summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Barkov <bar@mariadb.org>2017-02-02 08:21:42 +0400
committerAlexander Barkov <bar@mariadb.org>2017-02-02 08:21:42 +0400
commitd333e3ad9c877ce7540bd1cdaf78094fa0f273c4 (patch)
treed8314d20839872e0b71854ab84c7d4ae25e5dc6c
parent02a4bbb4128fbea05b503ebec4346c214e8e6c93 (diff)
parent8481c70ede067b576d5b1576a9b68042e84368fb (diff)
downloadmariadb-git-d333e3ad9c877ce7540bd1cdaf78094fa0f273c4.tar.gz
Merge remote-tracking branch 'origin/10.2' into bb-10.2-ext
-rw-r--r--CMakeLists.txt12
-rw-r--r--client/client_priv.h4
-rw-r--r--client/mysqlbinlog.cc252
-rw-r--r--cmake/lz4.cmake10
-rw-r--r--dbug/CMakeLists.txt4
-rw-r--r--extra/innochecksum.cc6
-rw-r--r--include/json_lib.h25
-rw-r--r--mysql-test/extra/binlog_tests/binlog_write_error.inc2
-rw-r--r--mysql-test/include/have_unzip.inc3
-rwxr-xr-xmysql-test/mysql-test-run.pl1
-rw-r--r--mysql-test/r/cast.result73
-rw-r--r--mysql-test/r/cte_nonrecursive.result12
-rw-r--r--mysql-test/r/cte_recursive.result65
-rw-r--r--mysql-test/r/default.result38
-rw-r--r--mysql-test/r/derived_cond_pushdown.result109
-rw-r--r--mysql-test/r/func_json.result56
-rw-r--r--mysql-test/r/gis-json.result66
-rw-r--r--mysql-test/r/keywords.result51
-rw-r--r--mysql-test/r/mysqld--help,win.rdiff28
-rw-r--r--mysql-test/r/mysqld--help.result11
-rw-r--r--mysql-test/r/partition_innodb_plugin.result10
-rw-r--r--mysql-test/r/ps.result23
-rw-r--r--mysql-test/r/set_statement.result8
-rw-r--r--mysql-test/r/sql_mode.result17
-rw-r--r--mysql-test/r/subselect_sj2.result13
-rw-r--r--mysql-test/r/subselect_sj2_jcl6.result13
-rw-r--r--mysql-test/r/subselect_sj2_mat.result13
-rw-r--r--mysql-test/r/trigger_null-8605.result10
-rw-r--r--mysql-test/r/win.result78
-rw-r--r--mysql-test/suite.pm2
-rw-r--r--mysql-test/suite/binlog/r/binlog_write_error.result4
-rw-r--r--mysql-test/suite/binlog/r/flashback.result480
-rw-r--r--mysql-test/suite/binlog/t/flashback-master.opt2
-rw-r--r--mysql-test/suite/binlog/t/flashback.test163
-rw-r--r--mysql-test/suite/binlog_encryption/binlog_row_annotate.combinations6
-rw-r--r--mysql-test/suite/binlog_encryption/binlog_write_error.result4
-rw-r--r--mysql-test/suite/binlog_encryption/mysqlbinlog.combinations6
-rw-r--r--mysql-test/suite/binlog_encryption/rpl_gtid_basic.combinations6
-rw-r--r--mysql-test/suite/encryption/disabled.def4
-rw-r--r--mysql-test/suite/encryption/r/innochecksum.result6
-rw-r--r--mysql-test/suite/encryption/r/innodb-bad-key-change.result4
-rw-r--r--mysql-test/suite/encryption/r/innodb-bad-key-change3.result4
-rw-r--r--mysql-test/suite/encryption/r/innodb-bad-key-change4.result10
-rw-r--r--mysql-test/suite/encryption/r/innodb-bad-key-change5.result10
-rw-r--r--mysql-test/suite/encryption/r/innodb-discard-import-change.result2
-rw-r--r--mysql-test/suite/encryption/r/innodb-discard-import.result2
-rw-r--r--mysql-test/suite/encryption/r/innodb-encryption-alter.result6
-rw-r--r--mysql-test/suite/encryption/r/innodb-encryption-disable.result6
-rw-r--r--mysql-test/suite/encryption/r/innodb-page_encryption-32k.result14
-rw-r--r--mysql-test/suite/encryption/r/innodb-page_encryption.result14
-rw-r--r--mysql-test/suite/encryption/r/innodb-page_encryption_compression.result14
-rw-r--r--mysql-test/suite/encryption/r/innodb-page_encryption_log_encryption.result14
-rw-r--r--mysql-test/suite/encryption/r/innodb_encryption-page-compression.result6
-rw-r--r--mysql-test/suite/encryption/r/innodb_encryption_discard_import.result2
-rw-r--r--mysql-test/suite/encryption/r/innodb_encryption_filekeys.result6
-rw-r--r--mysql-test/suite/encryption/r/innodb_encryption_is.result6
-rw-r--r--mysql-test/suite/encryption/r/innodb_encryption_row_compressed.result10
-rw-r--r--mysql-test/suite/encryption/r/innodb_encryption_tables.result10
-rw-r--r--mysql-test/suite/encryption/r/innodb_lotoftables.result24
-rw-r--r--mysql-test/suite/encryption/r/innodb_onlinealter_encryption.result6
-rw-r--r--mysql-test/suite/encryption/r/innodb_page_encryption_key_change.result10
-rw-r--r--mysql-test/suite/encryption/t/innochecksum.test6
-rw-r--r--mysql-test/suite/encryption/t/innodb-bad-key-change.test8
-rw-r--r--mysql-test/suite/encryption/t/innodb-bad-key-change3.test20
-rw-r--r--mysql-test/suite/encryption/t/innodb-bad-key-change4.test17
-rw-r--r--mysql-test/suite/encryption/t/innodb-bad-key-change5.test17
-rw-r--r--mysql-test/suite/encryption/t/innodb-discard-import-change.test13
-rw-r--r--mysql-test/suite/encryption/t/innodb-discard-import.test13
-rw-r--r--mysql-test/suite/encryption/t/innodb-encryption-alter.test8
-rw-r--r--mysql-test/suite/encryption/t/innodb-encryption-disable.test13
-rw-r--r--mysql-test/suite/encryption/t/innodb-page_encryption-32k.test18
-rw-r--r--mysql-test/suite/encryption/t/innodb-page_encryption.test20
-rw-r--r--mysql-test/suite/encryption/t/innodb-page_encryption_compression.test13
-rw-r--r--mysql-test/suite/encryption/t/innodb-page_encryption_log_encryption.test20
-rw-r--r--mysql-test/suite/encryption/t/innodb_encryption-page-compression.test9
-rw-r--r--mysql-test/suite/encryption/t/innodb_encryption_discard_import.test18
-rw-r--r--mysql-test/suite/encryption/t/innodb_encryption_filekeys.test9
-rw-r--r--mysql-test/suite/encryption/t/innodb_encryption_is.test14
-rw-r--r--mysql-test/suite/encryption/t/innodb_encryption_row_compressed.test17
-rw-r--r--mysql-test/suite/encryption/t/innodb_encryption_tables.test17
-rw-r--r--mysql-test/suite/encryption/t/innodb_onlinealter_encryption.test14
-rw-r--r--mysql-test/suite/encryption/t/innodb_page_encryption_key_change.test17
-rw-r--r--mysql-test/suite/encryption/t/innodb_scrub.opt2
-rw-r--r--mysql-test/suite/encryption/t/innodb_scrub_background.opt2
-rw-r--r--mysql-test/suite/galera/disabled.def3
-rw-r--r--mysql-test/suite/galera/r/create.result2
-rw-r--r--mysql-test/suite/galera/r/galera_forced_binlog_format.result4
-rw-r--r--mysql-test/suite/galera/r/galera_parallel_apply_lock_table.result2
-rw-r--r--mysql-test/suite/galera/r/galera_parallel_autoinc_largetrx.result3
-rw-r--r--mysql-test/suite/galera/r/galera_sbr.result4
-rw-r--r--mysql-test/suite/galera/r/galera_sbr_binlog.result4
-rw-r--r--mysql-test/suite/galera/r/galera_var_slave_threads.result9
-rw-r--r--mysql-test/suite/galera/t/galera_kill_applier.test2
-rw-r--r--mysql-test/suite/galera/t/galera_parallel_apply_lock_table.test2
-rw-r--r--mysql-test/suite/galera/t/galera_parallel_autoinc_largetrx.test3
-rw-r--r--mysql-test/suite/galera/t/galera_var_slave_threads.test9
-rw-r--r--mysql-test/suite/gcol/r/innodb_virtual_basic.result2
-rw-r--r--mysql-test/suite/innodb/include/dml_ops.inc82
-rw-r--r--mysql-test/suite/innodb/include/have_innodb_punchhole.inc4
-rw-r--r--mysql-test/suite/innodb/include/ibd_convert.pl25
-rw-r--r--mysql-test/suite/innodb/include/innodb_simulate_comp_failures.inc16
-rw-r--r--mysql-test/suite/innodb/include/innodb_wl6501_crash.inc14
-rw-r--r--mysql-test/suite/innodb/include/innodb_wl6501_crash_temp.inc4
-rw-r--r--mysql-test/suite/innodb/include/log_file_cleanup.inc16
-rw-r--r--mysql-test/suite/innodb/r/101_compatibility.result47
-rw-r--r--mysql-test/suite/innodb/r/alter_missing_tablespace.result34
-rw-r--r--mysql-test/suite/innodb/r/doublewrite.result2
-rw-r--r--mysql-test/suite/innodb/r/group_commit_crash.result1
-rw-r--r--mysql-test/suite/innodb/r/group_commit_crash_no_optimize_thread.result1
-rw-r--r--mysql-test/suite/innodb/r/innodb-16k.result17
-rw-r--r--mysql-test/suite/innodb/r/innodb-32k-crash.result210
-rw-r--r--mysql-test/suite/innodb/r/innodb-32k.result442
-rw-r--r--mysql-test/suite/innodb/r/innodb-64k-crash.result418
-rw-r--r--mysql-test/suite/innodb/r/innodb-64k.result2
-rw-r--r--mysql-test/suite/innodb/r/innodb-alter-discard.result28
-rw-r--r--mysql-test/suite/innodb/r/innodb-alter-tempfile.result4
-rw-r--r--mysql-test/suite/innodb/r/innodb-bug-14068765.result9
-rw-r--r--mysql-test/suite/innodb/r/innodb-bug-14084530.result11
-rw-r--r--mysql-test/suite/innodb/r/innodb-fk-virtual.result86
-rw-r--r--mysql-test/suite/innodb/r/innodb-index.result15
-rw-r--r--mysql-test/suite/innodb/r/innodb-page_compression_bzip2.result6
-rw-r--r--mysql-test/suite/innodb/r/innodb-page_compression_lz4.result6
-rw-r--r--mysql-test/suite/innodb/r/innodb-page_compression_lzma.result6
-rw-r--r--mysql-test/suite/innodb/r/innodb-page_compression_lzo.result6
-rw-r--r--mysql-test/suite/innodb/r/innodb-page_compression_snappy.result54
-rw-r--r--mysql-test/suite/innodb/r/innodb-page_compression_tables.result10
-rw-r--r--mysql-test/suite/innodb/r/innodb-page_compression_zip.result6
-rw-r--r--mysql-test/suite/innodb/r/innodb-trim.result20
-rw-r--r--mysql-test/suite/innodb/r/innodb-wl5522-1.result67
-rw-r--r--mysql-test/suite/innodb/r/innodb-wl5522-debug-zip.result43
-rw-r--r--mysql-test/suite/innodb/r/innodb-wl5522-debug.result10
-rw-r--r--mysql-test/suite/innodb/r/innodb-wl5522-zip.result34
-rw-r--r--mysql-test/suite/innodb/r/innodb-wl5522.result27
-rw-r--r--mysql-test/suite/innodb/r/innodb_blob_truncate.result6
-rw-r--r--mysql-test/suite/innodb/r/innodb_bug59641.result6
-rw-r--r--mysql-test/suite/innodb/r/innodb_monitor.result8
-rw-r--r--mysql-test/suite/innodb/r/innodb_prefix_index_restart_server.result9
-rw-r--r--mysql-test/suite/innodb/r/innodb_skip_innodb_is_tables.result8
-rw-r--r--mysql-test/suite/innodb/r/log_alter_table.result16
-rw-r--r--mysql-test/suite/innodb/r/log_corruption.result19
-rw-r--r--mysql-test/suite/innodb/r/log_file.result344
-rw-r--r--mysql-test/suite/innodb/r/log_file_name.result77
-rw-r--r--mysql-test/suite/innodb/r/log_file_name_debug.result8
-rw-r--r--mysql-test/suite/innodb/r/log_file_size.result54
-rw-r--r--mysql-test/suite/innodb/r/log_file_size_checkpoint.result4
-rw-r--r--mysql-test/suite/innodb/r/temp_table.result (renamed from mysql-test/suite/innodb_zip/r/wl6470_1.result)17
-rw-r--r--mysql-test/suite/innodb/r/temp_table_savepoint.result (renamed from mysql-test/suite/innodb_zip/r/wl6470_2.result)173
-rw-r--r--mysql-test/suite/innodb/r/temporary_table.result639
-rw-r--r--mysql-test/suite/innodb/r/temporary_table_optimization.result266
-rw-r--r--mysql-test/suite/innodb/r/xa_recovery.result3
-rw-r--r--mysql-test/suite/innodb/std_data/log_corruption.zipbin0 -> 94694 bytes
-rw-r--r--mysql-test/suite/innodb/std_data/log_corruption0.zipbin0 -> 1211 bytes
-rw-r--r--mysql-test/suite/innodb/std_data/log_corruption1.zipbin0 -> 1257 bytes
-rw-r--r--mysql-test/suite/innodb/std_data/log_corruption2.zipbin0 -> 1304 bytes
-rw-r--r--mysql-test/suite/innodb/std_data/log_corruption3.zipbin0 -> 1304 bytes
-rw-r--r--mysql-test/suite/innodb/std_data/log_corruption4.zipbin0 -> 1308 bytes
-rw-r--r--mysql-test/suite/innodb/std_data/log_corruption4a.zipbin0 -> 1310 bytes
-rw-r--r--mysql-test/suite/innodb/std_data/log_corruption5.zipbin0 -> 1308 bytes
-rw-r--r--mysql-test/suite/innodb/std_data/log_corruption6.zipbin0 -> 1311 bytes
-rw-r--r--mysql-test/suite/innodb/t/101_compatibility.test105
-rw-r--r--mysql-test/suite/innodb/t/alter_missing_tablespace.test58
-rw-r--r--mysql-test/suite/innodb/t/doublewrite.test46
-rw-r--r--mysql-test/suite/innodb/t/group_commit_crash.test2
-rw-r--r--mysql-test/suite/innodb/t/group_commit_crash_no_optimize_thread.test2
-rw-r--r--mysql-test/suite/innodb/t/innochecksum.opt2
-rw-r--r--mysql-test/suite/innodb/t/innodb-16k.test16
-rw-r--r--mysql-test/suite/innodb/t/innodb-32k-crash.test19
-rw-r--r--mysql-test/suite/innodb/t/innodb-32k.test35
-rw-r--r--mysql-test/suite/innodb/t/innodb-64k-crash.test19
-rw-r--r--mysql-test/suite/innodb/t/innodb-64k.test27
-rw-r--r--mysql-test/suite/innodb/t/innodb-alter-discard.test54
-rw-r--r--mysql-test/suite/innodb/t/innodb-alter-tempfile.test7
-rw-r--r--mysql-test/suite/innodb/t/innodb-bug-14068765.test14
-rw-r--r--mysql-test/suite/innodb/t/innodb-bug-14084530.test13
-rw-r--r--mysql-test/suite/innodb/t/innodb-fk-virtual.test61
-rw-r--r--mysql-test/suite/innodb/t/innodb-index.test17
-rw-r--r--mysql-test/suite/innodb/t/innodb-page_compression_bzip2.test9
-rw-r--r--mysql-test/suite/innodb/t/innodb-page_compression_lz4.test9
-rw-r--r--mysql-test/suite/innodb/t/innodb-page_compression_lzma.test9
-rw-r--r--mysql-test/suite/innodb/t/innodb-page_compression_lzo.test10
-rw-r--r--mysql-test/suite/innodb/t/innodb-page_compression_snappy.test35
-rw-r--r--mysql-test/suite/innodb/t/innodb-page_compression_tables.test10
-rw-r--r--mysql-test/suite/innodb/t/innodb-page_compression_zip.test9
-rw-r--r--mysql-test/suite/innodb/t/innodb-trim.opt1
-rw-r--r--mysql-test/suite/innodb/t/innodb-trim.test54
-rw-r--r--mysql-test/suite/innodb/t/innodb-wl5522-1.test76
-rw-r--r--mysql-test/suite/innodb/t/innodb-wl5522-debug-zip.test31
-rw-r--r--mysql-test/suite/innodb/t/innodb-wl5522-debug.test8
-rw-r--r--mysql-test/suite/innodb/t/innodb-wl5522-zip.test28
-rw-r--r--mysql-test/suite/innodb/t/innodb-wl5522.test24
-rw-r--r--mysql-test/suite/innodb/t/innodb_blob_truncate.test13
-rw-r--r--mysql-test/suite/innodb/t/innodb_bug59641.test31
-rw-r--r--mysql-test/suite/innodb/t/innodb_prefix_index_restart_server.test12
-rw-r--r--mysql-test/suite/innodb/t/log_alter_table.test51
-rw-r--r--mysql-test/suite/innodb/t/log_corruption.test149
-rw-r--r--mysql-test/suite/innodb/t/log_file.test262
-rw-r--r--mysql-test/suite/innodb/t/log_file_name.test267
-rw-r--r--mysql-test/suite/innodb/t/log_file_name_debug.test31
-rw-r--r--mysql-test/suite/innodb/t/log_file_size.test218
-rw-r--r--mysql-test/suite/innodb/t/log_file_size_checkpoint.test32
-rw-r--r--mysql-test/suite/innodb/t/temp_table.test (renamed from mysql-test/suite/innodb_zip/t/wl6470_1.test)30
-rw-r--r--mysql-test/suite/innodb/t/temp_table_savepoint.test (renamed from mysql-test/suite/innodb_zip/t/wl6470_2.test)191
-rw-r--r--mysql-test/suite/innodb/t/temporary_table.test445
-rw-r--r--mysql-test/suite/innodb/t/temporary_table_optimization.opt1
-rw-r--r--mysql-test/suite/innodb/t/temporary_table_optimization.test243
-rw-r--r--mysql-test/suite/innodb/t/xa_recovery.test22
-rw-r--r--mysql-test/suite/innodb_zip/include/innodb_temp_table_dml.inc40
-rw-r--r--mysql-test/suite/innodb_zip/include/innodb_wl6501_crash_stripped.inc144
-rw-r--r--mysql-test/suite/innodb_zip/include/innodb_wl6501_error.inc8
-rw-r--r--mysql-test/suite/innodb_zip/include/innodb_wl6501_scale.inc1
-rw-r--r--mysql-test/suite/innodb_zip/r/create_options.result24
-rw-r--r--mysql-test/suite/innodb_zip/r/innochecksum.result3
-rw-r--r--mysql-test/suite/innodb_zip/r/innochecksum_2.result4
-rw-r--r--mysql-test/suite/innodb_zip/r/innochecksum_3.result6
-rw-r--r--mysql-test/suite/innodb_zip/r/innodb-create-options.result870
-rw-r--r--mysql-test/suite/innodb_zip/r/innodb-zip.result9
-rw-r--r--mysql-test/suite/innodb_zip/r/innodb_bug36169.result4
-rw-r--r--mysql-test/suite/innodb_zip/r/innodb_bug52745.result8
-rw-r--r--mysql-test/suite/innodb_zip/r/innodb_bug53591.result8
-rw-r--r--mysql-test/suite/innodb_zip/r/innodb_bug56680.result6
-rw-r--r--mysql-test/suite/innodb_zip/r/innodb_index_large_prefix.result15
-rw-r--r--mysql-test/suite/innodb_zip/r/wl6501_crash_3.result39
-rw-r--r--mysql-test/suite/innodb_zip/r/wl6501_crash_4.result95
-rw-r--r--mysql-test/suite/innodb_zip/r/wl6501_crash_5.result75
-rw-r--r--mysql-test/suite/innodb_zip/r/wl6501_scale_1.result27
-rw-r--r--mysql-test/suite/innodb_zip/r/wl6915_1.result2079
-rw-r--r--mysql-test/suite/innodb_zip/t/create_options.test18
-rw-r--r--mysql-test/suite/innodb_zip/t/disabled.def14
-rw-r--r--mysql-test/suite/innodb_zip/t/innochecksum.opt1
-rw-r--r--mysql-test/suite/innodb_zip/t/innochecksum.test13
-rw-r--r--mysql-test/suite/innodb_zip/t/innochecksum_2.opt1
-rw-r--r--mysql-test/suite/innodb_zip/t/innochecksum_2.test3
-rw-r--r--mysql-test/suite/innodb_zip/t/innochecksum_3.test16
-rw-r--r--mysql-test/suite/innodb_zip/t/innodb-create-options.test561
-rw-r--r--mysql-test/suite/innodb_zip/t/innodb-zip.test17
-rw-r--r--mysql-test/suite/innodb_zip/t/innodb_bug36169.test8
-rw-r--r--mysql-test/suite/innodb_zip/t/innodb_bug36172.test8
-rw-r--r--mysql-test/suite/innodb_zip/t/innodb_bug52745.test8
-rw-r--r--mysql-test/suite/innodb_zip/t/innodb_bug53591.test7
-rw-r--r--mysql-test/suite/innodb_zip/t/innodb_bug56680.test6
-rw-r--r--mysql-test/suite/innodb_zip/t/innodb_index_large_prefix.test17
-rw-r--r--mysql-test/suite/innodb_zip/t/wl6501_crash_3.test1
-rw-r--r--mysql-test/suite/innodb_zip/t/wl6501_crash_4.test2
-rw-r--r--mysql-test/suite/innodb_zip/t/wl6501_crash_5.test1
-rw-r--r--mysql-test/suite/innodb_zip/t/wl6501_scale_1.test4
-rw-r--r--mysql-test/suite/innodb_zip/t/wl6560.test422
-rw-r--r--mysql-test/suite/innodb_zip/t/wl6915_1.test650
-rw-r--r--mysql-test/suite/json/r/json_no_table.result3622
-rw-r--r--mysql-test/suite/json/t/json_no_table.test2288
-rw-r--r--mysql-test/suite/parts/r/partition_repair_myisam.result12
-rw-r--r--mysql-test/suite/parts/t/partition_repair_myisam.test6
-rw-r--r--mysql-test/suite/rpl/r/rpl_gtid_crash.result1
-rw-r--r--mysql-test/suite/rpl/r/rpl_killed_ddl.result10
-rw-r--r--mysql-test/suite/rpl/t/rpl_gtid_crash.test5
-rw-r--r--mysql-test/suite/rpl/t/rpl_killed_ddl.test10
-rw-r--r--mysql-test/suite/sys_vars/r/innodb_force_recovery_crash_basic.result33
-rw-r--r--mysql-test/suite/sys_vars/r/innodb_monitor_disable_basic.result8
-rw-r--r--mysql-test/suite/sys_vars/r/innodb_monitor_enable_basic.result8
-rw-r--r--mysql-test/suite/sys_vars/r/innodb_monitor_reset_all_basic.result8
-rw-r--r--mysql-test/suite/sys_vars/r/innodb_monitor_reset_basic.result8
-rw-r--r--mysql-test/suite/sys_vars/r/innodb_use_trim_basic.result8
-rw-r--r--mysql-test/suite/sys_vars/r/sysvars_innodb,32bit.rdiff22
-rw-r--r--mysql-test/suite/sys_vars/r/sysvars_innodb.result34
-rw-r--r--mysql-test/suite/sys_vars/r/sysvars_server_embedded.result14
-rw-r--r--mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result18
-rw-r--r--mysql-test/suite/sys_vars/r/thread_pool_max_threads_basic.result10
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_force_recovery_crash_basic.test30
-rw-r--r--mysql-test/suite/vcol/disabled.def1
-rw-r--r--mysql-test/suite/wsrep/r/binlog_format.result10
-rw-r--r--mysql-test/suite/wsrep/t/binlog_format.test2
-rw-r--r--mysql-test/t/cast.test39
-rw-r--r--mysql-test/t/cte_nonrecursive.test12
-rw-r--r--mysql-test/t/cte_recursive.test12
-rw-r--r--mysql-test/t/default.test30
-rw-r--r--mysql-test/t/derived_cond_pushdown.test34
-rw-r--r--mysql-test/t/func_json.test20
-rw-r--r--mysql-test/t/gis-json.test28
-rw-r--r--mysql-test/t/keywords.test40
-rw-r--r--mysql-test/t/partition_innodb_plugin.test6
-rw-r--r--mysql-test/t/ps.test29
-rw-r--r--mysql-test/t/set_statement.test6
-rw-r--r--mysql-test/t/sql_mode.test14
-rw-r--r--mysql-test/t/subselect_sj2.test15
-rw-r--r--mysql-test/t/trigger_null-8605.test14
-rw-r--r--mysql-test/t/win.test66
-rw-r--r--mysql-test/unstable-tests144
-rw-r--r--mysys/my_malloc.c15
-rw-r--r--mysys_ssl/my_crypt.cc3
-rw-r--r--sql/item.cc91
-rw-r--r--sql/item.h79
-rw-r--r--sql/item_create.cc125
-rw-r--r--sql/item_func.h11
-rw-r--r--sql/item_geofunc.cc90
-rw-r--r--sql/item_geofunc.h34
-rw-r--r--sql/item_jsonfunc.cc400
-rw-r--r--sql/item_jsonfunc.h1
-rw-r--r--sql/item_sum.cc3
-rw-r--r--sql/item_sum.h4
-rw-r--r--sql/lex.h2
-rw-r--r--sql/log_event.cc418
-rw-r--r--sql/log_event.h76
-rw-r--r--sql/mysqld.cc36
-rw-r--r--sql/mysqld.h1
-rw-r--r--sql/opt_subselect.cc2
-rw-r--r--sql/share/errmsg-utf8.txt10
-rw-r--r--sql/spatial.cc781
-rw-r--r--sql/spatial.h39
-rw-r--r--sql/sql_base.cc17
-rw-r--r--sql/sql_class.cc8
-rw-r--r--sql/sql_class.h7
-rw-r--r--sql/sql_cte.cc6
-rw-r--r--sql/sql_derived.cc20
-rw-r--r--sql/sql_prepare.cc44
-rw-r--r--sql/sql_select.cc3
-rw-r--r--sql/sql_trigger.cc2
-rw-r--r--sql/sql_union.cc9
-rw-r--r--sql/sql_yacc.yy31
-rw-r--r--sql/sys_vars.cc18
-rw-r--r--storage/innobase/btr/btr0btr.cc7
-rw-r--r--storage/innobase/btr/btr0cur.cc28
-rw-r--r--storage/innobase/btr/btr0pcur.cc31
-rw-r--r--storage/innobase/btr/btr0scrub.cc9
-rw-r--r--storage/innobase/buf/buf0buf.cc85
-rw-r--r--storage/innobase/buf/buf0dblwr.cc271
-rw-r--r--storage/innobase/buf/buf0flu.cc4
-rw-r--r--storage/innobase/buf/buf0rea.cc2
-rw-r--r--storage/innobase/dict/dict0crea.cc104
-rw-r--r--storage/innobase/dict/dict0dict.cc111
-rw-r--r--storage/innobase/dict/dict0load.cc379
-rw-r--r--storage/innobase/dict/dict0mem.cc4
-rw-r--r--storage/innobase/fil/fil0crypt.cc8
-rw-r--r--storage/innobase/fil/fil0fil.cc1305
-rw-r--r--storage/innobase/fil/fil0pagecompress.cc38
-rw-r--r--storage/innobase/fsp/fsp0file.cc268
-rw-r--r--storage/innobase/fsp/fsp0fsp.cc1116
-rw-r--r--storage/innobase/fsp/fsp0space.cc13
-rw-r--r--storage/innobase/fsp/fsp0sysspace.cc4
-rw-r--r--storage/innobase/fts/fts0fts.cc11
-rw-r--r--storage/innobase/gis/gis0sea.cc18
-rw-r--r--storage/innobase/handler/ha_innodb.cc1571
-rw-r--r--storage/innobase/handler/ha_innodb.h82
-rw-r--r--storage/innobase/handler/ha_innopart.cc70
-rw-r--r--storage/innobase/handler/handler0alter.cc96
-rw-r--r--storage/innobase/handler/i_s.cc10
-rw-r--r--storage/innobase/ibuf/ibuf0ibuf.cc39
-rw-r--r--storage/innobase/include/buf0buf.h1
-rw-r--r--storage/innobase/include/buf0buf.ic3
-rw-r--r--storage/innobase/include/data0data.ic1
-rw-r--r--storage/innobase/include/db0err.h23
-rw-r--r--storage/innobase/include/dict0crea.h7
-rw-r--r--storage/innobase/include/dict0dict.h50
-rw-r--r--storage/innobase/include/dict0dict.ic157
-rw-r--r--storage/innobase/include/dict0load.h10
-rw-r--r--storage/innobase/include/dict0mem.h38
-rw-r--r--storage/innobase/include/dict0pagecompress.h13
-rw-r--r--storage/innobase/include/dict0pagecompress.ic76
-rw-r--r--storage/innobase/include/fil0fil.h266
-rw-r--r--storage/innobase/include/fil0fil.ic94
-rw-r--r--storage/innobase/include/fil0pagecompress.h11
-rw-r--r--storage/innobase/include/fsp0file.h47
-rw-r--r--storage/innobase/include/fsp0fsp.h301
-rw-r--r--storage/innobase/include/fsp0fsp.ic214
-rw-r--r--storage/innobase/include/fsp0pagecompress.h11
-rw-r--r--storage/innobase/include/fsp0pagecompress.ic26
-rw-r--r--storage/innobase/include/fsp0space.h26
-rw-r--r--storage/innobase/include/fsp0types.h297
-rw-r--r--storage/innobase/include/ha_prototypes.h3
-rw-r--r--storage/innobase/include/lock0lock.h3
-rw-r--r--storage/innobase/include/log0recv.h17
-rw-r--r--storage/innobase/include/mtr0mtr.h8
-rw-r--r--storage/innobase/include/mtr0types.h13
-rw-r--r--storage/innobase/include/os0api.h75
-rw-r--r--storage/innobase/include/os0file.h644
-rw-r--r--storage/innobase/include/os0file.ic10
-rw-r--r--storage/innobase/include/page0page.ic7
-rw-r--r--storage/innobase/include/page0size.h8
-rw-r--r--storage/innobase/include/que0que.h13
-rw-r--r--storage/innobase/include/row0merge.h4
-rw-r--r--storage/innobase/include/row0mysql.h8
-rw-r--r--storage/innobase/include/row0row.ic4
-rw-r--r--storage/innobase/include/srv0mon.h8
-rw-r--r--storage/innobase/include/srv0srv.h51
-rw-r--r--storage/innobase/include/srv0start.h21
-rw-r--r--storage/innobase/include/sync0sync.h1
-rw-r--r--storage/innobase/include/sync0types.h1
-rw-r--r--storage/innobase/include/univ.i6
-rw-r--r--storage/innobase/include/ut0mutex.h2
-rw-r--r--storage/innobase/include/ut0new.h13
-rw-r--r--storage/innobase/include/ut0timer.ic2
-rw-r--r--storage/innobase/innodb.cmake19
-rw-r--r--storage/innobase/lock/lock0lock.cc3
-rw-r--r--storage/innobase/log/log0crypt.cc11
-rw-r--r--storage/innobase/log/log0log.cc41
-rw-r--r--storage/innobase/log/log0recv.cc203
-rw-r--r--storage/innobase/mtr/mtr0mtr.cc80
-rw-r--r--storage/innobase/mysql-test/storage_engine/tbl_opt_key_block_size.opt3
-rw-r--r--storage/innobase/mysql-test/storage_engine/tbl_opt_row_format.opt3
-rw-r--r--storage/innobase/os/os0file.cc2244
-rw-r--r--storage/innobase/page/page0page.cc1
-rw-r--r--storage/innobase/page/page0zip.cc11
-rw-r--r--storage/innobase/que/que0que.cc19
-rw-r--r--storage/innobase/row/row0import.cc394
-rw-r--r--storage/innobase/row/row0log.cc2
-rw-r--r--storage/innobase/row/row0merge.cc35
-rw-r--r--storage/innobase/row/row0mysql.cc255
-rw-r--r--storage/innobase/row/row0quiesce.cc247
-rw-r--r--storage/innobase/row/row0sel.cc2
-rw-r--r--storage/innobase/row/row0trunc.cc137
-rw-r--r--storage/innobase/row/row0vers.cc13
-rw-r--r--storage/innobase/srv/srv0mon.cc64
-rw-r--r--storage/innobase/srv/srv0srv.cc79
-rw-r--r--storage/innobase/srv/srv0start.cc456
-rw-r--r--storage/innobase/sync/sync0arr.cc2
-rw-r--r--storage/innobase/sync/sync0debug.cc2
-rw-r--r--storage/innobase/sync/sync0rw.cc2
-rw-r--r--storage/innobase/sync/sync0sync.cc1
-rw-r--r--storage/innobase/trx/trx0purge.cc6
-rw-r--r--storage/innobase/trx/trx0rec.cc7
-rw-r--r--storage/innobase/trx/trx0sys.cc13
-rw-r--r--storage/innobase/ut/ut0ut.cc17
-rw-r--r--storage/xtradb/buf/buf0dblwr.cc236
-rw-r--r--storage/xtradb/dict/dict0load.cc20
-rw-r--r--storage/xtradb/fil/fil0fil.cc395
-rw-r--r--storage/xtradb/fsp/fsp0fsp.cc3
-rw-r--r--storage/xtradb/include/dict0dict.ic40
-rw-r--r--storage/xtradb/include/dict0pagecompress.h13
-rw-r--r--storage/xtradb/include/dict0pagecompress.ic88
-rw-r--r--storage/xtradb/include/fil0fil.h41
-rw-r--r--storage/xtradb/include/fil0pagecompress.h13
-rw-r--r--storage/xtradb/include/fsp0fsp.h437
-rw-r--r--storage/xtradb/include/fsp0fsp.ic153
-rw-r--r--storage/xtradb/include/fsp0pagecompress.h11
-rw-r--r--storage/xtradb/include/fsp0pagecompress.ic28
-rw-r--r--storage/xtradb/row/row0import.cc94
-rw-r--r--storage/xtradb/row/row0mysql.cc11
-rw-r--r--storage/xtradb/srv/srv0start.cc18
-rw-r--r--strings/json_lib.c214
437 files changed, 18328 insertions, 18921 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4f553bad5b4..be86adbf67b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -183,18 +183,18 @@ INCLUDE(check_compiler_flag)
OPTION(WITH_ASAN "Enable address sanitizer" OFF)
IF (WITH_ASAN)
# gcc 4.8.1 and new versions of clang
- MY_CHECK_AND_SET_COMPILER_FLAG("-fsanitize=address -O1 -Wno-error -fPIC"
+ MY_CHECK_AND_SET_COMPILER_FLAG("-fsanitize=address -fPIC"
DEBUG RELWITHDEBINFO)
- SET(HAVE_C_FSANITIZE ${HAVE_C__fsanitize_address__O1__Wno_error__fPIC})
- SET(HAVE_CXX_FSANITIZE ${HAVE_CXX__fsanitize_address__O1__Wno_error__fPIC})
+ SET(HAVE_C_FSANITIZE ${have_C__fsanitize_address__fPIC})
+ SET(HAVE_CXX_FSANITIZE ${have_CXX__fsanitize_address__fPIC})
IF(HAVE_C_FSANITIZE AND HAVE_CXX_FSANITIZE)
SET(WITH_ASAN_OK 1)
ELSE()
# older versions of clang
- MY_CHECK_AND_SET_COMPILER_FLAG("-faddress-sanitizer -O1 -fPIC"
+ MY_CHECK_AND_SET_COMPILER_FLAG("-faddress-sanitizer -fPIC"
DEBUG RELWITHDEBINFO)
- SET(HAVE_C_FADDRESS ${HAVE_C__faddress_sanitizer__O1__fPIC})
- SET(HAVE_CXX_FADDRESS ${HAVE_CXX__faddress_sanitizer__O1__fPIC})
+ SET(HAVE_C_FADDRESS ${have_C__faddress_sanitizer__fPIC})
+ SET(HAVE_CXX_FADDRESS ${have_CXX__faddress_sanitizer__fPIC})
IF(HAVE_C_FADDRESS AND HAVE_CXX_FADDRESS)
SET(WITH_ASAN_OK 1)
ENDIF()
diff --git a/client/client_priv.h b/client/client_priv.h
index 1d85791fa73..e96e187fb34 100644
--- a/client/client_priv.h
+++ b/client/client_priv.h
@@ -66,6 +66,10 @@ enum options_client
OPT_MYSQLDUMP_SLAVE_APPLY,
OPT_MYSQLDUMP_SLAVE_DATA,
OPT_MYSQLDUMP_INCLUDE_MASTER_HOST_PORT,
+#ifdef WHEN_FLASHBACK_REVIEW_READY
+ OPT_REVIEW,
+ OPT_REVIEW_DBNAME, OPT_REVIEW_TABLENAME,
+#endif
OPT_SLAP_CSV, OPT_SLAP_CREATE_STRING,
OPT_SLAP_AUTO_GENERATE_SQL_LOAD_TYPE, OPT_SLAP_AUTO_GENERATE_WRITE_NUM,
OPT_SLAP_AUTO_GENERATE_ADD_AUTO,
diff --git a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc
index 558dbebc89c..e2b121c27a7 100644
--- a/client/mysqlbinlog.cc
+++ b/client/mysqlbinlog.cc
@@ -66,6 +66,10 @@ Rpl_filter *binlog_filter= 0;
/* Needed for Rpl_filter */
CHARSET_INFO* system_charset_info= &my_charset_utf8_general_ci;
+/* Needed for Flashback */
+DYNAMIC_ARRAY binlog_events; // Storing the events output string
+String stop_event_string; // Storing the STOP_EVENT output string
+
char server_version[SERVER_VERSION_LENGTH];
ulong server_id = 0;
@@ -89,7 +93,7 @@ static const char *load_groups[]=
static void error(const char *format, ...) ATTRIBUTE_FORMAT(printf, 1, 2);
static void warning(const char *format, ...) ATTRIBUTE_FORMAT(printf, 1, 2);
-static bool one_database=0, to_last_remote_log= 0, disable_log_bin= 0;
+static bool one_database=0, one_table=0, to_last_remote_log= 0, disable_log_bin= 0;
static bool opt_hexdump= 0, opt_version= 0;
const char *base64_output_mode_names[]=
{"NEVER", "AUTO", "ALWAYS", "UNSPEC", "DECODE-ROWS", NullS};
@@ -99,6 +103,7 @@ TYPELIB base64_output_mode_typelib=
static enum_base64_output_mode opt_base64_output_mode= BASE64_OUTPUT_UNSPEC;
static char *opt_base64_output_mode_str= NullS;
static char* database= 0;
+static char* table= 0;
static my_bool force_opt= 0, short_form= 0, remote_opt= 0;
static my_bool debug_info_flag, debug_check_flag;
static my_bool force_if_open_opt= 1;
@@ -132,6 +137,12 @@ static MYSQL* mysql = NULL;
static const char* dirname_for_local_load= 0;
static bool opt_skip_annotate_row_events= 0;
+static my_bool opt_flashback;
+#ifdef WHEN_FLASHBACK_REVIEW_READY
+static my_bool opt_flashback_review;
+static char *flashback_review_dbname, *flashback_review_tablename;
+#endif
+
/**
Pointer to the Format_description_log_event of the currently active binlog.
@@ -791,6 +802,23 @@ print_skip_replication_statement(PRINT_EVENT_INFO *pinfo, const Log_event *ev)
}
/**
+ Indicates whether the given table should be filtered out,
+ according to the --table=X option.
+
+ @param log_tblname Name of table.
+
+ @return nonzero if the table with the given name should be
+ filtered out, 0 otherwise.
+*/
+static bool shall_skip_table(const char *log_tblname)
+{
+ return one_table &&
+ (log_tblname != NULL) &&
+ strcmp(log_tblname, table);
+}
+
+
+/**
Prints the given event in base64 format.
The header is printed to the head cache and the body is printed to
@@ -952,6 +980,12 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev,
Exit_status retval= OK_CONTINUE;
IO_CACHE *const head= &print_event_info->head_cache;
+ /* Bypass flashback settings to event */
+ ev->is_flashback= opt_flashback;
+#ifdef WHEN_FLASHBACK_REVIEW_READY
+ ev->need_flashback_review= opt_flashback_review;
+#endif
+
/*
Format events are not concerned by --offset and such, we always need to
read them to be able to process the wanted events.
@@ -988,7 +1022,7 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev,
retval= OK_STOP;
goto end;
}
- if (!short_form)
+ if (!short_form && !opt_flashback)
fprintf(result_file, "# at %s\n",llstr(pos,ll_buff));
if (!opt_hexdump)
@@ -1214,12 +1248,128 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev,
case TABLE_MAP_EVENT:
{
Table_map_log_event *map= ((Table_map_log_event *)ev);
- if (shall_skip_database(map->get_db_name()))
+ if (shall_skip_database(map->get_db_name()) ||
+ shall_skip_table(map->get_table_name()))
{
print_event_info->m_table_map_ignored.set_table(map->get_table_id(), map);
destroy_evt= FALSE;
goto end;
}
+#ifdef WHEN_FLASHBACK_REVIEW_READY
+ /* Create review table for Flashback */
+ if (opt_flashback_review)
+ {
+ // Check if the table was already created?
+ Table_map_log_event *exist_table;
+ exist_table= print_event_info->m_table_map.get_table(map->get_table_id());
+
+ if (!exist_table)
+ {
+
+ MYSQL *conn;
+ MYSQL_RES *res;
+ MYSQL_ROW row;
+ char tmp_sql[8096];
+ int tmp_sql_offset;
+
+ conn = mysql_init(NULL);
+ if (!mysql_real_connect(conn, host, user, pass,
+ map->get_db_name(), port, sock, 0))
+ {
+ fprintf(stderr, "%s\n", mysql_error(conn));
+ exit(1);
+ }
+
+ if (mysql_query(conn, "SET group_concat_max_len=10000;"))
+ {
+ fprintf(stderr, "%s\n", mysql_error(conn));
+ exit(1);
+ }
+
+ memset(tmp_sql, 0, sizeof(tmp_sql));
+ sprintf(tmp_sql, " "
+ "SELECT Group_concat(cols) "
+ "FROM (SELECT 'op_type char(1)' cols "
+ " UNION ALL "
+ " SELECT Concat('`', column_name, '_old` ', column_type, ' ', "
+ " IF(character_set_name IS NOT NULL, "
+ " Concat('character set ', character_set_name, ' '), ' '), "
+ " IF(collation_name IS NOT NULL, "
+ " Concat('collate ', collation_name, ' '), ' ')) cols "
+ " FROM information_schema.columns "
+ " WHERE table_schema = '%s' "
+ " AND table_name = '%s' "
+ " UNION ALL "
+ " SELECT Concat('`', column_name, '_new` ', column_type, ' ', "
+ " IF(character_set_name IS NOT NULL, "
+ " Concat('character set ', character_set_name, ' '), ' '), "
+ " IF(collation_name IS NOT NULL, "
+ " Concat('collate ', collation_name, ' '), ' ')) cols "
+ " FROM information_schema.columns "
+ " WHERE table_schema = '%s' "
+ " AND table_name = '%s') tmp;",
+ map->get_db_name(), map->get_table_name(),
+ map->get_db_name(), map->get_table_name());
+
+ if (mysql_query(conn, tmp_sql))
+ {
+ fprintf(stderr, "%s\n", mysql_error(conn));
+ exit(1);
+ }
+ res = mysql_use_result(conn);
+ if ((row = mysql_fetch_row(res)) != NULL) // only one row
+ {
+ if (flashback_review_dbname)
+ {
+ ev->set_flashback_review_dbname(flashback_review_dbname);
+ }
+ else
+ {
+ ev->set_flashback_review_dbname(map->get_db_name());
+ }
+ if (flashback_review_tablename)
+ {
+ ev->set_flashback_review_tablename(flashback_review_tablename);
+ }
+ else
+ {
+ memset(tmp_sql, 0, sizeof(tmp_sql));
+ sprintf(tmp_sql, "__%s", map->get_table_name());
+ ev->set_flashback_review_tablename(tmp_sql);
+ }
+ memset(tmp_sql, 0, sizeof(tmp_sql));
+ tmp_sql_offset= sprintf(tmp_sql, "CREATE TABLE IF NOT EXISTS");
+ tmp_sql_offset+= sprintf(tmp_sql + tmp_sql_offset, " `%s`.`%s` (%s) %s",
+ ev->get_flashback_review_dbname(),
+ ev->get_flashback_review_tablename(),
+ row[0],
+ print_event_info->delimiter);
+ }
+ fprintf(result_file, "%s\n", tmp_sql);
+ mysql_free_result(res);
+ mysql_close(conn);
+ }
+ else
+ {
+ char tmp_str[128];
+
+ if (flashback_review_dbname)
+ ev->set_flashback_review_dbname(flashback_review_dbname);
+ else
+ ev->set_flashback_review_dbname(map->get_db_name());
+
+ if (flashback_review_tablename)
+ ev->set_flashback_review_tablename(flashback_review_tablename);
+ else
+ {
+ memset(tmp_str, 0, sizeof(tmp_str));
+ sprintf(tmp_str, "__%s", map->get_table_name());
+ ev->set_flashback_review_tablename(tmp_str);
+ }
+ }
+ }
+#endif
+
/*
The Table map is to be printed, so it's just the time when we may
print the kept Annotate event (if there is any).
@@ -1294,6 +1444,38 @@ end:
*/
if (ev)
{
+ /* Holding event output if needed */
+ if (!ev->output_buf.is_empty())
+ {
+ LEX_STRING tmp_str;
+
+ tmp_str.length= ev->output_buf.length();
+ tmp_str.str= ev->output_buf.release();
+
+ if (opt_flashback)
+ {
+ if (ev_type == STOP_EVENT)
+ stop_event_string.reset(tmp_str.str, tmp_str.length, tmp_str.length,
+ &my_charset_bin);
+ else
+ {
+ if (push_dynamic(&binlog_events, (uchar *) &tmp_str))
+ {
+ error("Out of memory: can't allocate memory to store the flashback events.");
+ exit(1);
+ }
+ }
+ }
+ else
+ {
+ my_fwrite(result_file, (const uchar *) tmp_str.str, tmp_str.length,
+ MYF(MY_NABP));
+ my_free(tmp_str.str);
+ }
+ }
+
+ if (remote_opt)
+ ev->temp_buf= 0;
if (destroy_evt) /* destroy it later if not set (ignored table map) */
delete ev;
}
@@ -1352,6 +1534,13 @@ static struct my_option my_options[] =
"already have. NOTE: you will need a SUPER privilege to use this option.",
&disable_log_bin, &disable_log_bin, 0, GET_BOOL,
NO_ARG, 0, 0, 0, 0, 0, 0},
+ {"flashback", 'B', "Flashback feature can rollback you committed data to a special time point.",
+#ifdef WHEN_FLASHBACK_REVIEW_READY
+ "before Flashback feature writing a row, original row can insert to review-dbname.review-tablename,"
+ "and mysqlbinlog will login mysql by user(-u) and password(-p) and host(-h).",
+#endif
+ &opt_flashback, &opt_flashback, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
+ 0, 0},
{"force-if-open", 'F', "Force if binlog was not closed properly.",
&force_if_open_opt, &force_if_open_opt, 0, GET_BOOL, NO_ARG,
1, 0, 0, 0, 0, 0},
@@ -1395,6 +1584,19 @@ static struct my_option my_options[] =
"prefix for the file names.",
&result_file_name, &result_file_name, 0, GET_STR, REQUIRED_ARG,
0, 0, 0, 0, 0, 0},
+#ifdef WHEN_FLASHBACK_REVIEW_READY
+ {"review", opt_flashback_review, "Print review sql in output file.",
+ &opt_flashback_review, &opt_flashback_review, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
+ 0, 0},
+ {"review-dbname", opt_flashback_flashback_review_dbname,
+ "Writing flashback original row data into this db",
+ &flashback_review_dbname, &flashback_review_dbname,
+ 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ {"review-tablename", opt_flashback_flashback_review_tablename,
+ "Writing flashback original row data into this table",
+ &flashback_review_tablename, &flashback_review_tablename,
+ 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+#endif
{"server-id", 0,
"Extract only binlog entries created by the server having the given id.",
&server_id, &server_id, 0, GET_ULONG,
@@ -1458,6 +1660,9 @@ static struct my_option my_options[] =
&stop_position, &stop_position, 0, GET_ULL,
REQUIRED_ARG, (longlong)(~(my_off_t)0), BIN_LOG_HEADER_SIZE,
(ulonglong)(~(my_off_t)0), 0, 0, 0},
+ {"table", 'T', "List entries for just this table (local log only).",
+ &table, &table, 0, GET_STR_ALLOC, REQUIRED_ARG,
+ 0, 0, 0, 0, 0, 0},
{"to-last-log", 't', "Requires -R. Will not stop at the end of the \
requested binlog but rather continue printing until the end of the last \
binlog of the MySQL server. If you send the output to the same MySQL server, \
@@ -1567,6 +1772,7 @@ static void cleanup()
{
my_free(pass);
my_free(database);
+ my_free(table);
my_free(host);
my_free(user);
my_free(const_cast<char*>(dirname_for_local_load));
@@ -1637,6 +1843,9 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
break;
#endif
#include <sslopt-case.h>
+ case 'B':
+ opt_flashback= 1;
+ break;
case 'd':
one_database = 1;
break;
@@ -1658,10 +1867,18 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
case 'R':
remote_opt= 1;
break;
+ case 'T':
+ one_table= 1;
+ break;
case OPT_MYSQL_PROTOCOL:
opt_protocol= find_type_or_exit(argument, &sql_protocol_typelib,
opt->name);
break;
+#ifdef WHEN_FLASHBACK_REVIEW_READY
+ case opt_flashback_review:
+ opt_flashback_review= 1;
+ break;
+#endif
case OPT_START_DATETIME:
start_datetime= convert_str_to_timestamp(start_datetime_str);
break;
@@ -1862,7 +2079,7 @@ static Exit_status dump_log_entries(const char* logname)
dump_local_log_entries(&print_event_info, logname));
/* Set delimiter back to semicolon */
- if (!opt_raw_mode)
+ if (!opt_raw_mode && !opt_flashback)
fprintf(result_file, "DELIMITER ;\n");
strmov(print_event_info.delimiter, ";");
return rc;
@@ -2697,6 +2914,10 @@ int main(int argc, char** argv)
my_set_max_open_files(open_files_limit);
+ if (opt_flashback)
+ my_init_dynamic_array(&binlog_events, sizeof(LEX_STRING), 1024, 1024,
+ MYF(0));
+
if (opt_stop_never)
to_last_remote_log= TRUE;
@@ -2795,6 +3016,29 @@ int main(int argc, char** argv)
start_position= BIN_LOG_HEADER_SIZE;
}
+ /*
+ If enable flashback, need to print the events from the end to the
+ beginning
+ */
+ if (opt_flashback)
+ {
+ for (uint i= binlog_events.elements; i > 0; --i)
+ {
+ LEX_STRING *event_str= dynamic_element(&binlog_events, i - 1,
+ LEX_STRING*);
+ fprintf(result_file, "%s", event_str->str);
+ my_free(event_str->str);
+ }
+ fprintf(result_file, "COMMIT\n/*!*/;\n");
+ delete_dynamic(&binlog_events);
+ }
+
+ /* Set delimiter back to semicolon */
+ if (!stop_event_string.is_empty())
+ fprintf(result_file, "%s", stop_event_string.ptr());
+ if (!opt_raw_mode && opt_flashback)
+ fprintf(result_file, "DELIMITER ;\n");
+
if (!opt_raw_mode)
{
/*
diff --git a/cmake/lz4.cmake b/cmake/lz4.cmake
index 1607c68c5fb..075904589f0 100644
--- a/cmake/lz4.cmake
+++ b/cmake/lz4.cmake
@@ -19,9 +19,13 @@ MACRO (MYSQL_CHECK_LZ4)
IF (WITH_INNODB_LZ4 STREQUAL "ON" OR WITH_INNODB_LZ4 STREQUAL "AUTO")
CHECK_INCLUDE_FILES(lz4.h HAVE_LZ4_H)
CHECK_LIBRARY_EXISTS(lz4 LZ4_compress_limitedOutput "" HAVE_LZ4_SHARED_LIB)
+ CHECK_LIBRARY_EXISTS(lz4 LZ4_compress_default "" HAVE_LZ4_COMPRESS_DEFAULT)
IF (HAVE_LZ4_SHARED_LIB AND HAVE_LZ4_H)
ADD_DEFINITIONS(-DHAVE_LZ4=1)
+ IF (HAVE_LZ4_COMPRESS_DEFAULT)
+ ADD_DEFINITIONS(-DHAVE_LZ4_COMPRESS_DEFAULT=1)
+ ENDIF()
LINK_LIBRARIES(lz4)
ELSE()
IF (WITH_INNODB_LZ4 STREQUAL "ON")
@@ -35,9 +39,13 @@ MACRO (MYSQL_CHECK_LZ4_STATIC)
IF (WITH_INNODB_LZ4 STREQUAL "ON" OR WITH_INNODB_LZ4 STREQUAL "AUTO")
CHECK_INCLUDE_FILES(lz4.h HAVE_LZ4_H)
CHECK_LIBRARY_EXISTS(liblz4.a LZ4_compress_limitedOutput "" HAVE_LZ4_LIB)
+ CHECK_LIBRARY_EXISTS(liblz3.a LZ4_compress_default "" HAVE_LZ4_COMPRESS_DEFAULT)
IF(HAVE_LZ4_LIB AND HAVE_LZ4_H)
ADD_DEFINITIONS(-DHAVE_LZ4=1)
+ IF (HAVE_LZ4_COMPRESS_DEFAULT)
+ ADD_DEFINITIONS(-DHAVE_LZ4_COMPRESS_DEFAULT=1)
+ ENDIF()
LINK_LIBRARIES(liblz4.a)
ELSE()
IF (WITH_INNODB_LZ4 STREQUAL "ON")
@@ -45,4 +53,4 @@ MACRO (MYSQL_CHECK_LZ4_STATIC)
ENDIF()
ENDIF()
ENDIF()
-ENDMACRO() \ No newline at end of file
+ENDMACRO()
diff --git a/dbug/CMakeLists.txt b/dbug/CMakeLists.txt
index 014efdeb9a3..84d6f1ba723 100644
--- a/dbug/CMakeLists.txt
+++ b/dbug/CMakeLists.txt
@@ -58,13 +58,13 @@ IF(NOT WIN32 AND NOT CMAKE_GENERATOR MATCHES Xcode)
ADD_CUSTOM_COMMAND(OUTPUT user.ps
DEPENDS user.r ${OUTPUT_INC} ${SOURCE_INC}
COMMAND ${GROFF} -mm ${CMAKE_CURRENT_SOURCE_DIR}/user.r > user.ps || touch user.ps)
- ADD_CUSTOM_TARGET(user.ps ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/user.ps)
+ ADD_CUSTOM_TARGET(user_ps ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/user.ps)
ENDIF(GROFF)
IF(NROFF)
ADD_CUSTOM_COMMAND(OUTPUT user.t
DEPENDS user.r ${OUTPUT_INC} ${SOURCE_INC}
COMMAND ${NROFF} -mm ${CMAKE_CURRENT_SOURCE_DIR}/user.r > user.t || touch user.t)
- ADD_CUSTOM_TARGET(user.t ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/user.t)
+ ADD_CUSTOM_TARGET(user_t ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/user.t)
ENDIF(NROFF)
ENDIF()
diff --git a/extra/innochecksum.cc b/extra/innochecksum.cc
index 9d02a545cc5..393b1af062c 100644
--- a/extra/innochecksum.cc
+++ b/extra/innochecksum.cc
@@ -1346,10 +1346,8 @@ static struct my_option innochecksum_options[] = {
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"verbose", 'v', "Verbose (prints progress every 5 seconds).",
&verbose, &verbose, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
-#ifndef DBUG_OFF
{"debug", '#', "Output debug log. See " REFMAN "dbug-package.html",
&dbug_setting, &dbug_setting, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
-#endif /* !DBUG_OFF */
{"count", 'c', "Print the count of pages in the file and exits.",
&just_count, &just_count, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"start_page", 's', "Start on this page number (0 based).",
@@ -1381,7 +1379,7 @@ static struct my_option innochecksum_options[] = {
{"log", 'l', "log output.",
&log_filename, &log_filename, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
- {"leaf", 'l', "Examine leaf index pages",
+ {"leaf", 'e', "Examine leaf index pages",
&do_leaf, &do_leaf, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"merge", 'm', "leaf page count if merge given number of consecutive pages",
&n_merge, &n_merge, 0, GET_ULONG, REQUIRED_ARG, 0, 0, (longlong)10L, 0, 1, 0},
@@ -1411,7 +1409,7 @@ static void usage(void)
printf("Usage: %s [-c] [-s <start page>] [-e <end page>] "
"[-p <page>] [-v] [-a <allow mismatches>] [-n] "
"[-C <strict-check>] [-w <write>] [-S] [-D <page type dump>] "
- "[-l <log>] <filename or [-]>\n", my_progname);
+ "[-l <log>] [-e] <filename or [-]>\n", my_progname);
printf("See " REFMAN "innochecksum.html for usage hints.\n");
my_print_help(innochecksum_options);
my_print_variables(innochecksum_options);
diff --git a/include/json_lib.h b/include/json_lib.h
index ce7f27317bc..ddba571ac59 100644
--- a/include/json_lib.h
+++ b/include/json_lib.h
@@ -219,7 +219,7 @@ typedef struct st_json_engine_t
/* string constants. */
int stack[JSON_DEPTH_LIMIT]; /* Keeps the stack of nested JSON structures. */
- int *stack_p; /* The 'stack' pointer. */
+ int stack_p; /* The 'stack' pointer. */
} json_engine_t;
@@ -308,7 +308,7 @@ typedef const int *json_level_t;
*/
#define json_get_level(j) (j->stack_p)
-int json_skip_to_level(json_engine_t *j, json_level_t level);
+int json_skip_to_level(json_engine_t *j, int level);
/*
json_skip_level() works as above with just current structre.
@@ -391,6 +391,27 @@ int json_append_ascii(CHARSET_INFO *json_cs,
uchar *json, uchar *json_end,
const uchar *ascii, const uchar *ascii_end);
+
+/*
+ Scan the JSON and return paths met one-by-one.
+ json_get_path_start(&p)
+ while (json_get_path_next(&p))
+ {
+ handle_the_next_path();
+ }
+*/
+
+int json_get_path_start(json_engine_t *je, CHARSET_INFO *i_cs,
+ const uchar *str, const uchar *end,
+ json_path_t *p);
+
+
+int json_get_path_next(json_engine_t *je, json_path_t *p);
+
+
+int json_path_compare(const json_path_t *a, const json_path_t *b);
+
+
#ifdef __cplusplus
}
#endif
diff --git a/mysql-test/extra/binlog_tests/binlog_write_error.inc b/mysql-test/extra/binlog_tests/binlog_write_error.inc
index da66dbf5a95..fa3ba087a7e 100644
--- a/mysql-test/extra/binlog_tests/binlog_write_error.inc
+++ b/mysql-test/extra/binlog_tests/binlog_write_error.inc
@@ -71,7 +71,7 @@ source include/binlog_inject_error.inc;
let $query= DROP VIEW v1;
source include/binlog_inject_error.inc;
-let $query= CREATE PROCEDURE p1(OUT rows INT) SELECT count(*) INTO rows FROM t1;
+let $query= CREATE PROCEDURE p1(OUT rows_cnt INT) SELECT count(*) INTO rows_cnt FROM t1;
source include/binlog_inject_error.inc;
let $query= DROP PROCEDURE p1;
diff --git a/mysql-test/include/have_unzip.inc b/mysql-test/include/have_unzip.inc
new file mode 100644
index 00000000000..a3308524679
--- /dev/null
+++ b/mysql-test/include/have_unzip.inc
@@ -0,0 +1,3 @@
+#
+# empty. the real check happens in suite.pm
+#
diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl
index b3fe2d2f20a..1b6802e6b49 100755
--- a/mysql-test/mysql-test-run.pl
+++ b/mysql-test/mysql-test-run.pl
@@ -182,6 +182,7 @@ my @DEFAULT_SUITES= qw(
innodb_fts-
innodb_gis-
innodb_zip-
+ json-
maria-
multi_source-
optimizer_unfixed_bugs-
diff --git a/mysql-test/r/cast.result b/mysql-test/r/cast.result
index 2edacb6c7e9..1e39c03696f 100644
--- a/mysql-test/r/cast.result
+++ b/mysql-test/r/cast.result
@@ -583,7 +583,7 @@ show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`cast(1 as unsigned)` int(1) unsigned NOT NULL,
- `cast(1 as signed)` int(1) NOT NULL,
+ `cast(1 as signed)` int(2) NOT NULL,
`cast(1 as double(5,2))` double(5,2) DEFAULT NULL,
`cast(1 as decimal(5,3))` decimal(5,3) NOT NULL,
`cast("A" as binary)` varbinary(1) NOT NULL,
@@ -822,3 +822,74 @@ utf8_bin
select collation(cast("a" as char(10) binary ascii));
collation(cast("a" as char(10) binary ascii))
latin1_bin
+#
+# MDEV-11030 Assertion `precision > 0' failed in decimal_bin_size
+#
+SELECT * FROM (SELECT IFNULL(CONVERT(NULL, UNSIGNED), NULL)) sq;
+IFNULL(CONVERT(NULL, UNSIGNED), NULL)
+NULL
+CREATE TABLE t1 AS SELECT IFNULL(CONVERT(NULL, UNSIGNED), NULL);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `IFNULL(CONVERT(NULL, UNSIGNED), NULL)` decimal(1,0) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1;
+CREATE TABLE t1 AS SELECT COALESCE(CONVERT(NULL, UNSIGNED), NULL);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `COALESCE(CONVERT(NULL, UNSIGNED), NULL)` decimal(1,0) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1;
+CREATE TABLE t1 AS SELECT CASE WHEN TRUE THEN CONVERT(NULL, UNSIGNED) ELSE NULL END;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `CASE WHEN TRUE THEN CONVERT(NULL, UNSIGNED) ELSE NULL END` decimal(1,0) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1;
+CREATE TABLE t1 AS SELECT IFNULL(CONVERT(NULL,SIGNED),CONVERT(NULL,UNSIGNED)) AS a;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` decimal(1,0) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1;
+CREATE TABLE t1 AS SELECT
+-1,
+CONVERT(NULL,SIGNED),
+CONCAT(CONVERT(NULL,SIGNED)),
+1,
+CONVERT(NULL,UNSIGNED),
+CONCAT(CONVERT(NULL,UNSIGNED));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `-1` int(2) NOT NULL,
+ `CONVERT(NULL,SIGNED)` int(2) DEFAULT NULL,
+ `CONCAT(CONVERT(NULL,SIGNED))` varchar(2) DEFAULT NULL,
+ `1` int(1) NOT NULL,
+ `CONVERT(NULL,UNSIGNED)` int(1) unsigned DEFAULT NULL,
+ `CONCAT(CONVERT(NULL,UNSIGNED))` varchar(1) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1;
+CREATE TABLE t1 AS SELECT
+CONVERT('',SIGNED),
+CONCAT(CONVERT('',SIGNED)),
+CONVERT('',UNSIGNED),
+CONCAT(CONVERT('',UNSIGNED));
+Warnings:
+Warning 1292 Truncated incorrect INTEGER value: ''
+Warning 1292 Truncated incorrect INTEGER value: ''
+Warning 1292 Truncated incorrect INTEGER value: ''
+Warning 1292 Truncated incorrect INTEGER value: ''
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `CONVERT('',SIGNED)` int(2) NOT NULL,
+ `CONCAT(CONVERT('',SIGNED))` varchar(2) NOT NULL,
+ `CONVERT('',UNSIGNED)` int(1) unsigned NOT NULL,
+ `CONCAT(CONVERT('',UNSIGNED))` varchar(1) NOT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1;
diff --git a/mysql-test/r/cte_nonrecursive.result b/mysql-test/r/cte_nonrecursive.result
index 71bf617df0a..bd681dbb343 100644
--- a/mysql-test/r/cte_nonrecursive.result
+++ b/mysql-test/r/cte_nonrecursive.result
@@ -927,3 +927,15 @@ Sergei Golubchik Development DE
Claudio Nanni Support ES
Sergei Petrunia Development RU
drop table employees;
+#
+# MDEV-11818: EXPLAIN EXTENDED for a query with optimized away CTE table
+#
+CREATE TABLE t1 (i INT, c VARCHAR(3));
+INSERT INTO t1 VALUES (1,'foo');
+EXPLAIN EXTENDED
+WITH cte AS ( SELECT * FROM t1 ) SELECT i FROM cte;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 system NULL NULL NULL NULL 1 100.00
+Warnings:
+Note 1003 with cte as (select `test`.`t1`.`i` AS `i`,`test`.`t1`.`c` AS `c` from `test`.`t1`)select 1 AS `i` from dual
+DROP TABLE t1;
diff --git a/mysql-test/r/cte_recursive.result b/mysql-test/r/cte_recursive.result
index d5476aec1c4..20ca5c8f8cb 100644
--- a/mysql-test/r/cte_recursive.result
+++ b/mysql-test/r/cte_recursive.result
@@ -2343,3 +2343,68 @@ select id + 1, uuid() from data_generator where id < 150000
select * from data_generator
) as a;
drop table t1;
+#
+# MDEV-10773: ANALYZE for query with recursive CTE
+#
+analyze format=json
+with recursive src(counter) as
+(select 1
+union
+select counter+1 from src where counter<10
+) select * from src;
+ANALYZE
+{
+ "query_block": {
+ "select_id": 1,
+ "r_loops": 1,
+ "r_total_time_ms": "REPLACED",
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 2,
+ "r_rows": 10,
+ "r_total_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100,
+ "materialized": {
+ "query_block": {
+ "recursive_union": {
+ "table_name": "<union2,3>",
+ "access_type": "ALL",
+ "r_loops": 0,
+ "r_rows": null,
+ "query_specifications": [
+ {
+ "query_block": {
+ "select_id": 2,
+ "table": {
+ "message": "No tables used"
+ }
+ }
+ },
+ {
+ "query_block": {
+ "select_id": 3,
+ "r_loops": 10,
+ "r_total_time_ms": "REPLACED",
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "r_loops": 10,
+ "rows": 2,
+ "r_rows": 1,
+ "r_total_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 90,
+ "attached_condition": "src.counter < 10"
+ }
+ }
+ }
+ ]
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/mysql-test/r/default.result b/mysql-test/r/default.result
index 566b4314006..09fb673ac77 100644
--- a/mysql-test/r/default.result
+++ b/mysql-test/r/default.result
@@ -3269,6 +3269,44 @@ INSERT INTO t1 VALUES (1),(2),(3);
EXECUTE IMMEDIATE 'EXPLAIN EXTENDED SELECT * FROM t1 WHERE ?+a<=>?+a' USING DEFAULT,DEFAULT;
ERROR HY000: Default/ignore value is not supported for such parameter usage
DROP TABLE t1;
+#
+# MDEV-11134 Assertion `fixed' failed in Item::const_charset_converter(THD*, CHARSET_INFO*, bool, const char*)
+#
+SET NAMES utf8;
+PREPARE stmt FROM "CREATE OR REPLACE TABLE t1 (c CHAR(8) DEFAULT ?)";
+SET @a='';
+EXECUTE stmt USING @a;
+EXECUTE stmt USING @a;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c` char(8) DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1;
+SET @a='A';
+EXECUTE stmt USING @a;
+EXECUTE stmt USING @a;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c` char(8) DEFAULT 'A'
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1;
+SET @a=_utf8 0xC380;
+EXECUTE stmt USING @a;
+EXECUTE stmt USING @a;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c` char(8) DEFAULT 'À'
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1;
+SET @a=_utf8 0xD18F;
+EXECUTE stmt USING @a;
+ERROR 42000: Invalid default value for 'c'
+EXECUTE stmt USING @a;
+ERROR 42000: Invalid default value for 'c'
+DEALLOCATE PREPARE stmt;
# end of 10.2 test
set sql_mode=ansi_quotes;
create table t1 (a int, b int default (a+1));
diff --git a/mysql-test/r/derived_cond_pushdown.result b/mysql-test/r/derived_cond_pushdown.result
index 0be577a9f64..fd58ee038c7 100644
--- a/mysql-test/r/derived_cond_pushdown.result
+++ b/mysql-test/r/derived_cond_pushdown.result
@@ -8241,3 +8241,112 @@ SELECT * FROM v1 WHERE v1.d IN ( SELECT MIN(d) FROM t2 WHERE 0 );
d
DROP VIEW v1;
DROP TABLE t1,t2;
+#
+# MDEV-11820: second execution of PS for query
+# with false subquery predicate in WHERE
+#
+CREATE TABLE t1 (c VARCHAR(3)) ENGINE=MyISAM;
+INSERT INTO t1 VALUES ('foo'),('bar');
+CREATE ALGORITHM=TEMPTABLE VIEW v1 AS SELECT * FROM t1;
+CREATE TABLE t2 (a INT);
+INSERT INTO t2 VALUES (3), (4);
+PREPARE stmt1 FROM
+" SELECT * FROM v1 WHERE 1 IN (SELECT a FROM t2) OR c = 'foo'";
+PREPARE stmt2 FROM
+"EXPLAIN FORMAT=JSON
+ SELECT * FROM v1 WHERE 1 IN (SELECT a FROM t2) OR c = 'foo'";
+EXECUTE stmt1;
+c
+foo
+EXECUTE stmt2;
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "<derived3>",
+ "access_type": "ALL",
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "v1.c = 'foo'",
+ "materialized": {
+ "query_block": {
+ "select_id": 3,
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "t1.c = 'foo'"
+ }
+ }
+ }
+ },
+ "subqueries": [
+ {
+ "query_block": {
+ "select_id": 2,
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "1 = t2.a"
+ }
+ }
+ }
+ ]
+ }
+}
+INSERT INTO t2 SELECT a+1 FROM t2;
+INSERT INTO t2 SELECT a+1 FROM t2;
+INSERT INTO t2 SELECT a+1 FROM t2;
+INSERT INTO t2 SELECT a+1 FROM t2;
+INSERT INTO t2 SELECT a+1 FROM t2;
+INSERT INTO t2 SELECT a+1 FROM t2;
+EXECUTE stmt1;
+c
+foo
+EXECUTE stmt2;
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "<derived3>",
+ "access_type": "ALL",
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "<in_optimizer>(1,<exists>(subquery#2)) or v1.c = 'foo'",
+ "materialized": {
+ "query_block": {
+ "select_id": 3,
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 2,
+ "filtered": 100
+ }
+ }
+ }
+ },
+ "subqueries": [
+ {
+ "query_block": {
+ "select_id": 2,
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 128,
+ "filtered": 100,
+ "attached_condition": "1 = t2.a"
+ }
+ }
+ }
+ ]
+ }
+}
+DEALLOCATE PREPARE stmt1;
+DEALLOCATE PREPARE stmt2;
+DROP VIEW v1;
+DROP TABLE t1,t2;
diff --git a/mysql-test/r/func_json.result b/mysql-test/r/func_json.result
index 6c1987cc3e7..6968cf79d7d 100644
--- a/mysql-test/r/func_json.result
+++ b/mysql-test/r/func_json.result
@@ -212,6 +212,12 @@ json_extract('1', '$')
select json_extract('[10, 20, [30, 40], 1, 10]', '$[1]');
json_extract('[10, 20, [30, 40], 1, 10]', '$[1]')
20
+select json_extract('[10, 20, [30, 40], 1, 10]', '$[1]', '$[25]');
+json_extract('[10, 20, [30, 40], 1, 10]', '$[1]', '$[25]')
+[20]
+select json_extract( '[{"a": [3, 4]}, {"b": 2}]', '$[0].a', '$[1].a');
+json_extract( '[{"a": [3, 4]}, {"b": 2}]', '$[0].a', '$[1].a')
+[[3, 4]]
select json_insert('{"a":1, "b":{"c":1}, "d":[1, 2]}', '$.b.k1', 'word');
json_insert('{"a":1, "b":{"c":1}, "d":[1, 2]}', '$.b.k1', 'word')
{"a":1, "b":{"c":1, "k1":"word"}, "d":[1, 2]}
@@ -438,3 +444,53 @@ json CREATE TABLE `json` (
`j` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table json;
+select json_length( '[ 1, [ 2, 3, 4 ], 5 ]', '$[2]' );
+json_length( '[ 1, [ 2, 3, 4 ], 5 ]', '$[2]' )
+1
+select json_length( '[ 1, [ 2, 3, 4 ], 5 ]', '$[2][0]' );
+json_length( '[ 1, [ 2, 3, 4 ], 5 ]', '$[2][0]' )
+1
+select json_length( '[ 1, [ 2, 3, 4 ], 5 ]', '$[2][0][0]' );
+json_length( '[ 1, [ 2, 3, 4 ], 5 ]', '$[2][0][0]' )
+1
+select json_length( '[ 1, [ 2, 3, 4 ], 5 ]', '$[2][0][0][0]' );
+json_length( '[ 1, [ 2, 3, 4 ], 5 ]', '$[2][0][0][0]' )
+1
+select json_length( '[ 1, [ 2, 3, 4 ], {"a":5, "b":6} ]', '$[2]' );
+json_length( '[ 1, [ 2, 3, 4 ], {"a":5, "b":6} ]', '$[2]' )
+2
+select json_length( '[ 1, [ 2, 3, 4 ], {"a":5, "b":6} ]', '$[2][0]' );
+json_length( '[ 1, [ 2, 3, 4 ], {"a":5, "b":6} ]', '$[2][0]' )
+2
+select json_length( '[ 1, [ 2, 3, 4 ], {"a":5, "b":6} ]', '$[2][0][0]' );
+json_length( '[ 1, [ 2, 3, 4 ], {"a":5, "b":6} ]', '$[2][0][0]' )
+2
+select json_length( '[ 1, [ 2, 3, 4 ], {"a":5, "b":6} ]', '$[2][0][0][0]' );
+json_length( '[ 1, [ 2, 3, 4 ], {"a":5, "b":6} ]', '$[2][0][0][0]' )
+2
+select json_length( '{"a":{"b":{"d":1}}, "a":{"c":{"d":1, "j":2}}}', '$.a[0][0][0].c' );
+json_length( '{"a":{"b":{"d":1}}, "a":{"c":{"d":1, "j":2}}}', '$.a[0][0][0].c' )
+2
+select json_set('1', '$[0]', 100);
+json_set('1', '$[0]', 100)
+100
+select json_set('1', '$[0][0]', 100);
+json_set('1', '$[0][0]', 100)
+100
+select json_set('1', '$[1]', 100);
+json_set('1', '$[1]', 100)
+[1, 100]
+select json_set('{"a":12}', '$[0]', 100);
+json_set('{"a":12}', '$[0]', 100)
+100
+select json_set('{"a":12}', '$[0].a', 100);
+json_set('{"a":12}', '$[0].a', 100)
+{"a":100}
+select json_set('{"a":12}', '$[0][0].a', 100);
+json_set('{"a":12}', '$[0][0].a', 100)
+{"a":100}
+select json_set('{"a":12}', '$[0][1].a', 100);
+json_set('{"a":12}', '$[0][1].a', 100)
+NULL
+Warnings:
+Warning 4037 Unexpected end of JSON text in argument 1 to function 'json_set'
diff --git a/mysql-test/r/gis-json.result b/mysql-test/r/gis-json.result
new file mode 100644
index 00000000000..8625a5bfb74
--- /dev/null
+++ b/mysql-test/r/gis-json.result
@@ -0,0 +1,66 @@
+select st_asgeojson(geomfromtext('POINT(1 1)'));
+st_asgeojson(geomfromtext('POINT(1 1)'))
+{"type": "Point", "coordinates": [1, 1]}
+select st_asgeojson(geomfromtext('LINESTRING(10 10,20 10,20 20,10 20,10 10)'));
+st_asgeojson(geomfromtext('LINESTRING(10 10,20 10,20 20,10 20,10 10)'))
+{"type": "LineString", "coordinates": [[10, 10], [20, 10], [20, 20], [10, 20], [10, 10]]}
+select st_asgeojson(geomfromtext('POLYGON((10 10,20 10,20 20,10 20,10 10))'));
+st_asgeojson(geomfromtext('POLYGON((10 10,20 10,20 20,10 20,10 10))'))
+{"type": "Polygon", "coordinates": [[[10, 10], [20, 10], [20, 20], [10, 20], [10, 10]]]}
+select st_asgeojson(geomfromtext('MULTIPOLYGON(((10 10,20 10,20 20,10 20,10 10)))'));
+st_asgeojson(geomfromtext('MULTIPOLYGON(((10 10,20 10,20 20,10 20,10 10)))'))
+{"type": "MultiPolygon", "coordinates": [[[[10, 10], [20, 10], [20, 20], [10, 20], [10, 10]]]]}
+select st_asgeojson(geomfromtext('multilinestring((10 10,20 10,20 20,10 20,10 10))'));
+st_asgeojson(geomfromtext('multilinestring((10 10,20 10,20 20,10 20,10 10))'))
+{"type": "MultiLineString", "coordinates": [[[10, 10], [20, 10], [20, 20], [10, 20], [10, 10]]]}
+select st_asgeojson(geomfromtext('multipoint(10 10,20 10,20 20,10 20,10 10)'));
+st_asgeojson(geomfromtext('multipoint(10 10,20 10,20 20,10 20,10 10)'))
+{"type": "MultiPoint", "coordinates": [[10, 10], [20, 10], [20, 20], [10, 20], [10, 10]]}
+select st_asgeojson(st_geomfromtext('GEOMETRYCOLLECTION(POINT(100 0),LINESTRING(101 0,102 1))'));
+st_asgeojson(st_geomfromtext('GEOMETRYCOLLECTION(POINT(100 0),LINESTRING(101 0,102 1))'))
+{"type": "GeometryCollection", "geometries": [{"type": "Point", "coordinates": [100, 0]}, {"type": "LineString", "coordinates": [[101, 0], [102, 1]]}]}
+SELECT st_astext(st_geomfromgeojson('{"type":"point","coordinates":[1,2]}'));
+st_astext(st_geomfromgeojson('{"type":"point","coordinates":[1,2]}'))
+POINT(1 2)
+SELECT st_astext(st_geomfromgeojson('{"type":"LineString","coordinates":[[1,2],[4,5],[7,8]]}'));
+st_astext(st_geomfromgeojson('{"type":"LineString","coordinates":[[1,2],[4,5],[7,8]]}'))
+LINESTRING(1 2,4 5,7 8)
+SELECT st_astext(st_geomfromgeojson('{"type": "polygon", "coordinates": [[[10, 10], [20, 10], [20, 20], [10, 20], [10, 10]]]}'));
+st_astext(st_geomfromgeojson('{"type": "polygon", "coordinates": [[[10, 10], [20, 10], [20, 20], [10, 20], [10, 10]]]}'))
+POLYGON((10 10,20 10,20 20,10 20,10 10))
+SELECT st_astext(st_geomfromgeojson('{"type":"multipoint","coordinates":[[1,2],[4,5],[7,8]]}'));
+st_astext(st_geomfromgeojson('{"type":"multipoint","coordinates":[[1,2],[4,5],[7,8]]}'))
+MULTIPOINT(1 2,4 5,7 8)
+SELECT st_astext(st_geomfromgeojson('{"type": "multilinestring", "coordinates": [[[10, 10], [20, 10], [20, 20], [10, 20], [10, 10]]]}'));
+st_astext(st_geomfromgeojson('{"type": "multilinestring", "coordinates": [[[10, 10], [20, 10], [20, 20], [10, 20], [10, 10]]]}'))
+MULTILINESTRING((10 10,20 10,20 20,10 20,10 10))
+SELECT st_astext(st_geomfromgeojson('{"type": "multipolygon", "coordinates": [[[[10, 10], [20, 10], [20, 20], [10, 20], [10, 10]]]]}'));
+st_astext(st_geomfromgeojson('{"type": "multipolygon", "coordinates": [[[[10, 10], [20, 10], [20, 20], [10, 20], [10, 10]]]]}'))
+MULTIPOLYGON(((10 10,20 10,20 20,10 20,10 10)))
+SELECT st_astext(st_geomfromgeojson('{"type": "GeometryCollection", "geometries": [{"type": "Point","coordinates": [100.0, 0.0]}, {"type": "LineString","coordinates": [[101.0, 0.0],[102.0, 1.0]]}]}'));
+st_astext(st_geomfromgeojson('{"type": "GeometryCollection", "geometries": [{"type": "Point","coordinates": [100.0, 0.0]}, {"type": "LineString","coordinates": [[101.0, 0.0],[102.0, 1.0]]}]}'))
+GEOMETRYCOLLECTION(POINT(100 0),LINESTRING(101 0,102 1))
+SELECT st_astext(st_geomfromgeojson('{"type":"point"}'));
+st_astext(st_geomfromgeojson('{"type":"point"}'))
+NULL
+Warnings:
+Warning 4048 Incorrect GeoJSON format specified for st_geomfromgeojson function.
+SELECT st_astext(st_geomfromgeojson('{"type":"point"'));
+st_astext(st_geomfromgeojson('{"type":"point"'))
+NULL
+Warnings:
+Warning 4037 Unexpected end of JSON text in argument 1 to function 'st_geomfromgeojson'
+SELECT st_astext(st_geomfromgeojson('{"type""point"}'));
+st_astext(st_geomfromgeojson('{"type""point"}'))
+NULL
+Warnings:
+Warning 4038 Syntax error in JSON text in argument 1 to function 'st_geomfromgeojson' at position 7
+SELECT st_astext(st_geomfromgeojson('{ "type": "Feature", "geometry": { "type": "Point", "coordinates": [102.0, 0.5] } }'));
+st_astext(st_geomfromgeojson('{ "type": "Feature", "geometry": { "type": "Point", "coordinates": [102.0, 0.5] } }'))
+POINT(102 0.5)
+SELECT st_astext(st_geomfromgeojson('{ "type": "FeatureCollection", "features": [{ "type": "Feature", "geometry": { "type": "Point", "coordinates": [102.0, 0.5] }, "properties": { "prop0": "value0" } }]}'));
+st_astext(st_geomfromgeojson('{ "type": "FeatureCollection", "features": [{ "type": "Feature", "geometry": { "type": "Point", "coordinates": [102.0, 0.5] }, "properties": { "prop0": "value0" } }]}'))
+GEOMETRYCOLLECTION(POINT(102 0.5))
+#
+# End of 10.2 tests
+#
diff --git a/mysql-test/r/keywords.result b/mysql-test/r/keywords.result
index f5bf600dc40..8c510b712ce 100644
--- a/mysql-test/r/keywords.result
+++ b/mysql-test/r/keywords.result
@@ -276,6 +276,57 @@ ERROR HY000: Unknown system variable 'option'
set option option=1;
ERROR HY000: Unknown system variable 'option'
#
+# MDEV-9979 Keywords UNBOUNDED, PRECEDING, FOLLOWING, TIES, OTHERS should be non-reserved
+#
+CREATE TABLE EXCLUDE (EXCLUDE INT);
+SELECT EXCLUDE FROM EXCLUDE;
+EXCLUDE
+SELECT EXCLUDE EXCLUDE FROM EXCLUDE;
+EXCLUDE
+SELECT EXCLUDE AS EXCLUDE FROM EXCLUDE;
+EXCLUDE
+DROP TABLE EXCLUDE;
+CREATE TABLE UNBOUNDED (UNBOUNDED INT);
+SELECT UNBOUNDED FROM UNBOUNDED;
+UNBOUNDED
+SELECT UNBOUNDED UNBOUNDEX FROM UNBOUNDED;
+UNBOUNDEX
+SELECT UNBOUNDED AS UNBOUNDEX FROM UNBOUNDED;
+UNBOUNDEX
+DROP TABLE UNBOUNDED;
+CREATE TABLE PRECEDING (PRECEDING INT);
+SELECT PRECEDING FROM PRECEDING;
+PRECEDING
+SELECT PRECEDING PRECEDING FROM PRECEDING;
+PRECEDING
+SELECT PRECEDING AS PRECEDING FROM PRECEDING;
+PRECEDING
+DROP TABLE PRECEDING;
+CREATE TABLE FOLLOWING (FOLLOWING INT);
+SELECT FOLLOWING FROM FOLLOWING;
+FOLLOWING
+SELECT FOLLOWING FOLLOWING FROM FOLLOWING;
+FOLLOWING
+SELECT FOLLOWING AS FOLLOWING FROM FOLLOWING;
+FOLLOWING
+DROP TABLE FOLLOWING;
+CREATE TABLE TIES (TIES INT);
+SELECT TIES FROM TIES;
+TIES
+SELECT TIES TIES FROM TIES;
+TIES
+SELECT TIES AS TIES FROM TIES;
+TIES
+DROP TABLE TIES;
+CREATE TABLE OTHERS (OTHERS INT);
+SELECT OTHERS FROM OTHERS;
+OTHERS
+SELECT OTHERS OTHERS FROM OTHERS;
+OTHERS
+SELECT OTHERS AS OTHERS FROM OTHERS;
+OTHERS
+DROP TABLE OTHERS;
+#
# MDEV-10585 EXECUTE IMMEDIATE statement
#
CREATE TABLE immediate (immediate int);
diff --git a/mysql-test/r/mysqld--help,win.rdiff b/mysql-test/r/mysqld--help,win.rdiff
index 4d66e8bad60..77a1427d893 100644
--- a/mysql-test/r/mysqld--help,win.rdiff
+++ b/mysql-test/r/mysqld--help,win.rdiff
@@ -1,5 +1,5 @@
---- mysqld--help.result 2016-09-21 13:50:58.682767100 +0000
-+++ mysqld--help,win.reject 2016-09-21 13:57:57.494626000 +0000
+--- mysqld--help.result 2016-11-04 13:35:06.665881700 +0000
++++ mysqld--help,win.reject 2016-11-04 13:58:39.030512500 +0000
@@ -318,7 +318,6 @@
The number of segments in a key cache
-L, --language=name Client error messages in given language. May be given as
@@ -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
-@@ -517,6 +516,7 @@
+@@ -521,6 +520,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=#
-@@ -924,6 +924,9 @@
+@@ -931,6 +931,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.
-@@ -1036,6 +1039,10 @@
+@@ -1043,6 +1046,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
-@@ -1054,6 +1061,7 @@
+@@ -1061,6 +1068,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 @@
--standards-compliant-cte
Allow only standards compiant CTE
(Defaults to on; use --skip-standards-compliant-cte to disable.)
-@@ -1102,6 +1110,11 @@
+@@ -1109,6 +1117,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.
-@@ -1132,8 +1145,8 @@
+@@ -1139,8 +1152,8 @@
size, MySQL will 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
-@@ -1257,7 +1270,6 @@
+@@ -1264,7 +1277,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
-@@ -1324,6 +1336,7 @@
+@@ -1333,6 +1345,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
-@@ -1424,6 +1437,8 @@
+@@ -1434,6 +1447,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
-@@ -1448,6 +1463,7 @@
+@@ -1458,6 +1473,7 @@
slave-type-conversions
slow-launch-time 2
slow-query-log FALSE
@@ -101,7 +101,7 @@
sort-buffer-size 2097152
sql-mode NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
stack-trace TRUE
-@@ -1461,14 +1477,16 @@
+@@ -1471,14 +1487,16 @@
sync-relay-log 10000
sync-relay-log-info 10000
sysdate-is-now FALSE
@@ -114,7 +114,7 @@
tc-heuristic-recover OFF
thread-cache-size 151
thread-pool-idle-timeout 60
- thread-pool-max-threads 1000
+ thread-pool-max-threads 65536
+thread-pool-min-threads 1
+thread-pool-mode windows
thread-pool-oversubscribe 3
diff --git a/mysql-test/r/mysqld--help.result b/mysql-test/r/mysqld--help.result
index 203921ce08f..5938da489f7 100644
--- a/mysql-test/r/mysqld--help.result
+++ b/mysql-test/r/mysqld--help.result
@@ -208,6 +208,9 @@ The following options may be given as the first argument:
--extra-port=# Extra port number to use for tcp connections in a
one-thread-per-connection manner. 0 means don't use
another port
+ --flashback Setup the server to use flashback. This enables binary
+ log in row mode and will enable extra logging for DDL's
+ needed by flashback feature
--flush Flush MyISAM tables to disk between SQL commands
--flush-time=# A dedicated thread is created to flush all tables at the
given interval
@@ -461,6 +464,10 @@ The following options may be given as the first argument:
--max-seeks-for-key=#
Limit assumed max number of seeks when looking up rows
based on a key
+ --max-session-mem-used=#
+ Amount of memory a single user session is allowed to
+ allocate. This limits the value of the session variable
+ MEM_USED
--max-sort-length=# 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)
@@ -1229,6 +1236,7 @@ explicit-defaults-for-timestamp FALSE
external-locking FALSE
extra-max-connections 1
extra-port 0
+flashback FALSE
flush FALSE
flush-time 0
ft-boolean-syntax + -><()~*:""&|
@@ -1311,6 +1319,7 @@ max-prepared-stmt-count 16382
max-recursive-iterations 18446744073709551615
max-relay-log-size 1073741824
max-seeks-for-key 18446744073709551615
+max-session-mem-used 9223372036854775807
max-sort-length 1024
max-sp-recursion-depth 0
max-statement-time 0
@@ -1478,7 +1487,7 @@ table-open-cache-instances 8
tc-heuristic-recover OFF
thread-cache-size 151
thread-pool-idle-timeout 60
-thread-pool-max-threads 1000
+thread-pool-max-threads 65536
thread-pool-oversubscribe 3
thread-pool-prio-kickup-timer 1000
thread-pool-priority auto
diff --git a/mysql-test/r/partition_innodb_plugin.result b/mysql-test/r/partition_innodb_plugin.result
index cd5dfade0ab..28f5a1303ea 100644
--- a/mysql-test/r/partition_innodb_plugin.result
+++ b/mysql-test/r/partition_innodb_plugin.result
@@ -37,14 +37,10 @@ call mtr.add_suppression("InnoDB: Error: table `test`.`t1` .* InnoDB internal");
#
# Bug#55091: Server crashes on ADD PARTITION after a failed attempt
#
-SET @old_innodb_file_format = @@global.innodb_file_format;
SET @old_innodb_file_per_table = @@global.innodb_file_per_table;
SET @old_innodb_strict_mode = @@global.innodb_strict_mode;
-SET @@global.innodb_file_format = Barracuda,
-@@global.innodb_file_per_table = ON,
+SET @@global.innodb_file_per_table = ON,
@@global.innodb_strict_mode = ON;
-Warnings:
-Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
connect con1,localhost,root,,;
CREATE TABLE t1 (id INT NOT NULL
PRIMARY KEY,
@@ -106,9 +102,6 @@ DROP TABLE t1;
disconnect con2;
connection default;
SET @@global.innodb_strict_mode = @old_innodb_strict_mode;
-SET @@global.innodb_file_format = @old_innodb_file_format;
-Warnings:
-Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
SET @@global.innodb_file_per_table = @old_innodb_file_per_table;
SET NAMES utf8;
CREATE TABLE `t``\""e` (a INT, PRIMARY KEY (a))
@@ -160,4 +153,3 @@ ROLLBACK;
disconnect con1;
connection default;
DROP TABLE `t``\""e`;
-SET NAMES DEFAULT;
diff --git a/mysql-test/r/ps.result b/mysql-test/r/ps.result
index 5b7d4b6fa7f..6c0750e513a 100644
--- a/mysql-test/r/ps.result
+++ b/mysql-test/r/ps.result
@@ -4747,3 +4747,26 @@ INSERT INTO t1 VALUES (1),(2),(3);
EXECUTE IMMEDIATE 'EXPLAIN EXTENDED SELECT * FROM t1 WHERE ?+a<=>?+a' USING DEFAULT,DEFAULT;
ERROR HY000: Default/ignore value is not supported for such parameter usage
DROP TABLE t1;
+#
+# MDEV-11780 Crash with PREPARE + SP out parameter + literal
+#
+CREATE OR REPLACE PROCEDURE p1(OUT a INT)
+BEGIN
+SET a=10;
+END;
+$$
+PREPARE stmt FROM 'CALL p1(?)';
+EXECUTE stmt USING 10;
+ERROR 42000: OUT or INOUT argument 1 for routine test.p1 is not a variable or NEW pseudo-variable in BEFORE trigger
+EXECUTE stmt USING DEFAULT;
+ERROR 42000: OUT or INOUT argument 1 for routine test.p1 is not a variable or NEW pseudo-variable in BEFORE trigger
+EXECUTE stmt USING IGNORE;
+ERROR 42000: OUT or INOUT argument 1 for routine test.p1 is not a variable or NEW pseudo-variable in BEFORE trigger
+DEALLOCATE PREPARE stmt;
+EXECUTE IMMEDIATE 'CALL p1(?)' USING 10;
+ERROR 42000: OUT or INOUT argument 1 for routine test.p1 is not a variable or NEW pseudo-variable in BEFORE trigger
+EXECUTE IMMEDIATE 'CALL p1(?)' USING DEFAULT;
+ERROR 42000: OUT or INOUT argument 1 for routine test.p1 is not a variable or NEW pseudo-variable in BEFORE trigger
+EXECUTE IMMEDIATE 'CALL p1(?)' USING IGNORE;
+ERROR 42000: OUT or INOUT argument 1 for routine test.p1 is not a variable or NEW pseudo-variable in BEFORE trigger
+DROP PROCEDURE p1;
diff --git a/mysql-test/r/set_statement.result b/mysql-test/r/set_statement.result
index 4cb143f6ba5..91b8aa6fe59 100644
--- a/mysql-test/r/set_statement.result
+++ b/mysql-test/r/set_statement.result
@@ -652,7 +652,9 @@ v1 v2
3 4
ALTER TABLE t1 ADD COLUMN v3 int;
execute stmt;
-ERROR 42000: You 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
+v1 v2 v3
+1 2 NULL
+3 4 NULL
ALTER TABLE t1 drop COLUMN v3;
deallocate prepare stmt;
''
@@ -670,7 +672,9 @@ v1 v2
3 4
ALTER TABLE t1 ADD COLUMN v3 int;
execute stmt;
-ERROR 42000: You 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
+v1 v2 v3
+1 2 NULL
+3 4 NULL
ALTER TABLE t1 drop COLUMN v3;
deallocate prepare stmt;
SELECT @@sql_mode;
diff --git a/mysql-test/r/sql_mode.result b/mysql-test/r/sql_mode.result
index 782ae00bb33..04935a4a268 100644
--- a/mysql-test/r/sql_mode.result
+++ b/mysql-test/r/sql_mode.result
@@ -742,3 +742,20 @@ DROP FUNCTION test_function;
SET @@sql_mode= @org_mode;
#End of Test for Bug#12601974
+#
+# MDEV-11848 Automatic statement repreparation changes query semantics
+#
+SET sql_mode=DEFAULT;
+CREATE OR REPLACE TABLE t1 (a TEXT);
+PREPARE stmt FROM 'INSERT INTO t1 (a) VALUES (2||3)';
+EXECUTE stmt;
+SET sql_mode=ORACLE;
+EXECUTE stmt;
+ALTER TABLE t1 ADD b INT;
+EXECUTE stmt;
+SELECT * FROM t1;
+a b
+1 NULL
+1 NULL
+1 NULL
+DROP TABLE t1;
diff --git a/mysql-test/r/subselect_sj2.result b/mysql-test/r/subselect_sj2.result
index 8f37c09efcf..948be5766a2 100644
--- a/mysql-test/r/subselect_sj2.result
+++ b/mysql-test/r/subselect_sj2.result
@@ -1318,5 +1318,18 @@ id
1
2
drop table t1,t2,t3;
+#
+# MDEV-11108: Assertion `uniq_tuple_length_arg <= table->file->max_key_length()' failed in SJ_TMP_TABLE::create_sj_weedout_tmp_table
+#
+CREATE TABLE t1 (a INT) ENGINE=InnoDB;
+CREATE TABLE t2 (pk BLOB, b INT, PRIMARY KEY(pk(1000))) ENGINE=InnoDB;
+CREATE TABLE t3 (c INT) ENGINE=InnoDB;
+CREATE OR REPLACE ALGORITHM=MERGE VIEW v3 AS SELECT * FROM t3;
+INSERT INTO t3 VALUES (1),(2),(3),(4),(5),(6),(7),(8);
+SELECT * FROM t1, t2
+WHERE a IN ( SELECT b FROM t2 LEFT JOIN v3 ON ( c = b ) ) ;
+a pk b
+DROP TABLE t1,t2,t3;
+DROP VIEW v3;
# This must be the last in the file:
set optimizer_switch=@subselect_sj2_tmp;
diff --git a/mysql-test/r/subselect_sj2_jcl6.result b/mysql-test/r/subselect_sj2_jcl6.result
index 021646a7599..61519234f44 100644
--- a/mysql-test/r/subselect_sj2_jcl6.result
+++ b/mysql-test/r/subselect_sj2_jcl6.result
@@ -1333,6 +1333,19 @@ id
1
2
drop table t1,t2,t3;
+#
+# MDEV-11108: Assertion `uniq_tuple_length_arg <= table->file->max_key_length()' failed in SJ_TMP_TABLE::create_sj_weedout_tmp_table
+#
+CREATE TABLE t1 (a INT) ENGINE=InnoDB;
+CREATE TABLE t2 (pk BLOB, b INT, PRIMARY KEY(pk(1000))) ENGINE=InnoDB;
+CREATE TABLE t3 (c INT) ENGINE=InnoDB;
+CREATE OR REPLACE ALGORITHM=MERGE VIEW v3 AS SELECT * FROM t3;
+INSERT INTO t3 VALUES (1),(2),(3),(4),(5),(6),(7),(8);
+SELECT * FROM t1, t2
+WHERE a IN ( SELECT b FROM t2 LEFT JOIN v3 ON ( c = b ) ) ;
+a pk b
+DROP TABLE t1,t2,t3;
+DROP VIEW v3;
# This must be the last in the file:
set optimizer_switch=@subselect_sj2_tmp;
#
diff --git a/mysql-test/r/subselect_sj2_mat.result b/mysql-test/r/subselect_sj2_mat.result
index 46da52fe0eb..a06742241cf 100644
--- a/mysql-test/r/subselect_sj2_mat.result
+++ b/mysql-test/r/subselect_sj2_mat.result
@@ -1320,6 +1320,19 @@ id
1
2
drop table t1,t2,t3;
+#
+# MDEV-11108: Assertion `uniq_tuple_length_arg <= table->file->max_key_length()' failed in SJ_TMP_TABLE::create_sj_weedout_tmp_table
+#
+CREATE TABLE t1 (a INT) ENGINE=InnoDB;
+CREATE TABLE t2 (pk BLOB, b INT, PRIMARY KEY(pk(1000))) ENGINE=InnoDB;
+CREATE TABLE t3 (c INT) ENGINE=InnoDB;
+CREATE OR REPLACE ALGORITHM=MERGE VIEW v3 AS SELECT * FROM t3;
+INSERT INTO t3 VALUES (1),(2),(3),(4),(5),(6),(7),(8);
+SELECT * FROM t1, t2
+WHERE a IN ( SELECT b FROM t2 LEFT JOIN v3 ON ( c = b ) ) ;
+a pk b
+DROP TABLE t1,t2,t3;
+DROP VIEW v3;
# This must be the last in the file:
set optimizer_switch=@subselect_sj2_tmp;
set optimizer_switch=default;
diff --git a/mysql-test/r/trigger_null-8605.result b/mysql-test/r/trigger_null-8605.result
index b187fc19554..10315988708 100644
--- a/mysql-test/r/trigger_null-8605.result
+++ b/mysql-test/r/trigger_null-8605.result
@@ -354,3 +354,13 @@ show columns from t1;
Field Type Null Key Default Extra
a int(11) NO PRI NULL
drop table t1;
+create table t1 (
+pk int primary key,
+i int,
+v1 int as (i) virtual,
+v2 int as (i) virtual
+);
+create trigger tr before update on t1 for each row set @a = 1;
+insert into t1 (pk, i) values (null, null);
+ERROR 23000: Column 'pk' cannot be null
+drop table t1;
diff --git a/mysql-test/r/win.result b/mysql-test/r/win.result
index c8c55b91016..0606737c3ef 100644
--- a/mysql-test/r/win.result
+++ b/mysql-test/r/win.result
@@ -2382,3 +2382,81 @@ pk c CNT
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)
+2
+1
+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;
diff --git a/mysql-test/suite.pm b/mysql-test/suite.pm
index f501e610e53..134a0d6d438 100644
--- a/mysql-test/suite.pm
+++ b/mysql-test/suite.pm
@@ -68,6 +68,8 @@ sub skip_combinations {
unless $::mysqld_variables{'version-ssl-library'} =~ /OpenSSL (\S+)/
and $1 ge "1.0.1d";
+ $skip{'include/have_unzip.inc'} = 'no unzip executable' unless `unzip`;
+
%skip;
}
diff --git a/mysql-test/suite/binlog/r/binlog_write_error.result b/mysql-test/suite/binlog/r/binlog_write_error.result
index 28cffb3a8e5..2606a9f40b3 100644
--- a/mysql-test/suite/binlog/r/binlog_write_error.result
+++ b/mysql-test/suite/binlog/r/binlog_write_error.result
@@ -59,8 +59,8 @@ DROP VIEW v1;
ERROR HY000: Error writing file 'master-bin' ((errno: #)
SET GLOBAL debug_dbug='';
SET GLOBAL debug_dbug='d,injecting_fault_writing';
-CREATE PROCEDURE p1(OUT rows INT) SELECT count(*) INTO rows FROM t1;
-CREATE PROCEDURE p1(OUT rows INT) SELECT count(*) INTO rows FROM t1;
+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='d,injecting_fault_writing';
diff --git a/mysql-test/suite/binlog/r/flashback.result b/mysql-test/suite/binlog/r/flashback.result
new file mode 100644
index 00000000000..94833c5224a
--- /dev/null
+++ b/mysql-test/suite/binlog/r/flashback.result
@@ -0,0 +1,480 @@
+#
+# Preparatory cleanup.
+#
+DROP TABLE IF EXISTS t1;
+#
+# We need a fixed timestamp to avoid varying results.
+#
+SET timestamp=1000000000;
+#
+# Delete all existing binary logs.
+#
+RESET MASTER;
+CREATE TABLE t1 (
+c01 tinyint,
+c02 smallint,
+c03 mediumint,
+c04 int,
+c05 bigint,
+c06 char(10),
+c07 varchar(20),
+c08 TEXT
+) ENGINE=InnoDB;
+#
+# Insert data to t1
+#
+INSERT INTO t1 VALUES(0,0,0,0,0,'','','');
+INSERT INTO t1 VALUES(1,2,3,4,5, "abc", "abcdefg", "abcedfghijklmnopqrstuvwxyz");
+INSERT INTO t1 VALUES(127, 32767, 8388607, 2147483647, 9223372036854775807, repeat('a', 10), repeat('a', 20), repeat('a', 255));
+#
+# Update t1
+#
+UPDATE t1 SET c01=100 WHERE c02=0 OR c03=3;
+#
+# Clear t1
+#
+DELETE FROM t1;
+FLUSH LOGS;
+#
+# Show mysqlbinlog result without -B
+#
+/*!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*/;
+DELIMITER /*!*/;
+# at #
+#010909 9:46:40 server id 1 end_log_pos # CRC32 XXX Start: binlog v 4, server v #.##.## created 010909 9:46:40 at startup
+ROLLBACK/*!*/;
+# at #
+#010909 9:46:40 server id 1 end_log_pos # CRC32 XXX Gtid list []
+# at #
+#010909 9:46:40 server id 1 end_log_pos # CRC32 XXX Binlog checkpoint master-bin.000001
+# at #
+#010909 9:46:40 server id 1 end_log_pos # CRC32 XXX GTID 0-1-1 ddl
+/*!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=1*//*!*/;
+# at #
+#010909 9:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0
+use `test`/*!*/;
+SET TIMESTAMP=1000000000/*!*/;
+SET @@session.pseudo_thread_id=#/*!*/;
+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=1342177280/*!*/;
+SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
+/*!\C latin1 *//*!*/;
+SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
+SET @@session.lc_time_names=0/*!*/;
+SET @@session.collation_database=DEFAULT/*!*/;
+CREATE TABLE t1 (
+c01 tinyint,
+c02 smallint,
+c03 mediumint,
+c04 int,
+c05 bigint,
+c06 char(10),
+c07 varchar(20),
+c08 TEXT
+) ENGINE=InnoDB
+/*!*/;
+# at #
+#010909 9:46:40 server id 1 end_log_pos # CRC32 XXX GTID 0-1-2 trans
+/*!100001 SET @@session.gtid_seq_no=2*//*!*/;
+BEGIN
+/*!*/;
+# at #
+#010909 9:46:40 server id 1 end_log_pos # CRC32 XXX Table_map: `test`.`t1` mapped to number #
+# at #
+#010909 9:46:40 server id 1 end_log_pos # CRC32 XXX Write_rows: table id # flags: STMT_END_F
+### INSERT INTO `test`.`t1`
+### SET
+### @1=0 /* TINYINT meta=0 nullable=1 is_null=0 */
+### @2=0 /* SHORTINT meta=0 nullable=1 is_null=0 */
+### @3=0 /* MEDIUMINT meta=0 nullable=1 is_null=0 */
+### @4=0 /* INT meta=0 nullable=1 is_null=0 */
+### @5=0 /* LONGINT meta=0 nullable=1 is_null=0 */
+### @6='' /* STRING(10) meta=65034 nullable=1 is_null=0 */
+### @7='' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
+### @8='' /* BLOB/TEXT meta=2 nullable=1 is_null=0 */
+# at #
+#010909 9:46:40 server id 1 end_log_pos # CRC32 XXX Xid = #
+COMMIT/*!*/;
+# at #
+#010909 9:46:40 server id 1 end_log_pos # CRC32 XXX GTID 0-1-3 trans
+/*!100001 SET @@session.gtid_seq_no=3*//*!*/;
+BEGIN
+/*!*/;
+# at #
+#010909 9:46:40 server id 1 end_log_pos # CRC32 XXX Table_map: `test`.`t1` mapped to number #
+# at #
+#010909 9:46:40 server id 1 end_log_pos # CRC32 XXX Write_rows: table id # flags: STMT_END_F
+### INSERT INTO `test`.`t1`
+### SET
+### @1=1 /* TINYINT meta=0 nullable=1 is_null=0 */
+### @2=2 /* SHORTINT meta=0 nullable=1 is_null=0 */
+### @3=3 /* MEDIUMINT meta=0 nullable=1 is_null=0 */
+### @4=4 /* INT meta=0 nullable=1 is_null=0 */
+### @5=5 /* LONGINT meta=0 nullable=1 is_null=0 */
+### @6='abc' /* STRING(10) meta=65034 nullable=1 is_null=0 */
+### @7='abcdefg' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
+### @8='abcedfghijklmnopqrstuvwxyz' /* BLOB/TEXT meta=2 nullable=1 is_null=0 */
+# at #
+#010909 9:46:40 server id 1 end_log_pos # CRC32 XXX Xid = #
+COMMIT/*!*/;
+# at #
+#010909 9:46:40 server id 1 end_log_pos # CRC32 XXX GTID 0-1-4 trans
+/*!100001 SET @@session.gtid_seq_no=4*//*!*/;
+BEGIN
+/*!*/;
+# at #
+#010909 9:46:40 server id 1 end_log_pos # CRC32 XXX Table_map: `test`.`t1` mapped to number #
+# at #
+#010909 9:46:40 server id 1 end_log_pos # CRC32 XXX Write_rows: table id # flags: STMT_END_F
+### INSERT INTO `test`.`t1`
+### SET
+### @1=127 /* TINYINT meta=0 nullable=1 is_null=0 */
+### @2=32767 /* SHORTINT meta=0 nullable=1 is_null=0 */
+### @3=8388607 /* MEDIUMINT meta=0 nullable=1 is_null=0 */
+### @4=2147483647 /* INT meta=0 nullable=1 is_null=0 */
+### @5=9223372036854775807 /* LONGINT meta=0 nullable=1 is_null=0 */
+### @6='aaaaaaaaaa' /* STRING(10) meta=65034 nullable=1 is_null=0 */
+### @7='aaaaaaaaaaaaaaaaaaaa' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
+### @8='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' /* BLOB/TEXT meta=2 nullable=1 is_null=0 */
+# at #
+#010909 9:46:40 server id 1 end_log_pos # CRC32 XXX Xid = #
+COMMIT/*!*/;
+# at #
+#010909 9:46:40 server id 1 end_log_pos # CRC32 XXX GTID 0-1-5 trans
+/*!100001 SET @@session.gtid_seq_no=5*//*!*/;
+BEGIN
+/*!*/;
+# at #
+#010909 9:46:40 server id 1 end_log_pos # CRC32 XXX Table_map: `test`.`t1` mapped to number #
+# at #
+#010909 9:46:40 server id 1 end_log_pos # CRC32 XXX Update_rows: table id # flags: STMT_END_F
+### UPDATE `test`.`t1`
+### WHERE
+### @1=0 /* TINYINT meta=0 nullable=1 is_null=0 */
+### @2=0 /* SHORTINT meta=0 nullable=1 is_null=0 */
+### @3=0 /* MEDIUMINT meta=0 nullable=1 is_null=0 */
+### @4=0 /* INT meta=0 nullable=1 is_null=0 */
+### @5=0 /* LONGINT meta=0 nullable=1 is_null=0 */
+### @6='' /* STRING(10) meta=65034 nullable=1 is_null=0 */
+### @7='' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
+### @8='' /* BLOB/TEXT meta=2 nullable=1 is_null=0 */
+### SET
+### @1=100 /* TINYINT meta=0 nullable=1 is_null=0 */
+### @2=0 /* SHORTINT meta=0 nullable=1 is_null=0 */
+### @3=0 /* MEDIUMINT meta=0 nullable=1 is_null=0 */
+### @4=0 /* INT meta=0 nullable=1 is_null=0 */
+### @5=0 /* LONGINT meta=0 nullable=1 is_null=0 */
+### @6='' /* STRING(10) meta=65034 nullable=1 is_null=0 */
+### @7='' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
+### @8='' /* BLOB/TEXT meta=2 nullable=1 is_null=0 */
+### UPDATE `test`.`t1`
+### WHERE
+### @1=1 /* TINYINT meta=0 nullable=1 is_null=0 */
+### @2=2 /* SHORTINT meta=0 nullable=1 is_null=0 */
+### @3=3 /* MEDIUMINT meta=0 nullable=1 is_null=0 */
+### @4=4 /* INT meta=0 nullable=1 is_null=0 */
+### @5=5 /* LONGINT meta=0 nullable=1 is_null=0 */
+### @6='abc' /* STRING(10) meta=65034 nullable=1 is_null=0 */
+### @7='abcdefg' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
+### @8='abcedfghijklmnopqrstuvwxyz' /* BLOB/TEXT meta=2 nullable=1 is_null=0 */
+### SET
+### @1=100 /* TINYINT meta=0 nullable=1 is_null=0 */
+### @2=2 /* SHORTINT meta=0 nullable=1 is_null=0 */
+### @3=3 /* MEDIUMINT meta=0 nullable=1 is_null=0 */
+### @4=4 /* INT meta=0 nullable=1 is_null=0 */
+### @5=5 /* LONGINT meta=0 nullable=1 is_null=0 */
+### @6='abc' /* STRING(10) meta=65034 nullable=1 is_null=0 */
+### @7='abcdefg' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
+### @8='abcedfghijklmnopqrstuvwxyz' /* BLOB/TEXT meta=2 nullable=1 is_null=0 */
+# at #
+#010909 9:46:40 server id 1 end_log_pos # CRC32 XXX Xid = #
+COMMIT/*!*/;
+# at #
+#010909 9:46:40 server id 1 end_log_pos # CRC32 XXX GTID 0-1-6 trans
+/*!100001 SET @@session.gtid_seq_no=6*//*!*/;
+BEGIN
+/*!*/;
+# at #
+#010909 9:46:40 server id 1 end_log_pos # CRC32 XXX Table_map: `test`.`t1` mapped to number #
+# at #
+#010909 9:46:40 server id 1 end_log_pos # CRC32 XXX Delete_rows: table id # flags: STMT_END_F
+### DELETE FROM `test`.`t1`
+### WHERE
+### @1=100 /* TINYINT meta=0 nullable=1 is_null=0 */
+### @2=0 /* SHORTINT meta=0 nullable=1 is_null=0 */
+### @3=0 /* MEDIUMINT meta=0 nullable=1 is_null=0 */
+### @4=0 /* INT meta=0 nullable=1 is_null=0 */
+### @5=0 /* LONGINT meta=0 nullable=1 is_null=0 */
+### @6='' /* STRING(10) meta=65034 nullable=1 is_null=0 */
+### @7='' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
+### @8='' /* BLOB/TEXT meta=2 nullable=1 is_null=0 */
+### DELETE FROM `test`.`t1`
+### WHERE
+### @1=100 /* TINYINT meta=0 nullable=1 is_null=0 */
+### @2=2 /* SHORTINT meta=0 nullable=1 is_null=0 */
+### @3=3 /* MEDIUMINT meta=0 nullable=1 is_null=0 */
+### @4=4 /* INT meta=0 nullable=1 is_null=0 */
+### @5=5 /* LONGINT meta=0 nullable=1 is_null=0 */
+### @6='abc' /* STRING(10) meta=65034 nullable=1 is_null=0 */
+### @7='abcdefg' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
+### @8='abcedfghijklmnopqrstuvwxyz' /* BLOB/TEXT meta=2 nullable=1 is_null=0 */
+### DELETE FROM `test`.`t1`
+### WHERE
+### @1=127 /* TINYINT meta=0 nullable=1 is_null=0 */
+### @2=32767 /* SHORTINT meta=0 nullable=1 is_null=0 */
+### @3=8388607 /* MEDIUMINT meta=0 nullable=1 is_null=0 */
+### @4=2147483647 /* INT meta=0 nullable=1 is_null=0 */
+### @5=9223372036854775807 /* LONGINT meta=0 nullable=1 is_null=0 */
+### @6='aaaaaaaaaa' /* STRING(10) meta=65034 nullable=1 is_null=0 */
+### @7='aaaaaaaaaaaaaaaaaaaa' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
+### @8='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' /* BLOB/TEXT meta=2 nullable=1 is_null=0 */
+# at #
+#010909 9:46:40 server id 1 end_log_pos # CRC32 XXX Xid = #
+COMMIT/*!*/;
+# at #
+#010909 9:46:40 server id 1 end_log_pos # CRC32 XXX Rotate to master-bin.000002 pos: 4
+DELIMITER ;
+# End of log file
+ROLLBACK /* added by mysqlbinlog */;
+/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
+#
+# Show mysqlbinlog result with -B
+#
+/*!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*/;
+DELIMITER /*!*/;
+#010909 9:46:40 server id 1 end_log_pos # CRC32 XXX Start: binlog v 4, server v #.##.## created 010909 9:46:40 at startup
+ROLLBACK/*!*/;
+#010909 9:46:40 server id 1 end_log_pos # CRC32 XXX Gtid list []
+#010909 9:46:40 server id 1 end_log_pos # CRC32 XXX Binlog checkpoint master-bin.000001
+#010909 9:46:40 server id 1 end_log_pos # CRC32 XXX Table_map: `test`.`t1` mapped to number #
+#010909 9:46:40 server id 1 end_log_pos # CRC32 XXX Table_map: `test`.`t1` mapped to number #
+#010909 9:46:40 server id 1 end_log_pos # CRC32 XXX Table_map: `test`.`t1` mapped to number #
+#010909 9:46:40 server id 1 end_log_pos # CRC32 XXX Table_map: `test`.`t1` mapped to number #
+#010909 9:46:40 server id 1 end_log_pos # CRC32 XXX Table_map: `test`.`t1` mapped to number #
+#010909 9:46:40 server id 1 end_log_pos # CRC32 XXX Rotate to master-bin.000002 pos: 4
+#010909 9:46:40 server id 1 end_log_pos # CRC32 XXX Xid = #
+BEGIN/*!*/;
+#010909 9:46:40 server id 1 end_log_pos # CRC32 XXX Write_rows: table id # flags: STMT_END_F
+### INSERT INTO `test`.`t1`
+### SET
+### @1=127 /* TINYINT meta=0 nullable=1 is_null=0 */
+### @2=32767 /* SHORTINT meta=0 nullable=1 is_null=0 */
+### @3=8388607 /* MEDIUMINT meta=0 nullable=1 is_null=0 */
+### @4=2147483647 /* INT meta=0 nullable=1 is_null=0 */
+### @5=9223372036854775807 /* LONGINT meta=0 nullable=1 is_null=0 */
+### @6='aaaaaaaaaa' /* STRING(10) meta=65034 nullable=1 is_null=0 */
+### @7='aaaaaaaaaaaaaaaaaaaa' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
+### @8='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' /* BLOB/TEXT meta=2 nullable=1 is_null=0 */
+### INSERT INTO `test`.`t1`
+### SET
+### @1=100 /* TINYINT meta=0 nullable=1 is_null=0 */
+### @2=2 /* SHORTINT meta=0 nullable=1 is_null=0 */
+### @3=3 /* MEDIUMINT meta=0 nullable=1 is_null=0 */
+### @4=4 /* INT meta=0 nullable=1 is_null=0 */
+### @5=5 /* LONGINT meta=0 nullable=1 is_null=0 */
+### @6='abc' /* STRING(10) meta=65034 nullable=1 is_null=0 */
+### @7='abcdefg' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
+### @8='abcedfghijklmnopqrstuvwxyz' /* BLOB/TEXT meta=2 nullable=1 is_null=0 */
+### INSERT INTO `test`.`t1`
+### SET
+### @1=100 /* TINYINT meta=0 nullable=1 is_null=0 */
+### @2=0 /* SHORTINT meta=0 nullable=1 is_null=0 */
+### @3=0 /* MEDIUMINT meta=0 nullable=1 is_null=0 */
+### @4=0 /* INT meta=0 nullable=1 is_null=0 */
+### @5=0 /* LONGINT meta=0 nullable=1 is_null=0 */
+### @6='' /* STRING(10) meta=65034 nullable=1 is_null=0 */
+### @7='' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
+### @8='' /* BLOB/TEXT meta=2 nullable=1 is_null=0 */
+COMMIT
+/*!*/;
+#010909 9:46:40 server id 1 end_log_pos # CRC32 XXX Xid = #
+BEGIN/*!*/;
+#010909 9:46:40 server id 1 end_log_pos # CRC32 XXX Update_rows: table id # flags: STMT_END_F
+### UPDATE `test`.`t1`
+### WHERE
+### @1=100 /* TINYINT meta=0 nullable=1 is_null=0 */
+### @2=2 /* SHORTINT meta=0 nullable=1 is_null=0 */
+### @3=3 /* MEDIUMINT meta=0 nullable=1 is_null=0 */
+### @4=4 /* INT meta=0 nullable=1 is_null=0 */
+### @5=5 /* LONGINT meta=0 nullable=1 is_null=0 */
+### @6='abc' /* STRING(10) meta=65034 nullable=1 is_null=0 */
+### @7='abcdefg' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
+### @8='abcedfghijklmnopqrstuvwxyz' /* BLOB/TEXT meta=2 nullable=1 is_null=0 */
+### SET
+### @1=1 /* TINYINT meta=0 nullable=1 is_null=0 */
+### @2=2 /* SHORTINT meta=0 nullable=1 is_null=0 */
+### @3=3 /* MEDIUMINT meta=0 nullable=1 is_null=0 */
+### @4=4 /* INT meta=0 nullable=1 is_null=0 */
+### @5=5 /* LONGINT meta=0 nullable=1 is_null=0 */
+### @6='abc' /* STRING(10) meta=65034 nullable=1 is_null=0 */
+### @7='abcdefg' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
+### @8='abcedfghijklmnopqrstuvwxyz' /* BLOB/TEXT meta=2 nullable=1 is_null=0 */
+### UPDATE `test`.`t1`
+### WHERE
+### @1=100 /* TINYINT meta=0 nullable=1 is_null=0 */
+### @2=0 /* SHORTINT meta=0 nullable=1 is_null=0 */
+### @3=0 /* MEDIUMINT meta=0 nullable=1 is_null=0 */
+### @4=0 /* INT meta=0 nullable=1 is_null=0 */
+### @5=0 /* LONGINT meta=0 nullable=1 is_null=0 */
+### @6='' /* STRING(10) meta=65034 nullable=1 is_null=0 */
+### @7='' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
+### @8='' /* BLOB/TEXT meta=2 nullable=1 is_null=0 */
+### SET
+### @1=0 /* TINYINT meta=0 nullable=1 is_null=0 */
+### @2=0 /* SHORTINT meta=0 nullable=1 is_null=0 */
+### @3=0 /* MEDIUMINT meta=0 nullable=1 is_null=0 */
+### @4=0 /* INT meta=0 nullable=1 is_null=0 */
+### @5=0 /* LONGINT meta=0 nullable=1 is_null=0 */
+### @6='' /* STRING(10) meta=65034 nullable=1 is_null=0 */
+### @7='' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
+### @8='' /* BLOB/TEXT meta=2 nullable=1 is_null=0 */
+COMMIT
+/*!*/;
+#010909 9:46:40 server id 1 end_log_pos # CRC32 XXX Xid = #
+BEGIN/*!*/;
+#010909 9:46:40 server id 1 end_log_pos # CRC32 XXX Delete_rows: table id # flags: STMT_END_F
+### DELETE FROM `test`.`t1`
+### WHERE
+### @1=127 /* TINYINT meta=0 nullable=1 is_null=0 */
+### @2=32767 /* SHORTINT meta=0 nullable=1 is_null=0 */
+### @3=8388607 /* MEDIUMINT meta=0 nullable=1 is_null=0 */
+### @4=2147483647 /* INT meta=0 nullable=1 is_null=0 */
+### @5=9223372036854775807 /* LONGINT meta=0 nullable=1 is_null=0 */
+### @6='aaaaaaaaaa' /* STRING(10) meta=65034 nullable=1 is_null=0 */
+### @7='aaaaaaaaaaaaaaaaaaaa' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
+### @8='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' /* BLOB/TEXT meta=2 nullable=1 is_null=0 */
+COMMIT
+/*!*/;
+#010909 9:46:40 server id 1 end_log_pos # CRC32 XXX Xid = #
+BEGIN/*!*/;
+#010909 9:46:40 server id 1 end_log_pos # CRC32 XXX Delete_rows: table id # flags: STMT_END_F
+### DELETE FROM `test`.`t1`
+### WHERE
+### @1=1 /* TINYINT meta=0 nullable=1 is_null=0 */
+### @2=2 /* SHORTINT meta=0 nullable=1 is_null=0 */
+### @3=3 /* MEDIUMINT meta=0 nullable=1 is_null=0 */
+### @4=4 /* INT meta=0 nullable=1 is_null=0 */
+### @5=5 /* LONGINT meta=0 nullable=1 is_null=0 */
+### @6='abc' /* STRING(10) meta=65034 nullable=1 is_null=0 */
+### @7='abcdefg' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
+### @8='abcedfghijklmnopqrstuvwxyz' /* BLOB/TEXT meta=2 nullable=1 is_null=0 */
+COMMIT
+/*!*/;
+#010909 9:46:40 server id 1 end_log_pos # CRC32 XXX Xid = #
+BEGIN/*!*/;
+#010909 9:46:40 server id 1 end_log_pos # CRC32 XXX Delete_rows: table id # flags: STMT_END_F
+### DELETE FROM `test`.`t1`
+### WHERE
+### @1=0 /* TINYINT meta=0 nullable=1 is_null=0 */
+### @2=0 /* SHORTINT meta=0 nullable=1 is_null=0 */
+### @3=0 /* MEDIUMINT meta=0 nullable=1 is_null=0 */
+### @4=0 /* INT meta=0 nullable=1 is_null=0 */
+### @5=0 /* LONGINT meta=0 nullable=1 is_null=0 */
+### @6='' /* STRING(10) meta=65034 nullable=1 is_null=0 */
+### @7='' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
+### @8='' /* BLOB/TEXT meta=2 nullable=1 is_null=0 */
+COMMIT
+/*!*/;
+#010909 9:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0
+use `test`/*!*/;
+SET TIMESTAMP=1000000000/*!*/;
+SET @@session.pseudo_thread_id=#/*!*/;
+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=1342177280/*!*/;
+SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
+/*!\C latin1 *//*!*/;
+SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
+SET @@session.lc_time_names=0/*!*/;
+SET @@session.collation_database=DEFAULT/*!*/;
+COMMIT
+/*!*/;
+DELIMITER ;
+# End of log file
+ROLLBACK /* added by mysqlbinlog */;
+/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
+#
+# Insert data to t1
+#
+TRUNCATE TABLE t1;
+INSERT INTO t1 VALUES(0,0,0,0,0,'','','');
+INSERT INTO t1 VALUES(1,2,3,4,5, "abc", "abcdefg", "abcedfghijklmnopqrstuvwxyz");
+INSERT INTO t1 VALUES(127, 32767, 8388607, 2147483647, 9223372036854775807, repeat('a', 10), repeat('a', 20), repeat('a', 60));
+#
+# Delete all existing binary logs.
+#
+RESET MASTER;
+SELECT * FROM t1;
+c01 c02 c03 c04 c05 c06 c07 c08
+0 0 0 0 0
+1 2 3 4 5 abc abcdefg abcedfghijklmnopqrstuvwxyz
+127 32767 8388607 2147483647 9223372036854775807 aaaaaaaaaa aaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+#
+# Operate some data
+#
+UPDATE t1 SET c01=20;
+UPDATE t1 SET c02=200;
+UPDATE t1 SET c03=2000;
+DELETE FROM t1;
+FLUSH LOGS;
+#
+# Flashback & Check the result
+#
+SELECT * FROM t1;
+c01 c02 c03 c04 c05 c06 c07 c08
+127 32767 8388607 2147483647 9223372036854775807 aaaaaaaaaa aaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+1 2 3 4 5 abc abcdefg abcedfghijklmnopqrstuvwxyz
+0 0 0 0 0
+RESET MASTER;
+#
+# UPDATE multi-rows in one event
+#
+BEGIN;
+UPDATE t1 SET c01=10 WHERE c01=0;
+UPDATE t1 SET c01=20 WHERE c01=10;
+COMMIT;
+FLUSH LOGS;
+#
+# Flashback & Check the result
+#
+SELECT * FROM t1;
+c01 c02 c03 c04 c05 c06 c07 c08
+127 32767 8388607 2147483647 9223372036854775807 aaaaaaaaaa aaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+1 2 3 4 5 abc abcdefg abcedfghijklmnopqrstuvwxyz
+0 0 0 0 0
+DROP TABLE t1;
+#
+# Self-referencing foreign keys
+#
+CREATE TABLE t1 (a INT PRIMARY KEY, b INT, FOREIGN KEY my_fk(b) REFERENCES t1(a)) ENGINE=InnoDB;
+BEGIN;
+INSERT INTO t1 VALUES (1, NULL);
+INSERT INTO t1 VALUES (2, 1), (3, 2), (4, 3);
+COMMIT;
+SELECT * FROM t1;
+a b
+1 NULL
+2 1
+3 2
+4 3
+RESET MASTER;
+DELETE FROM t1 ORDER BY a DESC;
+FLUSH LOGS;
+#
+# Flashback & Check the result
+#
+SELECT * FROM t1;
+a b
+1 NULL
+2 1
+3 2
+4 3
+DROP TABLE t1;
diff --git a/mysql-test/suite/binlog/t/flashback-master.opt b/mysql-test/suite/binlog/t/flashback-master.opt
new file mode 100644
index 00000000000..476efbe20ab
--- /dev/null
+++ b/mysql-test/suite/binlog/t/flashback-master.opt
@@ -0,0 +1,2 @@
+--flashback
+--timezone=GMT-8
diff --git a/mysql-test/suite/binlog/t/flashback.test b/mysql-test/suite/binlog/t/flashback.test
new file mode 100644
index 00000000000..2f395a2a7b1
--- /dev/null
+++ b/mysql-test/suite/binlog/t/flashback.test
@@ -0,0 +1,163 @@
+--source include/have_log_bin.inc
+--source include/have_innodb.inc
+
+--echo #
+--echo # Preparatory cleanup.
+--echo #
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+--echo #
+--echo # We need a fixed timestamp to avoid varying results.
+--echo #
+SET timestamp=1000000000;
+
+--echo #
+--echo # Delete all existing binary logs.
+--echo #
+RESET MASTER;
+
+
+CREATE TABLE t1 (
+ c01 tinyint,
+ c02 smallint,
+ c03 mediumint,
+ c04 int,
+ c05 bigint,
+ c06 char(10),
+ c07 varchar(20),
+ c08 TEXT
+) ENGINE=InnoDB;
+
+--echo #
+--echo # Insert data to t1
+--echo #
+INSERT INTO t1 VALUES(0,0,0,0,0,'','','');
+INSERT INTO t1 VALUES(1,2,3,4,5, "abc", "abcdefg", "abcedfghijklmnopqrstuvwxyz");
+INSERT INTO t1 VALUES(127, 32767, 8388607, 2147483647, 9223372036854775807, repeat('a', 10), repeat('a', 20), repeat('a', 255));
+
+
+--echo #
+--echo # Update t1
+--echo #
+UPDATE t1 SET c01=100 WHERE c02=0 OR c03=3;
+
+--echo #
+--echo # Clear t1
+--echo #
+DELETE FROM t1;
+
+FLUSH LOGS;
+
+--echo #
+--echo # Show mysqlbinlog result without -B
+--echo #
+
+let $MYSQLD_DATADIR= `select @@datadir`;
+--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 #/ /Xid = [0-9]*/Xid = #/ /thread_id=[0-9]*/thread_id=#/ /table id [0-9]*/table id #/ /mapped to number [0-9]*/mapped to number #/ /server v [^ ]*/server v #.##.##/ /CRC32 0x[0-9a-f]*/CRC32 XXX/
+--exec $MYSQL_BINLOG --base64-output=decode-rows -v -v $MYSQLD_DATADIR/master-bin.000001
+
+--echo #
+--echo # Show mysqlbinlog result with -B
+--echo #
+
+let $MYSQLD_DATADIR= `select @@datadir`;
+--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 #/ /Xid = [0-9]*/Xid = #/ /thread_id=[0-9]*/thread_id=#/ /table id [0-9]*/table id #/ /mapped to number [0-9]*/mapped to number #/ /server v [^ ]*/server v #.##.##/ /CRC32 0x[0-9a-f]*/CRC32 XXX/
+--exec $MYSQL_BINLOG -B --base64-output=decode-rows -v -v $MYSQLD_DATADIR/master-bin.000001
+
+--echo #
+--echo # Insert data to t1
+--echo #
+TRUNCATE TABLE t1;
+INSERT INTO t1 VALUES(0,0,0,0,0,'','','');
+INSERT INTO t1 VALUES(1,2,3,4,5, "abc", "abcdefg", "abcedfghijklmnopqrstuvwxyz");
+INSERT INTO t1 VALUES(127, 32767, 8388607, 2147483647, 9223372036854775807, repeat('a', 10), repeat('a', 20), repeat('a', 60));
+
+--echo #
+--echo # Delete all existing binary logs.
+--echo #
+RESET MASTER;
+SELECT * FROM t1;
+
+--echo #
+--echo # Operate some data
+--echo #
+
+UPDATE t1 SET c01=20;
+UPDATE t1 SET c02=200;
+UPDATE t1 SET c03=2000;
+
+DELETE FROM t1;
+
+FLUSH LOGS;
+
+--echo #
+--echo # Flashback & Check the result
+--echo #
+
+let $MYSQLD_DATADIR= `select @@datadir`;
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+--exec $MYSQL_BINLOG -B -vv $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mysqlbinlog_row_flashback_1.sql
+--exec $MYSQL -e "SET binlog_format= ROW; source $MYSQLTEST_VARDIR/tmp/mysqlbinlog_row_flashback_1.sql;"
+
+SELECT * FROM t1;
+
+RESET MASTER;
+
+--echo #
+--echo # UPDATE multi-rows in one event
+--echo #
+BEGIN;
+UPDATE t1 SET c01=10 WHERE c01=0;
+UPDATE t1 SET c01=20 WHERE c01=10;
+COMMIT;
+
+FLUSH LOGS;
+
+--echo #
+--echo # Flashback & Check the result
+--echo #
+
+let $MYSQLD_DATADIR= `select @@datadir`;
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+--exec $MYSQL_BINLOG -B -vv $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mysqlbinlog_row_flashback_2.sql
+--exec $MYSQL -e "SET binlog_format= ROW; source $MYSQLTEST_VARDIR/tmp/mysqlbinlog_row_flashback_2.sql;"
+
+SELECT * FROM t1;
+
+DROP TABLE t1;
+
+--echo #
+--echo # Self-referencing foreign keys
+--echo #
+CREATE TABLE t1 (a INT PRIMARY KEY, b INT, FOREIGN KEY my_fk(b) REFERENCES t1(a)) ENGINE=InnoDB;
+
+BEGIN;
+INSERT INTO t1 VALUES (1, NULL);
+INSERT INTO t1 VALUES (2, 1), (3, 2), (4, 3);
+COMMIT;
+
+SELECT * FROM t1;
+
+# New binlog
+RESET MASTER;
+
+DELETE FROM t1 ORDER BY a DESC;
+
+FLUSH LOGS;
+
+--echo #
+--echo # Flashback & Check the result
+--echo #
+
+let $MYSQLD_DATADIR= `select @@datadir`;
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+--exec $MYSQL_BINLOG -B -vv $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mysqlbinlog_row_flashback_3.sql
+--exec $MYSQL -e "SET binlog_format= ROW; source $MYSQLTEST_VARDIR/tmp/mysqlbinlog_row_flashback_3.sql;"
+
+SELECT * FROM t1;
+
+DROP TABLE t1;
diff --git a/mysql-test/suite/binlog_encryption/binlog_row_annotate.combinations b/mysql-test/suite/binlog_encryption/binlog_row_annotate.combinations
new file mode 100644
index 00000000000..710c53d0ace
--- /dev/null
+++ b/mysql-test/suite/binlog_encryption/binlog_row_annotate.combinations
@@ -0,0 +1,6 @@
+[cmpr]
+log-bin-compress=1
+log-bin-compress-min-len=10
+
+[ncmpr]
+log-bin-compress=0
diff --git a/mysql-test/suite/binlog_encryption/binlog_write_error.result b/mysql-test/suite/binlog_encryption/binlog_write_error.result
index 28cffb3a8e5..2606a9f40b3 100644
--- a/mysql-test/suite/binlog_encryption/binlog_write_error.result
+++ b/mysql-test/suite/binlog_encryption/binlog_write_error.result
@@ -59,8 +59,8 @@ DROP VIEW v1;
ERROR HY000: Error writing file 'master-bin' ((errno: #)
SET GLOBAL debug_dbug='';
SET GLOBAL debug_dbug='d,injecting_fault_writing';
-CREATE PROCEDURE p1(OUT rows INT) SELECT count(*) INTO rows FROM t1;
-CREATE PROCEDURE p1(OUT rows INT) SELECT count(*) INTO rows FROM t1;
+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='d,injecting_fault_writing';
diff --git a/mysql-test/suite/binlog_encryption/mysqlbinlog.combinations b/mysql-test/suite/binlog_encryption/mysqlbinlog.combinations
new file mode 100644
index 00000000000..710c53d0ace
--- /dev/null
+++ b/mysql-test/suite/binlog_encryption/mysqlbinlog.combinations
@@ -0,0 +1,6 @@
+[cmpr]
+log-bin-compress=1
+log-bin-compress-min-len=10
+
+[ncmpr]
+log-bin-compress=0
diff --git a/mysql-test/suite/binlog_encryption/rpl_gtid_basic.combinations b/mysql-test/suite/binlog_encryption/rpl_gtid_basic.combinations
new file mode 100644
index 00000000000..710c53d0ace
--- /dev/null
+++ b/mysql-test/suite/binlog_encryption/rpl_gtid_basic.combinations
@@ -0,0 +1,6 @@
+[cmpr]
+log-bin-compress=1
+log-bin-compress-min-len=10
+
+[ncmpr]
+log-bin-compress=0
diff --git a/mysql-test/suite/encryption/disabled.def b/mysql-test/suite/encryption/disabled.def
index c2f41b70d03..d92d3495cb8 100644
--- a/mysql-test/suite/encryption/disabled.def
+++ b/mysql-test/suite/encryption/disabled.def
@@ -10,5 +10,5 @@
#
##############################################################################
-innodb_scrub_background : MDEV-8139 background scrubbing does not work reliably
-innodb_scrub : MDEV-8139 occasional corruption of delete_3.ibd page 2
+innodb_scrub : MDEV-8139 scrubbing does not work reliably
+innodb_scrub_background : MDEV-8139 scrubbing does not work reliably
diff --git a/mysql-test/suite/encryption/r/innochecksum.result b/mysql-test/suite/encryption/r/innochecksum.result
index 50eafbf9f5e..7cd7af7b93b 100644
--- a/mysql-test/suite/encryption/r/innochecksum.result
+++ b/mysql-test/suite/encryption/r/innochecksum.result
@@ -1,7 +1,3 @@
-SET GLOBAL innodb_file_format = `Barracuda`;
-Warnings:
-Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
-SET GLOBAL innodb_file_per_table = ON;
set global innodb_compression_algorithm = 1;
# Create and populate a tables
CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY, b TEXT) ENGINE=InnoDB ENCRYPTED=YES ENCRYPTION_KEY_ID=4;
@@ -23,5 +19,3 @@ CREATE TABLE t5 (a INT AUTO_INCREMENT PRIMARY KEY, b TEXT) ENGINE=InnoDB PAGE_CO
# Write file to make mysql-test-run.pl start up the server again
# Cleanup
DROP TABLE t1, t2, t3, t4, t5;
-Warnings:
-Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
diff --git a/mysql-test/suite/encryption/r/innodb-bad-key-change.result b/mysql-test/suite/encryption/r/innodb-bad-key-change.result
index 7c6a9d2ba83..dc5be714f66 100644
--- a/mysql-test/suite/encryption/r/innodb-bad-key-change.result
+++ b/mysql-test/suite/encryption/r/innodb-bad-key-change.result
@@ -11,10 +11,6 @@ call mtr.add_suppression("InnoDB: Tablespace id .* is encrypted but encryption s
call mtr.add_suppression("InnoDB: InnoDB: Page may be an index page where index id is .*");
# Start server with keys2.txt
-SET GLOBAL innodb_file_format = `Barracuda`;
-Warnings:
-Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
-SET GLOBAL innodb_file_per_table = ON;
CREATE TABLE t1 (c VARCHAR(8)) ENGINE=InnoDB ENCRYPTED=YES ENCRYPTION_KEY_ID=2;
INSERT INTO t1 VALUES ('foobar');
ALTER TABLE t1 ADD COLUMN c2 INT;
diff --git a/mysql-test/suite/encryption/r/innodb-bad-key-change3.result b/mysql-test/suite/encryption/r/innodb-bad-key-change3.result
index 6f4a46b4c44..79155bf43b9 100644
--- a/mysql-test/suite/encryption/r/innodb-bad-key-change3.result
+++ b/mysql-test/suite/encryption/r/innodb-bad-key-change3.result
@@ -1,7 +1,5 @@
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.");
-SET GLOBAL innodb_file_format = `Barracuda`;
-SET GLOBAL innodb_file_per_table = ON;
set global innodb_compression_algorithm = 1;
CREATE TABLE t1 (pk INT PRIMARY KEY, f VARCHAR(255)) ENGINE=InnoDB PAGE_COMPRESSED=1 ENCRYPTED=YES ENCRYPTION_KEY_ID=4;
SHOW WARNINGS;
@@ -23,8 +21,6 @@ backup: t1
UNLOCK TABLES;
ALTER TABLE t1 DISCARD TABLESPACE;
restore: t1 .ibd and .cfg files
-SET GLOBAL innodb_file_format = `Barracuda`;
-SET GLOBAL innodb_file_per_table = ON;
ALTER TABLE t1 IMPORT TABLESPACE;
ERROR HY000: Got error 192 'Table encrypted but decryption failed. This could be because correct encryption management plugin is not loaded, used encryption key is not available or encryption method does not match.' from InnoDB
SHOW CREATE TABLE t1;
diff --git a/mysql-test/suite/encryption/r/innodb-bad-key-change4.result b/mysql-test/suite/encryption/r/innodb-bad-key-change4.result
index 369a8c7989c..d6c2706e8bf 100644
--- a/mysql-test/suite/encryption/r/innodb-bad-key-change4.result
+++ b/mysql-test/suite/encryption/r/innodb-bad-key-change4.result
@@ -4,16 +4,8 @@ call mtr.add_suppression("InnoDB: Marking tablespace as missing. You may drop th
call mtr.add_suppression(".*InnoDB: Cannot open table test/.* from the internal data dictionary of InnoDB though the .frm file for the table exists. See .* for how you can resolve the problem.");
call mtr.add_suppression("InnoDB: .ibd file is missing for table test/.*");
call mtr.add_suppression("Couldn't load plugins from 'file_key_management*");
-SET GLOBAL innodb_file_format = `Barracuda`;
-Warnings:
-Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
-SET GLOBAL innodb_file_per_table = ON;
CREATE TABLE t1 (pk INT PRIMARY KEY, f VARCHAR(8)) ENGINE=InnoDB ENCRYPTION_KEY_ID=4;
INSERT INTO t1 VALUES (1,'foo'),(2,'bar');
-SET GLOBAL innodb_file_format = `Barracuda`;
-Warnings:
-Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
-SET GLOBAL innodb_file_per_table = ON;
CHECK TABLE t1;
Table Op Msg_type Msg_text
test.t1 check Warning Table test/t1 in tablespace # is encrypted but encryption service or used key_id is not available. Can't continue reading table.
@@ -22,5 +14,3 @@ test.t1 check error Corrupt
SHOW WARNINGS;
Level Code Message
DROP TABLE t1;
-Warnings:
-Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
diff --git a/mysql-test/suite/encryption/r/innodb-bad-key-change5.result b/mysql-test/suite/encryption/r/innodb-bad-key-change5.result
index 9d8b1ddd23b..75a0587d35d 100644
--- a/mysql-test/suite/encryption/r/innodb-bad-key-change5.result
+++ b/mysql-test/suite/encryption/r/innodb-bad-key-change5.result
@@ -4,16 +4,8 @@ call mtr.add_suppression("InnoDB: Marking tablespace as missing. You may drop th
call mtr.add_suppression(".*InnoDB: Cannot open table test/.* from the internal data dictionary of InnoDB though the .frm file for the table exists. See .* for how you can resolve the problem.");
call mtr.add_suppression("InnoDB: .ibd file is missing for table test/.*");
call mtr.add_suppression("Couldn't load plugins from 'file_key_management*");
-SET GLOBAL innodb_file_format = `Barracuda`;
-Warnings:
-Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
-SET GLOBAL innodb_file_per_table = ON;
CREATE TABLE t1 (pk INT PRIMARY KEY, f VARCHAR(8)) ENGINE=InnoDB ENCRYPTION_KEY_ID=4;
INSERT INTO t1 VALUES (1,'foo'),(2,'bar');
-SET GLOBAL innodb_file_format = `Barracuda`;
-Warnings:
-Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
-SET GLOBAL innodb_file_per_table = ON;
OPTIMIZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 optimize Warning Table test/t1 is encrypted but encryption service or used key_id is not available. Can't continue checking table.
@@ -30,5 +22,3 @@ Level Code Message
Warning 192 Table test/t1 is encrypted but encryption service or used key_id is not available. Can't continue reading table.
Error 1296 Got error 192 'Table encrypted but decryption failed. This could be because correct encryption management plugin is not loaded, used encryption key is not available or encryption method does not match.' from InnoDB
DROP TABLE t1;
-Warnings:
-Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
diff --git a/mysql-test/suite/encryption/r/innodb-discard-import-change.result b/mysql-test/suite/encryption/r/innodb-discard-import-change.result
index 2505780b70c..b0b01b7cf7b 100644
--- a/mysql-test/suite/encryption/r/innodb-discard-import-change.result
+++ b/mysql-test/suite/encryption/r/innodb-discard-import-change.result
@@ -1,6 +1,4 @@
call mtr.add_suppression("InnoDB: Table .* tablespace is set as discarded");
-SET GLOBAL innodb_file_format = `Barracuda`;
-SET GLOBAL innodb_file_per_table = ON;
SET GLOBAL innodb_compression_algorithm = 1;
create table t1(c1 bigint not null primary key auto_increment, b char(200)) engine=innodb encrypted=yes encryption_key_id=4;
create table t2(c1 bigint not null primary key auto_increment, b char(200)) engine=innodb encrypted=yes encryption_key_id=1;
diff --git a/mysql-test/suite/encryption/r/innodb-discard-import.result b/mysql-test/suite/encryption/r/innodb-discard-import.result
index 06f4abab9f4..91314a77177 100644
--- a/mysql-test/suite/encryption/r/innodb-discard-import.result
+++ b/mysql-test/suite/encryption/r/innodb-discard-import.result
@@ -1,7 +1,5 @@
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.");
-SET GLOBAL innodb_file_format = `Barracuda`;
-SET GLOBAL innodb_file_per_table = ON;
SET GLOBAL innodb_compression_algorithm = 1;
create table t1(c1 bigint not null, b char(200)) engine=innodb encrypted=yes encryption_key_id=4;
show warnings;
diff --git a/mysql-test/suite/encryption/r/innodb-encryption-alter.result b/mysql-test/suite/encryption/r/innodb-encryption-alter.result
index 2003df0f4f4..06e4172bbae 100644
--- a/mysql-test/suite/encryption/r/innodb-encryption-alter.result
+++ b/mysql-test/suite/encryption/r/innodb-encryption-alter.result
@@ -1,7 +1,3 @@
-SET GLOBAL innodb_file_format = `Barracuda`;
-Warnings:
-Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
-SET GLOBAL innodb_file_per_table = ON;
SET GLOBAL innodb_encrypt_tables = ON;
SET GLOBAL innodb_encryption_threads = 4;
CREATE TABLE t1 (pk INT PRIMARY KEY AUTO_INCREMENT, c VARCHAR(256)) ENGINE=INNODB ENCRYPTED=NO ENCRYPTION_KEY_ID=4;
@@ -53,5 +49,3 @@ Error 1005 Can't create table `test`.`#sql-temporary` (errno: 140 "Wrong create
Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB
set innodb_default_encryption_key_id = 1;
drop table t1,t2;
-Warnings:
-Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
diff --git a/mysql-test/suite/encryption/r/innodb-encryption-disable.result b/mysql-test/suite/encryption/r/innodb-encryption-disable.result
index 62b233c1c93..63ad0cf13fb 100644
--- a/mysql-test/suite/encryption/r/innodb-encryption-disable.result
+++ b/mysql-test/suite/encryption/r/innodb-encryption-disable.result
@@ -1,7 +1,3 @@
-SET GLOBAL innodb_file_format = `Barracuda`;
-Warnings:
-Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
-SET GLOBAL innodb_file_per_table = ON;
call mtr.add_suppression("InnoDB: Block in space_id .* in file test/.* encrypted");
call mtr.add_suppression("InnoDB: However key management plugin or used key_id 1 is not found or used encryption algorithm or method does not match.");
call mtr.add_suppression("InnoDB: Marking tablespace as missing. You may drop this table or install correct key management plugin and key file.");
@@ -44,5 +40,3 @@ select * from t5;
ERROR HY000: Got error 192 'Table encrypted but decryption failed. This could be because correct encryption management plugin is not loaded, used encryption key is not available or encryption method does not match.' from InnoDB
drop table t1;
drop table t5;
-Warnings:
-Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
diff --git a/mysql-test/suite/encryption/r/innodb-page_encryption-32k.result b/mysql-test/suite/encryption/r/innodb-page_encryption-32k.result
index 6aa98a2fc68..fdebf23ce8f 100644
--- a/mysql-test/suite/encryption/r/innodb-page_encryption-32k.result
+++ b/mysql-test/suite/encryption/r/innodb-page_encryption-32k.result
@@ -1,9 +1,14 @@
call mtr.add_suppression("InnoDB: Warning: innodb_page_size has been changed from default value *");
-SET GLOBAL innodb_file_format = `Barracuda`;
-SET GLOBAL innodb_file_per_table = ON;
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 encrypted=yes encryption_key_id=1;
create table innodb_dynamic(c1 bigint not null, b char(200)) engine=innodb row_format=dynamic encrypted=yes encryption_key_id=3;
+ERROR HY000: Can't create table `test`.`innodb_dynamic` (errno: 140 "Wrong create options")
+show warnings;
+Level Code Message
+Warning 140 InnoDB: ENCRYPTION_KEY_ID 3 not available
+Error 1005 Can't create table `test`.`innodb_dynamic` (errno: 140 "Wrong create options")
+Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB
+create table innodb_dynamic(c1 bigint not null, b char(200)) engine=innodb row_format=dynamic encrypted=yes encryption_key_id=33;
create table innodb_redundant(c1 bigint not null, b char(200)) engine=innodb row_format=redundant encrypted=yes encryption_key_id=4;
show create table innodb_compact;
Table Create Table
@@ -16,7 +21,7 @@ Table Create Table
innodb_dynamic CREATE TABLE `innodb_dynamic` (
`c1` bigint(20) NOT NULL,
`b` char(200) DEFAULT NULL
-) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC `encrypted`=yes `encryption_key_id`=3
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC `encrypted`=yes `encryption_key_id`=33
show create table innodb_redundant;
Table Create Table
innodb_redundant CREATE TABLE `innodb_redundant` (
@@ -72,9 +77,6 @@ innodb_compact CREATE TABLE `innodb_compact` (
`b` char(200) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT
alter table innodb_dynamic engine=innodb encrypted=DEFAULT encryption_key_id=DEFAULT;
-Warnings:
-Warning 1478 InnoDB: ROW_FORMAT=DYNAMIC requires innodb_file_format > Antelope.
-Warning 1478 InnoDB: assuming ROW_FORMAT=COMPACT.
show create table innodb_dynamic;
Table Create Table
innodb_dynamic CREATE TABLE `innodb_dynamic` (
diff --git a/mysql-test/suite/encryption/r/innodb-page_encryption.result b/mysql-test/suite/encryption/r/innodb-page_encryption.result
index 051fd602db5..1069b8652da 100644
--- a/mysql-test/suite/encryption/r/innodb-page_encryption.result
+++ b/mysql-test/suite/encryption/r/innodb-page_encryption.result
@@ -1,7 +1,3 @@
-SET GLOBAL innodb_file_format = `Barracuda`;
-Warnings:
-Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
-SET GLOBAL innodb_file_per_table = ON;
create table innodb_normal(c1 bigint not null, b char(200)) engine=innodb;
show warnings;
Level Code Message
@@ -122,10 +118,6 @@ variable_value >= 0
SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_decrypted';
variable_value >= 0
1
-SET GLOBAL innodb_file_format = `Barracuda`;
-Warnings:
-Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
-SET GLOBAL innodb_file_per_table = ON;
update innodb_normal set c1 = c1 +1;
update innodb_compact set c1 = c1 + 1;
update innodb_compressed set c1 = c1 + 1;
@@ -201,10 +193,6 @@ innodb_redundant CREATE TABLE `innodb_redundant` (
`c1` bigint(20) NOT NULL,
`b` char(200) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=REDUNDANT
-SET GLOBAL innodb_file_format = `Barracuda`;
-Warnings:
-Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
-SET GLOBAL innodb_file_per_table = ON;
show create table innodb_compact;
Table Create Table
innodb_compact CREATE TABLE `innodb_compact` (
@@ -281,5 +269,3 @@ drop table innodb_compressed;
drop table innodb_dynamic;
drop table innodb_redundant;
drop table innodb_defkey;
-Warnings:
-Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
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 6efefb23b87..a5bd7da8421 100644
--- a/mysql-test/suite/encryption/r/innodb-page_encryption_compression.result
+++ b/mysql-test/suite/encryption/r/innodb-page_encryption_compression.result
@@ -1,7 +1,3 @@
-SET GLOBAL innodb_file_format = `Barracuda`;
-Warnings:
-Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
-SET GLOBAL innodb_file_per_table = ON;
set global innodb_compression_algorithm = 1;
create table innodb_normal(c1 bigint not null, b char(200)) engine=innodb page_compressed=1;
show warnings;
@@ -76,10 +72,6 @@ SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_
variable_value >= 0
SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_decompressed';
variable_value >= 0
-SET GLOBAL innodb_file_format = `Barracuda`;
-Warnings:
-Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
-SET GLOBAL innodb_file_per_table = ON;
set global innodb_compression_algorithm = 1;
update innodb_normal set c1 = c1 + 1;
update innodb_compact set c1 = c1 + 1;
@@ -132,10 +124,6 @@ innodb_dynamic CREATE TABLE `innodb_dynamic` (
`c1` bigint(20) NOT NULL,
`b` char(200) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC
-SET GLOBAL innodb_file_format = `Barracuda`;
-Warnings:
-Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
-SET GLOBAL innodb_file_per_table = ON;
show create table innodb_normal;
Table Create Table
innodb_normal CREATE TABLE `innodb_normal` (
@@ -188,5 +176,3 @@ drop procedure innodb_insert_proc;
drop table innodb_normal;
drop table innodb_compact;
drop table innodb_dynamic;
-Warnings:
-Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
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 672202de774..ce74ac52537 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
@@ -1,10 +1,6 @@
call mtr.add_suppression("KeyID 0 not found or with error. Check the key and the log*");
call mtr.add_suppression("Disabling redo log encryp*");
call mtr.add_suppression("InnoDB: Redo log crypto: Can't initialize to key version*");
-SET GLOBAL innodb_file_format = `Barracuda`;
-Warnings:
-Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
-SET GLOBAL innodb_file_per_table = ON;
create table innodb_normal(c1 bigint not null, b char(200)) engine=innodb;
show warnings;
Level Code Message
@@ -101,10 +97,6 @@ variable_value >= 0
SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_decrypted';
variable_value >= 0
1
-SET GLOBAL innodb_file_format = `Barracuda`;
-Warnings:
-Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
-SET GLOBAL innodb_file_per_table = ON;
update innodb_normal set c1 = c1 +1;
update innodb_compact set c1 = c1 + 1;
update innodb_compressed set c1 = c1 + 1;
@@ -172,10 +164,6 @@ innodb_redundant CREATE TABLE `innodb_redundant` (
`c1` bigint(20) NOT NULL,
`b` char(200) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=REDUNDANT
-SET GLOBAL innodb_file_format = `Barracuda`;
-Warnings:
-Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
-SET GLOBAL innodb_file_per_table = ON;
show create table innodb_compact;
Table Create Table
innodb_compact CREATE TABLE `innodb_compact` (
@@ -253,5 +241,3 @@ pk
1
2
DROP TABLE t1;
-Warnings:
-Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
diff --git a/mysql-test/suite/encryption/r/innodb_encryption-page-compression.result b/mysql-test/suite/encryption/r/innodb_encryption-page-compression.result
index 9523c7c3982..60b9ff57605 100644
--- a/mysql-test/suite/encryption/r/innodb_encryption-page-compression.result
+++ b/mysql-test/suite/encryption/r/innodb_encryption-page-compression.result
@@ -1,7 +1,3 @@
-SET GLOBAL innodb_file_format = `Barracuda`;
-Warnings:
-Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
-SET GLOBAL innodb_file_per_table = ON;
SET GLOBAL innodb_encryption_threads = 4;
SET GLOBAL innodb_encrypt_tables = on;
set global innodb_compression_algorithm = 1;
@@ -264,5 +260,3 @@ drop table innodb_page_compressed6;
drop table innodb_page_compressed7;
drop table innodb_page_compressed8;
drop table innodb_page_compressed9;
-Warnings:
-Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
diff --git a/mysql-test/suite/encryption/r/innodb_encryption_discard_import.result b/mysql-test/suite/encryption/r/innodb_encryption_discard_import.result
index ae1fbdebcb3..91581eb8837 100644
--- a/mysql-test/suite/encryption/r/innodb_encryption_discard_import.result
+++ b/mysql-test/suite/encryption/r/innodb_encryption_discard_import.result
@@ -1,7 +1,5 @@
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.");
-SET GLOBAL innodb_file_format = `Barracuda`;
-SET GLOBAL innodb_file_per_table = ON;
CREATE TABLE t1 (id INT NOT NULL PRIMARY KEY, a VARCHAR(255)) ENGINE=InnoDB encrypted=yes;
CREATE TABLE t2 (id INT NOT NULL PRIMARY KEY, a VARCHAR(255)) ENGINE=InnoDB;
CREATE TABLE t3 (id INT NOT NULL PRIMARY KEY, a VARCHAR(255)) ENGINE=InnoDB row_format=compressed encrypted=yes;
diff --git a/mysql-test/suite/encryption/r/innodb_encryption_filekeys.result b/mysql-test/suite/encryption/r/innodb_encryption_filekeys.result
index 576b44fe897..54cdf842b20 100644
--- a/mysql-test/suite/encryption/r/innodb_encryption_filekeys.result
+++ b/mysql-test/suite/encryption/r/innodb_encryption_filekeys.result
@@ -1,8 +1,4 @@
call mtr.add_suppression("trying to do an operation on a dropped tablespace .*");
-SET GLOBAL innodb_file_format = `Barracuda`;
-Warnings:
-Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
-SET GLOBAL innodb_file_per_table = ON;
SET GLOBAL innodb_encrypt_tables = OFF;
SET GLOBAL innodb_encryption_threads = 4;
CREATE TABLE t1 (pk INT PRIMARY KEY AUTO_INCREMENT, c VARCHAR(256)) ENGINE=INNODB;
@@ -65,7 +61,5 @@ COUNT(1)
SELECT COUNT(1) FROM t5;
COUNT(1)
400
-Warnings:
-Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
drop table t1,t2,t3,t4, t5;
set GLOBAL innodb_default_encryption_key_id=1;
diff --git a/mysql-test/suite/encryption/r/innodb_encryption_is.result b/mysql-test/suite/encryption/r/innodb_encryption_is.result
index 591c5a84ccc..0ce4a11f1ea 100644
--- a/mysql-test/suite/encryption/r/innodb_encryption_is.result
+++ b/mysql-test/suite/encryption/r/innodb_encryption_is.result
@@ -1,7 +1,3 @@
-SET GLOBAL innodb_file_format = `Barracuda`;
-Warnings:
-Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
-SET GLOBAL innodb_file_per_table = ON;
CREATE TABLE t1 (c VARCHAR(8)) ENGINE=InnoDB ENCRYPTED=YES ENCRYPTION_KEY_ID=1;
CREATE TABLE t2 (c VARCHAR(8)) ENGINE=InnoDB ENCRYPTED=YES ENCRYPTION_KEY_ID=2;
INSERT INTO t1 VALUES ('foobar');
@@ -14,5 +10,3 @@ NAME ENCRYPTION_SCHEME MIN_KEY_VERSION CURRENT_KEY_VERSION CURRENT_KEY_ID
test/t1 1 1 1 1
test/t2 1 1 1 2
DROP TABLE t1, t2;
-Warnings:
-Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
diff --git a/mysql-test/suite/encryption/r/innodb_encryption_row_compressed.result b/mysql-test/suite/encryption/r/innodb_encryption_row_compressed.result
index e49e38a8f3f..3d616ee71e3 100644
--- a/mysql-test/suite/encryption/r/innodb_encryption_row_compressed.result
+++ b/mysql-test/suite/encryption/r/innodb_encryption_row_compressed.result
@@ -1,7 +1,3 @@
-SET GLOBAL innodb_file_format = `Barracuda`;
-Warnings:
-Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
-SET GLOBAL innodb_file_per_table = ON;
create table innodb_compressed1(c1 bigint not null primary key, d int, a varchar(20), b char(200)) engine=innodb row_format=compressed encrypted=yes;
create table innodb_compressed2(c1 bigint not null primary key, d int, a varchar(20), b char(200)) engine=innodb row_format=compressed key_block_size=1 encrypted=yes;
create table innodb_compressed3(c1 bigint not null primary key, d int, a varchar(20), b char(200)) engine=innodb row_format=compressed key_block_size=2 encrypted=yes;
@@ -27,10 +23,6 @@ NOT FOUND /private/ in innodb_compressed2.ibd
NOT FOUND /private/ in innodb_compressed3.ibd
# t4 yes on expecting NOT FOUND
NOT FOUND /private/ in innodb_compressed4.ibd
-SET GLOBAL innodb_file_format = `Barracuda`;
-Warnings:
-Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
-SET GLOBAL innodb_file_per_table = ON;
select * from innodb_compressed1 where d = 20;
c1 d a b
1 20 private evenmoreprivate
@@ -155,5 +147,3 @@ drop table innodb_compressed1;
drop table innodb_compressed2;
drop table innodb_compressed3;
drop table innodb_compressed4;
-Warnings:
-Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
diff --git a/mysql-test/suite/encryption/r/innodb_encryption_tables.result b/mysql-test/suite/encryption/r/innodb_encryption_tables.result
index da62c0a2f0e..e7bcc207612 100644
--- a/mysql-test/suite/encryption/r/innodb_encryption_tables.result
+++ b/mysql-test/suite/encryption/r/innodb_encryption_tables.result
@@ -1,7 +1,3 @@
-SET GLOBAL innodb_file_format = `Barracuda`;
-Warnings:
-Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
-SET GLOBAL innodb_file_per_table = ON;
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;
create table innodb_dynamic(c1 bigint not null, b char(200)) engine=innodb row_format=dynamic;
@@ -105,10 +101,6 @@ variable_value >= 0
SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_page_decompressed';
variable_value >= 0
1
-SET GLOBAL innodb_file_format = `Barracuda`;
-Warnings:
-Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
-SET GLOBAL innodb_file_per_table = ON;
update innodb_normal set c1 = c1 + 1;
update innodb_compact set c1 = c1 + 1;
update innodb_dynamic set c1 = c1 + 1;
@@ -163,5 +155,3 @@ drop table innodb_compact;
drop table innodb_dynamic;
drop table innodb_compressed;
drop table innodb_redundant;
-Warnings:
-Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
diff --git a/mysql-test/suite/encryption/r/innodb_lotoftables.result b/mysql-test/suite/encryption/r/innodb_lotoftables.result
index aea50a1fa67..cf5724b527a 100644
--- a/mysql-test/suite/encryption/r/innodb_lotoftables.result
+++ b/mysql-test/suite/encryption/r/innodb_lotoftables.result
@@ -86,47 +86,47 @@ Innodb_pages0_read 3
# Restart Success!
show status like 'innodb_pages0_read%';
Variable_name Value
-Innodb_pages0_read 1
+Innodb_pages0_read 303
show status like 'innodb_pages0_read%';
Variable_name Value
-Innodb_pages0_read 1
+Innodb_pages0_read 303
use test;
show status like 'innodb_pages0_read%';
Variable_name Value
-Innodb_pages0_read 1
+Innodb_pages0_read 303
use innodb_encrypted_1;
show status like 'innodb_pages0_read%';
Variable_name Value
-Innodb_pages0_read 1
+Innodb_pages0_read 303
use innodb_encrypted_2;
show status like 'innodb_pages0_read%';
Variable_name Value
-Innodb_pages0_read 1
+Innodb_pages0_read 303
use innodb_encrypted_3;
show status like 'innodb_pages0_read%';
Variable_name Value
-Innodb_pages0_read 1
+Innodb_pages0_read 303
use innodb_encrypted_1;
show status like 'innodb_pages0_read%';
Variable_name Value
-Innodb_pages0_read 1
+Innodb_pages0_read 303
show status like 'innodb_pages0_read%';
Variable_name Value
-Innodb_pages0_read 101
+Innodb_pages0_read 303
use innodb_encrypted_2;
show status like 'innodb_pages0_read%';
Variable_name Value
-Innodb_pages0_read 101
+Innodb_pages0_read 303
show status like 'innodb_pages0_read%';
Variable_name Value
-Innodb_pages0_read 201
+Innodb_pages0_read 303
use innodb_encrypted_3;
show status like 'innodb_pages0_read%';
Variable_name Value
-Innodb_pages0_read 201
+Innodb_pages0_read 303
show status like 'innodb_pages0_read%';
Variable_name Value
-Innodb_pages0_read 301
+Innodb_pages0_read 303
SELECT COUNT(*) FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0 AND NAME LIKE 'innodb_encrypted%';
COUNT(*)
100
diff --git a/mysql-test/suite/encryption/r/innodb_onlinealter_encryption.result b/mysql-test/suite/encryption/r/innodb_onlinealter_encryption.result
index 798e0ca4357..d04525b0d5a 100644
--- a/mysql-test/suite/encryption/r/innodb_onlinealter_encryption.result
+++ b/mysql-test/suite/encryption/r/innodb_onlinealter_encryption.result
@@ -1,7 +1,3 @@
-SET GLOBAL innodb_file_format = `Barracuda`;
-Warnings:
-Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
-SET GLOBAL innodb_file_per_table = ON;
CREATE TABLE t1 (id INT NOT NULL PRIMARY KEY, a VARCHAR(255)) ENGINE=InnoDB encrypted=yes;
CREATE TABLE t2 (id INT NOT NULL PRIMARY KEY, a VARCHAR(255)) ENGINE=InnoDB;
CREATE TABLE t3 (id INT, a VARCHAR(255)) ENGINE=InnoDB encrypted=yes;
@@ -176,5 +172,3 @@ NOT FOUND /mangled/ in t6.ibd
NOT FOUND /mysql/ in t7.ibd
DROP PROCEDURE innodb_insert_proc;
DROP TABLE t1, t2, t3, t4, t5, t6, t7;
-Warnings:
-Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
diff --git a/mysql-test/suite/encryption/r/innodb_page_encryption_key_change.result b/mysql-test/suite/encryption/r/innodb_page_encryption_key_change.result
index 22038c0e933..d3406e67f18 100644
--- a/mysql-test/suite/encryption/r/innodb_page_encryption_key_change.result
+++ b/mysql-test/suite/encryption/r/innodb_page_encryption_key_change.result
@@ -1,8 +1,4 @@
# Restart mysqld --loose-file-key-management-filename=keys2.txt
-SET GLOBAL innodb_file_format = `Barracuda`;
-Warnings:
-Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
-SET GLOBAL innodb_file_per_table = ON;
create table innodb_normal(c1 bigint not null, b char(200)) engine=innodb;
show warnings;
Level Code Message
@@ -106,10 +102,6 @@ variable_value >= 0
SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_decrypted';
variable_value >= 0
1
-SET GLOBAL innodb_file_format = `Barracuda`;
-Warnings:
-Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
-SET GLOBAL innodb_file_per_table = ON;
alter table innodb_compact engine=innodb encryption_key_id = 2;
alter table innodb_compressed engine=innodb encryption_key_id = 3;
alter table innodb_dynamic engine=innodb encryption_key_id = 4;
@@ -155,5 +147,3 @@ drop table innodb_compact;
drop table innodb_compressed;
drop table innodb_dynamic;
drop table innodb_redundant;
-Warnings:
-Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
diff --git a/mysql-test/suite/encryption/t/innochecksum.test b/mysql-test/suite/encryption/t/innochecksum.test
index 7b41b2c5413..39e86d49674 100644
--- a/mysql-test/suite/encryption/t/innochecksum.test
+++ b/mysql-test/suite/encryption/t/innochecksum.test
@@ -15,13 +15,9 @@ if (!$INNOCHECKSUM) {
--disable_query_log
let $innodb_compression_algorithm_orig=`SELECT @@innodb_compression_algorithm`;
-let $innodb_file_format_orig = `SELECT @@innodb_file_format`;
-let $innodb_file_per_table_orig = `SELECT @@innodb_file_per_table`;
let MYSQLD_DATADIR= `SELECT @@datadir`;
--enable_query_log
-SET GLOBAL innodb_file_format = `Barracuda`;
-SET GLOBAL innodb_file_per_table = ON;
# zlib
set global innodb_compression_algorithm = 1;
@@ -97,6 +93,4 @@ DROP TABLE t1, t2, t3, t4, t5;
# reset system
--disable_query_log
EVAL SET GLOBAL innodb_compression_algorithm = $innodb_compression_algorithm_orig;
-EVAL SET GLOBAL innodb_file_per_table = $innodb_file_per_table_orig;
-EVAL SET GLOBAL innodb_file_format = $innodb_file_format_orig;
--enable_query_log
diff --git a/mysql-test/suite/encryption/t/innodb-bad-key-change.test b/mysql-test/suite/encryption/t/innodb-bad-key-change.test
index 3bcce90b01a..cc5e6b36ac3 100644
--- a/mysql-test/suite/encryption/t/innodb-bad-key-change.test
+++ b/mysql-test/suite/encryption/t/innodb-bad-key-change.test
@@ -29,14 +29,6 @@ call mtr.add_suppression("InnoDB: InnoDB: Page may be an index page where index
-- let $restart_parameters=--file-key-management-filename=$MYSQL_TEST_DIR/std_data/keys2.txt
-- source include/restart_mysqld.inc
---disable_query_log
-let $innodb_file_format_orig = `SELECT @@innodb_file_format`;
-let $innodb_file_per_table_orig = `SELECT @@innodb_file_per_table`;
---enable_query_log
-
-SET GLOBAL innodb_file_format = `Barracuda`;
-SET GLOBAL innodb_file_per_table = ON;
-
CREATE TABLE t1 (c VARCHAR(8)) ENGINE=InnoDB ENCRYPTED=YES ENCRYPTION_KEY_ID=2;
INSERT INTO t1 VALUES ('foobar');
ALTER TABLE t1 ADD COLUMN c2 INT;
diff --git a/mysql-test/suite/encryption/t/innodb-bad-key-change3.test b/mysql-test/suite/encryption/t/innodb-bad-key-change3.test
index b3ebe1c4aa5..dbd04748143 100644
--- a/mysql-test/suite/encryption/t/innodb-bad-key-change3.test
+++ b/mysql-test/suite/encryption/t/innodb-bad-key-change3.test
@@ -12,11 +12,6 @@
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.");
---disable_query_log
-let $innodb_file_format_orig = `SELECT @@innodb_file_format`;
-let $innodb_file_per_table_orig = `SELECT @@innodb_file_per_table`;
---enable_query_log
-
--let $MYSQLD_TMPDIR = `SELECT @@tmpdir`
--let $MYSQLD_DATADIR = `SELECT @@datadir`
--let SEARCH_RANGE = 10000000
@@ -34,11 +29,7 @@ EOF
--enable_reconnect
--source include/wait_until_connected_again.inc
---disable_warnings
-SET GLOBAL innodb_file_format = `Barracuda`;
-SET GLOBAL innodb_file_per_table = ON;
set global innodb_compression_algorithm = 1;
---enable_warnings
CREATE TABLE t1 (pk INT PRIMARY KEY, f VARCHAR(255)) ENGINE=InnoDB PAGE_COMPRESSED=1 ENCRYPTED=YES ENCRYPTION_KEY_ID=4;
SHOW WARNINGS;
@@ -76,11 +67,6 @@ EOF
--source include/wait_until_connected_again.inc
--source include/restart_mysqld.inc
---disable_warnings
-SET GLOBAL innodb_file_format = `Barracuda`;
-SET GLOBAL innodb_file_per_table = ON;
---enable_warnings
-
--error ER_GET_ERRMSG
ALTER TABLE t1 IMPORT TABLESPACE;
SHOW CREATE TABLE t1;
@@ -109,12 +95,6 @@ EOF
DROP TABLE t1;
# reset system
---disable_warnings
---disable_query_log
-EVAL SET GLOBAL innodb_file_per_table = $innodb_file_per_table_orig;
-EVAL SET GLOBAL innodb_file_format = $innodb_file_format_orig;
---enable_query_log
---enable_warnings
--remove_file $MYSQLTEST_VARDIR/keys1.txt
--remove_file $MYSQLTEST_VARDIR/keys2.txt
diff --git a/mysql-test/suite/encryption/t/innodb-bad-key-change4.test b/mysql-test/suite/encryption/t/innodb-bad-key-change4.test
index 82da3bbcf70..0b1db40b866 100644
--- a/mysql-test/suite/encryption/t/innodb-bad-key-change4.test
+++ b/mysql-test/suite/encryption/t/innodb-bad-key-change4.test
@@ -32,14 +32,6 @@ EOF
--let $MYSQLD_TMPDIR = `SELECT @@tmpdir`
--let $MYSQLD_DATADIR = `SELECT @@datadir`
---disable_query_log
-let $innodb_file_format_orig = `SELECT @@innodb_file_format`;
-let $innodb_file_per_table_orig = `SELECT @@innodb_file_per_table`;
---enable_query_log
-
-SET GLOBAL innodb_file_format = `Barracuda`;
-SET GLOBAL innodb_file_per_table = ON;
-
CREATE TABLE t1 (pk INT PRIMARY KEY, f VARCHAR(8)) ENGINE=InnoDB ENCRYPTION_KEY_ID=4;
INSERT INTO t1 VALUES (1,'foo'),(2,'bar');
@@ -56,9 +48,6 @@ EOF
--enable_reconnect
--source include/wait_until_connected_again.inc
-SET GLOBAL innodb_file_format = `Barracuda`;
-SET GLOBAL innodb_file_per_table = ON;
-
--replace_regex /tablespace [0-9]*/tablespace #/
CHECK TABLE t1;
SHOW WARNINGS;
@@ -82,9 +71,3 @@ EOF
DROP TABLE t1;
--remove_file $MYSQLTEST_VARDIR/keys1.txt
-
-# reset system
---disable_query_log
-EVAL SET GLOBAL innodb_file_per_table = $innodb_file_per_table_orig;
-EVAL SET GLOBAL innodb_file_format = $innodb_file_format_orig;
---enable_query_log
diff --git a/mysql-test/suite/encryption/t/innodb-bad-key-change5.test b/mysql-test/suite/encryption/t/innodb-bad-key-change5.test
index c6c0c963818..5f63eebe034 100644
--- a/mysql-test/suite/encryption/t/innodb-bad-key-change5.test
+++ b/mysql-test/suite/encryption/t/innodb-bad-key-change5.test
@@ -32,14 +32,6 @@ EOF
--let $MYSQLD_TMPDIR = `SELECT @@tmpdir`
--let $MYSQLD_DATADIR = `SELECT @@datadir`
---disable_query_log
-let $innodb_file_format_orig = `SELECT @@innodb_file_format`;
-let $innodb_file_per_table_orig = `SELECT @@innodb_file_per_table`;
---enable_query_log
-
-SET GLOBAL innodb_file_format = `Barracuda`;
-SET GLOBAL innodb_file_per_table = ON;
-
CREATE TABLE t1 (pk INT PRIMARY KEY, f VARCHAR(8)) ENGINE=InnoDB ENCRYPTION_KEY_ID=4;
INSERT INTO t1 VALUES (1,'foo'),(2,'bar');
@@ -56,9 +48,6 @@ EOF
--enable_reconnect
--source include/wait_until_connected_again.inc
-SET GLOBAL innodb_file_format = `Barracuda`;
-SET GLOBAL innodb_file_per_table = ON;
-
OPTIMIZE TABLE t1;
SHOW WARNINGS;
@@ -80,9 +69,3 @@ EOF
DROP TABLE t1;
--remove_file $MYSQLTEST_VARDIR/keys1.txt
-
-# reset system
---disable_query_log
-EVAL SET GLOBAL innodb_file_per_table = $innodb_file_per_table_orig;
-EVAL SET GLOBAL innodb_file_format = $innodb_file_format_orig;
---enable_query_log
diff --git a/mysql-test/suite/encryption/t/innodb-discard-import-change.test b/mysql-test/suite/encryption/t/innodb-discard-import-change.test
index a278a8fba29..2cb6865ed95 100644
--- a/mysql-test/suite/encryption/t/innodb-discard-import-change.test
+++ b/mysql-test/suite/encryption/t/innodb-discard-import-change.test
@@ -6,17 +6,9 @@
call mtr.add_suppression("InnoDB: Table .* tablespace is set as discarded");
---disable_query_log
-let $innodb_file_format_orig = `SELECT @@innodb_file_format`;
-let $innodb_file_per_table_orig = `SELECT @@innodb_file_per_table`;
let $innodb_compression_algo = `SELECT @@innodb_compression_algorithm`;
---enable_query_log
---disable_warnings
-SET GLOBAL innodb_file_format = `Barracuda`;
-SET GLOBAL innodb_file_per_table = ON;
SET GLOBAL innodb_compression_algorithm = 1;
---enable_warnings
create table t1(c1 bigint not null primary key auto_increment, b char(200)) engine=innodb encrypted=yes encryption_key_id=4;
create table t2(c1 bigint not null primary key auto_increment, b char(200)) engine=innodb encrypted=yes encryption_key_id=1;
@@ -121,11 +113,6 @@ SELECT COUNT(*) FROM t5;
DROP TABLE t1,t2,t3,t4,t5,t6;
# reset system
---disable_warnings
--disable_query_log
-EVAL SET GLOBAL innodb_file_per_table = $innodb_file_per_table_orig;
-EVAL SET GLOBAL innodb_file_format = $innodb_file_format_orig;
EVAL SET GLOBAL innodb_compression_algorithm = $innodb_compression_algo;
--enable_query_log
---enable_warnings
-
diff --git a/mysql-test/suite/encryption/t/innodb-discard-import.test b/mysql-test/suite/encryption/t/innodb-discard-import.test
index 9feaacc41e5..e105cf82b67 100644
--- a/mysql-test/suite/encryption/t/innodb-discard-import.test
+++ b/mysql-test/suite/encryption/t/innodb-discard-import.test
@@ -13,17 +13,8 @@
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.");
---disable_query_log
-let $innodb_file_format_orig = `SELECT @@innodb_file_format`;
-let $innodb_file_per_table_orig = `SELECT @@innodb_file_per_table`;
let $innodb_compression_algo = `SELECT @@innodb_compression_algorithm`;
---enable_query_log
-
---disable_warnings
-SET GLOBAL innodb_file_format = `Barracuda`;
-SET GLOBAL innodb_file_per_table = ON;
SET GLOBAL innodb_compression_algorithm = 1;
---enable_warnings
--let $MYSQLD_TMPDIR = `SELECT @@tmpdir`
--let $MYSQLD_DATADIR = `SELECT @@datadir`
@@ -126,10 +117,6 @@ DROP PROCEDURE innodb_insert_proc;
DROP TABLE t1,t2,t3,t4;
# reset system
---disable_warnings
--disable_query_log
-EVAL SET GLOBAL innodb_file_per_table = $innodb_file_per_table_orig;
-EVAL SET GLOBAL innodb_file_format = $innodb_file_format_orig;
EVAL SET GLOBAL innodb_compression_algorithm = $innodb_compression_algo;
--enable_query_log
---enable_warnings
diff --git a/mysql-test/suite/encryption/t/innodb-encryption-alter.test b/mysql-test/suite/encryption/t/innodb-encryption-alter.test
index 316ece1c16b..cb7d5a47975 100644
--- a/mysql-test/suite/encryption/t/innodb-encryption-alter.test
+++ b/mysql-test/suite/encryption/t/innodb-encryption-alter.test
@@ -5,15 +5,9 @@
# MDEV-8817: Failing assertion: new_state->key_version != ENCRYPTION_KEY_VERSION_INVALID
#
---disable_query_log
-let $innodb_file_format_orig = `SELECT @@innodb_file_format`;
-let $innodb_file_per_table_orig = `SELECT @@innodb_file_per_table`;
let $encrypt_tables = `SELECT @@innodb_encrypt_tables`;
let $threads = `SELECT @@innodb_encryption_threads`;
---enable_query_log
-SET GLOBAL innodb_file_format = `Barracuda`;
-SET GLOBAL innodb_file_per_table = ON;
SET GLOBAL innodb_encrypt_tables = ON;
SET GLOBAL innodb_encryption_threads = 4;
@@ -91,8 +85,6 @@ drop table t1,t2;
# reset system
--disable_query_log
-EVAL SET GLOBAL innodb_file_per_table = $innodb_file_per_table_orig;
-EVAL SET GLOBAL innodb_file_format = $innodb_file_format_orig;
EVAL SET GLOBAL innodb_encrypt_tables = $encrypt_tables;
EVAL SET GLOBAL innodb_encryption_threads = $threads;
--enable_query_log
diff --git a/mysql-test/suite/encryption/t/innodb-encryption-disable.test b/mysql-test/suite/encryption/t/innodb-encryption-disable.test
index e8e2ba02402..8a8b451f5b1 100644
--- a/mysql-test/suite/encryption/t/innodb-encryption-disable.test
+++ b/mysql-test/suite/encryption/t/innodb-encryption-disable.test
@@ -6,14 +6,6 @@
-- source include/not_crashrep.inc
-- source filekeys_plugin_exists.inc
---disable_query_log
-let $innodb_file_format_orig = `SELECT @@innodb_file_format`;
-let $innodb_file_per_table_orig = `SELECT @@innodb_file_per_table`;
---enable_query_log
-
-SET GLOBAL innodb_file_format = `Barracuda`;
-SET GLOBAL innodb_file_per_table = ON;
-
#
# MDEV-9559: Server without encryption configs crashes if selecting from an implicitly encrypted table
#
@@ -93,9 +85,4 @@ select * from t5;
drop table t1;
drop table t5;
---disable_query_log
-EVAL SET GLOBAL innodb_file_per_table = $innodb_file_per_table_orig;
-EVAL SET GLOBAL innodb_file_format = $innodb_file_format_orig;
---enable_query_log
-
--remove_file $MYSQLTEST_VARDIR/encryption-disable-keys1.txt
diff --git a/mysql-test/suite/encryption/t/innodb-page_encryption-32k.test b/mysql-test/suite/encryption/t/innodb-page_encryption-32k.test
index 325f0a86521..29d821d1fc1 100644
--- a/mysql-test/suite/encryption/t/innodb-page_encryption-32k.test
+++ b/mysql-test/suite/encryption/t/innodb-page_encryption-32k.test
@@ -7,18 +7,12 @@
call mtr.add_suppression("InnoDB: Warning: innodb_page_size has been changed from default value *");
---disable_query_log
-# These values can change during the test
-let $innodb_file_format_orig = `SELECT @@innodb_file_format`;
-let $innodb_file_per_table_orig = `SELECT @@innodb_file_per_table`;
---enable_query_log
-
-SET GLOBAL innodb_file_format = `Barracuda`;
-SET GLOBAL innodb_file_per_table = ON;
-
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 encrypted=yes encryption_key_id=1;
+--error ER_CANT_CREATE_TABLE
create table innodb_dynamic(c1 bigint not null, b char(200)) engine=innodb row_format=dynamic encrypted=yes encryption_key_id=3;
+show warnings;
+create table innodb_dynamic(c1 bigint not null, b char(200)) engine=innodb row_format=dynamic encrypted=yes encryption_key_id=33;
create table innodb_redundant(c1 bigint not null, b char(200)) engine=innodb row_format=redundant encrypted=yes encryption_key_id=4;
show create table innodb_compact;
@@ -88,9 +82,3 @@ drop table innodb_normal;
drop table innodb_compact;
drop table innodb_dynamic;
drop table innodb_redundant;
-
-# reset system
---disable_query_log
-EVAL SET GLOBAL innodb_file_per_table = $innodb_file_per_table_orig;
-EVAL SET GLOBAL innodb_file_format = $innodb_file_format_orig;
---enable_query_log
diff --git a/mysql-test/suite/encryption/t/innodb-page_encryption.test b/mysql-test/suite/encryption/t/innodb-page_encryption.test
index 463df756933..df2d1d52aaa 100644
--- a/mysql-test/suite/encryption/t/innodb-page_encryption.test
+++ b/mysql-test/suite/encryption/t/innodb-page_encryption.test
@@ -1,14 +1,6 @@
-- source include/have_innodb.inc
-- source include/have_file_key_management_plugin.inc
---disable_query_log
-let $innodb_file_format_orig = `SELECT @@innodb_file_format`;
-let $innodb_file_per_table_orig = `SELECT @@innodb_file_per_table`;
---enable_query_log
-
-SET GLOBAL innodb_file_format = `Barracuda`;
-SET GLOBAL innodb_file_per_table = ON;
-
create table innodb_normal(c1 bigint not null, b char(200)) engine=innodb;
show warnings;
create table innodb_compact(c1 bigint not null, b char(200)) engine=innodb row_format=compact encrypted=yes encryption_key_id=1;
@@ -85,9 +77,6 @@ SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_
--source include/restart_mysqld.inc
-SET GLOBAL innodb_file_format = `Barracuda`;
-SET GLOBAL innodb_file_per_table = ON;
-
update innodb_normal set c1 = c1 +1;
update innodb_compact set c1 = c1 + 1;
update innodb_compressed set c1 = c1 + 1;
@@ -124,9 +113,6 @@ show create table innodb_redundant;
--source include/restart_mysqld.inc
-SET GLOBAL innodb_file_format = `Barracuda`;
-SET GLOBAL innodb_file_per_table = ON;
-
show create table innodb_compact;
show create table innodb_compressed;
show create table innodb_dynamic;
@@ -161,9 +147,3 @@ drop table innodb_compressed;
drop table innodb_dynamic;
drop table innodb_redundant;
drop table innodb_defkey;
-
-# reset system
---disable_query_log
-EVAL SET GLOBAL innodb_file_per_table = $innodb_file_per_table_orig;
-EVAL SET GLOBAL innodb_file_format = $innodb_file_format_orig;
---enable_query_log
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 eb293e97693..2fe29e0cb5c 100644
--- a/mysql-test/suite/encryption/t/innodb-page_encryption_compression.test
+++ b/mysql-test/suite/encryption/t/innodb-page_encryption_compression.test
@@ -5,15 +5,9 @@
# Test heavy not tested on valgrind
-- source include/not_valgrind.inc
---disable_query_log
let $innodb_compression_algorithm_orig=`SELECT @@innodb_compression_algorithm`;
-let $innodb_file_format_orig = `SELECT @@innodb_file_format`;
-let $innodb_file_per_table_orig = `SELECT @@innodb_file_per_table`;
let $encryption = `SELECT @@innodb_encrypt_tables`;
---enable_query_log
-SET GLOBAL innodb_file_format = `Barracuda`;
-SET GLOBAL innodb_file_per_table = ON;
# zlib
set global innodb_compression_algorithm = 1;
@@ -67,8 +61,6 @@ SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_
--source include/restart_mysqld.inc
-SET GLOBAL innodb_file_format = `Barracuda`;
-SET GLOBAL innodb_file_per_table = ON;
# zlib
set global innodb_compression_algorithm = 1;
@@ -97,9 +89,6 @@ show create table innodb_dynamic;
--source include/restart_mysqld.inc
-SET GLOBAL innodb_file_format = `Barracuda`;
-SET GLOBAL innodb_file_per_table = ON;
-
show create table innodb_normal;
show create table innodb_compact;
show create table innodb_dynamic;
@@ -128,7 +117,5 @@ drop table innodb_dynamic;
# reset system
--disable_query_log
EVAL SET GLOBAL innodb_compression_algorithm = $innodb_compression_algorithm_orig;
-EVAL SET GLOBAL innodb_file_per_table = $innodb_file_per_table_orig;
-EVAL SET GLOBAL innodb_file_format = $innodb_file_format_orig;
EVAL SET GLOBAL innodb_encrypt_tables = $encryption;
--enable_query_log
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 b6fe0d10b65..f7eab67154d 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
@@ -2,18 +2,10 @@
-- source include/not_embedded.inc
-- source include/have_file_key_management_plugin.inc
---disable_query_log
-let $innodb_file_format_orig = `SELECT @@innodb_file_format`;
-let $innodb_file_per_table_orig = `SELECT @@innodb_file_per_table`;
---enable_query_log
-
call mtr.add_suppression("KeyID 0 not found or with error. Check the key and the log*");
call mtr.add_suppression("Disabling redo log encryp*");
call mtr.add_suppression("InnoDB: Redo log crypto: Can't initialize to key version*");
-SET GLOBAL innodb_file_format = `Barracuda`;
-SET GLOBAL innodb_file_per_table = ON;
-
create table innodb_normal(c1 bigint not null, b char(200)) engine=innodb;
show warnings;
create table innodb_compact(c1 bigint not null, b char(200)) engine=innodb row_format=compact encrypted=yes encryption_key_id=1;
@@ -77,9 +69,6 @@ SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_
--source include/restart_mysqld.inc
-SET GLOBAL innodb_file_format = `Barracuda`;
-SET GLOBAL innodb_file_per_table = ON;
-
update innodb_normal set c1 = c1 +1;
update innodb_compact set c1 = c1 + 1;
update innodb_compressed set c1 = c1 + 1;
@@ -112,9 +101,6 @@ show create table innodb_redundant;
--source include/restart_mysqld.inc
-SET GLOBAL innodb_file_format = `Barracuda`;
-SET GLOBAL innodb_file_per_table = ON;
-
show create table innodb_compact;
show create table innodb_compressed;
show create table innodb_dynamic;
@@ -160,9 +146,3 @@ INSERT INTO t1 VALUES (1),(2);
SELECT * FROM t1;
DROP TABLE t1;
-
-# reset system
---disable_query_log
-EVAL SET GLOBAL innodb_file_per_table = $innodb_file_per_table_orig;
-EVAL SET GLOBAL innodb_file_format = $innodb_file_format_orig;
---enable_query_log
diff --git a/mysql-test/suite/encryption/t/innodb_encryption-page-compression.test b/mysql-test/suite/encryption/t/innodb_encryption-page-compression.test
index c2c7bd96d3e..606662e44e6 100644
--- a/mysql-test/suite/encryption/t/innodb_encryption-page-compression.test
+++ b/mysql-test/suite/encryption/t/innodb_encryption-page-compression.test
@@ -4,16 +4,10 @@
# embedded does not support restart
-- source include/not_embedded.inc
---disable_query_log
let $innodb_compression_algorithm_orig=`SELECT @@innodb_compression_algorithm`;
-let $innodb_file_format_orig = `SELECT @@innodb_file_format`;
-let $innodb_file_per_table_orig = `SELECT @@innodb_file_per_table`;
let $innodb_encrypt_tables_orig = `SELECT @@innodb_encrypt_tables`;
let $innodb_encryption_threads_orig = `SELECT @@innodb_encryption_threads`;
---enable_query_log
-SET GLOBAL innodb_file_format = `Barracuda`;
-SET GLOBAL innodb_file_per_table = ON;
SET GLOBAL innodb_encryption_threads = 4;
SET GLOBAL innodb_encrypt_tables = on;
@@ -161,9 +155,6 @@ drop table innodb_page_compressed9;
# reset system
--disable_query_log
EVAL SET GLOBAL innodb_compression_algorithm = $innodb_compression_algorithm_orig;
-EVAL SET GLOBAL innodb_file_per_table = $innodb_file_per_table_orig;
-EVAL SET GLOBAL innodb_file_format = $innodb_file_format_orig;
EVAL SET GLOBAL innodb_encrypt_tables = $innodb_encrypt_tables_orig;
EVAL SET GLOBAL innodb_encryption_threads = $innodb_encryption_threads_orig;
--enable_query_log
-
diff --git a/mysql-test/suite/encryption/t/innodb_encryption_discard_import.test b/mysql-test/suite/encryption/t/innodb_encryption_discard_import.test
index 32ba5d306f4..075cb1cf77e 100644
--- a/mysql-test/suite/encryption/t/innodb_encryption_discard_import.test
+++ b/mysql-test/suite/encryption/t/innodb_encryption_discard_import.test
@@ -15,16 +15,6 @@ let $MYSQLD_DATADIR = `SELECT @@datadir`;
--let t2_IBD = $MYSQLD_DATADIR/test/t2.ibd
--let t3_IBD = $MYSQLD_DATADIR/test/t3.ibd
---disable_query_log
-let $innodb_file_format_orig = `SELECT @@innodb_file_format`;
-let $innodb_file_per_table_orig = `SELECT @@innodb_file_per_table`;
---enable_query_log
-
---disable_warnings
-SET GLOBAL innodb_file_format = `Barracuda`;
-SET GLOBAL innodb_file_per_table = ON;
---enable_warnings
-
CREATE TABLE t1 (id INT NOT NULL PRIMARY KEY, a VARCHAR(255)) ENGINE=InnoDB encrypted=yes;
CREATE TABLE t2 (id INT NOT NULL PRIMARY KEY, a VARCHAR(255)) ENGINE=InnoDB;
CREATE TABLE t3 (id INT NOT NULL PRIMARY KEY, a VARCHAR(255)) ENGINE=InnoDB row_format=compressed encrypted=yes;
@@ -154,11 +144,3 @@ SELECT COUNT(1) FROM t3;
DROP PROCEDURE innodb_insert_proc;
DROP TABLE t1, t2, t3;
-
-# reset system
---disable_warnings
---disable_query_log
-eval SET GLOBAL innodb_file_per_table = $innodb_file_per_table_orig;
-eval SET GLOBAL innodb_file_format = $innodb_file_format_orig;
---enable_query_log
---enable_warnings
diff --git a/mysql-test/suite/encryption/t/innodb_encryption_filekeys.test b/mysql-test/suite/encryption/t/innodb_encryption_filekeys.test
index 8f0986071f1..47d546ae698 100644
--- a/mysql-test/suite/encryption/t/innodb_encryption_filekeys.test
+++ b/mysql-test/suite/encryption/t/innodb_encryption_filekeys.test
@@ -5,15 +5,9 @@
call mtr.add_suppression("trying to do an operation on a dropped tablespace .*");
---disable_query_log
-let $innodb_file_format_orig = `SELECT @@innodb_file_format`;
-let $innodb_file_per_table_orig = `SELECT @@innodb_file_per_table`;
let $encrypt_tables = `SELECT @@innodb_encrypt_tables`;
let $threads = `SELECT @@innodb_encryption_threads`;
---enable_query_log
-SET GLOBAL innodb_file_format = `Barracuda`;
-SET GLOBAL innodb_file_per_table = ON;
SET GLOBAL innodb_encrypt_tables = OFF;
SET GLOBAL innodb_encryption_threads = 4;
@@ -133,8 +127,6 @@ SELECT COUNT(1) FROM t5;
# reset system
--disable_query_log
-EVAL SET GLOBAL innodb_file_per_table = $innodb_file_per_table_orig;
-EVAL SET GLOBAL innodb_file_format = $innodb_file_format_orig;
EVAL SET GLOBAL innodb_encrypt_tables = $encrypt_tables;
EVAL SET GLOBAL innodb_encryption_threads = $threads;
--enable_query_log
@@ -142,4 +134,3 @@ EVAL SET GLOBAL innodb_encryption_threads = $threads;
drop table t1,t2,t3,t4, t5;
set GLOBAL innodb_default_encryption_key_id=1;
-
diff --git a/mysql-test/suite/encryption/t/innodb_encryption_is.test b/mysql-test/suite/encryption/t/innodb_encryption_is.test
index 333bb84c634..52574aa2b9d 100644
--- a/mysql-test/suite/encryption/t/innodb_encryption_is.test
+++ b/mysql-test/suite/encryption/t/innodb_encryption_is.test
@@ -1,14 +1,6 @@
-- source include/have_innodb.inc
-- source include/have_file_key_management_plugin.inc
---disable_query_log
-let $innodb_file_format_orig = `SELECT @@innodb_file_format`;
-let $innodb_file_per_table_orig = `SELECT @@innodb_file_per_table`;
---enable_query_log
-
-SET GLOBAL innodb_file_format = `Barracuda`;
-SET GLOBAL innodb_file_per_table = ON;
-
CREATE TABLE t1 (c VARCHAR(8)) ENGINE=InnoDB ENCRYPTED=YES ENCRYPTION_KEY_ID=1;
CREATE TABLE t2 (c VARCHAR(8)) ENGINE=InnoDB ENCRYPTED=YES ENCRYPTION_KEY_ID=2;
INSERT INTO t1 VALUES ('foobar');
@@ -23,9 +15,3 @@ FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION
WHERE NAME LIKE '%t1' OR NAME LIKE '%t2';
DROP TABLE t1, t2;
-
-# reset system
---disable_query_log
-EVAL SET GLOBAL innodb_file_per_table = $innodb_file_per_table_orig;
-EVAL SET GLOBAL innodb_file_format = $innodb_file_format_orig;
---enable_query_log
diff --git a/mysql-test/suite/encryption/t/innodb_encryption_row_compressed.test b/mysql-test/suite/encryption/t/innodb_encryption_row_compressed.test
index 0a28c1690a2..d6319164c35 100644
--- a/mysql-test/suite/encryption/t/innodb_encryption_row_compressed.test
+++ b/mysql-test/suite/encryption/t/innodb_encryption_row_compressed.test
@@ -2,14 +2,6 @@
-- source include/have_file_key_management_plugin.inc
-- source include/not_embedded.inc
---disable_query_log
-let $innodb_file_format_orig = `SELECT @@innodb_file_format`;
-let $innodb_file_per_table_orig = `SELECT @@innodb_file_per_table`;
---enable_query_log
-
-SET GLOBAL innodb_file_format = `Barracuda`;
-SET GLOBAL innodb_file_per_table = ON;
-
create table innodb_compressed1(c1 bigint not null primary key, d int, a varchar(20), b char(200)) engine=innodb row_format=compressed encrypted=yes;
create table innodb_compressed2(c1 bigint not null primary key, d int, a varchar(20), b char(200)) engine=innodb row_format=compressed key_block_size=1 encrypted=yes;
create table innodb_compressed3(c1 bigint not null primary key, d int, a varchar(20), b char(200)) engine=innodb row_format=compressed key_block_size=2 encrypted=yes;
@@ -52,9 +44,6 @@ insert into innodb_compressed4 select * from innodb_compressed1;
-- let SEARCH_FILE=$t4_IBD
-- source include/search_pattern_in_file.inc
-SET GLOBAL innodb_file_format = `Barracuda`;
-SET GLOBAL innodb_file_per_table = ON;
-
select * from innodb_compressed1 where d = 20;
select * from innodb_compressed1 where d = 30;
select * from innodb_compressed2 where d = 20;
@@ -117,9 +106,3 @@ drop table innodb_compressed1;
drop table innodb_compressed2;
drop table innodb_compressed3;
drop table innodb_compressed4;
-
-# reset system
---disable_query_log
-EVAL SET GLOBAL innodb_file_per_table = $innodb_file_per_table_orig;
-EVAL SET GLOBAL innodb_file_format = $innodb_file_format_orig;
---enable_query_log
diff --git a/mysql-test/suite/encryption/t/innodb_encryption_tables.test b/mysql-test/suite/encryption/t/innodb_encryption_tables.test
index f806b776800..bc762faf12e 100644
--- a/mysql-test/suite/encryption/t/innodb_encryption_tables.test
+++ b/mysql-test/suite/encryption/t/innodb_encryption_tables.test
@@ -2,14 +2,6 @@
-- source include/have_example_key_management_plugin.inc
-- source include/not_embedded.inc
---disable_query_log
-let $innodb_file_format_orig = `SELECT @@innodb_file_format`;
-let $innodb_file_per_table_orig = `SELECT @@innodb_file_per_table`;
---enable_query_log
-
-SET GLOBAL innodb_file_format = `Barracuda`;
-SET GLOBAL innodb_file_per_table = ON;
-
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;
create table innodb_dynamic(c1 bigint not null, b char(200)) engine=innodb row_format=dynamic;
@@ -73,9 +65,6 @@ SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_
--source include/restart_mysqld.inc
-SET GLOBAL innodb_file_format = `Barracuda`;
-SET GLOBAL innodb_file_per_table = ON;
-
update innodb_normal set c1 = c1 + 1;
update innodb_compact set c1 = c1 + 1;
update innodb_dynamic set c1 = c1 + 1;
@@ -106,9 +95,3 @@ drop table innodb_compact;
drop table innodb_dynamic;
drop table innodb_compressed;
drop table innodb_redundant;
-
-# reset system
---disable_query_log
-EVAL SET GLOBAL innodb_file_per_table = $innodb_file_per_table_orig;
-EVAL SET GLOBAL innodb_file_format = $innodb_file_format_orig;
---enable_query_log
diff --git a/mysql-test/suite/encryption/t/innodb_onlinealter_encryption.test b/mysql-test/suite/encryption/t/innodb_onlinealter_encryption.test
index 40beb10bcdb..eb90c446a81 100644
--- a/mysql-test/suite/encryption/t/innodb_onlinealter_encryption.test
+++ b/mysql-test/suite/encryption/t/innodb_onlinealter_encryption.test
@@ -4,14 +4,6 @@
-- source include/not_embedded.inc
-- source include/not_windows.inc
---disable_query_log
-let $innodb_file_format_orig = `SELECT @@innodb_file_format`;
-let $innodb_file_per_table_orig = `SELECT @@innodb_file_per_table`;
---enable_query_log
-
-SET GLOBAL innodb_file_format = `Barracuda`;
-SET GLOBAL innodb_file_per_table = ON;
-
--let $MYSQLD_DATADIR=`select @@datadir`
--let SEARCH_RANGE = 10000000
--let t1_IBD = $MYSQLD_DATADIR/test/t1.ibd
@@ -183,9 +175,3 @@ select count(1) from t7;
DROP PROCEDURE innodb_insert_proc;
DROP TABLE t1, t2, t3, t4, t5, t6, t7;
-
-# reset system
---disable_query_log
-EVAL SET GLOBAL innodb_file_per_table = $innodb_file_per_table_orig;
-EVAL SET GLOBAL innodb_file_format = $innodb_file_format_orig;
---enable_query_log
diff --git a/mysql-test/suite/encryption/t/innodb_page_encryption_key_change.test b/mysql-test/suite/encryption/t/innodb_page_encryption_key_change.test
index 7cbf005ed32..1babf577473 100644
--- a/mysql-test/suite/encryption/t/innodb_page_encryption_key_change.test
+++ b/mysql-test/suite/encryption/t/innodb_page_encryption_key_change.test
@@ -7,14 +7,6 @@
-- let $restart_parameters=--loose-file-key-management-filename=$MYSQL_TEST_DIR/std_data/keys2.txt
-- source include/restart_mysqld.inc
---disable_query_log
-let $innodb_file_format_orig = `SELECT @@innodb_file_format`;
-let $innodb_file_per_table_orig = `SELECT @@innodb_file_per_table`;
---enable_query_log
-
-SET GLOBAL innodb_file_format = `Barracuda`;
-SET GLOBAL innodb_file_per_table = ON;
-
create table innodb_normal(c1 bigint not null, b char(200)) engine=innodb;
show warnings;
create table innodb_compact(c1 bigint not null, b char(200)) engine=innodb row_format=compact encrypted=yes encryption_key_id=2;
@@ -65,9 +57,6 @@ select * from innodb_redundant;
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';
-SET GLOBAL innodb_file_format = `Barracuda`;
-SET GLOBAL innodb_file_per_table = ON;
-
alter table innodb_compact engine=innodb encryption_key_id = 2;
alter table innodb_compressed engine=innodb encryption_key_id = 3;
alter table innodb_dynamic engine=innodb encryption_key_id = 4;
@@ -88,9 +77,3 @@ drop table innodb_compact;
drop table innodb_compressed;
drop table innodb_dynamic;
drop table innodb_redundant;
-
-# reset system
---disable_query_log
-EVAL SET GLOBAL innodb_file_per_table = $innodb_file_per_table_orig;
-EVAL SET GLOBAL innodb_file_format = $innodb_file_format_orig;
---enable_query_log
diff --git a/mysql-test/suite/encryption/t/innodb_scrub.opt b/mysql-test/suite/encryption/t/innodb_scrub.opt
index 3adb645c589..ef43b2a20a8 100644
--- a/mysql-test/suite/encryption/t/innodb_scrub.opt
+++ b/mysql-test/suite/encryption/t/innodb_scrub.opt
@@ -2,8 +2,6 @@
--innodb-background-scrub-data-uncompressed=OFF
--innodb-encrypt-tables=OFF
--innodb-encryption-threads=0
---innodb-file-format=Barracuda
---innodb-file-per-table=1
--innodb-immediate-scrub-data-uncompressed=ON
--loose-innodb-debug-force-scrubbing=ON
--innodb-tablespaces-scrubbing
diff --git a/mysql-test/suite/encryption/t/innodb_scrub_background.opt b/mysql-test/suite/encryption/t/innodb_scrub_background.opt
index 1cc525b2402..04987f4a3ad 100644
--- a/mysql-test/suite/encryption/t/innodb_scrub_background.opt
+++ b/mysql-test/suite/encryption/t/innodb_scrub_background.opt
@@ -1,5 +1,3 @@
---innodb-file-per-table=1
---innodb-file-format=Barracuda
--innodb-immediate-scrub-data-uncompressed=OFF
--innodb-background-scrub-data-uncompressed=ON
--innodb-background-scrub-data-compressed=ON
diff --git a/mysql-test/suite/galera/disabled.def b/mysql-test/suite/galera/disabled.def
index f2e4077016a..a738e97271b 100644
--- a/mysql-test/suite/galera/disabled.def
+++ b/mysql-test/suite/galera/disabled.def
@@ -41,3 +41,6 @@ galera_sst_xtrabackup-v2-options : TODO: Fix test case
galera_sst_xtrabackup-v2 : MDEV-11208
galera_sst_xtrabackup-v2_encrypt_with_key : MDEV-11208
mysql-wsrep#33 : TODO: investigate
+galera_var_innodb_disallow_writes : MDEV-10949
+galera_many_tables_pk : MDEV-11927
+galera_many_tables_nopk : MDEV-11927
diff --git a/mysql-test/suite/galera/r/create.result b/mysql-test/suite/galera/r/create.result
index 4d6488d324b..a445b32e8bf 100644
--- a/mysql-test/suite/galera/r/create.result
+++ b/mysql-test/suite/galera/r/create.result
@@ -7,6 +7,8 @@ SHOW VARIABLES LIKE '%log%bin%';
Variable_name Value
log_bin OFF
log_bin_basename
+log_bin_compress OFF
+log_bin_compress_min_len 256
log_bin_index
log_bin_trust_function_creators ON
sql_log_bin ON
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 86789a1b8e9..e5bd486eadc 100644
--- a/mysql-test/suite/galera/r/galera_forced_binlog_format.result
+++ b/mysql-test/suite/galera/r/galera_forced_binlog_format.result
@@ -2,12 +2,12 @@ connection node_1;
RESET MASTER;
SET SESSION binlog_format = 'STATEMENT';
Warnings:
-Warning 1105 MariaDB Galera does not support binlog format: STATEMENT
+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 does not support binlog format: MIXED
+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_parallel_apply_lock_table.result b/mysql-test/suite/galera/r/galera_parallel_apply_lock_table.result
index bf4b056a6e4..90349f493bd 100644
--- a/mysql-test/suite/galera/r/galera_parallel_apply_lock_table.result
+++ b/mysql-test/suite/galera/r/galera_parallel_apply_lock_table.result
@@ -11,7 +11,7 @@ SET SESSION wsrep_sync_wait=0;
SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE LIKE '%applied write set%';
COUNT(*) = 1
1
-SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE LIKE '%Waiting for table level lock%';
+SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE LIKE 'Waiting for table metadata lock';
COUNT(*) = 1
1
SELECT COUNT(*) = 0 FROM t1;
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 336f46fcd7e..dd30f5af384 100644
--- a/mysql-test/suite/galera/r/galera_parallel_autoinc_largetrx.result
+++ b/mysql-test/suite/galera/r/galera_parallel_autoinc_largetrx.result
@@ -19,7 +19,8 @@ COUNT(*) = 30000
SELECT COUNT(DISTINCT f1) = 30000 FROM t1;
COUNT(DISTINCT f1) = 30000
1
-SELECT COUNT(*) = 5 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user';
+SELECT COUNT(*) = 5 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE
+USER = 'system user' AND NOT STATE <=> 'InnoDB background thread';
COUNT(*) = 5
1
connection default;
diff --git a/mysql-test/suite/galera/r/galera_sbr.result b/mysql-test/suite/galera/r/galera_sbr.result
index 61a58c9cb89..0bdaeef5b8a 100644
--- a/mysql-test/suite/galera/r/galera_sbr.result
+++ b/mysql-test/suite/galera/r/galera_sbr.result
@@ -1,12 +1,12 @@
connection node_1;
SET SESSION binlog_format = 'STATEMENT';
Warnings:
-Warning 1105 MariaDB Galera does not support binlog format: STATEMENT
+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 does not support binlog format: MIXED
+Warning 1105 MariaDB Galera and flashback do not support binlog format: MIXED
INSERT INTO t1 VALUES (2);
connection node_2;
SELECT COUNT(*) = 2 FROM t1;
diff --git a/mysql-test/suite/galera/r/galera_sbr_binlog.result b/mysql-test/suite/galera/r/galera_sbr_binlog.result
index 61a58c9cb89..0bdaeef5b8a 100644
--- a/mysql-test/suite/galera/r/galera_sbr_binlog.result
+++ b/mysql-test/suite/galera/r/galera_sbr_binlog.result
@@ -1,12 +1,12 @@
connection node_1;
SET SESSION binlog_format = 'STATEMENT';
Warnings:
-Warning 1105 MariaDB Galera does not support binlog format: STATEMENT
+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 does not support binlog format: MIXED
+Warning 1105 MariaDB Galera and flashback do not support binlog format: MIXED
INSERT INTO t1 VALUES (2);
connection node_2;
SELECT COUNT(*) = 2 FROM t1;
diff --git a/mysql-test/suite/galera/r/galera_var_slave_threads.result b/mysql-test/suite/galera/r/galera_var_slave_threads.result
index facc083544c..0ad0e3820e0 100644
--- a/mysql-test/suite/galera/r/galera_var_slave_threads.result
+++ b/mysql-test/suite/galera/r/galera_var_slave_threads.result
@@ -12,7 +12,8 @@ SELECT @@wsrep_slave_threads = 1;
@@wsrep_slave_threads = 1
1
SET GLOBAL wsrep_slave_threads = 1;
-SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user';
+SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.PROCESSLIST
+WHERE USER = 'system user' AND NOT STATE <=> 'InnoDB background thread';
COUNT(*) = 2
1
SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE LIKE '%wsrep aborter%';
@@ -25,7 +26,8 @@ connection node_2;
SELECT COUNT(*) = 1 FROM t1;
COUNT(*) = 1
1
-SELECT COUNT(*) = @@wsrep_slave_threads + 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user';
+SELECT COUNT(*) = @@wsrep_slave_threads + 1 FROM INFORMATION_SCHEMA.PROCESSLIST
+WHERE USER = 'system user' AND NOT STATE <=> 'InnoDB background thread';
COUNT(*) = @@wsrep_slave_threads + 1
1
SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE LIKE '%wsrep aborter%';
@@ -101,7 +103,8 @@ connection node_2;
SELECT COUNT(*) = 64 FROM t2;
COUNT(*) = 64
1
-SELECT COUNT(*) = @@wsrep_slave_threads + 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user';
+SELECT COUNT(*) = @@wsrep_slave_threads + 1 FROM INFORMATION_SCHEMA.PROCESSLIST
+WHERE USER = 'system user' AND NOT STATE <=> 'InnoDB background thread';
COUNT(*) = @@wsrep_slave_threads + 1
1
SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE LIKE '%wsrep aborter%';
diff --git a/mysql-test/suite/galera/t/galera_kill_applier.test b/mysql-test/suite/galera/t/galera_kill_applier.test
index e14a8b9af23..71a46114970 100644
--- a/mysql-test/suite/galera/t/galera_kill_applier.test
+++ b/mysql-test/suite/galera/t/galera_kill_applier.test
@@ -7,7 +7,7 @@
--connection node_1
---let $applier_thread = `SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE != 'wsrep aborter idle' OR STATE IS NULL LIMIT 1`
+--let $applier_thread = `SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND NOT STATE <=> 'wsrep aborter idle' AND NOT STATE <=> 'InnoDB background thread' LIMIT 1`
--disable_query_log
--error ER_KILL_DENIED_ERROR,ER_KILL_DENIED_ERROR
diff --git a/mysql-test/suite/galera/t/galera_parallel_apply_lock_table.test b/mysql-test/suite/galera/t/galera_parallel_apply_lock_table.test
index febb91a9725..08ed3fac67e 100644
--- a/mysql-test/suite/galera/t/galera_parallel_apply_lock_table.test
+++ b/mysql-test/suite/galera/t/galera_parallel_apply_lock_table.test
@@ -33,7 +33,7 @@ INSERT INTO t2 VALUES (1);
--sleep 1
SET SESSION wsrep_sync_wait=0;
SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE LIKE '%applied write set%';
-SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE LIKE '%Waiting for table level lock%';
+SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE LIKE 'Waiting for table metadata lock';
SELECT COUNT(*) = 0 FROM t1;
SELECT COUNT(*) = 0 FROM t2;
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 f280e49d206..ea853f8ea01 100644
--- a/mysql-test/suite/galera/t/galera_parallel_autoinc_largetrx.test
+++ b/mysql-test/suite/galera/t/galera_parallel_autoinc_largetrx.test
@@ -39,7 +39,8 @@ SET GLOBAL wsrep_slave_threads = 4;
--reap
SELECT COUNT(*) = 30000 FROM t1;
SELECT COUNT(DISTINCT f1) = 30000 FROM t1;
-SELECT COUNT(*) = 5 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user';
+SELECT COUNT(*) = 5 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE
+ USER = 'system user' AND NOT STATE <=> 'InnoDB background thread';
--disable_query_log
--eval SET GLOBAL wsrep_slave_threads = $wsrep_slave_threads_orig;
diff --git a/mysql-test/suite/galera/t/galera_var_slave_threads.test b/mysql-test/suite/galera/t/galera_var_slave_threads.test
index 50e22fbef66..23608ad32a9 100644
--- a/mysql-test/suite/galera/t/galera_var_slave_threads.test
+++ b/mysql-test/suite/galera/t/galera_var_slave_threads.test
@@ -22,7 +22,8 @@ SELECT @@wsrep_slave_threads = 1;
SET GLOBAL wsrep_slave_threads = 1;
# There is a separate wsrep_aborter thread at all times
-SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user';
+SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.PROCESSLIST
+ WHERE USER = 'system user' AND NOT STATE <=> 'InnoDB background thread';
SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE LIKE '%wsrep aborter%';
#
@@ -38,7 +39,8 @@ INSERT INTO t1 VALUES (1);
--connection node_2
SELECT COUNT(*) = 1 FROM t1;
-SELECT COUNT(*) = @@wsrep_slave_threads + 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user';
+SELECT COUNT(*) = @@wsrep_slave_threads + 1 FROM INFORMATION_SCHEMA.PROCESSLIST
+ WHERE USER = 'system user' AND NOT STATE <=> 'InnoDB background thread';
SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE LIKE '%wsrep aborter%';
#
@@ -60,7 +62,8 @@ while ($count)
--connection node_2
SELECT COUNT(*) = 64 FROM t2;
-SELECT COUNT(*) = @@wsrep_slave_threads + 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user';
+SELECT COUNT(*) = @@wsrep_slave_threads + 1 FROM INFORMATION_SCHEMA.PROCESSLIST
+ WHERE USER = 'system user' AND NOT STATE <=> 'InnoDB background thread';
SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE LIKE '%wsrep aborter%';
diff --git a/mysql-test/suite/gcol/r/innodb_virtual_basic.result b/mysql-test/suite/gcol/r/innodb_virtual_basic.result
index 06a307fc761..f55085ce2f8 100644
--- a/mysql-test/suite/gcol/r/innodb_virtual_basic.result
+++ b/mysql-test/suite/gcol/r/innodb_virtual_basic.result
@@ -209,7 +209,7 @@ CREATE TABLE t1(a INT);
CREATE INDEX idx ON t1(a);
CREATE TABLE t3(a INT, b INT , INDEX(b), CONSTRAINT x FOREIGN KEY(b) REFERENCES t1(a));
CREATE TABLE t2(a INT, b INT generated always as (a+1) virtual, INDEX(b), CONSTRAINT x FOREIGN KEY(b) REFERENCES t1(a));
-ERROR HY000: Can't create table `test`.`t2` (errno: 150 "Foreign key constraint is incorrectly formed")
+ERROR HY000: Can't create table `test`.`t2` (errno: 121 "Duplicate key on write or update")
CREATE TABLE t2(a INT, b INT generated always as (a+1) virtual, INDEX(b));
DROP TABLE t3;
DROP TABLE t2;
diff --git a/mysql-test/suite/innodb/include/dml_ops.inc b/mysql-test/suite/innodb/include/dml_ops.inc
new file mode 100644
index 00000000000..4908dfb6bee
--- /dev/null
+++ b/mysql-test/suite/innodb/include/dml_ops.inc
@@ -0,0 +1,82 @@
+delimiter |;
+create procedure populate_t1()
+begin
+ declare i int default 1;
+ while (i <= 200) do
+ insert into t1 values (i, 'a', 'b');
+ set i = i + 1;
+ end while;
+end|
+create procedure populate_t1_small()
+begin
+ declare i int default 1;
+ while (i <= 20) do
+ insert into t1 values (i, 'c', 'd');
+ set i = i + 1;
+ end while;
+end|
+create procedure populate_t1_small2()
+begin
+ declare i int default 30;
+ while (i <= 50) do
+ insert into t1 values (i, 'e', 'f');
+ set i = i + 1;
+ end while;
+end|
+delimiter ;|
+#
+begin;
+select count(*) from t1;
+call populate_t1();
+select count(*) from t1;
+select * from t1 limit 10;
+rollback;
+select count(*) from t1;
+#
+begin;
+call populate_t1();
+select count(*) from t1;
+commit;
+select count(*) from t1;
+#
+truncate table t1;
+select count(*) from t1;
+#
+call populate_t1_small();
+select count(*) from t1;
+rollback;
+select count(*) from t1;
+truncate table t1;
+#
+call populate_t1();
+select count(*) from t1;
+delete from t1 where keyc <= 60;
+select count(*) from t1;
+call populate_t1_small();
+select count(*) from t1;
+select * from t1 limit 10;
+begin;
+call populate_t1_small2();
+select count(*) from t1;
+select * from t1 where keyc > 30 limit 10;
+rollback;
+select count(*) from t1;
+select * from t1 where keyc > 30 limit 10;
+#
+update t1 set keyc = keyc + 2000;
+select * from t1 limit 10;
+rollback;
+begin;
+update t1 set keyc = keyc + 2000;
+select * from t1 limit 10;
+rollback;
+select * from t1 limit 10;
+commit;
+select * from t1 limit 10;
+#
+insert into t2 select * from t1 where keyc < 2101;
+select count(*) from t2;
+#
+drop procedure populate_t1;
+drop procedure populate_t1_small;
+drop procedure populate_t1_small2;
diff --git a/mysql-test/suite/innodb/include/have_innodb_punchhole.inc b/mysql-test/suite/innodb/include/have_innodb_punchhole.inc
new file mode 100644
index 00000000000..74cd5c4e0f2
--- /dev/null
+++ b/mysql-test/suite/innodb/include/have_innodb_punchhole.inc
@@ -0,0 +1,4 @@
+if (!`SELECT COUNT(*) FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE LOWER(variable_name) = 'innodb_have_punch_hole' AND variable_value = 'ON'`)
+{
+ --skip Test requires InnoDB compiled with fallocate(FALLOC_PUNCH_HOLE| FALLOC_KEEP_SIZE)
+}
diff --git a/mysql-test/suite/innodb/include/ibd_convert.pl b/mysql-test/suite/innodb/include/ibd_convert.pl
new file mode 100644
index 00000000000..32eef96fd23
--- /dev/null
+++ b/mysql-test/suite/innodb/include/ibd_convert.pl
@@ -0,0 +1,25 @@
+#!/usr/bin/perl
+# Convert tablespace flags to the format understood by MariaDB 10.1.0..10.1.20,
+# with the assumption that the flags were correct.
+
+sub convert_to_mariadb_101
+{
+ my ($file, $page_size) = @_;
+ open(FILE, "+<", $file) or die "Unable to open $file\n";
+ sysread(FILE, $_, $page_size)==$page_size||die "Unable to read $file\n";
+ sysseek(FILE, 0, 0)||die "Unable to seek $file\n";
+
+ # FIL_PAGE_DATA + FSP_SPACE_FLAGS = 38 + 16 = 54 bytes from the start
+ my($flags) = unpack "x[54]N", $_;
+ my $badflags = ($flags & 0x3f);
+ my $compression_level=6;
+ $badflags |= 1<<6|$compression_level<<7 if ($flags & 1 << 16);
+ $badflags |= ($flags & 15 << 6) << 7; # PAGE_SSIZE
+
+ substr ($_, 54, 4) = pack("N", $badflags);
+ # Replace the innodb_checksum_algorithm=none checksum
+ substr ($_, 0, 4) = pack("N", 0xdeadbeef);
+ substr ($_, $page_size - 8, 4) = pack("N", 0xdeadbeef);
+ syswrite(FILE, $_, $page_size)==$page_size||die "Unable to write $file\n";
+ close(FILE);
+}
diff --git a/mysql-test/suite/innodb/include/innodb_simulate_comp_failures.inc b/mysql-test/suite/innodb/include/innodb_simulate_comp_failures.inc
index 75cab775528..d9c0294faf5 100644
--- a/mysql-test/suite/innodb/include/innodb_simulate_comp_failures.inc
+++ b/mysql-test/suite/innodb/include/innodb_simulate_comp_failures.inc
@@ -5,19 +5,10 @@
--source include/not_embedded.inc
--source include/have_innodb.inc
---disable_query_log
-# record the file format in order to restore in the end.
---let $file_format_save = `SELECT @@innodb_file_format`
---let $file_format_max_save = `SELECT @@innodb_file_format_max`
--let $simulate_comp_failures_save = `SELECT @@innodb_simulate_comp_failures`
---disable_warnings
-DROP TABLE IF EXISTS t1;
-SET GLOBAL INNODB_FILE_FORMAT='Barracuda';
---enable_warnings
-
-# since this test generates lot of errors in log, suppress checking errors
-call mtr.add_suppression(".*");
+--disable_query_log
+call mtr.add_suppression("InnoDB: Simulating a compression failure for table `test`\\.`t1`");
--enable_query_log
# create the table with compressed pages of size 8K.
@@ -156,9 +147,6 @@ COMMIT;
# final cleanup
DROP TABLE t1;
-# restore innodb_file_format and innodb_file_format_max
-eval SET GLOBAL innodb_file_format = \"$file_format_save\";
-eval SET GLOBAL innodb_file_format_max = \"$file_format_max_save\";
eval SET GLOBAL innodb_simulate_comp_failures = $simulate_comp_failures_save;
--enable_query_log
diff --git a/mysql-test/suite/innodb/include/innodb_wl6501_crash.inc b/mysql-test/suite/innodb/include/innodb_wl6501_crash.inc
index 047be4dba34..93eca7ec060 100644
--- a/mysql-test/suite/innodb/include/innodb_wl6501_crash.inc
+++ b/mysql-test/suite/innodb/include/innodb_wl6501_crash.inc
@@ -37,7 +37,6 @@ call mtr.add_suppression("InnoDB: Error number 17 means 'File exists'");
# create test-bed
#
let $per_table = `select @@innodb_file_per_table`;
-let $format = `select @@innodb_file_format`;
eval set global innodb_file_per_table = on;
let $WL6501_TMP_DIR = `select @@tmpdir`;
@@ -51,7 +50,6 @@ let SEARCH_FILE = $MYSQLTEST_VARDIR/log/my_restart.err;
--echo "1. Hit crash point while writing redo log."
use test;
eval set global innodb_file_per_table = $wl6501_file_per_table;
-eval set global innodb_file_format = $wl6501_file_format;
SET innodb_strict_mode=OFF;
--disable_warnings
eval create $wl6501_temp table t (
@@ -82,7 +80,6 @@ drop table t;
--echo "2. Hit crash point on completion of redo log write."
use test;
eval set global innodb_file_per_table = $wl6501_file_per_table;
-eval set global innodb_file_format = $wl6501_file_format;
SET innodb_strict_mode=OFF;
--disable_warnings
eval create $wl6501_temp table t (
@@ -115,7 +112,6 @@ drop table t;
--echo "3. Hit crash point while dropping indexes."
use test;
eval set global innodb_file_per_table = $wl6501_file_per_table;
-eval set global innodb_file_format = $wl6501_file_format;
SET innodb_strict_mode=OFF;
--disable_warnings
eval create $wl6501_temp table t (
@@ -144,7 +140,6 @@ drop table t;
#
use test;
eval set global innodb_file_per_table = $wl6501_file_per_table;
-eval set global innodb_file_format = $wl6501_file_format;
SET innodb_strict_mode=OFF;
--disable_warnings
eval create $wl6501_temp table t (
@@ -174,7 +169,6 @@ drop table t;
#
use test;
eval set global innodb_file_per_table = $wl6501_file_per_table;
-eval set global innodb_file_format = $wl6501_file_format;
SET innodb_strict_mode=OFF;
--disable_warnings
eval create $wl6501_temp table t (
@@ -209,7 +203,6 @@ drop table t;
--echo " of index is commenced."
use test;
eval set global innodb_file_per_table = $wl6501_file_per_table;
-eval set global innodb_file_format = $wl6501_file_format;
SET innodb_strict_mode=OFF;
--disable_warnings
eval create $wl6501_temp table t (
@@ -242,7 +235,6 @@ drop table t;
--echo "5. Hit crash point while creating indexes."
use test;
eval set global innodb_file_per_table = $wl6501_file_per_table;
-eval set global innodb_file_format = $wl6501_file_format;
SET innodb_strict_mode=OFF;
--disable_warnings
eval create $wl6501_temp table t (
@@ -271,7 +263,6 @@ drop table t;
#
use test;
eval set global innodb_file_per_table = $wl6501_file_per_table;
-eval set global innodb_file_format = $wl6501_file_format;
SET innodb_strict_mode=OFF;
--disable_warnings
eval create $wl6501_temp table t (
@@ -300,7 +291,6 @@ drop table t;
#
use test;
eval set global innodb_file_per_table = $wl6501_file_per_table;
-eval set global innodb_file_format = $wl6501_file_format;
SET innodb_strict_mode=OFF;
--disable_warnings
eval create $wl6501_temp table t (
@@ -334,7 +324,6 @@ drop table t;
--echo " in-memory dict."
use test;
eval set global innodb_file_per_table = $wl6501_file_per_table;
-eval set global innodb_file_format = $wl6501_file_format;
SET innodb_strict_mode=OFF;
--disable_warnings
eval create $wl6501_temp table t (
@@ -367,7 +356,6 @@ drop table t;
--echo "7. Hit crash point before/after log checkpoint is done."
use test;
eval set global innodb_file_per_table = $wl6501_file_per_table;
-eval set global innodb_file_format = $wl6501_file_format;
SET innodb_strict_mode=OFF;
--disable_warnings
eval create $wl6501_temp table t (
@@ -395,7 +383,6 @@ drop table t;
#
use test;
eval set global innodb_file_per_table = $wl6501_file_per_table;
-eval set global innodb_file_format = $wl6501_file_format;
SET innodb_strict_mode=OFF;
--disable_warnings
eval create $wl6501_temp table t (
@@ -426,5 +413,4 @@ drop table t;
#
# remove test-bed
#
-eval set global innodb_file_format = $format;
eval set global innodb_file_per_table = $per_table;
diff --git a/mysql-test/suite/innodb/include/innodb_wl6501_crash_temp.inc b/mysql-test/suite/innodb/include/innodb_wl6501_crash_temp.inc
index 76b7b5d59b5..edec93b875c 100644
--- a/mysql-test/suite/innodb/include/innodb_wl6501_crash_temp.inc
+++ b/mysql-test/suite/innodb/include/innodb_wl6501_crash_temp.inc
@@ -30,7 +30,6 @@ call mtr.add_suppression("does not exist in the InnoDB internal");
# create test-bed
#
let $per_table = `select @@innodb_file_per_table`;
-let $format = `select @@innodb_file_format`;
eval set global innodb_file_per_table = on;
let $WL6501_TMP_DIR = `select @@tmpdir`;
@@ -45,7 +44,6 @@ let SEARCH_FILE = $MYSQLTEST_VARDIR/log/my_restart.err;
--echo "1. Hit crash point on completing drop of all indexes before creation"
--echo " of index is commenced."
eval set global innodb_file_per_table = $wl6501_file_per_table;
-eval set global innodb_file_format = $wl6501_file_format;
set innodb_strict_mode=off;
--disable_warnings
eval create $wl6501_temp table t (
@@ -73,7 +71,6 @@ check table t;
--echo "2. Hit crash point after data is updated to system-table and"
--echo " in-memory dict."
eval set global innodb_file_per_table = $wl6501_file_per_table;
-eval set global innodb_file_format = $wl6501_file_format;
set innodb_strict_mode=off;
--disable_warnings
eval create $wl6501_temp table t (
@@ -98,5 +95,4 @@ check table t;
#
# remove test-bed
#
-eval set global innodb_file_format = $format;
eval set global innodb_file_per_table = $per_table;
diff --git a/mysql-test/suite/innodb/include/log_file_cleanup.inc b/mysql-test/suite/innodb/include/log_file_cleanup.inc
new file mode 100644
index 00000000000..ef57d58b788
--- /dev/null
+++ b/mysql-test/suite/innodb/include/log_file_cleanup.inc
@@ -0,0 +1,16 @@
+# Remove ibtmp* which are re-generated after each mysqld invocation
+# skip auto generated auto.cnf from list_files
+--remove_files_wildcard $bugdir ibtmp*
+--remove_files_wildcard $bugdir auto.cnf
+--list_files $bugdir
+--remove_files_wildcard $bugdir ibdata*
+--remove_files_wildcard $bugdir ib_logfile*
+--remove_files_wildcard $bugdir undo00*
+--copy_file $bugdir/bak_ibdata1 $bugdir/ibdata1
+--copy_file $bugdir/bak_ibdata2 $bugdir/ibdata2
+--copy_file $bugdir/bak_ib_logfile0 $bugdir/ib_logfile0
+--copy_file $bugdir/bak_ib_logfile1 $bugdir/ib_logfile1
+--copy_file $bugdir/bak_ib_logfile2 $bugdir/ib_logfile2
+--copy_file $bugdir/bak_undo001 $bugdir/undo001
+--copy_file $bugdir/bak_undo002 $bugdir/undo002
+--copy_file $bugdir/bak_undo003 $bugdir/undo003
diff --git a/mysql-test/suite/innodb/r/101_compatibility.result b/mysql-test/suite/innodb/r/101_compatibility.result
new file mode 100644
index 00000000000..bc4d37916df
--- /dev/null
+++ b/mysql-test/suite/innodb/r/101_compatibility.result
@@ -0,0 +1,47 @@
+#
+# MDEV-11623 MariaDB 10.1 fails to start datadir created with
+# MariaDB 10.0/MySQL 5.6 using innodb-page-size!=16K
+#
+CREATE TABLE tr(a INT)ENGINE=InnoDB ROW_FORMAT=REDUNDANT;
+CREATE TABLE tc(a INT)ENGINE=InnoDB ROW_FORMAT=COMPACT;
+CREATE TABLE td(a INT)ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
+SET INNODB_STRICT_MODE=OFF;
+CREATE TABLE tz(a INT)ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1;
+SET INNODB_STRICT_MODE=ON;
+CREATE TABLE tdd(a INT) ENGINE=InnoDB, DATA DIRECTORY='MYSQL_TMP_DIR';
+CREATE TABLE tp(a INT) ENGINE=InnoDB page_compressed=1;
+CREATE TABLE ti(a INT) ENGINE=InnoDB;
+FLUSH TABLES ti FOR EXPORT;
+backup: ti
+UNLOCK TABLES;
+ALTER TABLE ti DISCARD TABLESPACE;
+restore: ti .ibd and .cfg files
+ALTER TABLE ti IMPORT TABLESPACE;
+BEGIN;
+INSERT INTO tr VALUES(1);
+INSERT INTO tc VALUES(1);
+INSERT INTO td VALUES(1);
+INSERT INTO tz VALUES(1);
+INSERT INTO tdd VALUES(1);
+INSERT INTO tp VALUES(1);
+INSERT INTO ti VALUES(1);
+# Kill the server
+CHECK TABLE tr,tc,td,tz,tdd,tp,ti;
+Table Op Msg_type Msg_text
+test.tr check status OK
+test.tc check status OK
+test.td check status OK
+test.tz check status OK
+test.tdd check status OK
+test.tp check status OK
+test.ti check status OK
+CHECK TABLE tr,tc,td,tz,tdd,tp,ti;
+Table Op Msg_type Msg_text
+test.tr check status OK
+test.tc check status OK
+test.td check status OK
+test.tz check status OK
+test.tdd check status OK
+test.tp check status OK
+test.ti check status OK
+DROP TABLE tr,tc,td,tz,tdd,tp,ti;
diff --git a/mysql-test/suite/innodb/r/alter_missing_tablespace.result b/mysql-test/suite/innodb/r/alter_missing_tablespace.result
new file mode 100644
index 00000000000..1517afd1a39
--- /dev/null
+++ b/mysql-test/suite/innodb/r/alter_missing_tablespace.result
@@ -0,0 +1,34 @@
+#
+# Bug#13955083 ALLOW IN-PLACE DDL OPERATIONS ON MISSING
+# OR DISCARDED TABLESPACES
+#
+SET GLOBAL innodb_file_per_table=1;
+CREATE TABLE t(a INT)ENGINE=InnoDB;
+CREATE TABLE `x..d` (a INT PRIMARY KEY, b INT) ENGINE=InnoDB;
+SELECT * FROM t;
+ERROR 42S02: Table 'test.t' doesn't exist in engine
+ALTER TABLE t ADD INDEX (a), ALGORITHM=INPLACE;
+ERROR 42S02: Table 'test.t' doesn't exist in engine
+SHOW WARNINGS;
+Level Code Message
+Warning 1812 Tablespace is missing for table 'test/t'
+Error 1932 Table 'test.t' doesn't exist in engine
+ALTER TABLE t1 ADD INDEX (a), ALGORITHM=COPY;
+ERROR 42S02: Table 'test.t1' doesn't exist
+SHOW WARNINGS;
+Level Code Message
+Error 1146 Table 'test.t1' doesn't exist
+ALTER TABLE t ALGORITHM=INPLACE, DISCARD TABLESPACE;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DISCARD TABLESPACE' at line 1
+ALTER TABLE t ALGORITHM=COPY, DISCARD TABLESPACE;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DISCARD TABLESPACE' at line 1
+ALTER TABLE t ALGORITHM=DEFAULT, DISCARD TABLESPACE;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DISCARD TABLESPACE' at line 1
+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;
+SELECT * FROM `x..d`;
+ERROR 42S02: Table 'test.x..d' doesn't exist in engine
+DROP TABLE `x..d`;
diff --git a/mysql-test/suite/innodb/r/doublewrite.result b/mysql-test/suite/innodb/r/doublewrite.result
index aa96a5f2d93..6b913f49972 100644
--- a/mysql-test/suite/innodb/r/doublewrite.result
+++ b/mysql-test/suite/innodb/r/doublewrite.result
@@ -39,6 +39,8 @@ set global innodb_buf_flush_list_now = 1;
# Kill the server
# Make the first page (page_no=0) of the user tablespace
# full of zeroes.
+#
+# MDEV-11623: Use old FSP_SPACE_FLAGS in the doublewrite buffer.
check table t1;
Table Op Msg_type Msg_text
test.t1 check status OK
diff --git a/mysql-test/suite/innodb/r/group_commit_crash.result b/mysql-test/suite/innodb/r/group_commit_crash.result
index 80a780ba2c5..f07df897453 100644
--- a/mysql-test/suite/innodb/r/group_commit_crash.result
+++ b/mysql-test/suite/innodb/r/group_commit_crash.result
@@ -1,4 +1,3 @@
-call mtr.add_suppression("InnoDB: Warning: database page corruption or a failed");
CREATE TABLE t1(a CHAR(255),
b CHAR(255),
c CHAR(255),
diff --git a/mysql-test/suite/innodb/r/group_commit_crash_no_optimize_thread.result b/mysql-test/suite/innodb/r/group_commit_crash_no_optimize_thread.result
index 06fdeaef6a7..2cd9f01d7ed 100644
--- a/mysql-test/suite/innodb/r/group_commit_crash_no_optimize_thread.result
+++ b/mysql-test/suite/innodb/r/group_commit_crash_no_optimize_thread.result
@@ -1,4 +1,3 @@
-call mtr.add_suppression("InnoDB: Warning: database page corruption or a failed");
CREATE TABLE t1(a CHAR(255),
b CHAR(255),
c CHAR(255),
diff --git a/mysql-test/suite/innodb/r/innodb-16k.result b/mysql-test/suite/innodb/r/innodb-16k.result
index 63637c6428f..206abe45887 100644
--- a/mysql-test/suite/innodb/r/innodb-16k.result
+++ b/mysql-test/suite/innodb/r/innodb-16k.result
@@ -1,8 +1,4 @@
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 GLOBAL innodb_file_format = `Barracuda`;
-Warnings:
-Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
-SET GLOBAL innodb_file_per_table = ON;
SET GLOBAL innodb_large_prefix = OFF;
Warnings:
Warning 131 Using innodb_large_prefix is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
@@ -229,9 +225,6 @@ FROM information_schema.tables WHERE table_name = 't1';
table_name row_format create_options
t1 Compressed row_format=COMPRESSED
DROP TABLE t1;
-SET GLOBAL innodb_file_format = `Barracuda`;
-Warnings:
-Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
CREATE TABLE t2(d varchar(17) PRIMARY KEY) ENGINE=innodb DEFAULT CHARSET=utf8;
CREATE TABLE t3(a int PRIMARY KEY) ENGINE=innodb;
INSERT INTO t3 VALUES (22),(44),(33),(55),(66);
@@ -422,10 +415,6 @@ t1 CREATE TABLE `t1` (
KEY `t1t` (`t`(767))
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC
DROP TABLE t1;
-SET GLOBAL innodb_file_format = `Barracuda`;
-Warnings:
-Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
-SET GLOBAL innodb_file_per_table = ON;
Test an assertion failure on purge.
CREATE TABLE t1_purge (
A int,
@@ -466,10 +455,6 @@ DELETE FROM t1_purge;
DELETE FROM t2_purge;
DELETE FROM t3_purge;
DELETE FROM t4_purge;
-SET GLOBAL innodb_file_per_table=on;
-SET GLOBAL innodb_file_format='Barracuda';
-Warnings:
-Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
SET @r=REPEAT('a',500);
CREATE TABLE tlong(a int,
v1 varchar(500), v2 varchar(500), v3 varchar(500),
@@ -984,6 +969,4 @@ COL197 TEXT)
row_format=compact,ENGINE=INNODB;
ERROR 42000: 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.
Warnings:
-Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
-Warnings:
Warning 131 Using innodb_large_prefix is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
diff --git a/mysql-test/suite/innodb/r/innodb-32k-crash.result b/mysql-test/suite/innodb/r/innodb-32k-crash.result
index c9b21bf414a..1fd5cd9b521 100644
--- a/mysql-test/suite/innodb/r/innodb-32k-crash.result
+++ b/mysql-test/suite/innodb/r/innodb-32k-crash.result
@@ -1,6 +1,4 @@
call mtr.add_suppression("InnoDB: Warning: innodb_page_size has been changed from default value *");
-SET GLOBAL innodb_file_format = `Barracuda`;
-SET GLOBAL innodb_file_per_table = ON;
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,
@@ -161,58 +159,58 @@ COMMIT;
show create table t1;
Table Create Table
t1 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,
- `v` blob,
- `w` blob,
- `x` blob,
- `y` blob,
- `z` blob,
- `aa` blob,
- `ba` blob,
- `ca` blob,
- `da` blob,
- `ea` blob,
- `fa` blob,
- `ga` blob,
- `ha` blob,
- `ia` blob,
- `ja` blob,
- `ka` blob,
- `la` blob,
- `ma` blob,
- `na` blob,
- `oa` blob,
- `pa` blob,
- `qa` blob,
- `ra` blob,
- `sa` blob,
- `ta` blob,
- `ua` blob,
- `va` blob,
- `wa` blob,
- `xa` blob,
- `ya` blob,
- `za` blob,
+ `a` blob DEFAULT NULL,
+ `b` blob DEFAULT NULL,
+ `c` blob DEFAULT NULL,
+ `d` blob DEFAULT NULL,
+ `e` blob DEFAULT NULL,
+ `f` blob DEFAULT NULL,
+ `g` blob DEFAULT NULL,
+ `h` blob DEFAULT NULL,
+ `i` blob DEFAULT NULL,
+ `j` blob DEFAULT NULL,
+ `k` blob DEFAULT NULL,
+ `l` blob DEFAULT NULL,
+ `m` blob DEFAULT NULL,
+ `n` blob DEFAULT NULL,
+ `o` blob DEFAULT NULL,
+ `p` blob DEFAULT NULL,
+ `q` blob DEFAULT NULL,
+ `r` blob DEFAULT NULL,
+ `s` blob DEFAULT NULL,
+ `t` blob DEFAULT NULL,
+ `u` blob DEFAULT NULL,
+ `v` blob DEFAULT NULL,
+ `w` blob DEFAULT NULL,
+ `x` blob DEFAULT NULL,
+ `y` blob DEFAULT NULL,
+ `z` blob DEFAULT NULL,
+ `aa` blob DEFAULT NULL,
+ `ba` blob DEFAULT NULL,
+ `ca` blob DEFAULT NULL,
+ `da` blob DEFAULT NULL,
+ `ea` blob DEFAULT NULL,
+ `fa` blob DEFAULT NULL,
+ `ga` blob DEFAULT NULL,
+ `ha` blob DEFAULT NULL,
+ `ia` blob DEFAULT NULL,
+ `ja` blob DEFAULT NULL,
+ `ka` blob DEFAULT NULL,
+ `la` blob DEFAULT NULL,
+ `ma` blob DEFAULT NULL,
+ `na` blob DEFAULT NULL,
+ `oa` blob DEFAULT NULL,
+ `pa` blob DEFAULT NULL,
+ `qa` blob DEFAULT NULL,
+ `ra` blob DEFAULT NULL,
+ `sa` blob DEFAULT NULL,
+ `ta` blob DEFAULT NULL,
+ `ua` blob DEFAULT NULL,
+ `va` blob DEFAULT NULL,
+ `wa` blob DEFAULT NULL,
+ `xa` blob DEFAULT NULL,
+ `ya` blob DEFAULT NULL,
+ `za` blob DEFAULT NULL,
KEY `t1a` (`a`(767)),
KEY `t1b` (`b`(767)),
KEY `t1c` (`c`(767)),
@@ -227,58 +225,58 @@ t1 CREATE TABLE `t1` (
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `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,
- `v` blob,
- `w` blob,
- `x` blob,
- `y` blob,
- `z` blob,
- `aa` blob,
- `ba` blob,
- `ca` blob,
- `da` blob,
- `ea` blob,
- `fa` blob,
- `ga` blob,
- `ha` blob,
- `ia` blob,
- `ja` blob,
- `ka` blob,
- `la` blob,
- `ma` blob,
- `na` blob,
- `oa` blob,
- `pa` blob,
- `qa` blob,
- `ra` blob,
- `sa` blob,
- `ta` blob,
- `ua` blob,
- `va` blob,
- `wa` blob,
- `xa` blob,
- `ya` blob,
- `za` blob,
+ `a` blob DEFAULT NULL,
+ `b` blob DEFAULT NULL,
+ `c` blob DEFAULT NULL,
+ `d` blob DEFAULT NULL,
+ `e` blob DEFAULT NULL,
+ `f` blob DEFAULT NULL,
+ `g` blob DEFAULT NULL,
+ `h` blob DEFAULT NULL,
+ `i` blob DEFAULT NULL,
+ `j` blob DEFAULT NULL,
+ `k` blob DEFAULT NULL,
+ `l` blob DEFAULT NULL,
+ `m` blob DEFAULT NULL,
+ `n` blob DEFAULT NULL,
+ `o` blob DEFAULT NULL,
+ `p` blob DEFAULT NULL,
+ `q` blob DEFAULT NULL,
+ `r` blob DEFAULT NULL,
+ `s` blob DEFAULT NULL,
+ `t` blob DEFAULT NULL,
+ `u` blob DEFAULT NULL,
+ `v` blob DEFAULT NULL,
+ `w` blob DEFAULT NULL,
+ `x` blob DEFAULT NULL,
+ `y` blob DEFAULT NULL,
+ `z` blob DEFAULT NULL,
+ `aa` blob DEFAULT NULL,
+ `ba` blob DEFAULT NULL,
+ `ca` blob DEFAULT NULL,
+ `da` blob DEFAULT NULL,
+ `ea` blob DEFAULT NULL,
+ `fa` blob DEFAULT NULL,
+ `ga` blob DEFAULT NULL,
+ `ha` blob DEFAULT NULL,
+ `ia` blob DEFAULT NULL,
+ `ja` blob DEFAULT NULL,
+ `ka` blob DEFAULT NULL,
+ `la` blob DEFAULT NULL,
+ `ma` blob DEFAULT NULL,
+ `na` blob DEFAULT NULL,
+ `oa` blob DEFAULT NULL,
+ `pa` blob DEFAULT NULL,
+ `qa` blob DEFAULT NULL,
+ `ra` blob DEFAULT NULL,
+ `sa` blob DEFAULT NULL,
+ `ta` blob DEFAULT NULL,
+ `ua` blob DEFAULT NULL,
+ `va` blob DEFAULT NULL,
+ `wa` blob DEFAULT NULL,
+ `xa` blob DEFAULT NULL,
+ `ya` blob DEFAULT NULL,
+ `za` blob DEFAULT NULL,
KEY `t1a` (`a`(767)),
KEY `t1b` (`b`(767)),
KEY `t1c` (`c`(767)),
diff --git a/mysql-test/suite/innodb/r/innodb-32k.result b/mysql-test/suite/innodb/r/innodb-32k.result
index 2253ba5588f..29374689a3b 100644
--- a/mysql-test/suite/innodb/r/innodb-32k.result
+++ b/mysql-test/suite/innodb/r/innodb-32k.result
@@ -1,9 +1,8 @@
-call mtr.add_suppression("InnoDB: Warning: innodb_page_size has been changed from default value *");
-call mtr.add_suppression("InnoDB: Resizing redo log from *");
-call mtr.add_suppression("InnoDB: Starting to delete and rewrite log files.");
-call mtr.add_suppression("InnoDB: New log files created, LSN=*");
-SET GLOBAL innodb_file_format = `Barracuda`;
-SET GLOBAL innodb_file_per_table = ON;
+call mtr.add_suppression("InnoDB: Warning: innodb_page_size has been changed from default value ");
+call mtr.add_suppression("InnoDB: Resizing redo log from ");
+call mtr.add_suppression("InnoDB: Starting to delete and rewrite log files");
+call mtr.add_suppression("InnoDB: New log files created, LSN=");
+call mtr.add_suppression("Innodb: Cannot add field.*row size is");
# Test 1) Show the page size from Information Schema
SELECT variable_value FROM information_schema.global_status
WHERE LOWER(variable_name) = 'innodb_page_size';
@@ -234,7 +233,7 @@ v=@d,w=@d,x=@d,y=@d,z=@d,
aa=@d,ba=@d,ca=@d,da=@d,ea=@d,fa=@d,ga=@d,ha=@d,ia=@d,ja=@d,
ka=@d,la=@d,ma=@d,na=@d,oa=@d,pa=@d,qa=@d,ra=@d,sa=@d,ta=@d,ua=@d,
va=@d,wa=@d,xa=@d,ya=@d,za=@d;
-ERROR HY000: Undo log record is too big.
+ERROR HY000: Undo log record is too big
BEGIN;
UPDATE t1 SET a=@d,b=@d,c=@d,d=@d,e=@d;
UPDATE t1 SET f=@d,g=@d,h=@d,i=@d,j=@d;
@@ -278,7 +277,6 @@ CREATE INDEX tn1f9 ON t1 (oa(767));
CREATE INDEX to1f11 ON t1 (pa(767));
UPDATE t1 SET t=@e;
CREATE INDEX t1f6 ON t1 (l(767));
-ERROR 42000: Row size too large. The maximum row size for the used table type, not counting BLOBs, is 16318. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs
drop table t1;
Test an assertion failure on purge.
CREATE TABLE t1_purge (
@@ -320,8 +318,6 @@ DELETE FROM t1_purge;
DELETE FROM t2_purge;
DELETE FROM t3_purge;
DELETE FROM t4_purge;
-SET GLOBAL innodb_file_per_table=on;
-SET GLOBAL innodb_file_format='Barracuda';
SET @r=REPEAT('a',500);
CREATE TABLE tlong(a int,
v1 varchar(500), v2 varchar(500), v3 varchar(500),
@@ -366,22 +362,22 @@ CREATE INDEX ndx_p ON tlong2 (p(500));
SHOW CREATE TABLE tlong2;
Table Create Table
tlong2 CREATE TABLE `tlong2` (
- `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,
+ `a` blob DEFAULT NULL,
+ `b` blob DEFAULT NULL,
+ `c` blob DEFAULT NULL,
+ `d` blob DEFAULT NULL,
+ `e` blob DEFAULT NULL,
+ `f` blob DEFAULT NULL,
+ `g` blob DEFAULT NULL,
+ `h` blob DEFAULT NULL,
+ `i` blob DEFAULT NULL,
+ `j` blob DEFAULT NULL,
+ `k` blob DEFAULT NULL,
+ `l` blob DEFAULT NULL,
+ `m` blob DEFAULT NULL,
+ `n` blob DEFAULT NULL,
+ `o` blob DEFAULT NULL,
+ `p` blob DEFAULT NULL,
KEY `ndx_c` (`c`(500)),
KEY `ndx_d` (`d`(500)),
KEY `ndx_e` (`e`(500)),
@@ -665,203 +661,203 @@ set @b = repeat('zyxwvutsrqponmlkjihgfedcba', 2000);
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `COL1` text,
- `COL2` text,
- `COL3` text,
- `COL4` text,
- `COL5` text,
- `COL6` text,
- `COL7` text,
- `COL8` text,
- `COL9` text,
- `COL10` text,
- `COL11` text,
- `COL12` text,
- `COL13` text,
- `COL14` text,
- `COL15` text,
- `COL16` text,
- `COL17` text,
- `COL18` text,
- `COL19` text,
- `COL20` text,
- `COL21` text,
- `COL22` text,
- `COL23` text,
- `COL24` text,
- `COL25` text,
- `COL26` text,
- `COL27` text,
- `COL28` text,
- `COL29` text,
- `COL30` text,
- `COL31` text,
- `COL32` text,
- `COL33` text,
- `COL34` text,
- `COL35` text,
- `COL36` text,
- `COL37` text,
- `COL38` text,
- `COL39` text,
- `COL40` text,
- `COL41` text,
- `COL42` text,
- `COL43` text,
- `COL44` text,
- `COL45` text,
- `COL46` text,
- `COL47` text,
- `COL48` text,
- `COL49` text,
- `COL50` text,
- `COL51` text,
- `COL52` text,
- `COL53` text,
- `COL54` text,
- `COL55` text,
- `COL56` text,
- `COL57` text,
- `COL58` text,
- `COL59` text,
- `COL60` text,
- `COL61` text,
- `COL62` text,
- `COL63` text,
- `COL64` text,
- `COL65` text,
- `COL66` text,
- `COL67` text,
- `COL68` text,
- `COL69` text,
- `COL70` text,
- `COL71` text,
- `COL72` text,
- `COL73` text,
- `COL74` text,
- `COL75` text,
- `COL76` text,
- `COL77` text,
- `COL78` text,
- `COL79` text,
- `COL80` text,
- `COL81` text,
- `COL82` text,
- `COL83` text,
- `COL84` text,
- `COL85` text,
- `COL86` text,
- `COL87` text,
- `COL88` text,
- `COL89` text,
- `COL90` text,
- `COL91` text,
- `COL92` text,
- `COL93` text,
- `COL94` text,
- `COL95` text,
- `COL96` text,
- `COL97` text,
- `COL98` text,
- `COL99` text,
- `COL100` text,
- `COL101` text,
- `COL102` text,
- `COL103` text,
- `COL104` text,
- `COL105` text,
- `COL106` text,
- `COL107` text,
- `COL108` text,
- `COL109` text,
- `COL110` text,
- `COL111` text,
- `COL112` text,
- `COL113` text,
- `COL114` text,
- `COL115` text,
- `COL116` text,
- `COL117` text,
- `COL118` text,
- `COL119` text,
- `COL120` text,
- `COL121` text,
- `COL122` text,
- `COL123` text,
- `COL124` text,
- `COL125` text,
- `COL126` text,
- `COL127` text,
- `COL128` text,
- `COL129` text,
- `COL130` text,
- `COL131` text,
- `COL132` text,
- `COL133` text,
- `COL134` text,
- `COL135` text,
- `COL136` text,
- `COL137` text,
- `COL138` text,
- `COL139` text,
- `COL140` text,
- `COL141` text,
- `COL142` text,
- `COL143` text,
- `COL144` text,
- `COL145` text,
- `COL146` text,
- `COL147` text,
- `COL148` text,
- `COL149` text,
- `COL150` text,
- `COL151` text,
- `COL152` text,
- `COL153` text,
- `COL154` text,
- `COL155` text,
- `COL156` text,
- `COL157` text,
- `COL158` text,
- `COL159` text,
- `COL160` text,
- `COL161` text,
- `COL162` text,
- `COL163` text,
- `COL164` text,
- `COL165` text,
- `COL166` text,
- `COL167` text,
- `COL168` text,
- `COL169` text,
- `COL170` text,
- `COL171` text,
- `COL172` text,
- `COL173` text,
- `COL174` text,
- `COL175` text,
- `COL176` text,
- `COL177` text,
- `COL178` text,
- `COL179` text,
- `COL180` text,
- `COL181` text,
- `COL182` text,
- `COL183` text,
- `COL184` text,
- `COL185` text,
- `COL186` text,
- `COL187` text,
- `COL188` text,
- `COL189` text,
- `COL190` text,
- `COL191` text,
- `COL192` text,
- `COL193` text,
- `COL194` text,
- `COL195` text,
- `COL196` text,
- `COL197` text
+ `COL1` text DEFAULT NULL,
+ `COL2` text DEFAULT NULL,
+ `COL3` text DEFAULT NULL,
+ `COL4` text DEFAULT NULL,
+ `COL5` text DEFAULT NULL,
+ `COL6` text DEFAULT NULL,
+ `COL7` text DEFAULT NULL,
+ `COL8` text DEFAULT NULL,
+ `COL9` text DEFAULT NULL,
+ `COL10` text DEFAULT NULL,
+ `COL11` text DEFAULT NULL,
+ `COL12` text DEFAULT NULL,
+ `COL13` text DEFAULT NULL,
+ `COL14` text DEFAULT NULL,
+ `COL15` text DEFAULT NULL,
+ `COL16` text DEFAULT NULL,
+ `COL17` text DEFAULT NULL,
+ `COL18` text DEFAULT NULL,
+ `COL19` text DEFAULT NULL,
+ `COL20` text DEFAULT NULL,
+ `COL21` text DEFAULT NULL,
+ `COL22` text DEFAULT NULL,
+ `COL23` text DEFAULT NULL,
+ `COL24` text DEFAULT NULL,
+ `COL25` text DEFAULT NULL,
+ `COL26` text DEFAULT NULL,
+ `COL27` text DEFAULT NULL,
+ `COL28` text DEFAULT NULL,
+ `COL29` text DEFAULT NULL,
+ `COL30` text DEFAULT NULL,
+ `COL31` text DEFAULT NULL,
+ `COL32` text DEFAULT NULL,
+ `COL33` text DEFAULT NULL,
+ `COL34` text DEFAULT NULL,
+ `COL35` text DEFAULT NULL,
+ `COL36` text DEFAULT NULL,
+ `COL37` text DEFAULT NULL,
+ `COL38` text DEFAULT NULL,
+ `COL39` text DEFAULT NULL,
+ `COL40` text DEFAULT NULL,
+ `COL41` text DEFAULT NULL,
+ `COL42` text DEFAULT NULL,
+ `COL43` text DEFAULT NULL,
+ `COL44` text DEFAULT NULL,
+ `COL45` text DEFAULT NULL,
+ `COL46` text DEFAULT NULL,
+ `COL47` text DEFAULT NULL,
+ `COL48` text DEFAULT NULL,
+ `COL49` text DEFAULT NULL,
+ `COL50` text DEFAULT NULL,
+ `COL51` text DEFAULT NULL,
+ `COL52` text DEFAULT NULL,
+ `COL53` text DEFAULT NULL,
+ `COL54` text DEFAULT NULL,
+ `COL55` text DEFAULT NULL,
+ `COL56` text DEFAULT NULL,
+ `COL57` text DEFAULT NULL,
+ `COL58` text DEFAULT NULL,
+ `COL59` text DEFAULT NULL,
+ `COL60` text DEFAULT NULL,
+ `COL61` text DEFAULT NULL,
+ `COL62` text DEFAULT NULL,
+ `COL63` text DEFAULT NULL,
+ `COL64` text DEFAULT NULL,
+ `COL65` text DEFAULT NULL,
+ `COL66` text DEFAULT NULL,
+ `COL67` text DEFAULT NULL,
+ `COL68` text DEFAULT NULL,
+ `COL69` text DEFAULT NULL,
+ `COL70` text DEFAULT NULL,
+ `COL71` text DEFAULT NULL,
+ `COL72` text DEFAULT NULL,
+ `COL73` text DEFAULT NULL,
+ `COL74` text DEFAULT NULL,
+ `COL75` text DEFAULT NULL,
+ `COL76` text DEFAULT NULL,
+ `COL77` text DEFAULT NULL,
+ `COL78` text DEFAULT NULL,
+ `COL79` text DEFAULT NULL,
+ `COL80` text DEFAULT NULL,
+ `COL81` text DEFAULT NULL,
+ `COL82` text DEFAULT NULL,
+ `COL83` text DEFAULT NULL,
+ `COL84` text DEFAULT NULL,
+ `COL85` text DEFAULT NULL,
+ `COL86` text DEFAULT NULL,
+ `COL87` text DEFAULT NULL,
+ `COL88` text DEFAULT NULL,
+ `COL89` text DEFAULT NULL,
+ `COL90` text DEFAULT NULL,
+ `COL91` text DEFAULT NULL,
+ `COL92` text DEFAULT NULL,
+ `COL93` text DEFAULT NULL,
+ `COL94` text DEFAULT NULL,
+ `COL95` text DEFAULT NULL,
+ `COL96` text DEFAULT NULL,
+ `COL97` text DEFAULT NULL,
+ `COL98` text DEFAULT NULL,
+ `COL99` text DEFAULT NULL,
+ `COL100` text DEFAULT NULL,
+ `COL101` text DEFAULT NULL,
+ `COL102` text DEFAULT NULL,
+ `COL103` text DEFAULT NULL,
+ `COL104` text DEFAULT NULL,
+ `COL105` text DEFAULT NULL,
+ `COL106` text DEFAULT NULL,
+ `COL107` text DEFAULT NULL,
+ `COL108` text DEFAULT NULL,
+ `COL109` text DEFAULT NULL,
+ `COL110` text DEFAULT NULL,
+ `COL111` text DEFAULT NULL,
+ `COL112` text DEFAULT NULL,
+ `COL113` text DEFAULT NULL,
+ `COL114` text DEFAULT NULL,
+ `COL115` text DEFAULT NULL,
+ `COL116` text DEFAULT NULL,
+ `COL117` text DEFAULT NULL,
+ `COL118` text DEFAULT NULL,
+ `COL119` text DEFAULT NULL,
+ `COL120` text DEFAULT NULL,
+ `COL121` text DEFAULT NULL,
+ `COL122` text DEFAULT NULL,
+ `COL123` text DEFAULT NULL,
+ `COL124` text DEFAULT NULL,
+ `COL125` text DEFAULT NULL,
+ `COL126` text DEFAULT NULL,
+ `COL127` text DEFAULT NULL,
+ `COL128` text DEFAULT NULL,
+ `COL129` text DEFAULT NULL,
+ `COL130` text DEFAULT NULL,
+ `COL131` text DEFAULT NULL,
+ `COL132` text DEFAULT NULL,
+ `COL133` text DEFAULT NULL,
+ `COL134` text DEFAULT NULL,
+ `COL135` text DEFAULT NULL,
+ `COL136` text DEFAULT NULL,
+ `COL137` text DEFAULT NULL,
+ `COL138` text DEFAULT NULL,
+ `COL139` text DEFAULT NULL,
+ `COL140` text DEFAULT NULL,
+ `COL141` text DEFAULT NULL,
+ `COL142` text DEFAULT NULL,
+ `COL143` text DEFAULT NULL,
+ `COL144` text DEFAULT NULL,
+ `COL145` text DEFAULT NULL,
+ `COL146` text DEFAULT NULL,
+ `COL147` text DEFAULT NULL,
+ `COL148` text DEFAULT NULL,
+ `COL149` text DEFAULT NULL,
+ `COL150` text DEFAULT NULL,
+ `COL151` text DEFAULT NULL,
+ `COL152` text DEFAULT NULL,
+ `COL153` text DEFAULT NULL,
+ `COL154` text DEFAULT NULL,
+ `COL155` text DEFAULT NULL,
+ `COL156` text DEFAULT NULL,
+ `COL157` text DEFAULT NULL,
+ `COL158` text DEFAULT NULL,
+ `COL159` text DEFAULT NULL,
+ `COL160` text DEFAULT NULL,
+ `COL161` text DEFAULT NULL,
+ `COL162` text DEFAULT NULL,
+ `COL163` text DEFAULT NULL,
+ `COL164` text DEFAULT NULL,
+ `COL165` text DEFAULT NULL,
+ `COL166` text DEFAULT NULL,
+ `COL167` text DEFAULT NULL,
+ `COL168` text DEFAULT NULL,
+ `COL169` text DEFAULT NULL,
+ `COL170` text DEFAULT NULL,
+ `COL171` text DEFAULT NULL,
+ `COL172` text DEFAULT NULL,
+ `COL173` text DEFAULT NULL,
+ `COL174` text DEFAULT NULL,
+ `COL175` text DEFAULT NULL,
+ `COL176` text DEFAULT NULL,
+ `COL177` text DEFAULT NULL,
+ `COL178` text DEFAULT NULL,
+ `COL179` text DEFAULT NULL,
+ `COL180` text DEFAULT NULL,
+ `COL181` text DEFAULT NULL,
+ `COL182` text DEFAULT NULL,
+ `COL183` text DEFAULT NULL,
+ `COL184` text DEFAULT NULL,
+ `COL185` text DEFAULT NULL,
+ `COL186` text DEFAULT NULL,
+ `COL187` text DEFAULT NULL,
+ `COL188` text DEFAULT NULL,
+ `COL189` text DEFAULT NULL,
+ `COL190` text DEFAULT NULL,
+ `COL191` text DEFAULT NULL,
+ `COL192` text DEFAULT NULL,
+ `COL193` text DEFAULT NULL,
+ `COL194` text DEFAULT NULL,
+ `COL195` text DEFAULT NULL,
+ `COL196` text DEFAULT NULL,
+ `COL197` text DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC
update t2 set col150=@a;
update t2 set col145=@b;
diff --git a/mysql-test/suite/innodb/r/innodb-64k-crash.result b/mysql-test/suite/innodb/r/innodb-64k-crash.result
index 9371c4a09e5..7e2941b8e3b 100644
--- a/mysql-test/suite/innodb/r/innodb-64k-crash.result
+++ b/mysql-test/suite/innodb/r/innodb-64k-crash.result
@@ -1,6 +1,4 @@
call mtr.add_suppression("InnoDB: Warning: innodb_page_size has been changed from default value *");
-SET GLOBAL innodb_file_format = `Barracuda`;
-SET GLOBAL innodb_file_per_table = ON;
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,
@@ -347,110 +345,110 @@ COMMIT;
show create table t1;
Table Create Table
t1 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,
- `v` blob,
- `w` blob,
- `x` blob,
- `y` blob,
- `z` blob,
- `aa` blob,
- `ba` blob,
- `ca` blob,
- `da` blob,
- `ea` blob,
- `fa` blob,
- `ga` blob,
- `ha` blob,
- `ia` blob,
- `ja` blob,
- `ka` blob,
- `la` blob,
- `ma` blob,
- `na` blob,
- `oa` blob,
- `pa` blob,
- `qa` blob,
- `ra` blob,
- `sa` blob,
- `ta` blob,
- `ua` blob,
- `va` blob,
- `wa` blob,
- `xa` blob,
- `ya` blob,
- `za` blob,
- `ab` blob,
- `bb` blob,
- `cb` blob,
- `db` blob,
- `eb` blob,
- `fb` blob,
- `gb` blob,
- `hb` blob,
- `ib` blob,
- `jb` blob,
- `kb` blob,
- `lb` blob,
- `mb` blob,
- `nb` blob,
- `ob` blob,
- `pb` blob,
- `qb` blob,
- `rb` blob,
- `sb` blob,
- `tb` blob,
- `ub` blob,
- `vb` blob,
- `wb` blob,
- `xb` blob,
- `yb` blob,
- `zb` blob,
- `ac` blob,
- `bc` blob,
- `cc` blob,
- `dc` blob,
- `ec` blob,
- `fc` blob,
- `gc` blob,
- `hc` blob,
- `ic` blob,
- `jc` blob,
- `kc` blob,
- `lc` blob,
- `mc` blob,
- `nc` blob,
- `oc` blob,
- `pc` blob,
- `qc` blob,
- `rc` blob,
- `sc` blob,
- `tc` blob,
- `uc` blob,
- `vc` blob,
- `wc` blob,
- `xc` blob,
- `yc` blob,
- `zc` blob,
+ `a` blob DEFAULT NULL,
+ `b` blob DEFAULT NULL,
+ `c` blob DEFAULT NULL,
+ `d` blob DEFAULT NULL,
+ `e` blob DEFAULT NULL,
+ `f` blob DEFAULT NULL,
+ `g` blob DEFAULT NULL,
+ `h` blob DEFAULT NULL,
+ `i` blob DEFAULT NULL,
+ `j` blob DEFAULT NULL,
+ `k` blob DEFAULT NULL,
+ `l` blob DEFAULT NULL,
+ `m` blob DEFAULT NULL,
+ `n` blob DEFAULT NULL,
+ `o` blob DEFAULT NULL,
+ `p` blob DEFAULT NULL,
+ `q` blob DEFAULT NULL,
+ `r` blob DEFAULT NULL,
+ `s` blob DEFAULT NULL,
+ `t` blob DEFAULT NULL,
+ `u` blob DEFAULT NULL,
+ `v` blob DEFAULT NULL,
+ `w` blob DEFAULT NULL,
+ `x` blob DEFAULT NULL,
+ `y` blob DEFAULT NULL,
+ `z` blob DEFAULT NULL,
+ `aa` blob DEFAULT NULL,
+ `ba` blob DEFAULT NULL,
+ `ca` blob DEFAULT NULL,
+ `da` blob DEFAULT NULL,
+ `ea` blob DEFAULT NULL,
+ `fa` blob DEFAULT NULL,
+ `ga` blob DEFAULT NULL,
+ `ha` blob DEFAULT NULL,
+ `ia` blob DEFAULT NULL,
+ `ja` blob DEFAULT NULL,
+ `ka` blob DEFAULT NULL,
+ `la` blob DEFAULT NULL,
+ `ma` blob DEFAULT NULL,
+ `na` blob DEFAULT NULL,
+ `oa` blob DEFAULT NULL,
+ `pa` blob DEFAULT NULL,
+ `qa` blob DEFAULT NULL,
+ `ra` blob DEFAULT NULL,
+ `sa` blob DEFAULT NULL,
+ `ta` blob DEFAULT NULL,
+ `ua` blob DEFAULT NULL,
+ `va` blob DEFAULT NULL,
+ `wa` blob DEFAULT NULL,
+ `xa` blob DEFAULT NULL,
+ `ya` blob DEFAULT NULL,
+ `za` blob DEFAULT NULL,
+ `ab` blob DEFAULT NULL,
+ `bb` blob DEFAULT NULL,
+ `cb` blob DEFAULT NULL,
+ `db` blob DEFAULT NULL,
+ `eb` blob DEFAULT NULL,
+ `fb` blob DEFAULT NULL,
+ `gb` blob DEFAULT NULL,
+ `hb` blob DEFAULT NULL,
+ `ib` blob DEFAULT NULL,
+ `jb` blob DEFAULT NULL,
+ `kb` blob DEFAULT NULL,
+ `lb` blob DEFAULT NULL,
+ `mb` blob DEFAULT NULL,
+ `nb` blob DEFAULT NULL,
+ `ob` blob DEFAULT NULL,
+ `pb` blob DEFAULT NULL,
+ `qb` blob DEFAULT NULL,
+ `rb` blob DEFAULT NULL,
+ `sb` blob DEFAULT NULL,
+ `tb` blob DEFAULT NULL,
+ `ub` blob DEFAULT NULL,
+ `vb` blob DEFAULT NULL,
+ `wb` blob DEFAULT NULL,
+ `xb` blob DEFAULT NULL,
+ `yb` blob DEFAULT NULL,
+ `zb` blob DEFAULT NULL,
+ `ac` blob DEFAULT NULL,
+ `bc` blob DEFAULT NULL,
+ `cc` blob DEFAULT NULL,
+ `dc` blob DEFAULT NULL,
+ `ec` blob DEFAULT NULL,
+ `fc` blob DEFAULT NULL,
+ `gc` blob DEFAULT NULL,
+ `hc` blob DEFAULT NULL,
+ `ic` blob DEFAULT NULL,
+ `jc` blob DEFAULT NULL,
+ `kc` blob DEFAULT NULL,
+ `lc` blob DEFAULT NULL,
+ `mc` blob DEFAULT NULL,
+ `nc` blob DEFAULT NULL,
+ `oc` blob DEFAULT NULL,
+ `pc` blob DEFAULT NULL,
+ `qc` blob DEFAULT NULL,
+ `rc` blob DEFAULT NULL,
+ `sc` blob DEFAULT NULL,
+ `tc` blob DEFAULT NULL,
+ `uc` blob DEFAULT NULL,
+ `vc` blob DEFAULT NULL,
+ `wc` blob DEFAULT NULL,
+ `xc` blob DEFAULT NULL,
+ `yc` blob DEFAULT NULL,
+ `zc` blob DEFAULT NULL,
KEY `t1a` (`a`(767),`b`(767)),
KEY `t1c` (`c`(767),`d`(767)),
KEY `t1e` (`e`(767),`f`(767)),
@@ -470,110 +468,110 @@ t1 CREATE TABLE `t1` (
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `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,
- `v` blob,
- `w` blob,
- `x` blob,
- `y` blob,
- `z` blob,
- `aa` blob,
- `ba` blob,
- `ca` blob,
- `da` blob,
- `ea` blob,
- `fa` blob,
- `ga` blob,
- `ha` blob,
- `ia` blob,
- `ja` blob,
- `ka` blob,
- `la` blob,
- `ma` blob,
- `na` blob,
- `oa` blob,
- `pa` blob,
- `qa` blob,
- `ra` blob,
- `sa` blob,
- `ta` blob,
- `ua` blob,
- `va` blob,
- `wa` blob,
- `xa` blob,
- `ya` blob,
- `za` blob,
- `ab` blob,
- `bb` blob,
- `cb` blob,
- `db` blob,
- `eb` blob,
- `fb` blob,
- `gb` blob,
- `hb` blob,
- `ib` blob,
- `jb` blob,
- `kb` blob,
- `lb` blob,
- `mb` blob,
- `nb` blob,
- `ob` blob,
- `pb` blob,
- `qb` blob,
- `rb` blob,
- `sb` blob,
- `tb` blob,
- `ub` blob,
- `vb` blob,
- `wb` blob,
- `xb` blob,
- `yb` blob,
- `zb` blob,
- `ac` blob,
- `bc` blob,
- `cc` blob,
- `dc` blob,
- `ec` blob,
- `fc` blob,
- `gc` blob,
- `hc` blob,
- `ic` blob,
- `jc` blob,
- `kc` blob,
- `lc` blob,
- `mc` blob,
- `nc` blob,
- `oc` blob,
- `pc` blob,
- `qc` blob,
- `rc` blob,
- `sc` blob,
- `tc` blob,
- `uc` blob,
- `vc` blob,
- `wc` blob,
- `xc` blob,
- `yc` blob,
- `zc` blob,
+ `a` blob DEFAULT NULL,
+ `b` blob DEFAULT NULL,
+ `c` blob DEFAULT NULL,
+ `d` blob DEFAULT NULL,
+ `e` blob DEFAULT NULL,
+ `f` blob DEFAULT NULL,
+ `g` blob DEFAULT NULL,
+ `h` blob DEFAULT NULL,
+ `i` blob DEFAULT NULL,
+ `j` blob DEFAULT NULL,
+ `k` blob DEFAULT NULL,
+ `l` blob DEFAULT NULL,
+ `m` blob DEFAULT NULL,
+ `n` blob DEFAULT NULL,
+ `o` blob DEFAULT NULL,
+ `p` blob DEFAULT NULL,
+ `q` blob DEFAULT NULL,
+ `r` blob DEFAULT NULL,
+ `s` blob DEFAULT NULL,
+ `t` blob DEFAULT NULL,
+ `u` blob DEFAULT NULL,
+ `v` blob DEFAULT NULL,
+ `w` blob DEFAULT NULL,
+ `x` blob DEFAULT NULL,
+ `y` blob DEFAULT NULL,
+ `z` blob DEFAULT NULL,
+ `aa` blob DEFAULT NULL,
+ `ba` blob DEFAULT NULL,
+ `ca` blob DEFAULT NULL,
+ `da` blob DEFAULT NULL,
+ `ea` blob DEFAULT NULL,
+ `fa` blob DEFAULT NULL,
+ `ga` blob DEFAULT NULL,
+ `ha` blob DEFAULT NULL,
+ `ia` blob DEFAULT NULL,
+ `ja` blob DEFAULT NULL,
+ `ka` blob DEFAULT NULL,
+ `la` blob DEFAULT NULL,
+ `ma` blob DEFAULT NULL,
+ `na` blob DEFAULT NULL,
+ `oa` blob DEFAULT NULL,
+ `pa` blob DEFAULT NULL,
+ `qa` blob DEFAULT NULL,
+ `ra` blob DEFAULT NULL,
+ `sa` blob DEFAULT NULL,
+ `ta` blob DEFAULT NULL,
+ `ua` blob DEFAULT NULL,
+ `va` blob DEFAULT NULL,
+ `wa` blob DEFAULT NULL,
+ `xa` blob DEFAULT NULL,
+ `ya` blob DEFAULT NULL,
+ `za` blob DEFAULT NULL,
+ `ab` blob DEFAULT NULL,
+ `bb` blob DEFAULT NULL,
+ `cb` blob DEFAULT NULL,
+ `db` blob DEFAULT NULL,
+ `eb` blob DEFAULT NULL,
+ `fb` blob DEFAULT NULL,
+ `gb` blob DEFAULT NULL,
+ `hb` blob DEFAULT NULL,
+ `ib` blob DEFAULT NULL,
+ `jb` blob DEFAULT NULL,
+ `kb` blob DEFAULT NULL,
+ `lb` blob DEFAULT NULL,
+ `mb` blob DEFAULT NULL,
+ `nb` blob DEFAULT NULL,
+ `ob` blob DEFAULT NULL,
+ `pb` blob DEFAULT NULL,
+ `qb` blob DEFAULT NULL,
+ `rb` blob DEFAULT NULL,
+ `sb` blob DEFAULT NULL,
+ `tb` blob DEFAULT NULL,
+ `ub` blob DEFAULT NULL,
+ `vb` blob DEFAULT NULL,
+ `wb` blob DEFAULT NULL,
+ `xb` blob DEFAULT NULL,
+ `yb` blob DEFAULT NULL,
+ `zb` blob DEFAULT NULL,
+ `ac` blob DEFAULT NULL,
+ `bc` blob DEFAULT NULL,
+ `cc` blob DEFAULT NULL,
+ `dc` blob DEFAULT NULL,
+ `ec` blob DEFAULT NULL,
+ `fc` blob DEFAULT NULL,
+ `gc` blob DEFAULT NULL,
+ `hc` blob DEFAULT NULL,
+ `ic` blob DEFAULT NULL,
+ `jc` blob DEFAULT NULL,
+ `kc` blob DEFAULT NULL,
+ `lc` blob DEFAULT NULL,
+ `mc` blob DEFAULT NULL,
+ `nc` blob DEFAULT NULL,
+ `oc` blob DEFAULT NULL,
+ `pc` blob DEFAULT NULL,
+ `qc` blob DEFAULT NULL,
+ `rc` blob DEFAULT NULL,
+ `sc` blob DEFAULT NULL,
+ `tc` blob DEFAULT NULL,
+ `uc` blob DEFAULT NULL,
+ `vc` blob DEFAULT NULL,
+ `wc` blob DEFAULT NULL,
+ `xc` blob DEFAULT NULL,
+ `yc` blob DEFAULT NULL,
+ `zc` blob DEFAULT NULL,
KEY `t2a` (`a`(767),`b`(767)),
KEY `t2c` (`c`(767),`d`(767)),
KEY `t2e` (`e`(767),`f`(767)),
diff --git a/mysql-test/suite/innodb/r/innodb-64k.result b/mysql-test/suite/innodb/r/innodb-64k.result
index c84ad8caf88..9271ad70fb4 100644
--- a/mysql-test/suite/innodb/r/innodb-64k.result
+++ b/mysql-test/suite/innodb/r/innodb-64k.result
@@ -2,8 +2,6 @@ call mtr.add_suppression("InnoDB: Warning: innodb_page_size has been changed fro
call mtr.add_suppression("InnoDB: Resizing redo log from *");
call mtr.add_suppression("InnoDB: Starting to delete and rewrite log files.");
call mtr.add_suppression("InnoDB: New log files created, LSN=*");
-SET GLOBAL innodb_file_format = `Barracuda`;
-SET GLOBAL innodb_file_per_table = ON;
# Test 1) Show the page size from Information Schema
SELECT variable_value FROM information_schema.global_status
WHERE LOWER(variable_name) = 'innodb_page_size';
diff --git a/mysql-test/suite/innodb/r/innodb-alter-discard.result b/mysql-test/suite/innodb/r/innodb-alter-discard.result
deleted file mode 100644
index b05b905bc34..00000000000
--- a/mysql-test/suite/innodb/r/innodb-alter-discard.result
+++ /dev/null
@@ -1,28 +0,0 @@
-call mtr.add_suppression("InnoDB: Cannot open datafile for read-only: .*");
-SET GLOBAL innodb_file_per_table=1;
-CREATE TABLE t(a INT)ENGINE=InnoDB;
-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.");
-call mtr.add_suppression("InnoDB: If you are installing InnoDB, remember that you must create directories yourself, InnoDB does not create them.");
-call mtr.add_suppression("InnoDB: Cannot open datafile for read-only: './test/t.ibd' OS error: .*");
-call mtr.add_suppression("InnoDB: Ignoring tablespace `test/t` because it could not be opened.");
-call mtr.add_suppression("InnoDB: Cannot calculate statistics for table .* because the .ibd file is missing. Please refer to .*");
-call mtr.add_suppression("InnoDB: Error: trying to open a table, but could not$");
-call mtr.add_suppression("MySQL is trying to open a table handle but the \.ibd file for$");
-call mtr.add_suppression("InnoDB: Table 'test/t'$");
-call mtr.add_suppression("Could not find a valid tablespace file for");
-call mtr.add_suppression("InnoDB: Tablespace open failed for '\"test\"\.\"t\"', ignored");
-call mtr.add_suppression("InnoDB: Failed to find tablespace for table '\"test\"\.\"t\"' in the cache");
-call mtr.add_suppression("InnoDB: Cannot delete tablespace [0-9]+.*not found");
-call mtr.add_suppression("Table .*t in the InnoDB data dictionary has tablespace id .*, but tablespace with that id or name does not exist");
-SELECT * FROM t;
-ERROR 42S02: Table 'test.t' doesn't exist in engine
-ALTER TABLE t ADD INDEX (a), ALGORITHM=INPLACE;
-ERROR 42S02: Table 'test.t' doesn't exist in engine
-ALTER TABLE t1 ADD INDEX (a), ALGORITHM=COPY;
-ERROR 42S02: Table 'test.t1' doesn't exist
-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;
diff --git a/mysql-test/suite/innodb/r/innodb-alter-tempfile.result b/mysql-test/suite/innodb/r/innodb-alter-tempfile.result
index 3cc973ca3a3..ce13ad0978b 100644
--- a/mysql-test/suite/innodb/r/innodb-alter-tempfile.result
+++ b/mysql-test/suite/innodb/r/innodb-alter-tempfile.result
@@ -4,10 +4,6 @@
# Temporary tablename will be unique. This makes sure that future
# in-place ALTERs of the same table will not be blocked due to
# temporary tablename.
-call mtr.add_suppression("InnoDB: Warning: database page corruption or a failed
-");
-call mtr.add_suppression("InnoDB: file read of space .* page .*");
-call mtr.add_suppression("InnoDB: Trying to recover it from the doublewrite buffer.");
# Crash the server in ha_innobase::commit_inplace_alter_table()
CREATE TABLE t1 (f1 INT NOT NULL, f2 INT NOT NULL) ENGINE=innodb;
SET debug='d,innodb_alter_commit_crash_before_commit';
diff --git a/mysql-test/suite/innodb/r/innodb-bug-14068765.result b/mysql-test/suite/innodb/r/innodb-bug-14068765.result
index f6d37b23114..f7a2644cbf9 100644
--- a/mysql-test/suite/innodb/r/innodb-bug-14068765.result
+++ b/mysql-test/suite/innodb/r/innodb-bug-14068765.result
@@ -1,8 +1,3 @@
-DROP TABLE IF EXISTS t1;
-SET GLOBAL innodb_file_per_table = 1;
-SELECT @@innodb_file_per_table;
-@@innodb_file_per_table
-1
CREATE DATABASE testdb_wl5522;
CREATE TABLE testdb_wl5522.t1(col1 bit(1) , col2 boolean,col3 tinyint , col4 smallint , col5 mediumint ,col6 int , col7 bigint , col8 float (14,3) ,col9 double (14,3), col10 VARCHAR(20) CHARACTER SET utf8 , col11 TEXT CHARACTER SET binary , col12 ENUM('a','b','c') CHARACTER SET binary ,col13 TEXT CHARACTER SET latin1 COLLATE latin1_general_cs ,col14 CHAR(20) , col15 VARBINARY (400) , col16 BINARY(40), col17 BLOB (400) , col18 int not null primary key,col19 DATE ,col20 DATETIME , col21 TIMESTAMP ,col22 TIME , col23 YEAR ) ENGINE = Innodb;
CREATE INDEX idx1 ON testdb_wl5522.t1(col18);
@@ -38,7 +33,3 @@ COUNT(*)
2
DROP TABLE testdb_wl5522.t1;
DROP DATABASE testdb_wl5522;
-SET GLOBAL INNODB_FILE_FORMAT=Barracuda;
-Warnings:
-Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
-SET GLOBAL INNODB_FILE_PER_TABLE=1;
diff --git a/mysql-test/suite/innodb/r/innodb-bug-14084530.result b/mysql-test/suite/innodb/r/innodb-bug-14084530.result
index 3ba8e0e8440..b8e0e3a579d 100644
--- a/mysql-test/suite/innodb/r/innodb-bug-14084530.result
+++ b/mysql-test/suite/innodb/r/innodb-bug-14084530.result
@@ -1,8 +1,3 @@
-DROP TABLE IF EXISTS t1;
-SET GLOBAL innodb_file_per_table = 1;
-SELECT @@innodb_file_per_table;
-@@innodb_file_per_table
-1
SET AUTOCOMMIT = 0;
CREATE DATABASE testdb_wl5522;
CREATE TABLE testdb_wl5522.t1 (c1 int ) engine = Innodb;
@@ -24,10 +19,4 @@ Table Op Msg_type Msg_text
testdb_wl5522.t1 check status OK
SELECT c1 FROM testdb_wl5522.t1;
c1
-SET AUTOCOMMIT = 1;
-DROP TABLE testdb_wl5522.t1;
DROP DATABASE testdb_wl5522;
-SET GLOBAL INNODB_FILE_FORMAT=Barracuda;
-Warnings:
-Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
-SET GLOBAL INNODB_FILE_PER_TABLE=1;
diff --git a/mysql-test/suite/innodb/r/innodb-fk-virtual.result b/mysql-test/suite/innodb/r/innodb-fk-virtual.result
new file mode 100644
index 00000000000..a79cd133aa3
--- /dev/null
+++ b/mysql-test/suite/innodb/r/innodb-fk-virtual.result
@@ -0,0 +1,86 @@
+create or replace table a (
+cola int(10) primary key,
+v_cola int(10) as (cola mod 10) virtual,
+p_cola int(10) as (cola mod 10) persistent
+) engine=innodb;
+create index v_cola on a (v_cola);
+create index p_cola on a (p_cola);
+create or replace table b(
+cola int(10),
+v_cola int(10),
+p_cola int(10),
+c_cola int(10) as (cola + 2) virtual
+) engine=innodb;
+alter table b add constraint `p_cola_fk`
+foreign key (p_cola) references a (p_cola)
+on delete restrict
+on update restrict;
+show warnings;
+Level Code Message
+show create table b;
+Table Create Table
+b CREATE TABLE `b` (
+ `cola` int(10) DEFAULT NULL,
+ `v_cola` int(10) DEFAULT NULL,
+ `p_cola` int(10) DEFAULT NULL,
+ `c_cola` int(10) GENERATED ALWAYS AS (`cola` + 2) VIRTUAL,
+ KEY `p_cola_fk` (`p_cola`),
+ CONSTRAINT `p_cola_fk` FOREIGN KEY (`p_cola`) REFERENCES `a` (`p_cola`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+alter table b add constraint `v_cola_fk`
+foreign key (v_cola) references a (v_cola)
+on delete restrict
+on update restrict;
+show warnings;
+Level Code Message
+show create table b;
+Table Create Table
+b CREATE TABLE `b` (
+ `cola` int(10) DEFAULT NULL,
+ `v_cola` int(10) DEFAULT NULL,
+ `p_cola` int(10) DEFAULT NULL,
+ `c_cola` int(10) GENERATED ALWAYS AS (`cola` + 2) VIRTUAL,
+ KEY `p_cola_fk` (`p_cola`),
+ KEY `v_cola_fk` (`v_cola`),
+ CONSTRAINT `p_cola_fk` FOREIGN KEY (`p_cola`) REFERENCES `a` (`p_cola`),
+ CONSTRAINT `v_cola_fk` FOREIGN KEY (`v_cola`) REFERENCES `a` (`v_cola`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+alter table b add constraint `c_cola_fk`
+foreign key (c_cola) references a (cola)
+on delete restrict
+on update restrict;
+show warnings;
+Level Code Message
+show create table b;
+Table Create Table
+b CREATE TABLE `b` (
+ `cola` int(10) DEFAULT NULL,
+ `v_cola` int(10) DEFAULT NULL,
+ `p_cola` int(10) DEFAULT NULL,
+ `c_cola` int(10) GENERATED ALWAYS AS (`cola` + 2) VIRTUAL,
+ KEY `p_cola_fk` (`p_cola`),
+ KEY `v_cola_fk` (`v_cola`),
+ KEY `c_cola_fk` (`c_cola`),
+ CONSTRAINT `c_cola_fk` FOREIGN KEY (`c_cola`) REFERENCES `a` (`cola`),
+ CONSTRAINT `p_cola_fk` FOREIGN KEY (`p_cola`) REFERENCES `a` (`p_cola`),
+ CONSTRAINT `v_cola_fk` FOREIGN KEY (`v_cola`) REFERENCES `a` (`v_cola`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+insert into a(cola) values (12);
+select * from a;
+cola v_cola p_cola
+12 2 2
+insert into b(cola, v_cola, p_cola) values (10,2,2);
+select * from b;
+cola v_cola p_cola c_cola
+10 2 2 12
+insert into b(cola, v_cola, p_cola) values (10,1,1);
+ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`b`, CONSTRAINT `p_cola_fk` FOREIGN KEY (`p_cola`) REFERENCES `a` (`p_cola`))
+delete from a;
+ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`b`, CONSTRAINT `c_cola_fk` FOREIGN KEY (`c_cola`) REFERENCES `a` (`cola`))
+select * from a;
+cola v_cola p_cola
+12 2 2
+select * from b;
+cola v_cola p_cola c_cola
+10 2 2 12
+drop table b, a;
diff --git a/mysql-test/suite/innodb/r/innodb-index.result b/mysql-test/suite/innodb/r/innodb-index.result
index 2b5e7bf214d..1b7f44fa8c4 100644
--- a/mysql-test/suite/innodb/r/innodb-index.result
+++ b/mysql-test/suite/innodb/r/innodb-index.result
@@ -1,7 +1,3 @@
-set global innodb_file_per_table=on;
-set global innodb_file_format='Barracuda';
-Warnings:
-Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS;
create table t1(a varchar(2) primary key) engine=innodb;
insert into t1 values('');
@@ -858,13 +854,6 @@ explain select * from t1 order by a;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL PRIMARY 4 NULL 2 Using index
drop table t1;
-set global innodb_file_per_table=1;
-set global innodb_file_format=Barracuda;
-Warnings:
-Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
-set global innodb_file_format_max=Barracuda;
-Warnings:
-Warning 131 Using innodb_file_format_max is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;
SET FOREIGN_KEY_CHECKS=0;
CREATE TABLE t1(
@@ -1195,7 +1184,3 @@ t2c CREATE TABLE `t2c` (
KEY `t2a` (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
DROP TABLE t1,t2,t2c,t2i;
-Warnings:
-Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
-Warnings:
-Warning 131 Using innodb_file_format_max is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
diff --git a/mysql-test/suite/innodb/r/innodb-page_compression_bzip2.result b/mysql-test/suite/innodb/r/innodb-page_compression_bzip2.result
index a566c94bd3b..61507ddbe5c 100644
--- a/mysql-test/suite/innodb/r/innodb-page_compression_bzip2.result
+++ b/mysql-test/suite/innodb/r/innodb-page_compression_bzip2.result
@@ -1,7 +1,3 @@
-set global innodb_file_format = `barracuda`;
-Warnings:
-Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
-set global innodb_file_per_table = on;
set global innodb_compression_algorithm = 5;
create table innodb_compressed(c1 int, b char(20)) engine=innodb row_format=compressed key_block_size=8;
show warnings;
@@ -437,5 +433,3 @@ drop table innodb_page_compressed6;
drop table innodb_page_compressed7;
drop table innodb_page_compressed8;
drop table innodb_page_compressed9;
-Warnings:
-Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
diff --git a/mysql-test/suite/innodb/r/innodb-page_compression_lz4.result b/mysql-test/suite/innodb/r/innodb-page_compression_lz4.result
index 76cd5b16f28..6cef1978ca0 100644
--- a/mysql-test/suite/innodb/r/innodb-page_compression_lz4.result
+++ b/mysql-test/suite/innodb/r/innodb-page_compression_lz4.result
@@ -1,7 +1,3 @@
-set global innodb_file_format = `barracuda`;
-Warnings:
-Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
-set global innodb_file_per_table = on;
set global innodb_compression_algorithm = 2;
create table innodb_compressed(c1 int, b char(20)) engine=innodb row_format=compressed key_block_size=8;
show warnings;
@@ -438,5 +434,3 @@ drop table innodb_page_compressed6;
drop table innodb_page_compressed7;
drop table innodb_page_compressed8;
drop table innodb_page_compressed9;
-Warnings:
-Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
diff --git a/mysql-test/suite/innodb/r/innodb-page_compression_lzma.result b/mysql-test/suite/innodb/r/innodb-page_compression_lzma.result
index cceff820ee0..c7ab859e102 100644
--- a/mysql-test/suite/innodb/r/innodb-page_compression_lzma.result
+++ b/mysql-test/suite/innodb/r/innodb-page_compression_lzma.result
@@ -1,7 +1,3 @@
-set global innodb_file_format = `barracuda`;
-Warnings:
-Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
-set global innodb_file_per_table = on;
set global innodb_compression_algorithm = 4;
create table innodb_compressed(c1 int, b char(20)) engine=innodb row_format=compressed key_block_size=8;
show warnings;
@@ -437,5 +433,3 @@ drop table innodb_page_compressed6;
drop table innodb_page_compressed7;
drop table innodb_page_compressed8;
drop table innodb_page_compressed9;
-Warnings:
-Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
diff --git a/mysql-test/suite/innodb/r/innodb-page_compression_lzo.result b/mysql-test/suite/innodb/r/innodb-page_compression_lzo.result
index 1a9235fab62..379abcc9968 100644
--- a/mysql-test/suite/innodb/r/innodb-page_compression_lzo.result
+++ b/mysql-test/suite/innodb/r/innodb-page_compression_lzo.result
@@ -1,7 +1,3 @@
-set global innodb_file_format = `barracuda`;
-Warnings:
-Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
-set global innodb_file_per_table = on;
set global innodb_compression_algorithm = 3;
create table innodb_compressed(c1 int, b char(20)) engine=innodb row_format=compressed key_block_size=8;
show warnings;
@@ -351,5 +347,3 @@ drop table innodb_page_compressed6;
drop table innodb_page_compressed7;
drop table innodb_page_compressed8;
drop table innodb_page_compressed9;
-Warnings:
-Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
diff --git a/mysql-test/suite/innodb/r/innodb-page_compression_snappy.result b/mysql-test/suite/innodb/r/innodb-page_compression_snappy.result
index e1d46b04a7f..442885755fd 100644
--- a/mysql-test/suite/innodb/r/innodb-page_compression_snappy.result
+++ b/mysql-test/suite/innodb/r/innodb-page_compression_snappy.result
@@ -1,102 +1,98 @@
-call mtr.add_suppression("Compression failed for space*");
-set global innodb_file_format = `barracuda`;
-Warnings:
-Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
-set global innodb_file_per_table = on;
+call mtr.add_suppression("InnoDB: Compression failed for space.*");
set global innodb_compression_algorithm = 6;
-create table innodb_compressed(c1 int, b char(20)) engine=innodb row_format=compressed key_block_size=8;
+create table innodb_compressed(c1 int, b char(200)) engine=innodb row_format=compressed key_block_size=8;
show warnings;
Level Code Message
-create table innodb_normal (c1 int, b char(20)) engine=innodb;
+create table innodb_normal (c1 int, b char(200)) engine=innodb;
show warnings;
Level Code Message
-create table innodb_page_compressed1 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=1;
+create table innodb_page_compressed1 (c1 int, b char(200)) engine=innodb page_compressed=1 page_compression_level=1;
show warnings;
Level Code Message
show create table innodb_page_compressed1;
Table Create Table
innodb_page_compressed1 CREATE TABLE `innodb_page_compressed1` (
`c1` int(11) DEFAULT NULL,
- `b` char(20) DEFAULT NULL
+ `b` char(200) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=1
-create table innodb_page_compressed2 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=2;
+create table innodb_page_compressed2 (c1 int, b char(200)) engine=innodb page_compressed=1 page_compression_level=2;
show warnings;
Level Code Message
show create table innodb_page_compressed2;
Table Create Table
innodb_page_compressed2 CREATE TABLE `innodb_page_compressed2` (
`c1` int(11) DEFAULT NULL,
- `b` char(20) DEFAULT NULL
+ `b` char(200) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=2
-create table innodb_page_compressed3 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=3;
+create table innodb_page_compressed3 (c1 int, b char(200)) engine=innodb page_compressed=1 page_compression_level=3;
show warnings;
Level Code Message
show create table innodb_page_compressed3;
Table Create Table
innodb_page_compressed3 CREATE TABLE `innodb_page_compressed3` (
`c1` int(11) DEFAULT NULL,
- `b` char(20) DEFAULT NULL
+ `b` char(200) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=3
-create table innodb_page_compressed4 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=4;
+create table innodb_page_compressed4 (c1 int, b char(200)) engine=innodb page_compressed=1 page_compression_level=4;
show warnings;
Level Code Message
show create table innodb_page_compressed4;
Table Create Table
innodb_page_compressed4 CREATE TABLE `innodb_page_compressed4` (
`c1` int(11) DEFAULT NULL,
- `b` char(20) DEFAULT NULL
+ `b` char(200) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=4
-create table innodb_page_compressed5 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=5;
+create table innodb_page_compressed5 (c1 int, b char(200)) engine=innodb page_compressed=1 page_compression_level=5;
show warnings;
Level Code Message
show create table innodb_page_compressed5;
Table Create Table
innodb_page_compressed5 CREATE TABLE `innodb_page_compressed5` (
`c1` int(11) DEFAULT NULL,
- `b` char(20) DEFAULT NULL
+ `b` char(200) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=5
-create table innodb_page_compressed6 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=6;
+create table innodb_page_compressed6 (c1 int, b char(200)) engine=innodb page_compressed=1 page_compression_level=6;
show warnings;
Level Code Message
show create table innodb_page_compressed6;
Table Create Table
innodb_page_compressed6 CREATE TABLE `innodb_page_compressed6` (
`c1` int(11) DEFAULT NULL,
- `b` char(20) DEFAULT NULL
+ `b` char(200) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=6
-create table innodb_page_compressed7 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=7;
+create table innodb_page_compressed7 (c1 int, b char(200)) engine=innodb page_compressed=1 page_compression_level=7;
show warnings;
Level Code Message
show create table innodb_page_compressed7;
Table Create Table
innodb_page_compressed7 CREATE TABLE `innodb_page_compressed7` (
`c1` int(11) DEFAULT NULL,
- `b` char(20) DEFAULT NULL
+ `b` char(200) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=7
-create table innodb_page_compressed8 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=8;
+create table innodb_page_compressed8 (c1 int, b char(200)) engine=innodb page_compressed=1 page_compression_level=8;
show warnings;
Level Code Message
show create table innodb_page_compressed8;
Table Create Table
innodb_page_compressed8 CREATE TABLE `innodb_page_compressed8` (
`c1` int(11) DEFAULT NULL,
- `b` char(20) DEFAULT NULL
+ `b` char(200) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=8
-create table innodb_page_compressed9 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=9;
+create table innodb_page_compressed9 (c1 int, b char(200)) engine=innodb page_compressed=1 page_compression_level=9;
show warnings;
Level Code Message
show create table innodb_page_compressed9;
Table Create Table
innodb_page_compressed9 CREATE TABLE `innodb_page_compressed9` (
`c1` int(11) DEFAULT NULL,
- `b` char(20) DEFAULT NULL
+ `b` char(200) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=9
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,'testing..');
+insert into innodb_normal values(current_num,'aaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbccccccccccccccccccccccc');
set current_num = current_num + 1;
end while;
end//
@@ -159,7 +155,7 @@ show create table innodb_normal;
Table Create Table
innodb_normal CREATE TABLE `innodb_normal` (
`c1` int(11) DEFAULT NULL,
- `b` char(20) DEFAULT NULL
+ `b` char(200) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=8
alter table innodb_compressed row_format=default page_compressed=1 page_compression_level=8 key_block_size=0;
show warnings;
@@ -168,7 +164,7 @@ show create table innodb_compressed;
Table Create Table
innodb_compressed CREATE TABLE `innodb_compressed` (
`c1` int(11) DEFAULT NULL,
- `b` char(20) DEFAULT NULL
+ `b` char(200) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=8
update innodb_page_compressed1 set c1 = c1 + 1;
update innodb_page_compressed2 set c1 = c1 + 1;
@@ -438,5 +434,3 @@ drop table innodb_page_compressed6;
drop table innodb_page_compressed7;
drop table innodb_page_compressed8;
drop table innodb_page_compressed9;
-Warnings:
-Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
diff --git a/mysql-test/suite/innodb/r/innodb-page_compression_tables.result b/mysql-test/suite/innodb/r/innodb-page_compression_tables.result
index 7d825e73aa4..94420e5397d 100644
--- a/mysql-test/suite/innodb/r/innodb-page_compression_tables.result
+++ b/mysql-test/suite/innodb/r/innodb-page_compression_tables.result
@@ -1,7 +1,3 @@
-SET GLOBAL innodb_file_format = `Barracuda`;
-Warnings:
-Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
-SET GLOBAL innodb_file_per_table = ON;
set global innodb_compression_algorithm = 1;
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 page_compressed=1;
@@ -92,10 +88,6 @@ count(*)
select count(*) from innodb_dynamic where c1 < 1500000;
count(*)
5000
-SET GLOBAL innodb_file_format = `Barracuda`;
-Warnings:
-Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
-SET GLOBAL innodb_file_per_table = ON;
set global innodb_compression_algorithm = 0;
alter table innodb_compact engine=innodb page_compressed=DEFAULT;
alter table innodb_dynamic engine=innodb page_compressed=DEFAULT;
@@ -149,5 +141,3 @@ DROP TABLE no_compression;
DROP TABLE default_compression;
DROP TABLE explicit_no_compression;
SET SESSION innodb_compression_default = 0;
-Warnings:
-Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
diff --git a/mysql-test/suite/innodb/r/innodb-page_compression_zip.result b/mysql-test/suite/innodb/r/innodb-page_compression_zip.result
index a8078c02e13..bb9ceb29e17 100644
--- a/mysql-test/suite/innodb/r/innodb-page_compression_zip.result
+++ b/mysql-test/suite/innodb/r/innodb-page_compression_zip.result
@@ -1,7 +1,3 @@
-SET GLOBAL innodb_file_format = `Barracuda`;
-Warnings:
-Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
-SET GLOBAL innodb_file_per_table = ON;
set global innodb_compression_algorithm = 1;
create table innodb_compressed(c1 int, b char(20)) engine=innodb row_format=compressed key_block_size=8;
show warnings;
@@ -351,5 +347,3 @@ drop table innodb_page_compressed6;
drop table innodb_page_compressed7;
drop table innodb_page_compressed8;
drop table innodb_page_compressed9;
-Warnings:
-Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
diff --git a/mysql-test/suite/innodb/r/innodb-trim.result b/mysql-test/suite/innodb/r/innodb-trim.result
new file mode 100644
index 00000000000..40eac2f8b40
--- /dev/null
+++ b/mysql-test/suite/innodb/r/innodb-trim.result
@@ -0,0 +1,20 @@
+set global innodb_compression_algorithm = 1;
+create table innodb_page_compressed (c1 int not null primary key auto_increment, b char(200), c char(200), d char(200)) engine=innodb page_compressed=1 page_compression_level=9;
+show warnings;
+Level Code Message
+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_page_compressed values (NULL,repeat('A',150),repeat('AB',75),repeat('B', 175));
+set current_num = current_num + 1;
+end while;
+end//
+commit;
+set autocommit=0;
+call innodb_insert_proc(16000);
+commit;
+set autocommit=1;
+DROP PROCEDURE innodb_insert_proc;
+DROP TABLE innodb_page_compressed;
diff --git a/mysql-test/suite/innodb/r/innodb-wl5522-1.result b/mysql-test/suite/innodb/r/innodb-wl5522-1.result
index 0660ee1fae2..b2a5f49a9ad 100644
--- a/mysql-test/suite/innodb/r/innodb-wl5522-1.result
+++ b/mysql-test/suite/innodb/r/innodb-wl5522-1.result
@@ -1,18 +1,4 @@
call mtr.add_suppression("InnoDB: Unable to import tablespace .* because it already exists. Please DISCARD the tablespace before IMPORT.");
-DROP TABLE IF EXISTS t1;
-SET GLOBAL innodb_file_per_table = 1;
-SELECT @@innodb_file_per_table;
-@@innodb_file_per_table
-1
-SET GLOBAL innodb_file_format = `Barracuda`;
-Warnings:
-Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
-SELECT @@innodb_file_format;
-@@innodb_file_format
-Barracuda
-DROP DATABASE IF EXISTS testdb_wl5522;
-Warnings:
-Note 1008 Can't drop database 'testdb_wl5522'; database doesn't exist
CREATE DATABASE testdb_wl5522;
CREATE TABLE testdb_wl5522.t1 (c1 INT ) ENGINE = Innodb;
INSERT INTO testdb_wl5522.t1 VALUES (1),(123),(331);
@@ -44,37 +30,37 @@ CREATE TABLE testdb_wl5522.t1 (
col1 BIT(1),
col2 BOOLEAN,
col3 TINYINT,
-col4 SMALLINT,
+col4 SMALLINT,
col5 MEDIUMINT,
col6 INT,
-col7 BIGINT,
+col7 BIGINT,
col8 FLOAT (14,3) ,
-col9 DOUBLE (14,3),
-col10 VARCHAR(20),
+col9 DOUBLE (14,3),
+col10 VARCHAR(20),
col11 TEXT ,
col12 ENUM('a','b','c'),
col13 TEXT,
-col14 CHAR(20) ,
-col15 VARBINARY (400) ,
-col16 BINARY(40),
-col17 BLOB (400) ,
+col14 CHAR(20),
+col15 VARBINARY (400),
+col16 BINARY(40),
+col17 BLOB (400),
col18 INT NOT NULL PRIMARY KEY,
-col19 DATE ,
-col20 DATETIME ,
-col21 TIMESTAMP ,
-col22 TIME ,
+col19 DATE,
+col20 DATETIME,
+col21 TIMESTAMP,
+col22 TIME,
col23 YEAR ) ENGINE = Innodb;
CREATE INDEX idx1 ON testdb_wl5522.t1(col18);
CREATE INDEX prefix_idx ON testdb_wl5522.t1(col14 (10));
CREATE UNIQUE INDEX idx2 ON testdb_wl5522.t1(col12);
CREATE UNIQUE INDEX idx3 ON testdb_wl5522.t1(col8);
-INSERT INTO testdb_wl5522.t1 VALUES
+INSERT INTO testdb_wl5522.t1 VALUES
(1,1,-128,32767,-8388608,2147483647,-9223372036854775808, 92233720368.222,
-92233720368.222,'aaa', + 'aaaaaaaaaa','b','bbbbb','ccccc',
REPEAT('d',40),REPEAT('d',40),REPEAT('d',40),1,'1000-01-01',
'3000-12-31 23:59:59.99','1990-01-01 00:00:01.00',
'01:59:59.00','1901');
-INSERT INTO testdb_wl5522.t1 VALUES
+INSERT INTO testdb_wl5522.t1 VALUES
(NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
NULL,NULL,NULL,3,NULL,NULL,NULL,NULL,NULL);
INSERT INTO testdb_wl5522.t1 VALUES (NULL,NULL,NULL,NULL,NULL,NULL,NULL,
@@ -112,7 +98,7 @@ col18 INT NOT NULL PRIMARY KEY,
col19 DATE ,
col20 DATETIME ,
col21 TIMESTAMP ,
-col22 TIME ,
+col22 TIME,
col23 YEAR ) ENGINE = Innodb;
CREATE INDEX idx1 ON testdb_wl5522.t1(col18);
CREATE INDEX prefix_idx ON testdb_wl5522.t1(col14 (10));
@@ -128,9 +114,6 @@ SELECT COUNT(*) FROM testdb_wl5522.t1;
COUNT(*)
2
DROP TABLE testdb_wl5522.t1;
-SET GLOBAL innodb_file_format='Barracuda';
-Warnings:
-Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
CREATE TABLE testdb_wl5522.t1 (
col_1_varbinary VARBINARY (4000) ,
col_2_varchar VARCHAR (4000),
@@ -143,13 +126,13 @@ col_7_binary BINARY (255)
INSERT INTO testdb_wl5522.t1 VALUES(
REPEAT('a', 4000),REPEAT('o', 4000),REPEAT('a', 4000), REPEAT('o', 4000),
REPEAT('a', 4000),REPEAT('a', 4000),REPEAT('a', 255));
-SELECT col_1_varbinary = REPEAT("a", 4000) ,
+SELECT col_1_varbinary = REPEAT("a", 4000),
col_2_varchar = REPEAT("o", 4000) ,
col_3_text = REPEAT("a", 4000) ,
col_4_blob = REPEAT("o", 4000) ,
col_5_text = REPEAT("a", 4000) ,
col_6_varchar = REPEAT("a", 4000) ,
-col_7_binary = REPEAT("a", 255)
+col_7_binary = REPEAT("a", 255)
FROM testdb_wl5522.t1;
col_1_varbinary = REPEAT("a", 4000) col_2_varchar = REPEAT("o", 4000) col_3_text = REPEAT("a", 4000) col_4_blob = REPEAT("o", 4000) col_5_text = REPEAT("a", 4000) col_6_varchar = REPEAT("a", 4000) col_7_binary = REPEAT("a", 255)
1 1 1 1 1 1 1
@@ -175,14 +158,14 @@ col_3_text = REPEAT("a", 4000) ,
col_4_blob = REPEAT("o", 4000) ,
col_5_text = REPEAT("a", 4000) ,
col_6_varchar = REPEAT("a", 4000) ,
-col_7_binary = REPEAT("a", 255)
+col_7_binary = REPEAT("a", 255)
FROM testdb_wl5522.t1;
col_1_varbinary = REPEAT("a", 4000) col_2_varchar = REPEAT("o", 4000) col_3_text = REPEAT("a", 4000) col_4_blob = REPEAT("o", 4000) col_5_text = REPEAT("a", 4000) col_6_varchar = REPEAT("a", 4000) col_7_binary = REPEAT("a", 255)
1 1 1 1 1 1 1
DROP TABLE testdb_wl5522.t1;
CREATE TABLE testdb_wl5522.t1 (
col_1_int INT AUTO_INCREMENT,
-col_2_varchar VARCHAR (20),
+col_2_varchar VARCHAR (20),
PRIMARY KEY (col_1_int)) ENGINE = Innodb;
INSERT INTO testdb_wl5522.t1 VALUES (1,'a1'),(2,'a2'),(3,'a3');
INSERT INTO testdb_wl5522.t1 (col_2_varchar) VALUES ('a4'),('a5'),('a6');
@@ -245,7 +228,7 @@ col_1_int INT,col_2_varchar VARCHAR (20),
PRIMARY KEY (col_2_varchar)) ENGINE = Innodb;
CREATE TABLE testdb_wl5522.t1_fk (
col_1_int INT,col_2_varchar VARCHAR (20),
-PRIMARY KEY (col_1_int),
+PRIMARY KEY (col_1_int),
FOREIGN KEY (col_2_varchar) REFERENCES testdb_wl5522.t1(col_2_varchar)
) ENGINE = Innodb;
INSERT INTO testdb_wl5522.t1 VALUES (1,'a1'),(2,'a2'),(3,'a3'),(4,'a4'),(5,'a5');
@@ -702,19 +685,19 @@ DROP TABLE testdb_wl5522.t1;
SET AUTOCOMMIT = 1;
CREATE TABLE testdb_wl5522.t1(col1 bit(1) ,
col2 boolean,col3 tinyint , col4 smallint ,
-col5 mediumint ,col6 int , col7 bigint ,
+col5 mediumint ,col6 int , col7 bigint ,
col8 float (14,3) ,col9 double (14,3),
col10 VARCHAR(20) CHARACTER SET utf8 ,
col11 TEXT CHARACTER SET binary ,
col12 ENUM('a','b','c') CHARACTER SET binary,
col13 TEXT CHARACTER SET latin1 COLLATE latin1_general_cs ,
col14 CHAR(20) , col15 VARBINARY (400),
-col16 BINARY(40), col17 BLOB (400),
+col16 BINARY(40), col17 BLOB (400),
col18 int not null primary key,
col19 DATE ,col20 DATETIME , col21 TIMESTAMP ,
col22 TIME , col23 YEAR ) ENGINE = Innodb;
CREATE TABLE testdb_wl5522.trigger_table ( i int ) ENGINE = Innodb;
-CREATE TRIGGER testdb_wl5522.tri AFTER INSERT ON testdb_wl5522.t1
+CREATE TRIGGER testdb_wl5522.tri AFTER INSERT ON testdb_wl5522.t1
FOR EACH ROW INSERT INTO testdb_wl5522.trigger_table VALUES(NEW.col18);
CREATE OR REPLACE VIEW testdb_wl5522.VW1 AS SELECT * FROM testdb_wl5522.t1;
CREATE INDEX idx1 ON testdb_wl5522.t1(col18);
@@ -812,7 +795,3 @@ DROP DATABASE testdb_wl5522;
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: The table .* doesn't have a corresponding tablespace, it was discarded");
-SET GLOBAL INNODB_FILE_FORMAT=Barracuda;
-Warnings:
-Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
-SET GLOBAL INNODB_FILE_PER_TABLE=1;
diff --git a/mysql-test/suite/innodb/r/innodb-wl5522-debug-zip.result b/mysql-test/suite/innodb/r/innodb-wl5522-debug-zip.result
index cb19c66914e..cb01e5d2465 100644
--- a/mysql-test/suite/innodb/r/innodb-wl5522-debug-zip.result
+++ b/mysql-test/suite/innodb/r/innodb-wl5522-debug-zip.result
@@ -1,27 +1,10 @@
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: Error: Tablespace flags .* corrupted unused .*");
-call mtr.add_suppression("InnoDB: Tablespace flags: .* corrupted in file: .* ");
call mtr.add_suppression("InnoDB: Page 0 at offset 0 looks corrupted in file .*");
-call mtr.add_suppression("InnoDB: Page for tablespace .* ");
-flush tables;
-SET GLOBAL innodb_file_per_table = 1;
-SELECT @@innodb_file_per_table;
-@@innodb_file_per_table
-1
-SET GLOBAL innodb_file_format = `Barracuda`;
-Warnings:
-Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
-SELECT @@innodb_file_format;
-@@innodb_file_format
-Barracuda
+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;
-SELECT @@SESSION.innodb_strict_mode;
-@@SESSION.innodb_strict_mode
-1
-DROP DATABASE IF EXISTS test_wl5522;
-Warnings:
-Note 1008 Can't drop database 'test_wl5522'; database doesn't exist
CREATE DATABASE test_wl5522;
CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb
ROW_FORMAT=COMPRESSED;
@@ -53,20 +36,7 @@ unlink: t1.cfg
# Restart and reconnect to the server
SET SESSION debug_dbug="-d,ib_import_before_checkpoint_crash";
DROP TABLE test_wl5522.t1;
-SET GLOBAL innodb_file_per_table = 1;
-SELECT @@innodb_file_per_table;
-@@innodb_file_per_table
-1
-SET GLOBAL innodb_file_format = `Barracuda`;
-Warnings:
-Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
-SELECT @@innodb_file_format;
-@@innodb_file_format
-Barracuda
SET SESSION innodb_strict_mode=1;
-SELECT @@SESSION.innodb_strict_mode;
-@@SESSION.innodb_strict_mode
-1
CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb
ROW_FORMAT=COMPRESSED;
ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
@@ -575,7 +545,7 @@ 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` : Unsupported
+ERROR HY000: Internal error: Cannot reset LSNs in table `test_wl5522`.`t1` : Data structure corruption
SET SESSION debug_dbug="-d,fsp_flags_is_valid_failure";
DROP TABLE test_wl5522.t1;
unlink: t1.ibd
@@ -587,8 +557,3 @@ 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_FORMAT=Barracuda;
-Warnings:
-Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
-SET SESSION innodb_strict_mode=1;
diff --git a/mysql-test/suite/innodb/r/innodb-wl5522-debug.result b/mysql-test/suite/innodb/r/innodb-wl5522-debug.result
index 8327ef36909..698950e0d1d 100644
--- a/mysql-test/suite/innodb/r/innodb-wl5522-debug.result
+++ b/mysql-test/suite/innodb/r/innodb-wl5522-debug.result
@@ -2,13 +2,13 @@ call mtr.add_suppression("InnoDB: Operating system error number .* in a file ope
call mtr.add_suppression("InnoDB: The error means the system cannot find the path specified.");
call mtr.add_suppression("InnoDB: If you are installing InnoDB, remember that you must create directories yourself, InnoDB does not create them.");
call mtr.add_suppression("InnoDB: Cannot open datafile for read-only: .*");
-call mtr.add_suppression("InnoDB: Tablespace flags: .*");
call mtr.add_suppression("InnoDB: Ignoring tablespace .* because it could not be opened.");
call mtr.add_suppression("InnoDB: Tablespace for table .* is set as discarded.");
call mtr.add_suppression("InnoDB: Cannot calculate statistics for table .*");
-call mtr.add_suppression("InnoDB: Page 0 at offset 0 looks corrupted in file .*");
-call mtr.add_suppression("InnoDB: Page for tablespace .* ");
-flush tables;
+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=");
+FLUSH TABLES;
SET GLOBAL innodb_file_per_table = 1;
SELECT @@innodb_file_per_table;
@@innodb_file_per_table
@@ -921,7 +921,7 @@ 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` : Unsupported
+ERROR HY000: Internal error: Cannot reset LSNs in table `test_wl5522`.`t1` : Data structure corruption
SET SESSION debug_dbug="-d,fsp_flags_is_valid_failure";
DROP TABLE test_wl5522.t1;
unlink: t1.ibd
diff --git a/mysql-test/suite/innodb/r/innodb-wl5522-zip.result b/mysql-test/suite/innodb/r/innodb-wl5522-zip.result
index 42b2b6a527b..54f4bcc8c1f 100644
--- a/mysql-test/suite/innodb/r/innodb-wl5522-zip.result
+++ b/mysql-test/suite/innodb/r/innodb-wl5522-zip.result
@@ -1,19 +1,5 @@
call mtr.add_suppression("InnoDB: Unable to import tablespace .* because it already exists. Please DISCARD the tablespace before IMPORT.");
-DROP TABLE IF EXISTS t1;
-SET GLOBAL innodb_file_per_table = 1;
-SELECT @@innodb_file_per_table;
-@@innodb_file_per_table
-1
-SET GLOBAL innodb_file_format = `Barracuda`;
-Warnings:
-Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
-SELECT @@innodb_file_format;
-@@innodb_file_format
-Barracuda
SET SESSION innodb_strict_mode=1;
-SELECT @@SESSION.innodb_strict_mode;
-@@SESSION.innodb_strict_mode
-1
CREATE TABLE t1
(a INT AUTO_INCREMENT PRIMARY KEY,
b char(22),
@@ -107,20 +93,7 @@ a b c
822 Devotion asdfuihknaskdf
821 Cavalry ..asdasdfaeraf
DROP TABLE t1;
-SET GLOBAL innodb_file_per_table = 1;
-SELECT @@innodb_file_per_table;
-@@innodb_file_per_table
-1
-SET GLOBAL innodb_file_format = `Barracuda`;
-Warnings:
-Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
-SELECT @@innodb_file_format;
-@@innodb_file_format
-Barracuda
SET SESSION innodb_strict_mode=1;
-SELECT @@SESSION.innodb_strict_mode;
-@@SESSION.innodb_strict_mode
-1
CREATE TABLE t1(
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
c2 INT) ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1;
@@ -213,7 +186,7 @@ COUNT(*)
DROP TABLE t1;
CREATE TABLE t1(
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
-c2 INT, INDEX(c2)) ENGINE=InnoDB
+c2 INT, INDEX(c2)) ENGINE=InnoDB
ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8;
INSERT INTO t1(c2) VALUES(1);
INSERT INTO t1(c2) SELECT c2 FROM t1;
@@ -500,8 +473,3 @@ 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: The table .* doesn't have a corresponding tablespace, it was discarded");
-SET GLOBAL INNODB_FILE_FORMAT=Barracuda;
-Warnings:
-Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
-SET GLOBAL INNODB_FILE_PER_TABLE=1;
-SET SESSION innodb_strict_mode=1;
diff --git a/mysql-test/suite/innodb/r/innodb-wl5522.result b/mysql-test/suite/innodb/r/innodb-wl5522.result
index 2f8f56e9550..2ae994e8f3d 100644
--- a/mysql-test/suite/innodb/r/innodb-wl5522.result
+++ b/mysql-test/suite/innodb/r/innodb-wl5522.result
@@ -1,15 +1,5 @@
call mtr.add_suppression("InnoDB: Unable to import tablespace .* because it already exists. Please DISCARD the tablespace before IMPORT.");
-DROP TABLE IF EXISTS t1;
-SET GLOBAL innodb_file_per_table = 1;
-SELECT @@innodb_file_per_table;
-@@innodb_file_per_table
-1
-SET GLOBAL innodb_file_format = `Barracuda`;
-Warnings:
-Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
-SELECT @@innodb_file_format;
-@@innodb_file_format
-Barracuda
+FLUSH TABLES;
CREATE TABLE t1
(a INT AUTO_INCREMENT PRIMARY KEY,
b char(22),
@@ -103,16 +93,6 @@ a b c
822 Devotion asdfuihknaskdf
821 Cavalry ..asdasdfaeraf
DROP TABLE t1;
-SET GLOBAL innodb_file_per_table = 1;
-SELECT @@innodb_file_per_table;
-@@innodb_file_per_table
-1
-SET GLOBAL innodb_file_format = `Barracuda`;
-Warnings:
-Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
-SELECT @@innodb_file_format;
-@@innodb_file_format
-Barracuda
CREATE TABLE t1(
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
c2 INT) ENGINE=InnoDB;
@@ -1034,7 +1014,4 @@ 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: The table .* doesn't have a corresponding tablespace, it was discarded");
-SET GLOBAL INNODB_FILE_FORMAT=Barracuda;
-Warnings:
-Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
-SET GLOBAL INNODB_FILE_PER_TABLE=1;
+FLUSH TABLES;
diff --git a/mysql-test/suite/innodb/r/innodb_blob_truncate.result b/mysql-test/suite/innodb/r/innodb_blob_truncate.result
index a71dd7678c0..b10d4a94eb7 100644
--- a/mysql-test/suite/innodb/r/innodb_blob_truncate.result
+++ b/mysql-test/suite/innodb/r/innodb_blob_truncate.result
@@ -1,7 +1,3 @@
-SET GLOBAL innodb_file_format = `Barracuda`;
-Warnings:
-Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
-SET GLOBAL innodb_file_per_table = ON;
create table t1(a blob) engine=innodb key_block_size=8;
create function generate_blob()
returns varchar(20000)
@@ -19,5 +15,3 @@ truncate t1;
insert into t1 select generate_blob();
drop table t1;
drop function generate_blob;
-Warnings:
-Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
diff --git a/mysql-test/suite/innodb/r/innodb_bug59641.result b/mysql-test/suite/innodb/r/innodb_bug59641.result
index f22d39654de..2c042585745 100644
--- a/mysql-test/suite/innodb/r/innodb_bug59641.result
+++ b/mysql-test/suite/innodb/r/innodb_bug59641.result
@@ -1,5 +1,3 @@
-call mtr.add_suppression("Found 3 prepared XA transactions");
-flush tables;
CREATE TABLE t(a INT PRIMARY KEY, b INT)ENGINE=InnoDB;
INSERT INTO t VALUES(2,2),(4,4),(8,8),(16,16),(32,32);
COMMIT;
@@ -8,20 +6,18 @@ INSERT INTO t VALUES(1,1);
XA END '123';
XA PREPARE '123';
CONNECT con1,localhost,root,,;
-connection con1;
XA START '456';
INSERT INTO t VALUES(3,47),(5,67);
UPDATE t SET b=2*b WHERE a BETWEEN 5 AND 8;
XA END '456';
XA PREPARE '456';
CONNECT con2,localhost,root,,;
-connection con2;
XA START '789';
UPDATE t SET b=4*a WHERE a=32;
XA END '789';
XA PREPARE '789';
CONNECT con3,localhost,root,,;
-connection con3;
+# Kill and restart
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
SELECT * FROM t;
a b
diff --git a/mysql-test/suite/innodb/r/innodb_monitor.result b/mysql-test/suite/innodb/r/innodb_monitor.result
index 0a163193b58..263da6070b2 100644
--- a/mysql-test/suite/innodb/r/innodb_monitor.result
+++ b/mysql-test/suite/innodb/r/innodb_monitor.result
@@ -181,16 +181,8 @@ compress_pages_decompressed disabled
compression_pad_increments disabled
compression_pad_decrements disabled
compress_saved disabled
-compress_trim_sect512 disabled
-compress_trim_sect1024 disabled
-compress_trim_sect2048 disabled
-compress_trim_sect4096 disabled
-compress_trim_sect8192 disabled
-compress_trim_sect16384 disabled
-compress_trim_sect32768 disabled
compress_pages_page_compressed disabled
compress_page_compressed_trim_op disabled
-compress_page_compressed_trim_op_saved disabled
compress_pages_page_decompressed disabled
compress_pages_page_compression_error disabled
compress_pages_encrypted disabled
diff --git a/mysql-test/suite/innodb/r/innodb_prefix_index_restart_server.result b/mysql-test/suite/innodb/r/innodb_prefix_index_restart_server.result
index 5ae138477b9..a3ac78aadce 100644
--- a/mysql-test/suite/innodb/r/innodb_prefix_index_restart_server.result
+++ b/mysql-test/suite/innodb/r/innodb_prefix_index_restart_server.result
@@ -1,11 +1,6 @@
-set global innodb_file_format="Barracuda";
-Warnings:
-Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
-set global innodb_file_per_table=1;
set global innodb_large_prefix=1;
Warnings:
Warning 131 Using innodb_large_prefix is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
-DROP TABLE IF EXISTS worklog5743;
CREATE TABLE worklog5743 (
col_1_text TEXT(4000) , col_2_text TEXT(4000) ,
PRIMARY KEY (col_1_text(3072))
@@ -92,10 +87,6 @@ worklog5743;
col_1_text = REPEAT("a", 3500) col_2_text = REPEAT("o", 3500)
1 1
DROP TABLE worklog5743;
-SET GLOBAL innodb_file_format=Barracuda;
-Warnings:
-Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
-SET GLOBAL innodb_file_per_table=1;
SET GLOBAL innodb_large_prefix=1;
Warnings:
Warning 131 Using innodb_large_prefix is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
diff --git a/mysql-test/suite/innodb/r/innodb_skip_innodb_is_tables.result b/mysql-test/suite/innodb/r/innodb_skip_innodb_is_tables.result
index 4875dfaeb2a..f515cb047f1 100644
--- a/mysql-test/suite/innodb/r/innodb_skip_innodb_is_tables.result
+++ b/mysql-test/suite/innodb/r/innodb_skip_innodb_is_tables.result
@@ -216,16 +216,8 @@ compress_pages_decompressed compression 0 NULL NULL NULL 0 NULL NULL NULL NULL N
compression_pad_increments compression 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of times padding is incremented to avoid compression failures
compression_pad_decrements compression 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of times padding is decremented due to good compressibility
compress_saved compression 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of bytes saved by page compression
-compress_trim_sect512 compression 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of sect-512 TRIMed by page compression
-compress_trim_sect1024 compression 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of sect-1024 TRIMed by page compression
-compress_trim_sect2048 compression 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of sect-2048 TRIMed by page compression
-compress_trim_sect4096 compression 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of sect-4K TRIMed by page compression
-compress_trim_sect8192 compression 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of sect-8K TRIMed by page compression
-compress_trim_sect16384 compression 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of sect-16K TRIMed by page compression
-compress_trim_sect32768 compression 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of sect-32K TRIMed by page compression
compress_pages_page_compressed compression 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of pages compressed by page compression
compress_page_compressed_trim_op compression 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of TRIM operation performed by page compression
-compress_page_compressed_trim_op_saved compression 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of TRIM operation saved by page compression
compress_pages_page_decompressed compression 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of pages decompressed by page compression
compress_pages_page_compression_error compression 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of page compression errors
compress_pages_encrypted compression 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of pages encrypted
diff --git a/mysql-test/suite/innodb/r/log_alter_table.result b/mysql-test/suite/innodb/r/log_alter_table.result
new file mode 100644
index 00000000000..f1ee61e7572
--- /dev/null
+++ b/mysql-test/suite/innodb/r/log_alter_table.result
@@ -0,0 +1,16 @@
+#
+# Bug#21801423 INNODB REDO LOG DOES NOT INDICATE WHEN
+# FILES ARE CREATED
+#
+# Bug#21796691 INNODB REDO LOG DOES NOT INDICATE WHEN
+# REDO LOGGING IS SKIPPED
+#
+CREATE TABLE t1 (a INT NOT NULL, b INT UNIQUE) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1,2);
+ALTER TABLE t1 ADD PRIMARY KEY(a), ALGORITHM=INPLACE;
+ALTER TABLE t1 DROP INDEX b, ADD INDEX (b);
+# Kill the server
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+DROP TABLE t1;
diff --git a/mysql-test/suite/innodb/r/log_corruption.result b/mysql-test/suite/innodb/r/log_corruption.result
new file mode 100644
index 00000000000..64a8824189f
--- /dev/null
+++ b/mysql-test/suite/innodb/r/log_corruption.result
@@ -0,0 +1,19 @@
+# redo log from before MySQL 5.7.9
+# redo log from before MySQL 5.7.9, with corrupted log checkpoint
+# redo log from before MySQL 5.7.9, with corrupted log block
+# redo log from "after" MySQL 5.7.9, but with invalid header checksum
+# distant future redo log format, with valid header checksum
+# valid header, but old-format checkpoint blocks
+# valid header, valid checkpoint 1, all-zero (invalid) checkpoint 2, invalid block checksum
+# --innodb-force-recovery=6 (skip the entire redo log)
+# valid header, valid checkpoint 1, all-zero (invalid) checkpoint 2, invalid block number
+# --innodb-force-recovery=6 (skip the entire redo log)
+# Test a corrupted MLOG_FILE_NAME record.
+# valid header, valid checkpoint 1, all-zero (invalid) checkpoint 2
+# Test a corrupted MLOG_FILE_NAME record.
+# valid header, invalid checkpoint 1, valid checkpoint 2
+ib_logfile0
+ib_logfile1
+ibdata1
+my.cnf
+my_restart.err
diff --git a/mysql-test/suite/innodb/r/log_file.result b/mysql-test/suite/innodb/r/log_file.result
new file mode 100644
index 00000000000..a1ebdf037fa
--- /dev/null
+++ b/mysql-test/suite/innodb/r/log_file.result
@@ -0,0 +1,344 @@
+# Testcase for the following bugs
+# Bug#16691130 - ASSERT WHEN INNODB_LOG_GROUP_HOME_DIR DOES NOT EXIST
+# Bug#16418661 - CHANGING NAME IN FOR INNODB_DATA_FILE_PATH SHOULD NOT SUCCEED WITH LOG FILES
+# Write tmp/log_file/my.cnf
+# Start mysqld without the possibility to create innodb_undo_tablespaces
+# Remove undo001,undo002,ibdata1,ibdata2,ib_logfile1,ib_logfile2,ib_logfile101
+my.cnf
+my_restart.err
+# Start mysqld with non existent innodb_log_group_home_dir
+# Remove ibdata1 & ibdata2
+my.cnf
+my_restart.err
+# Start mysqld to create tablespaces according to my.cnf
+# Backup tmp/logfile/*
+# 1. With ibdata2, Without ibdata1
+bak_ib_logfile0
+bak_ib_logfile1
+bak_ib_logfile2
+bak_ibdata1
+bak_ibdata2
+bak_undo001
+bak_undo002
+bak_undo003
+ib_buffer_pool
+ib_logfile0
+ib_logfile1
+ib_logfile2
+ibdata2
+my.cnf
+my_restart.err
+undo001
+undo002
+undo003
+# 2. With ibdata1, without ibdata2
+bak_ib_logfile0
+bak_ib_logfile1
+bak_ib_logfile2
+bak_ibdata1
+bak_ibdata2
+bak_undo001
+bak_undo002
+bak_undo003
+ib_buffer_pool
+ib_logfile0
+ib_logfile1
+ib_logfile2
+ibdata1
+ibdata2
+my.cnf
+my_restart.err
+undo001
+undo002
+undo003
+# 3. Without ibdata1 & ibdata2
+bak_ib_logfile0
+bak_ib_logfile1
+bak_ib_logfile2
+bak_ibdata1
+bak_ibdata2
+bak_undo001
+bak_undo002
+bak_undo003
+ib_buffer_pool
+ib_logfile0
+ib_logfile1
+ib_logfile2
+my.cnf
+my_restart.err
+undo001
+undo002
+undo003
+bak_ib_logfile0
+bak_ib_logfile1
+bak_ib_logfile2
+bak_ibdata1
+bak_ibdata2
+bak_undo001
+bak_undo002
+bak_undo003
+ib_buffer_pool
+ib_logfile0
+ib_logfile1
+ib_logfile2
+my.cnf
+my_restart.err
+undo001
+undo002
+undo003
+# 4. Without ibdata*, ib_logfile* and with undo00*
+bak_ib_logfile0
+bak_ib_logfile1
+bak_ib_logfile2
+bak_ibdata1
+bak_ibdata2
+bak_undo001
+bak_undo002
+bak_undo003
+ib_buffer_pool
+my.cnf
+my_restart.err
+undo001
+undo002
+undo003
+bak_ib_logfile0
+bak_ib_logfile1
+bak_ib_logfile2
+bak_ibdata1
+bak_ibdata2
+bak_undo001
+bak_undo002
+bak_undo003
+ib_buffer_pool
+my.cnf
+my_restart.err
+undo001
+undo002
+undo003
+# 5. Without ibdata*,ib_logfile* files & Without undo002
+bak_ib_logfile0
+bak_ib_logfile1
+bak_ib_logfile2
+bak_ibdata1
+bak_ibdata2
+bak_undo001
+bak_undo002
+bak_undo003
+ib_buffer_pool
+my.cnf
+my_restart.err
+undo001
+undo003
+bak_ib_logfile0
+bak_ib_logfile1
+bak_ib_logfile2
+bak_ibdata1
+bak_ibdata2
+bak_undo001
+bak_undo002
+bak_undo003
+ib_buffer_pool
+my.cnf
+my_restart.err
+undo001
+undo003
+# 6. Without ibdata*,ib_logfile* files & Without undo001, undo002
+bak_ib_logfile0
+bak_ib_logfile1
+bak_ib_logfile2
+bak_ibdata1
+bak_ibdata2
+bak_undo001
+bak_undo002
+bak_undo003
+ib_buffer_pool
+my.cnf
+my_restart.err
+undo003
+bak_ib_logfile0
+bak_ib_logfile1
+bak_ib_logfile2
+bak_ibdata1
+bak_ibdata2
+bak_undo001
+bak_undo002
+bak_undo003
+ib_buffer_pool
+my.cnf
+my_restart.err
+undo003
+# 7. With ibdata files & Without undo002
+bak_ib_logfile0
+bak_ib_logfile1
+bak_ib_logfile2
+bak_ibdata1
+bak_ibdata2
+bak_undo001
+bak_undo002
+bak_undo003
+ib_buffer_pool
+ib_logfile0
+ib_logfile1
+ib_logfile2
+ibdata1
+ibdata2
+my.cnf
+my_restart.err
+undo001
+undo003
+bak_ib_logfile0
+bak_ib_logfile1
+bak_ib_logfile2
+bak_ibdata1
+bak_ibdata2
+bak_undo001
+bak_undo002
+bak_undo003
+ib_buffer_pool
+ib_logfile0
+ib_logfile1
+ib_logfile2
+ibdata1
+ibdata2
+my.cnf
+my_restart.err
+undo001
+undo003
+# 8. With ibdata files & Without undo001, undo002
+bak_ib_logfile0
+bak_ib_logfile1
+bak_ib_logfile2
+bak_ibdata1
+bak_ibdata2
+bak_undo001
+bak_undo002
+bak_undo003
+ib_buffer_pool
+ib_logfile0
+ib_logfile1
+ib_logfile2
+ibdata1
+ibdata2
+my.cnf
+my_restart.err
+undo003
+bak_ib_logfile0
+bak_ib_logfile1
+bak_ib_logfile2
+bak_ibdata1
+bak_ibdata2
+bak_undo001
+bak_undo002
+bak_undo003
+ib_buffer_pool
+ib_logfile0
+ib_logfile1
+ib_logfile2
+ibdata1
+ibdata2
+my.cnf
+my_restart.err
+undo003
+# 9. Without ibdata*, without undo*, Without ib_logfile1 and with ib_logfile2
+bak_ib_logfile0
+bak_ib_logfile1
+bak_ib_logfile2
+bak_ibdata1
+bak_ibdata2
+bak_undo001
+bak_undo002
+bak_undo003
+ib_buffer_pool
+ib_logfile0
+ib_logfile2
+my.cnf
+my_restart.err
+bak_ib_logfile0
+bak_ib_logfile1
+bak_ib_logfile2
+bak_ibdata1
+bak_ibdata2
+bak_undo001
+bak_undo002
+bak_undo003
+ib_buffer_pool
+ib_logfile0
+ib_logfile2
+my.cnf
+my_restart.err
+# 11. With ibdata*, without ib_logfile1
+bak_ib_logfile0
+bak_ib_logfile1
+bak_ib_logfile2
+bak_ibdata1
+bak_ibdata2
+bak_undo001
+bak_undo002
+bak_undo003
+ib_buffer_pool
+ib_logfile0
+ib_logfile2
+ibdata1
+ibdata2
+my.cnf
+my_restart.err
+undo001
+undo002
+undo003
+bak_ib_logfile0
+bak_ib_logfile1
+bak_ib_logfile2
+bak_ibdata1
+bak_ibdata2
+bak_undo001
+bak_undo002
+bak_undo003
+ib_buffer_pool
+ib_logfile0
+ib_logfile2
+ibdata1
+ibdata2
+my.cnf
+my_restart.err
+undo001
+undo002
+undo003
+# 12. With ibdata*, without ib_logfile2
+bak_ib_logfile0
+bak_ib_logfile1
+bak_ib_logfile2
+bak_ibdata1
+bak_ibdata2
+bak_undo001
+bak_undo002
+bak_undo003
+ib_buffer_pool
+ib_logfile0
+ib_logfile1
+ibdata1
+ibdata2
+my.cnf
+my_restart.err
+undo001
+undo002
+undo003
+# Cleanup
+bak_ib_logfile0
+bak_ib_logfile1
+bak_ib_logfile2
+bak_ibdata1
+bak_ibdata2
+bak_undo001
+bak_undo002
+bak_undo003
+ib_buffer_pool
+ib_logfile0
+ib_logfile1
+ib_logfile2
+ibdata1
+ibdata2
+my.cnf
+my_restart.err
+undo001
+undo002
+undo003
diff --git a/mysql-test/suite/innodb/r/log_file_name.result b/mysql-test/suite/innodb/r/log_file_name.result
new file mode 100644
index 00000000000..84107403cf2
--- /dev/null
+++ b/mysql-test/suite/innodb/r/log_file_name.result
@@ -0,0 +1,77 @@
+SET GLOBAL innodb_file_per_table=ON;
+CREATE TABLE t1(a INT PRIMARY KEY) ENGINE=InnoDB;
+CREATE TABLE t3(a INT PRIMARY KEY) ENGINE=InnoDB;
+BEGIN;
+INSERT INTO t3 VALUES (33101),(347);
+INSERT INTO t1 VALUES (42),(9),(101);
+RENAME TABLE t1 TO t2;
+UPDATE t2 SET a=347 where a=42;
+COMMIT;
+# Kill the server
+# Fault 0 (no real fault): Orphan file with duplicate space_id.
+# Fault 1: Two dirty files with the same space_id.
+SELECT * FROM INFORMATION_SCHEMA.ENGINES
+WHERE engine = 'innodb'
+AND support IN ('YES', 'DEFAULT', 'ENABLED');
+ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS
+# Fault 2: Wrong space_id in a dirty file, and a missing file.
+SELECT * FROM INFORMATION_SCHEMA.ENGINES
+WHERE engine = 'innodb'
+AND support IN ('YES', 'DEFAULT', 'ENABLED');
+ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS
+# Fault 3: Wrong space_id in a dirty file, and no missing file.
+SELECT * FROM INFORMATION_SCHEMA.ENGINES
+WHERE engine = 'innodb'
+AND support IN ('YES', 'DEFAULT', 'ENABLED');
+ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS
+# Fault 4: Missing data file
+SELECT * FROM INFORMATION_SCHEMA.ENGINES
+WHERE engine = 'innodb'
+AND support IN ('YES', 'DEFAULT', 'ENABLED');
+ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS
+# Fault 5: Wrong type of data file
+SELECT * FROM INFORMATION_SCHEMA.ENGINES
+WHERE engine = 'innodb'
+AND support IN ('YES', 'DEFAULT', 'ENABLED');
+ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS
+SELECT * FROM t2;
+a
+9
+101
+347
+SELECT * FROM t3;
+a
+347
+33101
+SHOW TABLES;
+Tables_in_test
+t2
+t3
+DROP TABLE t2,t3;
+CREATE TABLE t0(a INT PRIMARY KEY) ENGINE=InnoDB;
+ERROR HY000: Tablespace for table '`test`.`t0`' exists. Please DISCARD the tablespace before IMPORT
+CREATE TABLE t0(a INT PRIMARY KEY) ENGINE=InnoDB;
+DROP TABLE t0;
+CREATE TABLE u1(a INT PRIMARY KEY) ENGINE=InnoDB;
+CREATE TABLE u2(a INT PRIMARY KEY) ENGINE=InnoDB;
+CREATE TABLE u3(a INT PRIMARY KEY) ENGINE=InnoDB;
+CREATE TABLE u4(a INT PRIMARY KEY) ENGINE=InnoDB;
+INSERT INTO u4 VALUES(1);
+RENAME TABLE u4 TO u5;
+RENAME TABLE u5 TO u6;
+INSERT INTO u6 VALUES(2);
+# Kill the server
+# Fault 6: All-zero data file and innodb_force_recovery
+SELECT * FROM INFORMATION_SCHEMA.ENGINES
+WHERE engine = 'innodb'
+AND support IN ('YES', 'DEFAULT', 'ENABLED');
+ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS
+# Fault 7: Missing or wrong data file and innodb_force_recovery
+SELECT * FROM INFORMATION_SCHEMA.ENGINES
+WHERE engine = 'innodb'
+AND support IN ('YES', 'DEFAULT', 'ENABLED');
+ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS
+DROP TABLE u1,u2,u3,u6;
+# List of files:
+SHOW TABLES;
+Tables_in_test
diff --git a/mysql-test/suite/innodb/r/log_file_name_debug.result b/mysql-test/suite/innodb/r/log_file_name_debug.result
new file mode 100644
index 00000000000..e82feef870c
--- /dev/null
+++ b/mysql-test/suite/innodb/r/log_file_name_debug.result
@@ -0,0 +1,8 @@
+#
+# Bug#19685095 DO NOT CARE ABOUT UNRESOLVED MLOG_FILE_NAME
+# IF THERE ARE NO OPERATIONS TO APPLY
+#
+SET GLOBAL DEBUG_DBUG='+d,fil_names_write_bogus';
+CREATE TABLE t1(a INT PRIMARY KEY) ENGINE=InnoDB;
+# Kill the server
+DROP TABLE t1;
diff --git a/mysql-test/suite/innodb/r/log_file_size.result b/mysql-test/suite/innodb/r/log_file_size.result
new file mode 100644
index 00000000000..b73862af7c4
--- /dev/null
+++ b/mysql-test/suite/innodb/r/log_file_size.result
@@ -0,0 +1,54 @@
+CREATE TABLE t1(a INT PRIMARY KEY) ENGINE=InnoDB;
+BEGIN;
+INSERT INTO t1 VALUES (42);
+# Kill and restart: --innodb-log-file-size=6M
+SELECT * FROM t1;
+a
+INSERT INTO t1 VALUES (42);
+BEGIN;
+DELETE FROM t1;
+# Kill and restart: --innodb-log-files-in-group=3 --innodb-log-file-size=5M
+SELECT * FROM t1;
+a
+42
+INSERT INTO t1 VALUES (123);
+BEGIN;
+DELETE FROM t1;
+# Kill the server
+SELECT * FROM t1;
+ERROR 42000: Unknown storage engine 'InnoDB'
+SELECT * FROM t1;
+ERROR 42000: Unknown storage engine 'InnoDB'
+SELECT * FROM t1;
+ERROR 42000: Unknown storage engine 'InnoDB'
+SELECT * FROM t1;
+ERROR 42000: Unknown storage engine 'InnoDB'
+SELECT * FROM t1;
+ERROR 42000: Unknown storage engine 'InnoDB'
+SELECT * FROM t1;
+ERROR 42000: Unknown storage engine 'InnoDB'
+SELECT * FROM t1;
+ERROR 42000: Unknown storage engine 'InnoDB'
+SELECT * FROM t1;
+ERROR 42000: Unknown storage engine 'InnoDB'
+SELECT * FROM t1;
+ERROR 42000: Unknown storage engine 'InnoDB'
+SELECT * FROM t1;
+ERROR 42000: Unknown storage engine 'InnoDB'
+SELECT * FROM t1;
+ERROR 42000: Unknown storage engine 'InnoDB'
+SELECT * FROM t1;
+ERROR 42000: Unknown storage engine 'InnoDB'
+SELECT * FROM t1;
+ERROR 42000: Unknown storage engine 'InnoDB'
+SELECT * FROM t1;
+ERROR 42000: Unknown storage engine 'InnoDB'
+SELECT * FROM t1;
+ERROR 42000: Unknown storage engine 'InnoDB'
+SELECT * FROM t1;
+ERROR 42000: Unknown storage engine 'InnoDB'
+SELECT * FROM t1;
+a
+42
+123
+DROP TABLE t1;
diff --git a/mysql-test/suite/innodb/r/log_file_size_checkpoint.result b/mysql-test/suite/innodb/r/log_file_size_checkpoint.result
new file mode 100644
index 00000000000..068b1368e1e
--- /dev/null
+++ b/mysql-test/suite/innodb/r/log_file_size_checkpoint.result
@@ -0,0 +1,4 @@
+CREATE DATABASE logtest;
+USE logtest;
+# Kill and restart: --innodb-log-files-in-group=2 --innodb-log-file-size=4M --innodb-buffer-pool-size=50M
+DROP DATABASE logtest;
diff --git a/mysql-test/suite/innodb_zip/r/wl6470_1.result b/mysql-test/suite/innodb/r/temp_table.result
index ea1866d69eb..e90da0d5e77 100644
--- a/mysql-test/suite/innodb_zip/r/wl6470_1.result
+++ b/mysql-test/suite/innodb/r/temp_table.result
@@ -194,18 +194,22 @@ count(*)
drop procedure populate_t1;
drop procedure populate_t1_small;
drop procedure populate_t1_small2;
-drop table t1;
-drop table t2;
+drop temporary table t1,t2;
create temporary table t1
(keyc int, c1 char(100), c2 char(100),
primary key(keyc), index sec_index(c1)
) engine = innodb key_block_size = 4;
+ERROR HY000: CREATE TEMPORARY TABLE is not allowed with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE.
+create temporary table t1
+(keyc int, c1 char(100), c2 char(100),
+primary key(keyc), index sec_index(c1)
+) engine = innodb;
set innodb_strict_mode=off;
create temporary table t2
(keyc int, c1 char(100), c2 char(100),
primary key(keyc), index sec_index(c1)
) engine = innodb key_block_size = 8;
-set innodb_strict_mode=default;
+set innodb_strict_mode=on;
create procedure populate_t1()
begin
declare i int default 1;
@@ -394,9 +398,7 @@ count(*)
drop procedure populate_t1;
drop procedure populate_t1_small;
drop procedure populate_t1_small2;
-drop table t1;
-drop table t2;
-set global innodb_file_per_table = 0;
+drop temporary table t1, t2;
create temporary table t1
(keyc int, c1 char(100), c2 char(100),
primary key(keyc), index sec_index(c1)
@@ -593,6 +595,3 @@ count(*)
drop procedure populate_t1;
drop procedure populate_t1_small;
drop procedure populate_t1_small2;
-drop table t1;
-drop table t2;
-set global innodb_file_per_table = 1;
diff --git a/mysql-test/suite/innodb_zip/r/wl6470_2.result b/mysql-test/suite/innodb/r/temp_table_savepoint.result
index b001cd73882..d61eef404da 100644
--- a/mysql-test/suite/innodb_zip/r/wl6470_2.result
+++ b/mysql-test/suite/innodb/r/temp_table_savepoint.result
@@ -2,8 +2,6 @@ create procedure populate_tables()
begin
declare n int default 20;
declare inner_loop int default 100;
-set global innodb_file_per_table=on;
-drop table if exists t1,t2,t3,t4;
create temporary table t1(c1 int not null,
c2 int not null,
c3 char(255) not null,
@@ -14,7 +12,7 @@ c7 varchar(2000) not null,
c8 datetime,
c9 decimal(6,3),
primary key (c1),
-index (c3,c4(50),c5(50)),
+index (c3,c4(50),c5(50)),
index (c2))
engine=innodb row_format=redundant;
create temporary table t2(c1 int not null,
@@ -30,19 +28,6 @@ primary key (c1),
index (c3,c4(50),c5(50)),
index (c2))
engine=innodb row_format=compact;
-create temporary table t3(c1 int not null,
-c2 int not null,
-c3 char(255) not null,
-c4 text(6000) not null,
-c5 blob(6000) not null,
-c6 varchar(2000) not null,
-c7 varchar(2000) not null,
-c8 datetime,
-c9 decimal(6,3),
-primary key (c1),
-index (c3,c4(50),c5(50)),
-index (c2))
-engine=innodb row_format=compressed key_block_size=4;
create temporary table t4(c1 int not null,
c2 int not null,
c3 char(255) not null,
@@ -74,16 +59,12 @@ insert into t6 values (50),(100),(150),(190);
while (n > 0) do
start transaction;
insert into t1 values(n,n,repeat(concat(' tc3_',n),30),
-repeat(concat(' tc4_',n),800),repeat(concat(' tc_',n),800),
-repeat(concat(' tc6_',n),800),repeat(concat(' tc7_',n),800),
+repeat(concat(' tc4_',n),8),repeat(concat(' tc_',n),8),
+repeat(concat(' tc6_',n),8),repeat(concat(' tc7_',n),8),
now(),(100.55+n));
insert into t2 values(n,n,repeat(concat(' tc3_',n),30),
-repeat(concat(' tc4_',n),800),repeat(concat(' tc_',n),800),
-repeat(concat(' tc6_',n),800),repeat(concat(' tc7_',n),800),
-now(),(100.55+n));
-insert into t3 values(n,n,repeat(concat(' tc3_',n),30),
-repeat(concat(' tc4_',n),800),repeat(concat(' tc_',n),800),
-repeat(concat(' tc6_',n),800),repeat(concat(' tc7_',n),800),
+repeat(concat(' tc4_',n),8),repeat(concat(' tc_',n),8),
+repeat(concat(' tc6_',n),8),repeat(concat(' tc7_',n),8),
now(),(100.55+n));
insert into t4 values(n,n,repeat(concat(' tc3_',n),30),
repeat(concat(' tc4_',n),800),repeat(concat(' tc_',n),800),
@@ -95,33 +76,27 @@ repeat(concat(' tc6_',n),800),repeat(concat(' tc7_',n),800),
now(),(100.55+n));
if (n > 10) then
commit;
-else
+else
delete from t1 where c1 > 10 ;
delete from t2 where c1 > 10 ;
-delete from t3 where c1 > 10 ;
delete from t4 where c1 > 10 ;
delete from t5 where c1 > 10 ;
rollback;
start transaction;
update t1 set c1 = c1 + 1000 where c1 > 10;
update t2 set c1 = c1 + 1000 where c1 > 10;
-update t3 set c1 = c1 + 1000 where c1 > 10;
update t4 set c1 = c1 + 1000 where c1 > 10;
update t5 set c1 = c1 + 1000 where c1 > 10;
rollback;
-end if;
+end if;
start transaction;
insert into t1 values(n+inner_loop,n+inner_loop,repeat(concat(' tc3_',n+inner_loop),30),
-repeat(concat(' tc4_',n+inner_loop),800),repeat(concat(' tc_',n+inner_loop),800),
-repeat(concat(' tc6_',n+inner_loop),245),repeat(concat(' tc7_',n+inner_loop),245),
+repeat(concat(' tc4_',n+inner_loop),8),repeat(concat(' tc_',n+inner_loop),8),
+repeat(concat(' tc6_',n+inner_loop),2),repeat(concat(' tc7_',n+inner_loop),2),
now(),(100.55+n+inner_loop));
insert into t2 values(n+inner_loop,n+inner_loop,repeat(concat(' tc3_',n+inner_loop),30),
-repeat(concat(' tc4_',n+inner_loop),800),repeat(concat(' tc_',n+inner_loop),800),
-repeat(concat(' tc6_',n+inner_loop),245),repeat(concat(' tc7_',n+inner_loop),245),
-now(),(100.55+n+inner_loop));
-insert into t3 values(n+inner_loop,n+inner_loop,repeat(concat(' tc3_',n+inner_loop),30),
-repeat(concat(' tc4_',n+inner_loop),800),repeat(concat(' tc_',n+inner_loop),800),
-repeat(concat(' tc6_',n+inner_loop),245),repeat(concat(' tc7_',n+inner_loop),245),
+repeat(concat(' tc4_',n+inner_loop),8),repeat(concat(' tc_',n+inner_loop),8),
+repeat(concat(' tc6_',n+inner_loop),2),repeat(concat(' tc7_',n+inner_loop),2),
now(),(100.55+n+inner_loop));
insert into t4 values(n+inner_loop,n+inner_loop,repeat(concat(' tc3_',n+inner_loop),30),
repeat(concat(' tc4_',n+inner_loop),800),repeat(concat(' tc_',n+inner_loop),800),
@@ -133,26 +108,20 @@ repeat(concat(' tc6_',n+inner_loop),245),repeat(concat(' tc7_',n+inner_loop),245
now(),(100.55+n+inner_loop));
delete from t1 where c1 between 100 and 110;
delete from t2 where c1 between 100 and 110;
-delete from t3 where c1 between 100 and 110;
delete from t4 where c1 between 100 and 110;
delete from t5 where c1 between 100 and 110;
-update t1 set c1 = c1+1 where c1>110;
-update t2 set c1 = c1+1 where c1>110;
-update t3 set c1 = c1+1 where c1>110;
-update t4 set c1 = c1+1 where c1>110;
-update t5 set c1 = c1+1 where c1>110;
+update t1 set c1 = c1+1 where c1>110;
+update t2 set c1 = c1+1 where c1>110;
+update t4 set c1 = c1+1 where c1>110;
+update t5 set c1 = c1+1 where c1>110;
savepoint a;
insert into t1 values(300+n+inner_loop,n+inner_loop,repeat(concat(' tc3_',n+inner_loop),30),
-repeat(concat(' tc4_',n+inner_loop),800),repeat(concat(' tc_',n+inner_loop),800),
-repeat(concat(' tc6_',n+inner_loop),245),repeat(concat(' tc7_',n+inner_loop),245),
+repeat(concat(' tc4_',n+inner_loop),8),repeat(concat(' tc_',n+inner_loop),8),
+repeat(concat(' tc6_',n+inner_loop),2),repeat(concat(' tc7_',n+inner_loop),2),
now(),(100.55+n+inner_loop));
insert into t2 values(300+n+inner_loop,n+inner_loop,repeat(concat(' tc3_',n+inner_loop),30),
-repeat(concat(' tc4_',n+inner_loop),800),repeat(concat(' tc_',n+inner_loop),800),
-repeat(concat(' tc6_',n+inner_loop),245),repeat(concat(' tc7_',n+inner_loop),245),
-now(),(100.55+n+inner_loop));
-insert into t3 values(300+n+inner_loop,n+inner_loop,repeat(concat(' tc3_',n+inner_loop),30),
-repeat(concat(' tc4_',n+inner_loop),800),repeat(concat(' tc_',n+inner_loop),800),
-repeat(concat(' tc6_',n+inner_loop),245),repeat(concat(' tc7_',n+inner_loop),245),
+repeat(concat(' tc4_',n+inner_loop),8),repeat(concat(' tc_',n+inner_loop),8),
+repeat(concat(' tc6_',n+inner_loop),2),repeat(concat(' tc7_',n+inner_loop),2),
now(),(100.55+n+inner_loop));
insert into t4 values(300+n+inner_loop,n+inner_loop,repeat(concat(' tc3_',n+inner_loop),30),
repeat(concat(' tc4_',n+inner_loop),800),repeat(concat(' tc_',n+inner_loop),800),
@@ -164,16 +133,12 @@ repeat(concat(' tc6_',n+inner_loop),245),repeat(concat(' tc7_',n+inner_loop),245
now(),(100.55+n+inner_loop));
savepoint b;
insert into t1 values(400+n+inner_loop,n+inner_loop,repeat(concat(' tc3_',n+inner_loop),30),
-repeat(concat(' tc4_',n+inner_loop),800),repeat(concat(' tc_',n+inner_loop),800),
-repeat(concat(' tc6_',n+inner_loop),245),repeat(concat(' tc7_',n+inner_loop),245),
+repeat(concat(' tc4_',n+inner_loop),8),repeat(concat(' tc_',n+inner_loop),8),
+repeat(concat(' tc6_',n+inner_loop),2),repeat(concat(' tc7_',n+inner_loop),2),
now(),(100.55+n+inner_loop));
insert into t2 values(400+n+inner_loop,n+inner_loop,repeat(concat(' tc3_',n+inner_loop),30),
-repeat(concat(' tc4_',n+inner_loop),800),repeat(concat(' tc_',n+inner_loop),800),
-repeat(concat(' tc6_',n+inner_loop),245),repeat(concat(' tc7_',n+inner_loop),245),
-now(),(100.55+n+inner_loop));
-insert into t3 values(400+n+inner_loop,n+inner_loop,repeat(concat(' tc3_',n+inner_loop),30),
-repeat(concat(' tc4_',n+inner_loop),800),repeat(concat(' tc_',n+inner_loop),800),
-repeat(concat(' tc6_',n+inner_loop),245),repeat(concat(' tc7_',n+inner_loop),245),
+repeat(concat(' tc4_',n+inner_loop),8),repeat(concat(' tc_',n+inner_loop),8),
+repeat(concat(' tc6_',n+inner_loop),2),repeat(concat(' tc7_',n+inner_loop),2),
now(),(100.55+n+inner_loop));
insert into t4 values(400+n+inner_loop,n+inner_loop,repeat(concat(' tc3_',n+inner_loop),30),
repeat(concat(' tc4_',n+inner_loop),800),repeat(concat(' tc_',n+inner_loop),800),
@@ -189,16 +154,13 @@ rollback to a;
commit;
commit;
rollback;
-set n = n - 1;
+set n = n - 1;
end while;
end|
connect con1,localhost,root,,;
+call populate_tables();;
connect con2,localhost,root,,;
-#---client 1 : dml operation ---"
-connection con1;
-#---client 2 : dml operation ---"
-connection con2;
-# In connection 1
+call populate_tables();;
connection con1;
select count(*) from t1;
count(*)
@@ -206,9 +168,6 @@ count(*)
select count(*) from t2;
count(*)
20
-select count(*) from t3;
-count(*)
-20
select count(*) from t4;
count(*)
20
@@ -259,28 +218,6 @@ c1
136
138
140
-select c1 from t3;
-c1
-11
-12
-13
-14
-15
-16
-17
-18
-19
-20
-122
-124
-126
-128
-130
-132
-134
-136
-138
-140
select c1 from t4;
c1
11
@@ -325,7 +262,6 @@ c1
136
138
140
-# In connection 2
connection con2;
select count(*) from t1;
count(*)
@@ -333,9 +269,6 @@ count(*)
select count(*) from t2;
count(*)
20
-select count(*) from t3;
-count(*)
-20
select count(*) from t4;
count(*)
20
@@ -386,28 +319,6 @@ c1
136
138
140
-select c1 from t3;
-c1
-11
-12
-13
-14
-15
-16
-17
-18
-19
-20
-122
-124
-126
-128
-130
-132
-134
-136
-138
-140
select c1 from t4;
c1
11
@@ -452,7 +363,6 @@ c1
136
138
140
-# In connection 1
connection con1;
set autocommit = 0;
insert into t1 values (20,1,'a','a','a','a','a',now(),100.55);
@@ -465,11 +375,6 @@ ERROR 23000: Duplicate entry '20' for key 'PRIMARY'
insert ignore into t2 values (20,1,'a','a','a','a','a',now(),100.55);
Warnings:
Warning 1062 Duplicate entry '20' for key 'PRIMARY'
-insert into t3 values (20,1,'a','a','a','a','a',now(),100.55);
-ERROR 23000: Duplicate entry '20' for key 'PRIMARY'
-insert ignore into t3 values (20,1,'a','a','a','a','a',now(),100.55);
-Warnings:
-Warning 1062 Duplicate entry '20' for key 'PRIMARY'
insert into t4 values (20,1,'a','a','a','a','a',now(),100.55);
ERROR 23000: Duplicate entry '20' for key 'PRIMARY'
insert ignore into t4 values (20,1,'a','a','a','a','a',now(),100.55);
@@ -486,9 +391,6 @@ ERROR 23000: Duplicate entry '20' for key 'PRIMARY'
insert into t2 values (1,1,'a','a','a','a','a',now(),100.55),
(20,1,'a','a','a','a','a',now(),100.55);
ERROR 23000: Duplicate entry '20' for key 'PRIMARY'
-insert into t3 values (1,1,'a','a','a','a','a',now(),100.55),
-(20,1,'a','a','a','a','a',now(),100.55);
-ERROR 23000: Duplicate entry '20' for key 'PRIMARY'
insert into t4 values (1,1,'a','a','a','a','a',now(),100.55),
(20,1,'a','a','a','a','a',now(),100.55);
ERROR 23000: Duplicate entry '20' for key 'PRIMARY'
@@ -502,9 +404,6 @@ c1 c2
select c1,c2 from t2 where c1 in (20,1);
c1 c2
20 20
-select c1,c2 from t3 where c1 in (20,1);
-c1 c2
-20 20
select c1,c2 from t4 where c1 in (20,1);
c1 c2
20 20
@@ -513,7 +412,6 @@ c1 c2
20 20
replace into t1 values (20,1,'a','a','a','a','a',now(),100.55);
replace into t2 values (20,1,'a','a','a','a','a',now(),100.55);
-replace into t3 values (20,1,'a','a','a','a','a',now(),100.55);
replace into t4 values (20,1,'a','a','a','a','a',now(),100.55);
replace into t5 values (20,1,'a','a','a','a','a',now(),100.55);
select c1,c2,c3,c4,c5,c6,c7,c9 from t1 where c1 = 20;
@@ -522,9 +420,6 @@ c1 c2 c3 c4 c5 c6 c7 c9
select c1,c2,c3,c4,c5,c6,c7,c9 from t2 where c1 = 20;
c1 c2 c3 c4 c5 c6 c7 c9
20 1 a a a a a 100.550
-select c1,c2,c3,c4,c5,c6,c7,c9 from t3 where c1 = 20;
-c1 c2 c3 c4 c5 c6 c7 c9
-20 1 a a a a a 100.550
select c1,c2,c3,c4,c5,c6,c7,c9 from t4 where c1 = 20;
c1 c2 c3 c4 c5 c6 c7 c9
20 1 a a a a a 100.550
@@ -533,7 +428,6 @@ c1 c2 c3 c4 c5 c6 c7 c9
20 1 a a a a a 100.550
update ignore t1 set c1 = 20 where c1 = 140 ;
update ignore t2 set c1 = 20 where c1 = 140 ;
-update ignore t3 set c1 = 20 where c1 = 140 ;
update ignore t4 set c1 = 20 where c1 = 140 ;
update ignore t5 set c1 = 20 where c1 = 140 ;
select count(*) from t1 where c1 = 140;
@@ -542,25 +436,22 @@ count(*)
select count(*) from t2 where c1 = 140;
count(*)
1
-select count(*) from t3 where c1 = 140;
-count(*)
-1
select count(*) from t4 where c1 = 140;
count(*)
1
select count(*) from t5 where c1 = 140;
count(*)
1
-"running select * into outfile <file> from t1 ;
+select * into outfile "VARDIR/tmp/t1.outfile" from t1;
create temporary table temp_1 engine = innodb as select * from t1 where 1=2;
select count(*) from temp_1;
count(*)
0
-"running load data infile <file> into temp_1 ;
+load data infile 'VARDIR/tmp/t1.outfile' into table temp_1;
select count(*) from temp_1;
count(*)
20
-alter table temp_1 add column c10 int default 99 ,
+alter table temp_1 add column c10 int default 99 ,
add column c11 varchar(100) default 'test';
alter table temp_1 add primary key (c1);
insert into temp_1 (c1,c2,c3,c4,c5,c6,c7,c8,c9) values (-1,-1,'a','a','a','a','a',now(),100.55);
@@ -570,15 +461,12 @@ c1 c2 c3 c4 c5 c6 c7 c9 c10 c11
select count(*) from temp_1 where c10 = 99 and c11 like 'test';
count(*)
21
-insert into temp_1 (c1,c2,c3,c4,c5,c6,c7,c8,c9) values (-1,-1,'a','a','a','a','a',now(),100.55)
+insert into temp_1 (c1,c2,c3,c4,c5,c6,c7,c8,c9) values (-1,-1,'a','a','a','a','a',now(),100.55)
on duplicate key update c1=-2,c2=-2;
select c1,c2,c3,c4,c5,c6,c7,c9,c10,c11 from temp_1 where c1 < 0;
c1 c2 c3 c4 c5 c6 c7 c9 c10 c11
-2 -2 a a a a a 100.550 99 test
-drop table t1 ,t2 ,t3,t4,t5,t6,temp_1;
disconnect con1;
-connection con2;
-drop table t1 ,t2 ,t3,t4,t5,t6;
disconnect con2;
connection default;
drop procedure populate_tables;
@@ -664,4 +552,3 @@ count(*)
drop prepare stm;
drop prepare stm_1;
drop prepare stm_2;
-drop table prep_1;
diff --git a/mysql-test/suite/innodb/r/temporary_table.result b/mysql-test/suite/innodb/r/temporary_table.result
new file mode 100644
index 00000000000..1fb73f4e775
--- /dev/null
+++ b/mysql-test/suite/innodb/r/temporary_table.result
@@ -0,0 +1,639 @@
+# files in MYSQL_DATA_DIR
+ibtmp1
+create temporary table t1 (i int, f float, c char(100)) engine=innodb;
+insert into t1 values (100, 1.1, 'pune');
+insert into t1 values (99, 1.2, 'mumbai');
+insert into t1 values (98, 1.3, 'jaipur');
+insert into t1 values (97, 1.4, 'delhi');
+insert into t1 values (96, 1.5, 'ahmedabad');
+select * from t1;
+i f c
+100 1.1 pune
+99 1.2 mumbai
+98 1.3 jaipur
+97 1.4 delhi
+96 1.5 ahmedabad
+select * from t1 where i = 98;
+i f c
+98 1.3 jaipur
+select * from t1 where i < 100;
+i f c
+99 1.2 mumbai
+98 1.3 jaipur
+97 1.4 delhi
+96 1.5 ahmedabad
+explain select * from t1 where f > 1.29999;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using where
+alter table t1 add index sec_index(f);
+explain select * from t1 where f > 1.29999;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL sec_index NULL NULL NULL 5 Using where
+select * from t1 where f > 1.29999;
+i f c
+98 1.3 jaipur
+97 1.4 delhi
+96 1.5 ahmedabad
+explain select * from t1 where i = 100;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using where
+alter table t1 add unique index pri_index(i);
+explain select * from t1 where i = 100;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 const pri_index pri_index 5 const 1
+select * from t1 where i = 100;
+i f c
+100 1.1 pune
+delete from t1 where i < 97;
+select * from t1;
+i f c
+100 1.1 pune
+99 1.2 mumbai
+98 1.3 jaipur
+97 1.4 delhi
+insert into t1 values (96, 1.5, 'kolkata');
+select * from t1;
+i f c
+100 1.1 pune
+99 1.2 mumbai
+98 1.3 jaipur
+97 1.4 delhi
+96 1.5 kolkata
+update t1 set f = 1.44 where c = 'delhi';
+select * from t1;
+i f c
+100 1.1 pune
+99 1.2 mumbai
+98 1.3 jaipur
+97 1.44 delhi
+96 1.5 kolkata
+truncate table t1;
+insert into t1 values (100, 1.1, 'pune');
+insert into t1 values (99, 1.2, 'mumbai');
+insert into t1 values (98, 1.3, 'jaipur');
+insert into t1 values (97, 1.4, 'delhi');
+insert into t1 values (96, 1.5, 'ahmedabad');
+select * from t1;
+i f c
+100 1.1 pune
+99 1.2 mumbai
+98 1.3 jaipur
+97 1.4 delhi
+96 1.5 ahmedabad
+alter table t1 discard tablespace;
+ERROR HY000: Cannot DISCARD/IMPORT tablespace associated with temporary table
+alter table t1 import tablespace;
+ERROR HY000: Cannot DISCARD/IMPORT tablespace associated with temporary table
+drop temporary table t1;
+create temporary table t1
+(keyc int, c1 char(100), c2 char(100),
+primary key(keyc)) engine = innodb;
+CREATE PROCEDURE populate_t1()
+BEGIN
+DECLARE i INT DEFAULT 1;
+while (i <= 20000) DO
+insert into t1 values (i, 'a', 'b');
+SET i = i + 1;
+END WHILE;
+END|
+set autocommit=0;
+select count(*) from t1;
+count(*)
+0
+call populate_t1();
+select count(*) from t1;
+count(*)
+20000
+select * from t1 limit 10;
+keyc c1 c2
+1 a b
+2 a b
+3 a b
+4 a b
+5 a b
+6 a b
+7 a b
+8 a b
+9 a b
+10 a b
+set autocommit=1;
+truncate table t1;
+select * from t1;
+keyc c1 c2
+# test condition of full-temp-tablespace
+create temporary table t1
+(keyc int, c1 char(100), c2 char(100),
+primary key(keyc)) engine = innodb;
+begin;
+call populate_t1();
+ERROR HY000: The table 't1' is full
+drop procedure populate_t1;
+# test read-only mode
+# files in MYSQL_DATA_DIR
+ibtmp1
+select * from t1;
+ERROR 42S02: Table 'test.t1' doesn't exist
+show tables;
+Tables_in_test
+create temporary table t1 (keyc int, c1 char(100), c2 char(100)) engine = innodb;
+ERROR HY000: Can't create table `test`.`t1` (errno: 165 "Table is read only")
+# test various bad start-up parameters
+SELECT * FROM INFORMATION_SCHEMA.ENGINES WHERE engine = 'innodb'
+AND support IN ('YES', 'DEFAULT', 'ENABLED');
+ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS
+SELECT * FROM INFORMATION_SCHEMA.ENGINES WHERE engine = 'innodb'
+AND support IN ('YES', 'DEFAULT', 'ENABLED');
+ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS
+SELECT * FROM INFORMATION_SCHEMA.ENGINES WHERE engine = 'innodb'
+AND support IN ('YES', 'DEFAULT', 'ENABLED');
+ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS
+SELECT * FROM INFORMATION_SCHEMA.ENGINES WHERE engine = 'innodb'
+AND support IN ('YES', 'DEFAULT', 'ENABLED');
+ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS
+SELECT * FROM INFORMATION_SCHEMA.ENGINES WHERE engine = 'innodb'
+AND support IN ('YES', 'DEFAULT', 'ENABLED');
+ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS
+create temporary table t (
+i int)
+engine = innodb row_format = compressed;
+ERROR HY000: CREATE TEMPORARY TABLE is not allowed with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE.
+create temporary table t (
+i int)
+engine = innodb row_format = compressed key_block_size = 8;
+ERROR HY000: CREATE TEMPORARY TABLE is not allowed with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE.
+create temporary table t (
+i int)
+engine = innodb row_format = dynamic;
+show warnings;
+Level Code Message
+drop table t;
+create temporary table t (
+i int)
+engine = innodb row_format = dynamic;
+show warnings;
+Level Code Message
+drop table t;
+set innodb_strict_mode = off;
+create temporary table t (
+i int)
+engine = innodb row_format = compressed key_block_size = 8;
+Warnings:
+Warning 1478 InnoDB: KEY_BLOCK_SIZE is ignored for TEMPORARY TABLE.
+Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=8.
+Warning 1478 InnoDB: ROW_FORMAT=COMPRESSED is ignored for TEMPORARY TABLE.
+Warning 1478 InnoDB: assuming ROW_FORMAT=DYNAMIC.
+show warnings;
+Level Code Message
+Warning 1478 InnoDB: KEY_BLOCK_SIZE is ignored for TEMPORARY TABLE.
+Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=8.
+Warning 1478 InnoDB: ROW_FORMAT=COMPRESSED is ignored for TEMPORARY TABLE.
+Warning 1478 InnoDB: assuming ROW_FORMAT=DYNAMIC.
+set innodb_strict_mode = default;
+drop table t;
+create temporary table t (
+i int)
+engine = innodb row_format = compressed;
+ERROR HY000: CREATE TEMPORARY TABLE is not allowed with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE.
+#files in MYSQL_TMP_DIR, expecting only default temporary tablespace file
+ibtmp1
+create temporary table t (
+i int)
+engine = innodb row_format = dynamic;
+show warnings;
+Level Code Message
+drop table t;
+create temporary table t (
+i int)
+engine = innodb row_format = dynamic;
+show warnings;
+Level Code Message
+drop table t;
+set innodb_strict_mode = off;
+create temporary table t (
+i int)
+engine = innodb row_format = dynamic key_block_size = 4;
+Warnings:
+Warning 1478 InnoDB: KEY_BLOCK_SIZE is ignored for TEMPORARY TABLE.
+Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=4.
+show warnings;
+Level Code Message
+Warning 1478 InnoDB: KEY_BLOCK_SIZE is ignored for TEMPORARY TABLE.
+Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=4.
+drop table t;
+create temporary table t (
+i int)
+engine = innodb row_format = compact;
+show warnings;
+Level Code Message
+drop table t;
+create temporary table t (
+i int)
+engine = innodb key_block_size = 4;
+Warnings:
+Warning 1478 InnoDB: KEY_BLOCK_SIZE is ignored for TEMPORARY TABLE.
+Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=4.
+show warnings;
+Level Code Message
+Warning 1478 InnoDB: KEY_BLOCK_SIZE is ignored for TEMPORARY TABLE.
+Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=4.
+drop table t;
+CREATE TEMPORARY TABLE t1 (
+i INT NOT NULL PRIMARY KEY,
+c CHAR(10) NOT NULL
+) ENGINE = InnoDB KEY_BLOCK_SIZE = 4;
+Warnings:
+Warning 1478 InnoDB: KEY_BLOCK_SIZE is ignored for TEMPORARY TABLE.
+Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=4.
+SHOW WARNINGS;
+Level Code Message
+Warning 1478 InnoDB: KEY_BLOCK_SIZE is ignored for TEMPORARY TABLE.
+Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=4.
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TEMPORARY TABLE `t1` (
+ `i` int(11) NOT NULL,
+ `c` char(10) NOT NULL,
+ PRIMARY KEY (`i`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 KEY_BLOCK_SIZE=4
+DROP TABLE t1;
+CREATE TEMPORARY TABLE t1 (
+i INT NOT NULL PRIMARY KEY,
+c CHAR(10) NOT NULL
+) ENGINE = InnoDB ROW_FORMAT = REDUNDANT;
+SHOW WARNINGS;
+Level Code Message
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TEMPORARY TABLE `t1` (
+ `i` int(11) NOT NULL,
+ `c` char(10) NOT NULL,
+ PRIMARY KEY (`i`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=REDUNDANT
+DROP TABLE t1;
+CREATE TEMPORARY TABLE t1 (
+i INT NOT NULL PRIMARY KEY,
+c CHAR(10) NOT NULL
+) ENGINE = InnoDB ROW_FORMAT = COMPACT;
+SHOW WARNINGS;
+Level Code Message
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TEMPORARY TABLE `t1` (
+ `i` int(11) NOT NULL,
+ `c` char(10) NOT NULL,
+ PRIMARY KEY (`i`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT
+DROP TABLE t1;
+CREATE TEMPORARY TABLE t1 (
+i INT NOT NULL PRIMARY KEY,
+c CHAR(10) NOT NULL
+) ENGINE = InnoDB KEY_BLOCK_SIZE = 4;
+Warnings:
+Warning 1478 InnoDB: KEY_BLOCK_SIZE is ignored for TEMPORARY TABLE.
+Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=4.
+SHOW WARNINGS;
+Level Code Message
+Warning 1478 InnoDB: KEY_BLOCK_SIZE is ignored for TEMPORARY TABLE.
+Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=4.
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TEMPORARY TABLE `t1` (
+ `i` int(11) NOT NULL,
+ `c` char(10) NOT NULL,
+ PRIMARY KEY (`i`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 KEY_BLOCK_SIZE=4
+DROP TABLE t1;
+CREATE TEMPORARY TABLE t1 (
+i INT NOT NULL PRIMARY KEY,
+c CHAR(10) NOT NULL
+) ENGINE = InnoDB ROW_FORMAT = COMPRESSED;
+Warnings:
+Warning 1478 InnoDB: ROW_FORMAT=COMPRESSED is ignored for TEMPORARY TABLE.
+Warning 1478 InnoDB: assuming ROW_FORMAT=DYNAMIC.
+SHOW WARNINGS;
+Level Code Message
+Warning 1478 InnoDB: ROW_FORMAT=COMPRESSED is ignored for TEMPORARY TABLE.
+Warning 1478 InnoDB: assuming ROW_FORMAT=DYNAMIC.
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TEMPORARY TABLE `t1` (
+ `i` int(11) NOT NULL,
+ `c` char(10) NOT NULL,
+ PRIMARY KEY (`i`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED
+DROP TABLE t1;
+CREATE TEMPORARY TABLE t1 (
+i INT NOT NULL PRIMARY KEY,
+c CHAR(10) NOT NULL
+) ENGINE = InnoDB ROW_FORMAT = COMPRESSED KEY_BLOCK_SIZE = 8;
+Warnings:
+Warning 1478 InnoDB: KEY_BLOCK_SIZE is ignored for TEMPORARY TABLE.
+Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=8.
+Warning 1478 InnoDB: ROW_FORMAT=COMPRESSED is ignored for TEMPORARY TABLE.
+Warning 1478 InnoDB: assuming ROW_FORMAT=DYNAMIC.
+SHOW WARNINGS;
+Level Code Message
+Warning 1478 InnoDB: KEY_BLOCK_SIZE is ignored for TEMPORARY TABLE.
+Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=8.
+Warning 1478 InnoDB: ROW_FORMAT=COMPRESSED is ignored for TEMPORARY TABLE.
+Warning 1478 InnoDB: assuming ROW_FORMAT=DYNAMIC.
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TEMPORARY TABLE `t1` (
+ `i` int(11) NOT NULL,
+ `c` char(10) NOT NULL,
+ PRIMARY KEY (`i`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8
+DROP TABLE t1;
+CREATE TEMPORARY TABLE t1 (
+i INT NOT NULL PRIMARY KEY,
+c CHAR(10) NOT NULL
+) ENGINE = InnoDB ROW_FORMAT = DYNAMIC KEY_BLOCK_SIZE = 8;
+Warnings:
+Warning 1478 InnoDB: KEY_BLOCK_SIZE is ignored for TEMPORARY TABLE.
+Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=8.
+SHOW WARNINGS;
+Level Code Message
+Warning 1478 InnoDB: KEY_BLOCK_SIZE is ignored for TEMPORARY TABLE.
+Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=8.
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TEMPORARY TABLE `t1` (
+ `i` int(11) NOT NULL,
+ `c` char(10) NOT NULL,
+ PRIMARY KEY (`i`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC KEY_BLOCK_SIZE=8
+DROP TABLE t1;
+CREATE TEMPORARY TABLE t1 (
+i INT NOT NULL PRIMARY KEY,
+c CHAR(10) NOT NULL
+) ENGINE = InnoDB ROW_FORMAT = DYNAMIC;
+SHOW WARNINGS;
+Level Code Message
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TEMPORARY TABLE `t1` (
+ `i` int(11) NOT NULL,
+ `c` char(10) NOT NULL,
+ PRIMARY KEY (`i`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC
+DROP TABLE t1;
+CREATE TEMPORARY TABLE t1 (
+i INT NOT NULL PRIMARY KEY
+) ENGINE = InnoDB ROW_FORMAT = REDUNDANT;
+ALTER TABLE t1 ROW_FORMAT = COMPRESSED;
+Warnings:
+Warning 1478 InnoDB: ROW_FORMAT=COMPRESSED is ignored for TEMPORARY TABLE.
+Warning 1478 InnoDB: assuming ROW_FORMAT=DYNAMIC.
+SHOW WARNINGS;
+Level Code Message
+Warning 1478 InnoDB: ROW_FORMAT=COMPRESSED is ignored for TEMPORARY TABLE.
+Warning 1478 InnoDB: assuming ROW_FORMAT=DYNAMIC.
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TEMPORARY TABLE `t1` (
+ `i` int(11) NOT NULL,
+ PRIMARY KEY (`i`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED
+ALTER TABLE t1 KEY_BLOCK_SIZE = 4;
+Warnings:
+Warning 1478 InnoDB: KEY_BLOCK_SIZE is ignored for TEMPORARY TABLE.
+Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=4.
+Warning 1478 InnoDB: ROW_FORMAT=COMPRESSED is ignored for TEMPORARY TABLE.
+Warning 1478 InnoDB: assuming ROW_FORMAT=DYNAMIC.
+SHOW WARNINGS;
+Level Code Message
+Warning 1478 InnoDB: KEY_BLOCK_SIZE is ignored for TEMPORARY TABLE.
+Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=4.
+Warning 1478 InnoDB: ROW_FORMAT=COMPRESSED is ignored for TEMPORARY TABLE.
+Warning 1478 InnoDB: assuming ROW_FORMAT=DYNAMIC.
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TEMPORARY TABLE `t1` (
+ `i` int(11) NOT NULL,
+ PRIMARY KEY (`i`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4
+ALTER TABLE t1 KEY_BLOCK_SIZE = 4 ROW_FORMAT = COMPRESSED;
+Warnings:
+Warning 1478 InnoDB: KEY_BLOCK_SIZE is ignored for TEMPORARY TABLE.
+Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=4.
+Warning 1478 InnoDB: ROW_FORMAT=COMPRESSED is ignored for TEMPORARY TABLE.
+Warning 1478 InnoDB: assuming ROW_FORMAT=DYNAMIC.
+SHOW WARNINGS;
+Level Code Message
+Warning 1478 InnoDB: KEY_BLOCK_SIZE is ignored for TEMPORARY TABLE.
+Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=4.
+Warning 1478 InnoDB: ROW_FORMAT=COMPRESSED is ignored for TEMPORARY TABLE.
+Warning 1478 InnoDB: assuming ROW_FORMAT=DYNAMIC.
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TEMPORARY TABLE `t1` (
+ `i` int(11) NOT NULL,
+ PRIMARY KEY (`i`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4
+ALTER TABLE t1 ROW_FORMAT = DYNAMIC KEY_BLOCK_SIZE = 4;
+Warnings:
+Warning 1478 InnoDB: KEY_BLOCK_SIZE is ignored for TEMPORARY TABLE.
+Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=4.
+SHOW WARNINGS;
+Level Code Message
+Warning 1478 InnoDB: KEY_BLOCK_SIZE is ignored for TEMPORARY TABLE.
+Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=4.
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TEMPORARY TABLE `t1` (
+ `i` int(11) NOT NULL,
+ PRIMARY KEY (`i`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC KEY_BLOCK_SIZE=4
+ALTER TABLE t1 ROW_FORMAT = DYNAMIC;
+Warnings:
+Warning 1478 InnoDB: KEY_BLOCK_SIZE is ignored for TEMPORARY TABLE.
+Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=4.
+SHOW WARNINGS;
+Level Code Message
+Warning 1478 InnoDB: KEY_BLOCK_SIZE is ignored for TEMPORARY TABLE.
+Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=4.
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TEMPORARY TABLE `t1` (
+ `i` int(11) NOT NULL,
+ PRIMARY KEY (`i`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC KEY_BLOCK_SIZE=4
+DROP TABLE t1;
+set innodb_strict_mode = ON;
+CREATE TEMPORARY TABLE t1 (
+i INT NOT NULL PRIMARY KEY,
+c CHAR(10) NOT NULL
+) ENGINE = InnoDB KEY_BLOCK_SIZE = 4;
+ERROR HY000: CREATE TEMPORARY TABLE is not allowed with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE.
+SHOW WARNINGS;
+Level Code Message
+Error 4047 CREATE TEMPORARY TABLE is not allowed with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE.
+Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB
+CREATE TEMPORARY TABLE t1 (
+i INT NOT NULL PRIMARY KEY,
+c CHAR(10) NOT NULL
+) ENGINE = InnoDB KEY_BLOCK_SIZE = 4, ROW_FORMAT = COMPACT;
+ERROR HY000: CREATE TEMPORARY TABLE is not allowed with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE.
+SHOW WARNINGS;
+Level Code Message
+Error 4047 CREATE TEMPORARY TABLE is not allowed with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE.
+Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB
+CREATE TEMPORARY TABLE t1 (
+i INT NOT NULL PRIMARY KEY,
+c CHAR(10) NOT NULL
+) ENGINE = InnoDB ROW_FORMAT = REDUNDANT;
+SHOW WARNINGS;
+Level Code Message
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TEMPORARY TABLE `t1` (
+ `i` int(11) NOT NULL,
+ `c` char(10) NOT NULL,
+ PRIMARY KEY (`i`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=REDUNDANT
+DROP TABLE t1;
+CREATE TEMPORARY TABLE t1 (
+i INT NOT NULL PRIMARY KEY,
+c CHAR(10) NOT NULL
+) ENGINE = InnoDB KEY_BLOCK_SIZE = 4;
+ERROR HY000: CREATE TEMPORARY TABLE is not allowed with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE.
+SHOW WARNINGS;
+Level Code Message
+Error 4047 CREATE TEMPORARY TABLE is not allowed with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE.
+Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB
+CREATE TEMPORARY TABLE t1 (
+i INT NOT NULL PRIMARY KEY,
+c CHAR(10) NOT NULL
+) ENGINE = InnoDB ROW_FORMAT = COMPRESSED;
+ERROR HY000: CREATE TEMPORARY TABLE is not allowed with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE.
+SHOW WARNINGS;
+Level Code Message
+Error 4047 CREATE TEMPORARY TABLE is not allowed with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE.
+Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB
+CREATE TEMPORARY TABLE t1 (
+i INT NOT NULL PRIMARY KEY,
+c CHAR(10) NOT NULL
+) ENGINE = InnoDB ROW_FORMAT = COMPRESSED KEY_BLOCK_SIZE = 8;
+ERROR HY000: CREATE TEMPORARY TABLE is not allowed with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE.
+SHOW WARNINGS;
+Level Code Message
+Error 4047 CREATE TEMPORARY TABLE is not allowed with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE.
+Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB
+CREATE TEMPORARY TABLE t1 (
+i INT NOT NULL PRIMARY KEY,
+c CHAR(10) NOT NULL
+) ENGINE = InnoDB ROW_FORMAT = COMPRESSED KEY_BLOCK_SIZE = 7;
+ERROR HY000: CREATE TEMPORARY TABLE is not allowed with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE.
+SHOW WARNINGS;
+Level Code Message
+Error 4047 CREATE TEMPORARY TABLE is not allowed with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE.
+Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB
+CREATE TEMPORARY TABLE t1 (
+i INT NOT NULL PRIMARY KEY,
+c CHAR(10) NOT NULL
+) ENGINE = InnoDB ROW_FORMAT = DYNAMIC;
+SHOW WARNINGS;
+Level Code Message
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TEMPORARY TABLE `t1` (
+ `i` int(11) NOT NULL,
+ `c` char(10) NOT NULL,
+ PRIMARY KEY (`i`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC
+DROP TABLE t1;
+CREATE TEMPORARY TABLE t1 (
+i INT NOT NULL PRIMARY KEY
+) ENGINE = InnoDB ROW_FORMAT = REDUNDANT;
+ALTER TABLE t1 ROW_FORMAT = COMPRESSED;
+ERROR HY000: CREATE TEMPORARY TABLE is not allowed with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE.
+SHOW WARNINGS;
+Level Code Message
+Error 4047 CREATE TEMPORARY TABLE is not allowed with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE.
+Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB
+ALTER TABLE t1 KEY_BLOCK_SIZE = 4;
+ERROR HY000: CREATE TEMPORARY TABLE is not allowed with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE.
+SHOW WARNINGS;
+Level Code Message
+Error 4047 CREATE TEMPORARY TABLE is not allowed with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE.
+Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB
+ALTER TABLE t1 ROW_FORMAT = DYNAMIC KEY_BLOCK_SIZE = 4;
+ERROR HY000: CREATE TEMPORARY TABLE is not allowed with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE.
+SHOW WARNINGS;
+Level Code Message
+Error 4047 CREATE TEMPORARY TABLE is not allowed with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE.
+Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB
+ALTER TABLE t1 ROW_FORMAT = DYNAMIC;
+set innodb_strict_mode = OFF;
+ALTER TABLE t1 ROW_FORMAT = COMPRESSED;
+Warnings:
+Warning 1478 InnoDB: ROW_FORMAT=COMPRESSED is ignored for TEMPORARY TABLE.
+Warning 1478 InnoDB: assuming ROW_FORMAT=DYNAMIC.
+SHOW WARNINGS;
+Level Code Message
+Warning 1478 InnoDB: ROW_FORMAT=COMPRESSED is ignored for TEMPORARY TABLE.
+Warning 1478 InnoDB: assuming ROW_FORMAT=DYNAMIC.
+set innodb_strict_mode = ON;
+ALTER TABLE t1 ROW_FORMAT = DYNAMIC;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TEMPORARY TABLE `t1` (
+ `i` int(11) NOT NULL,
+ PRIMARY KEY (`i`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC
+set innodb_strict_mode = OFF;
+ALTER TABLE t1 ROW_FORMAT = COMPRESSED;
+Warnings:
+Warning 1478 InnoDB: ROW_FORMAT=COMPRESSED is ignored for TEMPORARY TABLE.
+Warning 1478 InnoDB: assuming ROW_FORMAT=DYNAMIC.
+SHOW WARNINGS;
+Level Code Message
+Warning 1478 InnoDB: ROW_FORMAT=COMPRESSED is ignored for TEMPORARY TABLE.
+Warning 1478 InnoDB: assuming ROW_FORMAT=DYNAMIC.
+ALTER TABLE t1 KEY_BLOCK_SIZE = 8;
+Warnings:
+Warning 1478 InnoDB: KEY_BLOCK_SIZE is ignored for TEMPORARY TABLE.
+Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=8.
+Warning 1478 InnoDB: ROW_FORMAT=COMPRESSED is ignored for TEMPORARY TABLE.
+Warning 1478 InnoDB: assuming ROW_FORMAT=DYNAMIC.
+SHOW WARNINGS;
+Level Code Message
+Warning 1478 InnoDB: KEY_BLOCK_SIZE is ignored for TEMPORARY TABLE.
+Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=8.
+Warning 1478 InnoDB: ROW_FORMAT=COMPRESSED is ignored for TEMPORARY TABLE.
+Warning 1478 InnoDB: assuming ROW_FORMAT=DYNAMIC.
+set innodb_strict_mode = ON;
+ALTER TABLE t1 ADD COLUMN j INT;
+ERROR HY000: CREATE TEMPORARY TABLE is not allowed with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE.
+SHOW WARNINGS;
+Level Code Message
+Error 4047 CREATE TEMPORARY TABLE is not allowed with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE.
+Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TEMPORARY TABLE `t1` (
+ `i` int(11) NOT NULL,
+ PRIMARY KEY (`i`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8
+set innodb_strict_mode = OFF;
+ALTER TABLE t1 KEY_BLOCK_SIZE = 0;
+Warnings:
+Warning 1478 InnoDB: ROW_FORMAT=COMPRESSED is ignored for TEMPORARY TABLE.
+Warning 1478 InnoDB: assuming ROW_FORMAT=DYNAMIC.
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TEMPORARY TABLE `t1` (
+ `i` int(11) NOT NULL,
+ PRIMARY KEY (`i`) KEY_BLOCK_SIZE=8
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED
+ALTER TABLE t1 ROW_FORMAT = DYNAMIC;
+set innodb_strict_mode = ON;
+ALTER TABLE t1 ADD COLUMN j INT;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TEMPORARY TABLE `t1` (
+ `i` int(11) NOT NULL,
+ `j` int(11) DEFAULT NULL,
+ PRIMARY KEY (`i`) KEY_BLOCK_SIZE=8
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC
diff --git a/mysql-test/suite/innodb/r/temporary_table_optimization.result b/mysql-test/suite/innodb/r/temporary_table_optimization.result
new file mode 100644
index 00000000000..63c4f388bf7
--- /dev/null
+++ b/mysql-test/suite/innodb/r/temporary_table_optimization.result
@@ -0,0 +1,266 @@
+create temporary table t1 (i int) engine = innodb;
+insert into t1 values (1), (2), (3), (4);
+select * from t1;
+i
+1
+2
+3
+4
+select * from t1 where i = 4;
+i
+4
+drop table t1;
+create temporary table t1 (i int) engine = innodb;
+insert into t1 values (1), (2), (3), (4);
+select * from t1;
+i
+1
+2
+3
+4
+select * from t1 where i = 4;
+i
+4
+drop table t1;
+create temporary table t2 (i int) engine = innodb;
+insert into t2 values (1), (2), (3), (4);
+select * from t2;
+i
+1
+2
+3
+4
+select * from t2 where i = 4;
+i
+4
+drop table t2;
+create temporary table t1
+(keyc int, c1 char(100), c2 char(100),
+primary key(keyc)) engine = innodb;
+create procedure populate_t1()
+begin
+declare i int default 1;
+while (i <= 200) DO
+insert into t1 values (i, 'a', 'b');
+set i = i + 1;
+end while;
+end|
+set autocommit=0;
+select count(*) from t1;
+count(*)
+0
+call populate_t1();
+select count(*) from t1;
+count(*)
+200
+select * from t1 limit 10;
+keyc c1 c2
+1 a b
+2 a b
+3 a b
+4 a b
+5 a b
+6 a b
+7 a b
+8 a b
+9 a b
+10 a b
+set autocommit=1;
+truncate table t1;
+select count(*) from t1;
+count(*)
+0
+drop table t1;
+create temporary table t1 (i int) engine = innodb;
+insert into t1 values (1), (2), (3), (4);
+select * from t1;
+i
+1
+2
+3
+4
+select * from t1 where i = 4;
+i
+4
+drop table t1;
+create temporary table t1
+(keyc int, c1 char(100), c2 char(100),
+primary key(keyc))
+engine = innodb;
+begin;
+select count(*) from t1;
+count(*)
+0
+call populate_t1();
+select count(*) from t1;
+count(*)
+200
+rollback;
+select count(*) from t1;
+count(*)
+0
+begin;
+call populate_t1();
+commit;
+select count(*) from t1;
+count(*)
+200
+truncate table t1;
+select count(*) from t1;
+count(*)
+0
+drop table t1;
+drop procedure populate_t1;
+create temporary table t1 (t1_i int, t1_f float) engine = innodb;
+insert into t1 values (1, 1.1), (2, 2.2), (3, 2.2), (4, 4.4);
+explain select * from t1 where t1_i = 1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where
+alter table t1 add unique index pri_index(t1_i);
+explain select * from t1 where t1_i = 1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 const pri_index pri_index 5 const 1
+select * from t1 where t1_i = 1;
+t1_i t1_f
+1 1.1
+alter table t1 add unique index sec_index(t1_f);
+ERROR 23000: Duplicate entry '2.2' for key 'sec_index'
+alter table t1 add index sec_index(t1_f);
+explain select * from t1 where t1_f > 2.2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL sec_index NULL NULL NULL 4 Using where
+select * from t1 where t1_f > 2.2;
+t1_i t1_f
+2 2.2
+3 2.2
+4 4.4
+alter table t1 add column (t1_c char(10));
+select * from t1;
+t1_i t1_f t1_c
+1 1.1 NULL
+2 2.2 NULL
+3 2.2 NULL
+4 4.4 NULL
+insert into t1 values (5, 5.5, 'krunal');
+alter table t1 drop column t1_f;
+show create table t1;
+Table Create Table
+t1 CREATE TEMPORARY TABLE `t1` (
+ `t1_i` int(11) DEFAULT NULL,
+ `t1_c` char(10) DEFAULT NULL,
+ UNIQUE KEY `pri_index` (`t1_i`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+select * from t1 where t1_f > 2.2;
+ERROR 42S22: Unknown column 't1_f' in 'where clause'
+alter table t1 add index sec_index2(t1_c), algorithm=inplace;
+ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY
+drop table t1;
+create temporary table t1 (i int, f float) engine = innodb;
+insert into t1 values (10, 1.1), (20, 2.2);
+select * from t1;
+i f
+10 1.1
+20 2.2
+alter table t1 discard tablespace;
+ERROR HY000: Cannot DISCARD/IMPORT tablespace associated with temporary table
+alter table t1 import tablespace;
+ERROR HY000: Cannot DISCARD/IMPORT tablespace associated with temporary table
+drop table t1;
+create temporary table t1 (i int) engine=innodb;
+insert into t1 values (1), (2), (3);
+select * from t1;
+i
+1
+2
+3
+alter table t1 rename t2;
+select * from t1;
+ERROR 42S02: Table 'test.t1' doesn't exist
+select * from t2;
+i
+1
+2
+3
+insert into t2 values (1), (2), (6), (7);
+select * from t2;
+i
+1
+2
+3
+1
+2
+6
+7
+drop table t2;
+SET sql_mode = 'NO_ENGINE_SUBSTITUTION';
+create temporary table t (
+a int not null,
+b blob not null,
+index sk (b(3021))
+) row_format = dynamic engine=innodb;
+drop table t;
+create temporary table t (
+a int not null,
+b blob not null,
+index sk (b(3021))
+) row_format = dynamic engine=innodb;
+drop table t;
+create temporary table t (
+a int not null,
+b blob not null,
+index sk (b(3021))
+) row_format = dynamic engine=innodb;
+drop table t;
+SET innodb_strict_mode=OFF;
+create temporary table t (
+a int not null,
+b blob not null,
+index sk (b(3021))
+) row_format = compact engine=innodb;
+ERROR HY000: Index column size too large. The maximum column size is 767 bytes
+create temporary table t (
+a int not null,
+b blob not null,
+index sk (b(3021))
+) row_format = dynamic engine=innodb;
+drop table t;
+create temporary table t (
+a int not null,
+b blob not null,
+index sk (b(3021))
+) row_format = compressed engine=innodb;
+drop table t;
+create temporary table t (
+a int not null,
+b blob not null,
+index sk (b(3021))
+) row_format = compact engine=innodb;
+ERROR HY000: Index column size too large. The maximum column size is 767 bytes
+create temporary table t (
+a int not null,
+b blob not null,
+index sk (b(3021))
+) row_format = dynamic engine=innodb;
+drop table t;
+CREATE TABLE t1 ( i INT ) ENGINE = Innodb;
+CREATE TEMPORARY TABLE t2 ( i INT ) ENGINE = Innodb;
+SELECT COUNT(*) FROM information_schema.INNODB_SYS_DATAFILES WHERE PATH LIKE '%test%t_';
+COUNT(*)
+0
+SELECT COUNT(*) FROM information_schema.INNODB_SYS_TABLES WHERE NAME LIKE '%test%t_';
+COUNT(*)
+1
+CREATE TEMPORARY table t3 ( i INT ) ENGINE = Innodb;
+SELECT COUNT(*) FROM information_schema.INNODB_SYS_DATAFILES WHERE PATH LIKE '%test%t_';
+COUNT(*)
+0
+SELECT COUNT(*) FROM information_schema.INNODB_SYS_TABLES WHERE NAME LIKE '%test%t_';
+COUNT(*)
+1
+DROP TABLE t1,t2,t3;
+SELECT COUNT(*) FROM information_schema.INNODB_SYS_DATAFILES WHERE PATH LIKE '%test%t_';
+COUNT(*)
+0
+SELECT COUNT(*) FROM information_schema.INNODB_SYS_TABLES WHERE NAME LIKE '%test%t_';
+COUNT(*)
+0
diff --git a/mysql-test/suite/innodb/r/xa_recovery.result b/mysql-test/suite/innodb/r/xa_recovery.result
index 666a65f8ee1..7a9448ad9f0 100644
--- a/mysql-test/suite/innodb/r/xa_recovery.result
+++ b/mysql-test/suite/innodb/r/xa_recovery.result
@@ -1,4 +1,3 @@
-call mtr.add_suppression("InnoDB: Warning: database page corruption or a failed");
CREATE TABLE t1 (a INT) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1);
connect con1,localhost,root;
@@ -7,7 +6,7 @@ UPDATE t1 set a=2;
XA END 'x';
XA PREPARE 'x';
connection default;
-call mtr.add_suppression("Found 1 prepared XA transactions");
+# Kill and restart
disconnect con1;
connect con1,localhost,root;
SELECT * FROM t1 LOCK IN SHARE MODE;
diff --git a/mysql-test/suite/innodb/std_data/log_corruption.zip b/mysql-test/suite/innodb/std_data/log_corruption.zip
new file mode 100644
index 00000000000..6f126c2edf0
--- /dev/null
+++ b/mysql-test/suite/innodb/std_data/log_corruption.zip
Binary files differ
diff --git a/mysql-test/suite/innodb/std_data/log_corruption0.zip b/mysql-test/suite/innodb/std_data/log_corruption0.zip
new file mode 100644
index 00000000000..c003a18a1b2
--- /dev/null
+++ b/mysql-test/suite/innodb/std_data/log_corruption0.zip
Binary files differ
diff --git a/mysql-test/suite/innodb/std_data/log_corruption1.zip b/mysql-test/suite/innodb/std_data/log_corruption1.zip
new file mode 100644
index 00000000000..35a02adaa6d
--- /dev/null
+++ b/mysql-test/suite/innodb/std_data/log_corruption1.zip
Binary files differ
diff --git a/mysql-test/suite/innodb/std_data/log_corruption2.zip b/mysql-test/suite/innodb/std_data/log_corruption2.zip
new file mode 100644
index 00000000000..4e4180ac4a3
--- /dev/null
+++ b/mysql-test/suite/innodb/std_data/log_corruption2.zip
Binary files differ
diff --git a/mysql-test/suite/innodb/std_data/log_corruption3.zip b/mysql-test/suite/innodb/std_data/log_corruption3.zip
new file mode 100644
index 00000000000..2337c81a80b
--- /dev/null
+++ b/mysql-test/suite/innodb/std_data/log_corruption3.zip
Binary files differ
diff --git a/mysql-test/suite/innodb/std_data/log_corruption4.zip b/mysql-test/suite/innodb/std_data/log_corruption4.zip
new file mode 100644
index 00000000000..86002d7d42a
--- /dev/null
+++ b/mysql-test/suite/innodb/std_data/log_corruption4.zip
Binary files differ
diff --git a/mysql-test/suite/innodb/std_data/log_corruption4a.zip b/mysql-test/suite/innodb/std_data/log_corruption4a.zip
new file mode 100644
index 00000000000..6d072f3029f
--- /dev/null
+++ b/mysql-test/suite/innodb/std_data/log_corruption4a.zip
Binary files differ
diff --git a/mysql-test/suite/innodb/std_data/log_corruption5.zip b/mysql-test/suite/innodb/std_data/log_corruption5.zip
new file mode 100644
index 00000000000..bbf0238efc9
--- /dev/null
+++ b/mysql-test/suite/innodb/std_data/log_corruption5.zip
Binary files differ
diff --git a/mysql-test/suite/innodb/std_data/log_corruption6.zip b/mysql-test/suite/innodb/std_data/log_corruption6.zip
new file mode 100644
index 00000000000..04dd687e7c9
--- /dev/null
+++ b/mysql-test/suite/innodb/std_data/log_corruption6.zip
Binary files differ
diff --git a/mysql-test/suite/innodb/t/101_compatibility.test b/mysql-test/suite/innodb/t/101_compatibility.test
new file mode 100644
index 00000000000..83ab7914a69
--- /dev/null
+++ b/mysql-test/suite/innodb/t/101_compatibility.test
@@ -0,0 +1,105 @@
+--source include/have_innodb.inc
+--source include/not_embedded.inc
+
+-- echo #
+-- echo # MDEV-11623 MariaDB 10.1 fails to start datadir created with
+-- echo # MariaDB 10.0/MySQL 5.6 using innodb-page-size!=16K
+-- echo #
+
+# This is actually testing the opposite: starting the fixed 10.1 with
+# buggy 10.1 files (by manually converting the flags in the files).
+
+--disable_query_log
+call mtr.add_suppression("InnoDB: adjusting FSP_SPACE_FLAGS of tablespace");
+FLUSH TABLES;
+--enable_query_log
+let INNODB_PAGE_SIZE=`select @@innodb_page_size`;
+let MYSQLD_DATADIR=`select @@datadir`;
+
+CREATE TABLE tr(a INT)ENGINE=InnoDB ROW_FORMAT=REDUNDANT;
+CREATE TABLE tc(a INT)ENGINE=InnoDB ROW_FORMAT=COMPACT;
+CREATE TABLE td(a INT)ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
+--disable_warnings
+# ROW_FORMAT=COMPRESSED is not available with innodb_page_size>16k
+SET INNODB_STRICT_MODE=OFF;
+CREATE TABLE tz(a INT)ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1;
+SET INNODB_STRICT_MODE=ON;
+--enable_warnings
+
+--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
+EVAL CREATE TABLE tdd(a INT) ENGINE=InnoDB, DATA DIRECTORY='$MYSQL_TMP_DIR';
+
+CREATE TABLE tp(a INT) ENGINE=InnoDB page_compressed=1;
+CREATE TABLE ti(a INT) ENGINE=InnoDB;
+FLUSH TABLES ti FOR EXPORT;
+perl;
+do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
+ib_backup_tablespaces("test", "ti");
+EOF
+UNLOCK TABLES;
+ALTER TABLE ti DISCARD TABLESPACE;
+perl;
+do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
+ib_discard_tablespaces("test", "ti");
+ib_restore_tablespaces("test", "ti");
+do "$ENV{MTR_SUITE_DIR}/include/ibd_convert.pl";
+my $ps = $ENV{INNODB_PAGE_SIZE};
+my $dd = $ENV{MYSQLD_DATADIR};
+convert_to_mariadb_101("$dd/test/ti.ibd", $ps);
+EOF
+
+ALTER TABLE ti IMPORT TABLESPACE;
+
+BEGIN;
+INSERT INTO tr VALUES(1);
+INSERT INTO tc VALUES(1);
+INSERT INTO td VALUES(1);
+INSERT INTO tz VALUES(1);
+INSERT INTO tdd VALUES(1);
+INSERT INTO tp VALUES(1);
+INSERT INTO ti VALUES(1);
+
+--source include/kill_mysqld.inc
+
+perl;
+do "$ENV{MTR_SUITE_DIR}/include/ibd_convert.pl";
+my $ps = $ENV{INNODB_PAGE_SIZE};
+my $dd = $ENV{MYSQLD_DATADIR};
+
+convert_to_mariadb_101("$dd/ibdata1", $ps);
+convert_to_mariadb_101("$dd/test/tr.ibd", $ps);
+convert_to_mariadb_101("$dd/test/tc.ibd", $ps);
+convert_to_mariadb_101("$dd/test/td.ibd", $ps);
+convert_to_mariadb_101("$dd/test/tz.ibd", 1024) if $ps<32768;
+convert_to_mariadb_101("$dd/test/tp.ibd", $ps);
+convert_to_mariadb_101("$dd/test/ti.ibd", $ps);
+convert_to_mariadb_101("$ENV{MYSQL_TMP_DIR}/test/tdd.ibd", $ps);
+EOF
+
+--source include/start_mysqld.inc
+CHECK TABLE tr,tc,td,tz,tdd,tp,ti;
+--source include/shutdown_mysqld.inc
+
+perl;
+do "$ENV{MTR_SUITE_DIR}/include/ibd_convert.pl";
+my $ps = $ENV{INNODB_PAGE_SIZE};
+my $dd = $ENV{MYSQLD_DATADIR};
+
+convert_to_mariadb_101("$dd/ibdata1", $ps);
+convert_to_mariadb_101("$dd/test/tr.ibd", $ps);
+convert_to_mariadb_101("$dd/test/tc.ibd", $ps);
+convert_to_mariadb_101("$dd/test/td.ibd", $ps);
+convert_to_mariadb_101("$dd/test/tz.ibd", 1024) if $ps<32768;
+convert_to_mariadb_101("$dd/test/tp.ibd", $ps);
+convert_to_mariadb_101("$dd/test/ti.ibd", $ps);
+convert_to_mariadb_101("$ENV{MYSQL_TMP_DIR}/test/tdd.ibd", $ps);
+EOF
+
+--let $restart_parameters=--innodb-read-only
+--source include/start_mysqld.inc
+CHECK TABLE tr,tc,td,tz,tdd,tp,ti;
+--source include/shutdown_mysqld.inc
+
+--let $restart_parameters=
+--source include/start_mysqld.inc
+DROP TABLE tr,tc,td,tz,tdd,tp,ti;
diff --git a/mysql-test/suite/innodb/t/alter_missing_tablespace.test b/mysql-test/suite/innodb/t/alter_missing_tablespace.test
new file mode 100644
index 00000000000..643b7a4833d
--- /dev/null
+++ b/mysql-test/suite/innodb/t/alter_missing_tablespace.test
@@ -0,0 +1,58 @@
+--source include/not_embedded.inc
+--source include/have_innodb.inc
+
+--echo #
+--echo # Bug#13955083 ALLOW IN-PLACE DDL OPERATIONS ON MISSING
+--echo # OR DISCARDED TABLESPACES
+--echo #
+
+--disable_query_log
+call mtr.add_suppression("InnoDB: Cannot open datafile for read-only: ");
+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");
+call mtr.add_suppression("InnoDB: If you are installing InnoDB, remember that you must create directories yourself, InnoDB does not create them");
+call mtr.add_suppression("InnoDB: Ignoring tablespace for `test`.`\(t\|x\.\.d\)` because it could not be opened");
+call mtr.add_suppression("InnoDB: Cannot calculate statistics for table .* because the .ibd file is missing");
+call mtr.add_suppression("Could not find a valid tablespace file for");
+call mtr.add_suppression("InnoDB: Failed to find tablespace for table `test`\.`\(t\|x\.\.d\)` in the cache");
+call mtr.add_suppression("InnoDB: Cannot delete tablespace [0-9]+.*not found");
+call mtr.add_suppression("Table .* in the InnoDB data dictionary has tablespace id .*, but tablespace with that id or name does not exist");
+--enable_query_log
+
+let $MYSQLD_DATADIR=`select @@datadir`;
+SET GLOBAL innodb_file_per_table=1;
+CREATE TABLE t(a INT)ENGINE=InnoDB;
+CREATE TABLE `x..d` (a INT PRIMARY KEY, b INT) ENGINE=InnoDB;
+
+--source include/shutdown_mysqld.inc
+
+# Remove the tablespace files.
+--remove_file $MYSQLD_DATADIR/test/t.ibd
+--remove_file $MYSQLD_DATADIR/test/x@002e@002ed.ibd
+
+--source include/start_mysqld.inc
+
+# The ER_NO_SUCH_TABLE is being thrown by ha_innobase::open().
+# The table does exist, only the tablespace does not exist.
+--error ER_NO_SUCH_TABLE_IN_ENGINE
+SELECT * FROM t;
+
+--error ER_NO_SUCH_TABLE_IN_ENGINE
+ALTER TABLE t ADD INDEX (a), ALGORITHM=INPLACE;
+SHOW WARNINGS;
+
+--error ER_NO_SUCH_TABLE
+ALTER TABLE t1 ADD INDEX (a), ALGORITHM=COPY;
+SHOW WARNINGS;
+
+--error ER_PARSE_ERROR
+ALTER TABLE t ALGORITHM=INPLACE, DISCARD TABLESPACE;
+--error ER_PARSE_ERROR
+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;
+--error ER_NO_SUCH_TABLE_IN_ENGINE
+SELECT * FROM `x..d`;
+DROP TABLE `x..d`;
diff --git a/mysql-test/suite/innodb/t/doublewrite.test b/mysql-test/suite/innodb/t/doublewrite.test
index e1984319cb7..a153ad66b19 100644
--- a/mysql-test/suite/innodb/t/doublewrite.test
+++ b/mysql-test/suite/innodb/t/doublewrite.test
@@ -10,15 +10,13 @@
# Slow shutdown and restart to make sure ibuf merge is finished
SET GLOBAL innodb_fast_shutdown = 0;
---source include/restart_mysqld.inc
-
--disable_query_log
-call mtr.add_suppression("InnoDB: Database page [0-9]+:1 contained only zeroes.");
call mtr.add_suppression("Header page consists of zero bytes");
call mtr.add_suppression("Checksum mismatch in datafile");
call mtr.add_suppression("but the innodb_page_size start-up parameter is");
-call mtr.add_suppression("Database page corruption");
+call mtr.add_suppression("adjusting FSP_SPACE_FLAGS");
--enable_query_log
+--source include/restart_mysqld.inc
let INNODB_PAGE_SIZE=`select @@innodb_page_size`;
let MYSQLD_DATADIR=`select @@datadir`;
@@ -65,14 +63,48 @@ set global innodb_buf_flush_list_now = 1;
--echo # Make the first page (page_no=0) of the user tablespace
--echo # full of zeroes.
+--echo #
+--echo # MDEV-11623: Use old FSP_SPACE_FLAGS in the doublewrite buffer.
+
perl;
use IO::Handle;
my $fname= "$ENV{'MYSQLD_DATADIR'}test/t1.ibd";
+my $page_size = $ENV{INNODB_PAGE_SIZE};
+my $page;
open(FILE, "+<", $fname) or die;
-FILE->autoflush(1);
-binmode FILE;
-print FILE chr(0) x ($ENV{'INNODB_PAGE_SIZE'});
+sysread(FILE, $page, $page_size)==$page_size||die "Unable to read $name\n";
+sysseek(FILE, 0, 0)||die "Unable to seek $fname\n";
+die unless syswrite(FILE, chr(0) x $page_size, $page_size) == $page_size;
close FILE;
+
+open(FILE, "+<", "$ENV{MYSQLD_DATADIR}ibdata1")||die "cannot open ibdata1\n";
+sysseek(FILE, 6 * $page_size - 190, 0)||die "Unable to seek ibdata1\n";
+sysread(FILE, $_, 12) == 12||die "Unable to read TRX_SYS\n";
+my($magic,$d1,$d2)=unpack "NNN", $_;
+die "magic=$magic, $d1, $d2\n" unless $magic == 536853855 && $d2 >= $d1 + 64;
+sysseek(FILE, $d1 * $page_size, 0)||die "Unable to seek ibdata1\n";
+# Find the page in the doublewrite buffer
+for (my $d = $d1; $d < $d2 + 64; $d++)
+{
+ sysread(FILE, $_, $page_size)==$page_size||die "Cannot read doublewrite\n";
+ next unless $_ eq $page;
+ sysseek(FILE, $d * $page_size, 0)||die "Unable to seek ibdata1\n";
+ # Write buggy MariaDB 10.1.x FSP_SPACE_FLAGS to the doublewrite buffer
+ my($flags) = unpack "x[54]N", $_;
+ my $badflags = ($flags & 0x3f);
+ my $compression_level=6;
+ $badflags |= 1<<6|$compression_level<<7 if ($flags & 1 << 16);
+ $badflags |= ($flags & 15 << 6) << 7; # PAGE_SSIZE
+
+ substr ($_, 54, 4) = pack("N", $badflags);
+ # Replace the innodb_checksum_algorithm=none checksum
+ substr ($_, 0, 4) = pack("N", 0xdeadbeef);
+ substr ($_, $page_size - 8, 4) = pack("N", 0xdeadbeef);
+ syswrite(FILE, $_, $page_size)==$page_size||die;
+ close(FILE);
+ exit 0;
+}
+die "Did not find the page in the doublewrite buffer ($d1,$d2)\n";
EOF
--source include/start_mysqld.inc
diff --git a/mysql-test/suite/innodb/t/group_commit_crash.test b/mysql-test/suite/innodb/t/group_commit_crash.test
index cad349819bd..7ad0d9d1e74 100644
--- a/mysql-test/suite/innodb/t/group_commit_crash.test
+++ b/mysql-test/suite/innodb/t/group_commit_crash.test
@@ -9,8 +9,6 @@
--source include/have_debug.inc
--source include/have_log_bin.inc
-call mtr.add_suppression("InnoDB: Warning: database page corruption or a failed");
-
let $file_format_max=`SELECT @@innodb_file_format_max`;
CREATE TABLE t1(a CHAR(255),
b CHAR(255),
diff --git a/mysql-test/suite/innodb/t/group_commit_crash_no_optimize_thread.test b/mysql-test/suite/innodb/t/group_commit_crash_no_optimize_thread.test
index 8d1f460b64b..9dc2557e687 100644
--- a/mysql-test/suite/innodb/t/group_commit_crash_no_optimize_thread.test
+++ b/mysql-test/suite/innodb/t/group_commit_crash_no_optimize_thread.test
@@ -9,8 +9,6 @@
--source include/have_debug.inc
--source include/have_log_bin.inc
-call mtr.add_suppression("InnoDB: Warning: database page corruption or a failed");
-
let $file_format_max=`SELECT @@innodb_file_format_max`;
CREATE TABLE t1(a CHAR(255),
b CHAR(255),
diff --git a/mysql-test/suite/innodb/t/innochecksum.opt b/mysql-test/suite/innodb/t/innochecksum.opt
deleted file mode 100644
index cc738d97434..00000000000
--- a/mysql-test/suite/innodb/t/innochecksum.opt
+++ /dev/null
@@ -1,2 +0,0 @@
---innodb_file_per_table=1
---innodb_file_format=Barracuda
diff --git a/mysql-test/suite/innodb/t/innodb-16k.test b/mysql-test/suite/innodb/t/innodb-16k.test
index ad09666442d..a771fac27ed 100644
--- a/mysql-test/suite/innodb/t/innodb-16k.test
+++ b/mysql-test/suite/innodb/t/innodb-16k.test
@@ -8,17 +8,11 @@ call mtr.add_suppression("InnoDB: Cannot add field .* in table .* because after
--disable_query_log
let $MYSQLD_DATADIR= `select @@datadir`;
# These values can change during the test
-let $innodb_file_format_orig = `SELECT @@innodb_file_format`;
-let $innodb_file_per_table_orig = `SELECT @@innodb_file_per_table`;
-let $innodb_strict_mode_orig = `SELECT @@session.innodb_strict_mode`;
let $innodb_large_prefix_orig = `SELECT @@innodb_large_prefix`;
--enable_query_log
-SET GLOBAL innodb_file_format = `Barracuda`;
-SET GLOBAL innodb_file_per_table = ON;
SET GLOBAL innodb_large_prefix = OFF;
-
--echo # Test 1) Show the page size from Information Schema
SELECT variable_value FROM information_schema.global_status
WHERE LOWER(variable_name) = 'innodb_page_size';
@@ -263,8 +257,6 @@ SELECT table_name, row_format, create_options
DROP TABLE t1;
-SET GLOBAL innodb_file_format = `Barracuda`;
-
CREATE TABLE t2(d varchar(17) PRIMARY KEY) ENGINE=innodb DEFAULT CHARSET=utf8;
CREATE TABLE t3(a int PRIMARY KEY) ENGINE=innodb;
INSERT INTO t3 VALUES (22),(44),(33),(55),(66);
@@ -381,9 +373,6 @@ UPDATE t1 SET t=@e;
SHOW CREATE TABLE t1;
DROP TABLE t1;
-SET GLOBAL innodb_file_format = `Barracuda`;
-SET GLOBAL innodb_file_per_table = ON;
-
--echo Test an assertion failure on purge.
# This test is not in innodb_8k or innodb_4k since the bug is not about
@@ -440,8 +429,6 @@ DELETE FROM t3_purge;
DELETE FROM t4_purge;
# A secondary index tuple is found to be too long to fit into a page.
-SET GLOBAL innodb_file_per_table=on;
-SET GLOBAL innodb_file_format='Barracuda';
SET @r=REPEAT('a',500);
CREATE TABLE tlong(a int,
@@ -961,8 +948,5 @@ row_format=compact,ENGINE=INNODB;
#
--disable_query_log
-EVAL SET GLOBAL innodb_file_format = $innodb_file_format_orig;
-EVAL SET GLOBAL innodb_file_per_table = $innodb_file_per_table_orig;
-EVAL SET SESSION innodb_strict_mode = $innodb_strict_mode_orig;
EVAL SET GLOBAL innodb_large_prefix = $innodb_large_prefix_orig;
--enable_query_log
diff --git a/mysql-test/suite/innodb/t/innodb-32k-crash.test b/mysql-test/suite/innodb/t/innodb-32k-crash.test
index 8f2e7d6c1e2..b9d96fd92c8 100644
--- a/mysql-test/suite/innodb/t/innodb-32k-crash.test
+++ b/mysql-test/suite/innodb/t/innodb-32k-crash.test
@@ -10,16 +10,7 @@
call mtr.add_suppression("InnoDB: Warning: innodb_page_size has been changed from default value *");
---disable_query_log
let $MYSQLD_DATADIR= `select @@datadir`;
-# These values can change during the test
-let $innodb_file_format_orig = `SELECT @@innodb_file_format`;
-let $innodb_file_per_table_orig = `SELECT @@innodb_file_per_table`;
-let $innodb_strict_mode_orig = `SELECT @@session.innodb_strict_mode`;
---enable_query_log
-
-SET GLOBAL innodb_file_format = `Barracuda`;
-SET GLOBAL innodb_file_per_table = ON;
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,
@@ -210,13 +201,3 @@ COMMIT;
show create table t1;
show create table t2;
drop table t1,t2;
-
-#
-# restore environment to the state it was before this test execution
-#
-
---disable_query_log
-EVAL SET GLOBAL innodb_file_format = $innodb_file_format_orig;
-EVAL SET GLOBAL innodb_file_per_table = $innodb_file_per_table_orig;
-EVAL SET SESSION innodb_strict_mode = $innodb_strict_mode_orig;
---enable_query_log
diff --git a/mysql-test/suite/innodb/t/innodb-32k.test b/mysql-test/suite/innodb/t/innodb-32k.test
index 65c1d4bbc76..53a2d3a7442 100644
--- a/mysql-test/suite/innodb/t/innodb-32k.test
+++ b/mysql-test/suite/innodb/t/innodb-32k.test
@@ -3,21 +3,13 @@
--source include/have_innodb.inc
--source include/have_innodb_32k.inc
-call mtr.add_suppression("InnoDB: Warning: innodb_page_size has been changed from default value *");
-call mtr.add_suppression("InnoDB: Resizing redo log from *");
-call mtr.add_suppression("InnoDB: Starting to delete and rewrite log files.");
-call mtr.add_suppression("InnoDB: New log files created, LSN=*");
+call mtr.add_suppression("InnoDB: Warning: innodb_page_size has been changed from default value ");
+call mtr.add_suppression("InnoDB: Resizing redo log from ");
+call mtr.add_suppression("InnoDB: Starting to delete and rewrite log files");
+call mtr.add_suppression("InnoDB: New log files created, LSN=");
+call mtr.add_suppression("Innodb: Cannot add field.*row size is");
---disable_query_log
let $MYSQLD_DATADIR= `select @@datadir`;
-# These values can change during the test
-let $innodb_file_format_orig = `SELECT @@innodb_file_format`;
-let $innodb_file_per_table_orig = `SELECT @@innodb_file_per_table`;
-let $innodb_strict_mode_orig = `SELECT @@session.innodb_strict_mode`;
---enable_query_log
-
-SET GLOBAL innodb_file_format = `Barracuda`;
-SET GLOBAL innodb_file_per_table = ON;
--echo # Test 1) Show the page size from Information Schema
SELECT variable_value FROM information_schema.global_status
@@ -347,9 +339,9 @@ CREATE INDEX tn1f9 ON t1 (oa(767));
CREATE INDEX to1f11 ON t1 (pa(767));
UPDATE t1 SET t=@e;
-# One more index and row size is too big
---replace_regex /> [0-9]*/> max_row_size/
---error ER_TOO_BIG_ROWSIZE
+# One more index and row size is too big (not any more!)
+#--replace_regex /> [0-9]*/> max_row_size/
+#--error ER_TOO_BIG_ROWSIZE
CREATE INDEX t1f6 ON t1 (l(767));
drop table t1;
@@ -410,8 +402,6 @@ DELETE FROM t3_purge;
DELETE FROM t4_purge;
# A secondary index tuple is found to be too long to fit into a page.
-SET GLOBAL innodb_file_per_table=on;
-SET GLOBAL innodb_file_format='Barracuda';
SET @r=REPEAT('a',500);
CREATE TABLE tlong(a int,
@@ -758,12 +748,3 @@ show create table t2;
update t2 set col150=@a;
update t2 set col145=@b;
drop table t2;
-#
-# restore environment to the state it was before this test execution
-#
-
---disable_query_log
-EVAL SET GLOBAL innodb_file_format = $innodb_file_format_orig;
-EVAL SET GLOBAL innodb_file_per_table = $innodb_file_per_table_orig;
-EVAL SET SESSION innodb_strict_mode = $innodb_strict_mode_orig;
---enable_query_log
diff --git a/mysql-test/suite/innodb/t/innodb-64k-crash.test b/mysql-test/suite/innodb/t/innodb-64k-crash.test
index 9d2d0d66415..b61396bf22c 100644
--- a/mysql-test/suite/innodb/t/innodb-64k-crash.test
+++ b/mysql-test/suite/innodb/t/innodb-64k-crash.test
@@ -10,16 +10,7 @@
call mtr.add_suppression("InnoDB: Warning: innodb_page_size has been changed from default value *");
---disable_query_log
let $MYSQLD_DATADIR= `select @@datadir`;
-# These values can change during the test
-let $innodb_file_format_orig = `SELECT @@innodb_file_format`;
-let $innodb_file_per_table_orig = `SELECT @@innodb_file_per_table`;
-let $innodb_strict_mode_orig = `SELECT @@session.innodb_strict_mode`;
---enable_query_log
-
-SET GLOBAL innodb_file_format = `Barracuda`;
-SET GLOBAL innodb_file_per_table = ON;
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,
@@ -400,13 +391,3 @@ COMMIT;
show create table t1;
show create table t2;
drop table t1,t2;
-
-#
-# restore environment to the state it was before this test execution
-#
-
---disable_query_log
-EVAL SET GLOBAL innodb_file_format = $innodb_file_format_orig;
-EVAL SET GLOBAL innodb_file_per_table = $innodb_file_per_table_orig;
-EVAL SET SESSION innodb_strict_mode = $innodb_strict_mode_orig;
---enable_query_log
diff --git a/mysql-test/suite/innodb/t/innodb-64k.test b/mysql-test/suite/innodb/t/innodb-64k.test
index bd0da6b66ad..c611b6cb2e2 100644
--- a/mysql-test/suite/innodb/t/innodb-64k.test
+++ b/mysql-test/suite/innodb/t/innodb-64k.test
@@ -1,5 +1,5 @@
--source include/no_valgrind_without_big.inc
-# Tests for setting innodb-page-size=64k;
+# Tests for setting innodb-page-size=64k;
--source include/have_innodb.inc
--source include/have_innodb_64k.inc
@@ -8,16 +8,7 @@ call mtr.add_suppression("InnoDB: Resizing redo log from *");
call mtr.add_suppression("InnoDB: Starting to delete and rewrite log files.");
call mtr.add_suppression("InnoDB: New log files created, LSN=*");
---disable_query_log
let $MYSQLD_DATADIR= `select @@datadir`;
-# These values can change during the test
-let $innodb_file_format_orig = `SELECT @@innodb_file_format`;
-let $innodb_file_per_table_orig = `SELECT @@innodb_file_per_table`;
-let $innodb_strict_mode_orig = `SELECT @@session.innodb_strict_mode`;
---enable_query_log
-
-SET GLOBAL innodb_file_format = `Barracuda`;
-SET GLOBAL innodb_file_per_table = ON;
--echo # Test 1) Show the page size from Information Schema
SELECT variable_value FROM information_schema.global_status
@@ -29,6 +20,7 @@ SET SESSION innodb_strict_mode = ON;
# Redundant table; 32698 bytes
+# MDEV-11828 FIXME: The length must be less!
CREATE TABLE t1 (
c01 char(200), c02 char(200), c03 char(200), c04 char(200), c05 char(200),
c06 char(200), c07 char(200), c08 char(200), c09 char(200), c10 char(200),
@@ -432,9 +424,9 @@ CREATE INDEX xtc1c5 ON t1 (cc(767),dc(767));
CREATE INDEX xte1e5 ON t1 (ec(767),fc(767));
UPDATE t1 SET t=@e;
-# One more index and row size is too big
---replace_regex /> [0-9]*/> max_row_size/
---error ER_TOO_BIG_ROWSIZE
+# One more index and row size is too big (not any more!)
+#--replace_regex /> [0-9]*/> max_row_size/
+#--error ER_TOO_BIG_ROWSIZE
CREATE INDEX xt5k1f6 ON t1 (lc(767),mc(767));
SHOW CREATE TABLE t1;
SHOW WARNINGS;
@@ -712,12 +704,3 @@ COMMIT;
drop table t2;
DROP TABLE t1;
-#
-# restore environment to the state it was before this test execution
-#
-
---disable_query_log
-EVAL SET GLOBAL innodb_file_format = $innodb_file_format_orig;
-EVAL SET GLOBAL innodb_file_per_table = $innodb_file_per_table_orig;
-EVAL SET SESSION innodb_strict_mode = $innodb_strict_mode_orig;
---enable_query_log
diff --git a/mysql-test/suite/innodb/t/innodb-alter-discard.test b/mysql-test/suite/innodb/t/innodb-alter-discard.test
deleted file mode 100644
index 19ba7c3a3ca..00000000000
--- a/mysql-test/suite/innodb/t/innodb-alter-discard.test
+++ /dev/null
@@ -1,54 +0,0 @@
-#Bug#13955083 ALLOW IN-PLACE DDL OPERATIONS ON MISSING OR DISCARDED TABLESPACES
-
---source include/not_embedded.inc
---source include/have_innodb.inc
-
-call mtr.add_suppression("InnoDB: Cannot open datafile for read-only: .*");
-
-let $MYSQLD_DATADIR=`select @@datadir`;
-SET GLOBAL innodb_file_per_table=1;
-CREATE TABLE t(a INT)ENGINE=InnoDB;
-
-# Shut down the server
--- exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--- shutdown_server
--- source include/wait_until_disconnected.inc
-
-# Remove the tablespace file.
-let IBD=$MYSQLD_DATADIR/test/t.ibd;
-perl;
-unlink "$ENV{IBD}" || die "Unable to unlink $ENV{IBD}\n";
-EOF
-
-# Restart the server.
--- exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--- enable_reconnect
--- source include/wait_until_connected_again.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.");
-call mtr.add_suppression("InnoDB: If you are installing InnoDB, remember that you must create directories yourself, InnoDB does not create them.");
-call mtr.add_suppression("InnoDB: Cannot open datafile for read-only: './test/t.ibd' OS error: .*");
-call mtr.add_suppression("InnoDB: Ignoring tablespace `test/t` because it could not be opened.");
-call mtr.add_suppression("InnoDB: Cannot calculate statistics for table .* because the .ibd file is missing. Please refer to .*");
-call mtr.add_suppression("InnoDB: Error: trying to open a table, but could not$");
-call mtr.add_suppression("MySQL is trying to open a table handle but the \.ibd file for$");
-call mtr.add_suppression("InnoDB: Table 'test/t'$");
-call mtr.add_suppression("Could not find a valid tablespace file for");
-call mtr.add_suppression("InnoDB: Tablespace open failed for '\"test\"\.\"t\"', ignored");
-call mtr.add_suppression("InnoDB: Failed to find tablespace for table '\"test\"\.\"t\"' in the cache");
-call mtr.add_suppression("InnoDB: Cannot delete tablespace [0-9]+.*not found");
-call mtr.add_suppression("Table .*t in the InnoDB data dictionary has tablespace id .*, but tablespace with that id or name does not exist");
-
-# The ER_NO_SUCH_TABLE is being thrown by ha_innobase::open().
-# The table does exist, only the tablespace does not exist.
---error ER_NO_SUCH_TABLE_IN_ENGINE
-SELECT * FROM t;
-
---error ER_NO_SUCH_TABLE_IN_ENGINE
-ALTER TABLE t ADD INDEX (a), ALGORITHM=INPLACE;
---error ER_NO_SUCH_TABLE
-ALTER TABLE t1 ADD INDEX (a), ALGORITHM=COPY;
-
-ALTER TABLE t DISCARD TABLESPACE;
-DROP TABLE t;
diff --git a/mysql-test/suite/innodb/t/innodb-alter-tempfile.test b/mysql-test/suite/innodb/t/innodb-alter-tempfile.test
index e1e736fc678..ec1ea35f1cf 100644
--- a/mysql-test/suite/innodb/t/innodb-alter-tempfile.test
+++ b/mysql-test/suite/innodb/t/innodb-alter-tempfile.test
@@ -20,13 +20,6 @@
--echo # in-place ALTERs of the same table will not be blocked due to
--echo # temporary tablename.
-# As we intentionally crash below, there could be partially written
-# pages that are then recovered from the doublewrite buffer
-call mtr.add_suppression("InnoDB: Warning: database page corruption or a failed
-");
-call mtr.add_suppression("InnoDB: file read of space .* page .*");
-call mtr.add_suppression("InnoDB: Trying to recover it from the doublewrite buffer.");
-
let datadir= `select @@datadir`;
--let $_server_id= `SELECT @@server_id`
diff --git a/mysql-test/suite/innodb/t/innodb-bug-14068765.test b/mysql-test/suite/innodb/t/innodb-bug-14068765.test
index 185e8849e21..c2446e0fecf 100644
--- a/mysql-test/suite/innodb/t/innodb-bug-14068765.test
+++ b/mysql-test/suite/innodb/t/innodb-bug-14068765.test
@@ -1,17 +1,6 @@
-- source include/have_innodb.inc
---disable_warnings
-DROP TABLE IF EXISTS t1;
---enable_warnings
let MYSQLD_DATADIR =`SELECT @@datadir`;
-let $innodb_file_per_table = `SELECT @@innodb_file_per_table`;
-let $innodb_file_format = `SELECT @@innodb_file_format`;
-
-SET GLOBAL innodb_file_per_table = 1;
-SELECT @@innodb_file_per_table;
-
-#SET GLOBAL innodb_file_format = `Barracuda`;
-#SELECT @@innodb_file_format;
# Export/import on the same instance, with --innodb-file-per-table=1
CREATE DATABASE testdb_wl5522;
@@ -68,6 +57,3 @@ SELECT COUNT(*) FROM testdb_wl5522.t1;
DROP TABLE testdb_wl5522.t1;
DROP DATABASE testdb_wl5522;
-
-eval SET GLOBAL INNODB_FILE_FORMAT=$innodb_file_format;
-eval SET GLOBAL INNODB_FILE_PER_TABLE=$innodb_file_per_table;
diff --git a/mysql-test/suite/innodb/t/innodb-bug-14084530.test b/mysql-test/suite/innodb/t/innodb-bug-14084530.test
index 94a2d6b2252..f27fbbe31d7 100644
--- a/mysql-test/suite/innodb/t/innodb-bug-14084530.test
+++ b/mysql-test/suite/innodb/t/innodb-bug-14084530.test
@@ -1,15 +1,6 @@
-- source include/have_innodb.inc
---disable_warnings
-DROP TABLE IF EXISTS t1;
---enable_warnings
-
let MYSQLD_DATADIR =`SELECT @@datadir`;
-let $innodb_file_per_table = `SELECT @@innodb_file_per_table`;
-let $innodb_file_format = `SELECT @@innodb_file_format`;
-
-SET GLOBAL innodb_file_per_table = 1;
-SELECT @@innodb_file_per_table;
SET AUTOCOMMIT = 0;
@@ -45,8 +36,4 @@ ALTER TABLE testdb_wl5522.t1 IMPORT TABLESPACE;
CHECK TABLE testdb_wl5522.t1;
SELECT c1 FROM testdb_wl5522.t1;
-SET AUTOCOMMIT = 1;
-DROP TABLE testdb_wl5522.t1;
DROP DATABASE testdb_wl5522;
-eval SET GLOBAL INNODB_FILE_FORMAT=$innodb_file_format;
-eval SET GLOBAL INNODB_FILE_PER_TABLE=$innodb_file_per_table;
diff --git a/mysql-test/suite/innodb/t/innodb-fk-virtual.test b/mysql-test/suite/innodb/t/innodb-fk-virtual.test
new file mode 100644
index 00000000000..094fda35abb
--- /dev/null
+++ b/mysql-test/suite/innodb/t/innodb-fk-virtual.test
@@ -0,0 +1,61 @@
+--source include/have_innodb.inc
+
+#
+# MDEV-11850: Can't create foreign key referencing a virtual column
+#
+
+create or replace table a (
+ cola int(10) primary key,
+ v_cola int(10) as (cola mod 10) virtual,
+ p_cola int(10) as (cola mod 10) persistent
+) engine=innodb;
+
+create index v_cola on a (v_cola);
+create index p_cola on a (p_cola);
+
+create or replace table b(
+cola int(10),
+v_cola int(10),
+p_cola int(10),
+c_cola int(10) as (cola + 2) virtual
+) engine=innodb;
+
+alter table b add constraint `p_cola_fk`
+foreign key (p_cola) references a (p_cola)
+on delete restrict
+on update restrict;
+
+show warnings;
+show create table b;
+
+alter table b add constraint `v_cola_fk`
+foreign key (v_cola) references a (v_cola)
+on delete restrict
+on update restrict;
+
+show warnings;
+show create table b;
+
+alter table b add constraint `c_cola_fk`
+foreign key (c_cola) references a (cola)
+on delete restrict
+on update restrict;
+
+show warnings;
+show create table b;
+
+#
+# Test that fk really works
+#
+
+insert into a(cola) values (12);
+select * from a;
+insert into b(cola, v_cola, p_cola) values (10,2,2);
+select * from b;
+--error 1452
+insert into b(cola, v_cola, p_cola) values (10,1,1);
+--error 1451
+delete from a;
+select * from a;
+select * from b;
+drop table b, a;
diff --git a/mysql-test/suite/innodb/t/innodb-index.test b/mysql-test/suite/innodb/t/innodb-index.test
index 8598647de66..4549b3b6b47 100644
--- a/mysql-test/suite/innodb/t/innodb-index.test
+++ b/mysql-test/suite/innodb/t/innodb-index.test
@@ -1,15 +1,7 @@
-- source include/have_innodb.inc
-let $innodb_file_format_orig=`select @@innodb_file_format`;
-let $innodb_file_format_max_orig=`select @@innodb_file_format_max`;
-
let $MYSQLD_DATADIR= `select @@datadir`;
-let $per_table=`select @@innodb_file_per_table`;
-let $format=`select @@innodb_file_format`;
-set global innodb_file_per_table=on;
-set global innodb_file_format='Barracuda';
-
SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS;
# Bug#13654923 BOGUS DEBUG ASSERTION IN INDEX CREATION FOR ZERO-LENGTH RECORD
@@ -336,10 +328,6 @@ explain select * from t1;
explain select * from t1 order by a;
drop table t1;
-eval set global innodb_file_per_table=$per_table;
-eval set global innodb_file_format=$format;
-eval set global innodb_file_format_max=$format;
-
#
# Test to check whether CREATE INDEX handles implicit foreign key
# constraint modifications (Issue #70, Bug #38786)
@@ -558,8 +546,3 @@ show create table t2c;
--disable_info
DROP TABLE t1,t2,t2c,t2i;
-
---disable_query_log
-eval SET GLOBAL innodb_file_format=$innodb_file_format_orig;
-eval SET GLOBAL innodb_file_format_max=$innodb_file_format_max_orig;
---enable_query_log
diff --git a/mysql-test/suite/innodb/t/innodb-page_compression_bzip2.test b/mysql-test/suite/innodb/t/innodb-page_compression_bzip2.test
index 51493266a60..69a632d6010 100644
--- a/mysql-test/suite/innodb/t/innodb-page_compression_bzip2.test
+++ b/mysql-test/suite/innodb/t/innodb-page_compression_bzip2.test
@@ -2,14 +2,7 @@
-- source include/have_innodb_bzip2.inc
-- source include/not_embedded.inc
---disable_query_log
let $innodb_compression_algorithm_orig=`select @@innodb_compression_algorithm`;
-let $innodb_file_format_orig = `select @@innodb_file_format`;
-let $innodb_file_per_table_orig = `select @@innodb_file_per_table`;
---enable_query_log
-
-set global innodb_file_format = `barracuda`;
-set global innodb_file_per_table = on;
# bzip2
set global innodb_compression_algorithm = 5;
@@ -247,6 +240,4 @@ drop table innodb_page_compressed9;
# reset system
--disable_query_log
EVAL SET GLOBAL innodb_compression_algorithm = $innodb_compression_algorithm_orig;
-EVAL SET GLOBAL innodb_file_per_table = $innodb_file_per_table_orig;
-EVAL SET GLOBAL innodb_file_format = $innodb_file_format_orig;
--enable_query_log
diff --git a/mysql-test/suite/innodb/t/innodb-page_compression_lz4.test b/mysql-test/suite/innodb/t/innodb-page_compression_lz4.test
index f36ea9684e9..1b1df674e3c 100644
--- a/mysql-test/suite/innodb/t/innodb-page_compression_lz4.test
+++ b/mysql-test/suite/innodb/t/innodb-page_compression_lz4.test
@@ -2,14 +2,7 @@
-- source include/have_innodb_lz4.inc
-- source include/not_embedded.inc
---disable_query_log
let $innodb_compression_algorithm_orig=`SELECT @@innodb_compression_algorithm`;
-let $innodb_file_format_orig = `SELECT @@innodb_file_format`;
-let $innodb_file_per_table_orig = `SELECT @@innodb_file_per_table`;
---enable_query_log
-
-set global innodb_file_format = `barracuda`;
-set global innodb_file_per_table = on;
# lz4
set global innodb_compression_algorithm = 2;
@@ -248,6 +241,4 @@ drop table innodb_page_compressed9;
# reset system
--disable_query_log
EVAL SET GLOBAL innodb_compression_algorithm = $innodb_compression_algorithm_orig;
-EVAL SET GLOBAL innodb_file_per_table = $innodb_file_per_table_orig;
-EVAL SET GLOBAL innodb_file_format = $innodb_file_format_orig;
--enable_query_log
diff --git a/mysql-test/suite/innodb/t/innodb-page_compression_lzma.test b/mysql-test/suite/innodb/t/innodb-page_compression_lzma.test
index 6ea686bca04..9cec3e7a947 100644
--- a/mysql-test/suite/innodb/t/innodb-page_compression_lzma.test
+++ b/mysql-test/suite/innodb/t/innodb-page_compression_lzma.test
@@ -2,14 +2,7 @@
-- source include/have_innodb_lzma.inc
-- source include/not_embedded.inc
---disable_query_log
let $innodb_compression_algorithm_orig=`SELECT @@innodb_compression_algorithm`;
-let $innodb_file_format_orig = `SELECT @@innodb_file_format`;
-let $innodb_file_per_table_orig = `SELECT @@innodb_file_per_table`;
---enable_query_log
-
-set global innodb_file_format = `barracuda`;
-set global innodb_file_per_table = on;
# lzma
set global innodb_compression_algorithm = 4;
@@ -247,6 +240,4 @@ drop table innodb_page_compressed9;
# reset system
--disable_query_log
EVAL SET GLOBAL innodb_compression_algorithm = $innodb_compression_algorithm_orig;
-EVAL SET GLOBAL innodb_file_per_table = $innodb_file_per_table_orig;
-EVAL SET GLOBAL innodb_file_format = $innodb_file_format_orig;
--enable_query_log
diff --git a/mysql-test/suite/innodb/t/innodb-page_compression_lzo.test b/mysql-test/suite/innodb/t/innodb-page_compression_lzo.test
index 96ba18f5112..65c7e5dd3d9 100644
--- a/mysql-test/suite/innodb/t/innodb-page_compression_lzo.test
+++ b/mysql-test/suite/innodb/t/innodb-page_compression_lzo.test
@@ -2,15 +2,7 @@
-- source include/have_innodb_lzo.inc
-- source include/not_embedded.inc
-
---disable_query_log
let $innodb_compression_algorithm_orig=`select @@innodb_compression_algorithm`;
-let $innodb_file_format_orig = `select @@innodb_file_format`;
-let $innodb_file_per_table_orig = `select @@innodb_file_per_table`;
---enable_query_log
-
-set global innodb_file_format = `barracuda`;
-set global innodb_file_per_table = on;
# lzo
set global innodb_compression_algorithm = 3;
@@ -201,6 +193,4 @@ drop table innodb_page_compressed9;
# reset system
--disable_query_log
eval set global innodb_compression_algorithm = $innodb_compression_algorithm_orig;
-eval set global innodb_file_per_table = $innodb_file_per_table_orig;
-eval set global innodb_file_format = $innodb_file_format_orig;
--enable_query_log
diff --git a/mysql-test/suite/innodb/t/innodb-page_compression_snappy.test b/mysql-test/suite/innodb/t/innodb-page_compression_snappy.test
index 929f547b6ac..b90d15f1fa3 100644
--- a/mysql-test/suite/innodb/t/innodb-page_compression_snappy.test
+++ b/mysql-test/suite/innodb/t/innodb-page_compression_snappy.test
@@ -1,49 +1,42 @@
-- source include/have_innodb.inc
-- source include/have_innodb_snappy.inc
-call mtr.add_suppression("Compression failed for space*");
+call mtr.add_suppression("InnoDB: Compression failed for space.*");
---disable_query_log
let $innodb_compression_algorithm_orig=`select @@innodb_compression_algorithm`;
-let $innodb_file_format_orig = `select @@innodb_file_format`;
-let $innodb_file_per_table_orig = `select @@innodb_file_per_table`;
---enable_query_log
-
-set global innodb_file_format = `barracuda`;
-set global innodb_file_per_table = on;
# snappy
set global innodb_compression_algorithm = 6;
-create table innodb_compressed(c1 int, b char(20)) engine=innodb row_format=compressed key_block_size=8;
+create table innodb_compressed(c1 int, b char(200)) engine=innodb row_format=compressed key_block_size=8;
show warnings;
-create table innodb_normal (c1 int, b char(20)) engine=innodb;
+create table innodb_normal (c1 int, b char(200)) engine=innodb;
show warnings;
-create table innodb_page_compressed1 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=1;
+create table innodb_page_compressed1 (c1 int, b char(200)) engine=innodb page_compressed=1 page_compression_level=1;
show warnings;
show create table innodb_page_compressed1;
-create table innodb_page_compressed2 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=2;
+create table innodb_page_compressed2 (c1 int, b char(200)) engine=innodb page_compressed=1 page_compression_level=2;
show warnings;
show create table innodb_page_compressed2;
-create table innodb_page_compressed3 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=3;
+create table innodb_page_compressed3 (c1 int, b char(200)) engine=innodb page_compressed=1 page_compression_level=3;
show warnings;
show create table innodb_page_compressed3;
-create table innodb_page_compressed4 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=4;
+create table innodb_page_compressed4 (c1 int, b char(200)) engine=innodb page_compressed=1 page_compression_level=4;
show warnings;
show create table innodb_page_compressed4;
-create table innodb_page_compressed5 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=5;
+create table innodb_page_compressed5 (c1 int, b char(200)) engine=innodb page_compressed=1 page_compression_level=5;
show warnings;
show create table innodb_page_compressed5;
-create table innodb_page_compressed6 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=6;
+create table innodb_page_compressed6 (c1 int, b char(200)) engine=innodb page_compressed=1 page_compression_level=6;
show warnings;
show create table innodb_page_compressed6;
-create table innodb_page_compressed7 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=7;
+create table innodb_page_compressed7 (c1 int, b char(200)) engine=innodb page_compressed=1 page_compression_level=7;
show warnings;
show create table innodb_page_compressed7;
-create table innodb_page_compressed8 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=8;
+create table innodb_page_compressed8 (c1 int, b char(200)) engine=innodb page_compressed=1 page_compression_level=8;
show warnings;
show create table innodb_page_compressed8;
-create table innodb_page_compressed9 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=9;
+create table innodb_page_compressed9 (c1 int, b char(200)) engine=innodb page_compressed=1 page_compression_level=9;
show warnings;
show create table innodb_page_compressed9;
delimiter //;
@@ -52,7 +45,7 @@ begin
declare current_num int;
set current_num = 0;
while current_num < repeat_count do
- insert into innodb_normal values(current_num,'testing..');
+ insert into innodb_normal values(current_num,'aaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbccccccccccccccccccccccc');
set current_num = current_num + 1;
end while;
end//
@@ -248,6 +241,4 @@ drop table innodb_page_compressed9;
# reset system
--disable_query_log
EVAL SET GLOBAL innodb_compression_algorithm = $innodb_compression_algorithm_orig;
-EVAL SET GLOBAL innodb_file_per_table = $innodb_file_per_table_orig;
-EVAL SET GLOBAL innodb_file_format = $innodb_file_format_orig;
--enable_query_log
diff --git a/mysql-test/suite/innodb/t/innodb-page_compression_tables.test b/mysql-test/suite/innodb/t/innodb-page_compression_tables.test
index 3a241810bbc..be8300b39aa 100644
--- a/mysql-test/suite/innodb/t/innodb-page_compression_tables.test
+++ b/mysql-test/suite/innodb/t/innodb-page_compression_tables.test
@@ -1,14 +1,8 @@
--source include/have_innodb.inc
--source include/not_embedded.inc
---disable_query_log
let $innodb_compression_algorithm_orig=`SELECT @@innodb_compression_algorithm`;
-let $innodb_file_format_orig = `SELECT @@innodb_file_format`;
-let $innodb_file_per_table_orig = `SELECT @@innodb_file_per_table`;
---enable_query_log
-SET GLOBAL innodb_file_format = `Barracuda`;
-SET GLOBAL innodb_file_per_table = ON;
# zlib
set global innodb_compression_algorithm = 1;
@@ -75,8 +69,6 @@ update innodb_dynamic set c1 = c1 + 1;
select count(*) from innodb_compact where c1 < 1500000;
select count(*) from innodb_dynamic where c1 < 1500000;
-SET GLOBAL innodb_file_format = `Barracuda`;
-SET GLOBAL innodb_file_per_table = ON;
# none
set global innodb_compression_algorithm = 0;
@@ -112,6 +104,4 @@ SET SESSION innodb_compression_default = 0;
# reset system
--disable_query_log
EVAL SET GLOBAL innodb_compression_algorithm = $innodb_compression_algorithm_orig;
-EVAL SET GLOBAL innodb_file_per_table = $innodb_file_per_table_orig;
-EVAL SET GLOBAL innodb_file_format = $innodb_file_format_orig;
--enable_query_log
diff --git a/mysql-test/suite/innodb/t/innodb-page_compression_zip.test b/mysql-test/suite/innodb/t/innodb-page_compression_zip.test
index 67fafdb9e83..0c843314eee 100644
--- a/mysql-test/suite/innodb/t/innodb-page_compression_zip.test
+++ b/mysql-test/suite/innodb/t/innodb-page_compression_zip.test
@@ -1,14 +1,7 @@
--source include/have_innodb.inc
--source include/not_embedded.inc
---disable_query_log
let $innodb_compression_algorithm_orig=`SELECT @@innodb_compression_algorithm`;
-let $innodb_file_format_orig = `SELECT @@innodb_file_format`;
-let $innodb_file_per_table_orig = `SELECT @@innodb_file_per_table`;
---enable_query_log
-
-SET GLOBAL innodb_file_format = `Barracuda`;
-SET GLOBAL innodb_file_per_table = ON;
# zlib
set global innodb_compression_algorithm = 1;
@@ -198,6 +191,4 @@ drop table innodb_page_compressed9;
# reset system
--disable_query_log
EVAL SET GLOBAL innodb_compression_algorithm = $innodb_compression_algorithm_orig;
-EVAL SET GLOBAL innodb_file_per_table = $innodb_file_per_table_orig;
-EVAL SET GLOBAL innodb_file_format = $innodb_file_format_orig;
--enable_query_log
diff --git a/mysql-test/suite/innodb/t/innodb-trim.opt b/mysql-test/suite/innodb/t/innodb-trim.opt
new file mode 100644
index 00000000000..c33d075b002
--- /dev/null
+++ b/mysql-test/suite/innodb/t/innodb-trim.opt
@@ -0,0 +1 @@
+--loose-innodb-use-trim=1
diff --git a/mysql-test/suite/innodb/t/innodb-trim.test b/mysql-test/suite/innodb/t/innodb-trim.test
new file mode 100644
index 00000000000..0f38ea5ba84
--- /dev/null
+++ b/mysql-test/suite/innodb/t/innodb-trim.test
@@ -0,0 +1,54 @@
+--source include/have_innodb.inc
+--source include/have_innodb_punchhole.inc
+
+--disable_query_log
+--disable_warnings
+let $innodb_compression_algorithm_orig=`SELECT @@innodb_compression_algorithm`;
+--enable_warnings
+--enable_query_log
+
+# zlib
+set global innodb_compression_algorithm = 1;
+
+create table innodb_page_compressed (c1 int not null primary key auto_increment, b char(200), c char(200), d char(200)) engine=innodb page_compressed=1 page_compression_level=9;
+show warnings;
+
+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_page_compressed values (NULL,repeat('A',150),repeat('AB',75),repeat('B', 175));
+ set current_num = current_num + 1;
+ end while;
+end//
+delimiter ;//
+commit;
+
+set autocommit=0;
+call innodb_insert_proc(16000);
+commit;
+set autocommit=1;
+
+
+let $success= `SELECT variable_value FROM information_schema.global_status WHERE variable_name = 'innodb_num_page_compressed_trim_op'`;
+
+if (!$success) {
+--disable_query_log
+--disable_result_log
+ DROP PROCEDURE innodb_insert_proc;
+ DROP TABLE innodb_page_compressed;
+--enable_query_log
+--enable_result_log
+ --skip "Test requires TRIM";
+}
+
+DROP PROCEDURE innodb_insert_proc;
+DROP TABLE innodb_page_compressed;
+
+--disable_query_log
+--disable_warnings
+EVAL SET GLOBAL innodb_compression_algorithm = $innodb_compression_algorithm_orig;
+--enable_warnings
+--enable_query_log
diff --git a/mysql-test/suite/innodb/t/innodb-wl5522-1.test b/mysql-test/suite/innodb/t/innodb-wl5522-1.test
index 6c2607effe8..0d59df11c44 100644
--- a/mysql-test/suite/innodb/t/innodb-wl5522-1.test
+++ b/mysql-test/suite/innodb/t/innodb-wl5522-1.test
@@ -5,30 +5,15 @@
call mtr.add_suppression("InnoDB: Unable to import tablespace .* because it already exists. Please DISCARD the tablespace before IMPORT.");
---disable_warnings
-DROP TABLE IF EXISTS t1;
---enable_warnings
-
let MYSQLD_DATADIR =`SELECT @@datadir`;
-let $innodb_file_per_table = `SELECT @@innodb_file_per_table`;
-let $innodb_file_format = `SELECT @@innodb_file_format`;
-
-SET GLOBAL innodb_file_per_table = 1;
-SELECT @@innodb_file_per_table;
-
-SET GLOBAL innodb_file_format = `Barracuda`;
-SELECT @@innodb_file_format;
-
-let $MYSQLD_DATADIR = `SELECT @@datadir`;
# Following testcases are created from JET cases (where import
# export instance are differnt server )
# Here test will be run on same import and export instance.
-DROP DATABASE IF EXISTS testdb_wl5522;
CREATE DATABASE testdb_wl5522;
-# case 1
+# case 1
CREATE TABLE testdb_wl5522.t1 (c1 INT ) ENGINE = Innodb;
INSERT INTO testdb_wl5522.t1 VALUES (1),(123),(331);
SELECT c1 FROM testdb_wl5522.t1;
@@ -57,43 +42,43 @@ ALTER TABLE testdb_wl5522.t1 IMPORT TABLESPACE;
SELECT * FROM testdb_wl5522.t1 ORDER BY c1;
DROP TABLE testdb_wl5522.t1;
-# case 2
+# case 2
CREATE TABLE testdb_wl5522.t1 (
col1 BIT(1),
col2 BOOLEAN,
col3 TINYINT,
-col4 SMALLINT,
+col4 SMALLINT,
col5 MEDIUMINT,
col6 INT,
-col7 BIGINT,
+col7 BIGINT,
col8 FLOAT (14,3) ,
-col9 DOUBLE (14,3),
-col10 VARCHAR(20),
+col9 DOUBLE (14,3),
+col10 VARCHAR(20),
col11 TEXT ,
col12 ENUM('a','b','c'),
col13 TEXT,
-col14 CHAR(20) ,
-col15 VARBINARY (400) ,
-col16 BINARY(40),
-col17 BLOB (400) ,
+col14 CHAR(20),
+col15 VARBINARY (400),
+col16 BINARY(40),
+col17 BLOB (400),
col18 INT NOT NULL PRIMARY KEY,
-col19 DATE ,
-col20 DATETIME ,
-col21 TIMESTAMP ,
-col22 TIME ,
+col19 DATE,
+col20 DATETIME,
+col21 TIMESTAMP,
+col22 TIME,
col23 YEAR ) ENGINE = Innodb;
CREATE INDEX idx1 ON testdb_wl5522.t1(col18);
CREATE INDEX prefix_idx ON testdb_wl5522.t1(col14 (10));
CREATE UNIQUE INDEX idx2 ON testdb_wl5522.t1(col12);
CREATE UNIQUE INDEX idx3 ON testdb_wl5522.t1(col8);
-INSERT INTO testdb_wl5522.t1 VALUES
+INSERT INTO testdb_wl5522.t1 VALUES
(1,1,-128,32767,-8388608,2147483647,-9223372036854775808, 92233720368.222,
-92233720368.222,'aaa', + 'aaaaaaaaaa','b','bbbbb','ccccc',
REPEAT('d',40),REPEAT('d',40),REPEAT('d',40),1,'1000-01-01',
'3000-12-31 23:59:59.99','1990-01-01 00:00:01.00',
'01:59:59.00','1901');
-INSERT INTO testdb_wl5522.t1 VALUES
+INSERT INTO testdb_wl5522.t1 VALUES
(NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
NULL,NULL,NULL,3,NULL,NULL,NULL,NULL,NULL);
--error 1048
@@ -136,7 +121,7 @@ col18 INT NOT NULL PRIMARY KEY,
col19 DATE ,
col20 DATETIME ,
col21 TIMESTAMP ,
-col22 TIME ,
+col22 TIME,
col23 YEAR ) ENGINE = Innodb;
CREATE INDEX idx1 ON testdb_wl5522.t1(col18);
@@ -162,8 +147,6 @@ DROP TABLE testdb_wl5522.t1;
# case 3 - with blob objects
-SET GLOBAL innodb_file_format='Barracuda';
-
CREATE TABLE testdb_wl5522.t1 (
col_1_varbinary VARBINARY (4000) ,
col_2_varchar VARCHAR (4000),
@@ -178,13 +161,13 @@ INSERT INTO testdb_wl5522.t1 VALUES(
REPEAT('a', 4000),REPEAT('o', 4000),REPEAT('a', 4000), REPEAT('o', 4000),
REPEAT('a', 4000),REPEAT('a', 4000),REPEAT('a', 255));
-SELECT col_1_varbinary = REPEAT("a", 4000) ,
+SELECT col_1_varbinary = REPEAT("a", 4000),
col_2_varchar = REPEAT("o", 4000) ,
col_3_text = REPEAT("a", 4000) ,
col_4_blob = REPEAT("o", 4000) ,
col_5_text = REPEAT("a", 4000) ,
col_6_varchar = REPEAT("a", 4000) ,
-col_7_binary = REPEAT("a", 255)
+col_7_binary = REPEAT("a", 255)
FROM testdb_wl5522.t1;
FLUSH TABLES testdb_wl5522.t1 FOR EXPORT;
@@ -223,7 +206,7 @@ col_3_text = REPEAT("a", 4000) ,
col_4_blob = REPEAT("o", 4000) ,
col_5_text = REPEAT("a", 4000) ,
col_6_varchar = REPEAT("a", 4000) ,
-col_7_binary = REPEAT("a", 255)
+col_7_binary = REPEAT("a", 255)
FROM testdb_wl5522.t1;
DROP TABLE testdb_wl5522.t1;
@@ -231,7 +214,7 @@ DROP TABLE testdb_wl5522.t1;
# case 4 - trasportable tablesace with autoincrement
CREATE TABLE testdb_wl5522.t1 (
col_1_int INT AUTO_INCREMENT,
-col_2_varchar VARCHAR (20),
+col_2_varchar VARCHAR (20),
PRIMARY KEY (col_1_int)) ENGINE = Innodb;
INSERT INTO testdb_wl5522.t1 VALUES (1,'a1'),(2,'a2'),(3,'a3');
@@ -268,7 +251,7 @@ SELECT * FROM testdb_wl5522.t1 ORDER BY col_1_int;
# error on inserting duplicate value
--error 1062
INSERT INTO testdb_wl5522.t1 VALUES (1,'a1');
-# insert new values
+# insert new values
INSERT INTO testdb_wl5522.t1(col_2_varchar) VALUES ('a101'),('a102'),('a103');
SELECT * FROM testdb_wl5522.t1 ORDER BY col_1_int;
# check table can be altered
@@ -284,7 +267,7 @@ PRIMARY KEY (col_2_varchar)) ENGINE = Innodb;
CREATE TABLE testdb_wl5522.t1_fk (
col_1_int INT,col_2_varchar VARCHAR (20),
-PRIMARY KEY (col_1_int),
+PRIMARY KEY (col_1_int),
FOREIGN KEY (col_2_varchar) REFERENCES testdb_wl5522.t1(col_2_varchar)
) ENGINE = Innodb;
@@ -452,7 +435,7 @@ UNLOCK TABLES;
DROP TABLE testdb_wl5522.t1;
-# create table with incorrect schema
+# create table with incorrect schema
CREATE TABLE testdb_wl5522.t1 ( i bigint) ENGINE = Innodb;
ALTER TABLE testdb_wl5522.t1 DISCARD TABLESPACE;
@@ -820,14 +803,14 @@ SET AUTOCOMMIT = 1;
CREATE TABLE testdb_wl5522.t1(col1 bit(1) ,
col2 boolean,col3 tinyint , col4 smallint ,
-col5 mediumint ,col6 int , col7 bigint ,
+col5 mediumint ,col6 int , col7 bigint ,
col8 float (14,3) ,col9 double (14,3),
col10 VARCHAR(20) CHARACTER SET utf8 ,
col11 TEXT CHARACTER SET binary ,
col12 ENUM('a','b','c') CHARACTER SET binary,
col13 TEXT CHARACTER SET latin1 COLLATE latin1_general_cs ,
col14 CHAR(20) , col15 VARBINARY (400),
-col16 BINARY(40), col17 BLOB (400),
+col16 BINARY(40), col17 BLOB (400),
col18 int not null primary key,
col19 DATE ,col20 DATETIME , col21 TIMESTAMP ,
col22 TIME , col23 YEAR ) ENGINE = Innodb;
@@ -835,7 +818,7 @@ col22 TIME , col23 YEAR ) ENGINE = Innodb;
# table for trigger action
CREATE TABLE testdb_wl5522.trigger_table ( i int ) ENGINE = Innodb;
# define trigger
-CREATE TRIGGER testdb_wl5522.tri AFTER INSERT ON testdb_wl5522.t1
+CREATE TRIGGER testdb_wl5522.tri AFTER INSERT ON testdb_wl5522.t1
FOR EACH ROW INSERT INTO testdb_wl5522.trigger_table VALUES(NEW.col18);
# define view
CREATE OR REPLACE VIEW testdb_wl5522.VW1 AS SELECT * FROM testdb_wl5522.t1;
@@ -917,7 +900,7 @@ SELECT COUNT(*) FROM testdb_wl5522.t1;
SELECT * FROM testdb_wl5522.trigger_table;
SELECT COUNT(*) FROM testdb_wl5522.VW1;
-# trigger table is not updated as trigger got dropped
+# trigger table is not updated as trigger got dropped
INSERT INTO testdb_wl5522.t1(col18) VALUES (5);
# validate data in table not updated
SELECT * FROM testdb_wl5522.trigger_table;
@@ -949,6 +932,3 @@ call mtr.add_suppression("InnoDB: The table .* doesn't have a corresponding tabl
--remove_file $MYSQLTEST_VARDIR/tmp/t1.ibd
--remove_file $MYSQLTEST_VARDIR/tmp/t1_fk.cfg
--remove_file $MYSQLTEST_VARDIR/tmp/t1_fk.ibd
-
-eval SET GLOBAL INNODB_FILE_FORMAT=$innodb_file_format;
-eval SET GLOBAL INNODB_FILE_PER_TABLE=$innodb_file_per_table;
diff --git a/mysql-test/suite/innodb/t/innodb-wl5522-debug-zip.test b/mysql-test/suite/innodb/t/innodb-wl5522-debug-zip.test
index 1f15c81b90b..2858fa7c8e1 100644
--- a/mysql-test/suite/innodb/t/innodb-wl5522-debug-zip.test
+++ b/mysql-test/suite/innodb/t/innodb-wl5522-debug-zip.test
@@ -19,30 +19,16 @@
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: Error: Tablespace flags .* corrupted unused .*");
-call mtr.add_suppression("InnoDB: Tablespace flags: .* corrupted in file: .* ");
call mtr.add_suppression("InnoDB: Page 0 at offset 0 looks corrupted in file .*");
-call mtr.add_suppression("InnoDB: Page for tablespace .* ");
-flush tables;
+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 $innodb_file_per_table = `SELECT @@innodb_file_per_table`;
-let $innodb_file_format = `SELECT @@innodb_file_format`;
-let $innodb_strict_mode_orig=`select @@session.innodb_strict_mode`;
let $pathfix=/: '.*test_wl5522.*t1.ibd'/: 'test_wl5522_t1.ibd'/;
-SET GLOBAL innodb_file_per_table = 1;
-SELECT @@innodb_file_per_table;
-
-SET GLOBAL innodb_file_format = `Barracuda`;
-SELECT @@innodb_file_format;
-
SET SESSION innodb_strict_mode=1;
-SELECT @@SESSION.innodb_strict_mode;
-
-
-DROP DATABASE IF EXISTS test_wl5522;
CREATE DATABASE test_wl5522;
# Create the table that we will use for crash recovery (during IMPORT)
@@ -140,14 +126,7 @@ SET SESSION debug_dbug="-d,ib_import_before_checkpoint_crash";
DROP TABLE test_wl5522.t1;
-SET GLOBAL innodb_file_per_table = 1;
-SELECT @@innodb_file_per_table;
-
-SET GLOBAL innodb_file_format = `Barracuda`;
-SELECT @@innodb_file_format;
-
SET SESSION innodb_strict_mode=1;
-SELECT @@SESSION.innodb_strict_mode;
CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb
ROW_FORMAT=COMPRESSED;
@@ -755,7 +734,3 @@ call mtr.add_suppression("Could not find a valid tablespace file for 'test_wl552
#cleanup
--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;
-eval SET GLOBAL INNODB_FILE_FORMAT=$innodb_file_format;
-eval SET SESSION innodb_strict_mode=$innodb_strict_mode_orig;
diff --git a/mysql-test/suite/innodb/t/innodb-wl5522-debug.test b/mysql-test/suite/innodb/t/innodb-wl5522-debug.test
index e537f5c0fc3..6a94c73e622 100644
--- a/mysql-test/suite/innodb/t/innodb-wl5522-debug.test
+++ b/mysql-test/suite/innodb/t/innodb-wl5522-debug.test
@@ -19,13 +19,13 @@ call mtr.add_suppression("InnoDB: Operating system error number .* in a file ope
call mtr.add_suppression("InnoDB: The error means the system cannot find the path specified.");
call mtr.add_suppression("InnoDB: If you are installing InnoDB, remember that you must create directories yourself, InnoDB does not create them.");
call mtr.add_suppression("InnoDB: Cannot open datafile for read-only: .*");
-call mtr.add_suppression("InnoDB: Tablespace flags: .*");
call mtr.add_suppression("InnoDB: Ignoring tablespace .* because it could not be opened.");
call mtr.add_suppression("InnoDB: Tablespace for table .* is set as discarded.");
call mtr.add_suppression("InnoDB: Cannot calculate statistics for table .*");
-call mtr.add_suppression("InnoDB: Page 0 at offset 0 looks corrupted in file .*");
-call mtr.add_suppression("InnoDB: Page for tablespace .* ");
-flush tables;
+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=");
+FLUSH TABLES;
let MYSQLD_DATADIR =`SELECT @@datadir`;
let $innodb_file_per_table = `SELECT @@innodb_file_per_table`;
diff --git a/mysql-test/suite/innodb/t/innodb-wl5522-zip.test b/mysql-test/suite/innodb/t/innodb-wl5522-zip.test
index 395e4def85d..4181b52573c 100644
--- a/mysql-test/suite/innodb/t/innodb-wl5522-zip.test
+++ b/mysql-test/suite/innodb/t/innodb-wl5522-zip.test
@@ -9,22 +9,7 @@
call mtr.add_suppression("InnoDB: Unable to import tablespace .* because it already exists. Please DISCARD the tablespace before IMPORT.");
---disable_warnings
-DROP TABLE IF EXISTS t1;
---enable_warnings
-
-let $innodb_file_per_table = `SELECT @@innodb_file_per_table`;
-let $innodb_file_format = `SELECT @@innodb_file_format`;
-let $innodb_strict_mode_orig=`select @@session.innodb_strict_mode`;
-
-SET GLOBAL innodb_file_per_table = 1;
-SELECT @@innodb_file_per_table;
-
-SET GLOBAL innodb_file_format = `Barracuda`;
-SELECT @@innodb_file_format;
-
SET SESSION innodb_strict_mode=1;
-SELECT @@SESSION.innodb_strict_mode;
let $MYSQLD_TMPDIR = `SELECT @@tmpdir`;
let $MYSQLD_DATADIR = `SELECT @@datadir`;
@@ -87,15 +72,8 @@ DROP TABLE t1;
--remove_file $MYSQLD_TMPDIR/t1.cfg
--remove_file $MYSQLD_TMPDIR/t1.ibd
-SET GLOBAL innodb_file_per_table = 1;
-SELECT @@innodb_file_per_table;
-
-SET GLOBAL innodb_file_format = `Barracuda`;
-SELECT @@innodb_file_format;
-
# restore session variable
SET SESSION innodb_strict_mode=1;
-SELECT @@SESSION.innodb_strict_mode;
let MYSQLD_DATADIR =`SELECT @@datadir`;
@@ -218,7 +196,7 @@ DROP TABLE t1;
# table and restore, this time the table has a secondary index too.
CREATE TABLE t1(
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
- c2 INT, INDEX(c2)) ENGINE=InnoDB
+ c2 INT, INDEX(c2)) ENGINE=InnoDB
ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8;
INSERT INTO t1(c2) VALUES(1);
@@ -540,7 +518,3 @@ call mtr.add_suppression("InnoDB: The table .* doesn't have a corresponding tabl
# cleanup
--remove_file $MYSQLTEST_VARDIR/tmp/t1.cfg
--remove_file $MYSQLTEST_VARDIR/tmp/t1.ibd
-
-eval SET GLOBAL INNODB_FILE_FORMAT=$innodb_file_format;
-eval SET GLOBAL INNODB_FILE_PER_TABLE=$innodb_file_per_table;
-eval SET SESSION innodb_strict_mode=$innodb_strict_mode_orig;
diff --git a/mysql-test/suite/innodb/t/innodb-wl5522.test b/mysql-test/suite/innodb/t/innodb-wl5522.test
index b04c726b74a..d2b6fca4d4a 100644
--- a/mysql-test/suite/innodb/t/innodb-wl5522.test
+++ b/mysql-test/suite/innodb/t/innodb-wl5522.test
@@ -4,19 +4,7 @@
-- source include/have_innodb.inc
call mtr.add_suppression("InnoDB: Unable to import tablespace .* because it already exists. Please DISCARD the tablespace before IMPORT.");
-
---disable_warnings
-DROP TABLE IF EXISTS t1;
---enable_warnings
-
-let $innodb_file_per_table = `SELECT @@innodb_file_per_table`;
-let $innodb_file_format = `SELECT @@innodb_file_format`;
-
-SET GLOBAL innodb_file_per_table = 1;
-SELECT @@innodb_file_per_table;
-
-SET GLOBAL innodb_file_format = `Barracuda`;
-SELECT @@innodb_file_format;
+FLUSH TABLES;
let $MYSQLD_TMPDIR = `SELECT @@tmpdir`;
let $MYSQLD_DATADIR = `SELECT @@datadir`;
@@ -80,12 +68,6 @@ DROP TABLE t1;
--remove_file $MYSQLD_TMPDIR/t1.cfg
--remove_file $MYSQLD_TMPDIR/t1.ibd
-SET GLOBAL innodb_file_per_table = 1;
-SELECT @@innodb_file_per_table;
-
-SET GLOBAL innodb_file_format = `Barracuda`;
-SELECT @@innodb_file_format;
-
let MYSQLD_DATADIR =`SELECT @@datadir`;
# Try importing when tablespace already exists
@@ -877,10 +859,8 @@ 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: The table .* doesn't have a corresponding tablespace, it was discarded");
+FLUSH TABLES;
# cleanup
--remove_file $MYSQLTEST_VARDIR/tmp/t1.cfg
--remove_file $MYSQLTEST_VARDIR/tmp/t1.ibd
-
-eval SET GLOBAL INNODB_FILE_FORMAT=$innodb_file_format;
-eval SET GLOBAL INNODB_FILE_PER_TABLE=$innodb_file_per_table;
diff --git a/mysql-test/suite/innodb/t/innodb_blob_truncate.test b/mysql-test/suite/innodb/t/innodb_blob_truncate.test
index 8a4248c795e..3e54ec80e2b 100644
--- a/mysql-test/suite/innodb/t/innodb_blob_truncate.test
+++ b/mysql-test/suite/innodb/t/innodb_blob_truncate.test
@@ -1,14 +1,6 @@
--source include/have_innodb.inc
--source include/have_innodb_16k.inc
---disable_query_log
-let $innodb_file_format_orig = `SELECT @@innodb_file_format`;
-let $innodb_file_per_table_orig = `SELECT @@innodb_file_per_table`;
---enable_query_log
-
-SET GLOBAL innodb_file_format = `Barracuda`;
-SET GLOBAL innodb_file_per_table = ON;
-
create table t1(a blob) engine=innodb key_block_size=8;
delimiter //;
create function generate_blob()
@@ -38,8 +30,3 @@ if ($x) {
}
drop table t1;
drop function generate_blob;
-
---disable_query_log
-EVAL SET GLOBAL innodb_file_per_table = $innodb_file_per_table_orig;
-EVAL SET GLOBAL innodb_file_format = $innodb_file_format_orig;
---enable_query_log
diff --git a/mysql-test/suite/innodb/t/innodb_bug59641.test b/mysql-test/suite/innodb/t/innodb_bug59641.test
index bca3f4a92c1..5f7528cf01a 100644
--- a/mysql-test/suite/innodb/t/innodb_bug59641.test
+++ b/mysql-test/suite/innodb/t/innodb_bug59641.test
@@ -2,11 +2,11 @@
# Bug #59641 Prepared XA transaction causes shutdown hang after a crash
-- source include/not_embedded.inc
-# The server would issue this warning on restart.
-call mtr.add_suppression("Found 3 prepared XA transactions");
-# Close tables used by other tests (to not get crashed myisam tables)
-flush tables;
+--disable_query_log
+call mtr.add_suppression("Found 3 prepared XA transactions");
+FLUSH TABLES;
+--enable_query_log
CREATE TABLE t(a INT PRIMARY KEY, b INT)ENGINE=InnoDB;
INSERT INTO t VALUES(2,2),(4,4),(8,8),(16,16),(32,32);
@@ -17,7 +17,6 @@ XA END '123';
XA PREPARE '123';
CONNECT (con1,localhost,root,,);
-CONNECTION con1;
XA START '456';
INSERT INTO t VALUES(3,47),(5,67);
@@ -26,7 +25,6 @@ XA END '456';
XA PREPARE '456';
CONNECT (con2,localhost,root,,);
-CONNECTION con2;
XA START '789';
UPDATE t SET b=4*a WHERE a=32;
@@ -34,30 +32,13 @@ XA END '789';
XA PREPARE '789';
CONNECT (con3,localhost,root,,);
-CONNECTION con3;
-# Kill the server without sending a shutdown command
--- exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--- shutdown_server 0
--- source include/wait_until_disconnected.inc
-
-# Restart the server.
--- exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--- enable_reconnect
--- source include/wait_until_connected_again.inc
+--source include/kill_and_restart_mysqld.inc
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
SELECT * FROM t;
COMMIT;
-# Shut down the server. This would hang because of the bug.
--- exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--- shutdown_server
--- source include/wait_until_disconnected.inc
-
-# Restart the server.
--- exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--- enable_reconnect
--- source include/wait_until_connected_again.inc
+--source include/restart_mysqld.inc
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
SELECT * FROM t;
diff --git a/mysql-test/suite/innodb/t/innodb_prefix_index_restart_server.test b/mysql-test/suite/innodb/t/innodb_prefix_index_restart_server.test
index adae10df2ad..7fb4037e6bb 100644
--- a/mysql-test/suite/innodb/t/innodb_prefix_index_restart_server.test
+++ b/mysql-test/suite/innodb/t/innodb_prefix_index_restart_server.test
@@ -16,20 +16,10 @@
# which is not there with embedded mode
--source include/not_embedded.inc
# Save innodb variables
-let $innodb_file_format_orig=`select @@innodb_file_format`;
-let $innodb_file_per_table_orig=`select @@innodb_file_per_table`;
let $innodb_large_prefix_orig=`select @@innodb_large_prefix`;
-# Set Innodb file format as feature works for Barracuda file format
-set global innodb_file_format="Barracuda";
-set global innodb_file_per_table=1;
set global innodb_large_prefix=1;
--- disable_warnings
-DROP TABLE IF EXISTS worklog5743;
--- enable_warnings
-
-
#------------------------------------------------------------------------------
# Stop the server in between when prefix index are created and see if state is
# correct when server is restarted.
@@ -111,6 +101,4 @@ DROP TABLE worklog5743;
#------------------------------------------------------------------------------
-eval SET GLOBAL innodb_file_format=$innodb_file_format_orig;
-eval SET GLOBAL innodb_file_per_table=$innodb_file_per_table_orig;
eval SET GLOBAL innodb_large_prefix=$innodb_large_prefix_orig;
diff --git a/mysql-test/suite/innodb/t/log_alter_table.test b/mysql-test/suite/innodb/t/log_alter_table.test
new file mode 100644
index 00000000000..f479c6695aa
--- /dev/null
+++ b/mysql-test/suite/innodb/t/log_alter_table.test
@@ -0,0 +1,51 @@
+--source include/have_innodb.inc
+--source include/have_debug.inc
+
+# Embedded server does not support crashing
+--source include/not_embedded.inc
+
+--echo #
+--echo # Bug#21801423 INNODB REDO LOG DOES NOT INDICATE WHEN
+--echo # FILES ARE CREATED
+--echo #
+--echo # Bug#21796691 INNODB REDO LOG DOES NOT INDICATE WHEN
+--echo # REDO LOGGING IS SKIPPED
+--echo #
+--source include/no_checkpoint_start.inc
+CREATE TABLE t1 (a INT NOT NULL, b INT UNIQUE) ENGINE=InnoDB;
+# MLOG_INDEX_LOAD will not be emitted for empty tables. Insert a row.
+INSERT INTO t1 VALUES (1,2);
+# We should get two MLOG_INDEX_LOAD for this.
+ALTER TABLE t1 ADD PRIMARY KEY(a), ALGORITHM=INPLACE;
+# And one MLOG_INDEX_LOAD for this.
+ALTER TABLE t1 DROP INDEX b, ADD INDEX (b);
+
+--let CLEANUP_IF_CHECKPOINT=DROP TABLE t1;
+--source include/no_checkpoint_end.inc
+
+--let $restart_parameters= --debug=d,ib_log
+--source include/start_mysqld.inc
+
+let SEARCH_RANGE = -50000;
+let SEARCH_FILE = $MYSQLTEST_VARDIR/log/mysqld.1.err;
+let SEARCH_ABORT=NOT FOUND;
+# Look for at least one MLOG_FILE_CREATE2 in the error log.
+# Theoretically, it may have been written by this test or an earlier test.
+# FIXME: redirect the error log of the restart to a new file,
+# and ensure that we have exactly 2 records there.
+let SEARCH_PATTERN=scan .*: multi-log rec MLOG_FILE_CREATE2.*page .*:0;
+--source include/search_pattern_in_file.inc
+# Look for at least one MLOG_INDEX_LOAD in the error log.
+# Theoretically, it may have been written by this test or an earlier test.
+# FIXME: redirect the error log of the restart to a new file,
+# and ensure that we have exactly 3 records there.
+let SEARCH_PATTERN=scan .*: log rec MLOG_INDEX_LOAD;
+--source include/search_pattern_in_file.inc
+
+CHECK TABLE t1;
+
+# Remove the --debug=d,ib_log setting.
+--let $restart_parameters=
+--source include/restart_mysqld.inc
+
+DROP TABLE t1;
diff --git a/mysql-test/suite/innodb/t/log_corruption.test b/mysql-test/suite/innodb/t/log_corruption.test
new file mode 100644
index 00000000000..664894f2c41
--- /dev/null
+++ b/mysql-test/suite/innodb/t/log_corruption.test
@@ -0,0 +1,149 @@
+--source include/have_unzip.inc
+--source include/have_innodb.inc
+--source include/have_innodb_16k.inc
+
+let bugdir= $MYSQLTEST_VARDIR/tmp/log_corruption;
+--mkdir $bugdir
+--let SEARCH_RANGE = -50000
+--let SEARCH_FILE = $bugdir/my_restart.err
+--let SEARCH_ABORT=NOT FOUND
+--let $args=--defaults-file=$bugdir/my.cnf --loose-console >> $SEARCH_FILE 2>&1
+
+perl;
+die unless open IN, "<", "$ENV{MYSQLTEST_VARDIR}/my.cnf";
+my $found;
+while (<IN>) { $found=$1 if /^(lc-messages-dir=.*)/ }
+close IN;
+
+die unless defined $found;
+die unless open OUT, ">", "$ENV{bugdir}/my.cnf";
+print OUT "[mysqld]
+$found
+innodb_data_home_dir = $ENV{bugdir}
+datadir = $ENV{bugdir}
+secure_file_priv=
+skip_aria
+core_file
+";
+EOF
+
+--echo # redo log from before MySQL 5.7.9
+--exec unzip $MTR_SUITE_DIR/std_data/log_corruption.zip -d $bugdir > $SEARCH_FILE
+--error 1
+--exec $MYSQLD $args
+let SEARCH_PATTERN=InnoDB: Upgrade after a crash is not supported. This redo log was created before MySQL 5\\.7\\.9\\.;
+--source include/search_pattern_in_file.inc
+
+--echo # redo log from before MySQL 5.7.9, with corrupted log checkpoint
+--remove_file $bugdir/ib_logfile0
+--copy_file $bugdir/ib_logfile1 $bugdir/ib_logfile0
+--error 1
+--exec $MYSQLD $args
+let SEARCH_PATTERN=InnoDB: Upgrade after a crash is not supported. This redo log was created before MySQL 5\\.7\\.9, and we did not find a valid checkpoint;
+--source include/search_pattern_in_file.inc
+
+--echo # redo log from before MySQL 5.7.9, with corrupted log block
+--remove_file $bugdir/ib_logfile0
+--exec unzip $MTR_SUITE_DIR/std_data/log_corruption0.zip -d $bugdir > $SEARCH_FILE
+--error 1
+--exec $MYSQLD $args
+let SEARCH_PATTERN=InnoDB: Upgrade after a crash is not supported. This redo log was created before MySQL 5\\.7\\.9, and it appears corrupted;
+--source include/search_pattern_in_file.inc
+
+--echo # redo log from "after" MySQL 5.7.9, but with invalid header checksum
+--remove_file $bugdir/ib_logfile0
+--exec unzip $MTR_SUITE_DIR/std_data/log_corruption1.zip -d $bugdir > $SEARCH_FILE
+--error 1
+--exec $MYSQLD $args
+let SEARCH_PATTERN=InnoDB: Invalid redo log header checksum;
+--source include/search_pattern_in_file.inc
+
+--echo # distant future redo log format, with valid header checksum
+--remove_file $bugdir/ib_logfile0
+--exec unzip $MTR_SUITE_DIR/std_data/log_corruption2.zip -d $bugdir > $SEARCH_FILE
+--error 1
+--exec $MYSQLD $args
+let SEARCH_PATTERN=InnoDB: Unsupported redo log format. The redo log was created with malicious intentions, or perhaps\. Please follow the instructions at http://dev.mysql.com/doc/refman/5.7/en/upgrading-downgrading.html;
+--source include/search_pattern_in_file.inc
+
+--echo # valid header, but old-format checkpoint blocks
+--remove_file $bugdir/ib_logfile0
+--exec unzip $MTR_SUITE_DIR/std_data/log_corruption3.zip -d $bugdir > $SEARCH_FILE
+--error 1
+--exec $MYSQLD $args
+let SEARCH_PATTERN=InnoDB: No valid checkpoint found .corrupted redo log;
+--source include/search_pattern_in_file.inc
+
+--echo # valid header, valid checkpoint 1, all-zero (invalid) checkpoint 2, invalid block checksum
+--remove_file $bugdir/ib_logfile0
+--exec unzip $MTR_SUITE_DIR/std_data/log_corruption4.zip -d $bugdir > $SEARCH_FILE
+# Anything below innodb_force_recovery=6 must find a valid redo log.
+# Missing tablespace files are tolerated already with innodb_force_recovery=1.
+--error 1
+--exec $MYSQLD $args --innodb-force-recovery=5
+let SEARCH_PATTERN=InnoDB: Log block 2372 at lsn 1213952 has valid header, but checksum field contains 144444122, should be 3362026715;
+--source include/search_pattern_in_file.inc
+let SEARCH_PATTERN=InnoDB: Ignoring the redo log due to missing MLOG_CHECKPOINT between the checkpoint 1213964 and the end 1213952\.;
+--source include/search_pattern_in_file.inc
+let SEARCH_PATTERN=Plugin 'InnoDB' registration as a STORAGE ENGINE failed;
+--source include/search_pattern_in_file.inc
+--echo # --innodb-force-recovery=6 (skip the entire redo log)
+--error 1
+--exec $MYSQLD $args --innodb-force-recovery=6
+let SEARCH_PATTERN=InnoDB: Cannot create sys_virtual system tables. running in read-only mode;
+--source include/search_pattern_in_file.inc
+
+--echo # valid header, valid checkpoint 1, all-zero (invalid) checkpoint 2, invalid block number
+--remove_file $bugdir/ib_logfile0
+--exec unzip $MTR_SUITE_DIR/std_data/log_corruption4a.zip -d $bugdir > $SEARCH_FILE
+# Anything below innodb_force_recovery=6 must find a valid redo log.
+# Missing tablespace files are tolerated already with innodb_force_recovery=1.
+--error 1
+--exec $MYSQLD $args --innodb-force-recovery=5
+let SEARCH_PATTERN=InnoDB: Ignoring the redo log due to missing MLOG_CHECKPOINT between the checkpoint 1213964 and the end 1213952\.;
+--source include/search_pattern_in_file.inc
+let SEARCH_PATTERN=Plugin 'InnoDB' registration as a STORAGE ENGINE failed;
+--source include/search_pattern_in_file.inc
+--echo # --innodb-force-recovery=6 (skip the entire redo log)
+--error 1
+--exec $MYSQLD $args --innodb-force-recovery=6
+let SEARCH_PATTERN=InnoDB: Cannot create sys_virtual system tables. running in read-only mode;
+--source include/search_pattern_in_file.inc
+
+--echo # Test a corrupted MLOG_FILE_NAME record.
+--echo # valid header, valid checkpoint 1, all-zero (invalid) checkpoint 2
+--remove_file $bugdir/ib_logfile0
+--exec unzip $MTR_SUITE_DIR/std_data/log_corruption5.zip -d $bugdir > $SEARCH_FILE
+--error 1
+--exec $MYSQLD $args
+let SEARCH_PATTERN=InnoDB: Log scan progressed past the checkpoint lsn 1213964;
+--source include/search_pattern_in_file.inc
+let SEARCH_PATTERN=InnoDB: ############### CORRUPT LOG RECORD FOUND ##################;
+--source include/search_pattern_in_file.inc
+let SEARCH_PATTERN=InnoDB: Log record type 55, page 151:488\. Log parsing proceeded successfully up to 1213973\. Previous log record type 56, is multi 0 Recv offset 9, prev 0;
+--source include/search_pattern_in_file.inc
+let SEARCH_PATTERN= len 22. hex 38000000000012860cb7809781e80006626f67757300. asc 8 bogus ;
+--source include/search_pattern_in_file.inc
+let SEARCH_PATTERN=InnoDB: Set innodb_force_recovery to ignore this error;
+--source include/search_pattern_in_file.inc
+
+--echo # Test a corrupted MLOG_FILE_NAME record.
+--echo # valid header, invalid checkpoint 1, valid checkpoint 2
+--remove_file $bugdir/ib_logfile0
+--exec unzip $MTR_SUITE_DIR/std_data/log_corruption6.zip -d $bugdir > $SEARCH_FILE
+--error 1
+--exec $MYSQLD $args
+let SEARCH_PATTERN=InnoDB: ############### CORRUPT LOG RECORD FOUND ##################;
+--source include/search_pattern_in_file.inc
+let SEARCH_PATTERN=InnoDB: Log record type 55, page 151:488\. Log parsing proceeded successfully up to 1213973\. Previous log record type 56, is multi 0 Recv offset 9, prev 0;
+--source include/search_pattern_in_file.inc
+let SEARCH_PATTERN=InnoDB: Hex dump starting 0 bytes before and ending 13 bytes after the corrupted record;
+--source include/search_pattern_in_file.inc
+let SEARCH_PATTERN= len 22. hex 38000000000012860cb7809781e80006626f67757300. asc 8 bogus ;
+--source include/search_pattern_in_file.inc
+let SEARCH_PATTERN=InnoDB: Set innodb_force_recovery to ignore this error;
+--source include/search_pattern_in_file.inc
+
+--list_files $bugdir
+--remove_files_wildcard $bugdir
+--rmdir $bugdir
diff --git a/mysql-test/suite/innodb/t/log_file.test b/mysql-test/suite/innodb/t/log_file.test
new file mode 100644
index 00000000000..7e52ccfc726
--- /dev/null
+++ b/mysql-test/suite/innodb/t/log_file.test
@@ -0,0 +1,262 @@
+--echo # Testcase for the following bugs
+--echo # Bug#16691130 - ASSERT WHEN INNODB_LOG_GROUP_HOME_DIR DOES NOT EXIST
+--echo # Bug#16418661 - CHANGING NAME IN FOR INNODB_DATA_FILE_PATH SHOULD NOT SUCCEED WITH LOG FILES
+
+--source include/have_innodb.inc
+
+let bugdir= $MYSQLTEST_VARDIR/tmp/log_file;
+--mkdir $bugdir
+
+--let SEARCH_RANGE = -50000
+--let SEARCH_FILE = $bugdir/my_restart.err
+--let SEARCH_ABORT=NOT FOUND
+--let $args=--defaults-file=$bugdir/my.cnf --loose-console > $SEARCH_FILE 2>&1
+
+--echo # Write tmp/log_file/my.cnf
+
+perl;
+die unless open IN, "<", "$ENV{MYSQLTEST_VARDIR}/my.cnf";
+my $found;
+while (<IN>) { $found=$1 if /^(lc-messages-dir=.*)/ }
+close IN;
+
+die unless defined $found;
+die unless open OUT, ">", "$ENV{bugdir}/my.cnf";
+print OUT "[mysqld]
+$found
+innodb_data_home_dir = $ENV{bugdir}
+datadir = $ENV{bugdir}
+secure_file_priv=
+skip_aria
+core_file
+innodb_data_file_path = ibdata1:10M;ibdata2:10M:autoextend
+innodb_undo_logs = 20
+innodb_undo_tablespaces = 3
+innodb_log_files_in_group = 3
+skip_innodb_use_native_aio # MDEV-11948 CentOS 5 fails to write ib_logfile101
+";
+close(OUT);
+EOF
+
+--echo # Start mysqld without the possibility to create innodb_undo_tablespaces
+--mkdir $bugdir/undo002
+--error 1
+--exec $MYSQLD $args
+let SEARCH_PATTERN=\[ERROR\] InnoDB: Could not create undo tablespace '.*undo002';
+--source include/search_pattern_in_file.inc
+let SEARCH_PATTERN=\[ERROR\] Aborting;
+--source include/search_pattern_in_file.inc
+
+--echo # Remove undo001,undo002,ibdata1,ibdata2,ib_logfile1,ib_logfile2,ib_logfile101
+--remove_file $bugdir/undo001
+--rmdir $bugdir/undo002
+--remove_file $bugdir/ibdata1
+--remove_file $bugdir/ibdata2
+--remove_file $bugdir/ib_logfile1
+--remove_file $bugdir/ib_logfile2
+--remove_file $bugdir/ib_logfile101
+--list_files $bugdir
+
+--echo # Start mysqld with non existent innodb_log_group_home_dir
+--error 1
+--exec $MYSQLD $args --innodb_log_group_home_dir=/path/to/non-existent/
+let SEARCH_PATTERN=File .path.to.non-existent.*ib_logfile101: 'create' returned OS error \d+;
+--source include/search_pattern_in_file.inc
+let SEARCH_PATTERN=\[ERROR\] Aborting;
+--source include/search_pattern_in_file.inc
+
+--echo # Remove ibdata1 & ibdata2
+--remove_file $bugdir/ibdata1
+--remove_file $bugdir/ibdata2
+--list_files $bugdir
+
+# Innodb creates system tablespaces according to my.cnf and aborts
+# complaining about mysql.* tables. This is sufficient for testing
+# missing tablespaces.
+--echo # Start mysqld to create tablespaces according to my.cnf
+--error 2
+--exec $MYSQLD $args --skip-grant-tables --innodb-unknown-parameter
+let SEARCH_PATTERN=unknown option '--innodb-unknown-parameter';
+--source include/search_pattern_in_file.inc
+let SEARCH_PATTERN=\[ERROR\] Aborting;
+--source include/search_pattern_in_file.inc
+
+--echo # Backup tmp/logfile/*
+--copy_file $bugdir/ibdata1 $bugdir/bak_ibdata1
+--copy_file $bugdir/ibdata2 $bugdir/bak_ibdata2
+--copy_file $bugdir/ib_logfile0 $bugdir/bak_ib_logfile0
+--copy_file $bugdir/ib_logfile1 $bugdir/bak_ib_logfile1
+--copy_file $bugdir/ib_logfile2 $bugdir/bak_ib_logfile2
+--copy_file $bugdir/undo001 $bugdir/bak_undo001
+--copy_file $bugdir/undo002 $bugdir/bak_undo002
+--copy_file $bugdir/undo003 $bugdir/bak_undo003
+
+--echo # 1. With ibdata2, Without ibdata1
+--remove_file $bugdir/ibdata1
+--error 1
+--exec $MYSQLD $args
+let SEARCH_PATTERN=The innodb_system data file 'ibdata1' was not found but one of the other data files 'ibdata2' exists;
+--source include/search_pattern_in_file.inc
+let SEARCH_PATTERN=\[ERROR\] Aborting;
+--source include/search_pattern_in_file.inc
+
+# clean up & Restore
+--source ../include/log_file_cleanup.inc
+
+--echo # 2. With ibdata1, without ibdata2
+--remove_file $bugdir/ibdata2
+--error 1
+--exec $MYSQLD $args
+let SEARCH_PATTERN=Tablespace size stored in header is \d+ pages, but;
+--source include/search_pattern_in_file.inc
+let SEARCH_PATTERN=\[ERROR\] Aborting;
+--source include/search_pattern_in_file.inc
+
+# clean up & Restore
+--source ../include/log_file_cleanup.inc
+
+--echo # 3. Without ibdata1 & ibdata2
+--remove_file $bugdir/ibdata1
+--remove_file $bugdir/ibdata2
+--list_files $bugdir
+--error 1
+--exec $MYSQLD $args
+let SEARCH_PATTERN=undo tablespace .*undo001.* exists\. Creating system tablespace with existing undo tablespaces is not supported\. Please delete all undo tablespaces before creating new system tablespace\.;
+--source include/search_pattern_in_file.inc
+let SEARCH_PATTERN=\[ERROR\] Aborting;
+--source include/search_pattern_in_file.inc
+
+# clean up & Restore
+--source ../include/log_file_cleanup.inc
+
+--echo # 4. Without ibdata*, ib_logfile* and with undo00*
+--remove_files_wildcard $bugdir ibdata*
+--remove_files_wildcard $bugdir ib_logfile*
+--list_files $bugdir
+--error 1
+--exec $MYSQLD $args
+let SEARCH_PATTERN=undo tablespace .*undo001.* exists\. Creating system tablespace with existing undo tablespaces is not supported\. Please delete all undo tablespaces before creating new system tablespace\.;
+--source include/search_pattern_in_file.inc
+let SEARCH_PATTERN=\[ERROR\] Aborting;
+--source include/search_pattern_in_file.inc
+
+# clean up & Restore
+--source ../include/log_file_cleanup.inc
+
+
+--echo # 5. Without ibdata*,ib_logfile* files & Without undo002
+--remove_files_wildcard $bugdir ibdata*
+--remove_files_wildcard $bugdir ib_logfile*
+--remove_file $bugdir/undo002
+--list_files $bugdir
+--error 1
+--exec $MYSQLD $args
+let SEARCH_PATTERN=undo tablespace .*undo001.* exists\. Creating system tablespace with existing undo tablespaces is not supported\. Please delete all undo tablespaces before creating new system tablespace\.;
+--source include/search_pattern_in_file.inc
+let SEARCH_PATTERN=\[ERROR\] Aborting;
+--source include/search_pattern_in_file.inc
+
+# clean up & Restore
+--source ../include/log_file_cleanup.inc
+
+--echo # 6. Without ibdata*,ib_logfile* files & Without undo001, undo002
+# and with undo003
+--remove_files_wildcard $bugdir ibdata*
+--remove_files_wildcard $bugdir ib_logfile*
+--remove_file $bugdir/undo001
+--remove_file $bugdir/undo002
+--list_files $bugdir
+--error 1
+--exec $MYSQLD $args
+let SEARCH_PATTERN=undo tablespace .*undo003.* exists\. Creating system tablespace with existing undo tablespaces is not supported\. Please delete all undo tablespaces before creating new system tablespace\.;
+--source include/search_pattern_in_file.inc
+let SEARCH_PATTERN=\[ERROR\] Aborting;
+--source include/search_pattern_in_file.inc
+
+# clean up & Restore
+--source ../include/log_file_cleanup.inc
+
+--echo # 7. With ibdata files & Without undo002
+--remove_file $bugdir/undo002
+--list_files $bugdir
+--error 1
+--exec $MYSQLD $args
+let SEARCH_PATTERN=Expected to open 3 undo tablespaces but was able;
+--source include/search_pattern_in_file.inc
+let SEARCH_PATTERN=to find only 1 undo tablespaces;
+--source include/search_pattern_in_file.inc
+let SEARCH_PATTERN=\[ERROR\] Aborting;
+--source include/search_pattern_in_file.inc
+# clean up & Restore
+--source ../include/log_file_cleanup.inc
+
+--echo # 8. With ibdata files & Without undo001, undo002
+--remove_file $bugdir/undo001
+--remove_file $bugdir/undo002
+--list_files $bugdir
+--error 1
+--exec $MYSQLD $args
+let SEARCH_PATTERN=Expected to open 3 undo tablespaces but was able;
+--source include/search_pattern_in_file.inc
+let SEARCH_PATTERN=to find only 0 undo tablespaces;
+--source include/search_pattern_in_file.inc
+let SEARCH_PATTERN=\[ERROR\] Aborting;
+--source include/search_pattern_in_file.inc
+
+# clean up & Restore
+--source ../include/log_file_cleanup.inc
+
+--echo # 9. Without ibdata*, without undo*, Without ib_logfile1 and with ib_logfile2
+--remove_files_wildcard $bugdir ibdata*
+--remove_files_wildcard $bugdir undo00*
+--remove_file $bugdir/ib_logfile1
+--list_files $bugdir
+--error 1
+--exec $MYSQLD $args
+let SEARCH_PATTERN=redo log file .*ib_logfile0.* exists\. Creating system tablespace with existing redo log files is not recommended\. Please delete all redo log files before creating new system tablespace\.;
+--source include/search_pattern_in_file.inc
+let SEARCH_PATTERN=\[ERROR\] Aborting;
+--source include/search_pattern_in_file.inc
+
+# clean up & Restore
+--source ../include/log_file_cleanup.inc
+
+# 10. With ibdata*, without ib_logfile0
+#--remove_file $bugdir/ib_logfile0
+# The below would start the server. Since we cannot start a parallel
+# server, do not test the below case
+#--error 1
+#--exec $MYSQLD $args
+
+# clean up & Restore
+#--source ../include/log_file_cleanup.inc
+
+--echo # 11. With ibdata*, without ib_logfile1
+--remove_file $bugdir/ib_logfile1
+--list_files $bugdir
+--error 1
+--exec $MYSQLD $args
+let SEARCH_PATTERN=Only one log file found;
+--source include/search_pattern_in_file.inc
+let SEARCH_PATTERN=\[ERROR\] Aborting;
+--source include/search_pattern_in_file.inc
+
+# clean up & Restore
+--source ../include/log_file_cleanup.inc
+
+--echo # 12. With ibdata*, without ib_logfile2
+--remove_file $bugdir/ib_logfile2
+--list_files $bugdir
+--error 1
+--exec $MYSQLD $args
+let SEARCH_PATTERN=Resizing redo log from \d+\*\d+ to \d+\*\d+ pages, LSN=\d+;
+--source include/search_pattern_in_file.inc
+
+--echo # Cleanup
+# Remove ibtmp* which are re-generated after each mysqld invocation
+# skip auto generated auto.cnf from list_files
+--remove_files_wildcard $bugdir auto.cnf
+--remove_files_wildcard $bugdir ibtmp*
+--list_files $bugdir
+--remove_files_wildcard $bugdir
+--rmdir $bugdir
diff --git a/mysql-test/suite/innodb/t/log_file_name.test b/mysql-test/suite/innodb/t/log_file_name.test
new file mode 100644
index 00000000000..5c063ab124f
--- /dev/null
+++ b/mysql-test/suite/innodb/t/log_file_name.test
@@ -0,0 +1,267 @@
+# WL#7142 InnoDB: Simplify tablespace discovery during crash recovery
+# Test the detection of duplicate tablespaces.
+
+--source include/have_innodb.inc
+
+# Embedded server does not support crashing
+--source include/not_embedded.inc
+
+SET GLOBAL innodb_file_per_table=ON;
+
+CREATE TABLE t1(a INT PRIMARY KEY) ENGINE=InnoDB;
+
+--source include/no_checkpoint_start.inc
+CREATE TABLE t3(a INT PRIMARY KEY) ENGINE=InnoDB;
+
+BEGIN;
+INSERT INTO t3 VALUES (33101),(347);
+INSERT INTO t1 VALUES (42),(9),(101);
+RENAME TABLE t1 TO t2;
+UPDATE t2 SET a=347 where a=42;
+COMMIT;
+
+--let CLEANUP_IF_CHECKPOINT=DROP TABLE t2,t3;
+--source include/no_checkpoint_end.inc
+
+--echo # Fault 0 (no real fault): Orphan file with duplicate space_id.
+--copy_file $MYSQLD_DATADIR/test/t2.ibd $MYSQLD_DATADIR/test/t0.ibd
+
+--echo # Fault 1: Two dirty files with the same space_id.
+--copy_file $MYSQLD_DATADIR/test/t2.ibd $MYSQLD_DATADIR/test/t1.ibd
+
+let SEARCH_FILE= $MYSQLTEST_VARDIR/log/mysqld.1.err;
+let SEARCH_RANGE= -50000;
+let SEARCH_ABORT= NOT FOUND;
+let $check_no_innodb=SELECT * FROM INFORMATION_SCHEMA.ENGINES
+WHERE engine = 'innodb'
+AND support IN ('YES', 'DEFAULT', 'ENABLED');
+
+# This could fail to refuse InnoDB startup, in case there was a log
+# checkpoint after the INSERT. That is what we checked above.
+--source include/start_mysqld.inc
+eval $check_no_innodb;
+let SEARCH_PATTERN= InnoDB: Ignoring data file '.*t2.ibd' with space ID \d+. Another data file called .*t1.ibd exists with the same space ID;
+--source include/search_pattern_in_file.inc
+
+--source include/shutdown_mysqld.inc
+
+--remove_file $MYSQLD_DATADIR/test/t1.ibd
+
+# This could fail to refuse InnoDB startup, in case there was a log
+# checkpoint after the CREATE TABLE t3. That is what we checked above.
+--echo # Fault 2: Wrong space_id in a dirty file, and a missing file.
+--move_file $MYSQLD_DATADIR/test/t3.ibd $MYSQLD_DATADIR/test/t1.ibd
+
+--source include/start_mysqld.inc
+eval $check_no_innodb;
+
+let SEARCH_PATTERN= InnoDB: Ignoring data file '.*t1.ibd' with space ID;
+--source include/search_pattern_in_file.inc
+
+let SEARCH_PATTERN= InnoDB: Tablespace \d+ was not found at.*t3.ibd;
+--source include/search_pattern_in_file.inc
+
+--source include/shutdown_mysqld.inc
+
+--move_file $MYSQLD_DATADIR/test/t1.ibd $MYSQLD_DATADIR/test/t3.ibd
+
+--echo # Fault 3: Wrong space_id in a dirty file, and no missing file.
+# Swap t2.ibd and t3.ibd.
+--move_file $MYSQLD_DATADIR/test/t3.ibd $MYSQLD_DATADIR/test/t.ibd
+--move_file $MYSQLD_DATADIR/test/t2.ibd $MYSQLD_DATADIR/test/t3.ibd
+--move_file $MYSQLD_DATADIR/test/t.ibd $MYSQLD_DATADIR/test/t2.ibd
+
+--source include/start_mysqld.inc
+eval $check_no_innodb;
+
+let SEARCH_PATTERN= InnoDB: Ignoring data file '.*t[23].ibd' with space ID;
+--source include/search_pattern_in_file.inc
+
+let SEARCH_PATTERN= InnoDB: Tablespace \d+ was not found at .*t1.ibd;
+--source include/search_pattern_in_file.inc
+let SEARCH_PATTERN= InnoDB: Tablespace \d+ was not found at .*t3.ibd;
+--source include/search_pattern_in_file.inc
+let SEARCH_PATTERN= InnoDB: Set innodb_force_recovery=1 to ignore this and to permanently lose all changes to the tablespace;
+--source include/search_pattern_in_file.inc
+
+--source include/shutdown_mysqld.inc
+
+# Swap back t3.ibd, but hide t2.ibd (which the redo log also knows as t1.ibd).
+--move_file $MYSQLD_DATADIR/test/t3.ibd $MYSQLD_DATADIR/test/t.ibd
+--move_file $MYSQLD_DATADIR/test/t2.ibd $MYSQLD_DATADIR/test/t3.ibd
+
+--echo # Fault 4: Missing data file
+
+--source include/start_mysqld.inc
+eval $check_no_innodb;
+
+let SEARCH_PATTERN= InnoDB: Tablespace \d+ was not found at .*t[12].ibd.
+.*InnoDB: Set innodb_force_recovery=1 to ignore this and to permanently lose all changes to the tablespace;
+--source include/search_pattern_in_file.inc
+
+--source include/shutdown_mysqld.inc
+
+--echo # Fault 5: Wrong type of data file
+
+# TODO: Test the following as well once
+# Bug#18131883 IMPROVE INNODB ERROR MESSAGES REGARDING FILES
+# has been fixed:
+# A file containing 16384 zero bytes.
+# --mkdir $MYSQLD_DATADIR/test/t2.ibd
+
+# Create a short file.
+--exec echo "" > $MYSQLD_DATADIR/test/t2.ibd
+
+--source include/start_mysqld.inc
+eval $check_no_innodb;
+
+let SEARCH_PATTERN= \[ERROR\] InnoDB: Datafile .*t2.*\. Cannot determine the space ID from the first 64 pages;
+--source include/search_pattern_in_file.inc
+
+--source include/shutdown_mysqld.inc
+
+# Restore t2.ibd
+--remove_file $MYSQLD_DATADIR/test/t2.ibd
+--move_file $MYSQLD_DATADIR/test/t.ibd $MYSQLD_DATADIR/test/t2.ibd
+
+--source include/start_mysqld.inc
+
+SELECT * FROM t2;
+SELECT * FROM t3;
+SHOW TABLES;
+DROP TABLE t2,t3;
+
+--error ER_TABLESPACE_EXISTS
+CREATE TABLE t0(a INT PRIMARY KEY) ENGINE=InnoDB;
+
+# Remove the orphan file from fault 0.
+--remove_file $MYSQLD_DATADIR/test/t0.ibd
+
+CREATE TABLE t0(a INT PRIMARY KEY) ENGINE=InnoDB;
+DROP TABLE t0;
+
+--disable_query_log
+# The following are for the orphan file t0.ibd:
+call mtr.add_suppression("InnoDB: Operating system error number [0-9]* in a file operation");
+call mtr.add_suppression("InnoDB: Error number [0-9]* means 'File exists'");
+call mtr.add_suppression("InnoDB: Cannot create file '.*t0.ibd'");
+call mtr.add_suppression("InnoDB: The file '.*t0\.ibd' already exists");
+# The following are for aborted startup without --innodb-force-recovery:
+call mtr.add_suppression("InnoDB: Tablespace .* was not found at .*test");
+call mtr.add_suppression("InnoDB: Set innodb_force_recovery=1 to ignore this and to permanently lose all changes to the tablespace");
+call mtr.add_suppression("InnoDB: Cannot read first page of '.*test.[tu]2.ibd' I/O error");
+call mtr.add_suppression("InnoDB: Cannot read first page in datafile: .*test.*ibd");
+call mtr.add_suppression("InnoDB: Datafile '.*test.*ibd' is corrupted");
+call mtr.add_suppression("InnoDB: Cannot replay file rename. Remove either file and try again");
+call mtr.add_suppression("InnoDB: Cannot rename.*because the target file exists");
+call mtr.add_suppression("InnoDB: Found corrupted log");
+# The following are for the --innodb-force-recovery=1 with broken u* tables:
+call mtr.add_suppression("InnoDB: Header page consists of zero bytes in datafile: .*u1.ibd");
+call mtr.add_suppression("InnoDB: The error means the system cannot find the path specified");
+call mtr.add_suppression("InnoDB: .*you must create directories");
+call mtr.add_suppression("InnoDB: Cannot open datafile for read-only: '.*u[1-5]\.ibd'");
+call mtr.add_suppression("InnoDB: Could not find a valid tablespace file for `test/u[1-5]`");
+call mtr.add_suppression("InnoDB: Ignoring tablespace for `test`.`u[1-3]` because it could not be opened.");
+call mtr.add_suppression("InnoDB: Failed to find tablespace for table .* in the cache. Attempting to load the tablespace with space id");
+call mtr.add_suppression("InnoDB: Plugin initialization aborted");
+call mtr.add_suppression("Plugin 'InnoDB' \(init function returned error\|registration as a STORAGE ENGINE failed\)");
+FLUSH TABLES;
+--enable_query_log
+
+--source include/no_checkpoint_start.inc
+
+CREATE TABLE u1(a INT PRIMARY KEY) ENGINE=InnoDB;
+CREATE TABLE u2(a INT PRIMARY KEY) ENGINE=InnoDB;
+CREATE TABLE u3(a INT PRIMARY KEY) ENGINE=InnoDB;
+CREATE TABLE u4(a INT PRIMARY KEY) ENGINE=InnoDB;
+INSERT INTO u4 VALUES(1);
+RENAME TABLE u4 TO u5;
+RENAME TABLE u5 TO u6;
+INSERT INTO u6 VALUES(2);
+
+--let CLEANUP_IF_CHECKPOINT=DROP TABLE u1,u2,u3,u6;
+--source include/no_checkpoint_end.inc
+
+--echo # Fault 6: All-zero data file and innodb_force_recovery
+
+--remove_file $MYSQLD_DATADIR/test/u1.ibd
+--remove_file $MYSQLD_DATADIR/test/u2.ibd
+--remove_file $MYSQLD_DATADIR/test/u3.ibd
+
+# InnoDB: Header page consists of zero bytes
+perl;
+die unless open(FILE, ">$ENV{MYSQLD_DATADIR}/test/u1.ibd");
+print FILE "\0" x 16384;
+close(FILE);
+EOF
+
+--exec echo "" > $MYSQLD_DATADIR/test/u2.ibd
+
+# TODO: Test with this, once
+# Bug#18131883 IMPROVE INNODB ERROR MESSAGES REGARDING FILES
+# has been fixed:
+#--mkdir $MYSQLD_DATADIR/test/u3.ibd
+
+--copy_file $MYSQLD_DATADIR/test/u6.ibd $MYSQLD_DATADIR/test/u4.ibd
+
+--let $restart_parameters= --innodb-force-recovery=1
+--source include/start_mysqld.inc
+eval $check_no_innodb;
+
+let SEARCH_PATTERN= \[ERROR\] InnoDB: Header page consists of zero bytes in datafile: .*u1.ibd;
+--source include/search_pattern_in_file.inc
+
+let SEARCH_PATTERN= \[ERROR\] InnoDB: Datafile .*u1.*\. Cannot determine the space ID from the first 64 pages;
+--source include/search_pattern_in_file.inc
+
+# TODO: These errors should state the file name (u2.ibd) and be ignored
+# in innodb-force-recovery mode once
+# Bug#18131883 IMPROVE INNODB ERROR MESSAGES REGARDING FILES
+# has been fixed:
+let SEARCH_PATTERN= \[ERROR\] InnoDB: Cannot read first page of .*u2.ibd.*;
+--source include/search_pattern_in_file.inc
+
+--source include/shutdown_mysqld.inc
+
+# Allow --innodb-force-recovery to start despite the broken file.
+# TODO: Remove this workaround, and make --innodb-force-recovery=1
+# ignore the broken file.
+--remove_file $MYSQLD_DATADIR/test/u2.ibd
+
+--echo # Fault 7: Missing or wrong data file and innodb_force_recovery
+
+--source include/start_mysqld.inc
+eval $check_no_innodb;
+
+let SEARCH_PATTERN= \[ERROR\] InnoDB: Header page consists of zero bytes in datafile: .*u1.ibd;
+--source include/search_pattern_in_file.inc
+
+let SEARCH_PATTERN= InnoDB: At LSN: \d+: unable to open file .*u[1-5].ibd for tablespace;
+--source include/search_pattern_in_file.inc
+
+let SEARCH_PATTERN= \[ERROR\] InnoDB: Cannot rename '.*u5.ibd' to '.*u6.ibd' for space ID \d+ because the target file exists;
+--source include/search_pattern_in_file.inc
+
+--remove_file $MYSQLD_DATADIR/test/u6.ibd
+
+--source include/restart_mysqld.inc
+
+let SEARCH_PATTERN= \[ERROR\] InnoDB: Header page consists of zero bytes in datafile: .*u1.ibd;
+--source include/search_pattern_in_file.inc
+
+let SEARCH_PATTERN= InnoDB: At LSN: \d+: unable to open file .*u[1-5].ibd for tablespace;
+--source include/search_pattern_in_file.inc
+
+let SEARCH_PATTERN= \[Warning\] InnoDB: Tablespace \d+ was not found at .*u[1-5].ibd, and innodb_force_recovery was set. All redo log for this tablespace will be ignored!;
+--source include/search_pattern_in_file.inc
+
+--let $restart_parameters=
+--source include/restart_mysqld.inc
+
+DROP TABLE u1,u2,u3,u6;
+
+--remove_file $MYSQLD_DATADIR/test/u1.ibd
+--echo # List of files:
+--list_files $MYSQLD_DATADIR/test
+
+SHOW TABLES;
diff --git a/mysql-test/suite/innodb/t/log_file_name_debug.test b/mysql-test/suite/innodb/t/log_file_name_debug.test
new file mode 100644
index 00000000000..41d7ec2e53e
--- /dev/null
+++ b/mysql-test/suite/innodb/t/log_file_name_debug.test
@@ -0,0 +1,31 @@
+--source include/have_innodb.inc
+# Embedded server does not support restarting
+--source include/not_embedded.inc
+--source include/have_debug.inc
+
+--echo #
+--echo # Bug#19685095 DO NOT CARE ABOUT UNRESOLVED MLOG_FILE_NAME
+--echo # IF THERE ARE NO OPERATIONS TO APPLY
+--echo #
+
+SET GLOBAL DEBUG_DBUG='+d,fil_names_write_bogus';
+--disable_query_log
+FLUSH TABLES;
+--enable_query_log
+
+--source include/no_checkpoint_start.inc
+
+CREATE TABLE t1(a INT PRIMARY KEY) ENGINE=InnoDB;
+
+--let CLEANUP_IF_CHECKPOINT=DROP TABLE t1;
+--source include/no_checkpoint_end.inc
+
+--source include/start_mysqld.inc
+
+DROP TABLE t1;
+
+--let SEARCH_FILE = $MYSQLTEST_VARDIR/log/mysqld.1.err
+--let SEARCH_PATTERN = InnoDB: Tablespace 4294967280 was not found at .*, but there were no modifications either
+--let SEARCH_ABORT = NOT FOUND
+--let SEARCH_RANGE = -50000
+--source include/search_pattern_in_file.inc
diff --git a/mysql-test/suite/innodb/t/log_file_size.test b/mysql-test/suite/innodb/t/log_file_size.test
new file mode 100644
index 00000000000..9d004991735
--- /dev/null
+++ b/mysql-test/suite/innodb/t/log_file_size.test
@@ -0,0 +1,218 @@
+# Test resizing the InnoDB redo log.
+
+--source include/have_innodb.inc
+
+# Embedded server does not support crashing
+--source include/not_embedded.inc
+# Avoid CrashReporter popup on Mac
+--source include/not_crashrep.inc
+# DBUG_EXECUTE_IF is needed
+--source include/have_debug.inc
+
+if (`SELECT @@innodb_log_file_size = 1048576`) {
+ --skip Test requires innodb_log_file_size>1M.
+}
+
+--disable_query_log
+call mtr.add_suppression("InnoDB: Resizing redo log");
+call mtr.add_suppression("InnoDB: Starting to delete and rewrite log files");
+call mtr.add_suppression("InnoDB: New log files created");
+call mtr.add_suppression("InnoDB: The log sequence numbers [0-9]+ and [0-9]+ in ibdata files do not match the log sequence number [0-9]+ in the ib_logfiles");
+call mtr.add_suppression("syntax error in innodb_log_group_home_dir");
+call mtr.add_suppression("Plugin 'InnoDB' init function returned error");
+call mtr.add_suppression("Plugin 'InnoDB' registration as a STORAGE ENGINE failed");
+call mtr.add_suppression("InnoDB: Plugin initialization aborted");
+call mtr.add_suppression("InnoDB: innodb_read_only prevents crash recovery");
+call mtr.add_suppression("InnoDB: Are you sure you are using the right ib_logfiles");
+call mtr.add_suppression("InnoDB: Cannot create log files in read-only mode");
+call mtr.add_suppression("InnoDB: Only one log file found");
+call mtr.add_suppression("InnoDB: Log file .*ib_logfile[01].* size");
+call mtr.add_suppression("InnoDB: Unable to open .*ib_logfile0. to check native AIO read support");
+FLUSH TABLES;
+--enable_query_log
+
+CREATE TABLE t1(a INT PRIMARY KEY) ENGINE=InnoDB;
+BEGIN;
+INSERT INTO t1 VALUES (42);
+
+let $restart_parameters = --innodb-log-file-size=6M;
+--source include/kill_and_restart_mysqld.inc
+
+SELECT * FROM t1;
+
+INSERT INTO t1 VALUES (42);
+BEGIN;
+DELETE FROM t1;
+
+let $restart_parameters = --innodb-log-files-in-group=3 --innodb-log-file-size=5M;
+--source include/kill_and_restart_mysqld.inc
+
+SELECT * FROM t1;
+
+INSERT INTO t1 VALUES (123);
+
+let MYSQLD_DATADIR= `select @@datadir`;
+let SEARCH_ABORT = NOT FOUND;
+let SEARCH_RANGE= -50000;
+let SEARCH_FILE= $MYSQLTEST_VARDIR/log/mysqld.1.err;
+
+BEGIN;
+DELETE FROM t1;
+
+--source include/kill_mysqld.inc
+
+--let $restart_parameters= --innodb-log-group-home-dir=foo\;bar
+--source include/start_mysqld.inc
+--error ER_UNKNOWN_STORAGE_ENGINE
+SELECT * FROM t1;
+let SEARCH_PATTERN= syntax error in innodb_log_group_home_dir;
+--source include/search_pattern_in_file.inc
+
+--let $restart_parameters= --debug=d,innodb_log_abort_1
+--source include/restart_mysqld.inc
+--error ER_UNKNOWN_STORAGE_ENGINE
+SELECT * FROM t1;
+let SEARCH_PATTERN= InnoDB: Starting an apply batch of log records;
+--source include/search_pattern_in_file.inc
+
+--let $restart_parameters= --debug=d,innodb_log_abort_3
+--source include/restart_mysqld.inc
+--error ER_UNKNOWN_STORAGE_ENGINE
+SELECT * FROM t1;
+let SEARCH_PATTERN= InnoDB: Starting an apply batch of log records;
+--source include/search_pattern_in_file.inc
+
+--let $restart_parameters= --innodb-read-only
+--source include/restart_mysqld.inc
+
+--error ER_UNKNOWN_STORAGE_ENGINE
+SELECT * FROM t1;
+let SEARCH_PATTERN= InnoDB: innodb_read_only prevents crash recovery;
+--source include/search_pattern_in_file.inc
+
+--let $restart_parameters= --debug=d,innodb_log_abort_4
+--source include/restart_mysqld.inc
+--error ER_UNKNOWN_STORAGE_ENGINE
+SELECT * FROM t1;
+let SEARCH_PATTERN= InnoDB: Starting an apply batch of log records;
+--source include/search_pattern_in_file.inc
+let SEARCH_PATTERN= InnoDB: Resizing redo log from 3\*[0-9]+ to 2\*[0-9]+ pages;
+--source include/search_pattern_in_file.inc
+
+--let $restart_parameters= --debug=d,innodb_log_abort_5
+--source include/restart_mysqld.inc
+--error ER_UNKNOWN_STORAGE_ENGINE
+SELECT * FROM t1;
+let SEARCH_PATTERN= InnoDB: Starting an apply batch of log records;
+--source include/search_pattern_in_file.inc
+let SEARCH_PATTERN= InnoDB: Resizing redo log from 3\*[0-9]+ to 2\*[0-9]+ pages;
+--source include/search_pattern_in_file.inc
+
+--let $restart_parameters= --innodb-read-only
+--source include/restart_mysqld.inc
+--error ER_UNKNOWN_STORAGE_ENGINE
+SELECT * FROM t1;
+let SEARCH_PATTERN= InnoDB: innodb_read_only prevents crash recovery;
+--source include/search_pattern_in_file.inc
+
+--let $restart_parameters= --debug=d,innodb_log_abort_6
+--source include/restart_mysqld.inc
+--error ER_UNKNOWN_STORAGE_ENGINE
+SELECT * FROM t1;
+
+let SEARCH_PATTERN= InnoDB: Starting an apply batch of log records;
+--source include/search_pattern_in_file.inc
+let SEARCH_PATTERN= InnoDB: Resizing redo log from 3\*[0-9]+ to 2\*[0-9]+ pages;
+--source include/search_pattern_in_file.inc
+
+--let $restart_parameters= --debug=d,innodb_log_abort_7
+--source include/restart_mysqld.inc
+--error ER_UNKNOWN_STORAGE_ENGINE
+SELECT * FROM t1;
+
+# this aborts right after deleting all log files
+
+--let $restart_parameters= --innodb-read-only
+--source include/restart_mysqld.inc
+--error ER_UNKNOWN_STORAGE_ENGINE
+SELECT * FROM t1;
+
+let SEARCH_PATTERN= InnoDB: Cannot create log files in read-only mode;
+--source include/search_pattern_in_file.inc
+
+--let $restart_parameters= --debug=d,innodb_log_abort_8
+--source include/restart_mysqld.inc
+--error ER_UNKNOWN_STORAGE_ENGINE
+SELECT * FROM t1;
+
+let SEARCH_PATTERN= InnoDB: Setting log file .*ib_logfile[0-9]+ size to;
+--source include/search_pattern_in_file.inc
+
+--let $restart_parameters= --debug=d,innodb_log_abort_9
+--source include/restart_mysqld.inc
+--error ER_UNKNOWN_STORAGE_ENGINE
+SELECT * FROM t1;
+
+let SEARCH_PATTERN= InnoDB: Setting log file .*ib_logfile[0-9]+ size to;
+--source include/search_pattern_in_file.inc
+--source include/shutdown_mysqld.inc
+
+# We should have perfectly synced files here.
+# Rename the log files, and trigger an error in recovery.
+--move_file $MYSQLD_DATADIR/ib_logfile101 $MYSQLD_DATADIR/ib_logfile0
+--move_file $MYSQLD_DATADIR/ib_logfile1 $MYSQLD_DATADIR/ib_logfile1_hidden
+
+--let $restart_parameters=
+--source include/start_mysqld.inc
+--error ER_UNKNOWN_STORAGE_ENGINE
+SELECT * FROM t1;
+
+let SEARCH_PATTERN= InnoDB: Only one log file found;
+--source include/search_pattern_in_file.inc
+--move_file $MYSQLD_DATADIR/ib_logfile0 $MYSQLD_DATADIR/ib_logfile101
+
+perl;
+die unless open(FILE, ">$ENV{MYSQLD_DATADIR}/ib_logfile0");
+print FILE "garbage";
+close(FILE);
+EOF
+
+--source include/restart_mysqld.inc
+--error ER_UNKNOWN_STORAGE_ENGINE
+SELECT * FROM t1;
+let SEARCH_PATTERN= InnoDB: Log file .*ib_logfile0 size 7 is not a multiple of innodb_page_size;
+--source include/search_pattern_in_file.inc
+--remove_file $MYSQLD_DATADIR/ib_logfile0
+--move_file $MYSQLD_DATADIR/ib_logfile101 $MYSQLD_DATADIR/ib_logfile0
+
+perl;
+die unless open(FILE, ">$ENV{MYSQLD_DATADIR}/ib_logfile1");
+print FILE "junkfill" x 131072;
+close(FILE);
+EOF
+
+--source include/restart_mysqld.inc
+--error ER_UNKNOWN_STORAGE_ENGINE
+SELECT * FROM t1;
+
+let SEARCH_PATTERN= InnoDB: Log file .*ib_logfile1 is of different size 1048576 bytes than other log files;
+--source include/search_pattern_in_file.inc
+--remove_file $MYSQLD_DATADIR/ib_logfile1
+--move_file $MYSQLD_DATADIR/ib_logfile0 $MYSQLD_DATADIR/ib_logfile101
+--move_file $MYSQLD_DATADIR/ib_logfile1_hidden $MYSQLD_DATADIR/ib_logfile1
+
+--let $restart_parameters= --debug=d,innodb_log_abort_10
+--source include/restart_mysqld.inc
+--error ER_UNKNOWN_STORAGE_ENGINE
+SELECT * FROM t1;
+
+let SEARCH_PATTERN= InnoDB: Setting log file .*ib_logfile[0-9]+ size to;
+--source include/search_pattern_in_file.inc
+let SEARCH_PATTERN= InnoDB: Renaming log file .*ib_logfile101 to .*ib_logfile0;
+--source include/search_pattern_in_file.inc
+
+--let $restart_parameters=
+--source include/restart_mysqld.inc
+
+SELECT * FROM t1;
+DROP TABLE t1;
diff --git a/mysql-test/suite/innodb/t/log_file_size_checkpoint.test b/mysql-test/suite/innodb/t/log_file_size_checkpoint.test
new file mode 100644
index 00000000000..26e0bdf5e2c
--- /dev/null
+++ b/mysql-test/suite/innodb/t/log_file_size_checkpoint.test
@@ -0,0 +1,32 @@
+--source include/have_innodb.inc
+--source include/not_embedded.inc
+--source include/no_valgrind_without_big.inc
+
+CREATE DATABASE logtest;
+USE logtest;
+let $n=250;
+let $t=veryLongTableNameToCreateMLOG_FILE_NAMErecords;
+
+--disable_query_log
+call mtr.add_suppression("InnoDB: Resizing redo log");
+call mtr.add_suppression("InnoDB: Starting to delete and rewrite log files");
+call mtr.add_suppression("InnoDB: New log files created");
+FLUSH TABLES;
+
+let $i=$n;
+while ($i)
+{
+--eval CREATE TABLE $t$i(a INT PRIMARY KEY) ENGINE=InnoDB;
+dec $i;
+}
+
+# If we set above n to 500, this test case could fail easily, because
+# the inndob buffer pool is too small, some of which would be occupied
+# by the recv*. With n=250, this test case could sporadically fail too.
+# So we have to set buffer pool size to 50M which should be enough for this
+# test case. Once we fix the bug#22179133 and bug#22186325, we should use
+# the default innodb buffer pool(or the smaller one).
+let $restart_parameters = --innodb-log-files-in-group=2 --innodb-log-file-size=4M --innodb-buffer-pool-size=50M;
+--source include/kill_and_restart_mysqld.inc
+
+DROP DATABASE logtest;
diff --git a/mysql-test/suite/innodb_zip/t/wl6470_1.test b/mysql-test/suite/innodb/t/temp_table.test
index ecf6b601d3d..4809f278fb6 100644
--- a/mysql-test/suite/innodb_zip/t/wl6470_1.test
+++ b/mysql-test/suite/innodb/t/temp_table.test
@@ -1,6 +1,4 @@
--source include/have_innodb.inc
---source include/have_innodb_zip.inc
---source include/big_test.inc
####################################################################
# TC to test temp-table DML optimization changes for correctness #
@@ -22,28 +20,29 @@ create temporary table t2
(keyc int, c1 char(100), c2 char(100),
primary key(keyc), index sec_index(c1)
) engine = innodb;
---source suite/innodb_zip/include/innodb_dml_ops.inc
-drop table t1;
-drop table t2;
+--source suite/innodb/include/dml_ops.inc
+drop temporary table t1,t2;
#
---disable_warnings
+--error ER_UNSUPPORT_COMPRESSED_TEMPORARY_TABLE
create temporary table t1
(keyc int, c1 char(100), c2 char(100),
primary key(keyc), index sec_index(c1)
) engine = innodb key_block_size = 4;
+create temporary table t1
+ (keyc int, c1 char(100), c2 char(100),
+ primary key(keyc), index sec_index(c1)
+ ) engine = innodb;
set innodb_strict_mode=off;
+--disable_warnings
create temporary table t2
(keyc int, c1 char(100), c2 char(100),
primary key(keyc), index sec_index(c1)
) engine = innodb key_block_size = 8;
-set innodb_strict_mode=default;
+set innodb_strict_mode=on;
--enable_warnings
---source suite/innodb_zip/include/innodb_dml_ops.inc
-drop table t1;
-drop table t2;
+--source suite/innodb/include/dml_ops.inc
+drop temporary table t1, t2;
#
-let $file_per_table = `select @@innodb_file_per_table`;
-set global innodb_file_per_table = 0;
create temporary table t1
(keyc int, c1 char(100), c2 char(100),
primary key(keyc), index sec_index(c1)
@@ -52,9 +51,4 @@ create temporary table t2
(keyc int, c1 char(100), c2 char(100),
primary key(keyc), index sec_index(c1)
) engine = innodb;
---source suite/innodb_zip/include/innodb_dml_ops.inc
-drop table t1;
-drop table t2;
-eval set global innodb_file_per_table = $file_per_table;
-#
-
+--source suite/innodb/include/dml_ops.inc
diff --git a/mysql-test/suite/innodb_zip/t/wl6470_2.test b/mysql-test/suite/innodb/t/temp_table_savepoint.test
index 020c27b97b9..314ac148fca 100644
--- a/mysql-test/suite/innodb_zip/t/wl6470_2.test
+++ b/mysql-test/suite/innodb/t/temp_table_savepoint.test
@@ -1,11 +1,10 @@
--source include/have_innodb.inc
---source include/have_innodb_zip.inc
--source include/no_valgrind_without_big.inc
####################################################################
# TC to test temp-table DML optimization changes for correctness #
# Sceanrio covered in single testcase : #
-# - Tables with row format(redundant,compressed,dynamic,compact #
+# - Tables with row format(redundant,dynamic,compact) #
# - Table with primary,composite,prefix,secondary index #
# - Insert/delete/update with transactioons #
# - Transaction with commit,rollback,savepoint statements #
@@ -14,37 +13,20 @@
# - Inserting data using #
# - Insert into .. , Load data infile..,insert ignore #
# - Insert into .. on duplicate update #
-# - Check basic delete and upadte [ignore] #
+# - Check basic delete and update [ignore] #
# - Check constraints like duplicate key,default value #
# - Alter add column , add primary key #
# - with prepare and execute statement #
####################################################################
-# run for page size >= 8k
---disable_warnings
-if (`SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE LOWER(variable_name) = 'innodb_page_size' AND variable_value >= 8192`)
-{
- --skip Test requires InnoDB with page size >= 8k.
-}
---enable_warnings
-
-
-# Save initial values of server variable
---disable_query_log
-let $innodb_file_per_table_orig=`select @@innodb_file_per_table`;
-SET sql_mode = 'NO_ENGINE_SUBSTITUTION';
---enable_query_log
-
-# Create procedure to perform
+# Create procedure to perform
# 1. Create temp table with row types , index , sufficent data types
-# 2. Perform DML with transaction
+# 2. Perform DML with transaction
delimiter |;
create procedure populate_tables()
begin
declare n int default 20;
declare inner_loop int default 100;
- set global innodb_file_per_table=on;
- drop table if exists t1,t2,t3,t4;
create temporary table t1(c1 int not null,
c2 int not null,
@@ -56,7 +38,7 @@ create procedure populate_tables()
c8 datetime,
c9 decimal(6,3),
primary key (c1),
- index (c3,c4(50),c5(50)),
+ index (c3,c4(50),c5(50)),
index (c2))
engine=innodb row_format=redundant;
@@ -74,20 +56,6 @@ create procedure populate_tables()
index (c2))
engine=innodb row_format=compact;
- create temporary table t3(c1 int not null,
- c2 int not null,
- c3 char(255) not null,
- c4 text(6000) not null,
- c5 blob(6000) not null,
- c6 varchar(2000) not null,
- c7 varchar(2000) not null,
- c8 datetime,
- c9 decimal(6,3),
- primary key (c1),
- index (c3,c4(50),c5(50)),
- index (c2))
- engine=innodb row_format=compressed key_block_size=4;
-
create temporary table t4(c1 int not null,
c2 int not null,
c3 char(255) not null,
@@ -115,23 +83,19 @@ create procedure populate_tables()
index (c3,c4(50),c5(50)),
index (c2))
engine=innodb;
-
+
create temporary table t6 ( a int ) engine = innodb;
insert into t6 values (50),(100),(150),(190);
while (n > 0) do
start transaction;
insert into t1 values(n,n,repeat(concat(' tc3_',n),30),
- repeat(concat(' tc4_',n),800),repeat(concat(' tc_',n),800),
- repeat(concat(' tc6_',n),800),repeat(concat(' tc7_',n),800),
+ repeat(concat(' tc4_',n),8),repeat(concat(' tc_',n),8),
+ repeat(concat(' tc6_',n),8),repeat(concat(' tc7_',n),8),
now(),(100.55+n));
insert into t2 values(n,n,repeat(concat(' tc3_',n),30),
- repeat(concat(' tc4_',n),800),repeat(concat(' tc_',n),800),
- repeat(concat(' tc6_',n),800),repeat(concat(' tc7_',n),800),
- now(),(100.55+n));
- insert into t3 values(n,n,repeat(concat(' tc3_',n),30),
- repeat(concat(' tc4_',n),800),repeat(concat(' tc_',n),800),
- repeat(concat(' tc6_',n),800),repeat(concat(' tc7_',n),800),
+ repeat(concat(' tc4_',n),8),repeat(concat(' tc_',n),8),
+ repeat(concat(' tc6_',n),8),repeat(concat(' tc7_',n),8),
now(),(100.55+n));
insert into t4 values(n,n,repeat(concat(' tc3_',n),30),
repeat(concat(' tc4_',n),800),repeat(concat(' tc_',n),800),
@@ -144,35 +108,29 @@ create procedure populate_tables()
if (n > 10) then
commit;
- else
+ else
delete from t1 where c1 > 10 ;
delete from t2 where c1 > 10 ;
- delete from t3 where c1 > 10 ;
delete from t4 where c1 > 10 ;
delete from t5 where c1 > 10 ;
-
+
rollback;
start transaction;
update t1 set c1 = c1 + 1000 where c1 > 10;
update t2 set c1 = c1 + 1000 where c1 > 10;
- update t3 set c1 = c1 + 1000 where c1 > 10;
update t4 set c1 = c1 + 1000 where c1 > 10;
update t5 set c1 = c1 + 1000 where c1 > 10;
rollback;
- end if;
+ end if;
start transaction;
insert into t1 values(n+inner_loop,n+inner_loop,repeat(concat(' tc3_',n+inner_loop),30),
- repeat(concat(' tc4_',n+inner_loop),800),repeat(concat(' tc_',n+inner_loop),800),
- repeat(concat(' tc6_',n+inner_loop),245),repeat(concat(' tc7_',n+inner_loop),245),
+ repeat(concat(' tc4_',n+inner_loop),8),repeat(concat(' tc_',n+inner_loop),8),
+ repeat(concat(' tc6_',n+inner_loop),2),repeat(concat(' tc7_',n+inner_loop),2),
now(),(100.55+n+inner_loop));
insert into t2 values(n+inner_loop,n+inner_loop,repeat(concat(' tc3_',n+inner_loop),30),
- repeat(concat(' tc4_',n+inner_loop),800),repeat(concat(' tc_',n+inner_loop),800),
- repeat(concat(' tc6_',n+inner_loop),245),repeat(concat(' tc7_',n+inner_loop),245),
- now(),(100.55+n+inner_loop));
- insert into t3 values(n+inner_loop,n+inner_loop,repeat(concat(' tc3_',n+inner_loop),30),
- repeat(concat(' tc4_',n+inner_loop),800),repeat(concat(' tc_',n+inner_loop),800),
- repeat(concat(' tc6_',n+inner_loop),245),repeat(concat(' tc7_',n+inner_loop),245),
+ repeat(concat(' tc4_',n+inner_loop),8),repeat(concat(' tc_',n+inner_loop),8),
+ repeat(concat(' tc6_',n+inner_loop),2),repeat(concat(' tc7_',n+inner_loop),2),
now(),(100.55+n+inner_loop));
insert into t4 values(n+inner_loop,n+inner_loop,repeat(concat(' tc3_',n+inner_loop),30),
repeat(concat(' tc4_',n+inner_loop),800),repeat(concat(' tc_',n+inner_loop),800),
@@ -185,29 +143,23 @@ create procedure populate_tables()
delete from t1 where c1 between 100 and 110;
delete from t2 where c1 between 100 and 110;
- delete from t3 where c1 between 100 and 110;
delete from t4 where c1 between 100 and 110;
delete from t5 where c1 between 100 and 110;
- update t1 set c1 = c1+1 where c1>110;
- update t2 set c1 = c1+1 where c1>110;
- update t3 set c1 = c1+1 where c1>110;
- update t4 set c1 = c1+1 where c1>110;
- update t5 set c1 = c1+1 where c1>110;
+ update t1 set c1 = c1+1 where c1>110;
+ update t2 set c1 = c1+1 where c1>110;
+ update t4 set c1 = c1+1 where c1>110;
+ update t5 set c1 = c1+1 where c1>110;
savepoint a;
insert into t1 values(300+n+inner_loop,n+inner_loop,repeat(concat(' tc3_',n+inner_loop),30),
- repeat(concat(' tc4_',n+inner_loop),800),repeat(concat(' tc_',n+inner_loop),800),
- repeat(concat(' tc6_',n+inner_loop),245),repeat(concat(' tc7_',n+inner_loop),245),
+ repeat(concat(' tc4_',n+inner_loop),8),repeat(concat(' tc_',n+inner_loop),8),
+ repeat(concat(' tc6_',n+inner_loop),2),repeat(concat(' tc7_',n+inner_loop),2),
now(),(100.55+n+inner_loop));
insert into t2 values(300+n+inner_loop,n+inner_loop,repeat(concat(' tc3_',n+inner_loop),30),
- repeat(concat(' tc4_',n+inner_loop),800),repeat(concat(' tc_',n+inner_loop),800),
- repeat(concat(' tc6_',n+inner_loop),245),repeat(concat(' tc7_',n+inner_loop),245),
- now(),(100.55+n+inner_loop));
- insert into t3 values(300+n+inner_loop,n+inner_loop,repeat(concat(' tc3_',n+inner_loop),30),
- repeat(concat(' tc4_',n+inner_loop),800),repeat(concat(' tc_',n+inner_loop),800),
- repeat(concat(' tc6_',n+inner_loop),245),repeat(concat(' tc7_',n+inner_loop),245),
+ repeat(concat(' tc4_',n+inner_loop),8),repeat(concat(' tc_',n+inner_loop),8),
+ repeat(concat(' tc6_',n+inner_loop),2),repeat(concat(' tc7_',n+inner_loop),2),
now(),(100.55+n+inner_loop));
insert into t4 values(300+n+inner_loop,n+inner_loop,repeat(concat(' tc3_',n+inner_loop),30),
repeat(concat(' tc4_',n+inner_loop),800),repeat(concat(' tc_',n+inner_loop),800),
@@ -220,16 +172,12 @@ create procedure populate_tables()
savepoint b;
insert into t1 values(400+n+inner_loop,n+inner_loop,repeat(concat(' tc3_',n+inner_loop),30),
- repeat(concat(' tc4_',n+inner_loop),800),repeat(concat(' tc_',n+inner_loop),800),
- repeat(concat(' tc6_',n+inner_loop),245),repeat(concat(' tc7_',n+inner_loop),245),
+ repeat(concat(' tc4_',n+inner_loop),8),repeat(concat(' tc_',n+inner_loop),8),
+ repeat(concat(' tc6_',n+inner_loop),2),repeat(concat(' tc7_',n+inner_loop),2),
now(),(100.55+n+inner_loop));
insert into t2 values(400+n+inner_loop,n+inner_loop,repeat(concat(' tc3_',n+inner_loop),30),
- repeat(concat(' tc4_',n+inner_loop),800),repeat(concat(' tc_',n+inner_loop),800),
- repeat(concat(' tc6_',n+inner_loop),245),repeat(concat(' tc7_',n+inner_loop),245),
- now(),(100.55+n+inner_loop));
- insert into t3 values(400+n+inner_loop,n+inner_loop,repeat(concat(' tc3_',n+inner_loop),30),
- repeat(concat(' tc4_',n+inner_loop),800),repeat(concat(' tc_',n+inner_loop),800),
- repeat(concat(' tc6_',n+inner_loop),245),repeat(concat(' tc7_',n+inner_loop),245),
+ repeat(concat(' tc4_',n+inner_loop),8),repeat(concat(' tc_',n+inner_loop),8),
+ repeat(concat(' tc6_',n+inner_loop),2),repeat(concat(' tc7_',n+inner_loop),2),
now(),(100.55+n+inner_loop));
insert into t4 values(400+n+inner_loop,n+inner_loop,repeat(concat(' tc3_',n+inner_loop),30),
repeat(concat(' tc4_',n+inner_loop),800),repeat(concat(' tc_',n+inner_loop),800),
@@ -245,67 +193,42 @@ create procedure populate_tables()
commit;
commit;
rollback;
- set n = n - 1;
+ set n = n - 1;
end while;
end|
delimiter ;|
# Create two client for concurrent execution
connect (con1,localhost,root,,);
-connect (con2,localhost,root,,);
-
---echo #---client 1 : dml operation ---"
-connection con1;
--- disable_query_log
-eval set global innodb_file_per_table=$innodb_file_per_table_orig;
--- enable_query_log
--- disable_query_log
-# call procedure
--send call populate_tables();
--- enable_query_log
---echo #---client 2 : dml operation ---"
-connection con2;
--- disable_query_log
-eval set global innodb_file_per_table=$innodb_file_per_table_orig;
--- enable_query_log
--- disable_query_log
-# call procedure
+connect (con2,localhost,root,,);
--send call populate_tables();
--- enable_query_log
-# check data of client connection 1
---echo # In connection 1
connection con1;
--reap
-# 20 rows exepceted in 5 tables
+# 20 rows expected
select count(*) from t1;
select count(*) from t2;
-select count(*) from t3;
select count(*) from t4;
select count(*) from t5;
select c1 from t1;
select c1 from t2;
-select c1 from t3;
select c1 from t4;
select c1 from t5;
-# check data of client connection 2
---echo # In connection 2
+
connection con2;
--reap
-# 20 rows exepceted in 5 tables
+# 20 rows expected
select count(*) from t1;
select count(*) from t2;
-select count(*) from t3;
select count(*) from t4;
select count(*) from t5;
select c1 from t1;
select c1 from t2;
-select c1 from t3;
select c1 from t4;
select c1 from t5;
---echo # In connection 1
connection con1;
set autocommit = 0;
@@ -317,9 +240,6 @@ insert ignore into t1 values (20,1,'a','a','a','a','a',now(),100.55);
insert into t2 values (20,1,'a','a','a','a','a',now(),100.55);
insert ignore into t2 values (20,1,'a','a','a','a','a',now(),100.55);
--error ER_DUP_ENTRY
-insert into t3 values (20,1,'a','a','a','a','a',now(),100.55);
-insert ignore into t3 values (20,1,'a','a','a','a','a',now(),100.55);
---error ER_DUP_ENTRY
insert into t4 values (20,1,'a','a','a','a','a',now(),100.55);
insert ignore into t4 values (20,1,'a','a','a','a','a',now(),100.55);
--error ER_DUP_ENTRY
@@ -334,9 +254,6 @@ insert into t1 values (1,1,'a','a','a','a','a',now(),100.55),
insert into t2 values (1,1,'a','a','a','a','a',now(),100.55),
(20,1,'a','a','a','a','a',now(),100.55);
--error ER_DUP_ENTRY
-insert into t3 values (1,1,'a','a','a','a','a',now(),100.55),
-(20,1,'a','a','a','a','a',now(),100.55);
---error ER_DUP_ENTRY
insert into t4 values (1,1,'a','a','a','a','a',now(),100.55),
(20,1,'a','a','a','a','a',now(),100.55);
--error ER_DUP_ENTRY
@@ -347,74 +264,59 @@ set autocommit = 1;
select c1,c2 from t1 where c1 in (20,1);
select c1,c2 from t2 where c1 in (20,1);
-select c1,c2 from t3 where c1 in (20,1);
select c1,c2 from t4 where c1 in (20,1);
select c1,c2 from t5 where c1 in (20,1);
#replace statement
replace into t1 values (20,1,'a','a','a','a','a',now(),100.55);
replace into t2 values (20,1,'a','a','a','a','a',now(),100.55);
-replace into t3 values (20,1,'a','a','a','a','a',now(),100.55);
replace into t4 values (20,1,'a','a','a','a','a',now(),100.55);
replace into t5 values (20,1,'a','a','a','a','a',now(),100.55);
# verify row is replaced from (20,20) to (20,1)
select c1,c2,c3,c4,c5,c6,c7,c9 from t1 where c1 = 20;
select c1,c2,c3,c4,c5,c6,c7,c9 from t2 where c1 = 20;
-select c1,c2,c3,c4,c5,c6,c7,c9 from t3 where c1 = 20;
select c1,c2,c3,c4,c5,c6,c7,c9 from t4 where c1 = 20;
select c1,c2,c3,c4,c5,c6,c7,c9 from t5 where c1 = 20;
-# Update ignore. statement is gonored as 20 value exits
+# Update ignore. statement is ignored as 20 value exists
update ignore t1 set c1 = 20 where c1 = 140 ;
update ignore t2 set c1 = 20 where c1 = 140 ;
-update ignore t3 set c1 = 20 where c1 = 140 ;
update ignore t4 set c1 = 20 where c1 = 140 ;
update ignore t5 set c1 = 20 where c1 = 140 ;
# see record 140 is present as last update ignored
select count(*) from t1 where c1 = 140;
select count(*) from t2 where c1 = 140;
-select count(*) from t3 where c1 = 140;
select count(*) from t4 where c1 = 140;
select count(*) from t5 where c1 = 140;
-# Load data infile
---echo "running select * into outfile <file> from t1 ;
---disable_query_log
+--replace_result $MYSQLTEST_VARDIR VARDIR
eval select * into outfile "$MYSQLTEST_VARDIR/tmp/t1.outfile" from t1;
---enable_query_log
-# Create table as select
+
create temporary table temp_1 engine = innodb as select * from t1 where 1=2;
select count(*) from temp_1;
---echo "running load data infile <file> into temp_1 ;
---disable_query_log
+
+--replace_result $MYSQLTEST_VARDIR VARDIR
eval load data infile '$MYSQLTEST_VARDIR/tmp/t1.outfile' into table temp_1;
---enable_query_log
select count(*) from temp_1;
+--remove_file $MYSQLTEST_VARDIR/tmp/t1.outfile
# Alter table to add column and primary key
-alter table temp_1 add column c10 int default 99 ,
+alter table temp_1 add column c10 int default 99 ,
add column c11 varchar(100) default 'test';
alter table temp_1 add primary key (c1);
insert into temp_1 (c1,c2,c3,c4,c5,c6,c7,c8,c9) values (-1,-1,'a','a','a','a','a',now(),100.55);
select c1,c2,c3,c4,c5,c6,c7,c9,c10,c11 from temp_1 where c1 < 0;
select count(*) from temp_1 where c10 = 99 and c11 like 'test';
# insert on duplicate key update
-insert into temp_1 (c1,c2,c3,c4,c5,c6,c7,c8,c9) values (-1,-1,'a','a','a','a','a',now(),100.55)
+insert into temp_1 (c1,c2,c3,c4,c5,c6,c7,c8,c9) values (-1,-1,'a','a','a','a','a',now(),100.55)
on duplicate key update c1=-2,c2=-2;
select c1,c2,c3,c4,c5,c6,c7,c9,c10,c11 from temp_1 where c1 < 0;
-#cleanup
-drop table t1 ,t2 ,t3,t4,t5,t6,temp_1;
disconnect con1;
-
-connection con2;
-drop table t1 ,t2 ,t3,t4,t5,t6;
disconnect con2;
-
connection default;
drop procedure populate_tables;
-
# case 2 - with prepare and execute
let $prep_loop= 5;
create temporary table prep_1(c1 int not null,
@@ -457,12 +359,3 @@ select count(*) from prep_1;
drop prepare stm;
drop prepare stm_1;
drop prepare stm_2;
-drop table prep_1;
-
---remove_file $MYSQLTEST_VARDIR/tmp/t1.outfile
-
--- disable_query_log
-eval set global innodb_file_per_table=$innodb_file_per_table_orig;
-SET sql_mode = default;
--- enable_query_log
-
diff --git a/mysql-test/suite/innodb/t/temporary_table.test b/mysql-test/suite/innodb/t/temporary_table.test
new file mode 100644
index 00000000000..9f63fe52f3b
--- /dev/null
+++ b/mysql-test/suite/innodb/t/temporary_table.test
@@ -0,0 +1,445 @@
+#
+# InnoDB temporary table test case, including
+# WL#6560: InnoDB: separate tablespace for innodb-temp-tables.
+# WL#7899: InnoDB: Map compressed temporary tables to uncompressed
+#
+
+--source include/have_innodb.inc
+# Embedded server does not restart of server
+--source include/not_embedded.inc
+--source include/no_valgrind_without_big.inc
+
+--disable_query_log
+call mtr.add_suppression("last file in setting innodb_temp_data_file_path");
+call mtr.add_suppression("The table 't1' is full");
+call mtr.add_suppression("Plugin 'InnoDB' init function returned error");
+call mtr.add_suppression("Plugin 'InnoDB' registration as a STORAGE ENGINE failed");
+call mtr.add_suppression("InnoDB: Tablespace doesn't support raw devices");
+call mtr.add_suppression("InnoDB: The innodb_temporary data file 'ibtmp1' must be at least");
+call mtr.add_suppression("InnoDB: Plugin initialization aborted");
+call mtr.add_suppression("innodb_temporary and innodb_system file names seem to be the same");
+call mtr.add_suppression("Could not create the shared innodb_temporary");
+call mtr.add_suppression("InnoDB: syntax error in file path");
+--enable_query_log
+
+let $MYSQL_TMP_DIR = `select @@tmpdir`;
+let $MYSQL_DATA_DIR = `select @@datadir`;
+
+--echo # files in MYSQL_DATA_DIR
+--list_files $MYSQL_DATA_DIR/ ibtmp*
+
+create temporary table t1 (i int, f float, c char(100)) engine=innodb;
+insert into t1 values (100, 1.1, 'pune');
+insert into t1 values (99, 1.2, 'mumbai');
+insert into t1 values (98, 1.3, 'jaipur');
+insert into t1 values (97, 1.4, 'delhi');
+insert into t1 values (96, 1.5, 'ahmedabad');
+select * from t1;
+select * from t1 where i = 98;
+select * from t1 where i < 100;
+
+explain select * from t1 where f > 1.29999;
+alter table t1 add index sec_index(f);
+explain select * from t1 where f > 1.29999;
+select * from t1 where f > 1.29999;
+
+explain select * from t1 where i = 100;
+alter table t1 add unique index pri_index(i);
+explain select * from t1 where i = 100;
+select * from t1 where i = 100;
+
+delete from t1 where i < 97;
+select * from t1;
+insert into t1 values (96, 1.5, 'kolkata');
+select * from t1;
+
+update t1 set f = 1.44 where c = 'delhi';
+select * from t1;
+
+truncate table t1;
+insert into t1 values (100, 1.1, 'pune');
+insert into t1 values (99, 1.2, 'mumbai');
+insert into t1 values (98, 1.3, 'jaipur');
+insert into t1 values (97, 1.4, 'delhi');
+insert into t1 values (96, 1.5, 'ahmedabad');
+select * from t1;
+
+--error ER_CANNOT_DISCARD_TEMPORARY_TABLE
+alter table t1 discard tablespace;
+--error ER_CANNOT_DISCARD_TEMPORARY_TABLE
+alter table t1 import tablespace;
+drop temporary table t1;
+
+create temporary table t1
+ (keyc int, c1 char(100), c2 char(100),
+ primary key(keyc)) engine = innodb;
+delimiter |;
+CREATE PROCEDURE populate_t1()
+BEGIN
+ DECLARE i INT DEFAULT 1;
+ while (i <= 20000) DO
+ insert into t1 values (i, 'a', 'b');
+ SET i = i + 1;
+ END WHILE;
+END|
+delimiter ;|
+set autocommit=0;
+select count(*) from t1;
+call populate_t1();
+select count(*) from t1;
+select * from t1 limit 10;
+set autocommit=1;
+truncate table t1;
+select * from t1;
+#
+
+--echo # test condition of full-temp-tablespace
+--let $restart_parameters= --innodb_temp_data_file_path=ibtmp1:12M
+--source include/restart_mysqld.inc
+
+create temporary table t1
+ (keyc int, c1 char(100), c2 char(100),
+ primary key(keyc)) engine = innodb;
+begin;
+--error ER_RECORD_FILE_FULL
+call populate_t1();
+
+drop procedure populate_t1;
+
+--echo # test read-only mode
+--let $restart_parameters = --innodb-read-only
+--source include/restart_mysqld.inc
+
+--echo # files in MYSQL_DATA_DIR
+--list_files $MYSQL_DATA_DIR/ ibtmp*
+
+--error ER_NO_SUCH_TABLE
+select * from t1;
+show tables;
+--error ER_CANT_CREATE_TABLE
+create temporary table t1 (keyc int, c1 char(100), c2 char(100)) engine = innodb;
+
+--echo # test various bad start-up parameters
+
+let SEARCH_FILE = $MYSQLTEST_VARDIR/log/mysqld.1.err;
+let SEARCH_RANGE = -50000;
+let SEARCH_ABORT = NOT FOUND;
+let $check_no_innodb=SELECT * FROM INFORMATION_SCHEMA.ENGINES WHERE engine = 'innodb'
+AND support IN ('YES', 'DEFAULT', 'ENABLED');
+
+--let $restart_parameters= --innodb_data_file_path=ibdata1:12M:autoextend --innodb_temp_data_file_path=ibdata1:12M:autoextend
+--source include/restart_mysqld.inc
+--let SEARCH_PATTERN = innodb_temporary and innodb_system file names seem to be the same
+--source include/search_pattern_in_file.inc
+eval $check_no_innodb;
+
+--let $restart_parameters= --innodb_temp_data_file_path=foobar:3Gnewraw
+--source include/restart_mysqld.inc
+--let SEARCH_PATTERN = support raw device
+--source include/search_pattern_in_file.inc
+eval $check_no_innodb;
+
+--let $restart_parameters= --innodb_temp_data_file_path=barbar:3Graw
+--source include/restart_mysqld.inc
+--source include/search_pattern_in_file.inc
+eval $check_no_innodb;
+
+--let $restart_parameters= --innodb_temp_data_file_path=ibtmp1:2M:autoextend
+--source include/restart_mysqld.inc
+--let SEARCH_PATTERN = The innodb_temporary data file 'ibtmp1' must be at least
+--source include/search_pattern_in_file.inc
+eval $check_no_innodb;
+
+--let $restart_parameters= --innodb_temp_data_file_path=
+--source include/restart_mysqld.inc
+--let SEARCH_PATTERN = InnoDB: syntax error in file path
+--source include/search_pattern_in_file.inc
+eval $check_no_innodb;
+
+--let $restart_parameters=
+--source include/restart_mysqld.inc
+
+--error ER_UNSUPPORT_COMPRESSED_TEMPORARY_TABLE
+create temporary table t (
+ i int)
+ engine = innodb row_format = compressed;
+#
+--error ER_UNSUPPORT_COMPRESSED_TEMPORARY_TABLE
+create temporary table t (
+ i int)
+ engine = innodb row_format = compressed key_block_size = 8;
+#
+create temporary table t (
+ i int)
+ engine = innodb row_format = dynamic;
+show warnings;
+drop table t;
+#
+create temporary table t (
+ i int)
+ engine = innodb row_format = dynamic;
+show warnings;
+drop table t;
+set innodb_strict_mode = off;
+#
+create temporary table t (
+ i int)
+ engine = innodb row_format = compressed key_block_size = 8;
+show warnings;
+set innodb_strict_mode = default;
+#
+drop table t;
+--error ER_UNSUPPORT_COMPRESSED_TEMPORARY_TABLE
+create temporary table t (
+ i int)
+ engine = innodb row_format = compressed;
+--echo #files in MYSQL_TMP_DIR, expecting only default temporary tablespace file
+--list_files $MYSQL_TMP_DIR/ *.ibd
+--list_files $MYSQL_DATA_DIR/ ibtmp*
+#
+create temporary table t (
+ i int)
+ engine = innodb row_format = dynamic;
+show warnings;
+drop table t;
+#
+create temporary table t (
+ i int)
+ engine = innodb row_format = dynamic;
+show warnings;
+drop table t;
+set innodb_strict_mode = off;
+#
+create temporary table t (
+ i int)
+ engine = innodb row_format = dynamic key_block_size = 4;
+show warnings;
+drop table t;
+#
+create temporary table t (
+ i int)
+ engine = innodb row_format = compact;
+show warnings;
+drop table t;
+#
+create temporary table t (
+ i int)
+ engine = innodb key_block_size = 4;
+show warnings;
+drop table t;
+#
+
+CREATE TEMPORARY TABLE t1 (
+ i INT NOT NULL PRIMARY KEY,
+ c CHAR(10) NOT NULL
+) ENGINE = InnoDB KEY_BLOCK_SIZE = 4;
+SHOW WARNINGS;
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+#
+CREATE TEMPORARY TABLE t1 (
+ i INT NOT NULL PRIMARY KEY,
+ c CHAR(10) NOT NULL
+) ENGINE = InnoDB ROW_FORMAT = REDUNDANT;
+SHOW WARNINGS;
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+#
+CREATE TEMPORARY TABLE t1 (
+ i INT NOT NULL PRIMARY KEY,
+ c CHAR(10) NOT NULL
+) ENGINE = InnoDB ROW_FORMAT = COMPACT;
+SHOW WARNINGS;
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+#
+
+CREATE TEMPORARY TABLE t1 (
+ i INT NOT NULL PRIMARY KEY,
+ c CHAR(10) NOT NULL
+) ENGINE = InnoDB KEY_BLOCK_SIZE = 4;
+SHOW WARNINGS;
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+#
+CREATE TEMPORARY TABLE t1 (
+ i INT NOT NULL PRIMARY KEY,
+ c CHAR(10) NOT NULL
+) ENGINE = InnoDB ROW_FORMAT = COMPRESSED;
+SHOW WARNINGS;
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+#
+CREATE TEMPORARY TABLE t1 (
+ i INT NOT NULL PRIMARY KEY,
+ c CHAR(10) NOT NULL
+) ENGINE = InnoDB ROW_FORMAT = COMPRESSED KEY_BLOCK_SIZE = 8;
+SHOW WARNINGS;
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+#
+CREATE TEMPORARY TABLE t1 (
+ i INT NOT NULL PRIMARY KEY,
+ c CHAR(10) NOT NULL
+) ENGINE = InnoDB ROW_FORMAT = DYNAMIC KEY_BLOCK_SIZE = 8;
+SHOW WARNINGS;
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+#
+CREATE TEMPORARY TABLE t1 (
+ i INT NOT NULL PRIMARY KEY,
+ c CHAR(10) NOT NULL
+) ENGINE = InnoDB ROW_FORMAT = DYNAMIC;
+SHOW WARNINGS;
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+#
+
+# Test alter table for temporary tables with row format = compressed or
+# key_block_size
+CREATE TEMPORARY TABLE t1 (
+ i INT NOT NULL PRIMARY KEY
+) ENGINE = InnoDB ROW_FORMAT = REDUNDANT;
+
+ALTER TABLE t1 ROW_FORMAT = COMPRESSED;
+SHOW WARNINGS;
+SHOW CREATE TABLE t1;
+ALTER TABLE t1 KEY_BLOCK_SIZE = 4;
+SHOW WARNINGS;
+SHOW CREATE TABLE t1;
+ALTER TABLE t1 KEY_BLOCK_SIZE = 4 ROW_FORMAT = COMPRESSED;
+SHOW WARNINGS;
+SHOW CREATE TABLE t1;
+
+ALTER TABLE t1 ROW_FORMAT = DYNAMIC KEY_BLOCK_SIZE = 4;
+SHOW WARNINGS;
+SHOW CREATE TABLE t1;
+ALTER TABLE t1 ROW_FORMAT = DYNAMIC;
+SHOW WARNINGS;
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+
+# Set innodb_strict_mode=ON and test compressed temporary tables again.
+set innodb_strict_mode = ON;
+
+--error ER_UNSUPPORT_COMPRESSED_TEMPORARY_TABLE
+CREATE TEMPORARY TABLE t1 (
+ i INT NOT NULL PRIMARY KEY,
+ c CHAR(10) NOT NULL
+) ENGINE = InnoDB KEY_BLOCK_SIZE = 4;
+SHOW WARNINGS;
+#
+
+--error ER_UNSUPPORT_COMPRESSED_TEMPORARY_TABLE
+CREATE TEMPORARY TABLE t1 (
+ i INT NOT NULL PRIMARY KEY,
+ c CHAR(10) NOT NULL
+) ENGINE = InnoDB KEY_BLOCK_SIZE = 4, ROW_FORMAT = COMPACT;
+SHOW WARNINGS;
+#
+
+CREATE TEMPORARY TABLE t1 (
+ i INT NOT NULL PRIMARY KEY,
+ c CHAR(10) NOT NULL
+) ENGINE = InnoDB ROW_FORMAT = REDUNDANT;
+SHOW WARNINGS;
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+#
+
+--error ER_UNSUPPORT_COMPRESSED_TEMPORARY_TABLE
+CREATE TEMPORARY TABLE t1 (
+ i INT NOT NULL PRIMARY KEY,
+ c CHAR(10) NOT NULL
+) ENGINE = InnoDB KEY_BLOCK_SIZE = 4;
+SHOW WARNINGS;
+#
+
+--error ER_UNSUPPORT_COMPRESSED_TEMPORARY_TABLE
+CREATE TEMPORARY TABLE t1 (
+ i INT NOT NULL PRIMARY KEY,
+ c CHAR(10) NOT NULL
+) ENGINE = InnoDB ROW_FORMAT = COMPRESSED;
+SHOW WARNINGS;
+#
+
+--error ER_UNSUPPORT_COMPRESSED_TEMPORARY_TABLE
+CREATE TEMPORARY TABLE t1 (
+ i INT NOT NULL PRIMARY KEY,
+ c CHAR(10) NOT NULL
+) ENGINE = InnoDB ROW_FORMAT = COMPRESSED KEY_BLOCK_SIZE = 8;
+SHOW WARNINGS;
+#
+
+--error ER_UNSUPPORT_COMPRESSED_TEMPORARY_TABLE
+CREATE TEMPORARY TABLE t1 (
+ i INT NOT NULL PRIMARY KEY,
+ c CHAR(10) NOT NULL
+) ENGINE = InnoDB ROW_FORMAT = COMPRESSED KEY_BLOCK_SIZE = 7;
+SHOW WARNINGS;
+#
+
+CREATE TEMPORARY TABLE t1 (
+ i INT NOT NULL PRIMARY KEY,
+ c CHAR(10) NOT NULL
+) ENGINE = InnoDB ROW_FORMAT = DYNAMIC;
+SHOW WARNINGS;
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+#
+
+CREATE TEMPORARY TABLE t1 (
+ i INT NOT NULL PRIMARY KEY
+) ENGINE = InnoDB ROW_FORMAT = REDUNDANT;
+
+--error ER_UNSUPPORT_COMPRESSED_TEMPORARY_TABLE
+ALTER TABLE t1 ROW_FORMAT = COMPRESSED;
+SHOW WARNINGS;
+
+--error ER_UNSUPPORT_COMPRESSED_TEMPORARY_TABLE
+ALTER TABLE t1 KEY_BLOCK_SIZE = 4;
+SHOW WARNINGS;
+
+--error ER_UNSUPPORT_COMPRESSED_TEMPORARY_TABLE
+ALTER TABLE t1 ROW_FORMAT = DYNAMIC KEY_BLOCK_SIZE = 4;
+SHOW WARNINGS;
+
+ALTER TABLE t1 ROW_FORMAT = DYNAMIC;
+
+#
+# Some checking for turning innodb_strict_mode ON and OFF.
+set innodb_strict_mode = OFF;
+
+ALTER TABLE t1 ROW_FORMAT = COMPRESSED;
+SHOW WARNINGS;
+
+set innodb_strict_mode = ON;
+
+ALTER TABLE t1 ROW_FORMAT = DYNAMIC;
+SHOW CREATE TABLE t1;
+
+set innodb_strict_mode = OFF;
+
+ALTER TABLE t1 ROW_FORMAT = COMPRESSED;
+SHOW WARNINGS;
+
+ALTER TABLE t1 KEY_BLOCK_SIZE = 8;
+SHOW WARNINGS;
+
+set innodb_strict_mode = ON;
+
+--error ER_UNSUPPORT_COMPRESSED_TEMPORARY_TABLE
+ALTER TABLE t1 ADD COLUMN j INT;
+SHOW WARNINGS;
+SHOW CREATE TABLE t1;
+
+set innodb_strict_mode = OFF;
+
+ALTER TABLE t1 KEY_BLOCK_SIZE = 0;
+SHOW CREATE TABLE t1;
+
+ALTER TABLE t1 ROW_FORMAT = DYNAMIC;
+
+set innodb_strict_mode = ON;
+ALTER TABLE t1 ADD COLUMN j INT;
+SHOW CREATE TABLE t1;
diff --git a/mysql-test/suite/innodb/t/temporary_table_optimization.opt b/mysql-test/suite/innodb/t/temporary_table_optimization.opt
new file mode 100644
index 00000000000..2f73da1ead6
--- /dev/null
+++ b/mysql-test/suite/innodb/t/temporary_table_optimization.opt
@@ -0,0 +1 @@
+--loose-innodb-sys-datafiles --loose-innodb-sys-tables
diff --git a/mysql-test/suite/innodb/t/temporary_table_optimization.test b/mysql-test/suite/innodb/t/temporary_table_optimization.test
new file mode 100644
index 00000000000..ae41c87839b
--- /dev/null
+++ b/mysql-test/suite/innodb/t/temporary_table_optimization.test
@@ -0,0 +1,243 @@
+#
+# WL#6469: Optimizing CREATE/DROP performance for temporary tables
+#
+--source include/no_valgrind_without_big.inc
+--source include/have_innodb.inc
+
+#########################################################################
+# #
+# Will test following scenarios: #
+# 1. Create/Drop of temp-table. (with and w/o explicit pk) #
+# 2. Truncate temp-table (result in table drop and recreate). #
+# 3. Alter of temp-table. #
+# 4. Import/Discard of temp-table (to check blocked action) #
+# 5. Renaming of temp-table #
+# 6. Creating temp-table with large prefix. #
+# 7. Check Temp table info not stored in I_S datafile and tables #
+#########################################################################
+
+
+#-------------------------------------------------------------
+#
+# 1. Create/Drop of temp-table. (with and w/o explicit pk) #
+#
+create temporary table t1 (i int) engine = innodb;
+insert into t1 values (1), (2), (3), (4);
+select * from t1;
+select * from t1 where i = 4;
+drop table t1;
+#
+# recreate table wih same name to ensure entries are removed.
+create temporary table t1 (i int) engine = innodb;
+insert into t1 values (1), (2), (3), (4);
+select * from t1;
+select * from t1 where i = 4;
+drop table t1;
+#
+create temporary table t2 (i int) engine = innodb;
+insert into t2 values (1), (2), (3), (4);
+select * from t2;
+select * from t2 where i = 4;
+drop table t2;
+
+#-------------------------------------------------------------
+#
+# 2. Truncate temp-table (result in table drop and recreate). #
+#
+create temporary table t1
+ (keyc int, c1 char(100), c2 char(100),
+ primary key(keyc)) engine = innodb;
+delimiter |;
+create procedure populate_t1()
+begin
+ declare i int default 1;
+ while (i <= 200) DO
+ insert into t1 values (i, 'a', 'b');
+ set i = i + 1;
+ end while;
+end|
+delimiter ;|
+set autocommit=0;
+select count(*) from t1;
+call populate_t1();
+select count(*) from t1;
+select * from t1 limit 10;
+set autocommit=1;
+truncate table t1;
+select count(*) from t1;
+drop table t1;
+#
+# recreate table wih same name to ensure entries are removed.
+create temporary table t1 (i int) engine = innodb;
+insert into t1 values (1), (2), (3), (4);
+select * from t1;
+select * from t1 where i = 4;
+drop table t1;
+#
+create temporary table t1
+ (keyc int, c1 char(100), c2 char(100),
+ primary key(keyc))
+ engine = innodb;
+begin;
+select count(*) from t1;
+call populate_t1();
+select count(*) from t1;
+rollback;
+select count(*) from t1;
+begin;
+call populate_t1();
+commit;
+select count(*) from t1;
+truncate table t1;
+select count(*) from t1;
+drop table t1;
+#
+drop procedure populate_t1;
+
+
+#-------------------------------------------------------------
+#
+# 3. Alter of temp-table.
+#
+create temporary table t1 (t1_i int, t1_f float) engine = innodb;
+insert into t1 values (1, 1.1), (2, 2.2), (3, 2.2), (4, 4.4);
+#
+explain select * from t1 where t1_i = 1;
+alter table t1 add unique index pri_index(t1_i);
+explain select * from t1 where t1_i = 1;
+select * from t1 where t1_i = 1;
+#
+--error ER_DUP_ENTRY
+alter table t1 add unique index sec_index(t1_f);
+alter table t1 add index sec_index(t1_f);
+explain select * from t1 where t1_f > 2.2;
+select * from t1 where t1_f > 2.2;
+#
+alter table t1 add column (t1_c char(10));
+select * from t1;
+insert into t1 values (5, 5.5, 'krunal');
+#
+alter table t1 drop column t1_f;
+show create table t1;
+--error ER_BAD_FIELD_ERROR
+select * from t1 where t1_f > 2.2;
+#
+--error ER_ALTER_OPERATION_NOT_SUPPORTED
+alter table t1 add index sec_index2(t1_c), algorithm=inplace;
+#
+drop table t1;
+
+#-------------------------------------------------------------
+#
+# 4. Import/Discard of temp-table (to check blocked action)
+#
+create temporary table t1 (i int, f float) engine = innodb;
+insert into t1 values (10, 1.1), (20, 2.2);
+select * from t1;
+#
+--error ER_CANNOT_DISCARD_TEMPORARY_TABLE
+alter table t1 discard tablespace;
+--error ER_CANNOT_DISCARD_TEMPORARY_TABLE
+alter table t1 import tablespace;
+drop table t1;
+
+#-------------------------------------------------------------
+#
+# 5. Renaming of temp-table #
+#
+create temporary table t1 (i int) engine=innodb;
+insert into t1 values (1), (2), (3);
+select * from t1;
+#
+alter table t1 rename t2;
+--error ER_NO_SUCH_TABLE
+select * from t1;
+select * from t2;
+insert into t2 values (1), (2), (6), (7);
+select * from t2;
+drop table t2;
+
+
+#-------------------------------------------------------------
+#
+# 6. Creating temp-table with large prefix. #
+#
+SET sql_mode = 'NO_ENGINE_SUBSTITUTION';
+# This will lead to warnings on innodb_page_size=8k or 4k:
+# 8k: Specified key was too long; max key length is 1536 bytes
+# 4k: Specified key was too long; max key length is 768 bytes
+--disable_warnings
+#
+create temporary table t (
+ a int not null,
+ b blob not null,
+ index sk (b(3021))
+ ) row_format = dynamic engine=innodb;
+drop table t;
+#
+create temporary table t (
+ a int not null,
+ b blob not null,
+ index sk (b(3021))
+ ) row_format = dynamic engine=innodb;
+drop table t;
+#
+create temporary table t (
+ a int not null,
+ b blob not null,
+ index sk (b(3021))
+ ) row_format = dynamic engine=innodb;
+drop table t;
+#
+SET innodb_strict_mode=OFF;
+--error ER_INDEX_COLUMN_TOO_LONG
+create temporary table t (
+ a int not null,
+ b blob not null,
+ index sk (b(3021))
+ ) row_format = compact engine=innodb;
+#
+create temporary table t (
+ a int not null,
+ b blob not null,
+ index sk (b(3021))
+ ) row_format = dynamic engine=innodb;
+drop table t;
+#
+create temporary table t (
+ a int not null,
+ b blob not null,
+ index sk (b(3021))
+ ) row_format = compressed engine=innodb;
+drop table t;
+#
+--error ER_INDEX_COLUMN_TOO_LONG
+create temporary table t (
+ a int not null,
+ b blob not null,
+ index sk (b(3021))
+ ) row_format = compact engine=innodb;
+#
+create temporary table t (
+ a int not null,
+ b blob not null,
+ index sk (b(3021))
+ ) row_format = dynamic engine=innodb;
+drop table t;
+--enable_warnings
+#
+
+#-------------------------------------------------------------
+#
+# 7. Temp table info not stored in I_S
+#
+CREATE TABLE t1 ( i INT ) ENGINE = Innodb;
+CREATE TEMPORARY TABLE t2 ( i INT ) ENGINE = Innodb;
+SELECT COUNT(*) FROM information_schema.INNODB_SYS_DATAFILES WHERE PATH LIKE '%test%t_';
+SELECT COUNT(*) FROM information_schema.INNODB_SYS_TABLES WHERE NAME LIKE '%test%t_';
+CREATE TEMPORARY table t3 ( i INT ) ENGINE = Innodb;
+SELECT COUNT(*) FROM information_schema.INNODB_SYS_DATAFILES WHERE PATH LIKE '%test%t_';
+SELECT COUNT(*) FROM information_schema.INNODB_SYS_TABLES WHERE NAME LIKE '%test%t_';
+DROP TABLE t1,t2,t3;
+SELECT COUNT(*) FROM information_schema.INNODB_SYS_DATAFILES WHERE PATH LIKE '%test%t_';
+SELECT COUNT(*) FROM information_schema.INNODB_SYS_TABLES WHERE NAME LIKE '%test%t_';
diff --git a/mysql-test/suite/innodb/t/xa_recovery.test b/mysql-test/suite/innodb/t/xa_recovery.test
index 32373d63d14..f5c2b655545 100644
--- a/mysql-test/suite/innodb/t/xa_recovery.test
+++ b/mysql-test/suite/innodb/t/xa_recovery.test
@@ -1,7 +1,3 @@
-if (`select plugin_auth_version <= "5.6.24" from information_schema.plugins where plugin_name='innodb'`)
-{
- --skip Not fixed in InnoDB as of 5.6.24 or earlier
-}
--source include/have_innodb.inc
# Embedded server does not support restarting.
--source include/not_embedded.inc
@@ -9,31 +5,17 @@ if (`select plugin_auth_version <= "5.6.24" from information_schema.plugins wher
# 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");
FLUSH TABLES;
--enable_query_log
-#
-# We kill server belown with timeout 0 that is not fully safe
-#
-call mtr.add_suppression("InnoDB: Warning: database page corruption or a failed");
-
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';
connection default;
-call mtr.add_suppression("Found 1 prepared XA transactions");
-
-# Kill and restart the server.
--- exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--- shutdown_server 0
--- source include/wait_until_disconnected.inc
-
--- exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--- enable_reconnect
--- source include/wait_until_connected_again.inc
--- disable_reconnect
+--source include/kill_and_restart_mysqld.inc
disconnect con1;
connect (con1,localhost,root);
diff --git a/mysql-test/suite/innodb_zip/include/innodb_temp_table_dml.inc b/mysql-test/suite/innodb_zip/include/innodb_temp_table_dml.inc
deleted file mode 100644
index 42e0908f810..00000000000
--- a/mysql-test/suite/innodb_zip/include/innodb_temp_table_dml.inc
+++ /dev/null
@@ -1,40 +0,0 @@
-# insert test
-insert into t1 values (100, 1.1, 'pune');
-insert into t1 values (99, 1.2, 'mumbai');
-insert into t1 values (98, 1.3, 'jaipur');
-insert into t1 values (97, 1.4, 'delhi');
-insert into t1 values (96, 1.5, 'ahmedabad');
-select * from t1;
-select * from t1 where i = 98;
-select * from t1 where i < 100;
-#
-# add index using alter table table
-explain select * from t1 where f > 1.29999;
-alter table t1 add index sec_index(f);
-explain select * from t1 where f > 1.29999;
-select * from t1 where f > 1.29999;
-#
-explain select * from t1 where i = 100;
-alter table t1 add unique index pri_index(i);
-explain select * from t1 where i = 100;
-select * from t1 where i = 100;
-#
-# delete test
-delete from t1 where i < 97;
-select * from t1;
-insert into t1 values (96, 1.5, 'kolkata');
-select * from t1;
-#
-# update test
-update t1 set f = 1.44 where c = 'delhi';
-select * from t1;
-#
-# truncate table
-truncate table t1;
-insert into t1 values (100, 1.1, 'pune');
-insert into t1 values (99, 1.2, 'mumbai');
-insert into t1 values (98, 1.3, 'jaipur');
-insert into t1 values (97, 1.4, 'delhi');
-insert into t1 values (96, 1.5, 'ahmedabad');
-select * from t1;
-
diff --git a/mysql-test/suite/innodb_zip/include/innodb_wl6501_crash_stripped.inc b/mysql-test/suite/innodb_zip/include/innodb_wl6501_crash_stripped.inc
deleted file mode 100644
index fcefd0cdf7e..00000000000
--- a/mysql-test/suite/innodb_zip/include/innodb_wl6501_crash_stripped.inc
+++ /dev/null
@@ -1,144 +0,0 @@
-#
-# WL#6501: make truncate table atomic
-#
-
---source include/have_innodb.inc
---source include/have_debug.inc
-
-# Valgrind would complain about memory leaks when we crash on purpose.
---source include/not_valgrind.inc
-# Embedded server does not support crashing
---source include/not_embedded.inc
-# Avoid CrashReporter popup on Mac
---source include/not_crashrep.inc
-
-# suppress expected warnings.
-call mtr.add_suppression("The file '.*' already exists though the corresponding table did not exist in the InnoDB data dictionary");
-call mtr.add_suppression("Cannot create file '.*'");
-call mtr.add_suppression("InnoDB: Error number 17 means 'File exists'");
-
-################################################################################
-#
-# Will test following scenarios:
-# 1. Hit crash point on completing drop of all indexes before creation of index
-# is commenced.
-# 2. Hit crash point after data is updated to system-table and in-memory dict.
-# 3. Post truncate recovery, abruptly shutdown the server.
-# On restart ensure table state is maintained.
-#
-################################################################################
-
-#-----------------------------------------------------------------------------
-#
-# create test-bed
-#
-
-let $WL6501_TMP_DIR = `select @@tmpdir`;
-let $WL6501_DATA_DIR = `select @@datadir`;
-let SEARCH_FILE = $MYSQLTEST_VARDIR/log/my_restart.err;
-
-#-----------------------------------------------------------------------------
-#
-# 1. Hit crash point on completing drop of all indexes before creation of index
-# is commenced.
-#
---echo "1. Hit crash point on completing drop of all indexes before creation"
---echo " of index is commenced."
-eval set global innodb_file_per_table = $wl6501_file_per_table;
-eval set global innodb_file_format = $wl6501_file_format;
-set innodb_strict_mode=off;
---disable_warnings
-eval create $wl6501_temp table t (
- i int, f float, c char,
- primary key pk(i), unique findex(f), index ck(c))
- engine = innodb row_format = $wl6501_row_fmt
- key_block_size = $wl6501_kbs;
---enable_warnings
-insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c');
-select * from t;
-check table t;
-#
-set session debug = "+d,ib_trunc_crash_drop_reinit_done_create_to_start";
---source include/expect_crash.inc
---error 2013
-truncate table t;
-#
---source include/start_mysqld.inc
-
-check table t;
-select * from t;
-insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c');
-select * from t;
-select * from t where f < 2.5;
-drop table t;
-
-#-----------------------------------------------------------------------------
-#
-# 2. Hit crash point after data is updated to system-table and in-memory dict.
-#
---echo "2. Hit crash point after data is updated to system-table and"
---echo " in-memory dict."
-eval set global innodb_file_per_table = $wl6501_file_per_table;
-eval set global innodb_file_format = $wl6501_file_format;
-set innodb_strict_mode=off;
---disable_warnings
-eval create $wl6501_temp table t (
- i int, f float, c char,
- primary key pk(i), unique findex(f), index ck(c))
- engine = innodb row_format = $wl6501_row_fmt
- key_block_size = $wl6501_kbs;
---enable_warnings
-insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c');
-select * from t;
-check table t;
-#
-set session debug = "+d,ib_trunc_crash_on_updating_dict_sys_info";
---source include/expect_crash.inc
---error 2013
-truncate table t;
-#
---source include/start_mysqld.inc
-check table t;
-select * from t;
-insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c');
-select * from t;
-select * from t where f < 2.5;
-drop table t;
-
-#-----------------------------------------------------------------------------
-#
-# 3. Post truncate recovery, abruptly shutdown the server.
-# On restart ensure table state is maintained.
-#
---echo "3. Post truncate recovery, abruptly shutdown the server."
---echo " On restart ensure table state is maintained."
-eval set global innodb_file_per_table = $wl6501_file_per_table;
-eval set global innodb_file_format = $wl6501_file_format;
-set innodb_strict_mode=off;
---disable_warnings
-eval create $wl6501_temp table t (
- i int, f float, c char,
- primary key pk(i), unique findex(f), index ck(c))
- engine = innodb row_format = $wl6501_row_fmt
- key_block_size = $wl6501_kbs;
---enable_warnings
-insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c');
-select * from t;
-check table t;
-#
-set session debug = "+d,ib_trunc_crash_after_redo_log_write_complete";
---source include/expect_crash.inc
---error 2013
-truncate table t;
-#
---source include/start_mysqld.inc
-check table t;
-select * from t;
-insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c');
-#
---source include/kill_and_restart_mysqld.inc
-#
-check table t;
-select * from t;
-select * from t where f < 2.5;
-drop table t;
diff --git a/mysql-test/suite/innodb_zip/include/innodb_wl6501_error.inc b/mysql-test/suite/innodb_zip/include/innodb_wl6501_error.inc
index 0939d452dae..424608f251b 100644
--- a/mysql-test/suite/innodb_zip/include/innodb_wl6501_error.inc
+++ b/mysql-test/suite/innodb_zip/include/innodb_wl6501_error.inc
@@ -44,7 +44,6 @@ set innodb_strict_mode=off;
#
--echo "1. Error in assigning undo logs for truncate action."
eval set global innodb_file_per_table = $wl6501_file_per_table;
-eval set global innodb_file_format = $wl6501_file_format;
--disable_warnings
eval create $wl6501_temp table t (
i int, f float, c char,
@@ -71,7 +70,6 @@ drop table t;
#
--echo "2. Error while preparing for truncate."
eval set global innodb_file_per_table = $wl6501_file_per_table;
-eval set global innodb_file_format = $wl6501_file_format;
--disable_warnings
eval create $wl6501_temp table t (
i int, f float, c char,
@@ -98,7 +96,6 @@ drop table t;
#
--echo "3. Error while dropping/creating indexes"
eval set global innodb_file_per_table = $wl6501_file_per_table;
-eval set global innodb_file_format = $wl6501_file_format;
--disable_warnings
eval create $wl6501_temp table t (
i int, f float, c char,
@@ -122,7 +119,6 @@ drop table t;
#
#
eval set global innodb_file_per_table = $wl6501_file_per_table;
-eval set global innodb_file_format = $wl6501_file_format;
--disable_warnings
eval create $wl6501_temp table t (
i int, f float, c char,
@@ -146,7 +142,6 @@ drop table t;
#
#
eval set global innodb_file_per_table = $wl6501_file_per_table;
-eval set global innodb_file_format = $wl6501_file_format;
--disable_warnings
eval create temporary table t (
i int, f float, c char,
@@ -174,7 +169,6 @@ drop table t;
#
--echo "4. Error while completing truncate of table involving FTS."
eval set global innodb_file_per_table = $wl6501_file_per_table;
-eval set global innodb_file_format = $wl6501_file_format;
--disable_warnings
eval create $wl6501_temp table t (i int, f float, c char(100),
primary key pk(i), index fk(f), fulltext index ck(c))
@@ -203,7 +197,6 @@ drop table t;
#
--echo "5. Error while updating sys-tables."
eval set global innodb_file_per_table = $wl6501_file_per_table;
-eval set global innodb_file_format = $wl6501_file_format;
--disable_warnings
eval create $wl6501_temp table t (i int, f float, c char(100),
primary key pk(i), index fk(f), fulltext index ck(c))
@@ -230,5 +223,4 @@ drop table t;
#
# remove test-bed
#
-eval set global innodb_file_format = $format;
eval set global innodb_file_per_table = $per_table;
diff --git a/mysql-test/suite/innodb_zip/include/innodb_wl6501_scale.inc b/mysql-test/suite/innodb_zip/include/innodb_wl6501_scale.inc
index 67569d3dae9..bef28a9c484 100644
--- a/mysql-test/suite/innodb_zip/include/innodb_wl6501_scale.inc
+++ b/mysql-test/suite/innodb_zip/include/innodb_wl6501_scale.inc
@@ -45,7 +45,6 @@ delimiter ;|
# create and load the tables.
#
eval set global innodb_file_per_table = $wl6501_file_per_table;
-eval set global innodb_file_format = $wl6501_file_format;
--replace_regex /[0-9]+/NUMBER/
eval create table t1
(i int, c1 char(100), c2 char(100),
diff --git a/mysql-test/suite/innodb_zip/r/create_options.result b/mysql-test/suite/innodb_zip/r/create_options.result
index 2d80894c8cd..1c152229b3c 100644
--- a/mysql-test/suite/innodb_zip/r/create_options.result
+++ b/mysql-test/suite/innodb_zip/r/create_options.result
@@ -1,4 +1,7 @@
SET default_storage_engine=InnoDB;
+SET GLOBAL innodb_file_format=`Barracuda`;
+Warnings:
+Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
SET GLOBAL innodb_file_per_table=ON;
SET SESSION innodb_strict_mode = ON;
# Test 1) StrictMode=ON, CREATE and ALTER with each ROW_FORMAT & KEY_BLOCK_SIZE=0
@@ -309,6 +312,10 @@ Warning 1478 InnoDB: ROW_FORMAT=COMPRESSED requires innodb_file_format > Antelop
Error 1478 Table storage engine 'InnoDB' does not support the create option 'ROW_FORMAT'
ALTER TABLE t1 ROW_FORMAT=DYNAMIC;
ERROR HY000: Table storage engine 'InnoDB' does not support the create option 'ROW_FORMAT'
+SHOW WARNINGS;
+Level Code Message
+Warning 1478 InnoDB: ROW_FORMAT=DYNAMIC requires innodb_file_format > Antelope.
+Error 1478 Table storage engine 'InnoDB' does not support the create option 'ROW_FORMAT'
SET GLOBAL innodb_file_format=Barracuda;
Warnings:
Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
@@ -340,7 +347,7 @@ Level Code Message
SET GLOBAL innodb_file_format=Barracuda;
Warnings:
Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
-# Test 8) StrictMode=ON, Make sure ROW_FORMAT= COMPRESSED & DYNAMIC and
+# Test 8) StrictMode=ON, Make sure ROW_FORMAT=COMPRESSED
# and a valid non-zero KEY_BLOCK_SIZE are rejected with
# innodb_file_per_table=OFF and that they can be set to default
# values during strict mode.
@@ -361,7 +368,12 @@ Warning 1478 InnoDB: ROW_FORMAT=COMPRESSED requires innodb_file_per_table.
Error 1005 Can't create table `test`.`t1` (errno: 140 "Wrong create options")
Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB
CREATE TABLE t1 ( i INT ) ROW_FORMAT=DYNAMIC;
-ERROR HY000: Can't create table `test`.`t1` (errno: 140 "Wrong create options")
+SHOW WARNINGS;
+Level Code Message
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
+TABLE_NAME ROW_FORMAT CREATE_OPTIONS
+t1 Dynamic row_format=DYNAMIC
+DROP TABLE t1;
CREATE TABLE t1 ( i INT ) ROW_FORMAT=REDUNDANT;
SHOW WARNINGS;
Level Code Message
@@ -392,7 +404,11 @@ Level Code Message
Warning 1478 InnoDB: ROW_FORMAT=COMPRESSED requires innodb_file_per_table.
Error 1478 Table storage engine 'InnoDB' does not support the create option 'ROW_FORMAT'
ALTER TABLE t1 ROW_FORMAT=DYNAMIC;
-ERROR HY000: Table storage engine 'InnoDB' does not support the create option 'ROW_FORMAT'
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
+TABLE_NAME ROW_FORMAT CREATE_OPTIONS
+t1 Dynamic row_format=DYNAMIC
+SHOW WARNINGS;
+Level Code Message
ALTER TABLE t1 ROW_FORMAT=COMPACT;
SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
TABLE_NAME ROW_FORMAT CREATE_OPTIONS
@@ -837,3 +853,5 @@ TABLE_NAME ROW_FORMAT CREATE_OPTIONS
t1 Dynamic row_format=DYNAMIC
# Cleanup
DROP TABLE t1;
+Warnings:
+Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
diff --git a/mysql-test/suite/innodb_zip/r/innochecksum.result b/mysql-test/suite/innodb_zip/r/innochecksum.result
index d05f93bd5af..ff1bccfb60c 100644
--- a/mysql-test/suite/innodb_zip/r/innochecksum.result
+++ b/mysql-test/suite/innodb_zip/r/innochecksum.result
@@ -1,7 +1,6 @@
# Set the environmental variables
call mtr.add_suppression("InnoDB: Unable to read tablespace .* page no .* into the buffer pool after 100 attempts");
call mtr.add_suppression("InnoDB: Warning: database page corruption or a failed");
-SET GLOBAL innodb_file_per_table=on;
CREATE TABLE tab1(c1 INT PRIMARY KEY,c2 VARCHAR(20)) ENGINE=InnoDB;
CREATE INDEX idx1 ON tab1(c2(10));
INSERT INTO tab1 VALUES(1, 'Innochecksum InnoDB1');
@@ -89,6 +88,4 @@ c1 c2
FOUND /Error while setting value \'strict_crc32\' to \'write\'/ in my_restart.err
FOUND /Error while setting value \'strict_innodb\' to \'write\'/ in my_restart.err
FOUND /Error while setting value \'crc23\' to \'write\'/ in my_restart.err
-# Restart the server
DROP TABLE tab1;
-SET GLOBAL innodb_file_per_table=default;
diff --git a/mysql-test/suite/innodb_zip/r/innochecksum_2.result b/mysql-test/suite/innodb_zip/r/innochecksum_2.result
index 649c32b1a87..78d8a1cbf90 100644
--- a/mysql-test/suite/innodb_zip/r/innochecksum_2.result
+++ b/mysql-test/suite/innodb_zip/r/innochecksum_2.result
@@ -41,7 +41,7 @@ innochecksum Ver #.#.#
Copyright (c) YEAR, YEAR , Oracle, MariaDB Corporation Ab and others.
InnoDB offline file checksum utility.
-Usage: innochecksum [-c] [-s <start page>] [-e <end page>] [-p <page>] [-v] [-a <allow mismatches>] [-n] [-C <strict-check>] [-w <write>] [-S] [-D <page type dump>] [-l <log>] <filename or [-]>
+Usage: innochecksum [-c] [-s <start page>] [-e <end page>] [-p <page>] [-v] [-a <allow mismatches>] [-n] [-C <strict-check>] [-w <write>] [-S] [-D <page type dump>] [-l <log>] [-e] <filename or [-]>
-?, --help Displays this help and exits.
-I, --info Synonym for --help.
-V, --version Displays version information and exits.
@@ -63,7 +63,7 @@ Usage: innochecksum [-c] [-s <start page>] [-e <end page>] [-p <page>] [-v] [-a
-D, --page-type-dump=name
Dump the page type info for each page in a tablespace.
-l, --log=name log output.
- -l, --leaf Examine leaf index pages
+ -e, --leaf Examine leaf index pages
-m, --merge=# leaf page count if merge given number of consecutive
pages
diff --git a/mysql-test/suite/innodb_zip/r/innochecksum_3.result b/mysql-test/suite/innodb_zip/r/innochecksum_3.result
index c5c2a7673b3..32e6d3f1d13 100644
--- a/mysql-test/suite/innodb_zip/r/innochecksum_3.result
+++ b/mysql-test/suite/innodb_zip/r/innochecksum_3.result
@@ -1,6 +1,5 @@
# Set the environmental variables
call mtr.add_suppression("InnoDB: Unable to read tablespace .* page no .* into the buffer pool after 100 attempts");
-SET GLOBAL innodb_file_per_table=on;
[1]: Further Test are for rewrite checksum (innodb|crc32|none) for all ibd file & start the server.
CREATE TABLE tab1 (pk INTEGER NOT NULL PRIMARY KEY,
linestring_key GEOMETRY NOT NULL,
@@ -221,7 +220,4 @@ NOT FOUND /Incorrect unsigned integer value: '18446744073709551616'/ in my_resta
NOT FOUND /Incorrect unsigned integer value: '18446744073709551616'/ in my_restart.err
NOT FOUND /Incorrect unsigned integer value: '18446744073709551616'/ in my_restart.err
NOT FOUND /Incorrect unsigned integer value: '18446744073709551616'/ in my_restart.err
-# Restart the server
-DROP TABLE tab1;
-DROP TABLE tab2;
-SET GLOBAL innodb_file_per_table=default;
+DROP TABLE tab1,tab2;
diff --git a/mysql-test/suite/innodb_zip/r/innodb-create-options.result b/mysql-test/suite/innodb_zip/r/innodb-create-options.result
deleted file mode 100644
index 1b92eb71fba..00000000000
--- a/mysql-test/suite/innodb_zip/r/innodb-create-options.result
+++ /dev/null
@@ -1,870 +0,0 @@
-SET default_storage_engine=InnoDB;
-SET GLOBAL innodb_file_format=`Barracuda`;
-Warnings:
-Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
-SET GLOBAL innodb_file_per_table=ON;
-SET SESSION innodb_strict_mode = ON;
-# Test 1) StrictMode=ON, CREATE and ALTER with each ROW_FORMAT & KEY_BLOCK_SIZE=0
-# KEY_BLOCK_SIZE=0 means 'no KEY_BLOCK_SIZE is specified'
-DROP TABLE IF EXISTS t1;
-Warnings:
-Note 1051 Unknown table 'test.t1'
-# 'FIXED' is sent to InnoDB since it is used by MyISAM.
-# But it is an invalid mode in InnoDB
-CREATE TABLE t1 ( i INT ) ROW_FORMAT=FIXED;
-ERROR HY000: Can't create table `test`.`t1` (errno: 140 "Wrong create options")
-SHOW WARNINGS;
-Level Code Message
-Warning 1478 InnoDB: invalid ROW_FORMAT specifier.
-Error 1005 Can't create table `test`.`t1` (errno: 140 "Wrong create options")
-Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB
-CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=0;
-SHOW WARNINGS;
-Level Code Message
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
-TABLE_NAME ROW_FORMAT CREATE_OPTIONS
-t1 Compressed row_format=COMPRESSED
-ALTER TABLE t1 ROW_FORMAT=COMPACT KEY_BLOCK_SIZE=0;
-SHOW WARNINGS;
-Level Code Message
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
-TABLE_NAME ROW_FORMAT CREATE_OPTIONS
-t1 Compact row_format=COMPACT
-ALTER TABLE t1 ROW_FORMAT=DYNAMIC KEY_BLOCK_SIZE=0;
-SHOW WARNINGS;
-Level Code Message
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
-TABLE_NAME ROW_FORMAT CREATE_OPTIONS
-t1 Dynamic row_format=DYNAMIC
-ALTER TABLE t1 ROW_FORMAT=REDUNDANT KEY_BLOCK_SIZE=0;
-SHOW WARNINGS;
-Level Code Message
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
-TABLE_NAME ROW_FORMAT CREATE_OPTIONS
-t1 Redundant row_format=REDUNDANT
-ALTER TABLE t1 ROW_FORMAT=DEFAULT KEY_BLOCK_SIZE=0;
-SHOW WARNINGS;
-Level Code Message
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
-TABLE_NAME ROW_FORMAT CREATE_OPTIONS
-t1 Dynamic
-ALTER TABLE t1 ROW_FORMAT=FIXED KEY_BLOCK_SIZE=0;
-ERROR HY000: Table storage engine 'InnoDB' does not support the create option 'ROW_TYPE'
-SHOW WARNINGS;
-Level Code Message
-Warning 1478 InnoDB: invalid ROW_FORMAT specifier.
-Error 1478 Table storage engine 'InnoDB' does not support the create option 'ROW_TYPE'
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
-TABLE_NAME ROW_FORMAT CREATE_OPTIONS
-t1 Dynamic
-# Test 2) StrictMode=ON, CREATE with each ROW_FORMAT & a valid non-zero KEY_BLOCK_SIZE
-# KEY_BLOCK_SIZE is incompatible with COMPACT, REDUNDANT, & DYNAMIC
-DROP TABLE IF EXISTS t1;
-CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPACT KEY_BLOCK_SIZE=1;
-ERROR HY000: Can't create table `test`.`t1` (errno: 140 "Wrong create options")
-SHOW WARNINGS;
-Level Code Message
-Warning 1478 InnoDB: cannot specify ROW_FORMAT = COMPACT with KEY_BLOCK_SIZE.
-Error 1005 Can't create table `test`.`t1` (errno: 140 "Wrong create options")
-Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB
-CREATE TABLE t1 ( i INT ) ROW_FORMAT=REDUNDANT KEY_BLOCK_SIZE=2;
-ERROR HY000: Can't create table `test`.`t1` (errno: 140 "Wrong create options")
-SHOW WARNINGS;
-Level Code Message
-Warning 1478 InnoDB: cannot specify ROW_FORMAT = REDUNDANT with KEY_BLOCK_SIZE.
-Error 1005 Can't create table `test`.`t1` (errno: 140 "Wrong create options")
-Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB
-CREATE TABLE t1 ( i INT ) ROW_FORMAT=DYNAMIC KEY_BLOCK_SIZE=4;
-ERROR HY000: Can't create table `test`.`t1` (errno: 140 "Wrong create options")
-SHOW WARNINGS;
-Level Code Message
-Warning 1478 InnoDB: cannot specify ROW_FORMAT = DYNAMIC with KEY_BLOCK_SIZE.
-Error 1005 Can't create table `test`.`t1` (errno: 140 "Wrong create options")
-Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB
-CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=2;
-SHOW WARNINGS;
-Level Code Message
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
-TABLE_NAME ROW_FORMAT CREATE_OPTIONS
-t1 Compressed row_format=COMPRESSED key_block_size=2
-ALTER TABLE t1 ADD COLUMN f1 INT;
-SHOW WARNINGS;
-Level Code Message
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
-TABLE_NAME ROW_FORMAT CREATE_OPTIONS
-t1 Compressed row_format=COMPRESSED key_block_size=2
-DROP TABLE IF EXISTS t1;
-CREATE TABLE t1 ( i INT ) ROW_FORMAT=DEFAULT KEY_BLOCK_SIZE=1;
-SHOW WARNINGS;
-Level Code Message
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
-TABLE_NAME ROW_FORMAT CREATE_OPTIONS
-t1 Compressed key_block_size=1
-ALTER TABLE t1 ADD COLUMN f1 INT;
-SHOW WARNINGS;
-Level Code Message
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
-TABLE_NAME ROW_FORMAT CREATE_OPTIONS
-t1 Compressed key_block_size=1
-# Test 3) StrictMode=ON, ALTER with each ROW_FORMAT & a valid non-zero KEY_BLOCK_SIZE
-DROP TABLE IF EXISTS t1;
-CREATE TABLE t1 ( i INT );
-ALTER TABLE t1 ROW_FORMAT=FIXED KEY_BLOCK_SIZE=1;
-ERROR HY000: Table storage engine 'InnoDB' does not support the create option 'ROW_TYPE'
-SHOW WARNINGS;
-Level Code Message
-Warning 1478 InnoDB: invalid ROW_FORMAT specifier.
-Error 1478 Table storage engine 'InnoDB' does not support the create option 'ROW_TYPE'
-ALTER TABLE t1 ROW_FORMAT=COMPACT KEY_BLOCK_SIZE=2;
-ERROR HY000: Table storage engine 'InnoDB' does not support the create option 'KEY_BLOCK_SIZE'
-SHOW WARNINGS;
-Level Code Message
-Warning 1478 InnoDB: cannot specify ROW_FORMAT = COMPACT with KEY_BLOCK_SIZE.
-Error 1478 Table storage engine 'InnoDB' does not support the create option 'KEY_BLOCK_SIZE'
-ALTER TABLE t1 ROW_FORMAT=DYNAMIC KEY_BLOCK_SIZE=4;
-ERROR HY000: Table storage engine 'InnoDB' does not support the create option 'KEY_BLOCK_SIZE'
-SHOW WARNINGS;
-Level Code Message
-Warning 1478 InnoDB: cannot specify ROW_FORMAT = DYNAMIC with KEY_BLOCK_SIZE.
-Error 1478 Table storage engine 'InnoDB' does not support the create option 'KEY_BLOCK_SIZE'
-ALTER TABLE t1 ROW_FORMAT=REDUNDANT KEY_BLOCK_SIZE=2;
-ERROR HY000: Table storage engine 'InnoDB' does not support the create option 'KEY_BLOCK_SIZE'
-SHOW WARNINGS;
-Level Code Message
-Warning 1478 InnoDB: cannot specify ROW_FORMAT = REDUNDANT with KEY_BLOCK_SIZE.
-Error 1478 Table storage engine 'InnoDB' does not support the create option 'KEY_BLOCK_SIZE'
-ALTER TABLE t1 ROW_FORMAT=DEFAULT KEY_BLOCK_SIZE=1;
-SHOW WARNINGS;
-Level Code Message
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
-TABLE_NAME ROW_FORMAT CREATE_OPTIONS
-t1 Compressed key_block_size=1
-ALTER TABLE t1 ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1;
-SHOW WARNINGS;
-Level Code Message
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
-TABLE_NAME ROW_FORMAT CREATE_OPTIONS
-t1 Compressed row_format=COMPRESSED key_block_size=1
-# Test 4) StrictMode=ON, CREATE with ROW_FORMAT=COMPACT, ALTER with a valid non-zero KEY_BLOCK_SIZE
-DROP TABLE IF EXISTS t1;
-CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPACT;
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
-TABLE_NAME ROW_FORMAT CREATE_OPTIONS
-t1 Compact row_format=COMPACT
-ALTER TABLE t1 KEY_BLOCK_SIZE=2;
-ERROR HY000: Table storage engine 'InnoDB' does not support the create option 'KEY_BLOCK_SIZE'
-SHOW WARNINGS;
-Level Code Message
-Warning 1478 InnoDB: cannot specify ROW_FORMAT = COMPACT with KEY_BLOCK_SIZE.
-Error 1478 Table storage engine 'InnoDB' does not support the create option 'KEY_BLOCK_SIZE'
-ALTER TABLE t1 ROW_FORMAT=REDUNDANT;
-SHOW WARNINGS;
-Level Code Message
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
-TABLE_NAME ROW_FORMAT CREATE_OPTIONS
-t1 Redundant row_format=REDUNDANT
-ALTER TABLE t1 KEY_BLOCK_SIZE=4;
-ERROR HY000: Table storage engine 'InnoDB' does not support the create option 'KEY_BLOCK_SIZE'
-SHOW WARNINGS;
-Level Code Message
-Warning 1478 InnoDB: cannot specify ROW_FORMAT = REDUNDANT with KEY_BLOCK_SIZE.
-Error 1478 Table storage engine 'InnoDB' does not support the create option 'KEY_BLOCK_SIZE'
-ALTER TABLE t1 ROW_FORMAT=DYNAMIC;
-SHOW WARNINGS;
-Level Code Message
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
-TABLE_NAME ROW_FORMAT CREATE_OPTIONS
-t1 Dynamic row_format=DYNAMIC
-ALTER TABLE t1 KEY_BLOCK_SIZE=2;
-ERROR HY000: Table storage engine 'InnoDB' does not support the create option 'KEY_BLOCK_SIZE'
-SHOW WARNINGS;
-Level Code Message
-Warning 1478 InnoDB: cannot specify ROW_FORMAT = DYNAMIC with KEY_BLOCK_SIZE.
-Error 1478 Table storage engine 'InnoDB' does not support the create option 'KEY_BLOCK_SIZE'
-ALTER TABLE t1 ROW_FORMAT=COMPRESSED;
-SHOW WARNINGS;
-Level Code Message
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
-TABLE_NAME ROW_FORMAT CREATE_OPTIONS
-t1 Compressed row_format=COMPRESSED
-ALTER TABLE t1 KEY_BLOCK_SIZE=1;
-SHOW WARNINGS;
-Level Code Message
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
-TABLE_NAME ROW_FORMAT CREATE_OPTIONS
-t1 Compressed row_format=COMPRESSED key_block_size=1
-DROP TABLE IF EXISTS t1;
-CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPACT;
-ALTER TABLE t1 ROW_FORMAT=DEFAULT KEY_BLOCK_SIZE=1;
-SHOW WARNINGS;
-Level Code Message
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
-TABLE_NAME ROW_FORMAT CREATE_OPTIONS
-t1 Compressed key_block_size=1
-# Test 5) StrictMode=ON, CREATE with a valid KEY_BLOCK_SIZE
-# ALTER with each ROW_FORMAT
-DROP TABLE IF EXISTS t1;
-CREATE TABLE t1 ( i INT ) KEY_BLOCK_SIZE=2;
-SHOW CREATE TABLE t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `i` int(11) DEFAULT NULL
-) ENGINE=InnoDB DEFAULT CHARSET=latin1 KEY_BLOCK_SIZE=2
-ALTER TABLE t1 ADD COLUMN f1 INT;
-SHOW CREATE TABLE t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `i` int(11) DEFAULT NULL,
- `f1` int(11) DEFAULT NULL
-) ENGINE=InnoDB DEFAULT CHARSET=latin1 KEY_BLOCK_SIZE=2
-ALTER TABLE t1 ROW_FORMAT=COMPACT;
-ERROR HY000: Table storage engine 'InnoDB' does not support the create option 'KEY_BLOCK_SIZE'
-SHOW WARNINGS;
-Level Code Message
-Warning 1478 InnoDB: cannot specify ROW_FORMAT = COMPACT with KEY_BLOCK_SIZE.
-Error 1478 Table storage engine 'InnoDB' does not support the create option 'KEY_BLOCK_SIZE'
-ALTER TABLE t1 ROW_FORMAT=REDUNDANT;
-ERROR HY000: Table storage engine 'InnoDB' does not support the create option 'KEY_BLOCK_SIZE'
-SHOW WARNINGS;
-Level Code Message
-Warning 1478 InnoDB: cannot specify ROW_FORMAT = REDUNDANT with KEY_BLOCK_SIZE.
-Error 1478 Table storage engine 'InnoDB' does not support the create option 'KEY_BLOCK_SIZE'
-ALTER TABLE t1 ROW_FORMAT=DYNAMIC;
-ERROR HY000: Table storage engine 'InnoDB' does not support the create option 'KEY_BLOCK_SIZE'
-SHOW WARNINGS;
-Level Code Message
-Warning 1478 InnoDB: cannot specify ROW_FORMAT = DYNAMIC with KEY_BLOCK_SIZE.
-Error 1478 Table storage engine 'InnoDB' does not support the create option 'KEY_BLOCK_SIZE'
-ALTER TABLE t1 ROW_FORMAT=COMPRESSED;
-SHOW WARNINGS;
-Level Code Message
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
-TABLE_NAME ROW_FORMAT CREATE_OPTIONS
-t1 Compressed row_format=COMPRESSED key_block_size=2
-ALTER TABLE t1 ROW_FORMAT=DEFAULT KEY_BLOCK_SIZE=0;
-SHOW WARNINGS;
-Level Code Message
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
-TABLE_NAME ROW_FORMAT CREATE_OPTIONS
-t1 Dynamic
-ALTER TABLE t1 ROW_FORMAT=COMPACT;
-SHOW WARNINGS;
-Level Code Message
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
-TABLE_NAME ROW_FORMAT CREATE_OPTIONS
-t1 Compact row_format=COMPACT
-# Test 6) StrictMode=ON, CREATE with an invalid KEY_BLOCK_SIZE.
-DROP TABLE IF EXISTS t1;
-CREATE TABLE t1 ( i INT ) KEY_BLOCK_SIZE=9;
-ERROR HY000: Can't create table `test`.`t1` (errno: 140 "Wrong create options")
-SHOW WARNINGS;
-Level Code Message
-Warning 1478 InnoDB: invalid KEY_BLOCK_SIZE = 9. Valid values are [1, 2, 4, 8, 16]
-Error 1005 Can't create table `test`.`t1` (errno: 140 "Wrong create options")
-Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB
-# Test 7) StrictMode=ON, Make sure ROW_FORMAT= COMPRESSED & DYNAMIC and
-# and a valid non-zero KEY_BLOCK_SIZE are rejected with Antelope
-# and that they can be set to default values during strict mode.
-SET GLOBAL innodb_file_format=Antelope;
-Warnings:
-Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
-DROP TABLE IF EXISTS t1;
-Warnings:
-Note 1051 Unknown table 'test.t1'
-CREATE TABLE t1 ( i INT ) KEY_BLOCK_SIZE=4;
-ERROR HY000: Can't create table `test`.`t1` (errno: 140 "Wrong create options")
-SHOW WARNINGS;
-Level Code Message
-Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_format > Antelope.
-Error 1005 Can't create table `test`.`t1` (errno: 140 "Wrong create options")
-Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB
-CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPRESSED;
-ERROR HY000: Can't create table `test`.`t1` (errno: 140 "Wrong create options")
-SHOW WARNINGS;
-Level Code Message
-Warning 1478 InnoDB: ROW_FORMAT=COMPRESSED requires innodb_file_format > Antelope.
-Error 1005 Can't create table `test`.`t1` (errno: 140 "Wrong create options")
-Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB
-CREATE TABLE t1 ( i INT ) ROW_FORMAT=DYNAMIC;
-ERROR HY000: Can't create table `test`.`t1` (errno: 140 "Wrong create options")
-SHOW WARNINGS;
-Level Code Message
-Warning 1478 InnoDB: ROW_FORMAT=DYNAMIC requires innodb_file_format > Antelope.
-Error 1005 Can't create table `test`.`t1` (errno: 140 "Wrong create options")
-Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB
-CREATE TABLE t1 ( i INT ) ROW_FORMAT=REDUNDANT;
-SHOW WARNINGS;
-Level Code Message
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
-TABLE_NAME ROW_FORMAT CREATE_OPTIONS
-t1 Redundant row_format=REDUNDANT
-DROP TABLE IF EXISTS t1;
-CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPACT;
-SHOW WARNINGS;
-Level Code Message
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
-TABLE_NAME ROW_FORMAT CREATE_OPTIONS
-t1 Compact row_format=COMPACT
-DROP TABLE IF EXISTS t1;
-CREATE TABLE t1 ( i INT ) ROW_FORMAT=DEFAULT;
-SHOW WARNINGS;
-Level Code Message
-ALTER TABLE t1 KEY_BLOCK_SIZE=2;
-ERROR HY000: Table storage engine 'InnoDB' does not support the create option 'KEY_BLOCK_SIZE'
-SHOW WARNINGS;
-Level Code Message
-Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_format > Antelope.
-Error 1478 Table storage engine 'InnoDB' does not support the create option 'KEY_BLOCK_SIZE'
-ALTER TABLE t1 ROW_FORMAT=COMPRESSED;
-ERROR HY000: Table storage engine 'InnoDB' does not support the create option 'ROW_FORMAT'
-SHOW WARNINGS;
-Level Code Message
-Warning 1478 InnoDB: ROW_FORMAT=COMPRESSED requires innodb_file_format > Antelope.
-Error 1478 Table storage engine 'InnoDB' does not support the create option 'ROW_FORMAT'
-ALTER TABLE t1 ROW_FORMAT=DYNAMIC;
-ERROR HY000: Table storage engine 'InnoDB' does not support the create option 'ROW_FORMAT'
-SHOW WARNINGS;
-Level Code Message
-Warning 1478 InnoDB: ROW_FORMAT=DYNAMIC requires innodb_file_format > Antelope.
-Error 1478 Table storage engine 'InnoDB' does not support the create option 'ROW_FORMAT'
-SET GLOBAL innodb_file_format=Barracuda;
-Warnings:
-Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
-DROP TABLE IF EXISTS t1;
-CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4;
-SET GLOBAL innodb_file_format=Antelope;
-Warnings:
-Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
-ALTER TABLE t1 ADD COLUMN f1 INT;
-Warnings:
-Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_format > Antelope.
-Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=4.
-Warning 1478 InnoDB: ROW_FORMAT=COMPRESSED requires innodb_file_format > Antelope.
-Warning 1478 InnoDB: assuming ROW_FORMAT=DYNAMIC.
-SHOW CREATE TABLE t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `i` int(11) DEFAULT NULL,
- `f1` int(11) DEFAULT NULL
-) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4
-SHOW WARNINGS;
-Level Code Message
-ALTER TABLE t1 ROW_FORMAT=DEFAULT KEY_BLOCK_SIZE=0;
-SHOW WARNINGS;
-Level Code Message
-ALTER TABLE t1 ADD COLUMN f2 INT;
-SHOW WARNINGS;
-Level Code Message
-SET GLOBAL innodb_file_format=Barracuda;
-Warnings:
-Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
-# Test 8) StrictMode=ON, Make sure ROW_FORMAT= COMPRESSED & DYNAMIC and
-# and a valid non-zero KEY_BLOCK_SIZE are rejected with
-# innodb_file_per_table=OFF and that they can be set to default
-# values during strict mode.
-SET GLOBAL innodb_file_per_table=OFF;
-DROP TABLE IF EXISTS t1;
-CREATE TABLE t1 ( i INT ) KEY_BLOCK_SIZE=1;
-ERROR HY000: Can't create table `test`.`t1` (errno: 140 "Wrong create options")
-SHOW WARNINGS;
-Level Code Message
-Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_per_table.
-Error 1005 Can't create table `test`.`t1` (errno: 140 "Wrong create options")
-Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB
-CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPRESSED;
-ERROR HY000: Can't create table `test`.`t1` (errno: 140 "Wrong create options")
-SHOW WARNINGS;
-Level Code Message
-Warning 1478 InnoDB: ROW_FORMAT=COMPRESSED requires innodb_file_per_table.
-Error 1005 Can't create table `test`.`t1` (errno: 140 "Wrong create options")
-Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB
-CREATE TABLE t1 ( i INT ) ROW_FORMAT=DYNAMIC;
-ERROR HY000: Can't create table `test`.`t1` (errno: 140 "Wrong create options")
-SHOW WARNINGS;
-Level Code Message
-Warning 1478 InnoDB: ROW_FORMAT=DYNAMIC requires innodb_file_per_table.
-Error 1005 Can't create table `test`.`t1` (errno: 140 "Wrong create options")
-Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB
-CREATE TABLE t1 ( i INT ) ROW_FORMAT=REDUNDANT;
-SHOW WARNINGS;
-Level Code Message
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
-TABLE_NAME ROW_FORMAT CREATE_OPTIONS
-t1 Redundant row_format=REDUNDANT
-DROP TABLE IF EXISTS t1;
-CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPACT;
-SHOW WARNINGS;
-Level Code Message
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
-TABLE_NAME ROW_FORMAT CREATE_OPTIONS
-t1 Compact row_format=COMPACT
-DROP TABLE IF EXISTS t1;
-CREATE TABLE t1 ( i INT ) ROW_FORMAT=DEFAULT;
-SHOW WARNINGS;
-Level Code Message
-ALTER TABLE t1 KEY_BLOCK_SIZE=1;
-ERROR HY000: Table storage engine 'InnoDB' does not support the create option 'KEY_BLOCK_SIZE'
-SHOW WARNINGS;
-Level Code Message
-Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_per_table.
-Error 1478 Table storage engine 'InnoDB' does not support the create option 'KEY_BLOCK_SIZE'
-ALTER TABLE t1 ROW_FORMAT=COMPRESSED;
-ERROR HY000: Table storage engine 'InnoDB' does not support the create option 'ROW_FORMAT'
-SHOW WARNINGS;
-Level Code Message
-Warning 1478 InnoDB: ROW_FORMAT=COMPRESSED requires innodb_file_per_table.
-Error 1478 Table storage engine 'InnoDB' does not support the create option 'ROW_FORMAT'
-ALTER TABLE t1 ROW_FORMAT=DYNAMIC;
-ERROR HY000: Table storage engine 'InnoDB' does not support the create option 'ROW_FORMAT'
-SHOW WARNINGS;
-Level Code Message
-Warning 1478 InnoDB: ROW_FORMAT=DYNAMIC requires innodb_file_per_table.
-Error 1478 Table storage engine 'InnoDB' does not support the create option 'ROW_FORMAT'
-ALTER TABLE t1 ROW_FORMAT=COMPACT;
-SHOW WARNINGS;
-Level Code Message
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
-TABLE_NAME ROW_FORMAT CREATE_OPTIONS
-t1 Compact row_format=COMPACT
-ALTER TABLE t1 ROW_FORMAT=REDUNDANT;
-SHOW WARNINGS;
-Level Code Message
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
-TABLE_NAME ROW_FORMAT CREATE_OPTIONS
-t1 Redundant row_format=REDUNDANT
-ALTER TABLE t1 ROW_FORMAT=DEFAULT;
-SHOW WARNINGS;
-Level Code Message
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
-TABLE_NAME ROW_FORMAT CREATE_OPTIONS
-t1 Dynamic
-SET GLOBAL innodb_file_per_table=ON;
-DROP TABLE IF EXISTS t1;
-CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4;
-SET GLOBAL innodb_file_per_table=OFF;
-ALTER TABLE t1 ADD COLUMN f1 INT;
-SHOW WARNINGS;
-Level Code Message
-ALTER TABLE t1 ROW_FORMAT=DEFAULT KEY_BLOCK_SIZE=0;
-SHOW WARNINGS;
-Level Code Message
-ALTER TABLE t1 ADD COLUMN f2 INT;
-SHOW WARNINGS;
-Level Code Message
-SET GLOBAL innodb_file_per_table=ON;
-##################################################
-SET SESSION innodb_strict_mode = OFF;
-# Test 9) StrictMode=OFF, CREATE and ALTER with each ROW_FORMAT & KEY_BLOCK_SIZE=0
-# KEY_BLOCK_SIZE=0 means 'no KEY_BLOCK_SIZE is specified'
-# 'FIXED' is sent to InnoDB since it is used by MyISAM.
-# It is an invalid mode in InnoDB, use COMPACT
-DROP TABLE IF EXISTS t1;
-CREATE TABLE t1 ( i INT ) ROW_FORMAT=FIXED;
-Warnings:
-Warning 1478 InnoDB: assuming ROW_FORMAT=DYNAMIC.
-SHOW WARNINGS;
-Level Code Message
-Warning 1478 InnoDB: assuming ROW_FORMAT=DYNAMIC.
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
-TABLE_NAME ROW_FORMAT CREATE_OPTIONS
-t1 Dynamic row_format=FIXED
-DROP TABLE IF EXISTS t1;
-CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=0;
-SHOW WARNINGS;
-Level Code Message
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
-TABLE_NAME ROW_FORMAT CREATE_OPTIONS
-t1 Compressed row_format=COMPRESSED
-ALTER TABLE t1 ROW_FORMAT=COMPACT KEY_BLOCK_SIZE=0;
-SHOW WARNINGS;
-Level Code Message
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
-TABLE_NAME ROW_FORMAT CREATE_OPTIONS
-t1 Compact row_format=COMPACT
-ALTER TABLE t1 ROW_FORMAT=DYNAMIC KEY_BLOCK_SIZE=0;
-SHOW WARNINGS;
-Level Code Message
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
-TABLE_NAME ROW_FORMAT CREATE_OPTIONS
-t1 Dynamic row_format=DYNAMIC
-ALTER TABLE t1 ROW_FORMAT=REDUNDANT KEY_BLOCK_SIZE=0;
-SHOW WARNINGS;
-Level Code Message
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
-TABLE_NAME ROW_FORMAT CREATE_OPTIONS
-t1 Redundant row_format=REDUNDANT
-ALTER TABLE t1 ROW_FORMAT=DEFAULT KEY_BLOCK_SIZE=0;
-SHOW WARNINGS;
-Level Code Message
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
-TABLE_NAME ROW_FORMAT CREATE_OPTIONS
-t1 Dynamic
-ALTER TABLE t1 ROW_FORMAT=FIXED KEY_BLOCK_SIZE=0;
-Warnings:
-Warning 1478 InnoDB: assuming ROW_FORMAT=DYNAMIC.
-SHOW WARNINGS;
-Level Code Message
-Warning 1478 InnoDB: assuming ROW_FORMAT=DYNAMIC.
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
-TABLE_NAME ROW_FORMAT CREATE_OPTIONS
-t1 Dynamic row_format=FIXED
-# Test 10) StrictMode=OFF, CREATE with each ROW_FORMAT & a valid KEY_BLOCK_SIZE
-# KEY_BLOCK_SIZE is ignored with COMPACT, REDUNDANT, & DYNAMIC
-DROP TABLE IF EXISTS t1;
-CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPACT KEY_BLOCK_SIZE=1;
-Warnings:
-Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=1 unless ROW_FORMAT=COMPRESSED.
-SHOW WARNINGS;
-Level Code Message
-Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=1 unless ROW_FORMAT=COMPRESSED.
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
-TABLE_NAME ROW_FORMAT CREATE_OPTIONS
-t1 Compact row_format=COMPACT key_block_size=1
-DROP TABLE IF EXISTS t1;
-CREATE TABLE t1 ( i INT ) ROW_FORMAT=REDUNDANT KEY_BLOCK_SIZE=2;
-Warnings:
-Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=2 unless ROW_FORMAT=COMPRESSED.
-SHOW WARNINGS;
-Level Code Message
-Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=2 unless ROW_FORMAT=COMPRESSED.
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
-TABLE_NAME ROW_FORMAT CREATE_OPTIONS
-t1 Redundant row_format=REDUNDANT key_block_size=2
-DROP TABLE IF EXISTS t1;
-CREATE TABLE t1 ( i INT ) ROW_FORMAT=DYNAMIC KEY_BLOCK_SIZE=4;
-Warnings:
-Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=4 unless ROW_FORMAT=COMPRESSED.
-SHOW WARNINGS;
-Level Code Message
-Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=4 unless ROW_FORMAT=COMPRESSED.
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
-TABLE_NAME ROW_FORMAT CREATE_OPTIONS
-t1 Dynamic row_format=DYNAMIC key_block_size=4
-DROP TABLE IF EXISTS t1;
-CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=2;
-SHOW WARNINGS;
-Level Code Message
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
-TABLE_NAME ROW_FORMAT CREATE_OPTIONS
-t1 Compressed row_format=COMPRESSED key_block_size=2
-ALTER TABLE t1 ADD COLUMN f1 INT;
-SHOW WARNINGS;
-Level Code Message
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
-TABLE_NAME ROW_FORMAT CREATE_OPTIONS
-t1 Compressed row_format=COMPRESSED key_block_size=2
-DROP TABLE IF EXISTS t1;
-CREATE TABLE t1 ( i INT ) ROW_FORMAT=DEFAULT KEY_BLOCK_SIZE=1;
-SHOW WARNINGS;
-Level Code Message
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
-TABLE_NAME ROW_FORMAT CREATE_OPTIONS
-t1 Compressed key_block_size=1
-ALTER TABLE t1 ADD COLUMN f1 INT;
-SHOW WARNINGS;
-Level Code Message
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
-TABLE_NAME ROW_FORMAT CREATE_OPTIONS
-t1 Compressed key_block_size=1
-# Test 11) StrictMode=OFF, ALTER with each ROW_FORMAT & a valid KEY_BLOCK_SIZE
-DROP TABLE IF EXISTS t1;
-CREATE TABLE t1 ( i INT );
-ALTER TABLE t1 ROW_FORMAT=FIXED KEY_BLOCK_SIZE=1;
-Warnings:
-Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=1 unless ROW_FORMAT=COMPRESSED.
-Warning 1478 InnoDB: assuming ROW_FORMAT=DYNAMIC.
-SHOW WARNINGS;
-Level Code Message
-Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=1 unless ROW_FORMAT=COMPRESSED.
-Warning 1478 InnoDB: assuming ROW_FORMAT=DYNAMIC.
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
-TABLE_NAME ROW_FORMAT CREATE_OPTIONS
-t1 Dynamic row_format=FIXED key_block_size=1
-DROP TABLE IF EXISTS t1;
-CREATE TABLE t1 ( i INT );
-ALTER TABLE t1 ROW_FORMAT=COMPACT KEY_BLOCK_SIZE=2;
-Warnings:
-Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=2 unless ROW_FORMAT=COMPRESSED.
-SHOW WARNINGS;
-Level Code Message
-Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=2 unless ROW_FORMAT=COMPRESSED.
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
-TABLE_NAME ROW_FORMAT CREATE_OPTIONS
-t1 Compact row_format=COMPACT key_block_size=2
-DROP TABLE IF EXISTS t1;
-CREATE TABLE t1 ( i INT );
-ALTER TABLE t1 ROW_FORMAT=DYNAMIC KEY_BLOCK_SIZE=4;
-Warnings:
-Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=4 unless ROW_FORMAT=COMPRESSED.
-SHOW WARNINGS;
-Level Code Message
-Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=4 unless ROW_FORMAT=COMPRESSED.
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
-TABLE_NAME ROW_FORMAT CREATE_OPTIONS
-t1 Dynamic row_format=DYNAMIC key_block_size=4
-DROP TABLE IF EXISTS t1;
-CREATE TABLE t1 ( i INT );
-ALTER TABLE t1 ROW_FORMAT=REDUNDANT KEY_BLOCK_SIZE=2;
-Warnings:
-Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=2 unless ROW_FORMAT=COMPRESSED.
-SHOW WARNINGS;
-Level Code Message
-Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=2 unless ROW_FORMAT=COMPRESSED.
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
-TABLE_NAME ROW_FORMAT CREATE_OPTIONS
-t1 Redundant row_format=REDUNDANT key_block_size=2
-DROP TABLE IF EXISTS t1;
-CREATE TABLE t1 ( i INT );
-ALTER TABLE t1 ROW_FORMAT=DEFAULT KEY_BLOCK_SIZE=1;
-SHOW WARNINGS;
-Level Code Message
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
-TABLE_NAME ROW_FORMAT CREATE_OPTIONS
-t1 Compressed key_block_size=1
-ALTER TABLE t1 ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1;
-SHOW WARNINGS;
-Level Code Message
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
-TABLE_NAME ROW_FORMAT CREATE_OPTIONS
-t1 Compressed row_format=COMPRESSED key_block_size=1
-# Test 12) StrictMode=OFF, CREATE with ROW_FORMAT=COMPACT, ALTER with a valid KEY_BLOCK_SIZE
-DROP TABLE IF EXISTS t1;
-CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPACT;
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
-TABLE_NAME ROW_FORMAT CREATE_OPTIONS
-t1 Compact row_format=COMPACT
-ALTER TABLE t1 KEY_BLOCK_SIZE=2;
-Warnings:
-Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=2 unless ROW_FORMAT=COMPRESSED.
-SHOW WARNINGS;
-Level Code Message
-Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=2 unless ROW_FORMAT=COMPRESSED.
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
-TABLE_NAME ROW_FORMAT CREATE_OPTIONS
-t1 Compact row_format=COMPACT key_block_size=2
-ALTER TABLE t1 ROW_FORMAT=REDUNDANT;
-Warnings:
-Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=2 unless ROW_FORMAT=COMPRESSED.
-SHOW WARNINGS;
-Level Code Message
-Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=2 unless ROW_FORMAT=COMPRESSED.
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
-TABLE_NAME ROW_FORMAT CREATE_OPTIONS
-t1 Redundant row_format=REDUNDANT key_block_size=2
-ALTER TABLE t1 ROW_FORMAT=DYNAMIC;
-Warnings:
-Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=2 unless ROW_FORMAT=COMPRESSED.
-SHOW WARNINGS;
-Level Code Message
-Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=2 unless ROW_FORMAT=COMPRESSED.
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
-TABLE_NAME ROW_FORMAT CREATE_OPTIONS
-t1 Dynamic row_format=DYNAMIC key_block_size=2
-ALTER TABLE t1 ROW_FORMAT=COMPRESSED;
-SHOW WARNINGS;
-Level Code Message
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
-TABLE_NAME ROW_FORMAT CREATE_OPTIONS
-t1 Compressed row_format=COMPRESSED key_block_size=2
-ALTER TABLE t1 KEY_BLOCK_SIZE=4;
-SHOW WARNINGS;
-Level Code Message
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
-TABLE_NAME ROW_FORMAT CREATE_OPTIONS
-t1 Compressed row_format=COMPRESSED key_block_size=4
-DROP TABLE IF EXISTS t1;
-CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPACT;
-ALTER TABLE t1 ROW_FORMAT=DEFAULT KEY_BLOCK_SIZE=2;
-SHOW WARNINGS;
-Level Code Message
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
-TABLE_NAME ROW_FORMAT CREATE_OPTIONS
-t1 Compressed key_block_size=2
-# Test 13) StrictMode=OFF, CREATE with a valid KEY_BLOCK_SIZE
-# ALTER with each ROW_FORMAT
-DROP TABLE IF EXISTS t1;
-CREATE TABLE t1 ( i INT ) KEY_BLOCK_SIZE=1;
-SHOW WARNINGS;
-Level Code Message
-SHOW CREATE TABLE t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `i` int(11) DEFAULT NULL
-) ENGINE=InnoDB DEFAULT CHARSET=latin1 KEY_BLOCK_SIZE=1
-ALTER TABLE t1 ADD COLUMN f1 INT;
-SHOW WARNINGS;
-Level Code Message
-SHOW CREATE TABLE t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `i` int(11) DEFAULT NULL,
- `f1` int(11) DEFAULT NULL
-) ENGINE=InnoDB DEFAULT CHARSET=latin1 KEY_BLOCK_SIZE=1
-ALTER TABLE t1 ROW_FORMAT=COMPACT;
-Warnings:
-Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=1 unless ROW_FORMAT=COMPRESSED.
-SHOW WARNINGS;
-Level Code Message
-Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=1 unless ROW_FORMAT=COMPRESSED.
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
-TABLE_NAME ROW_FORMAT CREATE_OPTIONS
-t1 Compact row_format=COMPACT key_block_size=1
-ALTER TABLE t1 ROW_FORMAT=REDUNDANT;
-Warnings:
-Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=1 unless ROW_FORMAT=COMPRESSED.
-SHOW WARNINGS;
-Level Code Message
-Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=1 unless ROW_FORMAT=COMPRESSED.
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
-TABLE_NAME ROW_FORMAT CREATE_OPTIONS
-t1 Redundant row_format=REDUNDANT key_block_size=1
-ALTER TABLE t1 ROW_FORMAT=DYNAMIC;
-Warnings:
-Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=1 unless ROW_FORMAT=COMPRESSED.
-SHOW WARNINGS;
-Level Code Message
-Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=1 unless ROW_FORMAT=COMPRESSED.
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
-TABLE_NAME ROW_FORMAT CREATE_OPTIONS
-t1 Dynamic row_format=DYNAMIC key_block_size=1
-ALTER TABLE t1 ROW_FORMAT=COMPRESSED;
-SHOW WARNINGS;
-Level Code Message
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
-TABLE_NAME ROW_FORMAT CREATE_OPTIONS
-t1 Compressed row_format=COMPRESSED key_block_size=1
-ALTER TABLE t1 ROW_FORMAT=DEFAULT KEY_BLOCK_SIZE=0;
-SHOW WARNINGS;
-Level Code Message
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
-TABLE_NAME ROW_FORMAT CREATE_OPTIONS
-t1 Dynamic
-ALTER TABLE t1 ROW_FORMAT=COMPACT;
-SHOW WARNINGS;
-Level Code Message
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
-TABLE_NAME ROW_FORMAT CREATE_OPTIONS
-t1 Compact row_format=COMPACT
-# Test 14) StrictMode=OFF, CREATE with an invalid KEY_BLOCK_SIZE,
-# it defaults to half of the page size.
-DROP TABLE IF EXISTS t1;
-CREATE TABLE t1 ( i INT ) KEY_BLOCK_SIZE=15;
-Warnings:
-Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=15.
-SHOW WARNINGS;
-Level Code Message
-Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=15.
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
-TABLE_NAME ROW_FORMAT CREATE_OPTIONS
-t1 Dynamic key_block_size=15
-# Test 15) StrictMode=OFF, Make sure ROW_FORMAT= COMPRESSED & DYNAMIC and a
-valid KEY_BLOCK_SIZE are remembered but not used when ROW_FORMAT
-is reverted to Antelope and then used again when ROW_FORMAT=Barracuda.
-DROP TABLE IF EXISTS t1;
-CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1;
-SHOW WARNINGS;
-Level Code Message
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
-TABLE_NAME ROW_FORMAT CREATE_OPTIONS
-t1 Compressed row_format=COMPRESSED key_block_size=1
-SET GLOBAL innodb_file_format=Antelope;
-Warnings:
-Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
-ALTER TABLE t1 ADD COLUMN f1 INT;
-Warnings:
-Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_format > Antelope.
-Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=1.
-Warning 1478 InnoDB: ROW_FORMAT=COMPRESSED requires innodb_file_format > Antelope.
-Warning 1478 InnoDB: assuming ROW_FORMAT=DYNAMIC.
-SHOW WARNINGS;
-Level Code Message
-Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_format > Antelope.
-Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=1.
-Warning 1478 InnoDB: ROW_FORMAT=COMPRESSED requires innodb_file_format > Antelope.
-Warning 1478 InnoDB: assuming ROW_FORMAT=DYNAMIC.
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
-TABLE_NAME ROW_FORMAT CREATE_OPTIONS
-t1 Dynamic row_format=COMPRESSED key_block_size=1
-SET GLOBAL innodb_file_format=Barracuda;
-Warnings:
-Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
-ALTER TABLE t1 ADD COLUMN f2 INT;
-SHOW WARNINGS;
-Level Code Message
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
-TABLE_NAME ROW_FORMAT CREATE_OPTIONS
-t1 Compressed row_format=COMPRESSED key_block_size=1
-DROP TABLE IF EXISTS t1;
-CREATE TABLE t1 ( i INT ) ROW_FORMAT=DYNAMIC;
-SHOW WARNINGS;
-Level Code Message
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
-TABLE_NAME ROW_FORMAT CREATE_OPTIONS
-t1 Dynamic row_format=DYNAMIC
-SET GLOBAL innodb_file_format=Antelope;
-Warnings:
-Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
-ALTER TABLE t1 ADD COLUMN f1 INT;
-SHOW WARNINGS;
-Level Code Message
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
-TABLE_NAME ROW_FORMAT CREATE_OPTIONS
-t1 Dynamic row_format=DYNAMIC
-SET GLOBAL innodb_file_format=Barracuda;
-Warnings:
-Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
-ALTER TABLE t1 ADD COLUMN f2 INT;
-SHOW WARNINGS;
-Level Code Message
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
-TABLE_NAME ROW_FORMAT CREATE_OPTIONS
-t1 Dynamic row_format=DYNAMIC
-# Test 16) StrictMode=OFF, Make sure ROW_FORMAT= COMPRESSED & DYNAMIC and a
-valid KEY_BLOCK_SIZE are remembered but not used when innodb_file_per_table=OFF
-and then used again when innodb_file_per_table=ON.
-DROP TABLE IF EXISTS t1;
-CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=2;
-SHOW WARNINGS;
-Level Code Message
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
-TABLE_NAME ROW_FORMAT CREATE_OPTIONS
-t1 Compressed row_format=COMPRESSED key_block_size=2
-SET GLOBAL innodb_file_per_table=OFF;
-ALTER TABLE t1 ADD COLUMN f1 INT;
-SHOW WARNINGS;
-Level Code Message
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
-TABLE_NAME ROW_FORMAT CREATE_OPTIONS
-t1 Compressed row_format=COMPRESSED key_block_size=2
-SET GLOBAL innodb_file_per_table=ON;
-ALTER TABLE t1 ADD COLUMN f2 INT;
-SHOW WARNINGS;
-Level Code Message
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
-TABLE_NAME ROW_FORMAT CREATE_OPTIONS
-t1 Compressed row_format=COMPRESSED key_block_size=2
-DROP TABLE IF EXISTS t1;
-CREATE TABLE t1 ( i INT ) ROW_FORMAT=DYNAMIC;
-SHOW WARNINGS;
-Level Code Message
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
-TABLE_NAME ROW_FORMAT CREATE_OPTIONS
-t1 Dynamic row_format=DYNAMIC
-SET GLOBAL innodb_file_per_table=OFF;
-ALTER TABLE t1 ADD COLUMN f1 INT;
-SHOW WARNINGS;
-Level Code Message
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
-TABLE_NAME ROW_FORMAT CREATE_OPTIONS
-t1 Dynamic row_format=DYNAMIC
-SET GLOBAL innodb_file_per_table=ON;
-ALTER TABLE t1 ADD COLUMN f2 INT;
-SHOW WARNINGS;
-Level Code Message
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
-TABLE_NAME ROW_FORMAT CREATE_OPTIONS
-t1 Dynamic row_format=DYNAMIC
-# Cleanup
-DROP TABLE IF EXISTS t1;
-Warnings:
-Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
diff --git a/mysql-test/suite/innodb_zip/r/innodb-zip.result b/mysql-test/suite/innodb_zip/r/innodb-zip.result
index 47215a1e077..c715f77b9ba 100644
--- a/mysql-test/suite/innodb_zip/r/innodb-zip.result
+++ b/mysql-test/suite/innodb_zip/r/innodb-zip.result
@@ -1,4 +1,3 @@
-DROP DATABASE IF EXISTS mysqltest_innodb_zip;
CREATE DATABASE mysqltest_innodb_zip;
USE mysqltest_innodb_zip;
SELECT table_name, row_format, data_length, index_length
@@ -316,19 +315,16 @@ Warning 1478 InnoDB: ROW_FORMAT=COMPRESSED requires innodb_file_per_table.
Error 1005 Can't create table `mysqltest_innodb_zip`.`t6` (errno: 140 "Wrong create options")
Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB
create table t7 (id int primary key) engine = innodb row_format = dynamic;
-ERROR HY000: Can't create table `mysqltest_innodb_zip`.`t7` (errno: 140 "Wrong create options")
show warnings;
Level Code Message
-Warning 1478 InnoDB: ROW_FORMAT=DYNAMIC requires innodb_file_per_table.
-Error 1005 Can't create table `mysqltest_innodb_zip`.`t7` (errno: 140 "Wrong create options")
-Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB
create table t8 (id int primary key) engine = innodb row_format = compact;
create table t9 (id int primary key) engine = innodb row_format = redundant;
SELECT table_schema, table_name, row_format, data_length, index_length FROM information_schema.tables WHERE engine='innodb' AND table_schema != 'mysql';
table_schema table_name row_format data_length index_length
+mysqltest_innodb_zip t7 Dynamic {valid} 0
mysqltest_innodb_zip t8 Compact {valid} 0
mysqltest_innodb_zip t9 Redundant {valid} 0
-drop table t8, t9;
+drop table t7, t8, t9;
set global innodb_file_per_table = on;
set global innodb_file_format = `0`;
Warnings:
@@ -409,5 +405,4 @@ select @@innodb_file_format_max;
@@innodb_file_format_max
Barracuda
drop table normal_table, zip_table;
-USE test;
DROP DATABASE mysqltest_innodb_zip;
diff --git a/mysql-test/suite/innodb_zip/r/innodb_bug36169.result b/mysql-test/suite/innodb_zip/r/innodb_bug36169.result
index 161cef10ad5..bae08bd54a2 100644
--- a/mysql-test/suite/innodb_zip/r/innodb_bug36169.result
+++ b/mysql-test/suite/innodb_zip/r/innodb_bug36169.result
@@ -1,5 +1 @@
call mtr.add_suppression("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 GLOBAL innodb_file_format='Barracuda';
-Warnings:
-Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
-SET GLOBAL innodb_file_per_table=ON;
diff --git a/mysql-test/suite/innodb_zip/r/innodb_bug52745.result b/mysql-test/suite/innodb_zip/r/innodb_bug52745.result
index 5ba26753ea6..7ae3cc4bb71 100644
--- a/mysql-test/suite/innodb_zip/r/innodb_bug52745.result
+++ b/mysql-test/suite/innodb_zip/r/innodb_bug52745.result
@@ -1,7 +1,3 @@
-SET GLOBAL innodb_file_format='Barracuda';
-Warnings:
-Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
-SET GLOBAL innodb_file_per_table=on;
CREATE TABLE bug52745 (
a2 int(10) unsigned DEFAULT NULL,
col37 time DEFAULT NULL,
@@ -128,7 +124,3 @@ Warning 1264 Out of range value for column 'col78' at row 1
Warning 1265 Data truncated for column 'col79' at row 1
Warning 1264 Out of range value for column 'col84' at row 1
DROP TABLE bug52745;
-SET GLOBAL innodb_file_format=Barracuda;
-Warnings:
-Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
-SET GLOBAL innodb_file_per_table=1;
diff --git a/mysql-test/suite/innodb_zip/r/innodb_bug53591.result b/mysql-test/suite/innodb_zip/r/innodb_bug53591.result
index 3b10942c2de..0222ad64fa2 100644
--- a/mysql-test/suite/innodb_zip/r/innodb_bug53591.result
+++ b/mysql-test/suite/innodb_zip/r/innodb_bug53591.result
@@ -1,7 +1,3 @@
-SET GLOBAL innodb_file_format='Barracuda';
-Warnings:
-Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
-SET GLOBAL innodb_file_per_table=on;
SET GLOBAL innodb_strict_mode=on;
set old_alter_table=0;
CREATE TABLE bug53591(a text charset utf8 not null)
@@ -12,8 +8,4 @@ SHOW WARNINGS;
Level Code Message
Error 1118 Row size too large. The maximum row size for the used table type, not counting BLOBs, is {checked_valid}. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs
DROP TABLE bug53591;
-SET GLOBAL innodb_file_format=Barracuda;
-Warnings:
-Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
-SET GLOBAL innodb_file_per_table=1;
SET GLOBAL innodb_strict_mode=DEFAULT;
diff --git a/mysql-test/suite/innodb_zip/r/innodb_bug56680.result b/mysql-test/suite/innodb_zip/r/innodb_bug56680.result
index 92b589c6b7e..c509c5bad21 100644
--- a/mysql-test/suite/innodb_zip/r/innodb_bug56680.result
+++ b/mysql-test/suite/innodb_zip/r/innodb_bug56680.result
@@ -1,8 +1,4 @@
SET GLOBAL tx_isolation='REPEATABLE-READ';
-SET GLOBAL innodb_file_format=Barracuda;
-Warnings:
-Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
-SET GLOBAL innodb_file_per_table=on;
CREATE TABLE bug56680(
a INT AUTO_INCREMENT PRIMARY KEY,
b CHAR(1),
@@ -121,5 +117,3 @@ Table Op Msg_type Msg_text
test.bug56680_2 check status OK
DROP TABLE bug56680_2;
DROP TABLE bug56680;
-Warnings:
-Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
diff --git a/mysql-test/suite/innodb_zip/r/innodb_index_large_prefix.result b/mysql-test/suite/innodb_zip/r/innodb_index_large_prefix.result
index d44c7e33fe3..b599716905d 100644
--- a/mysql-test/suite/innodb_zip/r/innodb_index_large_prefix.result
+++ b/mysql-test/suite/innodb_zip/r/innodb_index_large_prefix.result
@@ -1,9 +1,5 @@
SET default_storage_engine=InnoDB;
call mtr.add_suppression("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 global innodb_file_format="Barracuda";
-Warnings:
-Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
-set global innodb_file_per_table=1;
set global innodb_large_prefix=1;
Warnings:
Warning 131 Using innodb_large_prefix is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
@@ -491,6 +487,7 @@ connection con1;
select a = repeat("a", 20000) from worklog5743;
a = repeat("a", 20000)
1
+disconnect con1;
connection con2;
SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
select @@session.tx_isolation;
@@ -500,6 +497,7 @@ select a = repeat("x", 25000) from worklog5743;
a = repeat("x", 25000)
1
1
+disconnect con2;
connection default;
rollback;
drop table worklog5743;
@@ -529,16 +527,7 @@ create index idx on worklog5743(a(768));
ERROR HY000: Index column size too large. The maximum column size is 767 bytes
create index idx2 on worklog5743(a(767));
drop table worklog5743;
-SET GLOBAL innodb_file_format=Barracuda;
-Warnings:
-Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
-SET GLOBAL innodb_file_per_table=1;
SET GLOBAL innodb_large_prefix=1;
Warnings:
Warning 131 Using innodb_large_prefix is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
SET GLOBAL innodb_strict_mode = DEFAULT;
-connection con1;
-disconnect con1;
-connection con2;
-disconnect con2;
-connection default;
diff --git a/mysql-test/suite/innodb_zip/r/wl6501_crash_3.result b/mysql-test/suite/innodb_zip/r/wl6501_crash_3.result
index e874ab1a37a..554bb2892f6 100644
--- a/mysql-test/suite/innodb_zip/r/wl6501_crash_3.result
+++ b/mysql-test/suite/innodb_zip/r/wl6501_crash_3.result
@@ -5,9 +5,6 @@ set global innodb_file_per_table = on;
"1. Hit crash point while writing redo log."
use test;
set global innodb_file_per_table = 1;
-set global innodb_file_format = 'Barracuda';
-Warnings:
-Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
SET innodb_strict_mode=OFF;
create table t (
i int, f float, c char,
@@ -44,9 +41,6 @@ drop table t;
"2. Hit crash point on completion of redo log write."
use test;
set global innodb_file_per_table = 1;
-set global innodb_file_format = 'Barracuda';
-Warnings:
-Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
SET innodb_strict_mode=OFF;
create table t (
i int, f float, c char,
@@ -86,9 +80,6 @@ drop table t;
"3. Hit crash point while dropping indexes."
use test;
set global innodb_file_per_table = 1;
-set global innodb_file_format = 'Barracuda';
-Warnings:
-Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
SET innodb_strict_mode=OFF;
create table t (
i int, f float, c char,
@@ -127,9 +118,6 @@ i f c
drop table t;
use test;
set global innodb_file_per_table = 1;
-set global innodb_file_format = 'Barracuda';
-Warnings:
-Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
SET innodb_strict_mode=OFF;
create table t (
i int, f float, c char,
@@ -168,9 +156,6 @@ i f c
drop table t;
use test;
set global innodb_file_per_table = 1;
-set global innodb_file_format = 'Barracuda';
-Warnings:
-Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
SET innodb_strict_mode=OFF;
create table t (
i int, f float, c char,
@@ -211,9 +196,6 @@ drop table t;
" of index is commenced."
use test;
set global innodb_file_per_table = 1;
-set global innodb_file_format = 'Barracuda';
-Warnings:
-Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
SET innodb_strict_mode=OFF;
create table t (
i int, f float, c char,
@@ -253,9 +235,6 @@ drop table t;
"5. Hit crash point while creating indexes."
use test;
set global innodb_file_per_table = 1;
-set global innodb_file_format = 'Barracuda';
-Warnings:
-Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
SET innodb_strict_mode=OFF;
create table t (
i int, f float, c char,
@@ -294,9 +273,6 @@ i f c
drop table t;
use test;
set global innodb_file_per_table = 1;
-set global innodb_file_format = 'Barracuda';
-Warnings:
-Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
SET innodb_strict_mode=OFF;
create table t (
i int, f float, c char,
@@ -335,9 +311,6 @@ i f c
drop table t;
use test;
set global innodb_file_per_table = 1;
-set global innodb_file_format = 'Barracuda';
-Warnings:
-Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
SET innodb_strict_mode=OFF;
create table t (
i int, f float, c char,
@@ -378,9 +351,6 @@ drop table t;
" in-memory dict."
use test;
set global innodb_file_per_table = 1;
-set global innodb_file_format = 'Barracuda';
-Warnings:
-Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
SET innodb_strict_mode=OFF;
create table t (
i int, f float, c char,
@@ -420,9 +390,6 @@ drop table t;
"7. Hit crash point before/after log checkpoint is done."
use test;
set global innodb_file_per_table = 1;
-set global innodb_file_format = 'Barracuda';
-Warnings:
-Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
SET innodb_strict_mode=OFF;
create table t (
i int, f float, c char,
@@ -456,9 +423,6 @@ i f c
drop table t;
use test;
set global innodb_file_per_table = 1;
-set global innodb_file_format = 'Barracuda';
-Warnings:
-Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
SET innodb_strict_mode=OFF;
create table t (
i int, f float, c char,
@@ -495,7 +459,4 @@ i f c
1 1.1 a
2 2.2 b
drop table t;
-set global innodb_file_format = Barracuda;
-Warnings:
-Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
set global innodb_file_per_table = 1;
diff --git a/mysql-test/suite/innodb_zip/r/wl6501_crash_4.result b/mysql-test/suite/innodb_zip/r/wl6501_crash_4.result
index cb8a4d5a157..1a02c1a711a 100644
--- a/mysql-test/suite/innodb_zip/r/wl6501_crash_4.result
+++ b/mysql-test/suite/innodb_zip/r/wl6501_crash_4.result
@@ -5,9 +5,6 @@ set global innodb_file_per_table = on;
"1. Hit crash point while writing redo log."
use test;
set global innodb_file_per_table = 1;
-set global innodb_file_format = 'Barracuda';
-Warnings:
-Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
SET innodb_strict_mode=OFF;
create table t (
i int, f float, c char,
@@ -24,9 +21,10 @@ check table t;
Table Op Msg_type Msg_text
test.t check status OK
set session debug = "+d,ib_trunc_crash_while_writing_redo_log";
+Warnings:
+Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead
truncate table t;
ERROR HY000: Lost connection to MySQL server during query
-# restart
check table t;
Table Op Msg_type Msg_text
test.t check status OK
@@ -43,9 +41,6 @@ drop table t;
"2. Hit crash point on completion of redo log write."
use test;
set global innodb_file_per_table = 1;
-set global innodb_file_format = 'Barracuda';
-Warnings:
-Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
SET innodb_strict_mode=OFF;
create table t (
i int, f float, c char,
@@ -62,9 +57,10 @@ check table t;
Table Op Msg_type Msg_text
test.t check status OK
set session debug = "+d,ib_trunc_crash_after_redo_log_write_complete";
+Warnings:
+Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead
truncate table t;
ERROR HY000: Lost connection to MySQL server during query
-# restart
check table t;
Table Op Msg_type Msg_text
test.t check status OK
@@ -84,9 +80,6 @@ drop table t;
"3. Hit crash point while dropping indexes."
use test;
set global innodb_file_per_table = 1;
-set global innodb_file_format = 'Barracuda';
-Warnings:
-Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
SET innodb_strict_mode=OFF;
create table t (
i int, f float, c char,
@@ -103,9 +96,10 @@ check table t;
Table Op Msg_type Msg_text
test.t check status OK
set session debug = "+d,ib_trunc_crash_on_drop_of_clust_index";
+Warnings:
+Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead
truncate table t;
ERROR HY000: Lost connection to MySQL server during query
-# restart
check table t;
Table Op Msg_type Msg_text
test.t check status OK
@@ -124,9 +118,6 @@ i f c
drop table t;
use test;
set global innodb_file_per_table = 1;
-set global innodb_file_format = 'Barracuda';
-Warnings:
-Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
SET innodb_strict_mode=OFF;
create table t (
i int, f float, c char,
@@ -143,9 +134,10 @@ check table t;
Table Op Msg_type Msg_text
test.t check status OK
set session debug = "+d,ib_trunc_crash_on_drop_of_uniq_index";
+Warnings:
+Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead
truncate table t;
ERROR HY000: Lost connection to MySQL server during query
-# restart
check table t;
Table Op Msg_type Msg_text
test.t check status OK
@@ -164,9 +156,6 @@ i f c
drop table t;
use test;
set global innodb_file_per_table = 1;
-set global innodb_file_format = 'Barracuda';
-Warnings:
-Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
SET innodb_strict_mode=OFF;
create table t (
i int, f float, c char,
@@ -183,9 +172,10 @@ check table t;
Table Op Msg_type Msg_text
test.t check status OK
set session debug = "+d,ib_trunc_crash_on_drop_of_sec_index";
+Warnings:
+Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead
truncate table t;
ERROR HY000: Lost connection to MySQL server during query
-# restart
check table t;
Table Op Msg_type Msg_text
test.t check status OK
@@ -206,9 +196,6 @@ drop table t;
" of index is commenced."
use test;
set global innodb_file_per_table = 1;
-set global innodb_file_format = 'Barracuda';
-Warnings:
-Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
SET innodb_strict_mode=OFF;
create table t (
i int, f float, c char,
@@ -225,9 +212,10 @@ check table t;
Table Op Msg_type Msg_text
test.t check status OK
set session debug = "+d,ib_trunc_crash_drop_reinit_done_create_to_start";
+Warnings:
+Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead
truncate table t;
ERROR HY000: Lost connection to MySQL server during query
-# restart
check table t;
Table Op Msg_type Msg_text
test.t check status OK
@@ -247,9 +235,6 @@ drop table t;
"5. Hit crash point while creating indexes."
use test;
set global innodb_file_per_table = 1;
-set global innodb_file_format = 'Barracuda';
-Warnings:
-Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
SET innodb_strict_mode=OFF;
create table t (
i int, f float, c char,
@@ -266,9 +251,10 @@ check table t;
Table Op Msg_type Msg_text
test.t check status OK
set session debug = "+d,ib_trunc_crash_on_create_of_clust_index";
+Warnings:
+Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead
truncate table t;
ERROR HY000: Lost connection to MySQL server during query
-# restart
check table t;
Table Op Msg_type Msg_text
test.t check status OK
@@ -287,9 +273,6 @@ i f c
drop table t;
use test;
set global innodb_file_per_table = 1;
-set global innodb_file_format = 'Barracuda';
-Warnings:
-Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
SET innodb_strict_mode=OFF;
create table t (
i int, f float, c char,
@@ -306,9 +289,10 @@ check table t;
Table Op Msg_type Msg_text
test.t check status OK
set session debug = "+d,ib_trunc_crash_on_create_of_uniq_index";
+Warnings:
+Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead
truncate table t;
ERROR HY000: Lost connection to MySQL server during query
-# restart
check table t;
Table Op Msg_type Msg_text
test.t check status OK
@@ -327,9 +311,6 @@ i f c
drop table t;
use test;
set global innodb_file_per_table = 1;
-set global innodb_file_format = 'Barracuda';
-Warnings:
-Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
SET innodb_strict_mode=OFF;
create table t (
i int, f float, c char,
@@ -346,9 +327,10 @@ check table t;
Table Op Msg_type Msg_text
test.t check status OK
set session debug = "+d,ib_trunc_crash_on_create_of_sec_index";
+Warnings:
+Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead
truncate table t;
ERROR HY000: Lost connection to MySQL server during query
-# restart
check table t;
Table Op Msg_type Msg_text
test.t check status OK
@@ -369,9 +351,6 @@ drop table t;
" in-memory dict."
use test;
set global innodb_file_per_table = 1;
-set global innodb_file_format = 'Barracuda';
-Warnings:
-Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
SET innodb_strict_mode=OFF;
create table t (
i int, f float, c char,
@@ -388,9 +367,10 @@ check table t;
Table Op Msg_type Msg_text
test.t check status OK
set session debug = "+d,ib_trunc_crash_on_updating_dict_sys_info";
+Warnings:
+Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead
truncate table t;
ERROR HY000: Lost connection to MySQL server during query
-# restart
check table t;
Table Op Msg_type Msg_text
test.t check status OK
@@ -410,9 +390,6 @@ drop table t;
"7. Hit crash point before/after log checkpoint is done."
use test;
set global innodb_file_per_table = 1;
-set global innodb_file_format = 'Barracuda';
-Warnings:
-Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
SET innodb_strict_mode=OFF;
create table t (
i int, f float, c char,
@@ -429,9 +406,10 @@ check table t;
Table Op Msg_type Msg_text
test.t check status OK
set session debug = "+d,ib_trunc_crash_before_log_removal";
+Warnings:
+Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead
truncate table t;
ERROR HY000: Lost connection to MySQL server during query
-# restart
check table t;
Table Op Msg_type Msg_text
test.t check status OK
@@ -445,9 +423,6 @@ i f c
drop table t;
use test;
set global innodb_file_per_table = 1;
-set global innodb_file_format = 'Barracuda';
-Warnings:
-Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
SET innodb_strict_mode=OFF;
create table t (
i int, f float, c char,
@@ -464,9 +439,10 @@ check table t;
Table Op Msg_type Msg_text
test.t check status OK
set session debug = "+d,ib_trunc_crash_after_truncate_done";
+Warnings:
+Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead
truncate table t;
ERROR HY000: Lost connection to MySQL server during query
-# restart
check table t;
Table Op Msg_type Msg_text
test.t check status OK
@@ -483,18 +459,16 @@ i f c
1 1.1 a
2 2.2 b
drop table t;
-set global innodb_file_format = Barracuda;
-Warnings:
-Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
set global innodb_file_per_table = 1;
call mtr.add_suppression("does not exist in the InnoDB internal");
+Warnings:
+Error 145 Table './mtr/test_suppressions' is marked as crashed and should be repaired
+Error 1194 Table 'test_suppressions' is marked as crashed and should be repaired
+Error 1034 1 client is using or hasn't closed the table properly
set global innodb_file_per_table = on;
"1. Hit crash point on completing drop of all indexes before creation"
" of index is commenced."
set global innodb_file_per_table = 1;
-set global innodb_file_format = 'Barracuda';
-Warnings:
-Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
set innodb_strict_mode=off;
create temporary table t (
i int, f float, c char,
@@ -511,9 +485,10 @@ check table t;
Table Op Msg_type Msg_text
test.t check status OK
set session debug = "+d,ib_trunc_crash_drop_reinit_done_create_to_start";
+Warnings:
+Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead
truncate table t;
ERROR HY000: Lost connection to MySQL server during query
-# restart
check table t;
Table Op Msg_type Msg_text
test.t check Error Table 'test.t' doesn't exist
@@ -521,9 +496,6 @@ test.t check status Operation failed
"2. Hit crash point after data is updated to system-table and"
" in-memory dict."
set global innodb_file_per_table = 1;
-set global innodb_file_format = 'Barracuda';
-Warnings:
-Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
set innodb_strict_mode=off;
create temporary table t (
i int, f float, c char,
@@ -540,14 +512,11 @@ check table t;
Table Op Msg_type Msg_text
test.t check status OK
set session debug = "+d,ib_trunc_crash_on_updating_dict_sys_info";
+Warnings:
+Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead
truncate table t;
ERROR HY000: Lost connection to MySQL server during query
-# restart
check table t;
Table Op Msg_type Msg_text
test.t check Error Table 'test.t' doesn't exist
test.t check status Operation failed
-set global innodb_file_format = Barracuda;
-Warnings:
-Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
-set global innodb_file_per_table = 1;
diff --git a/mysql-test/suite/innodb_zip/r/wl6501_crash_5.result b/mysql-test/suite/innodb_zip/r/wl6501_crash_5.result
index 74f1e9dd1ad..b5fea6382ff 100644
--- a/mysql-test/suite/innodb_zip/r/wl6501_crash_5.result
+++ b/mysql-test/suite/innodb_zip/r/wl6501_crash_5.result
@@ -5,9 +5,6 @@ set global innodb_file_per_table = on;
"1. Hit crash point while writing redo log."
use test;
set global innodb_file_per_table = 1;
-set global innodb_file_format = 'Barracuda';
-Warnings:
-Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
SET innodb_strict_mode=OFF;
create table t (
i int, f float, c char,
@@ -24,9 +21,10 @@ check table t;
Table Op Msg_type Msg_text
test.t check status OK
set session debug = "+d,ib_trunc_crash_while_writing_redo_log";
+Warnings:
+Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead
truncate table t;
ERROR HY000: Lost connection to MySQL server during query
-# restart
check table t;
Table Op Msg_type Msg_text
test.t check status OK
@@ -43,9 +41,6 @@ drop table t;
"2. Hit crash point on completion of redo log write."
use test;
set global innodb_file_per_table = 1;
-set global innodb_file_format = 'Barracuda';
-Warnings:
-Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
SET innodb_strict_mode=OFF;
create table t (
i int, f float, c char,
@@ -62,9 +57,10 @@ check table t;
Table Op Msg_type Msg_text
test.t check status OK
set session debug = "+d,ib_trunc_crash_after_redo_log_write_complete";
+Warnings:
+Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead
truncate table t;
ERROR HY000: Lost connection to MySQL server during query
-# restart
check table t;
Table Op Msg_type Msg_text
test.t check status OK
@@ -84,9 +80,6 @@ drop table t;
"3. Hit crash point while dropping indexes."
use test;
set global innodb_file_per_table = 1;
-set global innodb_file_format = 'Barracuda';
-Warnings:
-Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
SET innodb_strict_mode=OFF;
create table t (
i int, f float, c char,
@@ -103,9 +96,10 @@ check table t;
Table Op Msg_type Msg_text
test.t check status OK
set session debug = "+d,ib_trunc_crash_on_drop_of_clust_index";
+Warnings:
+Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead
truncate table t;
ERROR HY000: Lost connection to MySQL server during query
-# restart
check table t;
Table Op Msg_type Msg_text
test.t check status OK
@@ -124,9 +118,6 @@ i f c
drop table t;
use test;
set global innodb_file_per_table = 1;
-set global innodb_file_format = 'Barracuda';
-Warnings:
-Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
SET innodb_strict_mode=OFF;
create table t (
i int, f float, c char,
@@ -143,9 +134,10 @@ check table t;
Table Op Msg_type Msg_text
test.t check status OK
set session debug = "+d,ib_trunc_crash_on_drop_of_uniq_index";
+Warnings:
+Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead
truncate table t;
ERROR HY000: Lost connection to MySQL server during query
-# restart
check table t;
Table Op Msg_type Msg_text
test.t check status OK
@@ -164,9 +156,6 @@ i f c
drop table t;
use test;
set global innodb_file_per_table = 1;
-set global innodb_file_format = 'Barracuda';
-Warnings:
-Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
SET innodb_strict_mode=OFF;
create table t (
i int, f float, c char,
@@ -183,9 +172,10 @@ check table t;
Table Op Msg_type Msg_text
test.t check status OK
set session debug = "+d,ib_trunc_crash_on_drop_of_sec_index";
+Warnings:
+Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead
truncate table t;
ERROR HY000: Lost connection to MySQL server during query
-# restart
check table t;
Table Op Msg_type Msg_text
test.t check status OK
@@ -206,9 +196,6 @@ drop table t;
" of index is commenced."
use test;
set global innodb_file_per_table = 1;
-set global innodb_file_format = 'Barracuda';
-Warnings:
-Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
SET innodb_strict_mode=OFF;
create table t (
i int, f float, c char,
@@ -225,9 +212,10 @@ check table t;
Table Op Msg_type Msg_text
test.t check status OK
set session debug = "+d,ib_trunc_crash_drop_reinit_done_create_to_start";
+Warnings:
+Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead
truncate table t;
ERROR HY000: Lost connection to MySQL server during query
-# restart
check table t;
Table Op Msg_type Msg_text
test.t check status OK
@@ -247,9 +235,6 @@ drop table t;
"5. Hit crash point while creating indexes."
use test;
set global innodb_file_per_table = 1;
-set global innodb_file_format = 'Barracuda';
-Warnings:
-Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
SET innodb_strict_mode=OFF;
create table t (
i int, f float, c char,
@@ -266,9 +251,10 @@ check table t;
Table Op Msg_type Msg_text
test.t check status OK
set session debug = "+d,ib_trunc_crash_on_create_of_clust_index";
+Warnings:
+Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead
truncate table t;
ERROR HY000: Lost connection to MySQL server during query
-# restart
check table t;
Table Op Msg_type Msg_text
test.t check status OK
@@ -287,9 +273,6 @@ i f c
drop table t;
use test;
set global innodb_file_per_table = 1;
-set global innodb_file_format = 'Barracuda';
-Warnings:
-Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
SET innodb_strict_mode=OFF;
create table t (
i int, f float, c char,
@@ -306,9 +289,10 @@ check table t;
Table Op Msg_type Msg_text
test.t check status OK
set session debug = "+d,ib_trunc_crash_on_create_of_uniq_index";
+Warnings:
+Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead
truncate table t;
ERROR HY000: Lost connection to MySQL server during query
-# restart
check table t;
Table Op Msg_type Msg_text
test.t check status OK
@@ -327,9 +311,6 @@ i f c
drop table t;
use test;
set global innodb_file_per_table = 1;
-set global innodb_file_format = 'Barracuda';
-Warnings:
-Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
SET innodb_strict_mode=OFF;
create table t (
i int, f float, c char,
@@ -346,9 +327,10 @@ check table t;
Table Op Msg_type Msg_text
test.t check status OK
set session debug = "+d,ib_trunc_crash_on_create_of_sec_index";
+Warnings:
+Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead
truncate table t;
ERROR HY000: Lost connection to MySQL server during query
-# restart
check table t;
Table Op Msg_type Msg_text
test.t check status OK
@@ -369,9 +351,6 @@ drop table t;
" in-memory dict."
use test;
set global innodb_file_per_table = 1;
-set global innodb_file_format = 'Barracuda';
-Warnings:
-Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
SET innodb_strict_mode=OFF;
create table t (
i int, f float, c char,
@@ -388,9 +367,10 @@ check table t;
Table Op Msg_type Msg_text
test.t check status OK
set session debug = "+d,ib_trunc_crash_on_updating_dict_sys_info";
+Warnings:
+Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead
truncate table t;
ERROR HY000: Lost connection to MySQL server during query
-# restart
check table t;
Table Op Msg_type Msg_text
test.t check status OK
@@ -410,9 +390,6 @@ drop table t;
"7. Hit crash point before/after log checkpoint is done."
use test;
set global innodb_file_per_table = 1;
-set global innodb_file_format = 'Barracuda';
-Warnings:
-Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
SET innodb_strict_mode=OFF;
create table t (
i int, f float, c char,
@@ -429,9 +406,10 @@ check table t;
Table Op Msg_type Msg_text
test.t check status OK
set session debug = "+d,ib_trunc_crash_before_log_removal";
+Warnings:
+Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead
truncate table t;
ERROR HY000: Lost connection to MySQL server during query
-# restart
check table t;
Table Op Msg_type Msg_text
test.t check status OK
@@ -445,9 +423,6 @@ i f c
drop table t;
use test;
set global innodb_file_per_table = 1;
-set global innodb_file_format = 'Barracuda';
-Warnings:
-Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
SET innodb_strict_mode=OFF;
create table t (
i int, f float, c char,
@@ -464,9 +439,10 @@ check table t;
Table Op Msg_type Msg_text
test.t check status OK
set session debug = "+d,ib_trunc_crash_after_truncate_done";
+Warnings:
+Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead
truncate table t;
ERROR HY000: Lost connection to MySQL server during query
-# restart
check table t;
Table Op Msg_type Msg_text
test.t check status OK
@@ -483,7 +459,4 @@ i f c
1 1.1 a
2 2.2 b
drop table t;
-set global innodb_file_format = Barracuda;
-Warnings:
-Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
set global innodb_file_per_table = 1;
diff --git a/mysql-test/suite/innodb_zip/r/wl6501_scale_1.result b/mysql-test/suite/innodb_zip/r/wl6501_scale_1.result
index 9c197737137..0064cf2a469 100644
--- a/mysql-test/suite/innodb_zip/r/wl6501_scale_1.result
+++ b/mysql-test/suite/innodb_zip/r/wl6501_scale_1.result
@@ -20,32 +20,27 @@ set i = i + 1;
end while;
end|
set global innodb_file_per_table = 1;
-set global innodb_file_format = 'Antelope';
-Warnings:
-Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
create table tNUMBER
(i int, cNUMBER char(NUMBER), cNUMBER char(NUMBER),
index cNUMBER_idx(cNUMBER))
engine=innodb row_format=compact
key_block_size=NUMBER;
Warnings:
-Warning NUMBER InnoDB: KEY_BLOCK_SIZE requires innodb_file_format > Antelope.
-Warning NUMBER InnoDB: ignoring KEY_BLOCK_SIZE=NUMBER.
+Warning NUMBER InnoDB: ignoring KEY_BLOCK_SIZE=NUMBER unless ROW_FORMAT=COMPRESSED.
create table t2
(i int, c1 char(100), c2 char(100),
index c1_idx(c1))
engine=innodb row_format=compact
key_block_size=16;
Warnings:
-Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_format > Antelope.
-Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=16.
+Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=16 unless ROW_FORMAT=COMPRESSED.
create temporary table t3
(i int, c1 char(100), c2 char(100),
index c1_idx(c1))
engine=innodb row_format=compact
key_block_size=16;
Warnings:
-Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_format > Antelope.
+Warning 1478 InnoDB: KEY_BLOCK_SIZE is ignored for TEMPORARY TABLE.
Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=16.
select count(*) from t1;
count(*)
@@ -140,9 +135,6 @@ set i = i + 1;
end while;
end|
set global innodb_file_per_table = 1;
-set global innodb_file_format = 'Barracuda';
-Warnings:
-Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
create table tNUMBER
(i int, cNUMBER char(NUMBER), cNUMBER char(NUMBER),
index cNUMBER_idx(cNUMBER))
@@ -158,6 +150,11 @@ create temporary table t3
index c1_idx(c1))
engine=innodb row_format=compressed
key_block_size=16;
+Warnings:
+Warning 1478 InnoDB: KEY_BLOCK_SIZE is ignored for TEMPORARY TABLE.
+Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=16.
+Warning 1478 InnoDB: ROW_FORMAT=COMPRESSED is ignored for TEMPORARY TABLE.
+Warning 1478 InnoDB: assuming ROW_FORMAT=DYNAMIC.
select count(*) from t1;
count(*)
0
@@ -251,9 +248,6 @@ set i = i + 1;
end while;
end|
set global innodb_file_per_table = 0;
-set global innodb_file_format = 'Antelope';
-Warnings:
-Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
create table tNUMBER
(i int, cNUMBER char(NUMBER), cNUMBER char(NUMBER),
index cNUMBER_idx(cNUMBER))
@@ -261,7 +255,6 @@ engine=innodb row_format=compact
key_block_size=NUMBER;
Warnings:
Warning NUMBER InnoDB: KEY_BLOCK_SIZE requires innodb_file_per_table.
-Warning NUMBER InnoDB: KEY_BLOCK_SIZE requires innodb_file_format > Antelope.
Warning NUMBER InnoDB: ignoring KEY_BLOCK_SIZE=NUMBER.
create table t2
(i int, c1 char(100), c2 char(100),
@@ -270,7 +263,6 @@ engine=innodb row_format=compact
key_block_size=16;
Warnings:
Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_per_table.
-Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_format > Antelope.
Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=16.
create temporary table t3
(i int, c1 char(100), c2 char(100),
@@ -278,8 +270,7 @@ index c1_idx(c1))
engine=innodb row_format=compact
key_block_size=16;
Warnings:
-Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_per_table.
-Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_format > Antelope.
+Warning 1478 InnoDB: KEY_BLOCK_SIZE is ignored for TEMPORARY TABLE.
Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=16.
select count(*) from t1;
count(*)
diff --git a/mysql-test/suite/innodb_zip/r/wl6915_1.result b/mysql-test/suite/innodb_zip/r/wl6915_1.result
deleted file mode 100644
index bba81098e9d..00000000000
--- a/mysql-test/suite/innodb_zip/r/wl6915_1.result
+++ /dev/null
@@ -1,2079 +0,0 @@
-call mtr.ADD_suppression(".*Resizing redo log.*");
-call mtr.ADD_suppression(".*Starting to delete and rewrite log files.*");
-call mtr.ADD_suppression(".*New log files created.*");
-SELECT @@global.innodb_undo_tablespaces;
-@@global.innodb_undo_tablespaces
-0
-CREATE PROCEDURE populate_tables(IN id VARCHAR(10))
-begin
-declare n int default 20;
-set global innodb_file_per_table=on;
-DROP TABLE IF EXISTS t1,t2,t3,t4;
-CREATE TEMPORARY TABLE t1_temp(c1 int NOT NULL,
-c2 int NOT NULL,
-c3 char(255) NOT NULL,
-c4 text(600) NOT NULL,
-c5 blob(600) NOT NULL,
-c6 varchar(600) NOT NULL,
-c7 varchar(600) NOT NULL,
-c8 datetime,
-c9 decimal(6,3),
-PRIMARY KEY (c1),
-INDEX (c3,c4(50),c5(50)),
-INDEX (c2))
-ENGINE=InnoDB ROW_FORMAT=redundant;
-set @s = concat("CREATE TABLE t1",id," ( c1 int NOT NULL, c2 int NOT NULL, c3 char(255) NOT NULL, c4 text(600) NOT NULL, c5 blob(600) NOT NULL, c6 varchar(600) NOT NULL, c7 varchar(600) NOT NULL, c8 datetime, c9 decimal(6,3), PRIMARY KEY (c1), INDEX (c3,c4(50),c5(50)), INDEX (c2)) ENGINE=InnoDB ROW_FORMAT=redundant;");
-PREPARE createTable FROM @s;
-EXECUTE createTable;
-DEALLOCATE PREPARE createTable;
-CREATE TEMPORARY TABLE t2_temp(c1 int NOT NULL,
-c2 int NOT NULL,
-c3 char(255) NOT NULL,
-c4 text(600) NOT NULL,
-c5 blob(600) NOT NULL,
-c6 varchar(600) NOT NULL,
-c7 varchar(600) NOT NULL,
-c8 datetime,
-c9 decimal(6,3),
-PRIMARY KEY (c1),
-INDEX (c3,c4(50),c5(50)),
-INDEX (c2))
-ENGINE=InnoDB ROW_FORMAT=compact;
-set @s = concat("CREATE TABLE t2",id," (c1 int NOT NULL, c2 int NOT NULL, c3 char(255) NOT NULL, c4 text(600) NOT NULL, c5 blob(600) NOT NULL, c6 varchar(600) NOT NULL, c7 varchar(600) NOT NULL, c8 datetime, c9 decimal(6,3), PRIMARY KEY (c1), INDEX (c3,c4(50),c5(50)), INDEX (c2)) ENGINE=InnoDB ROW_FORMAT=compact;");
-PREPARE createTable FROM @s;
-EXECUTE createTable;
-DEALLOCATE PREPARE createTable;
-CREATE TEMPORARY TABLE t3_temp(c1 int NOT NULL,
-c2 int NOT NULL,
-c3 char(255) NOT NULL,
-c4 text(600) NOT NULL,
-c5 blob(600) NOT NULL,
-c6 varchar(600) NOT NULL,
-c7 varchar(600) NOT NULL,
-c8 datetime,
-c9 decimal(6,3),
-PRIMARY KEY (c1),
-INDEX (c3,c4(50),c5(50)),
-INDEX (c2))
-ENGINE=InnoDB ROW_FORMAT=compressed key_block_size=4;
-set @s = concat("CREATE TABLE t3",id," (c1 int NOT NULL, c2 int NOT NULL, c3 char(255) NOT NULL, c4 text(600) NOT NULL, c5 blob(600) NOT NULL, c6 varchar(600) NOT NULL, c7 varchar(600) NOT NULL, c8 datetime, c9 decimal(6,3), PRIMARY KEY (c1), INDEX (c3,c4(50),c5(50)), INDEX (c2)) ENGINE=InnoDB ROW_FORMAT=compressed key_block_size=4;");
-PREPARE createTable FROM @s;
-EXECUTE createTable;
-DEALLOCATE PREPARE createTable;
-CREATE TEMPORARY TABLE t4_temp(c1 int NOT NULL,
-c2 int NOT NULL,
-c3 char(255) NOT NULL,
-c4 text(600) NOT NULL,
-c5 blob(600) NOT NULL,
-c6 varchar(600) NOT NULL,
-c7 varchar(600) NOT NULL,
-c8 datetime,
-c9 decimal(6,3),
-PRIMARY KEY (c1),
-INDEX (c3,c4(50),c5(50)),
-INDEX (c2))
-ENGINE=InnoDB ROW_FORMAT=dynamic;
-set @s = concat("CREATE TABLE t4",id," (c1 int NOT NULL, c2 int NOT NULL, c3 char(255) NOT NULL, c4 text(600) NOT NULL, c5 blob(600) NOT NULL, c6 varchar(600) NOT NULL, c7 varchar(600) NOT NULL, c8 datetime, c9 decimal(6,3), PRIMARY KEY (c1), INDEX (c3,c4(50),c5(50)), INDEX (c2)) ENGINE=InnoDB ROW_FORMAT=dynamic;");
-PREPARE createTable FROM @s;
-EXECUTE createTable;
-DEALLOCATE PREPARE createTable;
-while (n > 0) do
-START TRANSACTION;
-set @s = concat("INSERT INTO t1",id," VALUES(",n,",",n,",REPEAT(concat(' tc3_',",n,"),30), REPEAT(concat(' tc4_',",n,"),70),REPEAT(concat(' tc_',",n,"),70), REPEAT(concat(' tc6_',",n,"),70),REPEAT(concat(' tc7_',",n,"),70), NOW(),(100.55+",n,"));");
-PREPARE insertIntoTable FROM @s;
-EXECUTE insertIntoTable;
-DEALLOCATE PREPARE insertIntoTable;
-INSERT INTO t1_temp VALUES(n,n,REPEAT(concat(' tc3_',n),30),
-REPEAT(concat(' tc4_',n),70),REPEAT(concat(' tc_',n),70),
-REPEAT(concat(' tc6_',n),70),REPEAT(concat(' tc7_',n),70),
-NOW(),(100.55+n));
-set @s = concat("INSERT INTO t2",id," VALUES(",n,",",n,",REPEAT(concat(' tc3_',",n,"),30), REPEAT(concat(' tc4_',",n,"),70),REPEAT(concat(' tc_',",n,"),70), REPEAT(concat(' tc6_',",n,"),70),REPEAT(concat(' tc7_',",n,"),70), NOW(),(100.55+",n,"));");
-PREPARE insertIntoTable FROM @s;
-EXECUTE insertIntoTable;
-DEALLOCATE PREPARE insertIntoTable;
-INSERT INTO t2_temp VALUES(n,n,REPEAT(concat(' tc3_',n),30),
-REPEAT(concat(' tc4_',n),70),REPEAT(concat(' tc_',n),70),
-REPEAT(concat(' tc6_',n),70),REPEAT(concat(' tc7_',n),70),
-NOW(),(100.55+n));
-savepoint a;
-set @s = concat("INSERT INTO t3",id," VALUES(",n,",",n,",REPEAT(concat(' tc3_',",n,"),30), REPEAT(concat(' tc4_',",n,"),70),REPEAT(concat(' tc_',",n,"),70), REPEAT(concat(' tc6_',",n,"),70),REPEAT(concat(' tc7_',",n,"),70), NOW(),(100.55+",n,"));");
-PREPARE insertIntoTable FROM @s;
-EXECUTE insertIntoTable;
-DEALLOCATE PREPARE insertIntoTable;
-INSERT INTO t3_temp VALUES(n,n,REPEAT(concat(' tc3_',n),30),
-REPEAT(concat(' tc4_',n),70),REPEAT(concat(' tc_',n),70),
-REPEAT(concat(' tc6_',n),70),REPEAT(concat(' tc7_',n),70),
-NOW(),(100.55+n));
-savepoint b;
-set @s = concat("INSERT INTO t4",id," VALUES(",n,",",n,",REPEAT(concat(' tc3_',",n,"),30), REPEAT(concat(' tc4_',",n,"),70),REPEAT(concat(' tc_',",n,"),70), REPEAT(concat(' tc6_',",n,"),70),REPEAT(concat(' tc7_',",n,"),70), NOW(),(100.55+",n,"));");
-PREPARE insertIntoTable FROM @s;
-EXECUTE insertIntoTable;
-DEALLOCATE PREPARE insertIntoTable;
-INSERT INTO t4_temp VALUES(n,n,REPEAT(concat(' tc3_',n),30),
-REPEAT(concat(' tc4_',n),70),REPEAT(concat(' tc_',n),70),
-REPEAT(concat(' tc6_',n),70),REPEAT(concat(' tc7_',n),70),
-NOW(),(100.55+n));
-if (n > 10) then
-if (n > 10 and n <=12) then
-ROLLBACK TO SAVEPOINT a;
-COMMIT;
-end if;
-if (n > 12 and n < 15) then
-ROLLBACK TO SAVEPOINT b;
-COMMIT;
-end if;
-if (n > 15) then
-COMMIT;
-end if;
-else
-if (n > 5) then
-START TRANSACTION;
-DELETE FROM t1_temp WHERE c1 > 10 ;
-DELETE FROM t2_temp WHERE c1 > 10 ;
-DELETE FROM t3_temp WHERE c1 > 10 ;
-DELETE FROM t4_temp WHERE c1 > 10 ;
-rollback;
-START TRANSACTION;
-update t1_temp set c1 = c1 + 1000 WHERE c1 > 10;
-update t2_temp set c1 = c1 + 1000 WHERE c1 > 10;
-update t3_temp set c1 = c1 + 1000 WHERE c1 > 10;
-update t4_temp set c1 = c1 + 1000 WHERE c1 > 10;
-rollback;
-end if;
-end if;
-if (n < 5) then
-rollback;
-end if;
-FLUSH logs;
-ALTER TABLE t1_temp DROP PRIMARY KEY;
-ALTER TABLE t1_temp ADD PRIMARY KEY (c1,c3(10),c4(10));
-ALTER TABLE t2_temp DROP PRIMARY KEY;
-ALTER TABLE t2_temp ADD PRIMARY KEY (c1,c3(10),c4(10));
-ALTER TABLE t3_temp DROP PRIMARY KEY;
-ALTER TABLE t3_temp ADD PRIMARY KEY (c1,c3(10),c4(10));
-ALTER TABLE t4_temp DROP PRIMARY KEY;
-ALTER TABLE t4_temp ADD PRIMARY KEY (c1,c3(10),c4(10));
-FLUSH tables;
-START TRANSACTION;
-set @s = concat("INSERT INTO t1",id," VALUES(",n,"+100,",n,"+100,REPEAT(concat(' tc3_',",n,"+100),30), REPEAT(concat(' tc4_',",n,"+100),70),REPEAT(concat(' tc_',",n,"+100),70), REPEAT(concat(' tc6_',",n,"+100),60),REPEAT(concat(' tc7_',",n,"+100),60), NOW(),(100.55+",n,"+100));");
-PREPARE insertIntoTable FROM @s;
-EXECUTE insertIntoTable;
-DEALLOCATE PREPARE insertIntoTable;
-INSERT INTO t1_temp VALUES(n+100,n+100,REPEAT(concat(' tc3_',n+100),30),
-REPEAT(concat(' tc4_',n+100),70),REPEAT(concat(' tc_',n+100),70),
-REPEAT(concat(' tc6_',n+100),60),REPEAT(concat(' tc7_',n+100),60),
-NOW(),(100.55+n+100));
-set @s = concat("INSERT INTO t2",id," VALUES(",n,"+100,",n,"+100,REPEAT(concat(' tc3_',",n,"+100),30), REPEAT(concat(' tc4_',",n,"+100),70),REPEAT(concat(' tc_',",n,"+100),70), REPEAT(concat(' tc6_',",n,"+100),60),REPEAT(concat(' tc7_',",n,"+100),60), NOW(),(100.55+",n,"+100));");
-PREPARE insertIntoTable FROM @s;
-EXECUTE insertIntoTable;
-DEALLOCATE PREPARE insertIntoTable;
-INSERT INTO t2_temp VALUES(n+100,n+100,REPEAT(concat(' tc3_',n+100),30),
-REPEAT(concat(' tc4_',n+100),70),REPEAT(concat(' tc_',n+100),70),
-REPEAT(concat(' tc6_',n+100),60),REPEAT(concat(' tc7_',n+100),60),
-NOW(),(100.55+n+100));
-set @s = concat("INSERT INTO t3",id," VALUES(",n,"+100,",n,"+100,REPEAT(concat(' tc3_',",n,"+100),30), REPEAT(concat(' tc4_',",n,"+100),70),REPEAT(concat(' tc_',",n,"+100),70), REPEAT(concat(' tc6_',",n,"+100),60),REPEAT(concat(' tc7_',",n,"+100),60), NOW(),(100.55+",n,"+100));");
-PREPARE insertIntoTable FROM @s;
-EXECUTE insertIntoTable;
-DEALLOCATE PREPARE insertIntoTable;
-INSERT INTO t3_temp VALUES(n+100,n+100,REPEAT(concat(' tc3_',n+100),30),
-REPEAT(concat(' tc4_',n+100),70),REPEAT(concat(' tc_',n+100),70),
-REPEAT(concat(' tc6_',n+100),60),REPEAT(concat(' tc7_',n+100),60),
-NOW(),(100.55+n+100));
-set @s = concat("INSERT INTO t4",id," VALUES(",n,"+100,",n,"+100,REPEAT(concat(' tc3_',",n,"+100),30), REPEAT(concat(' tc4_',",n,"+100),70),REPEAT(concat(' tc_',",n,"+100),70), REPEAT(concat(' tc6_',",n,"+100),60),REPEAT(concat(' tc7_',",n,"+100),60), NOW(),(100.55+",n,"+100));");
-PREPARE insertIntoTable FROM @s;
-EXECUTE insertIntoTable;
-DEALLOCATE PREPARE insertIntoTable;
-INSERT INTO t4_temp VALUES(n+100,n+100,REPEAT(concat(' tc3_',n+100),30),
-REPEAT(concat(' tc4_',n+100),70),REPEAT(concat(' tc_',n+100),70),
-REPEAT(concat(' tc6_',n+100),60),REPEAT(concat(' tc7_',n+100),60),
-NOW(),(100.55+n+100));
-DELETE FROM t1_temp WHERE c1 between 100 and 110;
-DELETE FROM t2_temp WHERE c1 between 100 and 110;
-DELETE FROM t3_temp WHERE c1 between 100 and 110;
-DELETE FROM t4_temp WHERE c1 between 100 and 110;
-update t1_temp set c1 = c1+1 WHERE c1>110;
-update t2_temp set c1 = c1+1 WHERE c1>110;
-update t3_temp set c1 = c1+1 WHERE c1>110;
-update t4_temp set c1 = c1+1 WHERE c1>110;
-savepoint a;
-set @s = concat("INSERT INTO t1",id," VALUES(300+",n,"+100,",n,"+100,REPEAT(concat(' tc3_',",n,"+100),30), REPEAT(concat(' tc4_',",n,"+100),70),REPEAT(concat(' tc_',",n,"+100),70), REPEAT(concat(' tc6_',",n,"+100),60),REPEAT(concat(' tc7_',",n,"+100),60), NOW(),(100.55+",n,"+100));");
-PREPARE insertIntoTable FROM @s;
-EXECUTE insertIntoTable;
-DEALLOCATE PREPARE insertIntoTable;
-INSERT INTO t1_temp VALUES(300+n+100,n+100,REPEAT(concat(' tc3_',n+100),30),
-REPEAT(concat(' tc4_',n+100),70),REPEAT(concat(' tc_',n+100),70),
-REPEAT(concat(' tc6_',n+100),60),REPEAT(concat(' tc7_',n+100),60),
-NOW(),(100.55+n+100));
-set @s = concat("INSERT INTO t2",id," VALUES(300+",n,"+100,",n,"+100,REPEAT(concat(' tc3_',",n,"+100),30), REPEAT(concat(' tc4_',",n,"+100),70),REPEAT(concat(' tc_',",n,"+100),70), REPEAT(concat(' tc6_',",n,"+100),60),REPEAT(concat(' tc7_',",n,"+100),60), NOW(),(100.55+",n,"+100));");
-PREPARE insertIntoTable FROM @s;
-EXECUTE insertIntoTable;
-DEALLOCATE PREPARE insertIntoTable;
-INSERT INTO t2_temp VALUES(300+n+100,n+100,REPEAT(concat(' tc3_',n+100),30),
-REPEAT(concat(' tc4_',n+100),70),REPEAT(concat(' tc_',n+100),70),
-REPEAT(concat(' tc6_',n+100),60),REPEAT(concat(' tc7_',n+100),60),
-NOW(),(100.55+n+100));
-set @s = concat("INSERT INTO t3",id," VALUES(300+",n,"+100,",n,"+100,REPEAT(concat(' tc3_',",n,"+100),30), REPEAT(concat(' tc4_',",n,"+100),70),REPEAT(concat(' tc_',",n,"+100),70), REPEAT(concat(' tc6_',",n,"+100),60),REPEAT(concat(' tc7_',",n,"+100),60), NOW(),(100.55+",n,"+100));");
-PREPARE insertIntoTable FROM @s;
-EXECUTE insertIntoTable;
-DEALLOCATE PREPARE insertIntoTable;
-INSERT INTO t3_temp VALUES(300+n+100,n+100,REPEAT(concat(' tc3_',n+100),30),
-REPEAT(concat(' tc4_',n+100),70),REPEAT(concat(' tc_',n+100),70),
-REPEAT(concat(' tc6_',n+100),60),REPEAT(concat(' tc7_',n+100),60),
-NOW(),(100.55+n+100));
-set @s = concat("INSERT INTO t4",id," VALUES(300+",n,"+100,",n,"+100,REPEAT(concat(' tc3_',",n,"+100),30), REPEAT(concat(' tc4_',",n,"+100),70),REPEAT(concat(' tc_',",n,"+100),70), REPEAT(concat(' tc6_',",n,"+100),60),REPEAT(concat(' tc7_',",n,"+100),60), NOW(),(100.55+",n,"+100));");
-PREPARE insertIntoTable FROM @s;
-EXECUTE insertIntoTable;
-DEALLOCATE PREPARE insertIntoTable;
-INSERT INTO t4_temp VALUES(300+n+100,n+100,REPEAT(concat(' tc3_',n+100),30),
-REPEAT(concat(' tc4_',n+100),70),REPEAT(concat(' tc_',n+100),70),
-REPEAT(concat(' tc6_',n+100),60),REPEAT(concat(' tc7_',n+100),60),
-NOW(),(100.55+n+100));
-savepoint b;
-set @s = concat("INSERT INTO t1",id," VALUES(400+",n,"+100,",n,"+100,REPEAT(concat(' tc3_',",n,"+100),30), REPEAT(concat(' tc4_',",n,"+100),70),REPEAT(concat(' tc_',",n,"+100),70), REPEAT(concat(' tc6_',",n,"+100),60),REPEAT(concat(' tc7_',",n,"+100),60), NOW(),(100.55+",n,"+100));");
-PREPARE insertIntoTable FROM @s;
-EXECUTE insertIntoTable;
-DEALLOCATE PREPARE insertIntoTable;
-INSERT INTO t1_temp VALUES(400+n+100,n+100,REPEAT(concat(' tc3_',n+100),30),
-REPEAT(concat(' tc4_',n+100),70),REPEAT(concat(' tc_',n+100),70),
-REPEAT(concat(' tc6_',n+100),60),REPEAT(concat(' tc7_',n+100),60),
-NOW(),(100.55+n+100));
-set @s = concat("INSERT INTO t2",id," VALUES(400+",n,"+100,",n,"+100,REPEAT(concat(' tc3_',",n,"+100),30), REPEAT(concat(' tc4_',",n,"+100),70),REPEAT(concat(' tc_',",n,"+100),70), REPEAT(concat(' tc6_',",n,"+100),60),REPEAT(concat(' tc7_',",n,"+100),60), NOW(),(100.55+",n,"+100));");
-PREPARE insertIntoTable FROM @s;
-EXECUTE insertIntoTable;
-DEALLOCATE PREPARE insertIntoTable;
-INSERT INTO t2_temp VALUES(400+n+100,n+100,REPEAT(concat(' tc3_',n+100),30),
-REPEAT(concat(' tc4_',n+100),70),REPEAT(concat(' tc_',n+100),70),
-REPEAT(concat(' tc6_',n+100),60),REPEAT(concat(' tc7_',n+100),60),
-NOW(),(100.55+n+100));
-set @s = concat("INSERT INTO t3",id," VALUES(400+",n,"+100,",n,"+100,REPEAT(concat(' tc3_',",n,"+100),30), REPEAT(concat(' tc4_',",n,"+100),70),REPEAT(concat(' tc_',",n,"+100),70), REPEAT(concat(' tc6_',",n,"+100),60),REPEAT(concat(' tc7_',",n,"+100),60), NOW(),(100.55+",n,"+100));");
-PREPARE insertIntoTable FROM @s;
-EXECUTE insertIntoTable;
-DEALLOCATE PREPARE insertIntoTable;
-INSERT INTO t3_temp VALUES(400+n+100,n+100,REPEAT(concat(' tc3_',n+100),30),
-REPEAT(concat(' tc4_',n+100),70),REPEAT(concat(' tc_',n+100),70),
-REPEAT(concat(' tc6_',n+100),60),REPEAT(concat(' tc7_',n+100),60),
-NOW(),(100.55+n+100));
-set @s = concat("INSERT INTO t4",id," VALUES(400+",n,"+100,",n,"+100,REPEAT(concat(' tc3_',",n,"+100),30), REPEAT(concat(' tc4_',",n,"+100),70),REPEAT(concat(' tc_',",n,"+100),70), REPEAT(concat(' tc6_',",n,"+100),60),REPEAT(concat(' tc7_',",n,"+100),60), NOW(),(100.55+",n,"+100));");
-PREPARE insertIntoTable FROM @s;
-EXECUTE insertIntoTable;
-DEALLOCATE PREPARE insertIntoTable;
-INSERT INTO t4_temp VALUES(400+n+100,n+100,REPEAT(concat(' tc3_',n+100),30),
-REPEAT(concat(' tc4_',n+100),70),REPEAT(concat(' tc_',n+100),70),
-REPEAT(concat(' tc6_',n+100),60),REPEAT(concat(' tc7_',n+100),60),
-NOW(),(100.55+n+100));
-savepoint c;
-rollback to b;
-rollback to a;
-COMMIT;
-COMMIT;
-rollback;
-set n = n - 1;
-end while;
-end|
-connect con1,localhost,root,,;
-connect con2,localhost,root,,;
-#---client 1 : dml operation ---"
-connection con1;
-#---client 2 : dml operation ---"
-connection con2;
-# In connection 1
-connection con1;
-SELECT count(*) FROM t1_1;
-count(*)
-36
-SELECT count(*) FROM t2_1;
-count(*)
-36
-SELECT count(*) FROM t3_1;
-count(*)
-34
-SELECT count(*) FROM t4_1;
-count(*)
-32
-SELECT c1 FROM t1_1;
-c1
-5
-6
-7
-8
-9
-10
-11
-12
-13
-14
-15
-16
-17
-18
-19
-20
-101
-102
-103
-104
-105
-106
-107
-108
-109
-110
-111
-112
-113
-114
-115
-116
-117
-118
-119
-120
-SELECT c1 FROM t2_1;
-c1
-5
-6
-7
-8
-9
-10
-11
-12
-13
-14
-15
-16
-17
-18
-19
-20
-101
-102
-103
-104
-105
-106
-107
-108
-109
-110
-111
-112
-113
-114
-115
-116
-117
-118
-119
-120
-SELECT c1 FROM t3_1;
-c1
-5
-6
-7
-8
-9
-10
-13
-14
-15
-16
-17
-18
-19
-20
-101
-102
-103
-104
-105
-106
-107
-108
-109
-110
-111
-112
-113
-114
-115
-116
-117
-118
-119
-120
-SELECT c1 FROM t4_1;
-c1
-5
-6
-7
-8
-9
-10
-15
-16
-17
-18
-19
-20
-101
-102
-103
-104
-105
-106
-107
-108
-109
-110
-111
-112
-113
-114
-115
-116
-117
-118
-119
-120
-SELECT count(*) FROM t1_temp;
-count(*)
-26
-SELECT count(*) FROM t2_temp;
-count(*)
-26
-SELECT count(*) FROM t3_temp;
-count(*)
-24
-SELECT count(*) FROM t4_temp;
-count(*)
-22
-SELECT c1 FROM t1_temp;
-c1
-5
-6
-7
-8
-9
-10
-11
-12
-13
-14
-15
-16
-17
-18
-19
-20
-122
-124
-126
-128
-130
-132
-134
-136
-138
-140
-SELECT c1 FROM t2_temp;
-c1
-5
-6
-7
-8
-9
-10
-11
-12
-13
-14
-15
-16
-17
-18
-19
-20
-122
-124
-126
-128
-130
-132
-134
-136
-138
-140
-SELECT c1 FROM t3_temp;
-c1
-5
-6
-7
-8
-9
-10
-13
-14
-15
-16
-17
-18
-19
-20
-122
-124
-126
-128
-130
-132
-134
-136
-138
-140
-SELECT c1 FROM t4_temp;
-c1
-5
-6
-7
-8
-9
-10
-15
-16
-17
-18
-19
-20
-122
-124
-126
-128
-130
-132
-134
-136
-138
-140
-# In connection 2
-connection con2;
-SELECT count(*) FROM t1_2;
-count(*)
-36
-SELECT count(*) FROM t2_2;
-count(*)
-36
-SELECT count(*) FROM t3_2;
-count(*)
-34
-SELECT count(*) FROM t4_2;
-count(*)
-32
-SELECT c1 FROM t1_2;
-c1
-5
-6
-7
-8
-9
-10
-11
-12
-13
-14
-15
-16
-17
-18
-19
-20
-101
-102
-103
-104
-105
-106
-107
-108
-109
-110
-111
-112
-113
-114
-115
-116
-117
-118
-119
-120
-SELECT c1 FROM t2_2;
-c1
-5
-6
-7
-8
-9
-10
-11
-12
-13
-14
-15
-16
-17
-18
-19
-20
-101
-102
-103
-104
-105
-106
-107
-108
-109
-110
-111
-112
-113
-114
-115
-116
-117
-118
-119
-120
-SELECT c1 FROM t3_2;
-c1
-5
-6
-7
-8
-9
-10
-13
-14
-15
-16
-17
-18
-19
-20
-101
-102
-103
-104
-105
-106
-107
-108
-109
-110
-111
-112
-113
-114
-115
-116
-117
-118
-119
-120
-SELECT c1 FROM t4_2;
-c1
-5
-6
-7
-8
-9
-10
-15
-16
-17
-18
-19
-20
-101
-102
-103
-104
-105
-106
-107
-108
-109
-110
-111
-112
-113
-114
-115
-116
-117
-118
-119
-120
-SELECT count(*) FROM t1_temp;
-count(*)
-26
-SELECT count(*) FROM t2_temp;
-count(*)
-26
-SELECT count(*) FROM t3_temp;
-count(*)
-24
-SELECT count(*) FROM t4_temp;
-count(*)
-22
-SELECT c1 FROM t1_temp;
-c1
-5
-6
-7
-8
-9
-10
-11
-12
-13
-14
-15
-16
-17
-18
-19
-20
-122
-124
-126
-128
-130
-132
-134
-136
-138
-140
-SELECT c1 FROM t2_temp;
-c1
-5
-6
-7
-8
-9
-10
-11
-12
-13
-14
-15
-16
-17
-18
-19
-20
-122
-124
-126
-128
-130
-132
-134
-136
-138
-140
-SELECT c1 FROM t3_temp;
-c1
-5
-6
-7
-8
-9
-10
-13
-14
-15
-16
-17
-18
-19
-20
-122
-124
-126
-128
-130
-132
-134
-136
-138
-140
-SELECT c1 FROM t4_temp;
-c1
-5
-6
-7
-8
-9
-10
-15
-16
-17
-18
-19
-20
-122
-124
-126
-128
-130
-132
-134
-136
-138
-140
-# In connection 1
-connection con1;
-set AUTOCOMMIT = 0;
-ALTER TABLE t1_temp DROP PRIMARY KEY;
-ALTER TABLE t1_temp ADD PRIMARY KEY (c1);
-ALTER TABLE t2_temp DROP PRIMARY KEY;
-ALTER TABLE t2_temp ADD PRIMARY KEY (c1);
-ALTER TABLE t3_temp DROP PRIMARY KEY;
-ALTER TABLE t3_temp ADD PRIMARY KEY (c1);
-ALTER TABLE t4_temp DROP PRIMARY KEY;
-ALTER TABLE t4_temp ADD PRIMARY KEY (c1);
-INSERT INTO t1_temp VALUES (20,1,'a','a','a','a','a',NOW(),100.55);
-ERROR 23000: Duplicate entry '20' for key 'PRIMARY'
-insert ignore into t1_temp VALUES (20,1,'a','a','a','a','a',NOW(),100.55);
-Warnings:
-Warning 1062 Duplicate entry '20' for key 'PRIMARY'
-INSERT INTO t2_temp VALUES (20,1,'a','a','a','a','a',NOW(),100.55);
-ERROR 23000: Duplicate entry '20' for key 'PRIMARY'
-insert ignore into t2_temp VALUES (20,1,'a','a','a','a','a',NOW(),100.55);
-Warnings:
-Warning 1062 Duplicate entry '20' for key 'PRIMARY'
-INSERT INTO t3_temp VALUES (20,1,'a','a','a','a','a',NOW(),100.55);
-ERROR 23000: Duplicate entry '20' for key 'PRIMARY'
-insert ignore into t3_temp VALUES (20,1,'a','a','a','a','a',NOW(),100.55);
-Warnings:
-Warning 1062 Duplicate entry '20' for key 'PRIMARY'
-INSERT INTO t4_temp VALUES (20,1,'a','a','a','a','a',NOW(),100.55);
-ERROR 23000: Duplicate entry '20' for key 'PRIMARY'
-insert ignore into t4_temp VALUES (20,1,'a','a','a','a','a',NOW(),100.55);
-Warnings:
-Warning 1062 Duplicate entry '20' for key 'PRIMARY'
-INSERT INTO t1_temp VALUES (1,1,'a','a','a','a','a',NOW(),100.55),
-(20,1,'a','a','a','a','a',NOW(),100.55);
-ERROR 23000: Duplicate entry '20' for key 'PRIMARY'
-INSERT INTO t2_temp VALUES (1,1,'a','a','a','a','a',NOW(),100.55),
-(20,1,'a','a','a','a','a',NOW(),100.55);
-ERROR 23000: Duplicate entry '20' for key 'PRIMARY'
-INSERT INTO t3_temp VALUES (1,1,'a','a','a','a','a',NOW(),100.55),
-(20,1,'a','a','a','a','a',NOW(),100.55);
-ERROR 23000: Duplicate entry '20' for key 'PRIMARY'
-INSERT INTO t4_temp VALUES (1,1,'a','a','a','a','a',NOW(),100.55),
-(20,1,'a','a','a','a','a',NOW(),100.55);
-ERROR 23000: Duplicate entry '20' for key 'PRIMARY'
-set AUTOCOMMIT = 1;
-SELECT c1,c2 FROM t1_temp WHERE c1 in (20,1);
-c1 c2
-20 20
-SELECT c1,c2 FROM t2_temp WHERE c1 in (20,1);
-c1 c2
-20 20
-SELECT c1,c2 FROM t3_temp WHERE c1 in (20,1);
-c1 c2
-20 20
-SELECT c1,c2 FROM t4_temp WHERE c1 in (20,1);
-c1 c2
-20 20
-REPLACE INTO t1_temp VALUES (20,1,'a','a','a','a','a',NOW(),100.55);
-REPLACE INTO t2_temp VALUES (20,1,'a','a','a','a','a',NOW(),100.55);
-REPLACE INTO t3_temp VALUES (20,1,'a','a','a','a','a',NOW(),100.55);
-REPLACE INTO t4_temp VALUES (20,1,'a','a','a','a','a',NOW(),100.55);
-SELECT c1,c2,c3,c4,c5,c6,c7,c9 FROM t1_temp WHERE c1 = 20;
-c1 c2 c3 c4 c5 c6 c7 c9
-20 1 a a a a a 100.550
-SELECT c1,c2,c3,c4,c5,c6,c7,c9 FROM t2_temp WHERE c1 = 20;
-c1 c2 c3 c4 c5 c6 c7 c9
-20 1 a a a a a 100.550
-SELECT c1,c2,c3,c4,c5,c6,c7,c9 FROM t3_temp WHERE c1 = 20;
-c1 c2 c3 c4 c5 c6 c7 c9
-20 1 a a a a a 100.550
-SELECT c1,c2,c3,c4,c5,c6,c7,c9 FROM t4_temp WHERE c1 = 20;
-c1 c2 c3 c4 c5 c6 c7 c9
-20 1 a a a a a 100.550
-update ignore t1_temp set c1 = 20 WHERE c1 = 140 ;
-update ignore t2_temp set c1 = 20 WHERE c1 = 140 ;
-update ignore t3_temp set c1 = 20 WHERE c1 = 140 ;
-update ignore t4_temp set c1 = 20 WHERE c1 = 140 ;
-SELECT count(*) FROM t1_temp WHERE c1 = 140;
-count(*)
-1
-SELECT count(*) FROM t2_temp WHERE c1 = 140;
-count(*)
-1
-SELECT count(*) FROM t3_temp WHERE c1 = 140;
-count(*)
-1
-SELECT count(*) FROM t4_temp WHERE c1 = 140;
-count(*)
-1
-ALTER TABLE t1_temp ADD COLUMN c10 int default 99 ,
-ADD COLUMN c11 varchar(100) default 'test';
-ALTER TABLE t1_temp DROP PRIMARY KEY;
-ALTER TABLE t1_temp ADD PRIMARY KEY (c1);
-INSERT INTO t1_temp (c1,c2,c3,c4,c5,c6,c7,c8,c9) VALUES (-1,-1,'a','a','a','a','a',NOW(),100.55);
-SELECT c1,c2,c3,c4,c5,c6,c7,c9,c10,c11 FROM t1_temp WHERE c1 < 0;
-c1 c2 c3 c4 c5 c6 c7 c9 c10 c11
--1 -1 a a a a a 100.550 99 test
-SELECT count(*) FROM t1_temp WHERE c10 = 99 and c11 like 'test';
-count(*)
-27
-INSERT INTO t1_temp (c1,c2,c3,c4,c5,c6,c7,c8,c9) VALUES (-1,-1,'a','a','a','a','a',NOW(),100.55)
-ON DUPLICATE KEY UPDATE c1=-2,c2=-2;
-SELECT c1,c2,c3,c4,c5,c6,c7,c9,c10,c11 FROM t1_temp WHERE c1 < 0;
-c1 c2 c3 c4 c5 c6 c7 c9 c10 c11
--2 -2 a a a a a 100.550 99 test
-DROP TABLE t1_1 ,t2_1 ,t3_1,t4_1;
-disconnect con1;
-connection con2;
-DROP TABLE t1_2 ,t2_2 ,t3_2,t4_2;
-disconnect con2;
-connection default;
-connect con1,localhost,root,,;
-connect con2,localhost,root,,;
-connection con1;
-call populate_tables('_1');;
-connection con2;
-call populate_tables('_2');;
-"#connection 1 - verify tables"
-connection con1;
-SELECT count(*) FROM t1_1;
-count(*)
-36
-SELECT count(*) FROM t2_1;
-count(*)
-36
-SELECT count(*) FROM t3_1;
-count(*)
-34
-SELECT count(*) FROM t4_1;
-count(*)
-32
-SELECT c1 FROM t1_1;
-c1
-5
-6
-7
-8
-9
-10
-11
-12
-13
-14
-15
-16
-17
-18
-19
-20
-101
-102
-103
-104
-105
-106
-107
-108
-109
-110
-111
-112
-113
-114
-115
-116
-117
-118
-119
-120
-SELECT c1 FROM t2_1;
-c1
-5
-6
-7
-8
-9
-10
-11
-12
-13
-14
-15
-16
-17
-18
-19
-20
-101
-102
-103
-104
-105
-106
-107
-108
-109
-110
-111
-112
-113
-114
-115
-116
-117
-118
-119
-120
-SELECT c1 FROM t3_1;
-c1
-5
-6
-7
-8
-9
-10
-13
-14
-15
-16
-17
-18
-19
-20
-101
-102
-103
-104
-105
-106
-107
-108
-109
-110
-111
-112
-113
-114
-115
-116
-117
-118
-119
-120
-SELECT c1 FROM t4_1;
-c1
-5
-6
-7
-8
-9
-10
-15
-16
-17
-18
-19
-20
-101
-102
-103
-104
-105
-106
-107
-108
-109
-110
-111
-112
-113
-114
-115
-116
-117
-118
-119
-120
-SELECT count(*) FROM t1_temp;
-count(*)
-26
-SELECT count(*) FROM t2_temp;
-count(*)
-26
-SELECT count(*) FROM t3_temp;
-count(*)
-24
-SELECT count(*) FROM t4_temp;
-count(*)
-22
-SELECT c1 FROM t1_temp;
-c1
-5
-6
-7
-8
-9
-10
-11
-12
-13
-14
-15
-16
-17
-18
-19
-20
-122
-124
-126
-128
-130
-132
-134
-136
-138
-140
-SELECT c1 FROM t2_temp;
-c1
-5
-6
-7
-8
-9
-10
-11
-12
-13
-14
-15
-16
-17
-18
-19
-20
-122
-124
-126
-128
-130
-132
-134
-136
-138
-140
-SELECT c1 FROM t3_temp;
-c1
-5
-6
-7
-8
-9
-10
-13
-14
-15
-16
-17
-18
-19
-20
-122
-124
-126
-128
-130
-132
-134
-136
-138
-140
-SELECT c1 FROM t4_temp;
-c1
-5
-6
-7
-8
-9
-10
-15
-16
-17
-18
-19
-20
-122
-124
-126
-128
-130
-132
-134
-136
-138
-140
-DROP TABLE t1_1 ,t2_1 ,t3_1,t4_1;
-disconnect con1;
-"#connection 2 - verify tables"
-connection con2;
-SELECT count(*) FROM t1_2;
-count(*)
-36
-SELECT count(*) FROM t2_2;
-count(*)
-36
-SELECT count(*) FROM t3_2;
-count(*)
-34
-SELECT count(*) FROM t4_2;
-count(*)
-32
-SELECT c1 FROM t1_2;
-c1
-5
-6
-7
-8
-9
-10
-11
-12
-13
-14
-15
-16
-17
-18
-19
-20
-101
-102
-103
-104
-105
-106
-107
-108
-109
-110
-111
-112
-113
-114
-115
-116
-117
-118
-119
-120
-SELECT c1 FROM t2_2;
-c1
-5
-6
-7
-8
-9
-10
-11
-12
-13
-14
-15
-16
-17
-18
-19
-20
-101
-102
-103
-104
-105
-106
-107
-108
-109
-110
-111
-112
-113
-114
-115
-116
-117
-118
-119
-120
-SELECT c1 FROM t3_2;
-c1
-5
-6
-7
-8
-9
-10
-13
-14
-15
-16
-17
-18
-19
-20
-101
-102
-103
-104
-105
-106
-107
-108
-109
-110
-111
-112
-113
-114
-115
-116
-117
-118
-119
-120
-SELECT c1 FROM t4_2;
-c1
-5
-6
-7
-8
-9
-10
-15
-16
-17
-18
-19
-20
-101
-102
-103
-104
-105
-106
-107
-108
-109
-110
-111
-112
-113
-114
-115
-116
-117
-118
-119
-120
-SELECT count(*) FROM t1_temp;
-count(*)
-26
-SELECT count(*) FROM t2_temp;
-count(*)
-26
-SELECT count(*) FROM t3_temp;
-count(*)
-24
-SELECT count(*) FROM t4_temp;
-count(*)
-22
-SELECT c1 FROM t1_temp;
-c1
-5
-6
-7
-8
-9
-10
-11
-12
-13
-14
-15
-16
-17
-18
-19
-20
-122
-124
-126
-128
-130
-132
-134
-136
-138
-140
-SELECT c1 FROM t2_temp;
-c1
-5
-6
-7
-8
-9
-10
-11
-12
-13
-14
-15
-16
-17
-18
-19
-20
-122
-124
-126
-128
-130
-132
-134
-136
-138
-140
-SELECT c1 FROM t3_temp;
-c1
-5
-6
-7
-8
-9
-10
-13
-14
-15
-16
-17
-18
-19
-20
-122
-124
-126
-128
-130
-132
-134
-136
-138
-140
-SELECT c1 FROM t4_temp;
-c1
-5
-6
-7
-8
-9
-10
-15
-16
-17
-18
-19
-20
-122
-124
-126
-128
-130
-132
-134
-136
-138
-140
-DROP TABLE t1_2 ,t2_2 ,t3_2,t4_2;
-disconnect con2;
-connection default;
-connect con1,localhost,root,,;
-connect con2,localhost,root,,;
-connection con1;
-call populate_tables('_1');;
-connection con2;
-call populate_tables('_2');;
-"#connection 1 - verify tables"
-connection con1;
-SELECT count(*) FROM t1_1;
-count(*)
-36
-SELECT count(*) FROM t2_1;
-count(*)
-36
-SELECT count(*) FROM t3_1;
-count(*)
-34
-SELECT count(*) FROM t4_1;
-count(*)
-32
-SELECT c1 FROM t1_1;
-c1
-5
-6
-7
-8
-9
-10
-11
-12
-13
-14
-15
-16
-17
-18
-19
-20
-101
-102
-103
-104
-105
-106
-107
-108
-109
-110
-111
-112
-113
-114
-115
-116
-117
-118
-119
-120
-SELECT c1 FROM t2_1;
-c1
-5
-6
-7
-8
-9
-10
-11
-12
-13
-14
-15
-16
-17
-18
-19
-20
-101
-102
-103
-104
-105
-106
-107
-108
-109
-110
-111
-112
-113
-114
-115
-116
-117
-118
-119
-120
-SELECT c1 FROM t3_1;
-c1
-5
-6
-7
-8
-9
-10
-13
-14
-15
-16
-17
-18
-19
-20
-101
-102
-103
-104
-105
-106
-107
-108
-109
-110
-111
-112
-113
-114
-115
-116
-117
-118
-119
-120
-SELECT c1 FROM t4_1;
-c1
-5
-6
-7
-8
-9
-10
-15
-16
-17
-18
-19
-20
-101
-102
-103
-104
-105
-106
-107
-108
-109
-110
-111
-112
-113
-114
-115
-116
-117
-118
-119
-120
-SELECT count(*) FROM t1_temp;
-count(*)
-26
-SELECT count(*) FROM t2_temp;
-count(*)
-26
-SELECT count(*) FROM t3_temp;
-count(*)
-24
-SELECT count(*) FROM t4_temp;
-count(*)
-22
-SELECT c1 FROM t1_temp;
-c1
-5
-6
-7
-8
-9
-10
-11
-12
-13
-14
-15
-16
-17
-18
-19
-20
-122
-124
-126
-128
-130
-132
-134
-136
-138
-140
-SELECT c1 FROM t2_temp;
-c1
-5
-6
-7
-8
-9
-10
-11
-12
-13
-14
-15
-16
-17
-18
-19
-20
-122
-124
-126
-128
-130
-132
-134
-136
-138
-140
-SELECT c1 FROM t3_temp;
-c1
-5
-6
-7
-8
-9
-10
-13
-14
-15
-16
-17
-18
-19
-20
-122
-124
-126
-128
-130
-132
-134
-136
-138
-140
-SELECT c1 FROM t4_temp;
-c1
-5
-6
-7
-8
-9
-10
-15
-16
-17
-18
-19
-20
-122
-124
-126
-128
-130
-132
-134
-136
-138
-140
-DROP TABLE t1_1 ,t2_1 ,t3_1,t4_1;
-disconnect con1;
-"#connection 2 - verify tables"
-connection con2;
-SELECT count(*) FROM t1_2;
-count(*)
-36
-SELECT count(*) FROM t2_2;
-count(*)
-36
-SELECT count(*) FROM t3_2;
-count(*)
-34
-SELECT count(*) FROM t4_2;
-count(*)
-32
-SELECT c1 FROM t1_2;
-c1
-5
-6
-7
-8
-9
-10
-11
-12
-13
-14
-15
-16
-17
-18
-19
-20
-101
-102
-103
-104
-105
-106
-107
-108
-109
-110
-111
-112
-113
-114
-115
-116
-117
-118
-119
-120
-SELECT c1 FROM t2_2;
-c1
-5
-6
-7
-8
-9
-10
-11
-12
-13
-14
-15
-16
-17
-18
-19
-20
-101
-102
-103
-104
-105
-106
-107
-108
-109
-110
-111
-112
-113
-114
-115
-116
-117
-118
-119
-120
-SELECT c1 FROM t3_2;
-c1
-5
-6
-7
-8
-9
-10
-13
-14
-15
-16
-17
-18
-19
-20
-101
-102
-103
-104
-105
-106
-107
-108
-109
-110
-111
-112
-113
-114
-115
-116
-117
-118
-119
-120
-SELECT c1 FROM t4_2;
-c1
-5
-6
-7
-8
-9
-10
-15
-16
-17
-18
-19
-20
-101
-102
-103
-104
-105
-106
-107
-108
-109
-110
-111
-112
-113
-114
-115
-116
-117
-118
-119
-120
-SELECT count(*) FROM t1_temp;
-count(*)
-26
-SELECT count(*) FROM t2_temp;
-count(*)
-26
-SELECT count(*) FROM t3_temp;
-count(*)
-24
-SELECT count(*) FROM t4_temp;
-count(*)
-22
-SELECT c1 FROM t1_temp;
-c1
-5
-6
-7
-8
-9
-10
-11
-12
-13
-14
-15
-16
-17
-18
-19
-20
-122
-124
-126
-128
-130
-132
-134
-136
-138
-140
-SELECT c1 FROM t2_temp;
-c1
-5
-6
-7
-8
-9
-10
-11
-12
-13
-14
-15
-16
-17
-18
-19
-20
-122
-124
-126
-128
-130
-132
-134
-136
-138
-140
-SELECT c1 FROM t3_temp;
-c1
-5
-6
-7
-8
-9
-10
-13
-14
-15
-16
-17
-18
-19
-20
-122
-124
-126
-128
-130
-132
-134
-136
-138
-140
-SELECT c1 FROM t4_temp;
-c1
-5
-6
-7
-8
-9
-10
-15
-16
-17
-18
-19
-20
-122
-124
-126
-128
-130
-132
-134
-136
-138
-140
-DROP TABLE t1_2 ,t2_2 ,t3_2,t4_2;
-disconnect con2;
-connection default;
-DROP PROCEDURE populate_tables;
diff --git a/mysql-test/suite/innodb_zip/t/create_options.test b/mysql-test/suite/innodb_zip/t/create_options.test
index 1a3dbdff90a..86ef141cae8 100644
--- a/mysql-test/suite/innodb_zip/t/create_options.test
+++ b/mysql-test/suite/innodb_zip/t/create_options.test
@@ -63,10 +63,11 @@ SET default_storage_engine=InnoDB;
--disable_query_log
# These values can change during the test
+LET $innodb_file_format_orig=`select @@innodb_file_format`;
LET $innodb_file_per_table_orig=`select @@innodb_file_per_table`;
-LET $innodb_strict_mode_orig=`select @@session.innodb_strict_mode`;
--enable_query_log
+SET GLOBAL innodb_file_format=`Barracuda`;
SET GLOBAL innodb_file_per_table=ON;
# The first half of these tests are with strict mode ON.
@@ -242,8 +243,9 @@ SHOW WARNINGS;
--error ER_ILLEGAL_HA_CREATE_OPTION
ALTER TABLE t1 ROW_FORMAT=COMPRESSED;
SHOW WARNINGS;
---error 1478
+--error ER_ILLEGAL_HA_CREATE_OPTION
ALTER TABLE t1 ROW_FORMAT=DYNAMIC;
+SHOW WARNINGS;
SET GLOBAL innodb_file_format=Barracuda;
DROP TABLE t1;
CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4;
@@ -257,7 +259,7 @@ ALTER TABLE t1 ADD COLUMN f2 INT;
SHOW WARNINGS;
SET GLOBAL innodb_file_format=Barracuda;
---echo # Test 8) StrictMode=ON, Make sure ROW_FORMAT= COMPRESSED & DYNAMIC and
+--echo # Test 8) StrictMode=ON, Make sure ROW_FORMAT=COMPRESSED
--echo # and a valid non-zero KEY_BLOCK_SIZE are rejected with
--echo # innodb_file_per_table=OFF and that they can be set to default
--echo # values during strict mode.
@@ -269,8 +271,10 @@ SHOW WARNINGS;
--error ER_ILLEGAL_HA,1005
CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPRESSED;
SHOW WARNINGS;
---error 1005
CREATE TABLE t1 ( i INT ) ROW_FORMAT=DYNAMIC;
+SHOW WARNINGS;
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
+DROP TABLE t1;
CREATE TABLE t1 ( i INT ) ROW_FORMAT=REDUNDANT;
SHOW WARNINGS;
SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
@@ -287,8 +291,9 @@ SHOW WARNINGS;
--error ER_ILLEGAL_HA_CREATE_OPTION
ALTER TABLE t1 ROW_FORMAT=COMPRESSED;
SHOW WARNINGS;
---error 1478
ALTER TABLE t1 ROW_FORMAT=DYNAMIC;
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
+SHOW WARNINGS;
ALTER TABLE t1 ROW_FORMAT=COMPACT;
SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
ALTER TABLE t1 ROW_FORMAT=REDUNDANT;
@@ -522,7 +527,6 @@ SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE
DROP TABLE t1;
--disable_query_log
+EVAL SET GLOBAL innodb_file_format=$innodb_file_format_orig;
EVAL SET GLOBAL innodb_file_per_table=$innodb_file_per_table_orig;
-EVAL SET SESSION innodb_strict_mode=$innodb_strict_mode_orig;
--enable_query_log
-
diff --git a/mysql-test/suite/innodb_zip/t/disabled.def b/mysql-test/suite/innodb_zip/t/disabled.def
deleted file mode 100644
index 02adb097c9d..00000000000
--- a/mysql-test/suite/innodb_zip/t/disabled.def
+++ /dev/null
@@ -1,14 +0,0 @@
-##############################################################################
-#
-# List the test cases that are to be disabled temporarily.
-#
-# Separate the test case name and the comment with ':'.
-#
-# <testcasename> : BUG#<xxxx> <date disabled> <disabler> <comment>
-#
-# Do not use any TAB characters for whitespace.
-#
-##############################################################################
-
-wl6560 : Very long, timeout
-
diff --git a/mysql-test/suite/innodb_zip/t/innochecksum.opt b/mysql-test/suite/innodb_zip/t/innochecksum.opt
new file mode 100644
index 00000000000..ac26eca328c
--- /dev/null
+++ b/mysql-test/suite/innodb_zip/t/innochecksum.opt
@@ -0,0 +1 @@
+--skip-innodb-doublewrite
diff --git a/mysql-test/suite/innodb_zip/t/innochecksum.test b/mysql-test/suite/innodb_zip/t/innochecksum.test
index 3ef311ed154..0403251bf64 100644
--- a/mysql-test/suite/innodb_zip/t/innochecksum.test
+++ b/mysql-test/suite/innodb_zip/t/innochecksum.test
@@ -17,8 +17,6 @@ let SEARCH_FILE= $MYSQLTEST_VARDIR/log/my_restart.err;
call mtr.add_suppression("InnoDB: Unable to read tablespace .* page no .* into the buffer pool after 100 attempts");
call mtr.add_suppression("InnoDB: Warning: database page corruption or a failed");
-SET GLOBAL innodb_file_per_table=on;
-
CREATE TABLE tab1(c1 INT PRIMARY KEY,c2 VARCHAR(20)) ENGINE=InnoDB;
CREATE INDEX idx1 ON tab1(c2(10));
INSERT INTO tab1 VALUES(1, 'Innochecksum InnoDB1');
@@ -163,7 +161,7 @@ let SEARCH_PATTERN= Error while setting value \'no\' to \'strict-check\';
--exec $INNOCHECKSUM --strict-check=innodb $MYSQLD_DATADIR/test/tab1.ibd
--echo # start the server with innodb_checksum_algorithm=InnoDB
---let restart_options= : --innodb_checksum_algorithm=innodb
+--let $restart_parameters= --innodb_checksum_algorithm=innodb
--source include/start_mysqld.inc
INSERT INTO tab1 VALUES(2, 'Innochecksum CRC32');
@@ -181,7 +179,7 @@ SELECT c1,c2 FROM tab1 order by c1,c2;
--exec $INNOCHECKSUM --strict-check=none $MYSQLD_DATADIR/test/t1.ibd
--echo # Start the server with checksum algorithm=none
---let restart_options= : --innodb_checksum_algorithm=none
+--let $restart_parameters= --innodb_checksum_algorithm=none
--source include/start_mysqld.inc
INSERT INTO tab1 VALUES(3, 'Innochecksum None');
@@ -195,7 +193,7 @@ DROP TABLE t1;
--exec $INNOCHECKSUM --no-check --write=crc32 $MYSQLD_DATADIR/test/tab1.ibd
--echo # Restart the DB server with innodb_checksum_algorithm=crc32
---let restart_options= : --innodb_checksum_algorithm=crc32 --innodb_file_per_table=on
+--let $restart_parameters= --innodb_checksum_algorithm=crc32
--source include/start_mysqld.inc
SELECT * FROM tab1;
@@ -209,7 +207,7 @@ SELECT c1,c2 FROM tab1 order by c1,c2;
--exec $INNOCHECKSUM --no-check --write=InnoDB $MYSQLD_DATADIR/test/tab1.ibd
--echo # Restart the DB server with innodb_checksum_algorithm=InnoDB
---let restart_options= : --innodb_checksum_algorithm=innodb --innodb_file_per_table=on
+--let $restart_parameters= --innodb_checksum_algorithm=innodb
--source include/start_mysqld.inc
DELETE FROM tab1 where c1=2;
@@ -236,8 +234,7 @@ let SEARCH_PATTERN=Error while setting value \'crc23\' to \'write\';
--remove_file $SEARCH_FILE
# Cleanup
---echo # Restart the server
+--let $restart_parameters=
--source include/start_mysqld.inc
DROP TABLE tab1;
-SET GLOBAL innodb_file_per_table=default;
diff --git a/mysql-test/suite/innodb_zip/t/innochecksum_2.opt b/mysql-test/suite/innodb_zip/t/innochecksum_2.opt
new file mode 100644
index 00000000000..ac26eca328c
--- /dev/null
+++ b/mysql-test/suite/innodb_zip/t/innochecksum_2.opt
@@ -0,0 +1 @@
+--skip-innodb-doublewrite
diff --git a/mysql-test/suite/innodb_zip/t/innochecksum_2.test b/mysql-test/suite/innodb_zip/t/innochecksum_2.test
index a290a9fc449..7f4ad336805 100644
--- a/mysql-test/suite/innodb_zip/t/innochecksum_2.test
+++ b/mysql-test/suite/innodb_zip/t/innochecksum_2.test
@@ -4,8 +4,7 @@
--source include/have_innodb.inc
--source include/have_innodb_zip.inc
--source include/have_debug.inc
-# Valgrind would complain about memory leaks when we crash on purpose.
---source include/not_valgrind.inc
+--source include/no_valgrind_without_big.inc
# Avoid CrashReporter popup on Mac.
--source include/not_crashrep.inc
diff --git a/mysql-test/suite/innodb_zip/t/innochecksum_3.test b/mysql-test/suite/innodb_zip/t/innochecksum_3.test
index 60c4b167d9a..7895510b335 100644
--- a/mysql-test/suite/innodb_zip/t/innochecksum_3.test
+++ b/mysql-test/suite/innodb_zip/t/innochecksum_3.test
@@ -4,8 +4,7 @@
--source include/have_innodb.inc
--source include/have_innodb_zip.inc
-# Valgrind would complain about memory leaks when we crash on purpose.
---source include/not_valgrind.inc
+--source include/no_valgrind_without_big.inc
# Embedded server does not support crashing.
--source include/not_embedded.inc
@@ -19,8 +18,6 @@ let MYSQLD_DATADIR= `SELECT @@datadir`;
let SEARCH_FILE= $MYSQLTEST_VARDIR/log/my_restart.err;
call mtr.add_suppression("InnoDB: Unable to read tablespace .* page no .* into the buffer pool after 100 attempts");
-SET GLOBAL innodb_file_per_table=on;
-
--echo [1]: Further Test are for rewrite checksum (innodb|crc32|none) for all ibd file & start the server.
CREATE TABLE tab1 (pk INTEGER NOT NULL PRIMARY KEY,
@@ -78,7 +75,7 @@ foreach (glob("$ENV{MYSQLD_DATADIR}/*/*.ibd")) {
EOF
--echo : start the server with innodb_checksum_algorithm=strict_innodb
---let restart_options= : --innodb_checksum_algorithm=strict_innodb --default_storage_engine=InnoDB
+--let $restart_parameters= --innodb_checksum_algorithm=strict_innodb
--source include/start_mysqld.inc
INSERT INTO tab1 (pk, linestring_key, linestring_nokey)
@@ -118,7 +115,7 @@ foreach (glob("$ENV{MYSQLD_DATADIR}/*/*.ibd")) {
EOF
--echo # start the server with innodb_checksum_algorithm=strict_crc32
---let restart_options= : --innodb_checksum_algorithm=strict_crc32 --default_storage_engine=InnoDB
+--let $restart_parameters= --innodb_checksum_algorithm=strict_crc32
--source include/start_mysqld.inc
# check the table status is GOOD with DML
@@ -163,7 +160,7 @@ foreach (glob("$ENV{MYSQLD_DATADIR}/*/*.ibd")) {
}
EOF
---let $restart_parameters = --innodb_checksum_algorithm=strict_none --default_storage_engine=InnoDB
+--let $restart_parameters= --innodb_checksum_algorithm=strict_none
--source include/start_mysqld.inc
--let $restart_parameters=
# check the table status is GOOD with DML
@@ -403,9 +400,6 @@ let SEARCH_PATTERN= Incorrect unsigned integer value: '18446744073709551616';
--remove_file $SEARCH_FILE
# Cleanup
---echo # Restart the server
--source include/start_mysqld.inc
-DROP TABLE tab1;
-DROP TABLE tab2;
-SET GLOBAL innodb_file_per_table=default;
+DROP TABLE tab1,tab2;
diff --git a/mysql-test/suite/innodb_zip/t/innodb-create-options.test b/mysql-test/suite/innodb_zip/t/innodb-create-options.test
deleted file mode 100644
index aeb22514bf6..00000000000
--- a/mysql-test/suite/innodb_zip/t/innodb-create-options.test
+++ /dev/null
@@ -1,561 +0,0 @@
---source include/have_innodb.inc
-# Tests for various combinations of ROW_FORMAT and KEY_BLOCK_SIZE
-# Related bugs;
-# Bug#54679: ALTER TABLE causes compressed row_format to revert to compact
-# Bug#56628: ALTER TABLE .. KEY_BLOCK_SIZE=0 produces untrue warning or unnecessary error
-# Bug#56632: ALTER TABLE implicitly changes ROW_FORMAT to COMPRESSED
-# Rules for interpreting CREATE_OPTIONS
-# 1) Create options on an ALTER are added to the options on the
-# previous CREATE or ALTER statements.
-# 2) KEY_BLOCK_SIZE=0 is considered a unspecified value.
-# If the current ROW_FORMAT has explicitly been set to COMPRESSED,
-# InnoDB will use a default value of 8. Otherwise KEY_BLOCK_SIZE
-# will not be used.
-# 3) ROW_FORMAT=DEFAULT allows InnoDB to choose its own default, COMPACT.
-# 4) ROW_FORMAT=DEFAULT and KEY_BLOCK_SIZE=0 can be used at any time to
-# unset or erase the values persisted in the MySQL dictionary and
-# by SHOW CTREATE TABLE.
-# 5) When incompatible values for ROW_FORMAT and KEY_BLOCK_SIZE are
-# both explicitly given, the ROW_FORMAT is always used in non-strict
-# mode.
-# 6) InnoDB will automatically convert a table to COMPRESSED only if a
-# valid non-zero KEY_BLOCK_SIZE has been given and ROW_FORMAT=DEFAULT
-# or has not been used on a previous CREATE TABLE or ALTER TABLE.
-# 7) InnoDB strict mode is designed to prevent incompatible create
-# options from being used together.
-# 8) The non-strict behavior is intended to permit you to import a
-# mysqldump file into a database that does not support compressed
-# tables, even if the source database contained compressed tables.
-# All invalid values and/or incompatible combinations of ROW_FORMAT
-# and KEY_BLOCK_SIZE are automatically corrected
-#
-# *** innodb_strict_mode=ON ***
-# 1) Valid ROW_FORMATs are COMPRESSED, COMPACT, DEFAULT, DYNAMIC
-# & REDUNDANT. All others are rejected.
-# 2) Valid KEY_BLOCK_SIZEs are 0,1,2,4,8,16. All others are rejected.
-# 3) KEY_BLOCK_SIZE=0 can be used to set it to 'unspecified'.
-# 4) KEY_BLOCK_SIZE=1,2,4,8 & 16 are incompatible with COMPACT, DYNAMIC &
-# REDUNDANT.
-# 5) KEY_BLOCK_SIZE=1,2,4,8 & 16 as well as ROW_FORMAT=COMPRESSED and
-# ROW_FORMAT=DYNAMIC are incompatible with innodb_file_format=Antelope
-# and innodb_file_per_table=OFF
-# 6) KEY_BLOCK_SIZE on an ALTER must occur with ROW_FORMAT=COMPRESSED
-# or ROW_FORMAT=DEFAULT if the ROW_FORMAT was previously specified
-# as COMPACT, DYNAMIC or REDUNDANT.
-# 7) KEY_BLOCK_SIZE on an ALTER can occur without a ROW_FORMAT if the
-# previous ROW_FORMAT was DEFAULT, COMPRESSED, or unspecified.
-#
-# *** innodb_strict_mode=OFF ***
-# 1. Ignore a bad KEY_BLOCK_SIZE, defaulting it to 8.
-# 2. Ignore a bad ROW_FORMAT, defaulting to COMPACT.
-# 3. Ignore a valid KEY_BLOCK_SIZE when an incompatible but valid
-# ROW_FORMAT is specified.
-# 4. If innodb_file_format=Antelope or innodb_file_per_table=OFF
-# it will ignore ROW_FORMAT=COMPRESSED or DYNAMIC and it will
-# ignore all non-zero KEY_BLOCK_SIZEs.
-#
-# See InnoDB documentation page "SQL Compression Syntax Warnings and Errors"
-# This test case does not try to create tables with KEY_BLOCK_SIZE > 4
-# since they are rejected for InnoDB page sizes of 8k and 16k.
-# See innodb_16k and innodb_8k for those tests.
-
--- source include/have_innodb.inc
-SET default_storage_engine=InnoDB;
-
---disable_query_log
-# These values can change during the test
-LET $innodb_file_format_orig=`select @@innodb_file_format`;
-LET $innodb_file_per_table_orig=`select @@innodb_file_per_table`;
-LET $innodb_strict_mode_orig=`select @@session.innodb_strict_mode`;
---enable_query_log
-
-SET GLOBAL innodb_file_format=`Barracuda`;
-SET GLOBAL innodb_file_per_table=ON;
-
-# The first half of these tests are with strict mode ON.
-SET SESSION innodb_strict_mode = ON;
-
---echo # Test 1) StrictMode=ON, CREATE and ALTER with each ROW_FORMAT & KEY_BLOCK_SIZE=0
---echo # KEY_BLOCK_SIZE=0 means 'no KEY_BLOCK_SIZE is specified'
-DROP TABLE IF EXISTS t1;
---echo # 'FIXED' is sent to InnoDB since it is used by MyISAM.
---echo # But it is an invalid mode in InnoDB
---replace_regex / - .*[0-9]*[)]/)/
---error ER_CANT_CREATE_TABLE
-CREATE TABLE t1 ( i INT ) ROW_FORMAT=FIXED;
---replace_regex / - .*[0-9]*[)]/)/
-SHOW WARNINGS;
-CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=0;
-SHOW WARNINGS;
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
-ALTER TABLE t1 ROW_FORMAT=COMPACT KEY_BLOCK_SIZE=0;
-SHOW WARNINGS;
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
-ALTER TABLE t1 ROW_FORMAT=DYNAMIC KEY_BLOCK_SIZE=0;
-SHOW WARNINGS;
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
-ALTER TABLE t1 ROW_FORMAT=REDUNDANT KEY_BLOCK_SIZE=0;
-SHOW WARNINGS;
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
-ALTER TABLE t1 ROW_FORMAT=DEFAULT KEY_BLOCK_SIZE=0;
-SHOW WARNINGS;
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
---error ER_ILLEGAL_HA_CREATE_OPTION
-ALTER TABLE t1 ROW_FORMAT=FIXED KEY_BLOCK_SIZE=0;
-SHOW WARNINGS;
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
-
-
-
---echo # Test 2) StrictMode=ON, CREATE with each ROW_FORMAT & a valid non-zero KEY_BLOCK_SIZE
---echo # KEY_BLOCK_SIZE is incompatible with COMPACT, REDUNDANT, & DYNAMIC
-DROP TABLE IF EXISTS t1;
---replace_regex / - .*[0-9]*[)]/)/
---error ER_CANT_CREATE_TABLE
-CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPACT KEY_BLOCK_SIZE=1;
---replace_regex / - .*[0-9]*[)]/)/
-SHOW WARNINGS;
---replace_regex / - .*[0-9]*[)]/)/
---error ER_CANT_CREATE_TABLE
-CREATE TABLE t1 ( i INT ) ROW_FORMAT=REDUNDANT KEY_BLOCK_SIZE=2;
---replace_regex / - .*[0-9]*[)]/)/
-SHOW WARNINGS;
---replace_regex / - .*[0-9]*[)]/)/
---error ER_CANT_CREATE_TABLE
-CREATE TABLE t1 ( i INT ) ROW_FORMAT=DYNAMIC KEY_BLOCK_SIZE=4;
---replace_regex / - .*[0-9]*[)]/)/
-SHOW WARNINGS;
-CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=2;
-SHOW WARNINGS;
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
-ALTER TABLE t1 ADD COLUMN f1 INT;
-SHOW WARNINGS;
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
-DROP TABLE IF EXISTS t1;
-CREATE TABLE t1 ( i INT ) ROW_FORMAT=DEFAULT KEY_BLOCK_SIZE=1;
-SHOW WARNINGS;
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
-ALTER TABLE t1 ADD COLUMN f1 INT;
-SHOW WARNINGS;
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
-
-
---echo # Test 3) StrictMode=ON, ALTER with each ROW_FORMAT & a valid non-zero KEY_BLOCK_SIZE
-DROP TABLE IF EXISTS t1;
-CREATE TABLE t1 ( i INT );
---error ER_ILLEGAL_HA_CREATE_OPTION
-ALTER TABLE t1 ROW_FORMAT=FIXED KEY_BLOCK_SIZE=1;
-SHOW WARNINGS;
---error ER_ILLEGAL_HA_CREATE_OPTION
-ALTER TABLE t1 ROW_FORMAT=COMPACT KEY_BLOCK_SIZE=2;
-SHOW WARNINGS;
---error ER_ILLEGAL_HA_CREATE_OPTION
-ALTER TABLE t1 ROW_FORMAT=DYNAMIC KEY_BLOCK_SIZE=4;
-SHOW WARNINGS;
---error ER_ILLEGAL_HA_CREATE_OPTION
-ALTER TABLE t1 ROW_FORMAT=REDUNDANT KEY_BLOCK_SIZE=2;
-SHOW WARNINGS;
-ALTER TABLE t1 ROW_FORMAT=DEFAULT KEY_BLOCK_SIZE=1;
-SHOW WARNINGS;
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
-ALTER TABLE t1 ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1;
-SHOW WARNINGS;
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
-
-
---echo # Test 4) StrictMode=ON, CREATE with ROW_FORMAT=COMPACT, ALTER with a valid non-zero KEY_BLOCK_SIZE
-DROP TABLE IF EXISTS t1;
-CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPACT;
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
---error ER_ILLEGAL_HA_CREATE_OPTION
-ALTER TABLE t1 KEY_BLOCK_SIZE=2;
-SHOW WARNINGS;
-ALTER TABLE t1 ROW_FORMAT=REDUNDANT;
-SHOW WARNINGS;
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
---error ER_ILLEGAL_HA_CREATE_OPTION
-ALTER TABLE t1 KEY_BLOCK_SIZE=4;
-SHOW WARNINGS;
-ALTER TABLE t1 ROW_FORMAT=DYNAMIC;
-SHOW WARNINGS;
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
---error ER_ILLEGAL_HA_CREATE_OPTION
-ALTER TABLE t1 KEY_BLOCK_SIZE=2;
-SHOW WARNINGS;
-ALTER TABLE t1 ROW_FORMAT=COMPRESSED;
-SHOW WARNINGS;
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
-ALTER TABLE t1 KEY_BLOCK_SIZE=1;
-SHOW WARNINGS;
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
-DROP TABLE IF EXISTS t1;
-CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPACT;
-ALTER TABLE t1 ROW_FORMAT=DEFAULT KEY_BLOCK_SIZE=1;
-SHOW WARNINGS;
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
-
---echo # Test 5) StrictMode=ON, CREATE with a valid KEY_BLOCK_SIZE
---echo # ALTER with each ROW_FORMAT
-DROP TABLE IF EXISTS t1;
-CREATE TABLE t1 ( i INT ) KEY_BLOCK_SIZE=2;
-SHOW CREATE TABLE t1;
-ALTER TABLE t1 ADD COLUMN f1 INT;
-SHOW CREATE TABLE t1;
---error ER_ILLEGAL_HA_CREATE_OPTION
-ALTER TABLE t1 ROW_FORMAT=COMPACT;
-SHOW WARNINGS;
---error ER_ILLEGAL_HA_CREATE_OPTION
-ALTER TABLE t1 ROW_FORMAT=REDUNDANT;
-SHOW WARNINGS;
---error ER_ILLEGAL_HA_CREATE_OPTION
-ALTER TABLE t1 ROW_FORMAT=DYNAMIC;
-SHOW WARNINGS;
-ALTER TABLE t1 ROW_FORMAT=COMPRESSED;
-SHOW WARNINGS;
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
-ALTER TABLE t1 ROW_FORMAT=DEFAULT KEY_BLOCK_SIZE=0;
-SHOW WARNINGS;
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
-ALTER TABLE t1 ROW_FORMAT=COMPACT;
-SHOW WARNINGS;
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
-
---echo # Test 6) StrictMode=ON, CREATE with an invalid KEY_BLOCK_SIZE.
-DROP TABLE IF EXISTS t1;
---replace_regex / - .*[0-9]*[)]/)/
---error ER_CANT_CREATE_TABLE
-CREATE TABLE t1 ( i INT ) KEY_BLOCK_SIZE=9;
---replace_regex / - .*[0-9]*[)]/)/
-SHOW WARNINGS;
-
---echo # Test 7) StrictMode=ON, Make sure ROW_FORMAT= COMPRESSED & DYNAMIC and
---echo # and a valid non-zero KEY_BLOCK_SIZE are rejected with Antelope
---echo # and that they can be set to default values during strict mode.
-SET GLOBAL innodb_file_format=Antelope;
-DROP TABLE IF EXISTS t1;
---replace_regex / - .*[0-9]*[)]/)/
---error ER_CANT_CREATE_TABLE
-CREATE TABLE t1 ( i INT ) KEY_BLOCK_SIZE=4;
---replace_regex / - .*[0-9]*[)]/)/
-SHOW WARNINGS;
---replace_regex / - .*[0-9]*[)]/)/
---error ER_CANT_CREATE_TABLE
-CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPRESSED;
---replace_regex / - .*[0-9]*[)]/)/
-SHOW WARNINGS;
---replace_regex / - .*[0-9]*[)]/)/
---error ER_CANT_CREATE_TABLE
-CREATE TABLE t1 ( i INT ) ROW_FORMAT=DYNAMIC;
---replace_regex / - .*[0-9]*[)]/)/
-SHOW WARNINGS;
-CREATE TABLE t1 ( i INT ) ROW_FORMAT=REDUNDANT;
-SHOW WARNINGS;
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
-DROP TABLE IF EXISTS t1;
-CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPACT;
-SHOW WARNINGS;
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
-DROP TABLE IF EXISTS t1;
-CREATE TABLE t1 ( i INT ) ROW_FORMAT=DEFAULT;
-SHOW WARNINGS;
---error ER_ILLEGAL_HA_CREATE_OPTION
-ALTER TABLE t1 KEY_BLOCK_SIZE=2;
-SHOW WARNINGS;
---error ER_ILLEGAL_HA_CREATE_OPTION
-ALTER TABLE t1 ROW_FORMAT=COMPRESSED;
-SHOW WARNINGS;
---error ER_ILLEGAL_HA_CREATE_OPTION
-ALTER TABLE t1 ROW_FORMAT=DYNAMIC;
-SHOW WARNINGS;
-SET GLOBAL innodb_file_format=Barracuda;
-DROP TABLE IF EXISTS t1;
-CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4;
-SET GLOBAL innodb_file_format=Antelope;
-ALTER TABLE t1 ADD COLUMN f1 INT;
-SHOW CREATE TABLE t1;
-SHOW WARNINGS;
-ALTER TABLE t1 ROW_FORMAT=DEFAULT KEY_BLOCK_SIZE=0;
-SHOW WARNINGS;
-ALTER TABLE t1 ADD COLUMN f2 INT;
-SHOW WARNINGS;
-SET GLOBAL innodb_file_format=Barracuda;
-
---echo # Test 8) StrictMode=ON, Make sure ROW_FORMAT= COMPRESSED & DYNAMIC and
---echo # and a valid non-zero KEY_BLOCK_SIZE are rejected with
---echo # innodb_file_per_table=OFF and that they can be set to default
---echo # values during strict mode.
-SET GLOBAL innodb_file_per_table=OFF;
-DROP TABLE IF EXISTS t1;
---replace_regex / - .*[0-9]*[)]/)/
---error ER_CANT_CREATE_TABLE
-CREATE TABLE t1 ( i INT ) KEY_BLOCK_SIZE=1;
---replace_regex / - .*[0-9]*[)]/)/
-SHOW WARNINGS;
---replace_regex / - .*[0-9]*[)]/)/
---error ER_CANT_CREATE_TABLE
-CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPRESSED;
---replace_regex / - .*[0-9]*[)]/)/
-SHOW WARNINGS;
---replace_regex / - .*[0-9]*[)]/)/
---error ER_CANT_CREATE_TABLE
-CREATE TABLE t1 ( i INT ) ROW_FORMAT=DYNAMIC;
---replace_regex / - .*[0-9]*[)]/)/
-SHOW WARNINGS;
-CREATE TABLE t1 ( i INT ) ROW_FORMAT=REDUNDANT;
-SHOW WARNINGS;
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
-DROP TABLE IF EXISTS t1;
-CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPACT;
-SHOW WARNINGS;
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
-DROP TABLE IF EXISTS t1;
-CREATE TABLE t1 ( i INT ) ROW_FORMAT=DEFAULT;
-SHOW WARNINGS;
---error ER_ILLEGAL_HA_CREATE_OPTION
-ALTER TABLE t1 KEY_BLOCK_SIZE=1;
-SHOW WARNINGS;
---error ER_ILLEGAL_HA_CREATE_OPTION
-ALTER TABLE t1 ROW_FORMAT=COMPRESSED;
-SHOW WARNINGS;
---error ER_ILLEGAL_HA_CREATE_OPTION
-ALTER TABLE t1 ROW_FORMAT=DYNAMIC;
-SHOW WARNINGS;
-ALTER TABLE t1 ROW_FORMAT=COMPACT;
-SHOW WARNINGS;
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
-ALTER TABLE t1 ROW_FORMAT=REDUNDANT;
-SHOW WARNINGS;
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
-ALTER TABLE t1 ROW_FORMAT=DEFAULT;
-SHOW WARNINGS;
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
-SET GLOBAL innodb_file_per_table=ON;
-DROP TABLE IF EXISTS t1;
-CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4;
-SET GLOBAL innodb_file_per_table=OFF;
-ALTER TABLE t1 ADD COLUMN f1 INT;
-SHOW WARNINGS;
-ALTER TABLE t1 ROW_FORMAT=DEFAULT KEY_BLOCK_SIZE=0;
-SHOW WARNINGS;
-ALTER TABLE t1 ADD COLUMN f2 INT;
-SHOW WARNINGS;
-SET GLOBAL innodb_file_per_table=ON;
-
---echo ##################################################
-SET SESSION innodb_strict_mode = OFF;
-
---echo # Test 9) StrictMode=OFF, CREATE and ALTER with each ROW_FORMAT & KEY_BLOCK_SIZE=0
---echo # KEY_BLOCK_SIZE=0 means 'no KEY_BLOCK_SIZE is specified'
---echo # 'FIXED' is sent to InnoDB since it is used by MyISAM.
---echo # It is an invalid mode in InnoDB, use COMPACT
-DROP TABLE IF EXISTS t1;
-CREATE TABLE t1 ( i INT ) ROW_FORMAT=FIXED;
-SHOW WARNINGS;
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
-DROP TABLE IF EXISTS t1;
-CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=0;
-SHOW WARNINGS;
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
-ALTER TABLE t1 ROW_FORMAT=COMPACT KEY_BLOCK_SIZE=0;
-SHOW WARNINGS;
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
-ALTER TABLE t1 ROW_FORMAT=DYNAMIC KEY_BLOCK_SIZE=0;
-SHOW WARNINGS;
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
-ALTER TABLE t1 ROW_FORMAT=REDUNDANT KEY_BLOCK_SIZE=0;
-SHOW WARNINGS;
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
-ALTER TABLE t1 ROW_FORMAT=DEFAULT KEY_BLOCK_SIZE=0;
-SHOW WARNINGS;
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
-ALTER TABLE t1 ROW_FORMAT=FIXED KEY_BLOCK_SIZE=0;
-SHOW WARNINGS;
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
-
---echo # Test 10) StrictMode=OFF, CREATE with each ROW_FORMAT & a valid KEY_BLOCK_SIZE
---echo # KEY_BLOCK_SIZE is ignored with COMPACT, REDUNDANT, & DYNAMIC
-DROP TABLE IF EXISTS t1;
-CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPACT KEY_BLOCK_SIZE=1;
-SHOW WARNINGS;
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
-DROP TABLE IF EXISTS t1;
-CREATE TABLE t1 ( i INT ) ROW_FORMAT=REDUNDANT KEY_BLOCK_SIZE=2;
-SHOW WARNINGS;
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
-DROP TABLE IF EXISTS t1;
-CREATE TABLE t1 ( i INT ) ROW_FORMAT=DYNAMIC KEY_BLOCK_SIZE=4;
-SHOW WARNINGS;
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
-DROP TABLE IF EXISTS t1;
-CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=2;
-SHOW WARNINGS;
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
-ALTER TABLE t1 ADD COLUMN f1 INT;
-SHOW WARNINGS;
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
-DROP TABLE IF EXISTS t1;
-CREATE TABLE t1 ( i INT ) ROW_FORMAT=DEFAULT KEY_BLOCK_SIZE=1;
-SHOW WARNINGS;
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
-ALTER TABLE t1 ADD COLUMN f1 INT;
-SHOW WARNINGS;
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
-
-
---echo # Test 11) StrictMode=OFF, ALTER with each ROW_FORMAT & a valid KEY_BLOCK_SIZE
-DROP TABLE IF EXISTS t1;
-CREATE TABLE t1 ( i INT );
-ALTER TABLE t1 ROW_FORMAT=FIXED KEY_BLOCK_SIZE=1;
-SHOW WARNINGS;
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
-DROP TABLE IF EXISTS t1;
-CREATE TABLE t1 ( i INT );
-ALTER TABLE t1 ROW_FORMAT=COMPACT KEY_BLOCK_SIZE=2;
-SHOW WARNINGS;
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
-DROP TABLE IF EXISTS t1;
-CREATE TABLE t1 ( i INT );
-ALTER TABLE t1 ROW_FORMAT=DYNAMIC KEY_BLOCK_SIZE=4;
-SHOW WARNINGS;
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
-DROP TABLE IF EXISTS t1;
-CREATE TABLE t1 ( i INT );
-ALTER TABLE t1 ROW_FORMAT=REDUNDANT KEY_BLOCK_SIZE=2;
-SHOW WARNINGS;
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
-DROP TABLE IF EXISTS t1;
-CREATE TABLE t1 ( i INT );
-ALTER TABLE t1 ROW_FORMAT=DEFAULT KEY_BLOCK_SIZE=1;
-SHOW WARNINGS;
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
-ALTER TABLE t1 ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1;
-SHOW WARNINGS;
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
-
-
---echo # Test 12) StrictMode=OFF, CREATE with ROW_FORMAT=COMPACT, ALTER with a valid KEY_BLOCK_SIZE
-DROP TABLE IF EXISTS t1;
-CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPACT;
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
-ALTER TABLE t1 KEY_BLOCK_SIZE=2;
-SHOW WARNINGS;
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
-ALTER TABLE t1 ROW_FORMAT=REDUNDANT;
-SHOW WARNINGS;
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
-ALTER TABLE t1 ROW_FORMAT=DYNAMIC;
-SHOW WARNINGS;
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
-ALTER TABLE t1 ROW_FORMAT=COMPRESSED;
-SHOW WARNINGS;
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
-ALTER TABLE t1 KEY_BLOCK_SIZE=4;
-SHOW WARNINGS;
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
-DROP TABLE IF EXISTS t1;
-CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPACT;
-ALTER TABLE t1 ROW_FORMAT=DEFAULT KEY_BLOCK_SIZE=2;
-SHOW WARNINGS;
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
-
---echo # Test 13) StrictMode=OFF, CREATE with a valid KEY_BLOCK_SIZE
---echo # ALTER with each ROW_FORMAT
-DROP TABLE IF EXISTS t1;
-CREATE TABLE t1 ( i INT ) KEY_BLOCK_SIZE=1;
-SHOW WARNINGS;
-SHOW CREATE TABLE t1;
-ALTER TABLE t1 ADD COLUMN f1 INT;
-SHOW WARNINGS;
-SHOW CREATE TABLE t1;
-ALTER TABLE t1 ROW_FORMAT=COMPACT;
-SHOW WARNINGS;
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
-ALTER TABLE t1 ROW_FORMAT=REDUNDANT;
-SHOW WARNINGS;
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
-ALTER TABLE t1 ROW_FORMAT=DYNAMIC;
-SHOW WARNINGS;
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
-ALTER TABLE t1 ROW_FORMAT=COMPRESSED;
-SHOW WARNINGS;
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
-ALTER TABLE t1 ROW_FORMAT=DEFAULT KEY_BLOCK_SIZE=0;
-SHOW WARNINGS;
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
-ALTER TABLE t1 ROW_FORMAT=COMPACT;
-SHOW WARNINGS;
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
-
---echo # Test 14) StrictMode=OFF, CREATE with an invalid KEY_BLOCK_SIZE,
---echo # it defaults to half of the page size.
-DROP TABLE IF EXISTS t1;
-CREATE TABLE t1 ( i INT ) KEY_BLOCK_SIZE=15;
-SHOW WARNINGS;
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
-
---echo # Test 15) StrictMode=OFF, Make sure ROW_FORMAT= COMPRESSED & DYNAMIC and a
---echo valid KEY_BLOCK_SIZE are remembered but not used when ROW_FORMAT
---echo is reverted to Antelope and then used again when ROW_FORMAT=Barracuda.
-DROP TABLE IF EXISTS t1;
-CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1;
-SHOW WARNINGS;
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
-SET GLOBAL innodb_file_format=Antelope;
-ALTER TABLE t1 ADD COLUMN f1 INT;
-SHOW WARNINGS;
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
-SET GLOBAL innodb_file_format=Barracuda;
-ALTER TABLE t1 ADD COLUMN f2 INT;
-SHOW WARNINGS;
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
-DROP TABLE IF EXISTS t1;
-CREATE TABLE t1 ( i INT ) ROW_FORMAT=DYNAMIC;
-SHOW WARNINGS;
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
-SET GLOBAL innodb_file_format=Antelope;
-ALTER TABLE t1 ADD COLUMN f1 INT;
-SHOW WARNINGS;
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
-SET GLOBAL innodb_file_format=Barracuda;
-ALTER TABLE t1 ADD COLUMN f2 INT;
-SHOW WARNINGS;
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
-
---echo # Test 16) StrictMode=OFF, Make sure ROW_FORMAT= COMPRESSED & DYNAMIC and a
---echo valid KEY_BLOCK_SIZE are remembered but not used when innodb_file_per_table=OFF
---echo and then used again when innodb_file_per_table=ON.
-DROP TABLE IF EXISTS t1;
-CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=2;
-SHOW WARNINGS;
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
-SET GLOBAL innodb_file_per_table=OFF;
-ALTER TABLE t1 ADD COLUMN f1 INT;
-SHOW WARNINGS;
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
-SET GLOBAL innodb_file_per_table=ON;
-ALTER TABLE t1 ADD COLUMN f2 INT;
-SHOW WARNINGS;
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
-DROP TABLE IF EXISTS t1;
-CREATE TABLE t1 ( i INT ) ROW_FORMAT=DYNAMIC;
-SHOW WARNINGS;
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
-SET GLOBAL innodb_file_per_table=OFF;
-ALTER TABLE t1 ADD COLUMN f1 INT;
-SHOW WARNINGS;
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
-SET GLOBAL innodb_file_per_table=ON;
-ALTER TABLE t1 ADD COLUMN f2 INT;
-SHOW WARNINGS;
-SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
-
-
---echo # Cleanup
-DROP TABLE IF EXISTS t1;
-
---disable_query_log
-EVAL SET GLOBAL innodb_file_format=$innodb_file_format_orig;
-EVAL SET GLOBAL innodb_file_per_table=$innodb_file_per_table_orig;
-EVAL SET SESSION innodb_strict_mode=$innodb_strict_mode_orig;
---enable_query_log
-
diff --git a/mysql-test/suite/innodb_zip/t/innodb-zip.test b/mysql-test/suite/innodb_zip/t/innodb-zip.test
index 1c7c7c8c419..8a201cb37ae 100644
--- a/mysql-test/suite/innodb_zip/t/innodb-zip.test
+++ b/mysql-test/suite/innodb_zip/t/innodb-zip.test
@@ -1,10 +1,5 @@
-- source include/have_innodb.inc
-
---disable_warnings
-DROP DATABASE IF EXISTS mysqltest_innodb_zip;
---enable_warnings
-
CREATE DATABASE mysqltest_innodb_zip;
USE mysqltest_innodb_zip;
SELECT table_name, row_format, data_length, index_length
@@ -18,14 +13,13 @@ let $innodb_file_format_orig=`select @@innodb_file_format`;
let $innodb_file_format_max_orig=`select @@innodb_file_format_max`;
SET @save_innodb_stats_on_metadata=@@global.innodb_stats_on_metadata;
-
--let $query_i_s = SELECT table_schema, table_name, row_format, data_length, index_length FROM information_schema.tables WHERE engine='innodb' AND table_schema != 'mysql'
set session innodb_strict_mode=0;
set global innodb_file_per_table=off;
set global innodb_file_format=`0`;
SET @@global.innodb_stats_on_metadata=ON;
-
+
create table t0(a int primary key) engine=innodb row_format=compressed;
create table t00(a int primary key) engine=innodb
key_block_size=4 row_format=compressed;
@@ -280,21 +274,18 @@ show warnings;
create table t6 (id int primary key) engine = innodb row_format = compressed;
--replace_regex / - .*[0-9]*[)]/)/
show warnings;
---replace_regex / - .*[0-9]*[)]/)/
---error ER_CANT_CREATE_TABLE
create table t7 (id int primary key) engine = innodb row_format = dynamic;
---replace_regex / - .*[0-9]*[)]/)/
show warnings;
create table t8 (id int primary key) engine = innodb row_format = compact;
create table t9 (id int primary key) engine = innodb row_format = redundant;
--replace_result 16384 {valid} 8192 {valid} 4096 {valid}
--eval $query_i_s
-drop table t8, t9;
+drop table t7, t8, t9;
#test valid values with innodb_file_format unset
set global innodb_file_per_table = on;
-set global innodb_file_format = `0`;
+set global innodb_file_format = `0`;
--replace_regex / - .*[0-9]*[)]/)/
--error ER_CANT_CREATE_TABLE
@@ -369,6 +360,4 @@ eval SET GLOBAL innodb_file_format_max=$innodb_file_format_max_orig;
SET @@global.innodb_stats_on_metadata=@save_innodb_stats_on_metadata;
--enable_query_log
-USE test;
DROP DATABASE mysqltest_innodb_zip;
-
diff --git a/mysql-test/suite/innodb_zip/t/innodb_bug36169.test b/mysql-test/suite/innodb_zip/t/innodb_bug36169.test
index 1d82b95a602..93051d56639 100644
--- a/mysql-test/suite/innodb_zip/t/innodb_bug36169.test
+++ b/mysql-test/suite/innodb_zip/t/innodb_bug36169.test
@@ -6,11 +6,6 @@
call mtr.add_suppression("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.");
-let $file_format=`select @@innodb_file_format`;
-let $file_per_table=`select @@innodb_file_per_table`;
-SET GLOBAL innodb_file_format='Barracuda';
-SET GLOBAL innodb_file_per_table=ON;
-
#
# The following is copied from http://bugs.mysql.com/36169
# (http://bugs.mysql.com/file.php?id=9121)
@@ -1156,6 +1151,3 @@ DROP TABLE IF EXISTS table3;
DROP TABLE IF EXISTS table4;
DROP TABLE IF EXISTS table5;
DROP TABLE IF EXISTS table6;
-
-EVAL SET GLOBAL innodb_file_format=$file_format;
-EVAL SET GLOBAL innodb_file_per_table=$file_per_table;
diff --git a/mysql-test/suite/innodb_zip/t/innodb_bug36172.test b/mysql-test/suite/innodb_zip/t/innodb_bug36172.test
index 015f461e532..622e0c56b15 100644
--- a/mysql-test/suite/innodb_zip/t/innodb_bug36172.test
+++ b/mysql-test/suite/innodb_zip/t/innodb_bug36172.test
@@ -14,17 +14,9 @@ SET storage_engine=InnoDB;
-- disable_query_log
-- disable_result_log
-let $file_format=`select @@innodb_file_format`;
-let $file_per_table=`select @@innodb_file_per_table`;
-SET GLOBAL innodb_file_format='Barracuda';
-SET GLOBAL innodb_file_per_table=on;
-
-DROP TABLE IF EXISTS `table0`;
CREATE TABLE `table0` ( `col0` tinyint(1) DEFAULT NULL, `col1` tinyint(1) DEFAULT NULL, `col2` tinyint(4) DEFAULT NULL, `col3` date DEFAULT NULL, `col4` time DEFAULT NULL, `col5` set('test1','test2','test3') DEFAULT NULL, `col6` time DEFAULT NULL, `col7` text, `col8` decimal(10,0) DEFAULT NULL, `col9` set('test1','test2','test3') DEFAULT NULL, `col10` float DEFAULT NULL, `col11` double DEFAULT NULL, `col12` enum('test1','test2','test3') DEFAULT NULL, `col13` tinyblob, `col14` year(4) DEFAULT NULL, `col15` set('test1','test2','test3') DEFAULT NULL, `col16` decimal(10,0) DEFAULT NULL, `col17` decimal(10,0) DEFAULT NULL, `col18` blob, `col19` datetime DEFAULT NULL, `col20` double DEFAULT NULL, `col21` decimal(10,0) DEFAULT NULL, `col22` datetime DEFAULT NULL, `col23` decimal(10,0) DEFAULT NULL, `col24` decimal(10,0) DEFAULT NULL, `col25` longtext, `col26` tinyblob, `col27` time DEFAULT NULL, `col28` tinyblob, `col29` enum('test1','test2','test3') DEFAULT NULL, `col30` smallint(6) DEFAULT NULL, `col31` double DEFAULT NULL, `col32` float DEFAULT NULL, `col33` char(175) DEFAULT NULL, `col34` tinytext, `col35` tinytext, `col36` tinyblob, `col37` tinyblob, `col38` tinytext, `col39` mediumblob, `col40` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `col41` double DEFAULT NULL, `col42` smallint(6) DEFAULT NULL, `col43` longblob, `col44` varchar(80) DEFAULT NULL, `col45` mediumtext, `col46` decimal(10,0) DEFAULT NULL, `col47` bigint(20) DEFAULT NULL, `col48` date DEFAULT NULL, `col49` tinyblob, `col50` date DEFAULT NULL, `col51` tinyint(1) DEFAULT NULL, `col52` mediumint(9) DEFAULT NULL, `col53` float DEFAULT NULL, `col54` tinyblob, `col55` longtext, `col56` smallint(6) DEFAULT NULL, `col57` enum('test1','test2','test3') DEFAULT NULL, `col58` datetime DEFAULT NULL, `col59` mediumtext, `col60` varchar(232) DEFAULT NULL, `col61` decimal(10,0) DEFAULT NULL, `col62` year(4) DEFAULT NULL, `col63` smallint(6) DEFAULT NULL, `col64` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', `col65` blob, `col66` longblob, `col67` int(11) DEFAULT NULL, `col68` longtext, `col69` enum('test1','test2','test3') DEFAULT NULL, `col70` int(11) DEFAULT NULL, `col71` time DEFAULT NULL, `col72` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', `col73` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', `col74` varchar(170) DEFAULT NULL, `col75` set('test1','test2','test3') DEFAULT NULL, `col76` tinyblob, `col77` bigint(20) DEFAULT NULL, `col78` decimal(10,0) DEFAULT NULL, `col79` datetime DEFAULT NULL, `col80` year(4) DEFAULT NULL, `col81` decimal(10,0) DEFAULT NULL, `col82` longblob, `col83` text, `col84` char(83) DEFAULT NULL, `col85` decimal(10,0) DEFAULT NULL, `col86` float DEFAULT NULL, `col87` int(11) DEFAULT NULL, `col88` varchar(145) DEFAULT NULL, `col89` date DEFAULT NULL, `col90` decimal(10,0) DEFAULT NULL, `col91` decimal(10,0) DEFAULT NULL, `col92` mediumblob, `col93` time DEFAULT NULL, KEY `idx0` (`col69`,`col90`,`col8`), KEY `idx1` (`col60`), KEY `idx2` (`col60`,`col70`,`col74`), KEY `idx3` (`col22`,`col32`,`col72`,`col30`), KEY `idx4` (`col29`), KEY `idx5` (`col19`,`col45`(143)), KEY `idx6` (`col46`,`col48`,`col5`,`col39`(118)), KEY `idx7` (`col48`,`col61`), KEY `idx8` (`col93`), KEY `idx9` (`col31`), KEY `idx10` (`col30`,`col21`), KEY `idx11` (`col67`), KEY `idx12` (`col44`,`col6`,`col8`,`col38`(226)), KEY `idx13` (`col71`,`col41`,`col15`,`col49`(88)), KEY `idx14` (`col78`), KEY `idx15` (`col63`,`col67`,`col64`), KEY `idx16` (`col17`,`col86`), KEY `idx17` (`col77`,`col56`,`col10`,`col55`(24)), KEY `idx18` (`col62`), KEY `idx19` (`col31`,`col57`,`col56`,`col53`), KEY `idx20` (`col46`), KEY `idx21` (`col83`(54)), KEY `idx22` (`col51`,`col7`(120)), KEY `idx23` (`col7`(163),`col31`,`col71`,`col14`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=2;
insert ignore into `table0` set `col23` = 7887371.5084383683, `col24` = 4293854615.6906948000, `col25` = 'vitalist', `col26` = 'widespread', `col27` = '3570490', `col28` = 'habitual', `col30` = -5471, `col31` = 4286985783.6771750000, `col32` = 6354540.9826654866, `col33` = 'defoliation', `col34` = 'logarithms', `col35` = 'tegument\'s', `col36` = 'scouting\'s', `col37` = 'intermittency', `col38` = 'elongates', `col39` = 'prophecies', `col40` = '20560103035939', `col41` = 4292809130.0544143000, `col42` = 22057, `col43` = 'Hess\'s', `col44` = 'bandstand', `col45` = 'phenylketonuria', `col46` = 6338767.4018677324, `col47` = 5310247, `col48` = '12592418', `col49` = 'churchman\'s', `col50` = '32226125', `col51` = -58, `col52` = -6207968, `col53` = 1244839.3255104220, `col54` = 'robotized', `col55` = 'monotonous', `col56` = -26909, `col58` = '20720107023550', `col59` = 'suggestiveness\'s', `col60` = 'gemology', `col61` = 4287800670.2229986000, `col62` = '1944', `col63` = -16827, `col64` = '20700107212324', `col65` = 'Nicolais', `col66` = 'apteryx', `col67` = 6935317, `col68` = 'stroganoff', `col70` = 3316430, `col71` = '3277608', `col72` = '19300511045918', `col73` = '20421201003327', `col74` = 'attenuant', `col75` = '15173', `col76` = 'upstroke\'s', `col77` = 8118987, `col78` = 6791516.2735374002, `col79` = '20780701144624', `col80` = '2134', `col81` = 4290682351.3127537000, `col82` = 'unexplainably', `col83` = 'Storm', `col84` = 'Greyso\'s', `col85` = 4289119212.4306774000, `col86` = 7617575.8796655172, `col87` = -6325335, `col88` = 'fondue\'s', `col89` = '40608940', `col90` = 1659421.8093508712, `col91` = 8346904.6584368423, `col92` = 'reloads', `col93` = '5188366';
CHECK TABLE table0 EXTENDED;
INSERT IGNORE INTO `table0` SET `col19` = '19940127002709', `col20` = 2383927.9055146948, `col21` = 4293243420.5621204000, `col22` = '20511211123705', `col23` = 4289899778.6573381000, `col24` = 4293449279.0540481000, `col25` = 'emphysemic', `col26` = 'dentally', `col27` = '2347406', `col28` = 'eruct', `col30` = 1222, `col31` = 4294372994.9941406000, `col32` = 4291385574.1173744000, `col33` = 'borrowing\'s', `col34` = 'septics', `col35` = 'ratter\'s', `col36` = 'Kaye', `col37` = 'Florentia', `col38` = 'allium', `col39` = 'barkeep', `col40` = '19510407003441', `col41` = 4293559200.4215522000, `col42` = 22482, `col43` = 'decussate', `col44` = 'Brom\'s', `col45` = 'violated', `col46` = 4925506.4635456400, `col47` = 930549, `col48` = '51296066', `col49` = 'voluminously', `col50` = '29306676', `col51` = -88, `col52` = -2153690, `col53` = 4290250202.1464887000, `col54` = 'expropriation', `col55` = 'Aberdeen\'s', `col56` = 20343, `col58` = '19640415171532', `col59` = 'extern', `col60` = 'Ubana', `col61` = 4290487961.8539081000, `col62` = '2147', `col63` = -24271, `col64` = '20750801194548', `col65` = 'Cunaxa\'s', `col66` = 'pasticcio', `col67` = 2795817, `col68` = 'Indore\'s', `col70` = 6864127, `col71` = '1817832', `col72` = '20540506114211', `col73` = '20040101012300', `col74` = 'rationalized', `col75` = '45522', `col76` = 'indene', `col77` = -6964559, `col78` = 4247535.5266884370, `col79` = '20720416124357', `col80` = '2143', `col81` = 4292060102.4466386000, `col82` = 'striving', `col83` = 'boneblack\'s', `col84` = 'redolent', `col85` = 6489697.9009369183, `col86` = 4287473465.9731131000, `col87` = 7726015, `col88` = 'perplexed', `col89` = '17153791', `col90` = 5478587.1108127078, `col91` = 4287091404.7004304000, `col92` = 'Boulez\'s', `col93` = '2931278';
CHECK TABLE table0 EXTENDED;
DROP TABLE table0;
-EVAL SET GLOBAL innodb_file_format=$file_format;
-EVAL SET GLOBAL innodb_file_per_table=$file_per_table;
diff --git a/mysql-test/suite/innodb_zip/t/innodb_bug52745.test b/mysql-test/suite/innodb_zip/t/innodb_bug52745.test
index 3c5d79826f0..fe7bdbae42d 100644
--- a/mysql-test/suite/innodb_zip/t/innodb_bug52745.test
+++ b/mysql-test/suite/innodb_zip/t/innodb_bug52745.test
@@ -1,10 +1,5 @@
-- source include/have_innodb.inc
-let $file_format=`select @@innodb_file_format`;
-let $file_per_table=`select @@innodb_file_per_table`;
-SET GLOBAL innodb_file_format='Barracuda';
-SET GLOBAL innodb_file_per_table=on;
-
CREATE TABLE bug52745 (
a2 int(10) unsigned DEFAULT NULL,
col37 time DEFAULT NULL,
@@ -102,6 +97,3 @@ col90=repeat('gale',48);
SHOW WARNINGS;
DROP TABLE bug52745;
-
-EVAL SET GLOBAL innodb_file_format=$file_format;
-EVAL SET GLOBAL innodb_file_per_table=$file_per_table;
diff --git a/mysql-test/suite/innodb_zip/t/innodb_bug53591.test b/mysql-test/suite/innodb_zip/t/innodb_bug53591.test
index 6c80165f6eb..1366e0e43ac 100644
--- a/mysql-test/suite/innodb_zip/t/innodb_bug53591.test
+++ b/mysql-test/suite/innodb_zip/t/innodb_bug53591.test
@@ -1,10 +1,5 @@
-- source include/have_innodb.inc
-let $file_format=`select @@innodb_file_format`;
-let $file_per_table=`select @@innodb_file_per_table`;
-
-SET GLOBAL innodb_file_format='Barracuda';
-SET GLOBAL innodb_file_per_table=on;
SET GLOBAL innodb_strict_mode=on;
set old_alter_table=0;
@@ -18,6 +13,4 @@ SHOW WARNINGS;
DROP TABLE bug53591;
-EVAL SET GLOBAL innodb_file_format=$file_format;
-EVAL SET GLOBAL innodb_file_per_table=$file_per_table;
SET GLOBAL innodb_strict_mode=DEFAULT;
diff --git a/mysql-test/suite/innodb_zip/t/innodb_bug56680.test b/mysql-test/suite/innodb_zip/t/innodb_bug56680.test
index f592bd16942..4e73b1fce0f 100644
--- a/mysql-test/suite/innodb_zip/t/innodb_bug56680.test
+++ b/mysql-test/suite/innodb_zip/t/innodb_bug56680.test
@@ -4,8 +4,6 @@
#
-- disable_query_log
SET @tx_isolation_orig = @@tx_isolation;
-SET @innodb_file_per_table_orig = @@innodb_file_per_table;
-SET @innodb_file_format_orig = @@innodb_file_format;
# The flag innodb_change_buffering_debug is only available in debug builds.
# It instructs InnoDB to try to evict pages from the buffer pool when
# change buffering is possible, so that the change buffer will be used
@@ -16,8 +14,6 @@ SET @innodb_change_buffering_debug_orig = @@innodb_change_buffering_debug;
SET GLOBAL innodb_change_buffering_debug = 1;
-- enable_query_log
SET GLOBAL tx_isolation='REPEATABLE-READ';
-SET GLOBAL innodb_file_format=Barracuda;
-SET GLOBAL innodb_file_per_table=on;
CREATE TABLE bug56680(
a INT AUTO_INCREMENT PRIMARY KEY,
@@ -133,7 +129,5 @@ DROP TABLE bug56680;
-- disable_query_log
SET GLOBAL tx_isolation = @tx_isolation_orig;
-SET GLOBAL innodb_file_per_table = @innodb_file_per_table_orig;
-SET GLOBAL innodb_file_format = @innodb_file_format_orig;
-- error 0, ER_UNKNOWN_SYSTEM_VARIABLE
SET GLOBAL innodb_change_buffering_debug = @innodb_change_buffering_debug_orig;
diff --git a/mysql-test/suite/innodb_zip/t/innodb_index_large_prefix.test b/mysql-test/suite/innodb_zip/t/innodb_index_large_prefix.test
index 8af2bc7ffc7..72890a933f2 100644
--- a/mysql-test/suite/innodb_zip/t/innodb_index_large_prefix.test
+++ b/mysql-test/suite/innodb_zip/t/innodb_index_large_prefix.test
@@ -6,12 +6,8 @@ SET default_storage_engine=InnoDB;
call mtr.add_suppression("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.");
-let $innodb_file_format_orig=`select @@innodb_file_format`;
-let $innodb_file_per_table_orig=`select @@innodb_file_per_table`;
let $innodb_large_prefix_orig=`select @@innodb_large_prefix`;
-set global innodb_file_format="Barracuda";
-set global innodb_file_per_table=1;
set global innodb_large_prefix=1;
set global innodb_strict_mode=1;
@@ -391,11 +387,13 @@ update worklog5743 set a = (repeat("x", 25000));
select @@session.tx_isolation;
--connection con1
select a = repeat("a", 20000) from worklog5743;
+--disconnect con1
--connection con2
SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
select @@session.tx_isolation;
select a = repeat("x", 25000) from worklog5743;
+--disconnect con2
--connection default
rollback;
@@ -427,16 +425,5 @@ create index idx on worklog5743(a(768));
create index idx2 on worklog5743(a(767));
drop table worklog5743;
-
-eval SET GLOBAL innodb_file_format=$innodb_file_format_orig;
-eval SET GLOBAL innodb_file_per_table=$innodb_file_per_table_orig;
eval SET GLOBAL innodb_large_prefix=$innodb_large_prefix_orig;
SET GLOBAL innodb_strict_mode = DEFAULT;
---connection con1
---disconnect con1
---source include/wait_until_disconnected.inc
---connection con2
---disconnect con2
---source include/wait_until_disconnected.inc
---connection default
-
diff --git a/mysql-test/suite/innodb_zip/t/wl6501_crash_3.test b/mysql-test/suite/innodb_zip/t/wl6501_crash_3.test
index eb4c23aa66e..3ec990b4715 100644
--- a/mysql-test/suite/innodb_zip/t/wl6501_crash_3.test
+++ b/mysql-test/suite/innodb_zip/t/wl6501_crash_3.test
@@ -21,6 +21,5 @@
let $wl6501_file_per_table = 1;
let $wl6501_row_fmt = compressed;
let $wl6501_kbs = 16;
-let $wl6501_file_format = 'Barracuda';
--source suite/innodb/include/innodb_wl6501_crash.inc
diff --git a/mysql-test/suite/innodb_zip/t/wl6501_crash_4.test b/mysql-test/suite/innodb_zip/t/wl6501_crash_4.test
index 870af3dfc94..f54df3c128c 100644
--- a/mysql-test/suite/innodb_zip/t/wl6501_crash_4.test
+++ b/mysql-test/suite/innodb_zip/t/wl6501_crash_4.test
@@ -21,9 +21,7 @@
let $wl6501_file_per_table = 1;
let $wl6501_row_fmt = compressed;
let $wl6501_kbs = 4;
-let $wl6501_file_format = 'Barracuda';
--source suite/innodb/include/innodb_wl6501_crash.inc
let $wl6501_temp = temporary;
--source suite/innodb/include/innodb_wl6501_crash_temp.inc
-
diff --git a/mysql-test/suite/innodb_zip/t/wl6501_crash_5.test b/mysql-test/suite/innodb_zip/t/wl6501_crash_5.test
index 3432a5a5c76..2f9847ae5fb 100644
--- a/mysql-test/suite/innodb_zip/t/wl6501_crash_5.test
+++ b/mysql-test/suite/innodb_zip/t/wl6501_crash_5.test
@@ -21,6 +21,5 @@
let $wl6501_file_per_table = 1;
let $wl6501_row_fmt = compressed;
let $wl6501_kbs = 8;
-let $wl6501_file_format = 'Barracuda';
--source suite/innodb/include/innodb_wl6501_crash.inc
diff --git a/mysql-test/suite/innodb_zip/t/wl6501_scale_1.test b/mysql-test/suite/innodb_zip/t/wl6501_scale_1.test
index 8c746fe8abf..e6392759d5e 100644
--- a/mysql-test/suite/innodb_zip/t/wl6501_scale_1.test
+++ b/mysql-test/suite/innodb_zip/t/wl6501_scale_1.test
@@ -22,20 +22,16 @@
let $wl6501_file_per_table = 1;
let $wl6501_row_fmt = compact;
let $wl6501_kbs = 16;
-let $wl6501_file_format = 'Antelope';
--source suite/innodb_zip/include/innodb_wl6501_scale.inc
# Single-Tablespace/Compressed
let $wl6501_file_per_table = 1;
let $wl6501_row_fmt = compressed;
let $wl6501_kbs = 16;
-let $wl6501_file_format = 'Barracuda';
--source suite/innodb_zip/include/innodb_wl6501_scale.inc
# System-Tablespace/Non-Compressed
let $wl6501_file_per_table = 0;
let $wl6501_row_fmt = compact;
let $wl6501_kbs = 16;
-let $wl6501_file_format = 'Antelope';
--source suite/innodb_zip/include/innodb_wl6501_scale.inc
-
diff --git a/mysql-test/suite/innodb_zip/t/wl6560.test b/mysql-test/suite/innodb_zip/t/wl6560.test
deleted file mode 100644
index 55d36747938..00000000000
--- a/mysql-test/suite/innodb_zip/t/wl6560.test
+++ /dev/null
@@ -1,422 +0,0 @@
-#
-# WL#6560: InnoDB: separate tablespace for innodb-temp-tables.
-#
-
---source include/have_innodb.inc
---source include/have_innodb_zip.inc
-# Embedded server does not restart of server
---source include/not_embedded.inc
--- source include/big_test.inc
-
---disable_query_log
-call mtr.add_suppression("Tablespace innodb_temporary ran out of space. Please add another file or use 'autoextend' for the last file in setting innodb_temp_data_file_path.");
-call mtr.add_suppression("The table 't1' is full");
---enable_query_log
-
-################################################################################
-#
-# Will test following scenarios:
-# 1. creation of shared temp-tablespace.
-# 2. ddl + dml operation involving temp-tablespace.
-# insert/delete/update/select
-# create/drop/alter/truncate/import-discard (though blocked).
-# 3. ddl + dml operation on compressed table.
-# (table doesn't reside in shared temp-tablespace).
-# 4. Test bulk-loading that result in auto-extension of temp-tablespace.
-# 5. re-creation of temp-tablespace on re-start.
-# also to ensure non-existence of existing temp-table.
-# 6. restart server in innodb-read-only mode. this will also
-# block creation of temp-tables.
-# 7. try starting server with shared and temp-tablespace filename same.
-# 8. try re-starting server with param so that temp-tablespace can't be
-# expanded and insert enough data to make it full.
-# 9. tests for different row format types and key block sizes for
-# compressed tables.
-# 10. try restarting server with raw device specified for temp-tablespace.
-# 11. try restarting server with temp-tablespace less than min. threshold
-# 12. no file specified for temp-tablespace.
-################################################################################
-
-#-----------------------------------------------------------------------------
-#
-# create test-bed
-#
-let $per_table = `select @@innodb_file_per_table`;
-
-set global innodb_file_per_table = off;
-let $MYSQL_TMP_DIR = `select @@tmpdir`;
-let $MYSQL_DATA_DIR = `select @@datadir`;
-let SEARCH_FILE = $MYSQLTEST_VARDIR/log/my_restart.err;
-let $args = --loose-console --core-file > $SEARCH_FILE 2>&1;
-let crash = --loose-console > $SEARCH_FILE 2>&1 --innodb-force-recovery-crash;
-let readonly = $args --innodb_read_only;
-let nameconflicts = $args --innodb_data_file_path="ibdata1:12M:autoextend:max:134217728" --innodb_temp_data_file_path="ibdata1:12M:autoextend";
-let rawdevice1 = $args --innodb_temp_data_file_path="/dev/hdd1:3Gnewraw;/dev/hdd2:2Gnewraw";
-let rawdevice2 = $args --innodb_temp_data_file_path="/dev/hdd1:3Graw;/dev/hdd2:2Graw";
-let sizeoftempfile1 = $args --innodb_temp_data_file_path="ibtmp1:2M:autoextend";
-let sizeoftempfile2 = $args --innodb_data_file_path="ibdata1:2M:autoextend";
-let notemptablespacefile = $args --innodb_temp_data_file_path="";
-
-#-----------------------------------------------------------------------------
-#
-# 1. creation of shared temp-tablespace.
-#
---echo # files in MYSQL_DATA_DIR
---list_files $MYSQL_DATA_DIR/ ibtmp*
-
-
-#-----------------------------------------------------------------------------
-#
-# 2. ddl + dml operation involving temp-tablespace.
-# insert/delete/update/select
-# create/drop/alter/truncate/import-discard (though blocked).
-#
-select @@global.innodb_file_per_table;
-create temporary table t1 (i int, f float, c char(100)) engine=innodb;
-#
---source suite/innodb_zip/include/innodb_temp_table_dml.inc
-#
-# alter table
---error ER_CANNOT_DISCARD_TEMPORARY_TABLE
-alter table t1 discard tablespace;
---error ER_CANNOT_DISCARD_TEMPORARY_TABLE
-alter table t1 import tablespace;
-#
-# drop table
-drop table t1;
-
-#-----------------------------------------------------------------------------
-#
-# 3. ddl + dml operation on compressed table.
-# (table doesn't reside in shared temp-tablespace).
-#
---echo #files in MYSQL_TMP_DIR
---list_files $MYSQL_TMP_DIR/ *.ibd
-set global innodb_file_per_table = 1;
-select @@global.innodb_file_per_table;
-create temporary table t1
- (i int, f float, c char(100)) engine = innodb key_block_size = 4;
-show create table t1;
---echo #files in MYSQL_TMP_DIR
---replace_regex /#sql[0-9a-f_]*/#sql<temporary>/
---list_files $MYSQL_TMP_DIR/ *.ibd
-#
---source suite/innodb_zip/include/innodb_temp_table_dml.inc
-#
-# alter table
---error ER_CANNOT_DISCARD_TEMPORARY_TABLE
-alter table t1 discard tablespace;
-#
-# drop table
-drop table t1;
-set global innodb_file_per_table = off;
-
-#-----------------------------------------------------------------------------
-#
-# 4. Test bulk-loading that result in auto-extension of temp-tablespace.
-#
-create temporary table t1
- (keyc int, c1 char(100), c2 char(100),
- primary key(keyc)) engine = innodb;
-delimiter |;
-CREATE PROCEDURE populate_t1()
-BEGIN
- DECLARE i INT DEFAULT 1;
- while (i <= 20000) DO
- insert into t1 values (i, 'a', 'b');
- SET i = i + 1;
- END WHILE;
-END|
-delimiter ;|
-set autocommit=0;
-select count(*) from t1;
-call populate_t1();
-select count(*) from t1;
-select * from t1 limit 10;
-set autocommit=1;
-truncate table t1;
-select count(*) from t1;
-#
-drop procedure populate_t1;
-drop table t1;
-
-#-----------------------------------------------------------------------------
-#
-# 5. re-creation of temp-tablespace on re-start.
-# also to ensure non-existence of existing temp-table.
-#
-create temporary table t1 (keyc int, c1 char(100), c2 char(100)) engine = innodb;
-insert into t1 values (1, 'c', 'b');
-select * from t1;
-#
---source include/restart_mysqld.inc
-#
---echo # files in MYSQL_DATA_DIR
---list_files $MYSQL_DATA_DIR/ ibtmp*
-use test;
---error ER_NO_SUCH_TABLE
-select * from t1;
-
-#-----------------------------------------------------------------------------
-#
-# 6. restart server in innodb-read-only mode. this will also
-# block creation of temp-tables.
-#
-#
---echo "testing temp-table creation in --innodb_read_only mode"
-let $restart_parameters=--innodb-read-only;
---source include/restart_mysqld.inc
-#
-use test;
-show tables;
---error ER_INNODB_READ_ONLY, 1005
-create temporary table t1 (keyc int, c1 char(100), c2 char(100)) engine = innodb;
-
-#-----------------------------------------------------------------------------
-#
-# 7. try starting server with shared and temp-tablespace filename same.
-#
---source include/shutdown_mysqld.inc
---echo "testing system and temp tablespace name conflict"
---error 1
---exec $MYSQLD_CMD $nameconflicts
-let SEARCH_PATTERN = innodb_temporary and innodb_system file names seem to be the same;
---source ./include/search_pattern_in_file.inc
---remove_file $SEARCH_FILE
---echo "restarting server in normal mode"
---enable_reconnect
-let $restart_parameters = restart;
---source include/start_mysqld.inc
-#
-show tables;
-create temporary table t1 (keyc int, c1 char(100), c2 char(100)) engine = innodb;
-drop table t1;
-
-#-----------------------------------------------------------------------------
-#
-# 8. try re-starting server with param so that temp-tablespace can't be expanded
-# and insert enough data to make it full.
-#
---echo # test condition of full-temp-tablespace
-let $restart_parameters=--innodb_temp_data_file_path=ibtmp1:12M;
---source include/restart_mysqld.inc
-#
-create temporary table t1
- (keyc int, c1 char(100), c2 char(100),
- primary key(keyc)) engine = innodb;
-delimiter |;
-CREATE PROCEDURE populate_t1()
-BEGIN
- DECLARE i INT DEFAULT 1;
- while (i <= 20000) DO
- insert into t1 values (i, 'a', 'b');
- SET i = i + 1;
- END WHILE;
-END|
-delimiter ;|
-set autocommit=0;
-select count(*) from t1;
---error ER_RECORD_FILE_FULL
-call populate_t1();
-#
-drop procedure populate_t1;
-drop table t1;
-
-#-----------------------------------------------------------------------------
-#
-# 9. tests for different row format types and key block sizes for
-# compressed tables.
-#
-set innodb_strict_mode = off;
---disable_warnings
-set global innodb_file_per_table = 0;
-set global innodb_file_format = 'Antelope';
-create temporary table t (
- i int)
- engine = innodb row_format = compressed;
---replace_regex /[0-9]+/NUMBER/
-show warnings;
-drop table t;
-#
-create temporary table t (
- i int)
- engine = innodb row_format = compressed key_block_size = 8;
---replace_regex /[0-9]+/NUMBER/
-show warnings;
-#
-drop table t;
-set global innodb_file_per_table = 1;
-create temporary table t (
- i int)
- engine = innodb row_format = compressed key_block_size = 8;
---replace_regex /[0-9]+/NUMBER/
-show warnings;
-drop table t;
-#
-create temporary table t (
- i int)
- engine = innodb row_format = dynamic;
---replace_regex /[0-9]+/NUMBER/
-show warnings;
---echo #files in MYSQL_TMP_DIR
---replace_regex /#sql[0-9a-f_]*/#sql<temporary>/
---list_files $MYSQL_TMP_DIR/ *.ibd
-drop table t;
-#
-set innodb_strict_mode = on;
-create temporary table t (
- i int)
- engine = innodb row_format = dynamic;
---replace_regex /[0-9]+/NUMBER/
-drop table t;
-#
-set global innodb_file_format = 'Barracuda';
-set innodb_strict_mode = off;
-create temporary table t (
- i int)
- engine = innodb row_format = compressed key_block_size = 8;
---replace_regex /[0-9]+/NUMBER/
-# explicitly disabling it else it will generate warning of ignoring
-# key_block_size when suite is run with innodb-page-size=4k
-#show warnings;
-set innodb_strict_mode = default;
---echo #files in MYSQL_TMP_DIR
---replace_regex /#sql[0-9a-f_]*/#sql<temporary>/
---list_files $MYSQL_TMP_DIR/ *.ibd
-#
-drop table t;
-create temporary table t (
- i int)
- engine = innodb row_format = compressed;
---replace_regex /[0-9]+/NUMBER/
-show warnings;
---echo #files in MYSQL_TMP_DIR
---replace_regex /#sql[0-9a-f_]*/#sql<temporary>/
---list_files $MYSQL_TMP_DIR/ *.ibd
-drop table t;
-#
-create temporary table t (
- i int)
- engine = innodb row_format = dynamic;
---replace_regex /[0-9]+/NUMBER/
-show warnings;
---echo #files in MYSQL_TMP_DIR
---replace_regex /#sql[0-9a-f_]*/#sql<temporary>/
---list_files $MYSQL_TMP_DIR/ *.ibd
-drop table t;
-#
-set innodb_strict_mode = on;
-create temporary table t (
- i int)
- engine = innodb row_format = dynamic;
---replace_regex /[0-9]+/NUMBER/
-show warnings;
-drop table t;
-set innodb_strict_mode = off;
-#
---echo #files in MYSQL_TMP_DIR
---replace_regex /#sql[0-9a-f_]*/#sql<temporary>/
---list_files $MYSQL_TMP_DIR/ *.ibd
-create temporary table t (
- i int)
- engine = innodb row_format = dynamic key_block_size = 4;
---replace_regex /[0-9]+/NUMBER/
-show warnings;
---echo #files in MYSQL_TMP_DIR
---replace_regex /#sql[0-9a-f_]*/#sql<temporary>/
---list_files $MYSQL_TMP_DIR/ *.ibd
-drop table t;
-#
-create temporary table t (
- i int)
- engine = innodb row_format = compact;
---replace_regex /[0-9]+/NUMBER/
-show warnings;
---echo #files in MYSQL_TMP_DIR
---replace_regex /#sql[0-9a-f_]*/#sql<temporary>/
---list_files $MYSQL_TMP_DIR/ *.ibd
-drop table t;
-#
-create temporary table t (
- i int)
- engine = innodb key_block_size = 4;
---replace_regex /[0-9]+/NUMBER/
-show warnings;
---echo #files in MYSQL_TMP_DIR
---replace_regex /#sql[0-9a-f_]*/#sql<temporary>/
---list_files $MYSQL_TMP_DIR/ *.ibd
-drop table t;
-#
-
-#-----------------------------------------------------------------------------
-#
-# 10. try restarting server with raw device specified for temp-tablespace.
-#
---source include/shutdown_mysqld.inc
---echo "testing temp tablespace non-support for raw device"
---error 1
---exec $MYSQLD_CMD $rawdevice1
-let SEARCH_PATTERN = support raw device;
---source include/search_pattern_in_file.inc
---remove_file $SEARCH_FILE
---echo "testing temp tablespace non-support for raw device"
---error 1
---exec $MYSQLD_CMD $rawdevice2
-let SEARCH_PATTERN = support raw device;
---source include/search_pattern_in_file.inc
---remove_file $SEARCH_FILE
-
---source include/start_mysqld.inc
-
-show tables;
-create temporary table t1 (
- keyc int, c1 char(100), c2 char(100)
- ) engine = innodb;
-drop table t1;
-
-#-----------------------------------------------------------------------------
-#
-# 11. try restarting server with temp-tablespace less than min. threshold
-#
---source include/shutdown_mysqld.inc
---echo "try starting server with temp-tablespace size < min. threshold"
---error 1
---exec $MYSQLD_CMD $sizeoftempfile1
-let SEARCH_PATTERN = Tablespace size must be at least;
---source ./include/search_pattern_in_file.inc
---remove_file $SEARCH_FILE
---echo "try starting server with sys-tablespace size < min. threshold"
---error 1
---exec $MYSQLD_CMD $sizeoftempfile2
-let SEARCH_PATTERN = Tablespace size must be at least;
---source ./include/search_pattern_in_file.inc
---remove_file $SEARCH_FILE
-
---source include/start_mysqld.inc
-
-show tables;
-create temporary table t1 (
- keyc int, c1 char(100), c2 char(100)
- ) engine = innodb;
-drop table t1;
-
-#-----------------------------------------------------------------------------
-#
-# 12. no file specified for temp-tablespace.
-#
---source include/shutdown_mysqld.inc
-
---echo "try starting server with no file specified for temp-tablespace"
---error 1
---exec $MYSQLD_CMD $notemptablespacefile
-let SEARCH_PATTERN = init function returned error;
---source ./include/search_pattern_in_file.inc
---remove_file $SEARCH_FILE
-
---source include/start_mysqld.inc
-
-show tables;
-create temporary table t1 (
- keyc int, c1 char(100), c2 char(100)
- ) engine = innodb;
-drop table t1;
diff --git a/mysql-test/suite/innodb_zip/t/wl6915_1.test b/mysql-test/suite/innodb_zip/t/wl6915_1.test
deleted file mode 100644
index 7f0f734d16a..00000000000
--- a/mysql-test/suite/innodb_zip/t/wl6915_1.test
+++ /dev/null
@@ -1,650 +0,0 @@
---source include/have_innodb.inc
---source include/have_innodb_zip.inc
---source include/have_no_undo_tablespaces.inc
---source include/big_test.inc
-
-# Embedded server does not support restarting
---source include/not_embedded.inc
-# Avoid CrashReporter popup on Mac
---source include/not_crashrep.inc
-
-####################################################################
-# TC to test temp-table undolog changes correctness #
-# Sceanrio covered in single testcase : #
-# - Tables with row format(redundant,compressed,dynamic,compact #
-# - Table with primary,composite,prefix,secondary INDEX #
-# - Insert/delete/update with transactioons #
-# - Transaction with COMMIT,rollback,savepoint statements #
-# - Transaction having temporary table and normal table #
-# - Concurrency by execution of two clients creating tables with #
-# same names #
-# - Inserting data using #
-# - Insert into .. , Load data infile..,insert ignore #
-# - Insert into .. on duplicate update #
-# - Check basic delete and upadte [ignore] #
-# - Check constraints like duplicate key,default value #
-# - Alter ADD COLUMN , ADD PRIMARY KEY #
-# - Flush Tables, logs command #
-# - Vary innodb_undo_tablespaces=0,innodb_undo_logs #
-# innodb_log_files_in_group #
-# - Verify rseg message from server log #
-####################################################################
-
-# run for page size >= 8k
---disable_warnings
-if (`SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE LOWER(variable_name) = 'innodb_page_size' AND variable_value >= 8192`)
-{
- --skip Test requires InnoDB with page size >= 8k.
-}
---enable_warnings
-
-call mtr.ADD_suppression(".*Resizing redo log.*");
-call mtr.ADD_suppression(".*Starting to delete and rewrite log files.*");
-call mtr.ADD_suppression(".*New log files created.*");
-# Save initial VALUES of server variable
---disable_query_log
-let $innodb_file_per_table_orig=`SELECT @@innodb_file_per_table`;
---enable_query_log
-
-SELECT @@global.innodb_undo_tablespaces;
-
-# Create procedure to perform
-# 1. Create temp table with row types , INDEX , sufficent data types
-# 2. Perform DML with transaction
-delimiter |;
-CREATE PROCEDURE populate_tables(IN id VARCHAR(10))
- begin
- declare n int default 20;
- set global innodb_file_per_table=on;
- DROP TABLE IF EXISTS t1,t2,t3,t4;
-
- CREATE TEMPORARY TABLE t1_temp(c1 int NOT NULL,
- c2 int NOT NULL,
- c3 char(255) NOT NULL,
- c4 text(600) NOT NULL,
- c5 blob(600) NOT NULL,
- c6 varchar(600) NOT NULL,
- c7 varchar(600) NOT NULL,
- c8 datetime,
- c9 decimal(6,3),
- PRIMARY KEY (c1),
- INDEX (c3,c4(50),c5(50)),
- INDEX (c2))
- ENGINE=InnoDB ROW_FORMAT=redundant;
-
- set @s = concat("CREATE TABLE t1",id," ( c1 int NOT NULL, c2 int NOT NULL, c3 char(255) NOT NULL, c4 text(600) NOT NULL, c5 blob(600) NOT NULL, c6 varchar(600) NOT NULL, c7 varchar(600) NOT NULL, c8 datetime, c9 decimal(6,3), PRIMARY KEY (c1), INDEX (c3,c4(50),c5(50)), INDEX (c2)) ENGINE=InnoDB ROW_FORMAT=redundant;");
- PREPARE createTable FROM @s;
- EXECUTE createTable;
- DEALLOCATE PREPARE createTable;
-
-
- CREATE TEMPORARY TABLE t2_temp(c1 int NOT NULL,
- c2 int NOT NULL,
- c3 char(255) NOT NULL,
- c4 text(600) NOT NULL,
- c5 blob(600) NOT NULL,
- c6 varchar(600) NOT NULL,
- c7 varchar(600) NOT NULL,
- c8 datetime,
- c9 decimal(6,3),
- PRIMARY KEY (c1),
- INDEX (c3,c4(50),c5(50)),
- INDEX (c2))
- ENGINE=InnoDB ROW_FORMAT=compact;
-
- set @s = concat("CREATE TABLE t2",id," (c1 int NOT NULL, c2 int NOT NULL, c3 char(255) NOT NULL, c4 text(600) NOT NULL, c5 blob(600) NOT NULL, c6 varchar(600) NOT NULL, c7 varchar(600) NOT NULL, c8 datetime, c9 decimal(6,3), PRIMARY KEY (c1), INDEX (c3,c4(50),c5(50)), INDEX (c2)) ENGINE=InnoDB ROW_FORMAT=compact;");
- PREPARE createTable FROM @s;
- EXECUTE createTable;
- DEALLOCATE PREPARE createTable;
-
- CREATE TEMPORARY TABLE t3_temp(c1 int NOT NULL,
- c2 int NOT NULL,
- c3 char(255) NOT NULL,
- c4 text(600) NOT NULL,
- c5 blob(600) NOT NULL,
- c6 varchar(600) NOT NULL,
- c7 varchar(600) NOT NULL,
- c8 datetime,
- c9 decimal(6,3),
- PRIMARY KEY (c1),
- INDEX (c3,c4(50),c5(50)),
- INDEX (c2))
- ENGINE=InnoDB ROW_FORMAT=compressed key_block_size=4;
-
- set @s = concat("CREATE TABLE t3",id," (c1 int NOT NULL, c2 int NOT NULL, c3 char(255) NOT NULL, c4 text(600) NOT NULL, c5 blob(600) NOT NULL, c6 varchar(600) NOT NULL, c7 varchar(600) NOT NULL, c8 datetime, c9 decimal(6,3), PRIMARY KEY (c1), INDEX (c3,c4(50),c5(50)), INDEX (c2)) ENGINE=InnoDB ROW_FORMAT=compressed key_block_size=4;");
- PREPARE createTable FROM @s;
- EXECUTE createTable;
- DEALLOCATE PREPARE createTable;
-
- CREATE TEMPORARY TABLE t4_temp(c1 int NOT NULL,
- c2 int NOT NULL,
- c3 char(255) NOT NULL,
- c4 text(600) NOT NULL,
- c5 blob(600) NOT NULL,
- c6 varchar(600) NOT NULL,
- c7 varchar(600) NOT NULL,
- c8 datetime,
- c9 decimal(6,3),
- PRIMARY KEY (c1),
- INDEX (c3,c4(50),c5(50)),
- INDEX (c2))
- ENGINE=InnoDB ROW_FORMAT=dynamic;
-
- set @s = concat("CREATE TABLE t4",id," (c1 int NOT NULL, c2 int NOT NULL, c3 char(255) NOT NULL, c4 text(600) NOT NULL, c5 blob(600) NOT NULL, c6 varchar(600) NOT NULL, c7 varchar(600) NOT NULL, c8 datetime, c9 decimal(6,3), PRIMARY KEY (c1), INDEX (c3,c4(50),c5(50)), INDEX (c2)) ENGINE=InnoDB ROW_FORMAT=dynamic;");
- PREPARE createTable FROM @s;
- EXECUTE createTable;
- DEALLOCATE PREPARE createTable;
-
- while (n > 0) do
- START TRANSACTION;
- set @s = concat("INSERT INTO t1",id," VALUES(",n,",",n,",REPEAT(concat(' tc3_',",n,"),30), REPEAT(concat(' tc4_',",n,"),70),REPEAT(concat(' tc_',",n,"),70), REPEAT(concat(' tc6_',",n,"),70),REPEAT(concat(' tc7_',",n,"),70), NOW(),(100.55+",n,"));");
- PREPARE insertIntoTable FROM @s;
- EXECUTE insertIntoTable;
- DEALLOCATE PREPARE insertIntoTable;
- INSERT INTO t1_temp VALUES(n,n,REPEAT(concat(' tc3_',n),30),
- REPEAT(concat(' tc4_',n),70),REPEAT(concat(' tc_',n),70),
- REPEAT(concat(' tc6_',n),70),REPEAT(concat(' tc7_',n),70),
- NOW(),(100.55+n));
-
- set @s = concat("INSERT INTO t2",id," VALUES(",n,",",n,",REPEAT(concat(' tc3_',",n,"),30), REPEAT(concat(' tc4_',",n,"),70),REPEAT(concat(' tc_',",n,"),70), REPEAT(concat(' tc6_',",n,"),70),REPEAT(concat(' tc7_',",n,"),70), NOW(),(100.55+",n,"));");
- PREPARE insertIntoTable FROM @s;
- EXECUTE insertIntoTable;
- DEALLOCATE PREPARE insertIntoTable;
-
- INSERT INTO t2_temp VALUES(n,n,REPEAT(concat(' tc3_',n),30),
- REPEAT(concat(' tc4_',n),70),REPEAT(concat(' tc_',n),70),
- REPEAT(concat(' tc6_',n),70),REPEAT(concat(' tc7_',n),70),
- NOW(),(100.55+n));
-
- savepoint a;
-
- set @s = concat("INSERT INTO t3",id," VALUES(",n,",",n,",REPEAT(concat(' tc3_',",n,"),30), REPEAT(concat(' tc4_',",n,"),70),REPEAT(concat(' tc_',",n,"),70), REPEAT(concat(' tc6_',",n,"),70),REPEAT(concat(' tc7_',",n,"),70), NOW(),(100.55+",n,"));");
- PREPARE insertIntoTable FROM @s;
- EXECUTE insertIntoTable;
- DEALLOCATE PREPARE insertIntoTable;
-
- INSERT INTO t3_temp VALUES(n,n,REPEAT(concat(' tc3_',n),30),
- REPEAT(concat(' tc4_',n),70),REPEAT(concat(' tc_',n),70),
- REPEAT(concat(' tc6_',n),70),REPEAT(concat(' tc7_',n),70),
- NOW(),(100.55+n));
-
- savepoint b;
-
- set @s = concat("INSERT INTO t4",id," VALUES(",n,",",n,",REPEAT(concat(' tc3_',",n,"),30), REPEAT(concat(' tc4_',",n,"),70),REPEAT(concat(' tc_',",n,"),70), REPEAT(concat(' tc6_',",n,"),70),REPEAT(concat(' tc7_',",n,"),70), NOW(),(100.55+",n,"));");
- PREPARE insertIntoTable FROM @s;
- EXECUTE insertIntoTable;
- DEALLOCATE PREPARE insertIntoTable;
-
- INSERT INTO t4_temp VALUES(n,n,REPEAT(concat(' tc3_',n),30),
- REPEAT(concat(' tc4_',n),70),REPEAT(concat(' tc_',n),70),
- REPEAT(concat(' tc6_',n),70),REPEAT(concat(' tc7_',n),70),
- NOW(),(100.55+n));
-
-
- if (n > 10) then
- if (n > 10 and n <=12) then
- ROLLBACK TO SAVEPOINT a;
- COMMIT;
- end if;
- if (n > 12 and n < 15) then
- ROLLBACK TO SAVEPOINT b;
- COMMIT;
- end if;
- if (n > 15) then
- COMMIT;
- end if;
-
- else
- if (n > 5) then
- START TRANSACTION;
- DELETE FROM t1_temp WHERE c1 > 10 ;
- DELETE FROM t2_temp WHERE c1 > 10 ;
- DELETE FROM t3_temp WHERE c1 > 10 ;
- DELETE FROM t4_temp WHERE c1 > 10 ;
-
- rollback;
- START TRANSACTION;
- update t1_temp set c1 = c1 + 1000 WHERE c1 > 10;
- update t2_temp set c1 = c1 + 1000 WHERE c1 > 10;
- update t3_temp set c1 = c1 + 1000 WHERE c1 > 10;
- update t4_temp set c1 = c1 + 1000 WHERE c1 > 10;
- rollback;
- end if;
- end if;
-
- if (n < 5) then
- rollback;
- end if;
-
- FLUSH logs;
- ALTER TABLE t1_temp DROP PRIMARY KEY;
- ALTER TABLE t1_temp ADD PRIMARY KEY (c1,c3(10),c4(10));
- ALTER TABLE t2_temp DROP PRIMARY KEY;
- ALTER TABLE t2_temp ADD PRIMARY KEY (c1,c3(10),c4(10));
- ALTER TABLE t3_temp DROP PRIMARY KEY;
- ALTER TABLE t3_temp ADD PRIMARY KEY (c1,c3(10),c4(10));
- ALTER TABLE t4_temp DROP PRIMARY KEY;
- ALTER TABLE t4_temp ADD PRIMARY KEY (c1,c3(10),c4(10));
- FLUSH tables;
-
- START TRANSACTION;
- set @s = concat("INSERT INTO t1",id," VALUES(",n,"+100,",n,"+100,REPEAT(concat(' tc3_',",n,"+100),30), REPEAT(concat(' tc4_',",n,"+100),70),REPEAT(concat(' tc_',",n,"+100),70), REPEAT(concat(' tc6_',",n,"+100),60),REPEAT(concat(' tc7_',",n,"+100),60), NOW(),(100.55+",n,"+100));");
- PREPARE insertIntoTable FROM @s;
- EXECUTE insertIntoTable;
- DEALLOCATE PREPARE insertIntoTable;
- INSERT INTO t1_temp VALUES(n+100,n+100,REPEAT(concat(' tc3_',n+100),30),
- REPEAT(concat(' tc4_',n+100),70),REPEAT(concat(' tc_',n+100),70),
- REPEAT(concat(' tc6_',n+100),60),REPEAT(concat(' tc7_',n+100),60),
- NOW(),(100.55+n+100));
- set @s = concat("INSERT INTO t2",id," VALUES(",n,"+100,",n,"+100,REPEAT(concat(' tc3_',",n,"+100),30), REPEAT(concat(' tc4_',",n,"+100),70),REPEAT(concat(' tc_',",n,"+100),70), REPEAT(concat(' tc6_',",n,"+100),60),REPEAT(concat(' tc7_',",n,"+100),60), NOW(),(100.55+",n,"+100));");
- PREPARE insertIntoTable FROM @s;
- EXECUTE insertIntoTable;
- DEALLOCATE PREPARE insertIntoTable;
- INSERT INTO t2_temp VALUES(n+100,n+100,REPEAT(concat(' tc3_',n+100),30),
- REPEAT(concat(' tc4_',n+100),70),REPEAT(concat(' tc_',n+100),70),
- REPEAT(concat(' tc6_',n+100),60),REPEAT(concat(' tc7_',n+100),60),
- NOW(),(100.55+n+100));
- set @s = concat("INSERT INTO t3",id," VALUES(",n,"+100,",n,"+100,REPEAT(concat(' tc3_',",n,"+100),30), REPEAT(concat(' tc4_',",n,"+100),70),REPEAT(concat(' tc_',",n,"+100),70), REPEAT(concat(' tc6_',",n,"+100),60),REPEAT(concat(' tc7_',",n,"+100),60), NOW(),(100.55+",n,"+100));");
- PREPARE insertIntoTable FROM @s;
- EXECUTE insertIntoTable;
- DEALLOCATE PREPARE insertIntoTable;
- INSERT INTO t3_temp VALUES(n+100,n+100,REPEAT(concat(' tc3_',n+100),30),
- REPEAT(concat(' tc4_',n+100),70),REPEAT(concat(' tc_',n+100),70),
- REPEAT(concat(' tc6_',n+100),60),REPEAT(concat(' tc7_',n+100),60),
- NOW(),(100.55+n+100));
- set @s = concat("INSERT INTO t4",id," VALUES(",n,"+100,",n,"+100,REPEAT(concat(' tc3_',",n,"+100),30), REPEAT(concat(' tc4_',",n,"+100),70),REPEAT(concat(' tc_',",n,"+100),70), REPEAT(concat(' tc6_',",n,"+100),60),REPEAT(concat(' tc7_',",n,"+100),60), NOW(),(100.55+",n,"+100));");
- PREPARE insertIntoTable FROM @s;
- EXECUTE insertIntoTable;
- DEALLOCATE PREPARE insertIntoTable;
- INSERT INTO t4_temp VALUES(n+100,n+100,REPEAT(concat(' tc3_',n+100),30),
- REPEAT(concat(' tc4_',n+100),70),REPEAT(concat(' tc_',n+100),70),
- REPEAT(concat(' tc6_',n+100),60),REPEAT(concat(' tc7_',n+100),60),
- NOW(),(100.55+n+100));
-
-
- DELETE FROM t1_temp WHERE c1 between 100 and 110;
- DELETE FROM t2_temp WHERE c1 between 100 and 110;
- DELETE FROM t3_temp WHERE c1 between 100 and 110;
- DELETE FROM t4_temp WHERE c1 between 100 and 110;
-
- update t1_temp set c1 = c1+1 WHERE c1>110;
- update t2_temp set c1 = c1+1 WHERE c1>110;
- update t3_temp set c1 = c1+1 WHERE c1>110;
- update t4_temp set c1 = c1+1 WHERE c1>110;
-
- savepoint a;
-
- set @s = concat("INSERT INTO t1",id," VALUES(300+",n,"+100,",n,"+100,REPEAT(concat(' tc3_',",n,"+100),30), REPEAT(concat(' tc4_',",n,"+100),70),REPEAT(concat(' tc_',",n,"+100),70), REPEAT(concat(' tc6_',",n,"+100),60),REPEAT(concat(' tc7_',",n,"+100),60), NOW(),(100.55+",n,"+100));");
- PREPARE insertIntoTable FROM @s;
- EXECUTE insertIntoTable;
- DEALLOCATE PREPARE insertIntoTable;
- INSERT INTO t1_temp VALUES(300+n+100,n+100,REPEAT(concat(' tc3_',n+100),30),
- REPEAT(concat(' tc4_',n+100),70),REPEAT(concat(' tc_',n+100),70),
- REPEAT(concat(' tc6_',n+100),60),REPEAT(concat(' tc7_',n+100),60),
- NOW(),(100.55+n+100));
- set @s = concat("INSERT INTO t2",id," VALUES(300+",n,"+100,",n,"+100,REPEAT(concat(' tc3_',",n,"+100),30), REPEAT(concat(' tc4_',",n,"+100),70),REPEAT(concat(' tc_',",n,"+100),70), REPEAT(concat(' tc6_',",n,"+100),60),REPEAT(concat(' tc7_',",n,"+100),60), NOW(),(100.55+",n,"+100));");
- PREPARE insertIntoTable FROM @s;
- EXECUTE insertIntoTable;
- DEALLOCATE PREPARE insertIntoTable;
- INSERT INTO t2_temp VALUES(300+n+100,n+100,REPEAT(concat(' tc3_',n+100),30),
- REPEAT(concat(' tc4_',n+100),70),REPEAT(concat(' tc_',n+100),70),
- REPEAT(concat(' tc6_',n+100),60),REPEAT(concat(' tc7_',n+100),60),
- NOW(),(100.55+n+100));
- set @s = concat("INSERT INTO t3",id," VALUES(300+",n,"+100,",n,"+100,REPEAT(concat(' tc3_',",n,"+100),30), REPEAT(concat(' tc4_',",n,"+100),70),REPEAT(concat(' tc_',",n,"+100),70), REPEAT(concat(' tc6_',",n,"+100),60),REPEAT(concat(' tc7_',",n,"+100),60), NOW(),(100.55+",n,"+100));");
- PREPARE insertIntoTable FROM @s;
- EXECUTE insertIntoTable;
- DEALLOCATE PREPARE insertIntoTable;
- INSERT INTO t3_temp VALUES(300+n+100,n+100,REPEAT(concat(' tc3_',n+100),30),
- REPEAT(concat(' tc4_',n+100),70),REPEAT(concat(' tc_',n+100),70),
- REPEAT(concat(' tc6_',n+100),60),REPEAT(concat(' tc7_',n+100),60),
- NOW(),(100.55+n+100));
- set @s = concat("INSERT INTO t4",id," VALUES(300+",n,"+100,",n,"+100,REPEAT(concat(' tc3_',",n,"+100),30), REPEAT(concat(' tc4_',",n,"+100),70),REPEAT(concat(' tc_',",n,"+100),70), REPEAT(concat(' tc6_',",n,"+100),60),REPEAT(concat(' tc7_',",n,"+100),60), NOW(),(100.55+",n,"+100));");
- PREPARE insertIntoTable FROM @s;
- EXECUTE insertIntoTable;
- DEALLOCATE PREPARE insertIntoTable;
- INSERT INTO t4_temp VALUES(300+n+100,n+100,REPEAT(concat(' tc3_',n+100),30),
- REPEAT(concat(' tc4_',n+100),70),REPEAT(concat(' tc_',n+100),70),
- REPEAT(concat(' tc6_',n+100),60),REPEAT(concat(' tc7_',n+100),60),
- NOW(),(100.55+n+100));
- savepoint b;
-
- set @s = concat("INSERT INTO t1",id," VALUES(400+",n,"+100,",n,"+100,REPEAT(concat(' tc3_',",n,"+100),30), REPEAT(concat(' tc4_',",n,"+100),70),REPEAT(concat(' tc_',",n,"+100),70), REPEAT(concat(' tc6_',",n,"+100),60),REPEAT(concat(' tc7_',",n,"+100),60), NOW(),(100.55+",n,"+100));");
- PREPARE insertIntoTable FROM @s;
- EXECUTE insertIntoTable;
- DEALLOCATE PREPARE insertIntoTable;
- INSERT INTO t1_temp VALUES(400+n+100,n+100,REPEAT(concat(' tc3_',n+100),30),
- REPEAT(concat(' tc4_',n+100),70),REPEAT(concat(' tc_',n+100),70),
- REPEAT(concat(' tc6_',n+100),60),REPEAT(concat(' tc7_',n+100),60),
- NOW(),(100.55+n+100));
- set @s = concat("INSERT INTO t2",id," VALUES(400+",n,"+100,",n,"+100,REPEAT(concat(' tc3_',",n,"+100),30), REPEAT(concat(' tc4_',",n,"+100),70),REPEAT(concat(' tc_',",n,"+100),70), REPEAT(concat(' tc6_',",n,"+100),60),REPEAT(concat(' tc7_',",n,"+100),60), NOW(),(100.55+",n,"+100));");
- PREPARE insertIntoTable FROM @s;
- EXECUTE insertIntoTable;
- DEALLOCATE PREPARE insertIntoTable;
- INSERT INTO t2_temp VALUES(400+n+100,n+100,REPEAT(concat(' tc3_',n+100),30),
- REPEAT(concat(' tc4_',n+100),70),REPEAT(concat(' tc_',n+100),70),
- REPEAT(concat(' tc6_',n+100),60),REPEAT(concat(' tc7_',n+100),60),
- NOW(),(100.55+n+100));
- set @s = concat("INSERT INTO t3",id," VALUES(400+",n,"+100,",n,"+100,REPEAT(concat(' tc3_',",n,"+100),30), REPEAT(concat(' tc4_',",n,"+100),70),REPEAT(concat(' tc_',",n,"+100),70), REPEAT(concat(' tc6_',",n,"+100),60),REPEAT(concat(' tc7_',",n,"+100),60), NOW(),(100.55+",n,"+100));");
- PREPARE insertIntoTable FROM @s;
- EXECUTE insertIntoTable;
- DEALLOCATE PREPARE insertIntoTable;
- INSERT INTO t3_temp VALUES(400+n+100,n+100,REPEAT(concat(' tc3_',n+100),30),
- REPEAT(concat(' tc4_',n+100),70),REPEAT(concat(' tc_',n+100),70),
- REPEAT(concat(' tc6_',n+100),60),REPEAT(concat(' tc7_',n+100),60),
- NOW(),(100.55+n+100));
- set @s = concat("INSERT INTO t4",id," VALUES(400+",n,"+100,",n,"+100,REPEAT(concat(' tc3_',",n,"+100),30), REPEAT(concat(' tc4_',",n,"+100),70),REPEAT(concat(' tc_',",n,"+100),70), REPEAT(concat(' tc6_',",n,"+100),60),REPEAT(concat(' tc7_',",n,"+100),60), NOW(),(100.55+",n,"+100));");
- PREPARE insertIntoTable FROM @s;
- EXECUTE insertIntoTable;
- DEALLOCATE PREPARE insertIntoTable;
- INSERT INTO t4_temp VALUES(400+n+100,n+100,REPEAT(concat(' tc3_',n+100),30),
- REPEAT(concat(' tc4_',n+100),70),REPEAT(concat(' tc_',n+100),70),
- REPEAT(concat(' tc6_',n+100),60),REPEAT(concat(' tc7_',n+100),60),
- NOW(),(100.55+n+100));
- savepoint c;
- rollback to b;
- rollback to a;
- COMMIT;
- COMMIT;
- rollback;
- set n = n - 1;
- end while;
-end|
-delimiter ;|
-
-# Create two client for concurrent execution
-connect (con1,localhost,root,,);
-connect (con2,localhost,root,,);
-
---echo #---client 1 : dml operation ---"
-connection con1;
--- disable_query_log
-eval set global innodb_file_per_table=$innodb_file_per_table_orig;
-
--- enable_query_log
--- disable_query_log
-# call procedure
---send call populate_tables('_1');
--- enable_query_log
-
---echo #---client 2 : dml operation ---"
-connection con2;
--- disable_query_log
-eval set global innodb_file_per_table=$innodb_file_per_table_orig;
--- enable_query_log
--- disable_query_log
-# call procedure
---send call populate_tables('_2');
-
--- enable_query_log
-
-# check data of client connection 1
---echo # In connection 1
-connection con1;
---reap
-# 20 rows exepceted in 5 tables
-SELECT count(*) FROM t1_1;
-SELECT count(*) FROM t2_1;
-SELECT count(*) FROM t3_1;
-SELECT count(*) FROM t4_1;
-SELECT c1 FROM t1_1;
-SELECT c1 FROM t2_1;
-SELECT c1 FROM t3_1;
-SELECT c1 FROM t4_1;
-SELECT count(*) FROM t1_temp;
-SELECT count(*) FROM t2_temp;
-SELECT count(*) FROM t3_temp;
-SELECT count(*) FROM t4_temp;
-SELECT c1 FROM t1_temp;
-SELECT c1 FROM t2_temp;
-SELECT c1 FROM t3_temp;
-SELECT c1 FROM t4_temp;
-# check data of client connection 2
---echo # In connection 2
-connection con2;
---reap
-# 20 rows exepceted in 5 tables
-SELECT count(*) FROM t1_2;
-SELECT count(*) FROM t2_2;
-SELECT count(*) FROM t3_2;
-SELECT count(*) FROM t4_2;
-SELECT c1 FROM t1_2;
-SELECT c1 FROM t2_2;
-SELECT c1 FROM t3_2;
-SELECT c1 FROM t4_2;
-SELECT count(*) FROM t1_temp;
-SELECT count(*) FROM t2_temp;
-SELECT count(*) FROM t3_temp;
-SELECT count(*) FROM t4_temp;
-SELECT c1 FROM t1_temp;
-SELECT c1 FROM t2_temp;
-SELECT c1 FROM t3_temp;
-SELECT c1 FROM t4_temp;
-
---echo # In connection 1
-connection con1;
-
-set AUTOCOMMIT = 0;
-ALTER TABLE t1_temp DROP PRIMARY KEY;
-ALTER TABLE t1_temp ADD PRIMARY KEY (c1);
-ALTER TABLE t2_temp DROP PRIMARY KEY;
-ALTER TABLE t2_temp ADD PRIMARY KEY (c1);
-ALTER TABLE t3_temp DROP PRIMARY KEY;
-ALTER TABLE t3_temp ADD PRIMARY KEY (c1);
-ALTER TABLE t4_temp DROP PRIMARY KEY;
-ALTER TABLE t4_temp ADD PRIMARY KEY (c1);
-# Check duplicate key constraint + insert ignore
---error ER_DUP_ENTRY
-INSERT INTO t1_temp VALUES (20,1,'a','a','a','a','a',NOW(),100.55);
-insert ignore into t1_temp VALUES (20,1,'a','a','a','a','a',NOW(),100.55);
---error ER_DUP_ENTRY
-INSERT INTO t2_temp VALUES (20,1,'a','a','a','a','a',NOW(),100.55);
-insert ignore into t2_temp VALUES (20,1,'a','a','a','a','a',NOW(),100.55);
---error ER_DUP_ENTRY
-INSERT INTO t3_temp VALUES (20,1,'a','a','a','a','a',NOW(),100.55);
-insert ignore into t3_temp VALUES (20,1,'a','a','a','a','a',NOW(),100.55);
---error ER_DUP_ENTRY
-INSERT INTO t4_temp VALUES (20,1,'a','a','a','a','a',NOW(),100.55);
-insert ignore into t4_temp VALUES (20,1,'a','a','a','a','a',NOW(),100.55);
-
-# check rollback due to duplicate value in second record of insert
---error ER_DUP_ENTRY
-INSERT INTO t1_temp VALUES (1,1,'a','a','a','a','a',NOW(),100.55),
-(20,1,'a','a','a','a','a',NOW(),100.55);
---error ER_DUP_ENTRY
-INSERT INTO t2_temp VALUES (1,1,'a','a','a','a','a',NOW(),100.55),
-(20,1,'a','a','a','a','a',NOW(),100.55);
---error ER_DUP_ENTRY
-INSERT INTO t3_temp VALUES (1,1,'a','a','a','a','a',NOW(),100.55),
-(20,1,'a','a','a','a','a',NOW(),100.55);
---error ER_DUP_ENTRY
-INSERT INTO t4_temp VALUES (1,1,'a','a','a','a','a',NOW(),100.55),
-(20,1,'a','a','a','a','a',NOW(),100.55);
-
-set AUTOCOMMIT = 1;
-
-SELECT c1,c2 FROM t1_temp WHERE c1 in (20,1);
-SELECT c1,c2 FROM t2_temp WHERE c1 in (20,1);
-SELECT c1,c2 FROM t3_temp WHERE c1 in (20,1);
-SELECT c1,c2 FROM t4_temp WHERE c1 in (20,1);
-
-#replace statement
-REPLACE INTO t1_temp VALUES (20,1,'a','a','a','a','a',NOW(),100.55);
-REPLACE INTO t2_temp VALUES (20,1,'a','a','a','a','a',NOW(),100.55);
-REPLACE INTO t3_temp VALUES (20,1,'a','a','a','a','a',NOW(),100.55);
-REPLACE INTO t4_temp VALUES (20,1,'a','a','a','a','a',NOW(),100.55);
-# verify row is replaced FROM (20,20) to (20,1)
-SELECT c1,c2,c3,c4,c5,c6,c7,c9 FROM t1_temp WHERE c1 = 20;
-SELECT c1,c2,c3,c4,c5,c6,c7,c9 FROM t2_temp WHERE c1 = 20;
-SELECT c1,c2,c3,c4,c5,c6,c7,c9 FROM t3_temp WHERE c1 = 20;
-SELECT c1,c2,c3,c4,c5,c6,c7,c9 FROM t4_temp WHERE c1 = 20;
-
-# Update ignore. statement is gonored as 20 value exits
-update ignore t1_temp set c1 = 20 WHERE c1 = 140 ;
-update ignore t2_temp set c1 = 20 WHERE c1 = 140 ;
-update ignore t3_temp set c1 = 20 WHERE c1 = 140 ;
-update ignore t4_temp set c1 = 20 WHERE c1 = 140 ;
-# see record 140 is present as last update ignored
-SELECT count(*) FROM t1_temp WHERE c1 = 140;
-SELECT count(*) FROM t2_temp WHERE c1 = 140;
-SELECT count(*) FROM t3_temp WHERE c1 = 140;
-SELECT count(*) FROM t4_temp WHERE c1 = 140;
-
-# Alter table to ADD COLUMN and PRIMARY KEY
-ALTER TABLE t1_temp ADD COLUMN c10 int default 99 ,
-ADD COLUMN c11 varchar(100) default 'test';
-ALTER TABLE t1_temp DROP PRIMARY KEY;
-ALTER TABLE t1_temp ADD PRIMARY KEY (c1);
-INSERT INTO t1_temp (c1,c2,c3,c4,c5,c6,c7,c8,c9) VALUES (-1,-1,'a','a','a','a','a',NOW(),100.55);
-SELECT c1,c2,c3,c4,c5,c6,c7,c9,c10,c11 FROM t1_temp WHERE c1 < 0;
-SELECT count(*) FROM t1_temp WHERE c10 = 99 and c11 like 'test';
-# insert on duplicate key update
-INSERT INTO t1_temp (c1,c2,c3,c4,c5,c6,c7,c8,c9) VALUES (-1,-1,'a','a','a','a','a',NOW(),100.55)
-ON DUPLICATE KEY UPDATE c1=-2,c2=-2;
-SELECT c1,c2,c3,c4,c5,c6,c7,c9,c10,c11 FROM t1_temp WHERE c1 < 0;
-
-#
-
-#cleanup
-DROP TABLE t1_1 ,t2_1 ,t3_1,t4_1;
-disconnect con1;
-
-connection con2;
-DROP TABLE t1_2 ,t2_2 ,t3_2,t4_2;
-disconnect con2;
-
-
-connection default;
-#
-## trying with VALUES innodb_undo_tablespaces, innodb_undo_logs ,innodb_log_files_in_group
-##
-let $restart_parameters=--innodb_undo_tablespaces=0 --innodb_rollback_segments=20 --innodb_undo_logs=20 --innodb_log_files_in_group=4;
---source include/restart_mysqld.inc
-
-# Create two client for concurrent execution
-connect (con1,localhost,root,,);
-connect (con2,localhost,root,,);
-#
-#
-connection con1;
---send call populate_tables('_1');
-connection con2;
---send call populate_tables('_2');
---echo "#connection 1 - verify tables"
-connection con1;
---reap
-SELECT count(*) FROM t1_1;
-SELECT count(*) FROM t2_1;
-SELECT count(*) FROM t3_1;
-SELECT count(*) FROM t4_1;
-SELECT c1 FROM t1_1;
-SELECT c1 FROM t2_1;
-SELECT c1 FROM t3_1;
-SELECT c1 FROM t4_1;
-SELECT count(*) FROM t1_temp;
-SELECT count(*) FROM t2_temp;
-SELECT count(*) FROM t3_temp;
-SELECT count(*) FROM t4_temp;
-SELECT c1 FROM t1_temp;
-SELECT c1 FROM t2_temp;
-SELECT c1 FROM t3_temp;
-SELECT c1 FROM t4_temp;
-DROP TABLE t1_1 ,t2_1 ,t3_1,t4_1;
-disconnect con1;
---echo "#connection 2 - verify tables"
-connection con2;
---reap
-SELECT count(*) FROM t1_2;
-SELECT count(*) FROM t2_2;
-SELECT count(*) FROM t3_2;
-SELECT count(*) FROM t4_2;
-SELECT c1 FROM t1_2;
-SELECT c1 FROM t2_2;
-SELECT c1 FROM t3_2;
-SELECT c1 FROM t4_2;
-SELECT count(*) FROM t1_temp;
-SELECT count(*) FROM t2_temp;
-SELECT count(*) FROM t3_temp;
-SELECT count(*) FROM t4_temp;
-SELECT c1 FROM t1_temp;
-SELECT c1 FROM t2_temp;
-SELECT c1 FROM t3_temp;
-SELECT c1 FROM t4_temp;
-DROP TABLE t1_2 ,t2_2 ,t3_2,t4_2;
-disconnect con2;
-
-connection default;
-# innodb_undo_logs > non redo rsegment
-let $restart_parameters=--innodb_undo_tablespaces=0 --innodb_rollback_segments=30 --innodb_undo_logs=20 --innodb_log_files_in_group=4;
---source include/restart_mysqld.inc
-
-connect (con1,localhost,root,,);
-connect (con2,localhost,root,,);
-
-connection con1;
---send call populate_tables('_1');
-connection con2;
---send call populate_tables('_2');
---echo "#connection 1 - verify tables"
-connection con1;
---reap
-SELECT count(*) FROM t1_1;
-SELECT count(*) FROM t2_1;
-SELECT count(*) FROM t3_1;
-SELECT count(*) FROM t4_1;
-SELECT c1 FROM t1_1;
-SELECT c1 FROM t2_1;
-SELECT c1 FROM t3_1;
-SELECT c1 FROM t4_1;
-SELECT count(*) FROM t1_temp;
-SELECT count(*) FROM t2_temp;
-SELECT count(*) FROM t3_temp;
-SELECT count(*) FROM t4_temp;
-SELECT c1 FROM t1_temp;
-SELECT c1 FROM t2_temp;
-SELECT c1 FROM t3_temp;
-SELECT c1 FROM t4_temp;
-DROP TABLE t1_1 ,t2_1 ,t3_1,t4_1;
-disconnect con1;
---echo "#connection 2 - verify tables"
-connection con2;
---reap
-SELECT count(*) FROM t1_2;
-SELECT count(*) FROM t2_2;
-SELECT count(*) FROM t3_2;
-SELECT count(*) FROM t4_2;
-SELECT c1 FROM t1_2;
-SELECT c1 FROM t2_2;
-SELECT c1 FROM t3_2;
-SELECT c1 FROM t4_2;
-SELECT count(*) FROM t1_temp;
-SELECT count(*) FROM t2_temp;
-SELECT count(*) FROM t3_temp;
-SELECT count(*) FROM t4_temp;
-SELECT c1 FROM t1_temp;
-SELECT c1 FROM t2_temp;
-SELECT c1 FROM t3_temp;
-SELECT c1 FROM t4_temp;
-DROP TABLE t1_2 ,t2_2 ,t3_2,t4_2;
-disconnect con2;
-
-#
-
-connection default;
-DROP PROCEDURE populate_tables;
-
-# check message in log
-let $error_log= $MYSQLTEST_VARDIR/log/my_restart.err;
-let SEARCH_FILE= $error_log;
-# We get depending on the platform either "./ibdata1" or ".\ibdata1".
-let SEARCH_PATTERN=redo rollback segment.*found.*redo rollback segment.*active
---source include/search_pattern_in_file.inc
-let SEARCH_PATTERN=non-redo rollback.*active
---source include/search_pattern_in_file.inc
-
-
-SHOW TABLES;
-
--- disable_query_log
-eval set global innodb_file_per_table=$innodb_file_per_table_orig;
--- enable_query_log
-
diff --git a/mysql-test/suite/json/r/json_no_table.result b/mysql-test/suite/json/r/json_no_table.result
new file mode 100644
index 00000000000..97148bdad43
--- /dev/null
+++ b/mysql-test/suite/json/r/json_no_table.result
@@ -0,0 +1,3622 @@
+SELECT CAST(0.0e0 AS JSON) = -0.0e0;
+CAST(0.0e0 AS JSON) = -0.0e0
+1
+SELECT CAST(CAST(0 AS DECIMAL) AS JSON) = CAST(-0.0e0 AS DECIMAL);
+CAST(CAST(0 AS DECIMAL) AS JSON) = CAST(-0.0e0 AS DECIMAL)
+1
+SELECT CAST(0.0e0 AS JSON) = CAST(-0.0e0 AS DECIMAL);
+CAST(0.0e0 AS JSON) = CAST(-0.0e0 AS DECIMAL)
+1
+SELECT CAST(CAST(0 AS DECIMAL) AS JSON) = -0.0e0;
+CAST(CAST(0 AS DECIMAL) AS JSON) = -0.0e0
+1
+SELECT CAST(CAST(0 AS SIGNED) AS JSON) = -0.0e0;
+CAST(CAST(0 AS SIGNED) AS JSON) = -0.0e0
+1
+SELECT CAST(CAST(0 AS SIGNED) AS JSON) = CAST(-0.0e0 AS DECIMAL);
+CAST(CAST(0 AS SIGNED) AS JSON) = CAST(-0.0e0 AS DECIMAL)
+1
+SELECT CAST(CAST(0 AS UNSIGNED) AS JSON) = -0.0e0;
+CAST(CAST(0 AS UNSIGNED) AS JSON) = -0.0e0
+1
+SELECT CAST(CAST(0 AS UNSIGNED) AS JSON) = CAST(-0.0e0 AS DECIMAL);
+CAST(CAST(0 AS UNSIGNED) AS JSON) = CAST(-0.0e0 AS DECIMAL)
+1
+select cast('"abc"' as json);
+cast('"abc"' as json)
+"abc"
+error ER_INVALID_JSON_TEXT_IN_PARAM
+select cast('abc' as json);
+cast('abc' as json)
+abc
+
+# String literal - valid JSON
+select JSON_VALID('123');
+JSON_VALID('123')
+1
+select JSON_VALID('-123');
+JSON_VALID('-123')
+1
+select JSON_VALID('5000000000');
+JSON_VALID('5000000000')
+1
+select JSON_VALID('-5000000000');
+JSON_VALID('-5000000000')
+1
+select JSON_VALID('1.23');
+JSON_VALID('1.23')
+1
+select JSON_VALID('"123"');
+JSON_VALID('"123"')
+1
+select JSON_VALID('true');
+JSON_VALID('true')
+1
+select JSON_VALID('false');
+JSON_VALID('false')
+1
+select JSON_VALID('null');
+JSON_VALID('null')
+1
+select JSON_VALID('{"address": "Trondheim"}');
+JSON_VALID('{"address": "Trondheim"}')
+1
+
+# String literal - not valid JSON
+select JSON_VALID('12 3');
+JSON_VALID('12 3')
+0
+
+# String literal not in UTF-8
+set names 'ascii';
+select JSON_VALID('123');
+JSON_VALID('123')
+1
+set names 'utf8';
+
+# Json expression
+select JSON_VALID(cast('[123]' as JSON ));
+JSON_VALID(cast('[123]' as JSON ))
+1
+
+# Json expression NULL
+select JSON_VALID(cast(NULL as JSON ));
+JSON_VALID(cast(NULL as JSON ))
+NULL
+
+# Bare NULL
+select JSON_VALID( NULL );
+JSON_VALID( NULL )
+NULL
+
+# Function result - string
+select JSON_VALID( UPPER('"abc"') );
+JSON_VALID( UPPER('"abc"') )
+1
+set names 'latin1';
+
+# Function result - string
+select JSON_VALID( UPPER('"abc"') );
+JSON_VALID( UPPER('"abc"') )
+1
+set names 'utf8';
+
+# Function result - date, not valid as JSON without CAST
+select JSON_VALID( CAST('2015-01-15' AS DATE) );
+JSON_VALID( CAST('2015-01-15' AS DATE) )
+0
+
+# The date string doesn't parse as JSON text, so wrong:
+select JSON_VALID( CAST(CAST('2015-01-15' AS DATE) as CHAR CHARACTER SET 'utf8') );
+JSON_VALID( CAST(CAST('2015-01-15' AS DATE) as CHAR CHARACTER SET 'utf8') )
+0
+# OK, though:
+select JSON_VALID( CAST(CURDATE() as JSON) );
+JSON_VALID( CAST(CURDATE() as JSON) )
+0
+
+# Function result - NULL
+select JSON_VALID( UPPER(NULL) );
+JSON_VALID( UPPER(NULL) )
+NULL
+select JSON_VALID( UPPER(CAST(NULL as CHAR)) );
+JSON_VALID( UPPER(CAST(NULL as CHAR)) )
+NULL
+SELECT JSON_VALID( '{ "firstName" : "Fred", "lastName" : "Flintstone" }' );
+JSON_VALID( '{ "firstName" : "Fred", "lastName" : "Flintstone" }' )
+1
+SELECT JSON_VALID( '3' );
+JSON_VALID( '3' )
+1
+SELECT JSON_VALID( null );
+JSON_VALID( null )
+NULL
+# ----------------------------------------------------------------------
+# Test of JSON_CONTAINS_PATH function.
+# ----------------------------------------------------------------------
+select json_contains_path();
+ERROR 42000: Incorrect parameter count in the call to native function 'json_contains_path'
+select json_contains_path('{ "a": true }' );
+ERROR 42000: Incorrect parameter count in the call to native function 'json_contains_path'
+select json_contains_path('{ "a": true }', 'all' );
+ERROR 42000: Incorrect parameter count in the call to native function 'json_contains_path'
+error ER_INVALID_JSON_TEXT_IN_PARAM
+select json_contains_path('{ "a": tru }', 'all', '$' );
+json_contains_path('{ "a": tru }', 'all', '$' )
+NULL
+Warnings:
+Warning 4038 Syntax error in JSON text in argument 1 to function 'json_contains_path' at position 10
+error ER_INVALID_JSON_PATH
+select json_contains_path('{ "a": true }', 'all', '$[' );
+json_contains_path('{ "a": true }', 'all', '$[' )
+NULL
+Warnings:
+Warning 4041 Unexpected end of JSON path in argument 3 to function 'json_contains_path'
+error ER_INVALID_JSON_PATH
+select json_contains_path('{ "a": true }', 'all', '$a.***[3]' );
+json_contains_path('{ "a": true }', 'all', '$a.***[3]' )
+NULL
+Warnings:
+Warning 4042 Syntax error in JSON path in argument 3 to function 'json_contains_path' at position 2
+error ER_JSON_BAD_ONE_OR_ALL_ARG
+select json_contains_path('{ "a": true }', 'foo', '$.a' );
+json_contains_path('{ "a": true }', 'foo', '$.a' )
+NULL
+Warnings:
+Warning 4046 Argument 2 to function 'json_contains_path' must be "one" or "all".
+error ER_INVALID_JSON_CHARSET
+select json_contains_path('{}', 'all', cast('$' as binary));
+json_contains_path('{}', 'all', cast('$' as binary))
+1
+select json_contains_path(null, 'all', '$.a' );
+json_contains_path(null, 'all', '$.a' )
+NULL
+select json_contains_path('{ "a": true }', null, '$.a' );
+json_contains_path('{ "a": true }', null, '$.a' )
+NULL
+select json_contains_path('{ "a": true }', 'all', null );
+json_contains_path('{ "a": true }', 'all', null )
+NULL
+select json_contains_path('{ "a": true }', 'all', '$' );
+json_contains_path('{ "a": true }', 'all', '$' )
+1
+select json_contains_path('{ "a": true }', 'all', '$.a' );
+json_contains_path('{ "a": true }', 'all', '$.a' )
+1
+select json_contains_path('{ "a": true }', 'one', '$.a' );
+json_contains_path('{ "a": true }', 'one', '$.a' )
+1
+select json_contains_path('{ "a": true }', 'all', '$.b' );
+json_contains_path('{ "a": true }', 'all', '$.b' )
+0
+select json_contains_path('{ "a": true }', 'one', '$.b' );
+json_contains_path('{ "a": true }', 'one', '$.b' )
+0
+select json_contains_path('{ "a": true }', 'all', '$.a', '$.b' );
+json_contains_path('{ "a": true }', 'all', '$.a', '$.b' )
+0
+select json_contains_path('{ "a": true }', 'all', '$.b', '$.a' );
+json_contains_path('{ "a": true }', 'all', '$.b', '$.a' )
+0
+select json_contains_path('{ "a": true }', 'ALL', '$.a', '$.b' );
+json_contains_path('{ "a": true }', 'ALL', '$.a', '$.b' )
+0
+select json_contains_path('{ "a": true }', 'aLl', '$.a', '$.b' );
+json_contains_path('{ "a": true }', 'aLl', '$.a', '$.b' )
+0
+select json_contains_path('{ "a": true }', 'one', '$.a', '$.b' );
+json_contains_path('{ "a": true }', 'one', '$.a', '$.b' )
+1
+select json_contains_path('{ "a": true }', 'one', '$.b', '$.a' );
+json_contains_path('{ "a": true }', 'one', '$.b', '$.a' )
+1
+select json_contains_path('{ "a": true }', 'ONE', '$.a', '$.b' );
+json_contains_path('{ "a": true }', 'ONE', '$.a', '$.b' )
+1
+select json_contains_path('{ "a": true }', 'oNe', '$.a', '$.b' );
+json_contains_path('{ "a": true }', 'oNe', '$.a', '$.b' )
+1
+select json_contains_path('{ "a": true, "b": [ 1, 2, { "c": [ 4, 5, { "d": [ 6, 7, 8, 9, 10 ]} ] } ] }', 'all', '$**[4]' );
+json_contains_path('{ "a": true, "b": [ 1, 2, { "c": [ 4, 5, { "d": [ 6, 7, 8, 9, 10 ]} ] } ] }', 'all', '$**[4]' )
+1
+select json_contains_path('{ "a": true, "b": [ 1, 2, { "c": [ 4, 5, { "d": [ 6, 7, 8, 9, 10 ]} ] } ] }', 'all', '$**[4]', '$**[5]' );
+json_contains_path('{ "a": true, "b": [ 1, 2, { "c": [ 4, 5, { "d": [ 6, 7, 8, 9, 10 ]} ] } ] }', 'all', '$**[4]', '$**[5]' )
+0
+select json_contains_path('{ "a": true, "b": [ 1, 2, { "c": [ 4, 5, { "d": [ 6, 7, 8, 9, 10 ]} ] } ] }', 'all', '$**.c[2]' );
+json_contains_path('{ "a": true, "b": [ 1, 2, { "c": [ 4, 5, { "d": [ 6, 7, 8, 9, 10 ]} ] } ] }', 'all', '$**.c[2]' )
+1
+select json_contains_path('{ "a": true, "b": [ 1, 2, { "c": [ 4, 5, { "d": [ 6, 7, 8, 9, 10 ]} ] } ] }', 'all', '$**.c[3]' );
+json_contains_path('{ "a": true, "b": [ 1, 2, { "c": [ 4, 5, { "d": [ 6, 7, 8, 9, 10 ]} ] } ] }', 'all', '$**.c[3]' )
+0
+select json_contains_path('{"a":1, "b":2}', 'one', '$.*');
+json_contains_path('{"a":1, "b":2}', 'one', '$.*')
+1
+select json_contains_path('[1,2,3]', 'one', '$.*');
+json_contains_path('[1,2,3]', 'one', '$.*')
+0
+select json_contains_path('{}', 'one', '$[*]');
+json_contains_path('{}', 'one', '$[*]')
+0
+SELECT JSON_CONTAINS_PATH('[1, [[{"x": [{"a":{"b":{"c":42}}}]}]]]',
+'one', '$**.a.*');
+JSON_CONTAINS_PATH('[1, [[{"x": [{"a":{"b":{"c":42}}}]}]]]',
+'one', '$**.a.*')
+1
+SELECT JSON_CONTAINS_PATH('[1, [[{"x": [{"a":{"b":{"c":42}}}]}]]]',
+'all', '$**.a.*');
+JSON_CONTAINS_PATH('[1, [[{"x": [{"a":{"b":{"c":42}}}]}]]]',
+'all', '$**.a.*')
+1
+SELECT JSON_CONTAINS_PATH('[1,2,3]', 'one', '$**[*]');
+JSON_CONTAINS_PATH('[1,2,3]', 'one', '$**[*]')
+1
+SELECT JSON_CONTAINS_PATH('[1,2,3]', 'all', '$**[*]');
+JSON_CONTAINS_PATH('[1,2,3]', 'all', '$**[*]')
+1
+select json_contains_path('{ "a": true, "b": [ 1, 2 ] }', 'all', '$**[1]', '$.b[0]', '$.c' );
+json_contains_path('{ "a": true, "b": [ 1, 2 ] }', 'all', '$**[1]', '$.b[0]', '$.c' )
+0
+select json_contains_path('{ "a": true, "b": [ 1, 2 ] }', 'all', '$.c', '$**[1]', '$.b[0]' );
+json_contains_path('{ "a": true, "b": [ 1, 2 ] }', 'all', '$.c', '$**[1]', '$.b[0]' )
+0
+select json_contains_path('{ "a": true, "b": [ 1, 2 ] }', 'all', '$.b[0]', '$.c', '$**[1]' );
+json_contains_path('{ "a": true, "b": [ 1, 2 ] }', 'all', '$.b[0]', '$.c', '$**[1]' )
+0
+select json_contains_path('{ "a": true, "b": [ 1, 2 ] }', 'one', '$**[1]', '$.b[0]', '$.c' );
+json_contains_path('{ "a": true, "b": [ 1, 2 ] }', 'one', '$**[1]', '$.b[0]', '$.c' )
+1
+select json_contains_path('{ "a": true, "b": [ 1, 2 ] }', 'one', '$.c', '$**[1]', '$.b[0]' );
+json_contains_path('{ "a": true, "b": [ 1, 2 ] }', 'one', '$.c', '$**[1]', '$.b[0]' )
+1
+select json_contains_path('{ "a": true, "b": [ 1, 2 ] }', 'one', '$.b[0]', '$.c', '$**[1]' );
+json_contains_path('{ "a": true, "b": [ 1, 2 ] }', 'one', '$.b[0]', '$.c', '$**[1]' )
+1
+SELECT JSON_CONTAINS_PATH
+(
+'{ "a" : 123, "b" : [ 123, 456 ] }',
+'all',
+'$.a.c',
+'$.b[1]'
+);
+JSON_CONTAINS_PATH
+(
+'{ "a" : 123, "b" : [ 123, 456 ] }',
+'all',
+'$.a.c',
+'$.b[1]'
+)
+0
+SELECT JSON_CONTAINS_PATH
+(
+'{ "a" : 123, "b" : [ 123, 456 ] }',
+'one',
+'$.a.c',
+'$.b[1]'
+);
+JSON_CONTAINS_PATH
+(
+'{ "a" : 123, "b" : [ 123, 456 ] }',
+'one',
+'$.a.c',
+'$.b[1]'
+)
+1
+SELECT JSON_CONTAINS_PATH
+(
+'{ "a" : 123, "b" : [ 123, 456 ] }',
+'all',
+'$.c'
+);
+JSON_CONTAINS_PATH
+(
+'{ "a" : 123, "b" : [ 123, 456 ] }',
+'all',
+'$.c'
+)
+0
+SELECT JSON_CONTAINS_PATH
+(
+'{ "a" : 123, "b" : [ 123, { "c" : { "d" : true } } ] }',
+'all',
+'$.b[1].c.d'
+);
+JSON_CONTAINS_PATH
+(
+'{ "a" : 123, "b" : [ 123, { "c" : { "d" : true } } ] }',
+'all',
+'$.b[1].c.d'
+)
+1
+select json_length( null );
+json_length( null )
+NULL
+select json_length( '1' );
+json_length( '1' )
+1
+
+# invalid json text
+error ER_INVALID_JSON_TEXT_IN_PARAM
+select json_length( 'abc' );
+json_length( 'abc' )
+NULL
+Warnings:
+Warning 4038 Syntax error in JSON text in argument 1 to function 'json_length' at position 1
+select json_length( '"abc"' );
+json_length( '"abc"' )
+1
+select json_length( 'true' );
+json_length( 'true' )
+1
+select json_length( 'false' );
+json_length( 'false' )
+1
+select json_length( 'null' );
+json_length( 'null' )
+1
+select json_length( '{}' );
+json_length( '{}' )
+0
+select json_length( '{ "a" : 100, "b" : 200 }' );
+json_length( '{ "a" : 100, "b" : 200 }' )
+2
+select json_length( '{ "a" : 100, "b" : [ 300, 400, 500 ] }' );
+json_length( '{ "a" : 100, "b" : [ 300, 400, 500 ] }' )
+2
+select json_length( '[]' );
+json_length( '[]' )
+0
+select json_length( '[ null, "foo", true, 1.1 ]' );
+json_length( '[ null, "foo", true, 1.1 ]' )
+4
+select json_length( '[ null, "foo", true, { "a" : "b", "c" : "d" } ]' );
+json_length( '[ null, "foo", true, { "a" : "b", "c" : "d" } ]' )
+4
+select json_length( '"foo"' );
+json_length( '"foo"' )
+1
+select json_length( '1.2' );
+json_length( '1.2' )
+1
+
+# invalid json path
+error ER_INVALID_JSON_PATH
+select json_length( 'true', 'c$' );
+json_length( 'true', 'c$' )
+NULL
+Warnings:
+Warning 4042 Syntax error in JSON path in argument 2 to function 'json_length' at position 1
+
+# invalid json path
+error ER_INVALID_JSON_PATH
+select json_length( '{ "foo" : [ true, false ] }', '$.foo[bar]' );
+json_length( '{ "foo" : [ true, false ] }', '$.foo[bar]' )
+NULL
+Warnings:
+Warning 4042 Syntax error in JSON path in argument 2 to function 'json_length' at position 7
+
+# wildcards not allowed in path expressions for this function
+error ER_INVALID_JSON_PATH_WILDCARD
+select json_length( 'true', '$.*' );
+json_length( 'true', '$.*' )
+NULL
+Warnings:
+Warning 4044 Wildcards in JSON path not allowed in argument 2 to function 'json_length'
+
+# wildcards not allowed in path expressions for this function
+error ER_INVALID_JSON_PATH_WILDCARD
+select json_length( 'true', '$.foo**.bar' );
+json_length( 'true', '$.foo**.bar' )
+NULL
+Warnings:
+Warning 4044 Wildcards in JSON path not allowed in argument 2 to function 'json_length'
+select json_length( '[ 1, [ 2, 3, 4 ], 5 ]', '$[0]' );
+json_length( '[ 1, [ 2, 3, 4 ], 5 ]', '$[0]' )
+1
+select json_length( '[ 1, [ 2, 3, 4 ], 5 ]', '$[1]' );
+json_length( '[ 1, [ 2, 3, 4 ], 5 ]', '$[1]' )
+3
+select json_length( '[ 1, [ 2, 3, 4 ], 5 ]', '$[2]' );
+json_length( '[ 1, [ 2, 3, 4 ], 5 ]', '$[2]' )
+1
+select json_length( '[ 1, [ 2, 3, 4 ], 5 ]', '$[2][0]' );
+json_length( '[ 1, [ 2, 3, 4 ], 5 ]', '$[2][0]' )
+1
+select json_length( '[ 1, [ 2, 3, 4 ], {"a": 1} ]', '$[2][0]' );
+json_length( '[ 1, [ 2, 3, 4 ], {"a": 1} ]', '$[2][0]' )
+1
+select json_length( '[ 1, [ 2, 3, 4 ], 5 ]', '$[2][1]' );
+json_length( '[ 1, [ 2, 3, 4 ], 5 ]', '$[2][1]' )
+NULL
+select json_length( '[ 1, { "a": true, "b": false, "c": null }, 5 ]', '$[1]' );
+json_length( '[ 1, { "a": true, "b": false, "c": null }, 5 ]', '$[1]' )
+3
+SELECT JSON_LENGTH
+(
+'{}'
+);
+JSON_LENGTH
+(
+'{}'
+)
+0
+SELECT JSON_LENGTH
+(
+'3'
+);
+JSON_LENGTH
+(
+'3'
+)
+1
+SELECT JSON_LENGTH
+(
+'{ "a" : 123, "b" : [ 123, 456, 789 ] }'
+);
+JSON_LENGTH
+(
+'{ "a" : 123, "b" : [ 123, 456, 789 ] }'
+)
+2
+SELECT JSON_LENGTH
+(
+'{ "a" : 123, "b" : [ 123, 456, 789 ] }',
+'$.b'
+);
+JSON_LENGTH
+(
+'{ "a" : 123, "b" : [ 123, 456, 789 ] }',
+'$.b'
+)
+3
+SELECT JSON_LENGTH
+(
+'{ "a" : 123, "b" : [ 123, 456, 789 ] }',
+'$.c'
+);
+JSON_LENGTH
+(
+'{ "a" : 123, "b" : [ 123, 456, 789 ] }',
+'$.c'
+)
+NULL
+# ----------------------------------------------------------------------
+# Test of JSON_DEPTH function.
+# ----------------------------------------------------------------------
+select json_depth(null);
+json_depth(null)
+NULL
+select json_depth(cast(null as json));
+json_depth(cast(null as json))
+NULL
+select json_depth(cast('[]' as json)),
+json_depth(cast('{}' as json)),
+json_depth(cast('null' as json)),
+json_depth(json_quote('foo'));
+json_depth(cast('[]' as json)) json_depth(cast('{}' as json)) json_depth(cast('null' as json)) json_depth(json_quote('foo'))
+1 1 1 1
+select json_depth(cast('[[2], 3, [[[4]]]]' as json));
+json_depth(cast('[[2], 3, [[[4]]]]' as json))
+5
+select json_depth(cast('{"a": {"a1": [3]}, "b": {"b1": {"c": {"d": [5]}}}}' as json));
+json_depth(cast('{"a": {"a1": [3]}, "b": {"b1": {"c": {"d": [5]}}}}' as json))
+6
+SELECT JSON_DEPTH
+(
+'{}'
+);
+JSON_DEPTH
+(
+'{}'
+)
+1
+SELECT JSON_DEPTH
+(
+'[]'
+);
+JSON_DEPTH
+(
+'[]'
+)
+1
+SELECT JSON_DEPTH( '"abc"' );
+JSON_DEPTH( '"abc"' )
+1
+SELECT JSON_DEPTH( CAST( '"abc"' AS JSON ) );
+JSON_DEPTH( CAST( '"abc"' AS JSON ) )
+1
+error ER_INVALID_TYPE_FOR_JSON
+SELECT JSON_DEPTH( 1 );
+JSON_DEPTH( 1 )
+1
+error ER_INVALID_JSON_TEXT_IN_PARAM
+SELECT JSON_DEPTH( 'abc' );
+JSON_DEPTH( 'abc' )
+NULL
+Warnings:
+Warning 4038 Syntax error in JSON text in argument 1 to function 'json_depth' at position 1
+SELECT JSON_DEPTH( CAST( 1 AS JSON ) );
+JSON_DEPTH( CAST( 1 AS JSON ) )
+1
+SELECT JSON_DEPTH
+(
+'{ "a" : true, "b" : false, "c" : null }'
+);
+JSON_DEPTH
+(
+'{ "a" : true, "b" : false, "c" : null }'
+)
+2
+SELECT JSON_DEPTH
+(
+'[ "a", true, "b" , false, "c" , null ]'
+);
+JSON_DEPTH
+(
+'[ "a", true, "b" , false, "c" , null ]'
+)
+2
+SELECT JSON_DEPTH
+(
+'{ "a" : true, "b" : {}, "c" : null }'
+);
+JSON_DEPTH
+(
+'{ "a" : true, "b" : {}, "c" : null }'
+)
+2
+SELECT JSON_DEPTH
+(
+'[ "a", true, "b" , {}, "c" , null ]'
+);
+JSON_DEPTH
+(
+'[ "a", true, "b" , {}, "c" , null ]'
+)
+2
+SELECT JSON_DEPTH
+(
+'{ "a" : true, "b" : { "e" : false }, "c" : null }'
+);
+JSON_DEPTH
+(
+'{ "a" : true, "b" : { "e" : false }, "c" : null }'
+)
+3
+SELECT JSON_DEPTH
+(
+'[ "a", true, "b" , { "e" : false }, "c" , null ]'
+);
+JSON_DEPTH
+(
+'[ "a", true, "b" , { "e" : false }, "c" , null ]'
+)
+3
+error ER_INVALID_JSON_TEXT_IN_PARAM
+SELECT JSON_DEPTH
+(
+'[ "a", true, "b" , { "e" : false }, "c" , null'
+);
+JSON_DEPTH
+(
+'[ "a", true, "b" , { "e" : false }, "c" , null'
+)
+NULL
+Warnings:
+Warning 4037 Unexpected end of JSON text in argument 1 to function 'json_depth'
+# ----------------------------------------------------------------------
+# Test of JSON_REMOVE function.
+# ----------------------------------------------------------------------
+select json_remove( null, '$[1]' );
+json_remove( null, '$[1]' )
+NULL
+select json_remove( null, '$[1]' ) is null;
+json_remove( null, '$[1]' ) is null
+1
+select json_remove( '[ 1, { "a": true, "b": false, "c": null }, 5 ]', null );
+json_remove( '[ 1, { "a": true, "b": false, "c": null }, 5 ]', null )
+NULL
+select json_remove( '[ 1, { "a": true, "b": false, "c": null }, 5 ]', null ) is null;
+json_remove( '[ 1, { "a": true, "b": false, "c": null }, 5 ]', null ) is null
+1
+select json_remove( '[ 1, { "a": true, "b": false, "c": null }, 5 ]', '$[1]', null );
+json_remove( '[ 1, { "a": true, "b": false, "c": null }, 5 ]', '$[1]', null )
+NULL
+select json_remove( '[ 1, { "a": true, "b": false, "c": null }, 5 ]', '$[1]', null ) is null;
+json_remove( '[ 1, { "a": true, "b": false, "c": null }, 5 ]', '$[1]', null ) is null
+1
+
+# not enough args
+select json_remove();
+ERROR 42000: Incorrect parameter count in the call to native function 'json_remove'
+
+# not enough args
+select json_remove( '[ 1, { "a": true, "b": false, "c": null }, 5 ]' );
+ERROR 42000: Incorrect parameter count in the call to native function 'json_remove'
+
+# not enough args
+select json_remove( '$[1]' );
+ERROR 42000: Incorrect parameter count in the call to native function 'json_remove'
+
+# invalid json text
+error ER_INVALID_JSON_TEXT_IN_PARAM
+select json_remove( '[ 1, { "a": true, "b": false, "c": null }, 5 ', '$[1]', '$[2]' );
+json_remove( '[ 1, { "a": true, "b": false, "c": null }, 5 ', '$[1]', '$[2]' )
+NULL
+Warnings:
+Warning 4037 Unexpected end of JSON text in argument 1 to function 'json_remove'
+
+# invalid json path
+error ER_INVALID_JSON_PATH
+select json_remove( '[ 1, { "a": true, "b": false, "c": null }, 5 ]', '$[1', '$[2]' );
+json_remove( '[ 1, { "a": true, "b": false, "c": null }, 5 ]', '$[1', '$[2]' )
+NULL
+Warnings:
+Warning 4041 Unexpected end of JSON path in argument 2 to function 'json_remove'
+
+# invalid json path
+error ER_INVALID_JSON_PATH
+select json_remove( '[ 1, { "a": true, "b": false, "c": null }, 5 ]', '$[1]', '$[2' );
+json_remove( '[ 1, { "a": true, "b": false, "c": null }, 5 ]', '$[1]', '$[2' )
+NULL
+Warnings:
+Warning 4041 Unexpected end of JSON path in argument 3 to function 'json_remove'
+
+# Vacuous path expression
+error ER_JSON_VACUOUS_PATH
+select json_remove( '[ 1, 2, 3 ]', '$' );
+json_remove( '[ 1, 2, 3 ]', '$' )
+NULL
+Warnings:
+Warning 4051 Path expression '$' is not allowed in argument 2 to function 'json_remove'.
+
+# Vacuous path expression
+error ER_JSON_VACUOUS_PATH
+select json_remove( '[ 1, 2, 3 ]', '$', '$[2]' );
+json_remove( '[ 1, 2, 3 ]', '$', '$[2]' )
+NULL
+Warnings:
+Warning 4051 Path expression '$' is not allowed in argument 2 to function 'json_remove'.
+
+# Vacuous path expression
+error ER_JSON_VACUOUS_PATH
+select json_remove( '[ 1, 2, 3 ]', '$[1]', '$' );
+json_remove( '[ 1, 2, 3 ]', '$[1]', '$' )
+NULL
+Warnings:
+Warning 4051 Path expression '$' is not allowed in argument 3 to function 'json_remove'.
+error ER_INVALID_JSON_PATH_WILDCARD
+select json_remove( '[ 1, 2, 3 ]', '$[*]' );
+json_remove( '[ 1, 2, 3 ]', '$[*]' )
+NULL
+Warnings:
+Warning 4044 Wildcards in JSON path not allowed in argument 2 to function 'json_remove'
+error ER_INVALID_JSON_PATH_WILDCARD
+select json_remove( '[ 1, 2, 3 ]', '$**[2]' );
+json_remove( '[ 1, 2, 3 ]', '$**[2]' )
+NULL
+Warnings:
+Warning 4044 Wildcards in JSON path not allowed in argument 2 to function 'json_remove'
+error ER_INVALID_JSON_PATH_WILDCARD
+select json_remove( '[ 1, 2, 3 ]', '$[2]', '$[*]' );
+json_remove( '[ 1, 2, 3 ]', '$[2]', '$[*]' )
+NULL
+Warnings:
+Warning 4044 Wildcards in JSON path not allowed in argument 3 to function 'json_remove'
+error ER_INVALID_JSON_PATH_WILDCARD
+select json_remove( '[ 1, 2, 3 ]', '$[2]', '$**[2]' );
+json_remove( '[ 1, 2, 3 ]', '$[2]', '$**[2]' )
+NULL
+Warnings:
+Warning 4044 Wildcards in JSON path not allowed in argument 3 to function 'json_remove'
+select json_remove( '[ 1, 2, 3 ]', '$[0]' );
+json_remove( '[ 1, 2, 3 ]', '$[0]' )
+[ 2, 3 ]
+select json_remove( '[ 1, 2, 3 ]', '$[1]' );
+json_remove( '[ 1, 2, 3 ]', '$[1]' )
+[ 1, 3 ]
+select json_remove( '[ 1, 2, 3 ]', '$[2]' );
+json_remove( '[ 1, 2, 3 ]', '$[2]' )
+[ 1, 2]
+select json_remove( '[ 1, 2, 3 ]', '$[3]' );
+json_remove( '[ 1, 2, 3 ]', '$[3]' )
+[ 1, 2, 3 ]
+select json_remove( '[ 1, { "a": true, "b": false, "c": null }, 5 ]', '$[1]' );
+json_remove( '[ 1, { "a": true, "b": false, "c": null }, 5 ]', '$[1]' )
+[ 1, 5 ]
+error ER_INVALID_JSON_PATH_WILDCARD
+select json_remove( '[ { "a": { "a": true } } ]', '$**.a' );
+json_remove( '[ { "a": { "a": true } } ]', '$**.a' )
+NULL
+Warnings:
+Warning 4044 Wildcards in JSON path not allowed in argument 2 to function 'json_remove'
+select json_remove( '[ { "a": true }, { "b": false }, { "c": null }, { "a": null } ]', '$[0].a', '$[2].c' );
+json_remove( '[ { "a": true }, { "b": false }, { "c": null }, { "a": null } ]', '$[0].a', '$[2].c' )
+[ { }, { "b": false }, { }, { "a": null } ]
+error ER_INVALID_JSON_PATH_WILDCARD
+select json_remove( '[ { "a": true }, { "b": [ { "c": { "a": true } } ] }, { "c": null }, { "a": null } ]', '$**.a' );
+json_remove( '[ { "a": true }, { "b": [ { "c": { "a": true } } ] }, { "c": null }, { "a": null } ]', '$**.a' )
+NULL
+Warnings:
+Warning 4044 Wildcards in JSON path not allowed in argument 2 to function 'json_remove'
+select json_remove( '{"id": 123, "name": "systemQA", "array": [1, 2, 3]}', '$[0]' );
+json_remove( '{"id": 123, "name": "systemQA", "array": [1, 2, 3]}', '$[0]' )
+{"id": 123, "name": "systemQA", "array": [1, 2, 3]}
+SELECT JSON_REMOVE
+(
+'{"a" : "foo", "b" : [true, {"c" : 123}]}',
+'$.b[ 1 ]'
+);
+JSON_REMOVE
+(
+'{"a" : "foo", "b" : [true, {"c" : 123}]}',
+'$.b[ 1 ]'
+)
+{"a" : "foo", "b" : [true, {"c" : 123}]}
+SELECT JSON_REMOVE
+(
+'{ "a" : "foo", "b" : [ true, { "c" : 123, "c" : 456 } ] }',
+'$.b[ 1 ].c'
+);
+JSON_REMOVE
+(
+'{ "a" : "foo", "b" : [ true, { "c" : 123, "c" : 456 } ] }',
+'$.b[ 1 ].c'
+)
+NULL
+Warnings:
+Warning 4037 Unexpected end of JSON text in argument 1 to function 'json_remove'
+SELECT JSON_REMOVE
+(
+'{ "a" : "foo", "b" : [ true, { "c" : 123 } ] }',
+'$.b[ 1 ].c'
+);
+JSON_REMOVE
+(
+'{ "a" : "foo", "b" : [ true, { "c" : 123 } ] }',
+'$.b[ 1 ].c'
+)
+NULL
+Warnings:
+Warning 4037 Unexpected end of JSON text in argument 1 to function 'json_remove'
+SELECT JSON_REMOVE
+(
+'{ "a" : "foo", "b" : [ true, { "c" : 123, "d" : 456 } ] }',
+'$.b[ 1 ].e'
+);
+JSON_REMOVE
+(
+'{ "a" : "foo", "b" : [ true, { "c" : 123, "d" : 456 } ] }',
+'$.b[ 1 ].e'
+)
+NULL
+Warnings:
+Warning 4037 Unexpected end of JSON text in argument 1 to function 'json_remove'
+# ----------------------------------------------------------------------
+# Test of JSON_MERGE function.
+# ----------------------------------------------------------------------
+
+# not enough args
+select json_merge();
+ERROR 42000: Incorrect parameter count in the call to native function 'json_merge'
+
+# not enough args
+select json_merge( '[ 1, 2, 3 ]' );
+ERROR 42000: Incorrect parameter count in the call to native function 'json_merge'
+select json_merge( null, null );
+json_merge( null, null )
+NULL
+select json_merge( null, '[ 1, 2, 3 ]' );
+json_merge( null, '[ 1, 2, 3 ]' )
+NULL
+select json_merge( '[ 1, 2, 3 ]', null );
+json_merge( '[ 1, 2, 3 ]', null )
+NULL
+select json_merge( null, '[ 1, 2, 3 ]', '[ 4, 5, 6 ]' );
+json_merge( null, '[ 1, 2, 3 ]', '[ 4, 5, 6 ]' )
+NULL
+select json_merge( '[ 1, 2, 3 ]', null, '[ 4, 5, 6 ]' );
+json_merge( '[ 1, 2, 3 ]', null, '[ 4, 5, 6 ]' )
+NULL
+select json_merge( '[ 1, 2, 3 ]', '[ 4, 5, 6 ]', null );
+json_merge( '[ 1, 2, 3 ]', '[ 4, 5, 6 ]', null )
+NULL
+error ER_INVALID_JSON_TEXT_IN_PARAM
+select json_merge( '[1, 2]', '[3, 4' );
+json_merge( '[1, 2]', '[3, 4' )
+[1, 2, 3, 4
+error ER_INVALID_JSON_TEXT_IN_PARAM
+select json_merge( '[1, 2', '[3, 4]' );
+json_merge( '[1, 2', '[3, 4]' )
+NULL
+Warnings:
+Warning 4037 Unexpected end of JSON text in argument 1 to function 'json_merge'
+select json_merge( '1', '2' );
+json_merge( '1', '2' )
+[1, 2]
+select json_merge( '1', '[2, 3]' );
+json_merge( '1', '[2, 3]' )
+[1, 2, 3]
+select json_merge( '[1, 2]', '3' );
+json_merge( '[1, 2]', '3' )
+[1, 2, 3]
+select json_merge( '1', '{ "a": 2 }' );
+json_merge( '1', '{ "a": 2 }' )
+[1, { "a": 2 }]
+select json_merge( '{ "a": 2 }', '1' );
+json_merge( '{ "a": 2 }', '1' )
+[{ "a": 2 }, 1]
+select json_merge( '[1, 2]', '[3, 4]' );
+json_merge( '[1, 2]', '[3, 4]' )
+[1, 2, 3, 4]
+select json_merge( '{ "a": 2 }', '{ "b": 3}' );
+json_merge( '{ "a": 2 }', '{ "b": 3}' )
+{ "a": 2 , "b": 3}
+select json_merge( '[1, 2]', '{ "a": 2 }' );
+json_merge( '[1, 2]', '{ "a": 2 }' )
+[1, 2, { "a": 2 }]
+select json_merge( '{ "a": 2 }', '[1, 2]' );
+json_merge( '{ "a": 2 }', '[1, 2]' )
+[{ "a": 2 }, 1, 2]
+select json_merge( '{"a": 1, "b": 2 }', '{"b": 3, "d": 4 }' );
+json_merge( '{"a": 1, "b": 2 }', '{"b": 3, "d": 4 }' )
+{"a": 1, "b": 2 , "b": 3, "d": 4 }
+select json_merge( '{"a": 1, "b": 2 }', '{"b": [3, 4], "d": 4 }' );
+json_merge( '{"a": 1, "b": 2 }', '{"b": [3, 4], "d": 4 }' )
+{"a": 1, "b": 2 , "b": [3, 4], "d": 4 }
+select json_merge( '{"a": 1, "b": [2, 3] }', '{"b": 4, "d": 4 }' );
+json_merge( '{"a": 1, "b": [2, 3] }', '{"b": 4, "d": 4 }' )
+{"a": 1, "b": [2, 3] , "b": 4, "d": 4 }
+select json_merge( '{"a": 1, "b": 2 }', '{"b": {"e": 7, "f": 8}, "d": 4 }' );
+json_merge( '{"a": 1, "b": 2 }', '{"b": {"e": 7, "f": 8}, "d": 4 }' )
+{"a": 1, "b": 2 , "b": {"e": 7, "f": 8}, "d": 4 }
+select json_merge( '{"b": {"e": 7, "f": 8}, "d": 4 }', '{"a": 1, "b": 2 }' );
+json_merge( '{"b": {"e": 7, "f": 8}, "d": 4 }', '{"a": 1, "b": 2 }' )
+{"b": {"e": 7, "f": 8}, "d": 4 , "a": 1, "b": 2 }
+select json_merge( '{"a": 1, "b": [2, 9] }', '{"b": [10, 11], "d": 4 }' );
+json_merge( '{"a": 1, "b": [2, 9] }', '{"b": [10, 11], "d": 4 }' )
+{"a": 1, "b": [2, 9] , "b": [10, 11], "d": 4 }
+select json_merge( '{"a": 1, "b": [2, 9] }', '{"b": {"e": 7, "f": 8}, "d": 4 }' );
+json_merge( '{"a": 1, "b": [2, 9] }', '{"b": {"e": 7, "f": 8}, "d": 4 }' )
+{"a": 1, "b": [2, 9] , "b": {"e": 7, "f": 8}, "d": 4 }
+select json_merge( '{"b": {"e": 7, "f": 8}, "d": 4 }', '{"a": 1, "b": [2, 9] }' );
+json_merge( '{"b": {"e": 7, "f": 8}, "d": 4 }', '{"a": 1, "b": [2, 9] }' )
+{"b": {"e": 7, "f": 8}, "d": 4 , "a": 1, "b": [2, 9] }
+select json_merge( '{"b": {"e": 7, "f": 8}, "d": 4 }', '{ "a": 1, "b": {"e": 20, "g": 21 } }' );
+json_merge( '{"b": {"e": 7, "f": 8}, "d": 4 }', '{ "a": 1, "b": {"e": 20, "g": 21 } }' )
+{"b": {"e": 7, "f": 8}, "d": 4 , "a": 1, "b": {"e": 20, "g": 21 } }
+select json_merge( '1', '2', '3' );
+json_merge( '1', '2', '3' )
+[1, 2, 3]
+select json_merge( '[1, 2 ]', '3', '[4, 5]' );
+json_merge( '[1, 2 ]', '3', '[4, 5]' )
+[1, 2 , 3, 4, 5]
+select json_merge
+(
+'{ "a": true, "b": { "c": 3, "d": 4 }, "e": [ 1, 2 ] }',
+'{ "d": false, "b": { "g": 3, "d": 5 }, "f": [ 1, 2 ] }',
+'{ "m": true, "b": { "h": 8, "d": 4 }, "e": [ 3, 4 ] }'
+);
+json_merge
+(
+'{ "a": true, "b": { "c": 3, "d": 4 }, "e": [ 1, 2 ] }',
+'{ "d": false, "b": { "g": 3, "d": 5 }, "f": [ 1, 2 ] }',
+'{ "m": true, "b": { "h": 8, "d": 4 }, "e": [ 3, 4 ] }'
+)
+{ "a": true, "b": { "c": 3, "d": 4 }, "e": [ 1, 2 ] , "d": false, "b": { "g": 3, "d": 5 }, "f": [ 1, 2 ] , "m": true, "b": { "h": 8, "d": 4 }, "e": [ 3, 4 ] }
+SELECT JSON_MERGE
+(
+'{ "a" : "foo", "b" : [ true, { "c" : 123 } ] }',
+'[ 5, 6]'
+);
+JSON_MERGE
+(
+'{ "a" : "foo", "b" : [ true, { "c" : 123 } ] }',
+'[ 5, 6]'
+)
+[{ "a" : "foo", "b" : [ true, { "c" : 123 } ] }, 5, 6]
+SELECT JSON_MERGE
+(
+'{ "a" : "foo", "b" : [ true, { "c" : 123 } ] }',
+'{ "b": [ false, 34 ] }'
+);
+JSON_MERGE
+(
+'{ "a" : "foo", "b" : [ true, { "c" : 123 } ] }',
+'{ "b": [ false, 34 ] }'
+)
+{ "a" : "foo", "b" : [ true, { "c" : 123 } ] , "b": [ false, 34 ] }
+SELECT JSON_MERGE
+(
+'{ "a" : "foo", "b" : [ true, { "c" : 123 } ] }',
+'{ "b": "bar" }'
+);
+JSON_MERGE
+(
+'{ "a" : "foo", "b" : [ true, { "c" : 123 } ] }',
+'{ "b": "bar" }'
+)
+{ "a" : "foo", "b" : [ true, { "c" : 123 } ] , "b": "bar" }
+SELECT JSON_MERGE
+(
+'{ "a" : { "b" : 1 } }',
+'{ "a" : { "c" : 1 } }'
+);
+JSON_MERGE
+(
+'{ "a" : { "b" : 1 } }',
+'{ "a" : { "c" : 1 } }'
+)
+{ "a" : { "b" : 1 } , "a" : { "c" : 1 } }
+# ----------------------------------------------------------------------
+# Test of JSON_TYPE function.
+# ----------------------------------------------------------------------
+error ER_INVALID_JSON_TEXT_IN_PARAM
+select json_type('abc');
+json_type('abc')
+NULL
+Warnings:
+Warning 4038 Syntax error in JSON text in argument 1 to function 'json_type' at position 1
+select json_type('{"a": 2}');
+json_type('{"a": 2}')
+OBJECT
+select json_type('[1,2]');
+json_type('[1,2]')
+ARRAY
+select json_type('"scalar string"');
+json_type('"scalar string"')
+STRING
+select json_type('true');
+json_type('true')
+BOOLEAN
+select json_type('false');
+json_type('false')
+BOOLEAN
+select json_type('null');
+json_type('null')
+NULL
+select json_type('1');
+json_type('1')
+INTEGER
+select json_type('-0');
+json_type('-0')
+INTEGER
+select json_type('-0.0');
+json_type('-0.0')
+DOUBLE
+error ER_INVALID_TYPE_FOR_JSON
+select json_type(-1);
+json_type(-1)
+INTEGER
+error ER_INVALID_TYPE_FOR_JSON
+select json_type(CAST(1 AS UNSIGNED));
+json_type(CAST(1 AS UNSIGNED))
+INTEGER
+select json_type('32767');
+json_type('32767')
+INTEGER
+error ER_INVALID_TYPE_FOR_JSON
+select json_type(PI());
+json_type(PI())
+DOUBLE
+select json_type('3.14');
+json_type('3.14')
+DOUBLE
+error ER_INVALID_JSON_TEXT_IN_PARAM
+select json_type(CAST(CAST('2015-01-15' AS DATE) as CHAR CHARACTER SET 'utf8'));
+json_type(CAST(CAST('2015-01-15' AS DATE) as CHAR CHARACTER SET 'utf8'))
+INTEGER
+# ----------------------------------------------------------------------
+# Test of CAST(literal AS JSON)
+# ----------------------------------------------------------------------
+select json_type(cast(cast('2014-11-25 18:00' as datetime) as json));
+json_type(cast(cast('2014-11-25 18:00' as datetime) as json))
+INTEGER
+select json_type(cast(cast('2014-11-25' as date) as json));
+json_type(cast(cast('2014-11-25' as date) as json))
+INTEGER
+select json_type(cast(cast('18:00:59' as time) as json));
+json_type(cast(cast('18:00:59' as time) as json))
+INTEGER
+select json_type(cast(127 as json));
+json_type(cast(127 as json))
+INTEGER
+select json_type(cast(255 as json));
+json_type(cast(255 as json))
+INTEGER
+select json_type(cast(32767 as json));
+json_type(cast(32767 as json))
+INTEGER
+select json_type(cast(65535 as json));
+json_type(cast(65535 as json))
+INTEGER
+select json_type(cast(8388607 as json));
+json_type(cast(8388607 as json))
+INTEGER
+select json_type(cast(16777215 as json));
+json_type(cast(16777215 as json))
+INTEGER
+select json_type(cast(2147483647 as json));
+json_type(cast(2147483647 as json))
+INTEGER
+select json_type(cast(4294967295 as json));
+json_type(cast(4294967295 as json))
+INTEGER
+select json_type(cast(9223372036854775807 as json));
+json_type(cast(9223372036854775807 as json))
+INTEGER
+select json_type(cast(18446744073709551615 as json));
+json_type(cast(18446744073709551615 as json))
+INTEGER
+select json_type(cast(true as json));
+json_type(cast(true as json))
+INTEGER
+select json_type(cast(b'10101' as json));
+json_type(cast(b'10101' as json))
+NULL
+Warnings:
+Warning 4036 Character disallowd in JSON in argument 1 to function 'json_type' at position 1
+select json_type(cast(cast(3.14 as decimal(5,2)) as json));
+json_type(cast(cast(3.14 as decimal(5,2)) as json))
+DOUBLE
+select json_type(cast(3.14 as json));
+json_type(cast(3.14 as json))
+DOUBLE
+select json_type(cast(3.14E30 as json));
+json_type(cast(3.14E30 as json))
+NULL
+Warnings:
+Warning 4038 Syntax error in JSON text in argument 1 to function 'json_type' at position 7
+select json_type(cast(cast('10101abcde' as binary) as json));
+json_type(cast(cast('10101abcde' as binary) as json))
+INTEGER
+select json_type(cast(ST_GeomFromText('POINT(1 1)') as json));
+json_type(cast(ST_GeomFromText('POINT(1 1)') as json))
+NULL
+Warnings:
+Warning 4036 Character disallowd in JSON in argument 1 to function 'json_type' at position 1
+select json_type(cast(ST_GeomFromText('LINESTRING(0 0,1 1,2 2)') as json));
+json_type(cast(ST_GeomFromText('LINESTRING(0 0,1 1,2 2)') as json))
+NULL
+Warnings:
+Warning 4036 Character disallowd in JSON in argument 1 to function 'json_type' at position 1
+select json_type(cast(ST_GeomFromText('POLYGON((0 0,10 0,10 10,0 10,0 0),
+ (5 5,7 5,7 7,5 7, 5 5))') as json));
+json_type(cast(ST_GeomFromText('POLYGON((0 0,10 0,10 10,0 10,0 0),
+ (5 5,7 5,7 7,5 7, 5 5))') as json))
+NULL
+Warnings:
+Warning 4036 Character disallowd in JSON in argument 1 to function 'json_type' at position 1
+select json_type(cast(null as json));
+json_type(cast(null as json))
+NULL
+select json_type(cast(null as json)) is null;
+json_type(cast(null as json)) is null
+1
+select json_type(null) is null;
+json_type(null) is null
+1
+select cast(cast('2014-11-25 18:00' as datetime) as json);
+cast(cast('2014-11-25 18:00' as datetime) as json)
+2014-11-25 18:00:00
+select cast(cast('2014-11-25' as date) as json);
+cast(cast('2014-11-25' as date) as json)
+2014-11-25
+select cast(cast('18:00:59' as time) as json);
+cast(cast('18:00:59' as time) as json)
+18:00:59
+select cast(127 as json);
+cast(127 as json)
+127
+select cast(255 as json);
+cast(255 as json)
+255
+select cast(32767 as json);
+cast(32767 as json)
+32767
+select cast(65535 as json);
+cast(65535 as json)
+65535
+select cast(8388607 as json);
+cast(8388607 as json)
+8388607
+select cast(16777215 as json);
+cast(16777215 as json)
+16777215
+select cast(2147483647 as json);
+cast(2147483647 as json)
+2147483647
+select cast(4294967295 as json);
+cast(4294967295 as json)
+4294967295
+select cast(9223372036854775807 as json);
+cast(9223372036854775807 as json)
+9223372036854775807
+select cast(18446744073709551615 as json);
+cast(18446744073709551615 as json)
+18446744073709551615
+select cast(true as json);
+cast(true as json)
+1
+select cast(b'10101' as json);
+cast(b'10101' as json)
+
+select cast(cast(3.14 as decimal(5,2)) as json);
+cast(cast(3.14 as decimal(5,2)) as json)
+3.14
+select cast(3.14 as json);
+cast(3.14 as json)
+3.14
+select cast(3.14e0 as json);
+cast(3.14e0 as json)
+3.14
+select cast(cast('10101abcde' as binary) as json);
+cast(cast('10101abcde' as binary) as json)
+10101abcde
+select cast(ST_GeomFromText('POINT(1 1)') as json);
+cast(ST_GeomFromText('POINT(1 1)') as json)
+
+select cast(ST_GeomFromText('LINESTRING(0 0,1 1,2 2)') as json);
+cast(ST_GeomFromText('LINESTRING(0 0,1 1,2 2)') as json)
+
+select cast(ST_GeomFromText('POLYGON((0 0,10 0,10 10,0 10,0 0),
+ (5 5,7 5,7 7,5 7, 5 5))') as json);
+cast(ST_GeomFromText('POLYGON((0 0,10 0,10 10,0 10,0 0),
+ (5 5,7 5,7 7,5 7, 5 5))') as json)
+
+select cast(null as json);
+cast(null as json)
+NULL
+select cast(null as json) is null;
+cast(null as json) is null
+1
+# ----------------------------------------------------------------------
+# Test of JSON_KEYS function.
+# ----------------------------------------------------------------------
+select json_keys(NULL);
+json_keys(NULL)
+NULL
+select json_keys(NULL, '$.b');
+json_keys(NULL, '$.b')
+NULL
+select json_keys(NULL, NULL);
+json_keys(NULL, NULL)
+NULL
+select json_keys('{"a": 1, "b": {"e": "foo", "b": 3}}', '$.a');
+json_keys('{"a": 1, "b": {"e": "foo", "b": 3}}', '$.a')
+NULL
+select json_keys('{"a": 1, "b": {"e": "foo", "b": 3}}', NULL);
+json_keys('{"a": 1, "b": {"e": "foo", "b": 3}}', NULL)
+NULL
+select json_keys('{"a": 1, "b": {"e": "foo", "b": 3}}');
+json_keys('{"a": 1, "b": {"e": "foo", "b": 3}}')
+["a", "b"]
+select json_keys('{"a": 1, "b": {"e": "foo", "b": 3}}', '$.b');
+json_keys('{"a": 1, "b": {"e": "foo", "b": 3}}', '$.b')
+["e", "b"]
+error ER_INVALID_JSON_PATH_WILDCARD
+select json_keys('{"a": 1, "b": {"e": "foo", "b": 3}}', '$.*.b');
+json_keys('{"a": 1, "b": {"e": "foo", "b": 3}}', '$.*.b')
+NULL
+Warnings:
+Warning 4044 Wildcards in JSON path not allowed in argument 2 to function 'json_keys'
+# returns [ "a", "b" ]
+SELECT JSON_KEYS('{ "a" : "foo", "b" : [ true, { "c" : "123" } ] }');
+JSON_KEYS('{ "a" : "foo", "b" : [ true, { "c" : "123" } ] }')
+["a", "b"]
+# returns []
+SELECT JSON_KEYS('{ "a" : "foo", "b" : [ true, { "c" : {} } ] }',
+'$.b[1].c');
+JSON_KEYS('{ "a" : "foo", "b" : [ true, { "c" : {} } ] }',
+'$.b[1].c')
+[]
+# returns NULL
+SELECT JSON_KEYS('{ "a" : "foo", "b" : [ true, { "c" : {} } ] }',
+'$.a.b[2]');
+JSON_KEYS('{ "a" : "foo", "b" : [ true, { "c" : {} } ] }',
+'$.a.b[2]')
+NULL
+error ER_INVALID_JSON_PATH
+SELECT JSON_KEYS('{"a":1}', '1010');
+JSON_KEYS('{"a":1}', '1010')
+NULL
+Warnings:
+Warning 4042 Syntax error in JSON path in argument 2 to function 'json_keys' at position 1
+error ER_INVALID_JSON_PATH
+SELECT JSON_KEYS('{"a":1}', '1010') IS NULL;
+JSON_KEYS('{"a":1}', '1010') IS NULL
+0
+SELECT JSON_KEYS
+(
+'{ "a" : "foo", "b" : [ true, { "c" : "123" } ] }'
+);
+JSON_KEYS
+(
+'{ "a" : "foo", "b" : [ true, { "c" : "123" } ] }'
+)
+["a", "b"]
+SELECT JSON_KEYS
+(
+'{ "a" : "foo", "b" : [ true, { "c" : {} } ] }',
+'$.b[1].c'
+);
+JSON_KEYS
+(
+'{ "a" : "foo", "b" : [ true, { "c" : {} } ] }',
+'$.b[1].c'
+)
+[]
+SELECT JSON_KEYS
+(
+'{ "a" : "foo", "b" : [ true, { "c" : {} } ] }',
+'$.a.b[2]'
+);
+JSON_KEYS
+(
+'{ "a" : "foo", "b" : [ true, { "c" : {} } ] }',
+'$.a.b[2]'
+)
+NULL
+SELECT JSON_KEYS();
+ERROR 42000: Incorrect parameter count in the call to native function 'JSON_KEYS'
+SELECT JSON_KEYS('{}', '$', '$');
+ERROR 42000: Incorrect parameter count in the call to native function 'JSON_KEYS'
+# ----------------------------------------------------------------------
+# CAST(<json> AS CHAR). See also 'json_conversions.test' for other
+# conversion tests.
+# ----------------------------------------------------------------------
+select cast(json_keys('{"a": 1}') as char);
+cast(json_keys('{"a": 1}') as char)
+["a"]
+select cast(cast(1 as json) as char);
+cast(cast(1 as json) as char)
+1
+select cast(json_keys(NULL) as char);
+cast(json_keys(NULL) as char)
+NULL
+# ----------------------------------------------------------------------
+# Path matching with double-quotes
+# ----------------------------------------------------------------------
+select json_extract( '{ "one potato" : 1 }', '$."one potato"' );
+json_extract( '{ "one potato" : 1 }', '$."one potato"' )
+NULL
+select json_extract( '{ "a.b" : 1 }', '$."a.b"' );
+json_extract( '{ "a.b" : 1 }', '$."a.b"' )
+NULL
+select json_extract( '{ "\\"a\\"": 1}', '$."a"' );
+json_extract( '{ "\\"a\\"": 1}', '$."a"' )
+NULL
+select json_extract( '{ "\\"a\\"": 1}', '$."\\"a\\""' );
+json_extract( '{ "\\"a\\"": 1}', '$."\\"a\\""' )
+NULL
+Warnings:
+Warning 4042 Syntax error in JSON path in argument 2 to function 'json_extract' at position 7
+select json_extract( '{ "a": 1}', '$."a"' );
+json_extract( '{ "a": 1}', '$."a"' )
+NULL
+select json_extract( '{ "a": 1}', '$.a' );
+json_extract( '{ "a": 1}', '$.a' )
+1
+select json_extract( '{ "a": [ [ 3, 2 ], [ { "c" : "d" }, 1 ] ], "b": { "c" : 6 }, "one potato": 7, "b.c" : 8 }', '$.a[0]' );
+json_extract( '{ "a": [ [ 3, 2 ], [ { "c" : "d" }, 1 ] ], "b": { "c" : 6 }, "one potato": 7, "b.c" : 8 }', '$.a[0]' )
+[ 3, 2 ]
+select json_extract( '{ "a": [ [ 3, 2 ], [ { "c" : "d" }, 1 ] ], "b": { "c" : 6 }, "one potato": 7, "b.c" : 8 }', '$.a[0][1]' );
+json_extract( '{ "a": [ [ 3, 2 ], [ { "c" : "d" }, 1 ] ], "b": { "c" : 6 }, "one potato": 7, "b.c" : 8 }', '$.a[0][1]' )
+2
+select json_extract( '{ "a": [ [ 3, 2 ], [ { "c" : "d" }, 1 ] ], "b": { "c" : 6 }, "one potato": 7, "b.c" : 8 }', '$.a[1]' );
+json_extract( '{ "a": [ [ 3, 2 ], [ { "c" : "d" }, 1 ] ], "b": { "c" : 6 }, "one potato": 7, "b.c" : 8 }', '$.a[1]' )
+[ { "c" : "d" }, 1 ]
+select json_extract( '{ "a": [ [ 3, 2 ], [ { "c" : "d" }, 1 ] ], "b": { "c" : 6 }, "one potato": 7, "b.c" : 8 }', '$.a[1][0]' );
+json_extract( '{ "a": [ [ 3, 2 ], [ { "c" : "d" }, 1 ] ], "b": { "c" : 6 }, "one potato": 7, "b.c" : 8 }', '$.a[1][0]' )
+{ "c" : "d" }
+select json_extract( '{ "a": [ [ 3, 2 ], [ { "c" : "d" }, 1 ] ], "b": { "c" : 6 }, "one potato": 7, "b.c" : 8 }', '$.a[1][0].c' );
+json_extract( '{ "a": [ [ 3, 2 ], [ { "c" : "d" }, 1 ] ], "b": { "c" : 6 }, "one potato": 7, "b.c" : 8 }', '$.a[1][0].c' )
+"d"
+select json_extract( '{ "a": [ [ 3, 2 ], [ { "c" : "d" }, 1 ] ], "b": { "c" : 6 }, "one potato": 7, "b.c" : 8 }', '$."one potato"' );
+json_extract( '{ "a": [ [ 3, 2 ], [ { "c" : "d" }, 1 ] ], "b": { "c" : 6 }, "one potato": 7, "b.c" : 8 }', '$."one potato"' )
+NULL
+select json_extract( '{ "a": [ [ 3, 2 ], [ { "c" : "d" }, 1 ] ], "b": { "c" : 6 }, "one potato": 7, "b.c" : 8 }', '$.b.c' );
+json_extract( '{ "a": [ [ 3, 2 ], [ { "c" : "d" }, 1 ] ], "b": { "c" : 6 }, "one potato": 7, "b.c" : 8 }', '$.b.c' )
+6
+select json_extract( '{ "a": [ [ 3, 2 ], [ { "c" : "d" }, 1 ] ], "b": { "c" : 6 }, "one potato": 7, "b.c" : 8 }', '$."b.c"' );
+json_extract( '{ "a": [ [ 3, 2 ], [ { "c" : "d" }, 1 ] ], "b": { "c" : 6 }, "one potato": 7, "b.c" : 8 }', '$."b.c"' )
+NULL
+# ----------------------------------------------------------------------
+# Test of JSON_EXTRACT function.
+# ----------------------------------------------------------------------
+select json_extract(NULL);
+ERROR 42000: Incorrect parameter count in the call to native function 'json_extract'
+select json_extract('$.b');
+ERROR 42000: Incorrect parameter count in the call to native function 'json_extract'
+select json_extract('{"a": 1, "b": {"e": "foo", "b": 3}}');
+ERROR 42000: Incorrect parameter count in the call to native function 'json_extract'
+error ER_INVALID_JSON_TEXT_IN_PARAM
+select json_extract('$.a', '{"a": 1, "b": {"e": "foo", "b": 3}}');
+json_extract('$.a', '{"a": 1, "b": {"e": "foo", "b": 3}}')
+NULL
+Warnings:
+Warning 4042 Syntax error in JSON path in argument 2 to function 'json_extract' at position 1
+select json_extract(NULL, '$.b');
+json_extract(NULL, '$.b')
+NULL
+select json_extract(NULL, NULL);
+json_extract(NULL, NULL)
+NULL
+select json_extract('{"a": 1, "b": {"e": "foo", "b": 3}}', '$.a');
+json_extract('{"a": 1, "b": {"e": "foo", "b": 3}}', '$.a')
+1
+select json_extract('{"a": 1, "b": {"e": "foo", "b": 3}}', '$.*');
+json_extract('{"a": 1, "b": {"e": "foo", "b": 3}}', '$.*')
+[1, {"e": "foo", "b": 3}]
+select json_extract('{"a": 1, "b": {"e": "foo", "b": 3}}', '$.a', '$.b.e');
+json_extract('{"a": 1, "b": {"e": "foo", "b": 3}}', '$.a', '$.b.e')
+[1, "foo"]
+select json_extract('{"a": 1, "b": [1,2,3]}', '$.b[2]');
+json_extract('{"a": 1, "b": [1,2,3]}', '$.b[2]')
+3
+select json_extract('{"a": 1, "b": {"e": "foo", "b": 3}}', '$.a', NULL);
+json_extract('{"a": 1, "b": {"e": "foo", "b": 3}}', '$.a', NULL)
+NULL
+# returns a JSON value containing just the string "123"
+SELECT JSON_EXTRACT('{ "a" : "foo", "b" : [ true, { "c" : "123" } ] }',
+'$.b[ 1 ].c');
+JSON_EXTRACT('{ "a" : "foo", "b" : [ true, { "c" : "123" } ] }',
+'$.b[ 1 ].c')
+NULL
+# returns a JSON value containing just the number 123
+SELECT JSON_EXTRACT('{ "a" : "foo", "b" : [ true, { "c" : 123 } ] }',
+'$.b[ 1 ].c');
+JSON_EXTRACT('{ "a" : "foo", "b" : [ true, { "c" : 123 } ] }',
+'$.b[ 1 ].c')
+NULL
+# raises an error because the document is not valid
+error ER_INVALID_JSON_TEXT_IN_PARAM
+SELECT JSON_EXTRACT('{ "a" : [ }',
+'$.b[ 1 ].c');
+JSON_EXTRACT('{ "a" : [ }',
+'$.b[ 1 ].c')
+NULL
+Warnings:
+Warning 4038 Syntax error in JSON text in argument 1 to function 'json_extract' at position 11
+# raises an error because the path is invalid
+error ER_INVALID_JSON_PATH
+SELECT JSON_EXTRACT('{ "a" : "foo", "b" : [ true, { "c" : 123 } ] }',
+'$.b[ 1 ].');
+JSON_EXTRACT('{ "a" : "foo", "b" : [ true, { "c" : 123 } ] }',
+'$.b[ 1 ].')
+NULL
+Warnings:
+Warning 4041 Unexpected end of JSON path in argument 2 to function 'json_extract'
+# returns a JSON value containing the number 123 (because of
+# auto-wrapping the scalar)
+SELECT JSON_EXTRACT('{ "a" : "foo", "b" : [ true, { "c" : 123 } ] }',
+'$.b[ 1 ].c[ 0 ]');
+JSON_EXTRACT('{ "a" : "foo", "b" : [ true, { "c" : 123 } ] }',
+'$.b[ 1 ].c[ 0 ]')
+NULL
+# returns a JSON value containing the object because of auto-wrapping
+SELECT JSON_EXTRACT('{ "a" : "foo", "b" : [ true, { "c" : {"not array": 4} } ] }',
+'$.b[ 1 ].c[ 0 ]');
+JSON_EXTRACT('{ "a" : "foo", "b" : [ true, { "c" : {"not array": 4} } ] }',
+'$.b[ 1 ].c[ 0 ]')
+NULL
+# returns null because the path, although valid, does not identify a value
+SELECT JSON_EXTRACT('{ "a" : "foo", "b" : [ true, { "c" : 123 } ] }',
+'$.b[ 1 ].c[ 1 ]');
+JSON_EXTRACT('{ "a" : "foo", "b" : [ true, { "c" : 123 } ] }',
+'$.b[ 1 ].c[ 1 ]')
+NULL
+# returns a JSON value containing the number 123 (due to normalization)
+SELECT JSON_EXTRACT('{ "a" : "foo", "b" : [ true, { "c" : 123, "c" : 456 } ] }',
+'$.b[ 1 ].c');
+JSON_EXTRACT('{ "a" : "foo", "b" : [ true, { "c" : 123, "c" : 456 } ] }',
+'$.b[ 1 ].c')
+NULL
+# returns a JSON array [ "foo", true ]
+SELECT JSON_EXTRACT('{ "a" : "foo", "b" : [ true, { "c" : 123, "c" : 456 } ] }',
+'$.a', '$.b[0]');
+JSON_EXTRACT('{ "a" : "foo", "b" : [ true, { "c" : 123, "c" : 456 } ] }',
+'$.a', '$.b[0]')
+["foo", true]
+# returns a JSON array [ true ]
+SELECT JSON_EXTRACT('{ "a" : "foo", "b" : [ true, { "c" : 123, "c" : 456 } ] }',
+'$.d', '$.b[0]');
+JSON_EXTRACT('{ "a" : "foo", "b" : [ true, { "c" : 123, "c" : 456 } ] }',
+'$.d', '$.b[0]')
+[true]
+select json_extract( '[1]', '$[0][0]' );
+json_extract( '[1]', '$[0][0]' )
+NULL
+select json_extract( '[1]', '$**[0]' );
+json_extract( '[1]', '$**[0]' )
+[1]
+select json_extract( '{ "a": 1 }', '$.a[0]' );
+json_extract( '{ "a": 1 }', '$.a[0]' )
+NULL
+select json_extract( '{ "a": 1 }', '$**[0]' );
+json_extract( '{ "a": 1 }', '$**[0]' )
+NULL
+select json_extract( '{ "a": 1 }', '$[0].a' );
+json_extract( '{ "a": 1 }', '$[0].a' )
+NULL
+select json_extract( '{ "a": 1 }', '$**.a' );
+json_extract( '{ "a": 1 }', '$**.a' )
+[1]
+select json_extract( '{ "a": 1 }', '$[0].a[0]' );
+json_extract( '{ "a": 1 }', '$[0].a[0]' )
+NULL
+select json_extract( '{ "a": 1 }', '$**[0]' );
+json_extract( '{ "a": 1 }', '$**[0]' )
+NULL
+select json_extract( '{ "a": 1 }', '$[0].a' );
+json_extract( '{ "a": 1 }', '$[0].a' )
+NULL
+select json_extract( '{ "a": 1 }', '$**.a' );
+json_extract( '{ "a": 1 }', '$**.a' )
+[1]
+select json_extract( '{ "a": 1 }', '$[0][0].a' );
+json_extract( '{ "a": 1 }', '$[0][0].a' )
+NULL
+select json_extract( '{ "a": 1 }', '$[0][0][0].a' );
+json_extract( '{ "a": 1 }', '$[0][0][0].a' )
+NULL
+SELECT JSON_EXTRACT('[1, [[{"x": [{"a":{"b":{"c":42}}}]}]]]', '$**.a.*');
+JSON_EXTRACT('[1, [[{"x": [{"a":{"b":{"c":42}}}]}]]]', '$**.a.*')
+[{"c":42}]
+SELECT JSON_EXTRACT('[1, [[{"x": [{"a":{"b":{"c":42}}}]}]]]',
+'$[1][0][0].x[0].a.*');
+JSON_EXTRACT('[1, [[{"x": [{"a":{"b":{"c":42}}}]}]]]',
+'$[1][0][0].x[0].a.*')
+[{"c":42}]
+SELECT JSON_EXTRACT
+(
+'{ "a" : "foo", "b" : [ true, { "c" : "123" } ] }',
+'$.b[ 1 ].c'
+);
+JSON_EXTRACT
+(
+'{ "a" : "foo", "b" : [ true, { "c" : "123" } ] }',
+'$.b[ 1 ].c'
+)
+NULL
+SELECT JSON_EXTRACT
+(
+'{ "a" : "foo", "b" : [ true, { "c" : 123 } ] }',
+'$.b[ 1 ].c'
+);
+JSON_EXTRACT
+(
+'{ "a" : "foo", "b" : [ true, { "c" : 123 } ] }',
+'$.b[ 1 ].c'
+)
+NULL
+error ER_INVALID_JSON_TEXT_IN_PARAM
+SELECT JSON_EXTRACT
+(
+'{ "a" : [ }',
+'$.b[ 1 ].c'
+);
+JSON_EXTRACT
+(
+'{ "a" : [ }',
+'$.b[ 1 ].c'
+)
+NULL
+Warnings:
+Warning 4038 Syntax error in JSON text in argument 1 to function 'json_extract' at position 11
+error ER_INVALID_JSON_PATH
+SELECT JSON_EXTRACT
+(
+'{ "a" : "foo", "b" : [ true, { "c" : 123 } ] }',
+'$.b[ 1 ].'
+);
+JSON_EXTRACT
+(
+'{ "a" : "foo", "b" : [ true, { "c" : 123 } ] }',
+'$.b[ 1 ].'
+)
+NULL
+Warnings:
+Warning 4041 Unexpected end of JSON path in argument 2 to function 'json_extract'
+SELECT JSON_EXTRACT
+(
+'{ "a" : "foo", "b" : [ true, { "c" : 123 } ] }',
+'$.b[ 1 ].c[ 0 ]'
+);
+JSON_EXTRACT
+(
+'{ "a" : "foo", "b" : [ true, { "c" : 123 } ] }',
+'$.b[ 1 ].c[ 0 ]'
+)
+NULL
+SELECT JSON_EXTRACT
+(
+'{ "a" : "foo", "b" : [ true, { "c" : 123 } ] }',
+'$.b[ 1 ].c[ 1 ]'
+);
+JSON_EXTRACT
+(
+'{ "a" : "foo", "b" : [ true, { "c" : 123 } ] }',
+'$.b[ 1 ].c[ 1 ]'
+)
+NULL
+SELECT JSON_EXTRACT
+(
+'{ "a" : "foo", "b" : [ true, { "c" : 123, "c" : 456 } ] }',
+'$.b[ 1 ].c'
+);
+JSON_EXTRACT
+(
+'{ "a" : "foo", "b" : [ true, { "c" : 123, "c" : 456 } ] }',
+'$.b[ 1 ].c'
+)
+NULL
+SELECT JSON_EXTRACT
+(
+'{ "a" : "foo", "b" : [ true, { "c" : 123, "c" : 456 } ] }',
+'$.a', '$.b[0]'
+);
+JSON_EXTRACT
+(
+'{ "a" : "foo", "b" : [ true, { "c" : 123, "c" : 456 } ] }',
+'$.a', '$.b[0]'
+)
+["foo", true]
+SELECT JSON_EXTRACT
+(
+'{ "a" : "foo", "b" : [ true, { "c" : 123, "c" : 456 } ] }',
+'$.d', '$.b[0]'
+);
+JSON_EXTRACT
+(
+'{ "a" : "foo", "b" : [ true, { "c" : 123, "c" : 456 } ] }',
+'$.d', '$.b[0]'
+)
+[true]
+select json_extract( '[ { "a": 1 }, { "a": 2 } ]', '$[*].b' ) jdoc;
+jdoc
+NULL
+select json_extract( '[ { "a": 1 }, { "a": 2 } ]', '$[0].b' ) jdoc;
+jdoc
+NULL
+select json_extract( '[ { "a": 1 }, { "a": 2 } ]', '$[0].a' ) jdoc;
+jdoc
+1
+select json_extract( '[ { "a": 1 }, { "a": 2 } ]', '$[*].a' ) jdoc;
+jdoc
+[1, 2]
+select json_extract( '[ { "a": 1 }, { "b": 2 } ]', '$[*].a' ) jdoc;
+jdoc
+[1]
+select json_extract( '[ { "a": [3,4] }, { "b": 2 } ]', '$[0].a' ) jdoc;
+jdoc
+[3,4]
+select json_extract( '[ { "a": [3,4] }, { "b": 2 } ]', '$[*].a' ) jdoc;
+jdoc
+[[3,4]]
+select json_extract( '[ { "a": [3,4] }, { "b": 2 } ]', '$[0].a', '$[1].a' ) jdoc;
+jdoc
+[[3,4]]
+# ----------------------------------------------------------------------
+# Test of JSON_ARRAY_APPEND function.
+# ----------------------------------------------------------------------
+select json_array_append(NULL, '$.b', cast(1 as json));
+json_array_append(NULL, '$.b', cast(1 as json))
+NULL
+select json_array_append('[1,2,3]', NULL, cast(1 as json));
+json_array_append('[1,2,3]', NULL, cast(1 as json))
+NULL
+select json_array_append('[1,2,3]', '$', NULL);
+json_array_append('[1,2,3]', '$', NULL)
+[1,2,3, null]
+select json_array_append(NULL);
+ERROR 42000: Incorrect parameter count in the call to native function 'json_array_append'
+select json_array_append(NULL, NULL);
+ERROR 42000: Incorrect parameter count in the call to native function 'json_array_append'
+select json_array_append(NULL, NULL, NULL, NULL);
+ERROR 42000: Incorrect parameter count in the call to native function 'json_array_append'
+SELECT JSON_ARRAY_APPEND(cast('1' as json), '$', 3);
+JSON_ARRAY_APPEND(cast('1' as json), '$', 3)
+[1, 3]
+SELECT JSON_ARRAY_APPEND(cast('{"a": 3}' as json), '$', 3);
+JSON_ARRAY_APPEND(cast('{"a": 3}' as json), '$', 3)
+[{"a": 3}, 3]
+error ER_INVALID_JSON_PATH_WILDCARD
+select json_array_append(cast('{"a": {"b": [3]}}' as json), '$**[0]', 6);
+json_array_append(cast('{"a": {"b": [3]}}' as json), '$**[0]', 6)
+NULL
+Warnings:
+Warning 4044 Wildcards in JSON path not allowed in argument 2 to function 'json_array_append'
+# Auto-wrapping, since because the paths identify scalars.
+# should return {"a": "foo", "b": ["bar", 4], "c": ["wibble", "grape"]}
+SELECT JSON_ARRAY_APPEND('{"a": "foo", "b": "bar", "c": "wibble"}',
+'$.b', cast(4 as json),
+'$.c', cast('"grape"' as json));
+JSON_ARRAY_APPEND('{"a": "foo", "b": "bar", "c": "wibble"}',
+'$.b', cast(4 as json),
+'$.c', cast('"grape"' as json))
+{"a": "foo", "b": ["bar", 4], "c": ["wibble", "grape"]}
+# should return {"a": "foo", "b": [1, 2, 3, 4],
+# "c": ["apple", "pear", "grape"]}
+SELECT JSON_ARRAY_APPEND('{"a" : "foo","b": [1, 2, 3], "c": ["apple", "pear"]}',
+'$.b', cast(4 as json),
+'$.c', cast('"grape"' as json));
+JSON_ARRAY_APPEND('{"a" : "foo","b": [1, 2, 3], "c": ["apple", "pear"]}',
+'$.b', cast(4 as json),
+'$.c', cast('"grape"' as json))
+{"a" : "foo","b": [1, 2, 3, 4], "c": ["apple", "pear", "grape"]}
+SELECT JSON_ARRAY_APPEND('{"a" : "foo","b": [1, 2, 3], "c": ["apple", "pear"]}',
+'$.b', 4,
+'$.c', 'grape');
+JSON_ARRAY_APPEND('{"a" : "foo","b": [1, 2, 3], "c": ["apple", "pear"]}',
+'$.b', 4,
+'$.c', 'grape')
+{"a" : "foo","b": [1, 2, 3, 4], "c": ["apple", "pear", "grape"]}
+error ER_INVALID_JSON_PATH_WILDCARD
+select json_array_append( '[[], [], []]', '$[*]', 3, '$[*]', 4);
+json_array_append( '[[], [], []]', '$[*]', 3, '$[*]', 4)
+NULL
+Warnings:
+Warning 4044 Wildcards in JSON path not allowed in argument 2 to function 'json_array_append'
+error ER_INVALID_JSON_PATH_WILDCARD
+select json_array_append( '[[], "not array", []]', '$[*]', 3, '$[*]', 4);
+json_array_append( '[[], "not array", []]', '$[*]', 3, '$[*]', 4)
+NULL
+Warnings:
+Warning 4044 Wildcards in JSON path not allowed in argument 2 to function 'json_array_append'
+SELECT JSON_ARRAY_APPEND
+(
+'{ "a" : "foo", "b" : "bar", "c" : "wibble" }',
+'$.b', 4,
+'$.c', "grape"
+);
+JSON_ARRAY_APPEND
+(
+'{ "a" : "foo", "b" : "bar", "c" : "wibble" }',
+'$.b', 4,
+'$.c', "grape"
+)
+{ "a" : "foo", "b" : ["bar", 4], "c" : ["wibble", "grape"] }
+SELECT JSON_ARRAY_APPEND
+(
+'{ "a" : "foo", "b" : [ 1, 2, 3 ], "c" : [ "apple", "pear" ] }',
+'$.b', 4,
+'$.c', "grape"
+);
+JSON_ARRAY_APPEND
+(
+'{ "a" : "foo", "b" : [ 1, 2, 3 ], "c" : [ "apple", "pear" ] }',
+'$.b', 4,
+'$.c', "grape"
+)
+{ "a" : "foo", "b" : [ 1, 2, 3 , 4], "c" : [ "apple", "pear" , "grape"] }
+# ----------------------------------------------------------------------
+# Bug#21373874 ASSERTION `PARENT' FAILED
+# ----------------------------------------------------------------------
+select json_array_append('{"a":1}', '$[0]', 100);
+json_array_append('{"a":1}', '$[0]', 100)
+[{"a":1}, 100]
+select json_array_append('3', '$[0]', 100);
+json_array_append('3', '$[0]', 100)
+[3, 100]
+select json_array_append('3', '$[0][0][0][0]', 100);
+json_array_append('3', '$[0][0][0][0]', 100)
+[3, 100]
+# ----------------------------------------------------------------------
+# Test of JSON_INSERT function.
+# ----------------------------------------------------------------------
+select json_insert(NULL, '$.b', cast(1 as json));
+json_insert(NULL, '$.b', cast(1 as json))
+NULL
+select json_insert('[1,2,3]', NULL, cast(1 as json));
+json_insert('[1,2,3]', NULL, cast(1 as json))
+NULL
+select json_insert('[1,2,3]', '$[3]', NULL);
+json_insert('[1,2,3]', '$[3]', NULL)
+[1,2,3, null]
+select json_insert(NULL);
+ERROR 42000: Incorrect parameter count in the call to native function 'json_insert'
+select json_insert(NULL, NULL);
+ERROR 42000: Incorrect parameter count in the call to native function 'json_insert'
+select json_insert(NULL, NULL, NULL, NULL);
+ERROR 42000: Incorrect parameter count in the call to native function 'json_insert'
+select json_insert('[1,2,3]', '$[2]', 4);
+json_insert('[1,2,3]', '$[2]', 4)
+[1,2,3]
+select json_insert('[1,2,3]', '$[3]', 4);
+json_insert('[1,2,3]', '$[3]', 4)
+[1,2,3, 4]
+select json_insert('[1,2,3]', '$[10]', 4);
+json_insert('[1,2,3]', '$[10]', 4)
+[1,2,3, 4]
+select json_insert('{"c":4}', '$.c', 4);
+json_insert('{"c":4}', '$.c', 4)
+{"c":4}
+select json_insert('{"c":4}', '$.a', 4);
+json_insert('{"c":4}', '$.a', 4)
+{"c":4, "a":4}
+select json_insert('1', '$', 4);
+json_insert('1', '$', 4)
+1
+select json_insert('1', '$[0]', 4);
+json_insert('1', '$[0]', 4)
+[1, 4]
+select json_insert('1', '$[1]', 4);
+json_insert('1', '$[1]', 4)
+[1, 4]
+select json_insert('1', '$[10]', '4', '$[11]', 5);
+json_insert('1', '$[10]', '4', '$[11]', 5)
+[1, "4", 5]
+select json_insert('[1,2,3]', '$[2][0]', 4);
+json_insert('[1,2,3]', '$[2][0]', 4)
+[1,2,[3, 4]]
+select json_insert('[1,2,3]', '$[2][2]', 4);
+json_insert('[1,2,3]', '$[2][2]', 4)
+[1,2,[3, 4]]
+select json_insert('{"a": 3}', '$.a[0]', 4);
+json_insert('{"a": 3}', '$.a[0]', 4)
+{"a": [3, 4]}
+select json_insert('{"a": 3}', '$.a[1]', 4, '$.a[2]', '5');
+json_insert('{"a": 3}', '$.a[1]', 4, '$.a[2]', '5')
+{"a": [3, 4, "5"]}
+error ER_INVALID_JSON_PATH_WILDCARD
+select json_insert(cast('{"a": [1], "b": 2}' as json), '$.*[1]', 6);
+json_insert(cast('{"a": [1], "b": 2}' as json), '$.*[1]', 6)
+NULL
+Warnings:
+Warning 4044 Wildcards in JSON path not allowed in argument 2 to function 'json_insert'
+error ER_INVALID_JSON_PATH_WILDCARD
+select json_insert(cast('{"a": 1, "b": 2}' as json), '$.*[1]', 6);
+json_insert(cast('{"a": 1, "b": 2}' as json), '$.*[1]', 6)
+NULL
+Warnings:
+Warning 4044 Wildcards in JSON path not allowed in argument 2 to function 'json_insert'
+error ER_INVALID_JSON_PATH_WILDCARD
+select json_insert(cast('{"a": {"b": 3}}' as json), '$.a.*[1]', 6);
+json_insert(cast('{"a": {"b": 3}}' as json), '$.a.*[1]', 6)
+NULL
+Warnings:
+Warning 4044 Wildcards in JSON path not allowed in argument 2 to function 'json_insert'
+error ER_INVALID_JSON_PATH_WILDCARD
+select json_insert(cast('{"a": {"b": [3]}}' as json), '$.a.*[1]', 6);
+json_insert(cast('{"a": {"b": [3]}}' as json), '$.a.*[1]', 6)
+NULL
+Warnings:
+Warning 4044 Wildcards in JSON path not allowed in argument 2 to function 'json_insert'
+error ER_INVALID_JSON_PATH_WILDCARD
+select json_insert(cast('{"a": {"b": 3}}' as json), '$**[1]', 6);
+json_insert(cast('{"a": {"b": 3}}' as json), '$**[1]', 6)
+NULL
+Warnings:
+Warning 4044 Wildcards in JSON path not allowed in argument 2 to function 'json_insert'
+error ER_INVALID_JSON_PATH_WILDCARD
+select json_insert(cast('{"a": {"b": [3]}}' as json), '$**[1]', 6);
+json_insert(cast('{"a": {"b": [3]}}' as json), '$**[1]', 6)
+NULL
+Warnings:
+Warning 4044 Wildcards in JSON path not allowed in argument 2 to function 'json_insert'
+error ER_INVALID_JSON_PATH_WILDCARD
+select json_insert(cast('[1]' as json), '$[*][1]', 6);
+json_insert(cast('[1]' as json), '$[*][1]', 6)
+NULL
+Warnings:
+Warning 4044 Wildcards in JSON path not allowed in argument 2 to function 'json_insert'
+error ER_INVALID_JSON_PATH_WILDCARD
+select json_insert(cast('[1]' as json), '$**[1]', 6);
+json_insert(cast('[1]' as json), '$**[1]', 6)
+NULL
+Warnings:
+Warning 4044 Wildcards in JSON path not allowed in argument 2 to function 'json_insert'
+error ER_INVALID_JSON_PATH_WILDCARD
+select json_insert(cast('[1, [2], 3]' as json), '$[*][1]', 6);
+json_insert(cast('[1, [2], 3]' as json), '$[*][1]', 6)
+NULL
+Warnings:
+Warning 4044 Wildcards in JSON path not allowed in argument 2 to function 'json_insert'
+error ER_INVALID_JSON_PATH_WILDCARD
+select json_insert(cast('[1, [2], 3]' as json), '$**[1]', 6);
+json_insert(cast('[1, [2], 3]' as json), '$**[1]', 6)
+NULL
+Warnings:
+Warning 4044 Wildcards in JSON path not allowed in argument 2 to function 'json_insert'
+error ER_INVALID_JSON_PATH_WILDCARD
+select json_insert(cast('[[1]]' as json), '$[*][1]', 6);
+json_insert(cast('[[1]]' as json), '$[*][1]', 6)
+NULL
+Warnings:
+Warning 4044 Wildcards in JSON path not allowed in argument 2 to function 'json_insert'
+error ER_INVALID_JSON_PATH_WILDCARD
+select json_insert(cast('[[1]]' as json), '$**[1]', 6);
+json_insert(cast('[[1]]' as json), '$**[1]', 6)
+NULL
+Warnings:
+Warning 4044 Wildcards in JSON path not allowed in argument 2 to function 'json_insert'
+select json_insert(cast('{"a": 3}' as json), '$[1]', 6);
+json_insert(cast('{"a": 3}' as json), '$[1]', 6)
+[{"a": 3}, 6]
+SELECT JSON_INSERT('{ "a" : "foo", "b" : [ 1, 2, 3 ] }', '$.a', true);
+JSON_INSERT('{ "a" : "foo", "b" : [ 1, 2, 3 ] }', '$.a', true)
+{ "a" : "foo", "b" : [ 1, 2, 3 ] }
+SELECT JSON_INSERT('{ "a" : "foo", "b" : [ 1, 2, 3 ] }', '$.c', 123);
+JSON_INSERT('{ "a" : "foo", "b" : [ 1, 2, 3 ] }', '$.c', 123)
+{ "a" : "foo", "b" : [ 1, 2, 3 ] , "c":123}
+SELECT JSON_INSERT('{ "a" : "foo", "b" : [ 1, 2, 3 ] }', '$.c', '123');
+JSON_INSERT('{ "a" : "foo", "b" : [ 1, 2, 3 ] }', '$.c', '123')
+{ "a" : "foo", "b" : [ 1, 2, 3 ] , "c":"123"}
+SELECT JSON_INSERT('{ "a" : "foo", "b" : [ 1, 2, 3 ] }', '$.a[1]', true);
+JSON_INSERT('{ "a" : "foo", "b" : [ 1, 2, 3 ] }', '$.a[1]', true)
+{ "a" : ["foo", true], "b" : [ 1, 2, 3 ] }
+SELECT JSON_INSERT('{ "a" : "foo"}', '$.b', true, '$.b', false);
+JSON_INSERT('{ "a" : "foo"}', '$.b', true, '$.b', false)
+{ "a" : "foo", "b":true}
+SELECT JSON_INSERT
+(
+'{ "a" : "foo", "b" : [ 1, 2, 3 ] }',
+'$.a',
+true
+);
+JSON_INSERT
+(
+'{ "a" : "foo", "b" : [ 1, 2, 3 ] }',
+'$.a',
+true
+)
+{ "a" : "foo", "b" : [ 1, 2, 3 ] }
+SELECT JSON_INSERT
+(
+'{ "a" : "foo", "b" : [ 1, 2, 3 ] }',
+'$.c',
+123
+);
+JSON_INSERT
+(
+'{ "a" : "foo", "b" : [ 1, 2, 3 ] }',
+'$.c',
+123
+)
+{ "a" : "foo", "b" : [ 1, 2, 3 ] , "c":123}
+SELECT JSON_INSERT
+(
+'{ "a" : "foo", "b" : [ 1, 2, 3 ] }',
+'$.c',
+'123'
+);
+JSON_INSERT
+(
+'{ "a" : "foo", "b" : [ 1, 2, 3 ] }',
+'$.c',
+'123'
+)
+{ "a" : "foo", "b" : [ 1, 2, 3 ] , "c":"123"}
+SELECT JSON_INSERT
+(
+'{ "a" : "foo", "b" : [ 1, 2, 3 ] }',
+'$.a[1]',
+true
+);
+JSON_INSERT
+(
+'{ "a" : "foo", "b" : [ 1, 2, 3 ] }',
+'$.a[1]',
+true
+)
+{ "a" : ["foo", true], "b" : [ 1, 2, 3 ] }
+SELECT JSON_INSERT
+(
+'{ "a" : "foo"}',
+'$.b', true,
+'$.b', false
+);
+JSON_INSERT
+(
+'{ "a" : "foo"}',
+'$.b', true,
+'$.b', false
+)
+{ "a" : "foo", "b":true}
+# ----------------------------------------------------------------------
+# Test of JSON_ARRAY_INSERT function.
+# ----------------------------------------------------------------------
+select json_array_insert(NULL, '$.b[1]', 1);
+json_array_insert(NULL, '$.b[1]', 1)
+NULL
+select json_array_insert('[1,2,3]', NULL, 1);
+json_array_insert('[1,2,3]', NULL, 1)
+NULL
+select json_array_insert('[1,2,3]', '$[3]', NULL);
+json_array_insert('[1,2,3]', '$[3]', NULL)
+[1,2,3, null]
+select json_array_insert(NULL);
+ERROR 42000: Incorrect parameter count in the call to native function 'json_array_insert'
+select json_array_insert(NULL, NULL);
+ERROR 42000: Incorrect parameter count in the call to native function 'json_array_insert'
+select json_array_insert(NULL, NULL, NULL, NULL);
+ERROR 42000: Incorrect parameter count in the call to native function 'json_array_insert'
+error ER_INVALID_JSON_PATH_ARRAY_CELL
+select json_array_insert('true', '$', 1);
+json_array_insert('true', '$', 1)
+NULL
+error ER_INVALID_JSON_PATH_ARRAY_CELL
+select json_array_insert('true', '$.a', 1);
+json_array_insert('true', '$.a', 1)
+NULL
+error ER_INVALID_JSON_PATH_ARRAY_CELL
+select json_array_insert('true', '$.a[1].b', 1);
+json_array_insert('true', '$.a[1].b', 1)
+NULL
+select json_array_insert( 'true', '$[0]', false );
+json_array_insert( 'true', '$[0]', false )
+true
+select json_array_insert( 'true', '$[1]', false );
+json_array_insert( 'true', '$[1]', false )
+true
+select json_array_insert( '{ "a": true }', '$.a[0]', false );
+json_array_insert( '{ "a": true }', '$.a[0]', false )
+{ "a": true }
+select json_array_insert( '{ "a": true }', '$.a[1]', false );
+json_array_insert( '{ "a": true }', '$.a[1]', false )
+{ "a": true }
+select json_array_insert( '[]', '$[0]', false );
+json_array_insert( '[]', '$[0]', false )
+[false]
+select json_array_insert( '[]', '$[1]', false );
+json_array_insert( '[]', '$[1]', false )
+[false]
+select json_array_insert( '[true]', '$[0]', false );
+json_array_insert( '[true]', '$[0]', false )
+[false, true]
+select json_array_insert( '[true]', '$[1]', false );
+json_array_insert( '[true]', '$[1]', false )
+[true, false]
+select json_array_insert( '[true]', '$[2]', false );
+json_array_insert( '[true]', '$[2]', false )
+[true, false]
+select json_array_insert( '{ "a": [] }', '$.a[0]', false );
+json_array_insert( '{ "a": [] }', '$.a[0]', false )
+{ "a": [false] }
+select json_array_insert( '{ "a": [] }', '$.a[1]', false );
+json_array_insert( '{ "a": [] }', '$.a[1]', false )
+{ "a": [false] }
+select json_array_insert( '{ "a": [true] }', '$.a[0]', false );
+json_array_insert( '{ "a": [true] }', '$.a[0]', false )
+{ "a": [false, true] }
+select json_array_insert( '{ "a": [true] }', '$.a[1]', false );
+json_array_insert( '{ "a": [true] }', '$.a[1]', false )
+{ "a": [true, false] }
+select json_array_insert( '{ "a": [true] }', '$.a[2]', false );
+json_array_insert( '{ "a": [true] }', '$.a[2]', false )
+{ "a": [true, false] }
+select json_array_insert( '[1, 2, 3, 4]', '$[0]', false );
+json_array_insert( '[1, 2, 3, 4]', '$[0]', false )
+[false, 1, 2, 3, 4]
+select json_array_insert( '[1, 2, 3, 4]', '$[1]', false );
+json_array_insert( '[1, 2, 3, 4]', '$[1]', false )
+[1, false, 2, 3, 4]
+select json_array_insert( '[1, 2, 3, 4]', '$[2]', false );
+json_array_insert( '[1, 2, 3, 4]', '$[2]', false )
+[1, 2, false, 3, 4]
+select json_array_insert( '[1, 2, 3, 4]', '$[3]', false );
+json_array_insert( '[1, 2, 3, 4]', '$[3]', false )
+[1, 2, 3, false, 4]
+select json_array_insert( '[1, 2, 3, 4]', '$[4]', false );
+json_array_insert( '[1, 2, 3, 4]', '$[4]', false )
+[1, 2, 3, 4, false]
+select json_array_insert( '[1, 2, 3, 4]', '$[5]', false );
+json_array_insert( '[1, 2, 3, 4]', '$[5]', false )
+[1, 2, 3, 4, false]
+select json_array_insert( '{ "a": [1, 2, 3, 4] }', '$.a[0]', false );
+json_array_insert( '{ "a": [1, 2, 3, 4] }', '$.a[0]', false )
+{ "a": [false, 1, 2, 3, 4] }
+select json_array_insert( '{ "a": [1, 2, 3, 4] }', '$.a[1]', false );
+json_array_insert( '{ "a": [1, 2, 3, 4] }', '$.a[1]', false )
+{ "a": [1, false, 2, 3, 4] }
+select json_array_insert( '{ "a": [1, 2, 3, 4] }', '$.a[2]', false );
+json_array_insert( '{ "a": [1, 2, 3, 4] }', '$.a[2]', false )
+{ "a": [1, 2, false, 3, 4] }
+select json_array_insert( '{ "a": [1, 2, 3, 4] }', '$.a[3]', false );
+json_array_insert( '{ "a": [1, 2, 3, 4] }', '$.a[3]', false )
+{ "a": [1, 2, 3, false, 4] }
+select json_array_insert( '{ "a": [1, 2, 3, 4] }', '$.a[4]', false );
+json_array_insert( '{ "a": [1, 2, 3, 4] }', '$.a[4]', false )
+{ "a": [1, 2, 3, 4, false] }
+select json_array_insert( '{ "a": [1, 2, 3, 4] }', '$.a[5]', false );
+json_array_insert( '{ "a": [1, 2, 3, 4] }', '$.a[5]', false )
+{ "a": [1, 2, 3, 4, false] }
+select json_array_insert( '{ "a": [1, 2, 3, 4] }', '$.b[0]', false );
+json_array_insert( '{ "a": [1, 2, 3, 4] }', '$.b[0]', false )
+{ "a": [1, 2, 3, 4] }
+select json_array_insert( '{ "a": [1, 2, 3, 4] }', '$.b[1]', false );
+json_array_insert( '{ "a": [1, 2, 3, 4] }', '$.b[1]', false )
+{ "a": [1, 2, 3, 4] }
+select json_array_insert( '"a"', '$[0]', true );
+json_array_insert( '"a"', '$[0]', true )
+"a"
+select json_array_insert( '[ "a" ]', '$[0][0]', true );
+json_array_insert( '[ "a" ]', '$[0][0]', true )
+[ "a" ]
+select json_array_insert( '"a"', '$[1]', true );
+json_array_insert( '"a"', '$[1]', true )
+"a"
+error ER_INVALID_JSON_PATH_WILDCARD
+select json_insert('[]', '$.a.*[1]', 6);
+json_insert('[]', '$.a.*[1]', 6)
+NULL
+Warnings:
+Warning 4044 Wildcards in JSON path not allowed in argument 2 to function 'json_insert'
+error ER_INVALID_JSON_PATH_WILDCARD
+select json_insert('[]', '$**[1]', 6);
+json_insert('[]', '$**[1]', 6)
+NULL
+Warnings:
+Warning 4044 Wildcards in JSON path not allowed in argument 2 to function 'json_insert'
+error ER_INVALID_JSON_PATH_WILDCARD
+select json_insert('[]', '$[*][1]', 6);
+json_insert('[]', '$[*][1]', 6)
+NULL
+Warnings:
+Warning 4044 Wildcards in JSON path not allowed in argument 2 to function 'json_insert'
+select json_array_insert( '[ 1, 2, 3 ]', '$[1]', true, '$[1]', false );
+json_array_insert( '[ 1, 2, 3 ]', '$[1]', true, '$[1]', false )
+[ 1, false, true, 2, 3 ]
+select json_array_insert( '[ 1, 2, 3 ]', '$[1]',
+cast( '[ "a", "b", "c", "d" ]' as json ), '$[1][2]', false );
+json_array_insert( '[ 1, 2, 3 ]', '$[1]',
+cast( '[ "a", "b", "c", "d" ]' as json ), '$[1][2]', false )
+[ 1, [ "a", "b", false, "c", "d" ], 2, 3 ]
+error ER_INVALID_JSON_TEXT_IN_PARAM
+SELECT JSON_ARRAY_INSERT(JSON_EXTRACT('[1', '$'), '$[0]', 1);
+JSON_ARRAY_INSERT(JSON_EXTRACT('[1', '$'), '$[0]', 1)
+NULL
+Warnings:
+Warning 4037 Unexpected end of JSON text in argument 1 to function 'json_extract'
+error ER_INVALID_JSON_TEXT_IN_PARAM
+select json_array_insert( '[ 1, 2, 3 ]', '$[1]', json_extract( '[', '$' ) );
+json_array_insert( '[ 1, 2, 3 ]', '$[1]', json_extract( '[', '$' ) )
+[ 1, null, 2, 3 ]
+Warnings:
+Warning 4037 Unexpected end of JSON text in argument 1 to function 'json_extract'
+# ----------------------------------------------------------------------
+# Test of JSON_SET function.
+# ----------------------------------------------------------------------
+select json_set(NULL, '$.b', cast(1 as json));
+json_set(NULL, '$.b', cast(1 as json))
+NULL
+select json_set('[1,2,3]', NULL, cast(1 as json));
+json_set('[1,2,3]', NULL, cast(1 as json))
+NULL
+select json_set('[1,2,3]', '$[3]', NULL);
+json_set('[1,2,3]', '$[3]', NULL)
+[1,2,3, null]
+select json_set(NULL);
+ERROR 42000: Incorrect parameter count in the call to native function 'json_set'
+select json_set(NULL, NULL);
+ERROR 42000: Incorrect parameter count in the call to native function 'json_set'
+select json_set(NULL, NULL, NULL, NULL);
+ERROR 42000: Incorrect parameter count in the call to native function 'json_set'
+error ER_INVALID_JSON_TEXT_IN_PARAM
+SELECT JSON_SET('{}', '$.name', JSON_EXTRACT('', '$'));
+JSON_SET('{}', '$.name', JSON_EXTRACT('', '$'))
+{, "name":null}
+Warnings:
+Warning 4037 Unexpected end of JSON text in argument 1 to function 'json_extract'
+select json_set('[1,2,3]', '$[2]', 4);
+json_set('[1,2,3]', '$[2]', 4)
+[1,2,4]
+select json_set('[1,2,3]', '$[3]', 4);
+json_set('[1,2,3]', '$[3]', 4)
+[1,2,3, 4]
+select json_set('[1,2,3]', '$[10]', 4);
+json_set('[1,2,3]', '$[10]', 4)
+[1,2,3, 4]
+select json_set('{"c":4}', '$.c', 5);
+json_set('{"c":4}', '$.c', 5)
+{"c":5}
+select json_set('{"c":4}', '$.a', 5);
+json_set('{"c":4}', '$.a', 5)
+{"c":4, "a":5}
+select json_set('1', '$', 4);
+json_set('1', '$', 4)
+4
+select json_set('1', '$[0]', 4);
+json_set('1', '$[0]', 4)
+4
+select json_set('1', '$[1]', 4);
+json_set('1', '$[1]', 4)
+[1, 4]
+select json_set('1', '$[10]', '4', '$[11]', 5);
+json_set('1', '$[10]', '4', '$[11]', 5)
+[1, "4", 5]
+select json_set('[1,2,3]', '$[2][0]', 4);
+json_set('[1,2,3]', '$[2][0]', 4)
+[1,2,4]
+select json_set('[1,2,3]', '$[2][2]', 4);
+json_set('[1,2,3]', '$[2][2]', 4)
+[1,2,[3, 4]]
+select json_set('{"a": 3}', '$.a[0]', 4);
+json_set('{"a": 3}', '$.a[0]', 4)
+{"a": 4}
+select json_set('{"a": 3}', '$.a[1]', 4, '$.a[2]', '5');
+json_set('{"a": 3}', '$.a[1]', 4, '$.a[2]', '5')
+{"a": [3, 4, "5"]}
+error ER_INVALID_JSON_PATH_WILDCARD
+select json_set(cast('{"a": {"b": [3]}}' as json), '$**[1]', 6);
+json_set(cast('{"a": {"b": [3]}}' as json), '$**[1]', 6)
+NULL
+Warnings:
+Warning 4044 Wildcards in JSON path not allowed in argument 2 to function 'json_set'
+SELECT JSON_SET('{ "a" : "foo", "b" : [ 1, 2, 3 ] }',
+'$.a',
+JSON_OBJECT());
+JSON_SET('{ "a" : "foo", "b" : [ 1, 2, 3 ] }',
+'$.a',
+JSON_OBJECT())
+{ "a" : {}, "b" : [ 1, 2, 3 ] }
+SELECT JSON_SET('{ "a" : "foo"}', '$.a',
+JSON_OBJECT( 'b', false ), '$.a.c', true);
+JSON_SET('{ "a" : "foo"}', '$.a',
+JSON_OBJECT( 'b', false ), '$.a.c', true)
+{ "a" : {"b": false, "c":true}}
+select json_set('{ "a" : "foo", "b" : [ 1, 2, 3 ] }',
+'$.a',
+cast('{}' as json));
+json_set('{ "a" : "foo", "b" : [ 1, 2, 3 ] }',
+'$.a',
+cast('{}' as json))
+{ "a" : {}, "b" : [ 1, 2, 3 ] }
+select json_set('{ "a" : "foo", "b" : [ 1, 2, 3 ] }',
+'$.c',
+cast('[true, false]' as json));
+json_set('{ "a" : "foo", "b" : [ 1, 2, 3 ] }',
+'$.c',
+cast('[true, false]' as json))
+{ "a" : "foo", "b" : [ 1, 2, 3 ] , "c":[true, false]}
+select json_set('1', '$[3]', 2);
+json_set('1', '$[3]', 2)
+[1, 2]
+select json_set('{ "a" : "foo"}', '$.a',
+cast('{"b": false}' as json), '$.a.c', true);
+json_set('{ "a" : "foo"}', '$.a',
+cast('{"b": false}' as json), '$.a.c', true)
+{ "a" : {"b": false, "c":true}}
+SELECT JSON_SET
+(
+'{ "a" : "foo", "b" : [ 1, 2, 3 ] }',
+'$.a',
+JSON_OBJECT()
+);
+JSON_SET
+(
+'{ "a" : "foo", "b" : [ 1, 2, 3 ] }',
+'$.a',
+JSON_OBJECT()
+)
+{ "a" : {}, "b" : [ 1, 2, 3 ] }
+SELECT JSON_SET
+(
+'{ "a" : "foo", "b" : [ 1, 2, 3 ] }',
+'$.c',
+JSON_ARRAY( true, false )
+);
+JSON_SET
+(
+'{ "a" : "foo", "b" : [ 1, 2, 3 ] }',
+'$.c',
+JSON_ARRAY( true, false )
+)
+{ "a" : "foo", "b" : [ 1, 2, 3 ] , "c":[true, false]}
+SELECT JSON_SET
+(
+'{ "a" : "foo", "b" : [ 1, 2, 3 ] }',
+'$.c',
+JSON_ARRAY( CAST( 'true' AS JSON ), CAST( 'false' AS JSON ) )
+);
+JSON_SET
+(
+'{ "a" : "foo", "b" : [ 1, 2, 3 ] }',
+'$.c',
+JSON_ARRAY( CAST( 'true' AS JSON ), CAST( 'false' AS JSON ) )
+)
+{ "a" : "foo", "b" : [ 1, 2, 3 ] , "c":[true, false]}
+SELECT JSON_SET
+(
+'1',
+'$[3]',
+2
+);
+JSON_SET
+(
+'1',
+'$[3]',
+2
+)
+[1, 2]
+SELECT JSON_SET
+(
+'{ "a" : "foo"}',
+'$.a', JSON_OBJECT( 'b', false ),
+'$.a.c', true
+);
+JSON_SET
+(
+'{ "a" : "foo"}',
+'$.a', JSON_OBJECT( 'b', false ),
+'$.a.c', true
+)
+{ "a" : {"b": false, "c":true}}
+# ----------------------------------------------------------------------
+# Test of JSON_REPLACE function.
+# ----------------------------------------------------------------------
+select json_replace(NULL, '$.b', cast(1 as json));
+json_replace(NULL, '$.b', cast(1 as json))
+NULL
+select json_replace('[1,2,3]', NULL, cast(1 as json));
+json_replace('[1,2,3]', NULL, cast(1 as json))
+NULL
+select json_replace('[1,2,3]', '$[2]', NULL);
+json_replace('[1,2,3]', '$[2]', NULL)
+[1,2,null]
+select json_replace(NULL);
+ERROR 42000: Incorrect parameter count in the call to native function 'json_replace'
+select json_replace(NULL, NULL);
+ERROR 42000: Incorrect parameter count in the call to native function 'json_replace'
+select json_replace(NULL, NULL, NULL, NULL);
+ERROR 42000: Incorrect parameter count in the call to native function 'json_replace'
+select json_replace('[1,2,3]', '$[2]', 4);
+json_replace('[1,2,3]', '$[2]', 4)
+[1,2,4]
+select json_replace('[1,2,3]', '$[3]', 4);
+json_replace('[1,2,3]', '$[3]', 4)
+[1,2,3]
+select json_replace('[1,2,3]', '$[10]', 4);
+json_replace('[1,2,3]', '$[10]', 4)
+[1,2,3]
+select json_replace('{"c":4}', '$.c', 5);
+json_replace('{"c":4}', '$.c', 5)
+{"c":5}
+select json_replace('{"c":4}', '$.a', 5);
+json_replace('{"c":4}', '$.a', 5)
+{"c":4}
+select json_replace('1', '$', 4);
+json_replace('1', '$', 4)
+4
+select json_replace('1', '$[0]', 4);
+json_replace('1', '$[0]', 4)
+4
+select json_replace('1', '$[1]', 4);
+json_replace('1', '$[1]', 4)
+1
+select json_replace('1', '$[10]', '4', '$[11]', 5);
+json_replace('1', '$[10]', '4', '$[11]', 5)
+1
+select json_replace('[1,2,3]', '$[2][0]', 4);
+json_replace('[1,2,3]', '$[2][0]', 4)
+[1,2,4]
+select json_replace('[1,2,3]', '$[2][2]', 4);
+json_replace('[1,2,3]', '$[2][2]', 4)
+[1,2,3]
+select json_replace('{"a": 3}', '$.a[0]', 4);
+json_replace('{"a": 3}', '$.a[0]', 4)
+{"a": 4}
+select json_replace('{"a": 3}', '$.a[1]', 4, '$.a[2]', '5');
+json_replace('{"a": 3}', '$.a[1]', 4, '$.a[2]', '5')
+{"a": 3}
+SELECT JSON_REPLACE('{ "a" : "foo", "b" : [ 1, 2, 3 ] }',
+'$.c',
+true);
+JSON_REPLACE('{ "a" : "foo", "b" : [ 1, 2, 3 ] }',
+'$.c',
+true)
+{ "a" : "foo", "b" : [ 1, 2, 3 ] }
+SELECT JSON_REPLACE('{ "a" : "foo", "b" : [ 1, 2, 3 ] }',
+'$.a[0]',
+true);
+JSON_REPLACE('{ "a" : "foo", "b" : [ 1, 2, 3 ] }',
+'$.a[0]',
+true)
+{ "a" : true, "b" : [ 1, 2, 3 ] }
+SELECT JSON_REPLACE('{ "a" : "foo", "b" : [ 1, 2, 3 ] }',
+'$.b[5]',
+true);
+JSON_REPLACE('{ "a" : "foo", "b" : [ 1, 2, 3 ] }',
+'$.b[5]',
+true)
+{ "a" : "foo", "b" : [ 1, 2, 3 ] }
+# ----------------------------------------------------------------------
+# Test of JSON_ARRAY function.
+# ----------------------------------------------------------------------
+select json_array(NULL, '$.b', cast(1 as json));
+json_array(NULL, '$.b', cast(1 as json))
+[null, "$.b", 1]
+select json_array('[1,2,3]', NULL, cast(1 as json));
+json_array('[1,2,3]', NULL, cast(1 as json))
+["[1,2,3]", null, 1]
+select json_array('[1,2,3]', '$[3]', NULL);
+json_array('[1,2,3]', '$[3]', NULL)
+["[1,2,3]", "$[3]", null]
+select json_array();
+json_array()
+[]
+select json_array(3.14);
+json_array(3.14)
+[3.14]
+select json_array('[1,2,3]');
+json_array('[1,2,3]')
+["[1,2,3]"]
+select json_array(cast('[1,2,3]' as json));
+json_array(cast('[1,2,3]' as json))
+[[1,2,3]]
+select json_array(1,2,3);
+json_array(1,2,3)
+[1, 2, 3]
+select json_array(b'0', b'1', b'10');
+json_array(b'0', b'1', b'10')
+["\u0000", "\u0001", "\u0002"]
+SELECT JSON_ARRAY();
+JSON_ARRAY()
+[]
+# ----------------------------------------------------------------------
+# Test of JSON_OBJECT function.
+# ----------------------------------------------------------------------
+select json_object( 'a' );
+ERROR 42000: Incorrect parameter count in the call to native function 'json_object'
+select json_object( 'a', 1, 'b' );
+ERROR 42000: Incorrect parameter count in the call to native function 'json_object'
+error ER_JSON_DOCUMENT_NULL_KEY
+select json_object( null, 1 );
+json_object( null, 1 )
+{"": 1}
+select json_object();
+json_object()
+{}
+select json_object( 'a', null );
+json_object( 'a', null )
+{"a": null}
+select json_object( 'a', 1 );
+json_object( 'a', 1 )
+{"a": 1}
+select json_object( 'a', 1, 'b', 'foo' );
+json_object( 'a', 1, 'b', 'foo' )
+{"a": 1, "b": "foo"}
+select json_object( 'a', 1, 'b', 'foo', 'c', cast( '{ "d": "wibble" }' as json ) );
+json_object( 'a', 1, 'b', 'foo', 'c', cast( '{ "d": "wibble" }' as json ) )
+{"a": 1, "b": "foo", "c": { "d": "wibble" }}
+select json_object( 'a', true, 'b', false, 'c', cast( 'null' as json) );
+json_object( 'a', true, 'b', false, 'c', cast( 'null' as json) )
+{"a": true, "b": false, "c": null}
+select json_valid( json_object( '"a"', 1 ) );
+json_valid( json_object( '"a"', 1 ) )
+0
+select json_object( REPEAT('a', 64 * 1024), 1 );
+json_object( REPEAT('a', 64 * 1024), 1 )
+{"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa": 1}
+select json_object(json_array(), json_array());
+json_object(json_array(), json_array())
+{"[]": []}
+select json_object( cast(json_array() as char), json_array());
+json_object( cast(json_array() as char), json_array())
+{"[]": []}
+select json_object( 1, json_array());
+json_object( 1, json_array())
+{"1": []}
+select json_object( cast(1 as char), json_array());
+json_object( cast(1 as char), json_array())
+{"1": []}
+SELECT JSON_OBJECT();
+JSON_OBJECT()
+{}
+# ----------------------------------------------------------------------
+# Test of JSON_SEARCH function.
+# ----------------------------------------------------------------------
+select json_search();
+ERROR 42000: Incorrect parameter count in the call to native function 'json_search'
+select json_search( '{ "a": true }' );
+ERROR 42000: Incorrect parameter count in the call to native function 'json_search'
+select json_search( '{ "a": true }', 'one' );
+ERROR 42000: Incorrect parameter count in the call to native function 'json_search'
+select json_search( null, 'one', 'foo' );
+json_search( null, 'one', 'foo' )
+NULL
+select json_search( '{ "a": "foo" }', null, 'foo' );
+json_search( '{ "a": "foo" }', null, 'foo' )
+NULL
+select json_search( '{ "a": "foo" }', 'one', 'foo', null, null );
+json_search( '{ "a": "foo" }', 'one', 'foo', null, null )
+NULL
+select json_search( '{ "a": "foo" }', 'one', 'foo', null, '$.a', null );
+json_search( '{ "a": "foo" }', 'one', 'foo', null, '$.a', null )
+NULL
+error ER_JSON_BAD_ONE_OR_ALL_ARG
+select json_search( '{ "a": "foo" }', 'twof', 'foo' );
+json_search( '{ "a": "foo" }', 'twof', 'foo' )
+NULL
+Warnings:
+Warning 4046 Argument 2 to function 'json_search' must be "one" or "all".
+error ER_JSON_BAD_ONE_OR_ALL_ARG
+select json_search( '{ "a": "foo" }', 'two', 'foo' );
+json_search( '{ "a": "foo" }', 'two', 'foo' )
+NULL
+Warnings:
+Warning 4046 Argument 2 to function 'json_search' must be "one" or "all".
+select json_search( '{ "a": "foo" }', 'one', 'foo', 'ab' );
+ERROR HY000: Incorrect arguments to ESCAPE
+error ER_INVALID_JSON_PATH
+select json_search( '{ "a": "foo" }', 'one', 'foo', null, '$a' );
+json_search( '{ "a": "foo" }', 'one', 'foo', null, '$a' )
+NULL
+Warnings:
+Warning 4042 Syntax error in JSON path in argument 5 to function 'json_search' at position 2
+error ER_INVALID_JSON_PATH
+select json_search( '{ "a": "foo" }', 'all', 'foo', null, '$.a', '$b' );
+json_search( '{ "a": "foo" }', 'all', 'foo', null, '$.a', '$b' )
+NULL
+Warnings:
+Warning 4042 Syntax error in JSON path in argument 6 to function 'json_search' at position 2
+select json_search(a, b, c);
+ERROR 42S22: Unknown column 'a' in 'field list'
+select json_search( '{ "a": "foobar" }', 'one', 'foo%' );
+json_search( '{ "a": "foobar" }', 'one', 'foo%' )
+"$.a"
+select json_search( '{ "a": "foobar", "b": "focus", "c": [ "arm", "foot", "shoulder" ] }', 'one', 'foo%' );
+json_search( '{ "a": "foobar", "b": "focus", "c": [ "arm", "foot", "shoulder" ] }', 'one', 'foo%' )
+"$.a"
+select json_search( '{ "a": "foobar", "b": "focus", "c": [ "arm", "foot", "shoulder" ] }', 'all', 'foo%' );
+json_search( '{ "a": "foobar", "b": "focus", "c": [ "arm", "foot", "shoulder" ] }', 'all', 'foo%' )
+["$.a", "$.c[1]"]
+select json_search( '{ "a": "foobar", "b": "focus", "c": [ "arm", "foot", "shoulder" ] }', 'all', 'f__us' );
+json_search( '{ "a": "foobar", "b": "focus", "c": [ "arm", "foot", "shoulder" ] }', 'all', 'f__us' )
+"$.b"
+select json_search( '{ "a": [ "foolish", "folly", "foolhardy" ], "b" : "fool" }', 'all', 'foo%', null, '$.a' );
+json_search( '{ "a": [ "foolish", "folly", "foolhardy" ], "b" : "fool" }', 'all', 'foo%', null, '$.a' )
+["$.a[0]", "$.a[2]"]
+select json_search( '{ "a": [ "foolish", "folly", "foolhardy" ], "b" : "fool" }', 'all', 'foo%', null, '$.a', '$.b' );
+json_search( '{ "a": [ "foolish", "folly", "foolhardy" ], "b" : "fool" }', 'all', 'foo%', null, '$.a', '$.b' )
+["$.a[0]", "$.a[2]", "$.b"]
+select json_search( '{ "a": [ "foolish", "folly", "foolhardy" ], "b" : "fool" }', 'one', 'foo%', null, '$.a', '$.b' );
+json_search( '{ "a": [ "foolish", "folly", "foolhardy" ], "b" : "fool" }', 'one', 'foo%', null, '$.a', '$.b' )
+"$.a[0]"
+select json_search( '{ "a": [ "foolish", "folly", "foolhardy" ], "b" : "fool" }', 'ALL', 'foo%', null, '$.a' );
+json_search( '{ "a": [ "foolish", "folly", "foolhardy" ], "b" : "fool" }', 'ALL', 'foo%', null, '$.a' )
+["$.a[0]", "$.a[2]"]
+select json_search( '{ "a": [ "foolish", "folly", "foolhardy" ], "b" : "fool" }', 'aLl', 'foo%', null, '$.a', '$.b' );
+json_search( '{ "a": [ "foolish", "folly", "foolhardy" ], "b" : "fool" }', 'aLl', 'foo%', null, '$.a', '$.b' )
+["$.a[0]", "$.a[2]", "$.b"]
+select json_search( '{ "a": [ "foolish", "folly", "foolhardy" ], "b" : "fool" }', 'ONE', 'foo%', null, '$.a', '$.b' );
+json_search( '{ "a": [ "foolish", "folly", "foolhardy" ], "b" : "fool" }', 'ONE', 'foo%', null, '$.a', '$.b' )
+"$.a[0]"
+select json_search
+(
+'[ { "a": { "b": { "c": "fool" } } }, { "b": { "c": "shoulder" } }, { "c": { "c": "food"} } ]',
+'all',
+'foo%',
+null,
+'$**.c'
+);
+json_search
+(
+'[ { "a": { "b": { "c": "fool" } } }, { "b": { "c": "shoulder" } }, { "c": { "c": "food"} } ]',
+'all',
+'foo%',
+null,
+'$**.c'
+)
+["$[0].a.b.c", "$[2].c.c"]
+select json_search
+(
+'[ { "a": { "b": { "c": "showtime" } } }, { "b": { "c": "shoulder" } }, { "c": { "c": "shoe"} } ]',
+'all',
+'sho%',
+null,
+'$**.c'
+);
+json_search
+(
+'[ { "a": { "b": { "c": "showtime" } } }, { "b": { "c": "shoulder" } }, { "c": { "c": "shoe"} } ]',
+'all',
+'sho%',
+null,
+'$**.c'
+)
+["$[0].a.b.c", "$[1].b.c", "$[2].c.c"]
+select json_search
+(
+'[ { "a": { "b": { "c": "showtime" } } }, { "b": { "c": "shoulder" } }, { "c": { "c": "shoe"} } ]',
+'all',
+'sho%e',
+null,
+'$**.c'
+);
+json_search
+(
+'[ { "a": { "b": { "c": "showtime" } } }, { "b": { "c": "shoulder" } }, { "c": { "c": "shoe"} } ]',
+'all',
+'sho%e',
+null,
+'$**.c'
+)
+["$[0].a.b.c", "$[2].c.c"]
+select json_search
+(
+'[ { "a": { "b": { "c": "showtime" } } }, { "b": { "c": "shoulder" } }, { "c": { "c": "shoe"} } ]',
+'all',
+'sho%',
+null,
+'$[*].c'
+);
+json_search
+(
+'[ { "a": { "b": { "c": "showtime" } } }, { "b": { "c": "shoulder" } }, { "c": { "c": "shoe"} } ]',
+'all',
+'sho%',
+null,
+'$[*].c'
+)
+"$[2].c.c"
+select json_search
+(
+'[ { "a": { "b": { "c": "showtime" } } }, [ { "b": { "c": "shout" } }, { "c": { "c": "shoe"} } ] ]',
+'all',
+'sho%',
+null,
+'$[1]**.c'
+);
+json_search
+(
+'[ { "a": { "b": { "c": "showtime" } } }, [ { "b": { "c": "shout" } }, { "c": { "c": "shoe"} } ] ]',
+'all',
+'sho%',
+null,
+'$[1]**.c'
+)
+["$[1][0].b.c", "$[1][1].c.c"]
+select json_search( '[ "footbar", "foo%bar" ]', 'all', 'foo%bar' );
+json_search( '[ "footbar", "foo%bar" ]', 'all', 'foo%bar' )
+["$[0]", "$[1]"]
+select json_search( '[ "footbar", "foo%bar" ]', 'all', 'foo\%bar' );
+json_search( '[ "footbar", "foo%bar" ]', 'all', 'foo\%bar' )
+NULL
+select json_search( '[ "footbar", "foo%bar" ]', 'all', 'foo|%bar', '|' );
+json_search( '[ "footbar", "foo%bar" ]', 'all', 'foo|%bar', '|' )
+"$[1]"
+select json_search( '[ "footbar", "foo%bar" ]', 'all', 'foo|%bar', '|', '$[0]' );
+json_search( '[ "footbar", "foo%bar" ]', 'all', 'foo|%bar', '|', '$[0]' )
+NULL
+select json_search( '[ "footbar", "foo%bar" ]', 'all', 'foo|%bar', '|', '$[0]', '$[1]' );
+json_search( '[ "footbar", "foo%bar" ]', 'all', 'foo|%bar', '|', '$[0]', '$[1]' )
+"$[1]"
+select json_search( '[ "footbar", "foo%bar" ]', 'all', 'foo|%bar', '|', '$[0]', '$[1]', '$[2]' );
+json_search( '[ "footbar", "foo%bar" ]', 'all', 'foo|%bar', '|', '$[0]', '$[1]', '$[2]' )
+"$[1]"
+select json_search( '[ "footbar", "foo%bar" ]', 'all', 'foo\%bar', null );
+json_search( '[ "footbar", "foo%bar" ]', 'all', 'foo\%bar', null )
+"$[1]"
+select json_search( '[ "footbar", "foo%bar" ]', 'all', 'foo\%bar', null, '$[0]' );
+json_search( '[ "footbar", "foo%bar" ]', 'all', 'foo\%bar', null, '$[0]' )
+NULL
+select json_search( '[ "footbar", "foo%bar" ]', 'all', 'foo\%bar', null, '$[1]' );
+json_search( '[ "footbar", "foo%bar" ]', 'all', 'foo\%bar', null, '$[1]' )
+"$[1]"
+select json_search( '[ "footbar", "foo%bar" ]', 'all', 'foo|%bar', '|', '$[0]' );
+json_search( '[ "footbar", "foo%bar" ]', 'all', 'foo|%bar', '|', '$[0]' )
+NULL
+select json_search( '[ "footbar", "foo%bar" ]', 'all', 'foo|%bar', '|', '$[1]' );
+json_search( '[ "footbar", "foo%bar" ]', 'all', 'foo|%bar', '|', '$[1]' )
+"$[1]"
+select json_search( '[ "abc", "ABC" ]', 'all', 'aBc' );
+json_search( '[ "abc", "ABC" ]', 'all', 'aBc' )
+["$[0]", "$[1]"]
+select json_search( '[ "abc", "ABC" ]', 'all', 'abc' );
+json_search( '[ "abc", "ABC" ]', 'all', 'abc' )
+["$[0]", "$[1]"]
+select json_search( '[ "abc", "ABC" ]', 'all', 'ABC' );
+json_search( '[ "abc", "ABC" ]', 'all', 'ABC' )
+["$[0]", "$[1]"]
+select json_search( '[ 10, "10", 1.0, "1.0" ]', 'all', '1%' );
+json_search( '[ 10, "10", 1.0, "1.0" ]', 'all', '1%' )
+["$[0]", "$[1]", "$[2]", "$[3]"]
+SELECT JSON_SEARCH
+(
+'{ "a" : 123, "b" : [ 123, 456 ] }',
+'one',
+'123'
+);
+JSON_SEARCH
+(
+'{ "a" : 123, "b" : [ 123, 456 ] }',
+'one',
+'123'
+)
+"$.a"
+SELECT JSON_SEARCH
+(
+'{ "a" : "123", "b" : [ 123, "789", "123", "456", "123" ] }',
+'one',
+'123',
+null,
+'$.b'
+);
+JSON_SEARCH
+(
+'{ "a" : "123", "b" : [ 123, "789", "123", "456", "123" ] }',
+'one',
+'123',
+null,
+'$.b'
+)
+"$.b[0]"
+SELECT JSON_SEARCH
+(
+'{ "a" : "123", "b" : { "key" : "123" } }',
+'one',
+'123'
+);
+JSON_SEARCH
+(
+'{ "a" : "123", "b" : { "key" : "123" } }',
+'one',
+'123'
+)
+"$.a"
+SELECT JSON_SEARCH
+(
+'{ "a" : "1243", "b" : { "key" : "1234" } }',
+'one',
+'123%'
+);
+JSON_SEARCH
+(
+'{ "a" : "1243", "b" : { "key" : "1234" } }',
+'one',
+'123%'
+)
+"$.b.key"
+SELECT JSON_SEARCH
+(
+'{ "a" : "1243", "b" : { "key" : "1234", "c": "directorysub%directoryabc" } }',
+'one',
+'dir%torysub@%dir%',
+'@'
+);
+JSON_SEARCH
+(
+'{ "a" : "1243", "b" : { "key" : "1234", "c": "directorysub%directoryabc" } }',
+'one',
+'dir%torysub@%dir%',
+'@'
+)
+"$.b.c"
+SELECT JSON_SEARCH
+(
+'{ "a" : "1243", "b" : { "key" : "1234" } }',
+'one',
+'123%',
+null,
+'$.c'
+);
+JSON_SEARCH
+(
+'{ "a" : "1243", "b" : { "key" : "1234" } }',
+'one',
+'123%',
+null,
+'$.c'
+)
+NULL
+SELECT JSON_UNQUOTE
+(
+JSON_SEARCH
+(
+'{ "onepotato": "foot", "one potato": "food" , "one \\"potato": "fool" }',
+'all',
+'food'
+ )
+);
+JSON_UNQUOTE
+(
+JSON_SEARCH
+(
+'{ "onepotato": "foot", "one potato": "food" , "one \\"potato": "fool" }',
+'all',
+'food'
+ )
+)
+$.one potato
+select json_type(case (null is null) when 1 then
+cast('null' as json) else
+cast('[1,2,3]' as json) end);
+json_type(case (null is null) when 1 then
+cast('null' as json) else
+cast('[1,2,3]' as json) end)
+NULL
+select json_type(case (null is not null) when 1 then
+cast('null' as json) else
+cast('[1,2,3]' as json) end);
+json_type(case (null is not null) when 1 then
+cast('null' as json) else
+cast('[1,2,3]' as json) end)
+ARRAY
+select json_type( if(null is null,
+cast('null' as json),
+cast('[1,2,3]' as json)) );
+json_type( if(null is null,
+cast('null' as json),
+cast('[1,2,3]' as json)) )
+NULL
+select json_type( if(null is not null,
+cast('null' as json),
+cast('[1,2,3]' as json)));
+json_type( if(null is not null,
+cast('null' as json),
+cast('[1,2,3]' as json)))
+ARRAY
+select cast(json_extract(cast(concat('[', cast('["A",2]' as json), ']') as json),
+'$[0][1]') as char) = 2;
+cast(json_extract(cast(concat('[', cast('["A",2]' as json), ']') as json),
+'$[0][1]') as char) = 2
+1
+# ----------------------------------------------------------------------
+# Test of aggregate function MAX, MIN.
+# ----------------------------------------------------------------------
+select max(cast('[1,2,3]' as json));
+max(cast('[1,2,3]' as json))
+[1,2,3]
+# ----------------------------------------------------------------------
+# Test of JSON_QUOTE, JSON_UNQUOTE
+# ----------------------------------------------------------------------
+select json_quote();
+ERROR 42000: Incorrect parameter count in the call to native function 'json_quote'
+select json_quote('abc', 'def');
+ERROR 42000: Incorrect parameter count in the call to native function 'json_quote'
+select json_quote(NULL, 'def');
+ERROR 42000: Incorrect parameter count in the call to native function 'json_quote'
+select json_quote('abc', NULL);
+ERROR 42000: Incorrect parameter count in the call to native function 'json_quote'
+select json_unquote();
+ERROR 42000: Incorrect parameter count in the call to native function 'json_unquote'
+select json_unquote('"abc"', '"def"');
+ERROR 42000: Incorrect parameter count in the call to native function 'json_unquote'
+select json_unquote(NULL, 'def');
+ERROR 42000: Incorrect parameter count in the call to native function 'json_unquote'
+select json_unquote('"abc"', NULL);
+ERROR 42000: Incorrect parameter count in the call to native function 'json_unquote'
+select json_quote(NULL);
+json_quote(NULL)
+NULL
+select json_unquote(NULL);
+json_unquote(NULL)
+NULL
+select json_quote('abc');
+json_quote('abc')
+"abc"
+select json_quote(convert('abc' using ascii));
+json_quote(convert('abc' using ascii))
+"abc"
+select json_quote(convert('abc' using latin1));
+json_quote(convert('abc' using latin1))
+"abc"
+select json_quote(convert('abc' using utf8));
+json_quote(convert('abc' using utf8))
+"abc"
+select json_quote(convert('abc' using utf8mb4));
+json_quote(convert('abc' using utf8mb4))
+"abc"
+select json_unquote('abc');
+json_unquote('abc')
+abc
+select json_unquote('"abc"');
+json_unquote('"abc"')
+abc
+select json_unquote(convert('"abc"' using ascii));
+json_unquote(convert('"abc"' using ascii))
+abc
+select json_unquote(convert('"abc"' using latin1));
+json_unquote(convert('"abc"' using latin1))
+abc
+select json_unquote(convert('"abc"' using utf8));
+json_unquote(convert('"abc"' using utf8))
+abc
+select json_unquote(convert('"abc"' using utf8mb4));
+json_unquote(convert('"abc"' using utf8mb4))
+abc
+select json_quote('"');
+json_quote('"')
+"\""
+select json_unquote('"');
+json_unquote('"')
+"
+Warnings:
+Warning 4037 Unexpected end of JSON text in argument 1 to function 'json_unquote'
+error ER_INCORRECT_TYPE
+select json_quote(123);
+json_quote(123)
+NULL
+error ER_INCORRECT_TYPE
+select json_unquote(123);
+json_unquote(123)
+123
+select json_unquote('""');
+json_unquote('""')
+
+select char_length(json_unquote('""'));
+char_length(json_unquote('""'))
+0
+select json_unquote('"" ');
+json_unquote('"" ')
+
+select json_unquote(cast(json_quote('abc') as json));
+json_unquote(cast(json_quote('abc') as json))
+abc
+select cast('{"abc": "foo"}' as json);
+cast('{"abc": "foo"}' as json)
+{"abc": "foo"}
+select json_unquote(cast('{"abc": "foo"}' as json));
+json_unquote(cast('{"abc": "foo"}' as json))
+{"abc": "foo"}
+select json_extract(cast('{"abc": "foo"}' as json), '$.abc');
+json_extract(cast('{"abc": "foo"}' as json), '$.abc')
+"foo"
+select json_unquote(json_extract(cast('{"abc": "foo"}' as json), '$.abc'));
+json_unquote(json_extract(cast('{"abc": "foo"}' as json), '$.abc'))
+foo
+select json_unquote('["a", "b", "c"]');
+json_unquote('["a", "b", "c"]')
+["a", "b", "c"]
+select json_unquote(cast('["a", "b", "c"]' as json));
+json_unquote(cast('["a", "b", "c"]' as json))
+["a", "b", "c"]
+select charset(json_unquote('"abc"'));
+charset(json_unquote('"abc"'))
+utf8
+select json_quote(convert(X'e68891' using utf8));
+json_quote(convert(X'e68891' using utf8))
+"我"
+select json_quote(convert(X'e68891' using utf8mb4));
+json_quote(convert(X'e68891' using utf8mb4))
+"我"
+select cast(json_quote(convert(X'e68891' using utf8)) as json);
+cast(json_quote(convert(X'e68891' using utf8)) as json)
+"我"
+select json_unquote(convert(X'e68891' using utf8));
+json_unquote(convert(X'e68891' using utf8))
+我
+select json_quote(json_quote(json_quote('abc')));
+json_quote(json_quote(json_quote('abc')))
+"\"\\\"abc\\\"\""
+select json_unquote(json_unquote(json_unquote( # long round trip of it
+json_quote(json_quote(json_quote('abc'))))));
+json_unquote(json_unquote(json_unquote( # long round trip of it
+json_quote(json_quote(json_quote('abc'))))))
+abc
+select cast(cast('2015-01-15 23:24:25' as datetime) as json);
+cast(cast('2015-01-15 23:24:25' as datetime) as json)
+2015-01-15 23:24:25
+select json_unquote(cast(cast('2015-01-15 23:24:25' as datetime) as json));
+json_unquote(cast(cast('2015-01-15 23:24:25' as datetime) as json))
+2015-01-15 23:24:25
+select cast(st_geomfromtext('point(1 1)') as json);
+cast(st_geomfromtext('point(1 1)') as json)
+
+select json_unquote(cast(st_geomfromtext('point(1 1)') as json));
+json_unquote(cast(st_geomfromtext('point(1 1)') as json))
+
+SELECT JSON_UNQUOTE( '"abc"' );
+JSON_UNQUOTE( '"abc"' )
+abc
+SELECT JSON_UNQUOTE( '"abc' );
+JSON_UNQUOTE( '"abc' )
+"abc
+Warnings:
+Warning 4037 Unexpected end of JSON text in argument 1 to function 'json_unquote'
+error ER_INCORRECT_TYPE
+SELECT JSON_UNQUOTE( 123 );
+JSON_UNQUOTE( 123 )
+123
+SELECT JSON_UNQUOTE
+( CAST( CAST( '"abc"' AS JSON ) AS CHAR ) );
+JSON_UNQUOTE
+( CAST( CAST( '"abc"' AS JSON ) AS CHAR ) )
+abc
+SELECT JSON_UNQUOTE
+(
+CAST(
+JSON_EXTRACT( '{ "userName" : "fred" }', '$.userName' )
+AS CHAR
+)
+) = 'fred';
+JSON_UNQUOTE
+(
+CAST(
+JSON_EXTRACT( '{ "userName" : "fred" }', '$.userName' )
+AS CHAR
+)
+) = 'fred'
+1
+SELECT
+CAST(
+JSON_EXTRACT( '{ "userName" : "fred" }', '$.userName' )
+AS CHAR
+) = 'fred';
+CAST(
+JSON_EXTRACT( '{ "userName" : "fred" }', '$.userName' )
+AS CHAR
+) = 'fred'
+0
+SELECT JSON_QUOTE( 'abc' );
+JSON_QUOTE( 'abc' )
+"abc"
+error ER_INCORRECT_TYPE
+SELECT JSON_QUOTE( 123 );
+JSON_QUOTE( 123 )
+NULL
+SELECT CAST( JSON_QUOTE( '123' ) AS JSON );
+CAST( JSON_QUOTE( '123' ) AS JSON )
+"123"
+# ----------------------------------------------------------------------
+# Test of JSON_CONTAINS
+# ----------------------------------------------------------------------
+# should give NULL
+select json_contains(NULL, NULL);
+json_contains(NULL, NULL)
+NULL
+select json_contains(cast('{"a": 1, "b": 2}' as json), NULL);
+json_contains(cast('{"a": 1, "b": 2}' as json), NULL)
+NULL
+select json_contains(NULL, cast('null' as json));
+json_contains(NULL, cast('null' as json))
+NULL
+select json_contains(cast('[1]' as json), cast('[1]' as json), NULL);
+json_contains(cast('[1]' as json), cast('[1]' as json), NULL)
+NULL
+# should give 0:
+select json_contains(cast(3.14 as json), cast(3 as json));
+json_contains(cast(3.14 as json), cast(3 as json))
+0
+# should give 0: not at top level
+select json_contains(cast('{"a": {"b": 7}}' as json), cast('{"b": 7}' as json));
+json_contains(cast('{"a": {"b": 7}}' as json), cast('{"b": 7}' as json))
+0
+# but path argument will fix it:
+select json_contains(cast('{"a": {"b": 7}}' as json), cast('{"b": 7}' as json), '$.a');
+json_contains(cast('{"a": {"b": 7}}' as json), cast('{"b": 7}' as json), '$.a')
+1
+# but arrays "introspect"
+select json_contains(cast('[1,[2.0, 3.0]]' as json), cast('[2.0]' as json));
+json_contains(cast('[1,[2.0, 3.0]]' as json), cast('[2.0]' as json))
+1
+select json_contains(cast('[1, 2, [3, [4, 5]], 6, 7]' as json), cast('5' as json));
+json_contains(cast('[1, 2, [3, [4, 5]], 6, 7]' as json), cast('5' as json))
+1
+# should give 0: just a key
+select json_contains(cast('{"a": 1, "b": 2}' as json), cast('"a"' as json));
+json_contains(cast('{"a": 1, "b": 2}' as json), cast('"a"' as json))
+0
+# should give 0: one candidate element doesn't match
+select json_contains(cast('[1]' as json), cast('[1,2]' as json));
+json_contains(cast('[1]' as json), cast('[1,2]' as json))
+0
+# should all give 1
+select json_contains(cast('null' as json), cast('null' as json));
+json_contains(cast('null' as json), cast('null' as json))
+1
+# simple object subset
+select json_contains(cast('{"a": 1, "b": 2}' as json), cast( '{"a": 1}' as json));
+json_contains(cast('{"a": 1, "b": 2}' as json), cast( '{"a": 1}' as json))
+1
+# simple vector subset
+select json_contains(cast('[1, 2, 3]' as json), cast('[1, 3]' as json));
+json_contains(cast('[1, 2, 3]' as json), cast('[1, 3]' as json))
+1
+# auto-wrap, should give 1
+select json_contains(cast('[1, 2, 3]' as json), cast(3 as json));
+json_contains(cast('[1, 2, 3]' as json), cast(3 as json))
+1
+# ok even with nested cast off elements
+select json_contains(cast('{"person": {"id": 1, "country": "norway"}}' as json),
+cast('{"person": {"country": "norway"}}' as json));
+json_contains(cast('{"person": {"id": 1, "country": "norway"}}' as json),
+cast('{"person": {"country": "norway"}}' as json))
+1
+# vector reordering and duplicates is ok
+select json_contains(cast('[1,3,5]' as json), cast('[5,3,1,5]' as json));
+json_contains(cast('[1,3,5]' as json), cast('[5,3,1,5]' as json))
+1
+# ok even with more elts in candidate than in doc
+select json_contains(cast('[{"b": 4, "a":7}]' as json), cast('[{"a":7},{"b":4}]' as json));
+json_contains(cast('[{"b": 4, "a":7}]' as json), cast('[{"a":7},{"b":4}]' as json))
+1
+select json_contains(cast('[{"b": 4, "a":7}, 5]' as json), cast('[5, {"a":7, "b":4}]' as json));
+json_contains(cast('[{"b": 4, "a":7}, 5]' as json), cast('[5, {"a":7, "b":4}]' as json))
+1
+# ok even with mixed number types that compare equal
+select json_contains(cast('[{"b": 4, "a":7}, 5.0]' as json), cast('[5, {"a":7.0E0, "b":4}]' as json));
+json_contains(cast('[{"b": 4, "a":7}, 5.0]' as json), cast('[5, {"a":7.0E0, "b":4}]' as json))
+1
+select json_contains( '{"customer": "cust3"}', '{"customer": "cust1"}' );
+json_contains( '{"customer": "cust3"}', '{"customer": "cust1"}' )
+0
+SELECT JSON_CONTAINS('[null,1,[2,3],true,false]', '[null,1,[3],false]');
+JSON_CONTAINS('[null,1,[2,3],true,false]', '[null,1,[3],false]')
+1
+SELECT JSON_CONTAINS('[null,1,[2,3],true,false]', '[null,1,[4],false]');
+JSON_CONTAINS('[null,1,[2,3],true,false]', '[null,1,[4],false]')
+0
+SELECT JSON_CONTAINS('[true,false]', '[[true]]');
+JSON_CONTAINS('[true,false]', '[[true]]')
+1
+SELECT JSON_CONTAINS('[1,2]', '[[1]]');
+JSON_CONTAINS('[1,2]', '[[1]]')
+1
+SELECT JSON_CONTAINS('[1,2]', '1', '$.abc');
+JSON_CONTAINS('[1,2]', '1', '$.abc')
+0
+SELECT JSON_CONTAINS('{}', '{}');
+JSON_CONTAINS('{}', '{}')
+1
+SELECT JSON_CONTAINS('{}', '{"a":1}');
+JSON_CONTAINS('{}', '{"a":1}')
+0
+SELECT JSON_CONTAINS('{"a":1}', '{"a":1,"b":2}');
+JSON_CONTAINS('{"a":1}', '{"a":1,"b":2}')
+0
+SELECT JSON_CONTAINS
+(
+CAST('[1, 4, 6]' AS JSON),
+CAST('[1, 6]' AS JSON)
+);
+JSON_CONTAINS
+(
+CAST('[1, 4, 6]' AS JSON),
+CAST('[1, 6]' AS JSON)
+)
+1
+SELECT JSON_CONTAINS
+(
+CAST('{"person": {"id": 1, "country": "norway"}}' AS JSON),
+CAST('{"person": {"country": "norway"}}' AS JSON)
+);
+JSON_CONTAINS
+(
+CAST('{"person": {"id": 1, "country": "norway"}}' AS JSON),
+CAST('{"person": {"country": "norway"}}' AS JSON)
+)
+1
+SELECT JSON_CONTAINS
+(
+CAST('[1,3,5]' AS JSON),
+CAST('[5,3,1,5]' AS JSON)
+);
+JSON_CONTAINS
+(
+CAST('[1,3,5]' AS JSON),
+CAST('[5,3,1,5]' AS JSON)
+)
+1
+SELECT JSON_CONTAINS
+(
+CAST('[3.14]' AS JSON),
+CAST('[3]' AS JSON)
+);
+JSON_CONTAINS
+(
+CAST('[3.14]' AS JSON),
+CAST('[3]' AS JSON)
+)
+0
+SELECT JSON_CONTAINS
+(
+CAST('[1, 2, 3]' AS JSON),
+CAST(3 AS JSON)
+);
+JSON_CONTAINS
+(
+CAST('[1, 2, 3]' AS JSON),
+CAST(3 AS JSON)
+)
+1
+SELECT JSON_CONTAINS();
+ERROR 42000: Incorrect parameter count in the call to native function 'JSON_CONTAINS'
+SELECT JSON_CONTAINS('[1]');
+ERROR 42000: Incorrect parameter count in the call to native function 'JSON_CONTAINS'
+SELECT JSON_CONTAINS('[1]', '[1]', '$', '$[0]');
+ERROR 42000: Incorrect parameter count in the call to native function 'JSON_CONTAINS'
+# ----------------------------------------------------------------------
+# Wrong collation from JSON_QUOTE caused problems: Set it in
+# Item_func_json_quote::fix_length_and_dec. Bug found by Knut.
+# Similar issue for JSON_UNQUOTE and JSON_TYPE.
+# ----------------------------------------------------------------------
+select json_object("a", ifnull(json_quote('test'), cast('null' as json)));
+json_object("a", ifnull(json_quote('test'), cast('null' as json)))
+{"a": "\"test\""}
+select cast(concat('[', json_quote('ab'), ']') as json);
+cast(concat('[', json_quote('ab'), ']') as json)
+["ab"]
+select cast(concat('[', json_unquote('"12"'), ']') as json);
+cast(concat('[', json_unquote('"12"'), ']') as json)
+[12]
+select cast(concat('["', json_type(cast(1 as json)), '"]') as json);
+cast(concat('["', json_type(cast(1 as json)), '"]') as json)
+["INTEGER"]
+#
+# Bug#20912438: ITEM_TYPE_HOLDER::DISPLAY_LENGTH(ITEM*): ASSERTION `0' FAILED
+#
+(SELECT JSON_KEYS('{ "key80": "2015-04-20 11:53:55"}')) UNION ALL
+(SELECT JSON_KEYS('{ "key80": "2015-04-20 11:53:55" }') LIMIT 0);
+JSON_KEYS('{ "key80": "2015-04-20 11:53:55"}')
+["key80"]
+SELECT CAST(1 AS JSON) UNION ALL SELECT CAST(1 AS JSON);
+CAST(1 AS JSON)
+1
+1
+SELECT COUNT(*), CAST(NULL AS JSON);
+COUNT(*) CAST(NULL AS JSON)
+1 NULL
+error ER_INVALID_JSON_TEXT_IN_PARAM
+SELECT COUNT(*), JSON_EXTRACT('not valid json!', '$');
+COUNT(*) JSON_EXTRACT('not valid json!', '$')
+1 NULL
+Warnings:
+Warning 4038 Syntax error in JSON text in argument 1 to function 'json_extract' at position 1
+# ----------------------------------------------------------------------
+# Bug report from John E.
+# Crash in Item_copy_json::~Item_copy_json
+# ----------------------------------------------------------------------
+EXPLAIN SELECT COUNT(*), JSON_KEYS('{}');
+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 json_search( '{ "a": "foo" }', 'one', 'foo', 'a' );
+json_search( '{ "a": "foo" }', 'one', 'foo', 'a' )
+"$.a"
+select json_search( '{ "a": "foo" }', 'one', 'foo', null );
+json_search( '{ "a": "foo" }', 'one', 'foo', null )
+"$.a"
+select json_search( '{ "a": "foo" }', 'one', 'foo', convert(x'f8' using latin1) );
+json_search( '{ "a": "foo" }', 'one', 'foo', convert(x'f8' using latin1) )
+"$.a"
+select json_search( '{ "a": "foo" }', 'one', 'foo', 'ab' );
+ERROR HY000: Incorrect arguments to ESCAPE
+# ----------------------------------------------------------------------
+# Wrong results when Json_path_cache primed is accessed
+# during the prepare-phase.
+#----------------------------------------------------------------------
+select json_remove( '[ 1, { "a": true, "b": false, "c": null }, 5 ]', null ) is null;
+json_remove( '[ 1, { "a": true, "b": false, "c": null }, 5 ]', null ) is null
+1
+prepare stmt1 from 'select json_remove( ''[ 1, { "a": true, "b": false, "c": null }, 5 ]'', null ) is null';
+execute stmt1;
+json_remove( '[ 1, { "a": true, "b": false, "c": null }, 5 ]', null ) is null
+1
+error ER_INVALID_JSON_PATH
+select json_remove( '[ 1, { "a": true, "b": false, "c": null }, 5 ]', '$.' ) is null;
+json_remove( '[ 1, { "a": true, "b": false, "c": null }, 5 ]', '$.' ) is null
+0
+error ER_INVALID_JSON_PATH
+prepare stmt1 from 'select json_remove( ''[ 1, { "a": true, "b": false, "c": null }, 5 ]'', ''$.'' ) is null';
+# ----------------------------------------------------------------------
+# Bug#20987329 VALUE OF PREPARED STATEMENT PLACEHOLDER FOR PARAMETER
+# IN JSON_EXTRACT IS STICKY
+#----------------------------------------------------------------------
+prepare json_stmt1 FROM 'select json_contains( ''{ "keyA": [1, 2, 3], "keyB": [4, 5, 6] }'', ''[2]'', ? )';
+set @mypath = '$.keyA';
+execute json_stmt1 USING @mypath;
+json_contains( '{ "keyA": [1, 2, 3], "keyB": [4, 5, 6] }', '[2]', ? )
+1
+set @mypath = '$.keyB';
+execute json_stmt1 USING @mypath;
+json_contains( '{ "keyA": [1, 2, 3], "keyB": [4, 5, 6] }', '[2]', ? )
+0
+prepare json_stmt2 FROM 'select json_contains_path( ''{ "keyA": [1, 2, 3] }'', ''all'', ? )';
+set @mypath = '$.keyA';
+execute json_stmt2 USING @mypath;
+json_contains_path( '{ "keyA": [1, 2, 3] }', 'all', ? )
+1
+set @mypath = '$.keyB';
+execute json_stmt2 USING @mypath;
+json_contains_path( '{ "keyA": [1, 2, 3] }', 'all', ? )
+0
+prepare json_stmt3 FROM 'select json_length( ''{ "keyA": [1, 2, 3], "keyB": [1, 2, 3, 4] }'', ? )';
+set @mypath = '$.keyA';
+execute json_stmt3 USING @mypath;
+json_length( '{ "keyA": [1, 2, 3], "keyB": [1, 2, 3, 4] }', ? )
+3
+set @mypath = '$.keyB';
+execute json_stmt3 USING @mypath;
+json_length( '{ "keyA": [1, 2, 3], "keyB": [1, 2, 3, 4] }', ? )
+4
+prepare json_stmt4 FROM 'select json_keys( ''[ { "keyA": true }, { "keyB": false } ]'', ? )';
+set @mypath = '$[0]';
+execute json_stmt4 USING @mypath;
+json_keys( '[ { "keyA": true }, { "keyB": false } ]', ? )
+["keyA"]
+set @mypath = '$[1]';
+execute json_stmt4 USING @mypath;
+json_keys( '[ { "keyA": true }, { "keyB": false } ]', ? )
+["keyB"]
+prepare json_stmt5 FROM 'select json_array_append( ''{ "keyA": [1, 2], "keyB": [3, 4] }'', ?, 5 )';
+set @mypath = '$.keyA';
+execute json_stmt5 USING @mypath;
+json_array_append( '{ "keyA": [1, 2], "keyB": [3, 4] }', ?, 5 )
+{ "keyA": [1, 2, 5], "keyB": [3, 4] }
+set @mypath = '$.keyB';
+execute json_stmt5 USING @mypath;
+json_array_append( '{ "keyA": [1, 2], "keyB": [3, 4] }', ?, 5 )
+{ "keyA": [1, 2], "keyB": [3, 4, 5] }
+prepare json_stmt6 FROM 'select json_insert( ''{ "keyA": [1, 2], "keyB": [3, 4] }'', ?, 5 )';
+set @mypath = '$.keyA[2]';
+execute json_stmt6 USING @mypath;
+json_insert( '{ "keyA": [1, 2], "keyB": [3, 4] }', ?, 5 )
+{ "keyA": [1, 2, 5], "keyB": [3, 4] }
+set @mypath = '$.keyB[2]';
+execute json_stmt6 USING @mypath;
+json_insert( '{ "keyA": [1, 2], "keyB": [3, 4] }', ?, 5 )
+{ "keyA": [1, 2], "keyB": [3, 4, 5] }
+prepare json_stmt7 FROM 'select json_set( ''{ "keyA": [1, 2], "keyB": [3, 4] }'', ?, 5 )';
+set @mypath = '$.keyA[2]';
+execute json_stmt7 USING @mypath;
+json_set( '{ "keyA": [1, 2], "keyB": [3, 4] }', ?, 5 )
+{ "keyA": [1, 2, 5], "keyB": [3, 4] }
+set @mypath = '$.keyB[2]';
+execute json_stmt7 USING @mypath;
+json_set( '{ "keyA": [1, 2], "keyB": [3, 4] }', ?, 5 )
+{ "keyA": [1, 2], "keyB": [3, 4, 5] }
+prepare json_stmt8 FROM 'select json_replace( ''{ "keyA": [1, 2], "keyB": [3, 4] }'', ?, 5 )';
+set @mypath = '$.keyA[1]';
+execute json_stmt8 USING @mypath;
+json_replace( '{ "keyA": [1, 2], "keyB": [3, 4] }', ?, 5 )
+{ "keyA": [1, 5], "keyB": [3, 4] }
+set @mypath = '$.keyB[1]';
+execute json_stmt8 USING @mypath;
+json_replace( '{ "keyA": [1, 2], "keyB": [3, 4] }', ?, 5 )
+{ "keyA": [1, 2], "keyB": [3, 5] }
+prepare json_stmt9 FROM 'select json_search( ''{ "keyA": [ "foot" ], "keyB": [ "food" ] }'', ''all'', ''foo%'', null, ? )';
+set @mypath = '$.keyA';
+execute json_stmt9 USING @mypath;
+json_search( '{ "keyA": [ "foot" ], "keyB": [ "food" ] }', 'all', 'foo%', null, ? )
+"$.keyA[0]"
+set @mypath = '$.keyB';
+execute json_stmt9 USING @mypath;
+json_search( '{ "keyA": [ "foot" ], "keyB": [ "food" ] }', 'all', 'foo%', null, ? )
+"$.keyB[0]"
+prepare json_stmt10 FROM 'select json_remove( ''{ "keyA": [ "foot" ], "keyB": [ "food" ] }'', ? )';
+set @mypath = '$.keyA';
+execute json_stmt10 USING @mypath;
+json_remove( '{ "keyA": [ "foot" ], "keyB": [ "food" ] }', ? )
+{ "keyB": [ "food" ] }
+set @mypath = '$.keyB';
+execute json_stmt10 USING @mypath;
+json_remove( '{ "keyA": [ "foot" ], "keyB": [ "food" ] }', ? )
+{ "keyA": [ "foot" ]}
+prepare json_stmt11 FROM 'select json_contains_path( ''{ "keyA": true }'', ?, ''$.keyA'', ''$.keyB'' )';
+set @mypath = 'one';
+execute json_stmt11 USING @mypath;
+json_contains_path( '{ "keyA": true }', ?, '$.keyA', '$.keyB' )
+1
+set @mypath = 'all';
+execute json_stmt11 USING @mypath;
+json_contains_path( '{ "keyA": true }', ?, '$.keyA', '$.keyB' )
+0
+prepare json_stmt12 FROM 'select json_search( ''{ "keyA": [ "foot" ], "keyB": [ "food" ] }'', ?, ''foo%'' )';
+set @mypath = 'one';
+execute json_stmt12 USING @mypath;
+json_search( '{ "keyA": [ "foot" ], "keyB": [ "food" ] }', ?, 'foo%' )
+"$.keyA[0]"
+set @mypath = 'all';
+execute json_stmt12 USING @mypath;
+json_search( '{ "keyA": [ "foot" ], "keyB": [ "food" ] }', ?, 'foo%' )
+["$.keyA[0]", "$.keyB[0]"]
+#
+# Bug#21128632 JSON_QUOTE(JSON_TYPE(...)) GIVES ERROR 3139 ER_INVALID_JSON_CHARSET
+#
+select json_quote( json_type( json_object() ) );
+json_quote( json_type( json_object() ) )
+"OBJECT"
+select json_quote( json_type( cast('{}' as json) ) );
+json_quote( json_type( cast('{}' as json) ) )
+"OBJECT"
+#
+# Bug#21148020 OUTPUT FROM JSON_TYPE() IS TRUNCATED
+# WHEN EXECUTED IN A VIEW OR JOIN
+#
+SELECT JSON_TYPE(JSON_OBJECT());
+JSON_TYPE(JSON_OBJECT())
+OBJECT
+CREATE VIEW v1 AS SELECT JSON_TYPE(JSON_OBJECT());
+SELECT * FROM v1;
+JSON_TYPE(JSON_OBJECT())
+OBJE
+drop view v1;
+#
+# Bug#21198333 SIG 6 IN ITEM_CACHE_JSON::CACHE_VALUE AT SQL/ITEM.CC:9470
+#
+error ER_INVALID_JSON_TEXT_IN_PARAM
+SELECT MIN(JSON_EXTRACT('not json', '$'));
+MIN(JSON_EXTRACT('not json', '$'))
+NULL
+Warnings:
+Warning 4038 Syntax error in JSON text in argument 1 to function 'json_extract' at position 1
+#
+# Bug#21200657 DATA FROM DERIVED TABLE BASED
+# ON JSN_QUOTE()/JSN_UNQUOTE() CALL IS TRUNCATED
+#
+SELECT JSON_QUOTE('This is a string that should not be truncated') AS field1;
+field1
+"This is a string that should not be truncated"
+SELECT JSON_UNQUOTE(JSON_QUOTE('This is a string that should not be truncated')) AS field1;
+field1
+This is a string that should not be truncated
+SELECT * FROM (SELECT JSON_QUOTE('This is a string that should not be truncated') AS field1) AS DERIVED_TABLE;
+field1
+"This is a string that should not be truncated"
+SELECT * FROM (SELECT JSON_UNQUOTE("This is a string that should not be truncated") AS field1) AS DERIVED_TABLE;
+field1
+This is a string that should not be truncated
+SELECT * FROM (SELECT JSON_UNQUOTE(JSON_QUOTE('This is a string that should not be truncated')) AS field1) AS DERIVED_TABLE;
+field1
+This is a string that should not be truncated
+#
+# Bug#21296173 JSON_OBJECT('KEY', BOOLEAN_LITERAL) USES VALUES 0, 1
+# FOR BOOL WHEN USED VIA VIEW
+#
+SELECT JSON_OBJECT('key1', false, 'key2', true);
+JSON_OBJECT('key1', false, 'key2', true)
+{"key1": false, "key2": true}
+SELECT JSON_ARRAY('key1', false, 'key2', true);
+JSON_ARRAY('key1', false, 'key2', true)
+["key1", false, "key2", true]
+CREATE VIEW v1 AS SELECT JSON_OBJECT('key1', false, 'key2', true);
+SELECT * FROM v1;
+JSON_OBJECT('key1', false, 'key2', true)
+{"key1": 0, "key2": 1}
+CREATE VIEW v2 AS SELECT JSON_ARRAY('key1', false, 'key2', true);
+SELECT * FROM v2;
+JSON_ARRAY('key1', false, 'key2', true)
+["key1", 0, "key2", 1]
+drop view v1;
+drop view v2;
+#
+# Bug#21293089 JSON_CONTAINS() RETURNS WRONG RESULT WITH EMPTY JSON ARRAY
+#
+SELECT JSON_CONTAINS('[]', '{"a" : 1}');
+JSON_CONTAINS('[]', '{"a" : 1}')
+0
+SELECT JSON_CONTAINS('[]', '[1, 2, 3, 4, 5]');
+JSON_CONTAINS('[]', '[1, 2, 3, 4, 5]')
+0
+SELECT JSON_CONTAINS('[]', '[1, 2, 3, 4, {"a" : 1}]');
+JSON_CONTAINS('[]', '[1, 2, 3, 4, {"a" : 1}]')
+0
+SELECT JSON_CONTAINS('[]', '{"a" : [1, 2, 3, 4, 5]}');
+JSON_CONTAINS('[]', '{"a" : [1, 2, 3, 4, 5]}')
+0
+SELECT JSON_CONTAINS('[]', '[]');
+JSON_CONTAINS('[]', '[]')
+1
+#
+# Bug#21377136 STACK OVERFLOW IN RAPIDJSON::GENERICREADER
+#
+error ER_JSON_DOCUMENT_TOO_DEEP
+SELECT JSON_VALID(REPEAT('[', 100000));
+JSON_VALID(REPEAT('[', 100000))
+0
+error ER_JSON_DOCUMENT_TOO_DEEP
+SELECT JSON_VALID(REPEAT('{"a":', 100000));
+JSON_VALID(REPEAT('{"a":', 100000))
+0
+error ER_JSON_DOCUMENT_TOO_DEEP
+SELECT JSON_VALID(REPEAT('{"a":[', 100000));
+JSON_VALID(REPEAT('{"a":[', 100000))
+0
+error ER_JSON_DOCUMENT_TOO_DEEP
+SELECT JSON_VALID(REPEAT('[{"a":', 100000));
+JSON_VALID(REPEAT('[{"a":', 100000))
+0
+#
+# Bug#21381806 JSON: ASSERTION FAILED: ARG->NULL_VALUE
+#
+SELECT JSON_SET(CASE WHEN 1 THEN NULL ELSE NULL END, '{}', '{}');
+JSON_SET(CASE WHEN 1 THEN NULL ELSE NULL END, '{}', '{}')
+NULL
+SELECT JSON_VALID(CASE WHEN 1 THEN NULL ELSE NULL END);
+JSON_VALID(CASE WHEN 1 THEN NULL ELSE NULL END)
+NULL
+SELECT JSON_ARRAY(CASE WHEN 1 THEN NULL ELSE NULL END);
+JSON_ARRAY(CASE WHEN 1 THEN NULL ELSE NULL END)
+[null]
+#
+# Bug#21384048 ASSERTION FAILED: N >= 0 && N <= 308
+# IN RAPIDJSON::INTERNAL::FASTPATH
+#
+SELECT JSON_EXTRACT('-1E-36181012216111515851075235238', '$');
+JSON_EXTRACT('-1E-36181012216111515851075235238', '$')
+NULL
+Warnings:
+Warning 4038 Syntax error in JSON text in argument 1 to function 'json_extract' at position 33
+SELECT JSON_EXTRACT('1E-36181012216111515851075235238', '$');
+JSON_EXTRACT('1E-36181012216111515851075235238', '$')
+NULL
+Warnings:
+Warning 4038 Syntax error in JSON text in argument 1 to function 'json_extract' at position 32
+SELECT JSON_EXTRACT('1E-325', '$');
+JSON_EXTRACT('1E-325', '$')
+NULL
+Warnings:
+Warning 4038 Syntax error in JSON text in argument 1 to function 'json_extract' at position 6
+SELECT JSON_EXTRACT('1E-324', '$');
+JSON_EXTRACT('1E-324', '$')
+NULL
+Warnings:
+Warning 4038 Syntax error in JSON text in argument 1 to function 'json_extract' at position 6
+SELECT JSON_EXTRACT('1E-323', '$');
+JSON_EXTRACT('1E-323', '$')
+NULL
+Warnings:
+Warning 4038 Syntax error in JSON text in argument 1 to function 'json_extract' at position 6
+SELECT JSON_EXTRACT('1E+308', '$');
+JSON_EXTRACT('1E+308', '$')
+NULL
+Warnings:
+Warning 4038 Syntax error in JSON text in argument 1 to function 'json_extract' at position 6
+error ER_INVALID_JSON_TEXT_IN_PARAM
+SELECT JSON_EXTRACT('1E+309', '$');
+JSON_EXTRACT('1E+309', '$')
+NULL
+Warnings:
+Warning 4038 Syntax error in JSON text in argument 1 to function 'json_extract' at position 6
+error ER_INVALID_JSON_TEXT_IN_PARAM
+SELECT JSON_EXTRACT('1E+36181012216111515851075235238', '$');
+JSON_EXTRACT('1E+36181012216111515851075235238', '$')
+NULL
+Warnings:
+Warning 4038 Syntax error in JSON text in argument 1 to function 'json_extract' at position 32
+error ER_INVALID_JSON_TEXT_IN_PARAM
+SELECT JSON_EXTRACT('-1E+36181012216111515851075235238', '$');
+JSON_EXTRACT('-1E+36181012216111515851075235238', '$')
+NULL
+Warnings:
+Warning 4038 Syntax error in JSON text in argument 1 to function 'json_extract' at position 33
+#
+# Bug#21383284: ASSERTION IN SELECT_LEX::SETUP_CONDS
+#
+SELECT 1 FROM dual WHERE JSON_SEARCH('{}', 'one', 'foo', 'too-long-escape');
+ERROR HY000: Incorrect arguments to ESCAPE
+error ER_INVALID_JSON_TEXT_IN_PARAM
+SELECT 1 FROM dual WHERE JSON_SEARCH('{}', 'one', 'foo', JSON_EXTRACT('', '$'));
+1
+Warnings:
+Warning 4037 Unexpected end of JSON text in argument 1 to function 'json_extract'
+#
+# Bug#21442624 INCORRECT RESULT FROM JSON_SET WITH AUTO-WRAPPING
+#
+SELECT JSON_SET('1', '$', 100);
+JSON_SET('1', '$', 100)
+100
+SELECT JSON_SET('1', '$[0]', 100);
+JSON_SET('1', '$[0]', 100)
+100
+SELECT JSON_SET('1', '$[0][0]', 100);
+JSON_SET('1', '$[0][0]', 100)
+100
+SELECT JSON_SET('1', '$[0][0][0]', 100);
+JSON_SET('1', '$[0][0][0]', 100)
+100
+SELECT JSON_SET('[]', '$', 100);
+JSON_SET('[]', '$', 100)
+100
+SELECT JSON_SET('[]', '$[0]', 100);
+JSON_SET('[]', '$[0]', 100)
+[100]
+SELECT JSON_SET('[]', '$[0][0]', 100);
+JSON_SET('[]', '$[0][0]', 100)
+NULL
+Warnings:
+Warning 4037 Unexpected end of JSON text in argument 1 to function 'json_set'
+SELECT JSON_SET('[]', '$[0][0][0]', 100);
+JSON_SET('[]', '$[0][0][0]', 100)
+NULL
+Warnings:
+Warning 4037 Unexpected end of JSON text in argument 1 to function 'json_set'
+SELECT JSON_SET('[1]', '$', 100);
+JSON_SET('[1]', '$', 100)
+100
+SELECT JSON_SET('[1]', '$[0]', 100);
+JSON_SET('[1]', '$[0]', 100)
+[100]
+SELECT JSON_SET('[1]', '$[0][0]', 100);
+JSON_SET('[1]', '$[0][0]', 100)
+[100]
+SELECT JSON_SET('[1]', '$[0][0][0]', 100);
+JSON_SET('[1]', '$[0][0][0]', 100)
+[100]
+SELECT JSON_SET('[[1]]', '$', 100);
+JSON_SET('[[1]]', '$', 100)
+100
+SELECT JSON_SET('[[1]]', '$[0]', 100);
+JSON_SET('[[1]]', '$[0]', 100)
+[100]
+SELECT JSON_SET('[[1]]', '$[0][0]', 100);
+JSON_SET('[[1]]', '$[0][0]', 100)
+[[100]]
+SELECT JSON_SET('[[1]]', '$[0][0][0]', 100);
+JSON_SET('[[1]]', '$[0][0][0]', 100)
+[[100]]
+SELECT JSON_SET('[[[1]]]', '$', 100);
+JSON_SET('[[[1]]]', '$', 100)
+100
+SELECT JSON_SET('[[[1]]]', '$[0]', 100);
+JSON_SET('[[[1]]]', '$[0]', 100)
+[100]
+SELECT JSON_SET('[[[1]]]', '$[0][0]', 100);
+JSON_SET('[[[1]]]', '$[0][0]', 100)
+[[100]]
+SELECT JSON_SET('[[[1]]]', '$[0][0][0]', 100);
+JSON_SET('[[[1]]]', '$[0][0][0]', 100)
+[[[100]]]
+SELECT JSON_REPLACE('1', '$', 100);
+JSON_REPLACE('1', '$', 100)
+100
+SELECT JSON_REPLACE('1', '$[0]', 100);
+JSON_REPLACE('1', '$[0]', 100)
+100
+SELECT JSON_REPLACE('1', '$[0][0]', 100);
+JSON_REPLACE('1', '$[0][0]', 100)
+100
+SELECT JSON_REPLACE('1', '$[0][0][0]', 100);
+JSON_REPLACE('1', '$[0][0][0]', 100)
+100
+SELECT JSON_REPLACE('[]', '$', 100);
+JSON_REPLACE('[]', '$', 100)
+100
+SELECT JSON_REPLACE('[]', '$[0]', 100);
+JSON_REPLACE('[]', '$[0]', 100)
+[]
+SELECT JSON_REPLACE('[]', '$[0][0]', 100);
+JSON_REPLACE('[]', '$[0][0]', 100)
+NULL
+Warnings:
+Warning 4037 Unexpected end of JSON text in argument 1 to function 'json_update'
+SELECT JSON_REPLACE('[]', '$[0][0][0]', 100);
+JSON_REPLACE('[]', '$[0][0][0]', 100)
+NULL
+Warnings:
+Warning 4037 Unexpected end of JSON text in argument 1 to function 'json_update'
+SELECT JSON_REPLACE('[1]', '$', 100);
+JSON_REPLACE('[1]', '$', 100)
+100
+SELECT JSON_REPLACE('[1]', '$[0]', 100);
+JSON_REPLACE('[1]', '$[0]', 100)
+[100]
+SELECT JSON_REPLACE('[1]', '$[0][0]', 100);
+JSON_REPLACE('[1]', '$[0][0]', 100)
+[100]
+SELECT JSON_REPLACE('[1]', '$[0][0][0]', 100);
+JSON_REPLACE('[1]', '$[0][0][0]', 100)
+[100]
+SELECT JSON_REPLACE('[[1]]', '$', 100);
+JSON_REPLACE('[[1]]', '$', 100)
+100
+SELECT JSON_REPLACE('[[1]]', '$[0]', 100);
+JSON_REPLACE('[[1]]', '$[0]', 100)
+[100]
+SELECT JSON_REPLACE('[[1]]', '$[0][0]', 100);
+JSON_REPLACE('[[1]]', '$[0][0]', 100)
+[[100]]
+SELECT JSON_REPLACE('[[1]]', '$[0][0][0]', 100);
+JSON_REPLACE('[[1]]', '$[0][0][0]', 100)
+[[100]]
+SELECT JSON_REPLACE('[[[1]]]', '$', 100);
+JSON_REPLACE('[[[1]]]', '$', 100)
+100
+SELECT JSON_REPLACE('[[[1]]]', '$[0]', 100);
+JSON_REPLACE('[[[1]]]', '$[0]', 100)
+[100]
+SELECT JSON_REPLACE('[[[1]]]', '$[0][0]', 100);
+JSON_REPLACE('[[[1]]]', '$[0][0]', 100)
+[[100]]
+SELECT JSON_REPLACE('[[[1]]]', '$[0][0][0]', 100);
+JSON_REPLACE('[[[1]]]', '$[0][0][0]', 100)
+[[[100]]]
+#
+# Bug#21828321: JSON FUNCS CALL DBUG_ABORT OR EXIT() ON WINDOWS!
+#
+SELECT JSON_ARRAY(LEAST(NULL, NULL), GREATEST(NULL, NULL), LEAST(j1, NULL),
+GREATEST(NULL, j2), LEAST(j1, j2), GREATEST(j1, j2)) AS j
+FROM (SELECT CAST('1' AS JSON) AS j1, CAST('2' AS JSON) AS j2) t;
+j
+[null, null, null, null, "1", "2"]
diff --git a/mysql-test/suite/json/t/json_no_table.test b/mysql-test/suite/json/t/json_no_table.test
new file mode 100644
index 00000000000..584af56a3a9
--- /dev/null
+++ b/mysql-test/suite/json/t/json_no_table.test
@@ -0,0 +1,2288 @@
+########### suite/json/t/json_notable.test #
+# Tests json columns functionality that does not need any tables #
+# to be defined (no storage engine functionality) #
+# #
+# This test copies some tests originally in json.test #
+######################################################################
+
+# Some extra checks for comparisons between positive and negative zero.
+# All should be equal.
+SELECT CAST(0.0e0 AS JSON) = -0.0e0;
+SELECT CAST(CAST(0 AS DECIMAL) AS JSON) = CAST(-0.0e0 AS DECIMAL);
+SELECT CAST(0.0e0 AS JSON) = CAST(-0.0e0 AS DECIMAL);
+SELECT CAST(CAST(0 AS DECIMAL) AS JSON) = -0.0e0;
+SELECT CAST(CAST(0 AS SIGNED) AS JSON) = -0.0e0;
+SELECT CAST(CAST(0 AS SIGNED) AS JSON) = CAST(-0.0e0 AS DECIMAL);
+SELECT CAST(CAST(0 AS UNSIGNED) AS JSON) = -0.0e0;
+SELECT CAST(CAST(0 AS UNSIGNED) AS JSON) = CAST(-0.0e0 AS DECIMAL);
+
+# Test that CAST string argument isn't treated as ANY_JSON_ATOM
+# in that a MySQL string needs to be parsed to JSON here; it is not
+# auto-converted to a JSON string as in ANY_JSON_ATOM contexts.
+select cast('"abc"' as json);
+--echo error ER_INVALID_JSON_TEXT_IN_PARAM
+select cast('abc' as json);
+
+--echo
+--echo # String literal - valid JSON
+select JSON_VALID('123'); # uint
+select JSON_VALID('-123'); # int
+select JSON_VALID('5000000000'); # uint64
+select JSON_VALID('-5000000000'); # int64
+select JSON_VALID('1.23'); # double
+select JSON_VALID('"123"');
+select JSON_VALID('true');
+select JSON_VALID('false');
+select JSON_VALID('null');
+select JSON_VALID('{"address": "Trondheim"}');
+
+--echo
+--echo # String literal - not valid JSON
+select JSON_VALID('12 3');
+
+--echo
+--echo # String literal not in UTF-8
+set names 'ascii';
+# auto-convert to utf-8
+select JSON_VALID('123');
+
+set names 'utf8';
+
+--echo
+--echo # Json expression
+select JSON_VALID(cast('[123]' as JSON ));
+
+--echo
+--echo # Json expression NULL
+select JSON_VALID(cast(NULL as JSON ));
+
+--echo
+--echo # Bare NULL
+select JSON_VALID( NULL );
+
+--echo
+--echo # Function result - string
+select JSON_VALID( UPPER('"abc"') );
+
+set names 'latin1';
+--echo
+--echo # Function result - string
+# auto-convert to utf-8
+select JSON_VALID( UPPER('"abc"') );
+
+set names 'utf8';
+
+--echo
+--echo # Function result - date, not valid as JSON without CAST
+select JSON_VALID( CAST('2015-01-15' AS DATE) );
+
+--echo
+--echo # The date string doesn't parse as JSON text, so wrong:
+select JSON_VALID( CAST(CAST('2015-01-15' AS DATE) as CHAR CHARACTER SET 'utf8') );
+--echo # OK, though:
+select JSON_VALID( CAST(CURDATE() as JSON) );
+
+--echo
+--echo # Function result - NULL
+select JSON_VALID( UPPER(NULL) );
+select JSON_VALID( UPPER(CAST(NULL as CHAR)) );
+
+# examples from wl7909 spec
+# returns 1
+SELECT JSON_VALID( '{ "firstName" : "Fred", "lastName" : "Flintstone" }' );
+
+# returns 1
+SELECT JSON_VALID( '3' );
+
+# returns NULL as IS JSON would
+SELECT JSON_VALID( null );
+
+
+--echo # ----------------------------------------------------------------------
+--echo # Test of JSON_CONTAINS_PATH function.
+--echo # ----------------------------------------------------------------------
+
+--error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
+select json_contains_path();
+--error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
+select json_contains_path('{ "a": true }' );
+--error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
+select json_contains_path('{ "a": true }', 'all' );
+--echo error ER_INVALID_JSON_TEXT_IN_PARAM
+select json_contains_path('{ "a": tru }', 'all', '$' );
+--echo error ER_INVALID_JSON_PATH
+select json_contains_path('{ "a": true }', 'all', '$[' );
+--echo error ER_INVALID_JSON_PATH
+select json_contains_path('{ "a": true }', 'all', '$a.***[3]' );
+--echo error ER_JSON_BAD_ONE_OR_ALL_ARG
+select json_contains_path('{ "a": true }', 'foo', '$.a' );
+--echo error ER_INVALID_JSON_CHARSET
+select json_contains_path('{}', 'all', cast('$' as binary));
+
+select json_contains_path(null, 'all', '$.a' );
+select json_contains_path('{ "a": true }', null, '$.a' );
+select json_contains_path('{ "a": true }', 'all', null );
+
+# degenerate path
+select json_contains_path('{ "a": true }', 'all', '$' );
+
+# positive, one path
+select json_contains_path('{ "a": true }', 'all', '$.a' );
+select json_contains_path('{ "a": true }', 'one', '$.a' );
+
+# negative, one path
+select json_contains_path('{ "a": true }', 'all', '$.b' );
+select json_contains_path('{ "a": true }', 'one', '$.b' );
+
+# all
+select json_contains_path('{ "a": true }', 'all', '$.a', '$.b' );
+select json_contains_path('{ "a": true }', 'all', '$.b', '$.a' );
+select json_contains_path('{ "a": true }', 'ALL', '$.a', '$.b' );
+select json_contains_path('{ "a": true }', 'aLl', '$.a', '$.b' );
+
+# some
+select json_contains_path('{ "a": true }', 'one', '$.a', '$.b' );
+select json_contains_path('{ "a": true }', 'one', '$.b', '$.a' );
+select json_contains_path('{ "a": true }', 'ONE', '$.a', '$.b' );
+select json_contains_path('{ "a": true }', 'oNe', '$.a', '$.b' );
+
+# some wildcards
+select json_contains_path('{ "a": true, "b": [ 1, 2, { "c": [ 4, 5, { "d": [ 6, 7, 8, 9, 10 ]} ] } ] }', 'all', '$**[4]' );
+select json_contains_path('{ "a": true, "b": [ 1, 2, { "c": [ 4, 5, { "d": [ 6, 7, 8, 9, 10 ]} ] } ] }', 'all', '$**[4]', '$**[5]' );
+select json_contains_path('{ "a": true, "b": [ 1, 2, { "c": [ 4, 5, { "d": [ 6, 7, 8, 9, 10 ]} ] } ] }', 'all', '$**.c[2]' );
+select json_contains_path('{ "a": true, "b": [ 1, 2, { "c": [ 4, 5, { "d": [ 6, 7, 8, 9, 10 ]} ] } ] }', 'all', '$**.c[3]' );
+select json_contains_path('{"a":1, "b":2}', 'one', '$.*');
+select json_contains_path('[1,2,3]', 'one', '$.*');
+select json_contains_path('{}', 'one', '$[*]');
+
+# combine ellipsis and wildcard
+SELECT JSON_CONTAINS_PATH('[1, [[{"x": [{"a":{"b":{"c":42}}}]}]]]',
+ 'one', '$**.a.*');
+SELECT JSON_CONTAINS_PATH('[1, [[{"x": [{"a":{"b":{"c":42}}}]}]]]',
+ 'all', '$**.a.*');
+SELECT JSON_CONTAINS_PATH('[1,2,3]', 'one', '$**[*]');
+SELECT JSON_CONTAINS_PATH('[1,2,3]', 'all', '$**[*]');
+
+# 3 paths
+select json_contains_path('{ "a": true, "b": [ 1, 2 ] }', 'all', '$**[1]', '$.b[0]', '$.c' );
+select json_contains_path('{ "a": true, "b": [ 1, 2 ] }', 'all', '$.c', '$**[1]', '$.b[0]' );
+select json_contains_path('{ "a": true, "b": [ 1, 2 ] }', 'all', '$.b[0]', '$.c', '$**[1]' );
+select json_contains_path('{ "a": true, "b": [ 1, 2 ] }', 'one', '$**[1]', '$.b[0]', '$.c' );
+select json_contains_path('{ "a": true, "b": [ 1, 2 ] }', 'one', '$.c', '$**[1]', '$.b[0]' );
+select json_contains_path('{ "a": true, "b": [ 1, 2 ] }', 'one', '$.b[0]', '$.c', '$**[1]' );
+
+# examples from the wl7909 spec
+# returns 0 because there is no element at $.a.c
+SELECT JSON_CONTAINS_PATH
+(
+ '{ "a" : 123, "b" : [ 123, 456 ] }',
+ 'all',
+ '$.a.c',
+ '$.b[1]'
+);
+
+# returns 1 because there is an element at $.b[1]
+SELECT JSON_CONTAINS_PATH
+(
+ '{ "a" : 123, "b" : [ 123, 456 ] }',
+ 'one',
+ '$.a.c',
+ '$.b[1]'
+);
+
+# returns 0 because there is no element at the given path
+SELECT JSON_CONTAINS_PATH
+(
+ '{ "a" : 123, "b" : [ 123, 456 ] }',
+ 'all',
+ '$.c'
+);
+
+# returns 1 because there is an element at $.b[1].c.d
+SELECT JSON_CONTAINS_PATH
+(
+ '{ "a" : 123, "b" : [ 123, { "c" : { "d" : true } } ] }',
+ 'all',
+ '$.b[1].c.d'
+);
+
+select json_length( null );
+select json_length( '1' );
+--echo
+--echo # invalid json text
+--echo error ER_INVALID_JSON_TEXT_IN_PARAM
+select json_length( 'abc' );
+select json_length( '"abc"' );
+select json_length( 'true' );
+select json_length( 'false' );
+select json_length( 'null' );
+
+select json_length( '{}' );
+select json_length( '{ "a" : 100, "b" : 200 }' );
+select json_length( '{ "a" : 100, "b" : [ 300, 400, 500 ] }' );
+select json_length( '[]' );
+select json_length( '[ null, "foo", true, 1.1 ]' );
+select json_length( '[ null, "foo", true, { "a" : "b", "c" : "d" } ]' );
+select json_length( '"foo"' );
+select json_length( '1.2' );
+
+
+# bad path expressions
+--echo
+--echo # invalid json path
+--echo error ER_INVALID_JSON_PATH
+select json_length( 'true', 'c$' );
+--echo
+--echo # invalid json path
+--echo error ER_INVALID_JSON_PATH
+select json_length( '{ "foo" : [ true, false ] }', '$.foo[bar]' );
+--echo
+--echo # wildcards not allowed in path expressions for this function
+--echo error ER_INVALID_JSON_PATH_WILDCARD
+select json_length( 'true', '$.*' );
+--echo
+--echo # wildcards not allowed in path expressions for this function
+--echo error ER_INVALID_JSON_PATH_WILDCARD
+select json_length( 'true', '$.foo**.bar' );
+
+# json_length() with non-vacuous path expressions
+
+# 1
+select json_length( '[ 1, [ 2, 3, 4 ], 5 ]', '$[0]' );
+# 3
+select json_length( '[ 1, [ 2, 3, 4 ], 5 ]', '$[1]' );
+# 1
+select json_length( '[ 1, [ 2, 3, 4 ], 5 ]', '$[2]' );
+# auto-wrapping: 1
+select json_length( '[ 1, [ 2, 3, 4 ], 5 ]', '$[2][0]' ); # auto-wrap scalar
+select json_length( '[ 1, [ 2, 3, 4 ], {"a": 1} ]', '$[2][0]' ); # ditto object
+
+# non-existent path: null
+select json_length( '[ 1, [ 2, 3, 4 ], 5 ]', '$[2][1]' );
+# 3
+select json_length( '[ 1, { "a": true, "b": false, "c": null }, 5 ]', '$[1]' );
+
+# examples from the wl7909 spec
+# returns 0
+SELECT JSON_LENGTH
+(
+ '{}'
+);
+
+# returns 1
+SELECT JSON_LENGTH
+(
+ '3'
+);
+
+# returns 2
+SELECT JSON_LENGTH
+(
+ '{ "a" : 123, "b" : [ 123, 456, 789 ] }'
+);
+
+# returns 3
+SELECT JSON_LENGTH
+(
+ '{ "a" : 123, "b" : [ 123, 456, 789 ] }',
+ '$.b'
+);
+
+# returns null because the path does not exist
+SELECT JSON_LENGTH
+(
+ '{ "a" : 123, "b" : [ 123, 456, 789 ] }',
+ '$.c'
+);
+
+--echo # ----------------------------------------------------------------------
+--echo # Test of JSON_DEPTH function.
+--echo # ----------------------------------------------------------------------
+select json_depth(null);
+select json_depth(cast(null as json));
+#select i, json_depth(j) from t1;
+select json_depth(cast('[]' as json)),
+ json_depth(cast('{}' as json)),
+ json_depth(cast('null' as json)),
+ json_depth(json_quote('foo'));
+select json_depth(cast('[[2], 3, [[[4]]]]' as json));
+select json_depth(cast('{"a": {"a1": [3]}, "b": {"b1": {"c": {"d": [5]}}}}' as json));
+
+# examples from the wl7909 spec
+# returns 1
+SELECT JSON_DEPTH
+(
+ '{}'
+);
+
+# returns 1
+SELECT JSON_DEPTH
+(
+ '[]'
+);
+
+# returns 1
+SELECT JSON_DEPTH( '"abc"' );
+
+# returns 1
+SELECT JSON_DEPTH( CAST( '"abc"' AS JSON ) );
+
+--echo error ER_INVALID_TYPE_FOR_JSON
+SELECT JSON_DEPTH( 1 );
+
+--echo error ER_INVALID_JSON_TEXT_IN_PARAM
+SELECT JSON_DEPTH( 'abc' );
+
+# returns 1
+SELECT JSON_DEPTH( CAST( 1 AS JSON ) );
+
+# returns 2
+SELECT JSON_DEPTH
+(
+ '{ "a" : true, "b" : false, "c" : null }'
+);
+
+# returns 2
+SELECT JSON_DEPTH
+(
+ '[ "a", true, "b" , false, "c" , null ]'
+);
+
+# returns 2
+SELECT JSON_DEPTH
+(
+ '{ "a" : true, "b" : {}, "c" : null }'
+);
+
+# returns 2
+SELECT JSON_DEPTH
+(
+ '[ "a", true, "b" , {}, "c" , null ]'
+);
+
+# returns 3
+SELECT JSON_DEPTH
+(
+ '{ "a" : true, "b" : { "e" : false }, "c" : null }'
+);
+
+# returns 3
+SELECT JSON_DEPTH
+(
+ '[ "a", true, "b" , { "e" : false }, "c" , null ]'
+);
+
+--echo error ER_INVALID_JSON_TEXT_IN_PARAM
+SELECT JSON_DEPTH
+(
+ '[ "a", true, "b" , { "e" : false }, "c" , null'
+);
+
+--echo # ----------------------------------------------------------------------
+--echo # Test of JSON_REMOVE function.
+--echo # ----------------------------------------------------------------------
+
+# null args
+select json_remove( null, '$[1]' );
+select json_remove( null, '$[1]' ) is null;
+select json_remove( '[ 1, { "a": true, "b": false, "c": null }, 5 ]', null );
+select json_remove( '[ 1, { "a": true, "b": false, "c": null }, 5 ]', null ) is null;
+select json_remove( '[ 1, { "a": true, "b": false, "c": null }, 5 ]', '$[1]', null );
+select json_remove( '[ 1, { "a": true, "b": false, "c": null }, 5 ]', '$[1]', null ) is null;
+
+# too few args
+
+--echo
+--echo # not enough args
+--error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
+select json_remove();
+--echo
+--echo # not enough args
+--error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
+select json_remove( '[ 1, { "a": true, "b": false, "c": null }, 5 ]' );
+--echo
+--echo # not enough args
+--error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
+select json_remove( '$[1]' );
+
+# malformed args
+--echo
+--echo # invalid json text
+--echo error ER_INVALID_JSON_TEXT_IN_PARAM
+select json_remove( '[ 1, { "a": true, "b": false, "c": null }, 5 ', '$[1]', '$[2]' );
+--echo
+--echo # invalid json path
+--echo error ER_INVALID_JSON_PATH
+select json_remove( '[ 1, { "a": true, "b": false, "c": null }, 5 ]', '$[1', '$[2]' );
+--echo
+--echo # invalid json path
+--echo error ER_INVALID_JSON_PATH
+select json_remove( '[ 1, { "a": true, "b": false, "c": null }, 5 ]', '$[1]', '$[2' );
+--echo
+--echo # Vacuous path expression
+--echo error ER_JSON_VACUOUS_PATH
+select json_remove( '[ 1, 2, 3 ]', '$' );
+--echo
+--echo # Vacuous path expression
+--echo error ER_JSON_VACUOUS_PATH
+select json_remove( '[ 1, 2, 3 ]', '$', '$[2]' );
+--echo
+--echo # Vacuous path expression
+--echo error ER_JSON_VACUOUS_PATH
+select json_remove( '[ 1, 2, 3 ]', '$[1]', '$' );
+
+# wildcard/ellipsis not allowed in paths
+--echo error ER_INVALID_JSON_PATH_WILDCARD
+select json_remove( '[ 1, 2, 3 ]', '$[*]' );
+--echo error ER_INVALID_JSON_PATH_WILDCARD
+select json_remove( '[ 1, 2, 3 ]', '$**[2]' );
+--echo error ER_INVALID_JSON_PATH_WILDCARD
+select json_remove( '[ 1, 2, 3 ]', '$[2]', '$[*]' );
+--echo error ER_INVALID_JSON_PATH_WILDCARD
+select json_remove( '[ 1, 2, 3 ]', '$[2]', '$**[2]' );
+
+# simple matches
+
+select json_remove( '[ 1, 2, 3 ]', '$[0]' );
+select json_remove( '[ 1, 2, 3 ]', '$[1]' );
+select json_remove( '[ 1, 2, 3 ]', '$[2]' );
+select json_remove( '[ 1, 2, 3 ]', '$[3]' );
+select json_remove( '[ 1, { "a": true, "b": false, "c": null }, 5 ]', '$[1]' );
+
+# one match nested inside another
+--echo error ER_INVALID_JSON_PATH_WILDCARD
+select json_remove( '[ { "a": { "a": true } } ]', '$**.a' );
+
+# multiple paths
+select json_remove( '[ { "a": true }, { "b": false }, { "c": null }, { "a": null } ]', '$[0].a', '$[2].c' );
+
+# ellipsis with matches at different levels
+--echo error ER_INVALID_JSON_PATH_WILDCARD
+select json_remove( '[ { "a": true }, { "b": [ { "c": { "a": true } } ] }, { "c": null }, { "a": null } ]', '$**.a' );
+
+# nonsense path
+select json_remove( '{"id": 123, "name": "systemQA", "array": [1, 2, 3]}', '$[0]' );
+
+# examples from wl7909 spec
+# returns the document {"a": "foo", "b": [true]}
+SELECT JSON_REMOVE
+(
+ '{"a" : "foo", "b" : [true, {"c" : 123}]}',
+ '$.b[ 1 ]'
+);
+
+# returns {"a": "foo", "b": [true, {}]} due to normalization
+SELECT JSON_REMOVE
+(
+ '{ "a" : "foo", "b" : [ true, { "c" : 123, "c" : 456 } ] }',
+ '$.b[ 1 ].c'
+);
+
+# returns {"a": "foo", "b": [true, {}]}
+SELECT JSON_REMOVE
+(
+ '{ "a" : "foo", "b" : [ true, { "c" : 123 } ] }',
+ '$.b[ 1 ].c'
+);
+
+# returns the original document because the path doesn't identify an element
+SELECT JSON_REMOVE
+(
+ '{ "a" : "foo", "b" : [ true, { "c" : 123, "d" : 456 } ] }',
+ '$.b[ 1 ].e'
+);
+
+--echo # ----------------------------------------------------------------------
+--echo # Test of JSON_MERGE function.
+--echo # ----------------------------------------------------------------------
+
+--echo
+--echo # not enough args
+--error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
+select json_merge();
+--echo
+--echo # not enough args
+--error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
+select json_merge( '[ 1, 2, 3 ]' );
+
+# null args result in NULL value
+select json_merge( null, null );
+select json_merge( null, '[ 1, 2, 3 ]' );
+select json_merge( '[ 1, 2, 3 ]', null );
+select json_merge( null, '[ 1, 2, 3 ]', '[ 4, 5, 6 ]' );
+select json_merge( '[ 1, 2, 3 ]', null, '[ 4, 5, 6 ]' );
+select json_merge( '[ 1, 2, 3 ]', '[ 4, 5, 6 ]', null );
+
+--echo error ER_INVALID_JSON_TEXT_IN_PARAM
+select json_merge( '[1, 2]', '[3, 4' );
+--echo error ER_INVALID_JSON_TEXT_IN_PARAM
+select json_merge( '[1, 2', '[3, 4]' );
+
+# good json_merge() expressions
+select json_merge( '1', '2' );
+select json_merge( '1', '[2, 3]' );
+select json_merge( '[1, 2]', '3' );
+select json_merge( '1', '{ "a": 2 }' );
+select json_merge( '{ "a": 2 }', '1' );
+select json_merge( '[1, 2]', '[3, 4]' );
+select json_merge( '{ "a": 2 }', '{ "b": 3}' );
+select json_merge( '[1, 2]', '{ "a": 2 }' );
+select json_merge( '{ "a": 2 }', '[1, 2]' );
+
+select json_merge( '{"a": 1, "b": 2 }', '{"b": 3, "d": 4 }' );
+select json_merge( '{"a": 1, "b": 2 }', '{"b": [3, 4], "d": 4 }' );
+select json_merge( '{"a": 1, "b": [2, 3] }', '{"b": 4, "d": 4 }' );
+select json_merge( '{"a": 1, "b": 2 }', '{"b": {"e": 7, "f": 8}, "d": 4 }' );
+select json_merge( '{"b": {"e": 7, "f": 8}, "d": 4 }', '{"a": 1, "b": 2 }' );
+select json_merge( '{"a": 1, "b": [2, 9] }', '{"b": [10, 11], "d": 4 }' );
+select json_merge( '{"a": 1, "b": [2, 9] }', '{"b": {"e": 7, "f": 8}, "d": 4 }' );
+select json_merge( '{"b": {"e": 7, "f": 8}, "d": 4 }', '{"a": 1, "b": [2, 9] }' );
+select json_merge( '{"b": {"e": 7, "f": 8}, "d": 4 }', '{ "a": 1, "b": {"e": 20, "g": 21 } }' );
+
+select json_merge( '1', '2', '3' );
+select json_merge( '[1, 2 ]', '3', '[4, 5]' );
+select json_merge
+(
+ '{ "a": true, "b": { "c": 3, "d": 4 }, "e": [ 1, 2 ] }',
+ '{ "d": false, "b": { "g": 3, "d": 5 }, "f": [ 1, 2 ] }',
+ '{ "m": true, "b": { "h": 8, "d": 4 }, "e": [ 3, 4 ] }'
+);
+
+# examples from the wl7909 spec
+# returns [{"a": "foo", "b": [true, {"c": 123}]}, 5, 6]
+SELECT JSON_MERGE
+(
+ '{ "a" : "foo", "b" : [ true, { "c" : 123 } ] }',
+ '[ 5, 6]'
+);
+
+# returns {"a": "foo", "b": [true, {"c": 123}, false, 34]}
+SELECT JSON_MERGE
+(
+ '{ "a" : "foo", "b" : [ true, { "c" : 123 } ] }',
+ '{ "b": [ false, 34 ] }'
+);
+
+# returns {"a": "foo", "b": [true, {"c": 123}, "bar"]}
+SELECT JSON_MERGE
+(
+ '{ "a" : "foo", "b" : [ true, { "c" : 123 } ] }',
+ '{ "b": "bar" }'
+);
+
+# returns {"a": {"b": 1, "c": 1}}
+SELECT JSON_MERGE
+(
+ '{ "a" : { "b" : 1 } }',
+ '{ "a" : { "c" : 1 } }'
+);
+
+--echo # ----------------------------------------------------------------------
+--echo # Test of JSON_TYPE function.
+--echo # ----------------------------------------------------------------------
+
+# negative test
+--echo error ER_INVALID_JSON_TEXT_IN_PARAM
+select json_type('abc');
+
+#select i, json_type(j) from t1;
+select json_type('{"a": 2}');
+select json_type('[1,2]');
+select json_type('"scalar string"');
+select json_type('true');
+select json_type('false');
+select json_type('null');
+select json_type('1');
+select json_type('-0');
+select json_type('-0.0');
+--echo error ER_INVALID_TYPE_FOR_JSON
+select json_type(-1);
+--echo error ER_INVALID_TYPE_FOR_JSON
+select json_type(CAST(1 AS UNSIGNED));
+select json_type('32767');
+--echo error ER_INVALID_TYPE_FOR_JSON
+select json_type(PI());
+select json_type('3.14');
+
+--echo error ER_INVALID_JSON_TEXT_IN_PARAM
+select json_type(CAST(CAST('2015-01-15' AS DATE) as CHAR CHARACTER SET 'utf8'));
+
+--echo # ----------------------------------------------------------------------
+--echo # Test of CAST(literal AS JSON)
+--echo # ----------------------------------------------------------------------
+select json_type(cast(cast('2014-11-25 18:00' as datetime) as json));
+select json_type(cast(cast('2014-11-25' as date) as json));
+select json_type(cast(cast('18:00:59' as time) as json));
+# select json_type(cast(cast('2014-11-25 18:00' as timestamp) as json)); -- cast target type not supported
+
+# select json_type(cast(cast('1999' as year) as json)); -- cast target type not supported
+select json_type(cast(127 as json));
+select json_type(cast(255 as json));
+select json_type(cast(32767 as json));
+select json_type(cast(65535 as json));
+select json_type(cast(8388607 as json));
+select json_type(cast(16777215 as json));
+select json_type(cast(2147483647 as json));
+select json_type(cast(4294967295 as json));
+select json_type(cast(9223372036854775807 as json));
+select json_type(cast(18446744073709551615 as json));
+select json_type(cast(true as json));
+select json_type(cast(b'10101' as json));
+
+select json_type(cast(cast(3.14 as decimal(5,2)) as json));
+select json_type(cast(3.14 as json));
+select json_type(cast(3.14E30 as json));
+# select json_type(cast(cast(3.14 as numeral(5,2)) as json)); -- cast target type not supported
+
+# select json_type(cast(cast(3.14 as double) as json)); -- cast target type not supported
+# select json_type(cast(cast(3.14 as float) as json)); -- cast target type not supported
+
+# select json_type(cast(cast(b'10101' as bit(10)) as json)); -- cast target type not supported
+# select json_type(cast(cast('10101abcde' as blob) as json)); -- cast target type not supported
+select json_type(cast(cast('10101abcde' as binary) as json));
+
+# select json_type(cast(cast('a' as enum('a','b','c')) as json)); -- cast target type not supported
+# select json_type(cast(cast('a,c' as set('a','b','c')) as json)); -- cast target type not supported
+
+select json_type(cast(ST_GeomFromText('POINT(1 1)') as json));
+select json_type(cast(ST_GeomFromText('LINESTRING(0 0,1 1,2 2)') as json));
+select json_type(cast(ST_GeomFromText('POLYGON((0 0,10 0,10 10,0 10,0 0),
+ (5 5,7 5,7 7,5 7, 5 5))') as json));
+select json_type(cast(null as json));
+select json_type(cast(null as json)) is null; # check that it is an SQL NULL
+select json_type(null) is null; # is an SQL NULL
+
+#
+# same, but now show the printable value:
+#
+select cast(cast('2014-11-25 18:00' as datetime) as json);
+select cast(cast('2014-11-25' as date) as json);
+select cast(cast('18:00:59' as time) as json);
+# select cast(cast('2014-11-25 18:00' as timestamp) as json); -- cast target type not supported
+
+# select cast(cast('1999' as year) as json); -- cast target type not supported
+select cast(127 as json);
+select cast(255 as json);
+select cast(32767 as json);
+select cast(65535 as json);
+select cast(8388607 as json);
+select cast(16777215 as json);
+select cast(2147483647 as json);
+select cast(4294967295 as json);
+select cast(9223372036854775807 as json);
+select cast(18446744073709551615 as json);
+select cast(true as json);
+select cast(b'10101' as json);
+
+select cast(cast(3.14 as decimal(5,2)) as json);
+select cast(3.14 as json);
+select cast(3.14e0 as json);
+# select cast(cast(3.14 as numeral(5,2)) as json); -- cast target type not supported
+
+# select cast(cast(3.14 as double) as json); -- cast target type not supported
+# select cast(cast(3.14 as float) as json); -- cast target type not supported
+
+# select cast(cast(b'10101' as bit(10) as json); -- cast target type not supported
+# select cast(cast('10101abcde' as blob) as json); -- cast target type not supported
+select cast(cast('10101abcde' as binary) as json);
+
+# select cast(cast('a' as enum('a','b','c') as json); -- cast target type not supported
+# select cast(cast('a,c' as set('a','b','c') as json); -- cast target type not supported
+
+select cast(ST_GeomFromText('POINT(1 1)') as json);
+select cast(ST_GeomFromText('LINESTRING(0 0,1 1,2 2)') as json);
+select cast(ST_GeomFromText('POLYGON((0 0,10 0,10 10,0 10,0 0),
+ (5 5,7 5,7 7,5 7, 5 5))') as json);
+select cast(null as json);
+select cast(null as json) is null; # check that it is an SQL NULL
+
+--echo # ----------------------------------------------------------------------
+--echo # Test of JSON_KEYS function.
+--echo # ----------------------------------------------------------------------
+# should all give NULL:
+select json_keys(NULL);
+select json_keys(NULL, '$.b');
+select json_keys(NULL, NULL);
+select json_keys('{"a": 1, "b": {"e": "foo", "b": 3}}', '$.a');
+select json_keys('{"a": 1, "b": {"e": "foo", "b": 3}}', NULL);
+
+# non NULL results
+select json_keys('{"a": 1, "b": {"e": "foo", "b": 3}}');
+select json_keys('{"a": 1, "b": {"e": "foo", "b": 3}}', '$.b');
+
+--echo error ER_INVALID_JSON_PATH_WILDCARD
+select json_keys('{"a": 1, "b": {"e": "foo", "b": 3}}', '$.*.b');
+
+# Examples from the specification
+--echo # returns [ "a", "b" ]
+SELECT JSON_KEYS('{ "a" : "foo", "b" : [ true, { "c" : "123" } ] }');
+
+--echo # returns []
+SELECT JSON_KEYS('{ "a" : "foo", "b" : [ true, { "c" : {} } ] }',
+ '$.b[1].c');
+
+--echo # returns NULL
+SELECT JSON_KEYS('{ "a" : "foo", "b" : [ true, { "c" : {} } ] }',
+ '$.a.b[2]');
+
+--echo error ER_INVALID_JSON_PATH
+SELECT JSON_KEYS('{"a":1}', '1010');
+--echo error ER_INVALID_JSON_PATH
+SELECT JSON_KEYS('{"a":1}', '1010') IS NULL;
+
+# examples from the wl7909 spec
+# returns [ "a", "b" ]
+SELECT JSON_KEYS
+(
+ '{ "a" : "foo", "b" : [ true, { "c" : "123" } ] }'
+);
+
+# returns []
+SELECT JSON_KEYS
+(
+ '{ "a" : "foo", "b" : [ true, { "c" : {} } ] }',
+ '$.b[1].c'
+);
+
+# returns NULL
+SELECT JSON_KEYS
+(
+ '{ "a" : "foo", "b" : [ true, { "c" : {} } ] }',
+ '$.a.b[2]'
+);
+
+--error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
+SELECT JSON_KEYS();
+--error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
+SELECT JSON_KEYS('{}', '$', '$');
+
+--echo # ----------------------------------------------------------------------
+--echo # CAST(<json> AS CHAR). See also 'json_conversions.test' for other
+--echo # conversion tests.
+--echo # ----------------------------------------------------------------------
+select cast(json_keys('{"a": 1}') as char);
+select cast(cast(1 as json) as char);
+select cast(json_keys(NULL) as char);
+#select cast(j as char) from keys1;
+
+--echo # ----------------------------------------------------------------------
+--echo # Path matching with double-quotes
+--echo # ----------------------------------------------------------------------
+
+# matches
+select json_extract( '{ "one potato" : 1 }', '$."one potato"' );
+# matches
+select json_extract( '{ "a.b" : 1 }', '$."a.b"' );
+
+# doesn't match
+select json_extract( '{ "\\"a\\"": 1}', '$."a"' );
+# matches
+select json_extract( '{ "\\"a\\"": 1}', '$."\\"a\\""' );
+# matches
+select json_extract( '{ "a": 1}', '$."a"' );
+# matches
+select json_extract( '{ "a": 1}', '$.a' );
+
+# examples from functional spec section on Path Syntax
+
+# [3, 2]
+select json_extract( '{ "a": [ [ 3, 2 ], [ { "c" : "d" }, 1 ] ], "b": { "c" : 6 }, "one potato": 7, "b.c" : 8 }', '$.a[0]' );
+# 2
+select json_extract( '{ "a": [ [ 3, 2 ], [ { "c" : "d" }, 1 ] ], "b": { "c" : 6 }, "one potato": 7, "b.c" : 8 }', '$.a[0][1]' );
+# [ { "c": "d" }, 1 ]
+select json_extract( '{ "a": [ [ 3, 2 ], [ { "c" : "d" }, 1 ] ], "b": { "c" : 6 }, "one potato": 7, "b.c" : 8 }', '$.a[1]' );
+# { "c": "d" }
+select json_extract( '{ "a": [ [ 3, 2 ], [ { "c" : "d" }, 1 ] ], "b": { "c" : 6 }, "one potato": 7, "b.c" : 8 }', '$.a[1][0]' );
+# "d"
+select json_extract( '{ "a": [ [ 3, 2 ], [ { "c" : "d" }, 1 ] ], "b": { "c" : 6 }, "one potato": 7, "b.c" : 8 }', '$.a[1][0].c' );
+# 7
+select json_extract( '{ "a": [ [ 3, 2 ], [ { "c" : "d" }, 1 ] ], "b": { "c" : 6 }, "one potato": 7, "b.c" : 8 }', '$."one potato"' );
+# 6
+select json_extract( '{ "a": [ [ 3, 2 ], [ { "c" : "d" }, 1 ] ], "b": { "c" : 6 }, "one potato": 7, "b.c" : 8 }', '$.b.c' );
+# 8
+select json_extract( '{ "a": [ [ 3, 2 ], [ { "c" : "d" }, 1 ] ], "b": { "c" : 6 }, "one potato": 7, "b.c" : 8 }', '$."b.c"' );
+
+
+--echo # ----------------------------------------------------------------------
+--echo # Test of JSON_EXTRACT function.
+--echo # ----------------------------------------------------------------------
+
+# errors
+--error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
+select json_extract(NULL);
+--error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
+select json_extract('$.b');
+--error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
+select json_extract('{"a": 1, "b": {"e": "foo", "b": 3}}');
+
+# Confused argument order
+--echo error ER_INVALID_JSON_TEXT_IN_PARAM
+select json_extract('$.a', '{"a": 1, "b": {"e": "foo", "b": 3}}');
+
+# NULLs
+select json_extract(NULL, '$.b');
+select json_extract(NULL, NULL);
+
+# non-NULLs
+select json_extract('{"a": 1, "b": {"e": "foo", "b": 3}}', '$.a');
+select json_extract('{"a": 1, "b": {"e": "foo", "b": 3}}', '$.*');
+select json_extract('{"a": 1, "b": {"e": "foo", "b": 3}}', '$.a', '$.b.e');
+select json_extract('{"a": 1, "b": [1,2,3]}', '$.b[2]');
+# one path is NULL
+select json_extract('{"a": 1, "b": {"e": "foo", "b": 3}}', '$.a', NULL);
+
+# Examples from the specification
+--echo # returns a JSON value containing just the string "123"
+SELECT JSON_EXTRACT('{ "a" : "foo", "b" : [ true, { "c" : "123" } ] }',
+ '$.b[ 1 ].c');
+
+--echo # returns a JSON value containing just the number 123
+SELECT JSON_EXTRACT('{ "a" : "foo", "b" : [ true, { "c" : 123 } ] }',
+ '$.b[ 1 ].c');
+
+--echo # raises an error because the document is not valid
+--echo error ER_INVALID_JSON_TEXT_IN_PARAM
+SELECT JSON_EXTRACT('{ "a" : [ }',
+ '$.b[ 1 ].c');
+
+--echo # raises an error because the path is invalid
+--echo error ER_INVALID_JSON_PATH
+SELECT JSON_EXTRACT('{ "a" : "foo", "b" : [ true, { "c" : 123 } ] }',
+ '$.b[ 1 ].');
+
+--echo # returns a JSON value containing the number 123 (because of
+--echo # auto-wrapping the scalar)
+SELECT JSON_EXTRACT('{ "a" : "foo", "b" : [ true, { "c" : 123 } ] }',
+ '$.b[ 1 ].c[ 0 ]');
+--echo # returns a JSON value containing the object because of auto-wrapping
+SELECT JSON_EXTRACT('{ "a" : "foo", "b" : [ true, { "c" : {"not array": 4} } ] }',
+ '$.b[ 1 ].c[ 0 ]');
+
+--echo # returns null because the path, although valid, does not identify a value
+SELECT JSON_EXTRACT('{ "a" : "foo", "b" : [ true, { "c" : 123 } ] }',
+ '$.b[ 1 ].c[ 1 ]');
+
+--echo # returns a JSON value containing the number 123 (due to normalization)
+SELECT JSON_EXTRACT('{ "a" : "foo", "b" : [ true, { "c" : 123, "c" : 456 } ] }',
+ '$.b[ 1 ].c');
+
+--echo # returns a JSON array [ "foo", true ]
+SELECT JSON_EXTRACT('{ "a" : "foo", "b" : [ true, { "c" : 123, "c" : 456 } ] }',
+ '$.a', '$.b[0]');
+
+--echo # returns a JSON array [ true ]
+SELECT JSON_EXTRACT('{ "a" : "foo", "b" : [ true, { "c" : 123, "c" : 456 } ] }',
+ '$.d', '$.b[0]');
+
+# some examples verifying ellipsis behavior
+
+# should have same result
+select json_extract( '[1]', '$[0][0]' );
+select json_extract( '[1]', '$**[0]' );
+
+# should have same result
+select json_extract( '{ "a": 1 }', '$.a[0]' );
+select json_extract( '{ "a": 1 }', '$**[0]' );
+
+# should have same result
+select json_extract( '{ "a": 1 }', '$[0].a' );
+select json_extract( '{ "a": 1 }', '$**.a' );
+
+# should have same result
+select json_extract( '{ "a": 1 }', '$[0].a[0]' );
+select json_extract( '{ "a": 1 }', '$**[0]' );
+
+# should have the same result
+select json_extract( '{ "a": 1 }', '$[0].a' );
+select json_extract( '{ "a": 1 }', '$**.a' );
+select json_extract( '{ "a": 1 }', '$[0][0].a' );
+select json_extract( '{ "a": 1 }', '$[0][0][0].a' );
+
+# should have the same result
+SELECT JSON_EXTRACT('[1, [[{"x": [{"a":{"b":{"c":42}}}]}]]]', '$**.a.*');
+SELECT JSON_EXTRACT('[1, [[{"x": [{"a":{"b":{"c":42}}}]}]]]',
+ '$[1][0][0].x[0].a.*');
+
+# examples from the wl7909 spec
+# returns a JSON value containing just the string "123"
+SELECT JSON_EXTRACT
+(
+ '{ "a" : "foo", "b" : [ true, { "c" : "123" } ] }',
+ '$.b[ 1 ].c'
+);
+
+# returns a JSON value containing just the number 123
+SELECT JSON_EXTRACT
+(
+ '{ "a" : "foo", "b" : [ true, { "c" : 123 } ] }',
+ '$.b[ 1 ].c'
+);
+
+--echo error ER_INVALID_JSON_TEXT_IN_PARAM
+SELECT JSON_EXTRACT
+(
+ '{ "a" : [ }',
+ '$.b[ 1 ].c'
+);
+
+--echo error ER_INVALID_JSON_PATH
+SELECT JSON_EXTRACT
+(
+ '{ "a" : "foo", "b" : [ true, { "c" : 123 } ] }',
+ '$.b[ 1 ].'
+);
+
+# returns a JSON value containing the number 123 (because of auto-wrapping)
+SELECT JSON_EXTRACT
+(
+ '{ "a" : "foo", "b" : [ true, { "c" : 123 } ] }',
+ '$.b[ 1 ].c[ 0 ]'
+);
+
+# returns null because the path, although valid, does not identify a value
+SELECT JSON_EXTRACT
+(
+ '{ "a" : "foo", "b" : [ true, { "c" : 123 } ] }',
+ '$.b[ 1 ].c[ 1 ]'
+);
+
+# returns a JSON value containing the number 123 (due to normalization)
+SELECT JSON_EXTRACT
+(
+ '{ "a" : "foo", "b" : [ true, { "c" : 123, "c" : 456 } ] }',
+ '$.b[ 1 ].c'
+);
+
+# returns a JSON array ["foo", true]
+SELECT JSON_EXTRACT
+(
+ '{ "a" : "foo", "b" : [ true, { "c" : 123, "c" : 456 } ] }',
+ '$.a', '$.b[0]'
+);
+
+# returns a the 'true' literal
+SELECT JSON_EXTRACT
+(
+ '{ "a" : "foo", "b" : [ true, { "c" : 123, "c" : 456 } ] }',
+ '$.d', '$.b[0]'
+);
+
+# should return NULL
+select json_extract( '[ { "a": 1 }, { "a": 2 } ]', '$[*].b' ) jdoc;
+
+# should return NULL
+select json_extract( '[ { "a": 1 }, { "a": 2 } ]', '$[0].b' ) jdoc;
+
+# should return 1
+select json_extract( '[ { "a": 1 }, { "a": 2 } ]', '$[0].a' ) jdoc;
+
+# should return [1, 2]
+select json_extract( '[ { "a": 1 }, { "a": 2 } ]', '$[*].a' ) jdoc;
+
+# should return [1]
+select json_extract( '[ { "a": 1 }, { "b": 2 } ]', '$[*].a' ) jdoc;
+
+# should return [3, 4]
+select json_extract( '[ { "a": [3,4] }, { "b": 2 } ]', '$[0].a' ) jdoc;
+
+# should return [[3, 4]]
+select json_extract( '[ { "a": [3,4] }, { "b": 2 } ]', '$[*].a' ) jdoc;
+
+# should return [[3, 4]]
+select json_extract( '[ { "a": [3,4] }, { "b": 2 } ]', '$[0].a', '$[1].a' ) jdoc;
+
+--echo # ----------------------------------------------------------------------
+--echo # Test of JSON_ARRAY_APPEND function.
+--echo # ----------------------------------------------------------------------
+
+# NULLs
+select json_array_append(NULL, '$.b', cast(1 as json));
+select json_array_append('[1,2,3]', NULL, cast(1 as json));
+select json_array_append('[1,2,3]', '$', NULL);
+
+# wrong # args
+--error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
+select json_array_append(NULL);
+--error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
+select json_array_append(NULL, NULL);
+--error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
+select json_array_append(NULL, NULL, NULL, NULL);
+
+# auto-wrap
+SELECT JSON_ARRAY_APPEND(cast('1' as json), '$', 3);
+SELECT JSON_ARRAY_APPEND(cast('{"a": 3}' as json), '$', 3);
+
+--echo error ER_INVALID_JSON_PATH_WILDCARD
+select json_array_append(cast('{"a": {"b": [3]}}' as json), '$**[0]', 6);
+
+# Examples from the specification
+
+--echo # Auto-wrapping, since because the paths identify scalars.
+--echo # should return {"a": "foo", "b": ["bar", 4], "c": ["wibble", "grape"]}
+SELECT JSON_ARRAY_APPEND('{"a": "foo", "b": "bar", "c": "wibble"}',
+ '$.b', cast(4 as json),
+ '$.c', cast('"grape"' as json));
+
+--echo # should return {"a": "foo", "b": [1, 2, 3, 4],
+--echo # "c": ["apple", "pear", "grape"]}
+SELECT JSON_ARRAY_APPEND('{"a" : "foo","b": [1, 2, 3], "c": ["apple", "pear"]}',
+ '$.b', cast(4 as json),
+ '$.c', cast('"grape"' as json));
+
+# without CAST: cf. not required for ANY_JSON_ATOM arguments in specification
+SELECT JSON_ARRAY_APPEND('{"a" : "foo","b": [1, 2, 3], "c": ["apple", "pear"]}',
+ '$.b', 4,
+ '$.c', 'grape');
+
+# wild cards, multiple pairs
+--echo error ER_INVALID_JSON_PATH_WILDCARD
+select json_array_append( '[[], [], []]', '$[*]', 3, '$[*]', 4);
+--echo error ER_INVALID_JSON_PATH_WILDCARD
+select json_array_append( '[[], "not array", []]', '$[*]', 3, '$[*]', 4);
+
+# examples from wl7909 spec
+# should return {"a": "foo", "b": ["bar", 4], "c": ["wibble", "grape"]} due to autowrapping
+SELECT JSON_ARRAY_APPEND
+(
+ '{ "a" : "foo", "b" : "bar", "c" : "wibble" }',
+ '$.b', 4,
+ '$.c', "grape"
+);
+
+# should return {"a": "foo", "b": [1, 2, 3, 4], "c": ["apple", "pear", "grape"]}
+SELECT JSON_ARRAY_APPEND
+(
+ '{ "a" : "foo", "b" : [ 1, 2, 3 ], "c" : [ "apple", "pear" ] }',
+ '$.b', 4,
+ '$.c', "grape"
+);
+
+--echo # ----------------------------------------------------------------------
+--echo # Bug#21373874 ASSERTION `PARENT' FAILED
+--echo # ----------------------------------------------------------------------
+
+select json_array_append('{"a":1}', '$[0]', 100);
+select json_array_append('3', '$[0]', 100);
+select json_array_append('3', '$[0][0][0][0]', 100);
+
+--echo # ----------------------------------------------------------------------
+--echo # Test of JSON_INSERT function.
+--echo # ----------------------------------------------------------------------
+
+# NULLs
+select json_insert(NULL, '$.b', cast(1 as json));
+select json_insert('[1,2,3]', NULL, cast(1 as json));
+select json_insert('[1,2,3]', '$[3]', NULL);
+
+# wrong # args
+--error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
+select json_insert(NULL);
+--error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
+select json_insert(NULL, NULL);
+--error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
+select json_insert(NULL, NULL, NULL, NULL);
+
+# positive test cases
+
+select json_insert('[1,2,3]', '$[2]', 4);
+select json_insert('[1,2,3]', '$[3]', 4);
+select json_insert('[1,2,3]', '$[10]', 4);
+
+select json_insert('{"c":4}', '$.c', 4);
+select json_insert('{"c":4}', '$.a', 4);
+
+select json_insert('1', '$', 4);
+select json_insert('1', '$[0]', 4);
+select json_insert('1', '$[1]', 4);
+select json_insert('1', '$[10]', '4', '$[11]', 5);
+
+select json_insert('[1,2,3]', '$[2][0]', 4);
+select json_insert('[1,2,3]', '$[2][2]', 4);
+
+select json_insert('{"a": 3}', '$.a[0]', 4);
+select json_insert('{"a": 3}', '$.a[1]', 4, '$.a[2]', '5');
+
+# wild card & auto-wrap (scalars)
+--echo error ER_INVALID_JSON_PATH_WILDCARD
+select json_insert(cast('{"a": [1], "b": 2}' as json), '$.*[1]', 6);
+--echo error ER_INVALID_JSON_PATH_WILDCARD
+select json_insert(cast('{"a": 1, "b": 2}' as json), '$.*[1]', 6);
+
+--echo error ER_INVALID_JSON_PATH_WILDCARD
+select json_insert(cast('{"a": {"b": 3}}' as json), '$.a.*[1]', 6);
+--echo error ER_INVALID_JSON_PATH_WILDCARD
+select json_insert(cast('{"a": {"b": [3]}}' as json), '$.a.*[1]', 6);
+--echo error ER_INVALID_JSON_PATH_WILDCARD
+select json_insert(cast('{"a": {"b": 3}}' as json), '$**[1]', 6);
+--echo error ER_INVALID_JSON_PATH_WILDCARD
+select json_insert(cast('{"a": {"b": [3]}}' as json), '$**[1]', 6);
+
+--echo error ER_INVALID_JSON_PATH_WILDCARD
+select json_insert(cast('[1]' as json), '$[*][1]', 6);
+--echo error ER_INVALID_JSON_PATH_WILDCARD
+select json_insert(cast('[1]' as json), '$**[1]', 6);
+--echo error ER_INVALID_JSON_PATH_WILDCARD
+select json_insert(cast('[1, [2], 3]' as json), '$[*][1]', 6);
+--echo error ER_INVALID_JSON_PATH_WILDCARD
+select json_insert(cast('[1, [2], 3]' as json), '$**[1]', 6);
+
+--echo error ER_INVALID_JSON_PATH_WILDCARD
+select json_insert(cast('[[1]]' as json), '$[*][1]', 6);
+--echo error ER_INVALID_JSON_PATH_WILDCARD
+select json_insert(cast('[[1]]' as json), '$**[1]', 6);
+
+# auto-wrap object
+select json_insert(cast('{"a": 3}' as json), '$[1]', 6);
+
+
+# Examples from the specification
+
+# returns the original document because the path does exist
+SELECT JSON_INSERT('{ "a" : "foo", "b" : [ 1, 2, 3 ] }', '$.a', true);
+
+# inserts a number, returns '{ "a" : "foo", "b" : [ 1, 2, 3 ], "c" : 123 }
+SELECT JSON_INSERT('{ "a" : "foo", "b" : [ 1, 2, 3 ] }', '$.c', 123);
+
+# inserts a string, returns '{ "a" : "foo", "b" : [ 1, 2, 3 ], "c" : "123" }
+SELECT JSON_INSERT('{ "a" : "foo", "b" : [ 1, 2, 3 ] }', '$.c', '123');
+
+# returns '{ "a" : [ "foo", true ], "b" : [ 1, 2, 3 ] }'
+SELECT JSON_INSERT('{ "a" : "foo", "b" : [ 1, 2, 3 ] }', '$.a[1]', true);
+
+# should return { "a" : "foo", "b": true }
+SELECT JSON_INSERT('{ "a" : "foo"}', '$.b', true, '$.b', false);
+
+# examples from the wl7909 spec
+# returns the original document because the path does exist
+SELECT JSON_INSERT
+(
+ '{ "a" : "foo", "b" : [ 1, 2, 3 ] }',
+ '$.a',
+ true
+);
+
+# inserts a number, returns '{"a": "foo", "b": [1, 2, 3], "c": 123}
+SELECT JSON_INSERT
+(
+ '{ "a" : "foo", "b" : [ 1, 2, 3 ] }',
+ '$.c',
+ 123
+);
+
+# inserts a string, returns '{"a": "foo", "b": [1, 2, 3], "c": "123"}
+SELECT JSON_INSERT
+(
+ '{ "a" : "foo", "b" : [ 1, 2, 3 ] }',
+ '$.c',
+ '123'
+);
+
+# returns '{"a": ["foo", true], "b": [1, 2, 3]}'
+SELECT JSON_INSERT
+(
+ '{ "a" : "foo", "b" : [ 1, 2, 3 ] }',
+ '$.a[1]',
+ true
+);
+
+# returns {"a": "foo", "b": true}
+SELECT JSON_INSERT
+(
+ '{ "a" : "foo"}',
+ '$.b', true,
+ '$.b', false
+);
+
+--echo # ----------------------------------------------------------------------
+--echo # Test of JSON_ARRAY_INSERT function.
+--echo # ----------------------------------------------------------------------
+
+# NULLs
+select json_array_insert(NULL, '$.b[1]', 1);
+select json_array_insert('[1,2,3]', NULL, 1);
+select json_array_insert('[1,2,3]', '$[3]', NULL);
+
+# wrong # args
+--error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
+select json_array_insert(NULL);
+--error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
+select json_array_insert(NULL, NULL);
+--error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
+select json_array_insert(NULL, NULL, NULL, NULL);
+
+# path does not indicate a cell position
+--echo error ER_INVALID_JSON_PATH_ARRAY_CELL
+select json_array_insert('true', '$', 1);
+--echo error ER_INVALID_JSON_PATH_ARRAY_CELL
+select json_array_insert('true', '$.a', 1);
+--echo error ER_INVALID_JSON_PATH_ARRAY_CELL
+select json_array_insert('true', '$.a[1].b', 1);
+
+# nop if there is no array at the path's parent
+select json_array_insert( 'true', '$[0]', false );
+select json_array_insert( 'true', '$[1]', false );
+select json_array_insert( '{ "a": true }', '$.a[0]', false );
+select json_array_insert( '{ "a": true }', '$.a[1]', false );
+
+# positive tests
+select json_array_insert( '[]', '$[0]', false );
+select json_array_insert( '[]', '$[1]', false );
+select json_array_insert( '[true]', '$[0]', false );
+select json_array_insert( '[true]', '$[1]', false );
+select json_array_insert( '[true]', '$[2]', false );
+select json_array_insert( '{ "a": [] }', '$.a[0]', false );
+select json_array_insert( '{ "a": [] }', '$.a[1]', false );
+select json_array_insert( '{ "a": [true] }', '$.a[0]', false );
+select json_array_insert( '{ "a": [true] }', '$.a[1]', false );
+select json_array_insert( '{ "a": [true] }', '$.a[2]', false );
+
+# insert into the middle of an array
+select json_array_insert( '[1, 2, 3, 4]', '$[0]', false );
+select json_array_insert( '[1, 2, 3, 4]', '$[1]', false );
+select json_array_insert( '[1, 2, 3, 4]', '$[2]', false );
+select json_array_insert( '[1, 2, 3, 4]', '$[3]', false );
+select json_array_insert( '[1, 2, 3, 4]', '$[4]', false );
+select json_array_insert( '[1, 2, 3, 4]', '$[5]', false );
+
+select json_array_insert( '{ "a": [1, 2, 3, 4] }', '$.a[0]', false );
+select json_array_insert( '{ "a": [1, 2, 3, 4] }', '$.a[1]', false );
+select json_array_insert( '{ "a": [1, 2, 3, 4] }', '$.a[2]', false );
+select json_array_insert( '{ "a": [1, 2, 3, 4] }', '$.a[3]', false );
+select json_array_insert( '{ "a": [1, 2, 3, 4] }', '$.a[4]', false );
+select json_array_insert( '{ "a": [1, 2, 3, 4] }', '$.a[5]', false );
+
+# nop
+select json_array_insert( '{ "a": [1, 2, 3, 4] }', '$.b[0]', false );
+select json_array_insert( '{ "a": [1, 2, 3, 4] }', '$.b[1]', false );
+
+# no auto-wrapping
+select json_array_insert( '"a"', '$[0]', true );
+select json_array_insert( '[ "a" ]', '$[0][0]', true );
+select json_array_insert( '"a"', '$[1]', true );
+
+--echo error ER_INVALID_JSON_PATH_WILDCARD
+select json_insert('[]', '$.a.*[1]', 6);
+--echo error ER_INVALID_JSON_PATH_WILDCARD
+select json_insert('[]', '$**[1]', 6);
+--echo error ER_INVALID_JSON_PATH_WILDCARD
+select json_insert('[]', '$[*][1]', 6);
+
+# multiple paths,
+select json_array_insert( '[ 1, 2, 3 ]', '$[1]', true, '$[1]', false );
+select json_array_insert( '[ 1, 2, 3 ]', '$[1]',
+ cast( '[ "a", "b", "c", "d" ]' as json ), '$[1][2]', false );
+
+# test an error while evaluating the document expression
+--echo error ER_INVALID_JSON_TEXT_IN_PARAM
+SELECT JSON_ARRAY_INSERT(JSON_EXTRACT('[1', '$'), '$[0]', 1);
+
+# error in reading new value
+--echo error ER_INVALID_JSON_TEXT_IN_PARAM
+select json_array_insert( '[ 1, 2, 3 ]', '$[1]', json_extract( '[', '$' ) );
+
+--echo # ----------------------------------------------------------------------
+--echo # Test of JSON_SET function.
+--echo # ----------------------------------------------------------------------
+
+# NULLs
+select json_set(NULL, '$.b', cast(1 as json));
+select json_set('[1,2,3]', NULL, cast(1 as json));
+select json_set('[1,2,3]', '$[3]', NULL);
+
+# wrong # args
+--error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
+select json_set(NULL);
+--error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
+select json_set(NULL, NULL);
+--error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
+select json_set(NULL, NULL, NULL, NULL);
+
+# Detect errors in nested function calls.
+--echo error ER_INVALID_JSON_TEXT_IN_PARAM
+SELECT JSON_SET('{}', '$.name', JSON_EXTRACT('', '$'));
+
+# positive test cases
+
+select json_set('[1,2,3]', '$[2]', 4);
+select json_set('[1,2,3]', '$[3]', 4);
+select json_set('[1,2,3]', '$[10]', 4);
+
+select json_set('{"c":4}', '$.c', 5);
+select json_set('{"c":4}', '$.a', 5);
+
+select json_set('1', '$', 4);
+select json_set('1', '$[0]', 4);
+select json_set('1', '$[1]', 4);
+select json_set('1', '$[10]', '4', '$[11]', 5);
+
+select json_set('[1,2,3]', '$[2][0]', 4);
+select json_set('[1,2,3]', '$[2][2]', 4);
+
+select json_set('{"a": 3}', '$.a[0]', 4);
+select json_set('{"a": 3}', '$.a[1]', 4, '$.a[2]', '5');
+
+# auto-wrap plus ellipsis with nested hits should give: {"a": [{"b": [3, 6]}, 6]}
+--echo error ER_INVALID_JSON_PATH_WILDCARD
+select json_set(cast('{"a": {"b": [3]}}' as json), '$**[1]', 6);
+
+# Examples from the specification: Include when missing functions are
+# available.
+
+# returns { "a" : {}, "b" : [ 1, 2, 3 ] }
+ SELECT JSON_SET('{ "a" : "foo", "b" : [ 1, 2, 3 ] }',
+ '$.a',
+ JSON_OBJECT());
+
+# # returns { "a" : "foo", "b" : [ 1, 2, 3 ], "c" : [ true, false ] }
+# SELECT JSON_SET('{ "a" : "foo", "b" : [ 1, 2, 3 ] }',
+# '$.c',
+# JSON_ARRAY( true, false ));
+
+# # returns { "a" : "foo", "b" : [ 1, 2, 3 ], "c" : [ true, false ] }
+# SELECT JSON_SET('{ "a" : "foo", "b" : [ 1, 2, 3 ] }',
+# '$.c',
+# JSON_ARRAY( CAST( 'true' AS JSON ), CAST( 'false' AS JSON ) ));
+
+# # returns [ 1, null, null, 2 ]
+# SELECT JSON_SET('1', '$[3]', 2);
+
+# should return { "a": { "b": false, "c": true } }
+SELECT JSON_SET('{ "a" : "foo"}', '$.a',
+ JSON_OBJECT( 'b', false ), '$.a.c', true);
+
+# returns { "a" : {}, "b" : [ 1, 2, 3 ] }
+select json_set('{ "a" : "foo", "b" : [ 1, 2, 3 ] }',
+ '$.a',
+ cast('{}' as json));
+
+# returns { "a" : "foo", "b" : [ 1, 2, 3 ], "c" : [ true, false ] }
+select json_set('{ "a" : "foo", "b" : [ 1, 2, 3 ] }',
+ '$.c',
+ cast('[true, false]' as json));
+
+# returns [ 1, null, null, 2 ]
+select json_set('1', '$[3]', 2);
+
+# should return { "a": { "b": false, "c": true } }
+select json_set('{ "a" : "foo"}', '$.a',
+ cast('{"b": false}' as json), '$.a.c', true);
+
+# examples from wl7909 spec
+# returns {"a": {}, "b": [1, 2, 3]}
+SELECT JSON_SET
+(
+ '{ "a" : "foo", "b" : [ 1, 2, 3 ] }',
+ '$.a',
+ JSON_OBJECT()
+);
+
+# returns {"a": "foo", "b": [1, 2, 3], "c": [true, false]}
+SELECT JSON_SET
+(
+ '{ "a" : "foo", "b" : [ 1, 2, 3 ] }',
+ '$.c',
+ JSON_ARRAY( true, false )
+);
+
+# returns {"a": "foo", "b": [1, 2, 3], "c": [true, false]}
+SELECT JSON_SET
+(
+ '{ "a" : "foo", "b" : [ 1, 2, 3 ] }',
+ '$.c',
+ JSON_ARRAY( CAST( 'true' AS JSON ), CAST( 'false' AS JSON ) )
+);
+
+# returns [1, 2]
+SELECT JSON_SET
+(
+ '1',
+ '$[3]',
+ 2
+);
+
+# returns {"a": {"b": false, "c": true}}
+SELECT JSON_SET
+(
+ '{ "a" : "foo"}',
+ '$.a', JSON_OBJECT( 'b', false ),
+ '$.a.c', true
+);
+
+--echo # ----------------------------------------------------------------------
+--echo # Test of JSON_REPLACE function.
+--echo # ----------------------------------------------------------------------
+
+# NULLs
+select json_replace(NULL, '$.b', cast(1 as json));
+select json_replace('[1,2,3]', NULL, cast(1 as json));
+select json_replace('[1,2,3]', '$[2]', NULL);
+
+# wrong # args
+--error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
+select json_replace(NULL);
+--error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
+select json_replace(NULL, NULL);
+--error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
+select json_replace(NULL, NULL, NULL, NULL);
+
+# positive test cases
+
+select json_replace('[1,2,3]', '$[2]', 4);
+select json_replace('[1,2,3]', '$[3]', 4);
+select json_replace('[1,2,3]', '$[10]', 4);
+
+select json_replace('{"c":4}', '$.c', 5);
+select json_replace('{"c":4}', '$.a', 5);
+
+select json_replace('1', '$', 4);
+select json_replace('1', '$[0]', 4);
+select json_replace('1', '$[1]', 4);
+select json_replace('1', '$[10]', '4', '$[11]', 5);
+
+select json_replace('[1,2,3]', '$[2][0]', 4);
+select json_replace('[1,2,3]', '$[2][2]', 4);
+
+select json_replace('{"a": 3}', '$.a[0]', 4);
+select json_replace('{"a": 3}', '$.a[1]', 4, '$.a[2]', '5');
+
+
+# Examples from the specification
+
+# returns the original document because the path doesn't exist
+SELECT JSON_REPLACE('{ "a" : "foo", "b" : [ 1, 2, 3 ] }',
+ '$.c',
+ true);
+
+# returns '{ "a" : true, "b" : [ 1, 2, 3 ] }'
+SELECT JSON_REPLACE('{ "a" : "foo", "b" : [ 1, 2, 3 ] }',
+ '$.a[0]',
+ true);
+
+# returns the original document because the path doesn't exist
+SELECT JSON_REPLACE('{ "a" : "foo", "b" : [ 1, 2, 3 ] }',
+ '$.b[5]',
+ true);
+
+--echo # ----------------------------------------------------------------------
+--echo # Test of JSON_ARRAY function.
+--echo # ----------------------------------------------------------------------
+
+# NULLs
+select json_array(NULL, '$.b', cast(1 as json));
+select json_array('[1,2,3]', NULL, cast(1 as json));
+select json_array('[1,2,3]', '$[3]', NULL);
+
+
+# positive test cases
+select json_array();
+select json_array(3.14);
+select json_array('[1,2,3]');
+select json_array(cast('[1,2,3]' as json));
+select json_array(1,2,3);
+select json_array(b'0', b'1', b'10');
+
+# returns the empty array: []
+SELECT JSON_ARRAY();
+
+--echo # ----------------------------------------------------------------------
+--echo # Test of JSON_OBJECT function.
+--echo # ----------------------------------------------------------------------
+
+# odd number of args
+--error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
+select json_object( 'a' );
+--error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
+select json_object( 'a', 1, 'b' );
+
+# null arg
+--echo error ER_JSON_DOCUMENT_NULL_KEY
+select json_object( null, 1 );
+
+# positive tests
+select json_object();
+select json_object( 'a', null );
+select json_object( 'a', 1 );
+select json_object( 'a', 1, 'b', 'foo' );
+select json_object( 'a', 1, 'b', 'foo', 'c', cast( '{ "d": "wibble" }' as json ) );
+select json_object( 'a', true, 'b', false, 'c', cast( 'null' as json) );
+select json_valid( json_object( '"a"', 1 ) );
+
+# long key
+select json_object( REPEAT('a', 64 * 1024), 1 );
+
+# non-string keyNames are cast to CHAR
+select json_object(json_array(), json_array());
+select json_object( cast(json_array() as char), json_array());
+
+select json_object( 1, json_array());
+select json_object( cast(1 as char), json_array());
+
+# returns the empty object: {}
+SELECT JSON_OBJECT();
+
+--echo # ----------------------------------------------------------------------
+--echo # Test of JSON_SEARCH function.
+--echo # ----------------------------------------------------------------------
+
+# wrong number of args
+--error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
+select json_search();
+--error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
+select json_search( '{ "a": true }' );
+--error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
+select json_search( '{ "a": true }', 'one' );
+
+# null args
+select json_search( null, 'one', 'foo' );
+select json_search( '{ "a": "foo" }', null, 'foo' );
+# FIXME. what should happen here?
+#select json_search( '{ "a": "foo" }', 'one', null );
+select json_search( '{ "a": "foo" }', 'one', 'foo', null, null );
+select json_search( '{ "a": "foo" }', 'one', 'foo', null, '$.a', null );
+
+# bad values for the oneOrAll arg
+--echo error ER_JSON_BAD_ONE_OR_ALL_ARG
+select json_search( '{ "a": "foo" }', 'twof', 'foo' );
+--echo error ER_JSON_BAD_ONE_OR_ALL_ARG
+select json_search( '{ "a": "foo" }', 'two', 'foo' );
+
+# bad escape arg
+--error ER_WRONG_ARGUMENTS
+select json_search( '{ "a": "foo" }', 'one', 'foo', 'ab' );
+
+# bad path args
+--echo error ER_INVALID_JSON_PATH
+select json_search( '{ "a": "foo" }', 'one', 'foo', null, '$a' );
+--echo error ER_INVALID_JSON_PATH
+select json_search( '{ "a": "foo" }', 'all', 'foo', null, '$.a', '$b' );
+
+--error ER_BAD_FIELD_ERROR
+select json_search(a, b, c);
+
+# simple tests for search without path arguments
+select json_search( '{ "a": "foobar" }', 'one', 'foo%' );
+select json_search( '{ "a": "foobar", "b": "focus", "c": [ "arm", "foot", "shoulder" ] }', 'one', 'foo%' );
+select json_search( '{ "a": "foobar", "b": "focus", "c": [ "arm", "foot", "shoulder" ] }', 'all', 'foo%' );
+select json_search( '{ "a": "foobar", "b": "focus", "c": [ "arm", "foot", "shoulder" ] }', 'all', 'f__us' );
+
+select json_search( '{ "a": [ "foolish", "folly", "foolhardy" ], "b" : "fool" }', 'all', 'foo%', null, '$.a' );
+select json_search( '{ "a": [ "foolish", "folly", "foolhardy" ], "b" : "fool" }', 'all', 'foo%', null, '$.a', '$.b' );
+select json_search( '{ "a": [ "foolish", "folly", "foolhardy" ], "b" : "fool" }', 'one', 'foo%', null, '$.a', '$.b' );
+
+select json_search( '{ "a": [ "foolish", "folly", "foolhardy" ], "b" : "fool" }', 'ALL', 'foo%', null, '$.a' );
+select json_search( '{ "a": [ "foolish", "folly", "foolhardy" ], "b" : "fool" }', 'aLl', 'foo%', null, '$.a', '$.b' );
+select json_search( '{ "a": [ "foolish", "folly", "foolhardy" ], "b" : "fool" }', 'ONE', 'foo%', null, '$.a', '$.b' );
+
+# wildcards in the path expression
+select json_search
+(
+ '[ { "a": { "b": { "c": "fool" } } }, { "b": { "c": "shoulder" } }, { "c": { "c": "food"} } ]',
+ 'all',
+ 'foo%',
+ null,
+ '$**.c'
+);
+
+select json_search
+(
+ '[ { "a": { "b": { "c": "showtime" } } }, { "b": { "c": "shoulder" } }, { "c": { "c": "shoe"} } ]',
+ 'all',
+ 'sho%',
+ null,
+ '$**.c'
+);
+
+select json_search
+(
+ '[ { "a": { "b": { "c": "showtime" } } }, { "b": { "c": "shoulder" } }, { "c": { "c": "shoe"} } ]',
+ 'all',
+ 'sho%e',
+ null,
+ '$**.c'
+);
+
+select json_search
+(
+ '[ { "a": { "b": { "c": "showtime" } } }, { "b": { "c": "shoulder" } }, { "c": { "c": "shoe"} } ]',
+ 'all',
+ 'sho%',
+ null,
+ '$[*].c'
+);
+
+select json_search
+(
+ '[ { "a": { "b": { "c": "showtime" } } }, [ { "b": { "c": "shout" } }, { "c": { "c": "shoe"} } ] ]',
+ 'all',
+ 'sho%',
+ null,
+ '$[1]**.c'
+);
+
+# escape character
+select json_search( '[ "footbar", "foo%bar" ]', 'all', 'foo%bar' );
+select json_search( '[ "footbar", "foo%bar" ]', 'all', 'foo\%bar' );
+select json_search( '[ "footbar", "foo%bar" ]', 'all', 'foo|%bar', '|' );
+select json_search( '[ "footbar", "foo%bar" ]', 'all', 'foo|%bar', '|', '$[0]' );
+select json_search( '[ "footbar", "foo%bar" ]', 'all', 'foo|%bar', '|', '$[0]', '$[1]' );
+select json_search( '[ "footbar", "foo%bar" ]', 'all', 'foo|%bar', '|', '$[0]', '$[1]', '$[2]' );
+
+select json_search( '[ "footbar", "foo%bar" ]', 'all', 'foo\%bar', null );
+select json_search( '[ "footbar", "foo%bar" ]', 'all', 'foo\%bar', null, '$[0]' );
+select json_search( '[ "footbar", "foo%bar" ]', 'all', 'foo\%bar', null, '$[1]' );
+select json_search( '[ "footbar", "foo%bar" ]', 'all', 'foo|%bar', '|', '$[0]' );
+select json_search( '[ "footbar", "foo%bar" ]', 'all', 'foo|%bar', '|', '$[1]' );
+
+# search is case-sensitive
+select json_search( '[ "abc", "ABC" ]', 'all', 'aBc' );
+select json_search( '[ "abc", "ABC" ]', 'all', 'abc' );
+select json_search( '[ "abc", "ABC" ]', 'all', 'ABC' );
+
+# only matches strings, not numerics
+select json_search( '[ 10, "10", 1.0, "1.0" ]', 'all', '1%' );
+
+# examples from the wl7909 spec
+# returns null because numeric values don't match string values
+SELECT JSON_SEARCH
+(
+ '{ "a" : 123, "b" : [ 123, 456 ] }',
+ 'one',
+ '123'
+);
+
+# returns "$.b[2]"
+SELECT JSON_SEARCH
+(
+ '{ "a" : "123", "b" : [ 123, "789", "123", "456", "123" ] }',
+ 'one',
+ '123',
+ null,
+ '$.b'
+);
+
+# could return either "$.a" or "$.b.key"
+SELECT JSON_SEARCH
+(
+ '{ "a" : "123", "b" : { "key" : "123" } }',
+ 'one',
+ '123'
+);
+
+# returns "$.b.key"
+SELECT JSON_SEARCH
+(
+ '{ "a" : "1243", "b" : { "key" : "1234" } }',
+ 'one',
+ '123%'
+);
+
+# returns "$.b.c"
+SELECT JSON_SEARCH
+(
+ '{ "a" : "1243", "b" : { "key" : "1234", "c": "directorysub%directoryabc" } }',
+ 'one',
+ 'dir%torysub@%dir%',
+ '@'
+);
+
+# returns null because the path doesn't exist
+SELECT JSON_SEARCH
+(
+ '{ "a" : "1243", "b" : { "key" : "1234" } }',
+ 'one',
+ '123%',
+ null,
+ '$.c'
+);
+
+# returns $."one potato"
+SELECT JSON_UNQUOTE
+(
+ JSON_SEARCH
+ (
+ '{ "onepotato": "foot", "one potato": "food" , "one \\"potato": "fool" }',
+ 'all',
+ 'food'
+ )
+);
+
+select json_type(case (null is null) when 1 then
+ cast('null' as json) else
+ cast('[1,2,3]' as json) end);
+
+select json_type(case (null is not null) when 1 then
+ cast('null' as json) else
+ cast('[1,2,3]' as json) end);
+
+select json_type( if(null is null,
+ cast('null' as json),
+ cast('[1,2,3]' as json)) );
+
+select json_type( if(null is not null,
+ cast('null' as json),
+ cast('[1,2,3]' as json)));
+
+select cast(json_extract(cast(concat('[', cast('["A",2]' as json), ']') as json),
+ '$[0][1]') as char) = 2;
+
+--echo # ----------------------------------------------------------------------
+--echo # Test of aggregate function MAX, MIN.
+--echo # ----------------------------------------------------------------------
+
+select max(cast('[1,2,3]' as json));
+
+--echo # ----------------------------------------------------------------------
+--echo # Test of JSON_QUOTE, JSON_UNQUOTE
+--echo # ----------------------------------------------------------------------
+
+--error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
+select json_quote();
+--error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
+select json_quote('abc', 'def');
+--error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
+select json_quote(NULL, 'def');
+--error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
+select json_quote('abc', NULL);
+
+--error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
+select json_unquote();
+--error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
+select json_unquote('"abc"', '"def"');
+--error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
+select json_unquote(NULL, 'def');
+--error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
+select json_unquote('"abc"', NULL);
+
+select json_quote(NULL);
+select json_unquote(NULL);
+
+select json_quote('abc');
+select json_quote(convert('abc' using ascii));
+select json_quote(convert('abc' using latin1));
+select json_quote(convert('abc' using utf8));
+select json_quote(convert('abc' using utf8mb4));
+
+select json_unquote('abc'); # should do nothing
+
+select json_unquote('"abc"');
+select json_unquote(convert('"abc"' using ascii));
+select json_unquote(convert('"abc"' using latin1));
+select json_unquote(convert('"abc"' using utf8));
+select json_unquote(convert('"abc"' using utf8mb4));
+
+select json_quote('"');
+select json_unquote('"'); # should do nothing
+
+--echo error ER_INCORRECT_TYPE
+select json_quote(123); # integer not allowed
+--echo error ER_INCORRECT_TYPE
+select json_unquote(123); # integer not allowed
+
+select json_unquote('""'); # empty string
+select char_length(json_unquote('""')); # verify empty string
+select json_unquote('"" '); # unchanged: no final "
+select json_unquote(cast(json_quote('abc') as json)); # round trip
+
+# No change in this JSON string: it is an object
+select cast('{"abc": "foo"}' as json);
+select json_unquote(cast('{"abc": "foo"}' as json));
+
+# This is a JSON string, so it is actually unquoted
+select json_extract(cast('{"abc": "foo"}' as json), '$.abc');
+select json_unquote(json_extract(cast('{"abc": "foo"}' as json), '$.abc'));
+
+# Bug fix: thse should be the same
+select json_unquote('["a", "b", "c"]');
+select json_unquote(cast('["a", "b", "c"]' as json));
+
+select charset(json_unquote('"abc"'));
+
+select json_quote(convert(X'e68891' using utf8)); # chinese "I" (wo3)
+select json_quote(convert(X'e68891' using utf8mb4)); # chinese "I" (wo3)
+
+select cast(json_quote(convert(X'e68891' using utf8)) as json);
+
+select json_unquote(convert(X'e68891' using utf8)); # chinese "I" (wo3)
+
+select json_quote(json_quote(json_quote('abc'))); # deep quote
+select json_unquote(json_unquote(json_unquote( # long round trip of it
+ json_quote(json_quote(json_quote('abc'))))));
+
+# DATE/TIME will lose their quotes, too:
+select cast(cast('2015-01-15 23:24:25' as datetime) as json);
+select json_unquote(cast(cast('2015-01-15 23:24:25' as datetime) as json));
+
+# as well as opaque values:
+select cast(st_geomfromtext('point(1 1)') as json);
+select json_unquote(cast(st_geomfromtext('point(1 1)') as json));
+
+# examples from the wl7909 spec
+# returns the SQL string literal abc
+SELECT JSON_UNQUOTE( '"abc"' );
+
+# returns the SQL string literal "abc
+SELECT JSON_UNQUOTE( '"abc' );
+
+--echo error ER_INCORRECT_TYPE
+SELECT JSON_UNQUOTE( 123 );
+
+# returns the SQL string literal abc
+SELECT JSON_UNQUOTE
+( CAST( CAST( '"abc"' AS JSON ) AS CHAR ) );
+
+# returns 1
+SELECT JSON_UNQUOTE
+(
+ CAST(
+ JSON_EXTRACT( '{ "userName" : "fred" }', '$.userName' )
+ AS CHAR
+ )
+) = 'fred';
+
+# returns 0
+SELECT
+ CAST(
+ JSON_EXTRACT( '{ "userName" : "fred" }', '$.userName' )
+ AS CHAR
+ ) = 'fred';
+
+# returns "abc"
+SELECT JSON_QUOTE( 'abc' );
+
+--echo error ER_INCORRECT_TYPE
+SELECT JSON_QUOTE( 123 );
+
+# returns the JSON document consisting of the string scalar "123"
+SELECT CAST( JSON_QUOTE( '123' ) AS JSON );
+
+--echo # ----------------------------------------------------------------------
+--echo # Test of JSON_CONTAINS
+--echo # ----------------------------------------------------------------------
+
+--echo # should give NULL
+select json_contains(NULL, NULL);
+select json_contains(cast('{"a": 1, "b": 2}' as json), NULL);
+select json_contains(NULL, cast('null' as json));
+select json_contains(cast('[1]' as json), cast('[1]' as json), NULL);
+
+--echo # should give 0:
+select json_contains(cast(3.14 as json), cast(3 as json));
+
+--echo # should give 0: not at top level
+select json_contains(cast('{"a": {"b": 7}}' as json), cast('{"b": 7}' as json));
+
+--echo # but path argument will fix it:
+select json_contains(cast('{"a": {"b": 7}}' as json), cast('{"b": 7}' as json), '$.a');
+
+--echo # but arrays "introspect"
+select json_contains(cast('[1,[2.0, 3.0]]' as json), cast('[2.0]' as json));
+select json_contains(cast('[1, 2, [3, [4, 5]], 6, 7]' as json), cast('5' as json));
+
+--echo # should give 0: just a key
+select json_contains(cast('{"a": 1, "b": 2}' as json), cast('"a"' as json));
+
+--echo # should give 0: one candidate element doesn't match
+select json_contains(cast('[1]' as json), cast('[1,2]' as json));
+
+--echo # should all give 1
+select json_contains(cast('null' as json), cast('null' as json));
+--echo # simple object subset
+select json_contains(cast('{"a": 1, "b": 2}' as json), cast( '{"a": 1}' as json));
+--echo # simple vector subset
+select json_contains(cast('[1, 2, 3]' as json), cast('[1, 3]' as json));
+--echo # auto-wrap, should give 1
+select json_contains(cast('[1, 2, 3]' as json), cast(3 as json));
+--echo # ok even with nested cast off elements
+select json_contains(cast('{"person": {"id": 1, "country": "norway"}}' as json),
+ cast('{"person": {"country": "norway"}}' as json));
+--echo # vector reordering and duplicates is ok
+select json_contains(cast('[1,3,5]' as json), cast('[5,3,1,5]' as json));
+--echo # ok even with more elts in candidate than in doc
+select json_contains(cast('[{"b": 4, "a":7}]' as json), cast('[{"a":7},{"b":4}]' as json));
+select json_contains(cast('[{"b": 4, "a":7}, 5]' as json), cast('[5, {"a":7, "b":4}]' as json));
+--echo # ok even with mixed number types that compare equal
+select json_contains(cast('[{"b": 4, "a":7}, 5.0]' as json), cast('[5, {"a":7.0E0, "b":4}]' as json));
+
+# Bug discovered by Rick: used to give 1 (true).
+select json_contains( '{"customer": "cust3"}', '{"customer": "cust1"}' );
+
+SELECT JSON_CONTAINS('[null,1,[2,3],true,false]', '[null,1,[3],false]');
+SELECT JSON_CONTAINS('[null,1,[2,3],true,false]', '[null,1,[4],false]');
+SELECT JSON_CONTAINS('[true,false]', '[[true]]');
+SELECT JSON_CONTAINS('[1,2]', '[[1]]');
+SELECT JSON_CONTAINS('[1,2]', '1', '$.abc');
+SELECT JSON_CONTAINS('{}', '{}');
+SELECT JSON_CONTAINS('{}', '{"a":1}');
+SELECT JSON_CONTAINS('{"a":1}', '{"a":1,"b":2}');
+
+# examples from the wl7909 spec
+# returns 1
+SELECT JSON_CONTAINS
+(
+ CAST('[1, 4, 6]' AS JSON),
+ CAST('[1, 6]' AS JSON)
+);
+
+# returns 1; even with nested cast off elements
+SELECT JSON_CONTAINS
+(
+ CAST('{"person": {"id": 1, "country": "norway"}}' AS JSON),
+ CAST('{"person": {"country": "norway"}}' AS JSON)
+);
+
+# returns 1; reordering and duplicates are ok
+SELECT JSON_CONTAINS
+(
+ CAST('[1,3,5]' AS JSON),
+ CAST('[5,3,1,5]' AS JSON)
+);
+
+# return 0; no type conversion is performed
+SELECT JSON_CONTAINS
+(
+ CAST('[3.14]' AS JSON),
+ CAST('[3]' AS JSON)
+);
+
+# returns 1, due to auto-wrapping
+SELECT JSON_CONTAINS
+(
+ CAST('[1, 2, 3]' AS JSON),
+ CAST(3 AS JSON)
+);
+
+--error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
+SELECT JSON_CONTAINS();
+--error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
+SELECT JSON_CONTAINS('[1]');
+--error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
+SELECT JSON_CONTAINS('[1]', '[1]', '$', '$[0]');
+
+--echo # ----------------------------------------------------------------------
+--echo # Wrong collation from JSON_QUOTE caused problems: Set it in
+--echo # Item_func_json_quote::fix_length_and_dec. Bug found by Knut.
+--echo # Similar issue for JSON_UNQUOTE and JSON_TYPE.
+--echo # ----------------------------------------------------------------------
+select json_object("a", ifnull(json_quote('test'), cast('null' as json)));
+select cast(concat('[', json_quote('ab'), ']') as json);
+select cast(concat('[', json_unquote('"12"'), ']') as json);
+select cast(concat('["', json_type(cast(1 as json)), '"]') as json);
+
+--echo #
+--echo # Bug#20912438: ITEM_TYPE_HOLDER::DISPLAY_LENGTH(ITEM*): ASSERTION `0' FAILED
+--echo #
+(SELECT JSON_KEYS('{ "key80": "2015-04-20 11:53:55"}')) UNION ALL
+(SELECT JSON_KEYS('{ "key80": "2015-04-20 11:53:55" }') LIMIT 0);
+SELECT CAST(1 AS JSON) UNION ALL SELECT CAST(1 AS JSON);
+
+# Exercise NULL handling and error handling in Item_copy_json::copy().
+SELECT COUNT(*), CAST(NULL AS JSON);
+--echo error ER_INVALID_JSON_TEXT_IN_PARAM
+SELECT COUNT(*), JSON_EXTRACT('not valid json!', '$');
+
+--echo # ----------------------------------------------------------------------
+--echo # Bug report from John E.
+--echo # Crash in Item_copy_json::~Item_copy_json
+--echo # ----------------------------------------------------------------------
+EXPLAIN SELECT COUNT(*), JSON_KEYS('{}');
+
+select json_search( '{ "a": "foo" }', 'one', 'foo', 'a' );
+select json_search( '{ "a": "foo" }', 'one', 'foo', null );
+select json_search( '{ "a": "foo" }', 'one', 'foo', convert(x'f8' using latin1) );
+
+# bad escape arg
+--error ER_WRONG_ARGUMENTS
+select json_search( '{ "a": "foo" }', 'one', 'foo', 'ab' );
+
+--echo # ----------------------------------------------------------------------
+--echo # Wrong results when Json_path_cache primed is accessed
+--echo # during the prepare-phase.
+--echo #----------------------------------------------------------------------
+
+select json_remove( '[ 1, { "a": true, "b": false, "c": null }, 5 ]', null ) is null;
+
+prepare stmt1 from 'select json_remove( ''[ 1, { "a": true, "b": false, "c": null }, 5 ]'', null ) is null';
+execute stmt1;
+
+--echo error ER_INVALID_JSON_PATH
+select json_remove( '[ 1, { "a": true, "b": false, "c": null }, 5 ]', '$.' ) is null;
+
+--echo error ER_INVALID_JSON_PATH
+prepare stmt1 from 'select json_remove( ''[ 1, { "a": true, "b": false, "c": null }, 5 ]'', ''$.'' ) is null';
+
+--echo # ----------------------------------------------------------------------
+--echo # Bug#20987329 VALUE OF PREPARED STATEMENT PLACEHOLDER FOR PARAMETER
+--echo # IN JSON_EXTRACT IS STICKY
+--echo #----------------------------------------------------------------------
+
+# should get different results with different parameter values
+
+# json_extract()
+
+# json_contains()
+
+prepare json_stmt1 FROM 'select json_contains( ''{ "keyA": [1, 2, 3], "keyB": [4, 5, 6] }'', ''[2]'', ? )';
+set @mypath = '$.keyA';
+execute json_stmt1 USING @mypath;
+set @mypath = '$.keyB';
+execute json_stmt1 USING @mypath;
+
+# json_contains_path()
+
+prepare json_stmt2 FROM 'select json_contains_path( ''{ "keyA": [1, 2, 3] }'', ''all'', ? )';
+set @mypath = '$.keyA';
+execute json_stmt2 USING @mypath;
+set @mypath = '$.keyB';
+execute json_stmt2 USING @mypath;
+
+# json_length()
+
+prepare json_stmt3 FROM 'select json_length( ''{ "keyA": [1, 2, 3], "keyB": [1, 2, 3, 4] }'', ? )';
+set @mypath = '$.keyA';
+execute json_stmt3 USING @mypath;
+set @mypath = '$.keyB';
+execute json_stmt3 USING @mypath;
+
+# json_keys()
+
+prepare json_stmt4 FROM 'select json_keys( ''[ { "keyA": true }, { "keyB": false } ]'', ? )';
+set @mypath = '$[0]';
+execute json_stmt4 USING @mypath;
+set @mypath = '$[1]';
+execute json_stmt4 USING @mypath;
+
+# json_array_append()
+
+prepare json_stmt5 FROM 'select json_array_append( ''{ "keyA": [1, 2], "keyB": [3, 4] }'', ?, 5 )';
+set @mypath = '$.keyA';
+execute json_stmt5 USING @mypath;
+set @mypath = '$.keyB';
+execute json_stmt5 USING @mypath;
+
+# json_insert()
+
+prepare json_stmt6 FROM 'select json_insert( ''{ "keyA": [1, 2], "keyB": [3, 4] }'', ?, 5 )';
+set @mypath = '$.keyA[2]';
+execute json_stmt6 USING @mypath;
+set @mypath = '$.keyB[2]';
+execute json_stmt6 USING @mypath;
+
+# json_set()
+
+prepare json_stmt7 FROM 'select json_set( ''{ "keyA": [1, 2], "keyB": [3, 4] }'', ?, 5 )';
+set @mypath = '$.keyA[2]';
+execute json_stmt7 USING @mypath;
+set @mypath = '$.keyB[2]';
+execute json_stmt7 USING @mypath;
+
+# json_replace()
+
+prepare json_stmt8 FROM 'select json_replace( ''{ "keyA": [1, 2], "keyB": [3, 4] }'', ?, 5 )';
+set @mypath = '$.keyA[1]';
+execute json_stmt8 USING @mypath;
+set @mypath = '$.keyB[1]';
+execute json_stmt8 USING @mypath;
+
+# json_search()
+
+prepare json_stmt9 FROM 'select json_search( ''{ "keyA": [ "foot" ], "keyB": [ "food" ] }'', ''all'', ''foo%'', null, ? )';
+set @mypath = '$.keyA';
+execute json_stmt9 USING @mypath;
+set @mypath = '$.keyB';
+execute json_stmt9 USING @mypath;
+
+# json_remove()
+
+prepare json_stmt10 FROM 'select json_remove( ''{ "keyA": [ "foot" ], "keyB": [ "food" ] }'', ? )';
+set @mypath = '$.keyA';
+execute json_stmt10 USING @mypath;
+set @mypath = '$.keyB';
+execute json_stmt10 USING @mypath;
+
+# similar caching problem for the oneOrAll args
+
+prepare json_stmt11 FROM 'select json_contains_path( ''{ "keyA": true }'', ?, ''$.keyA'', ''$.keyB'' )';
+set @mypath = 'one';
+execute json_stmt11 USING @mypath;
+set @mypath = 'all';
+execute json_stmt11 USING @mypath;
+
+prepare json_stmt12 FROM 'select json_search( ''{ "keyA": [ "foot" ], "keyB": [ "food" ] }'', ?, ''foo%'' )';
+set @mypath = 'one';
+execute json_stmt12 USING @mypath;
+set @mypath = 'all';
+execute json_stmt12 USING @mypath;
+
+--echo #
+--echo # Bug#21128632 JSON_QUOTE(JSON_TYPE(...)) GIVES ERROR 3139 ER_INVALID_JSON_CHARSET
+--echo #
+
+select json_quote( json_type( json_object() ) );
+select json_quote( json_type( cast('{}' as json) ) );
+
+--echo #
+--echo # Bug#21148020 OUTPUT FROM JSON_TYPE() IS TRUNCATED
+--echo # WHEN EXECUTED IN A VIEW OR JOIN
+--echo #
+
+SELECT JSON_TYPE(JSON_OBJECT());
+CREATE VIEW v1 AS SELECT JSON_TYPE(JSON_OBJECT());
+SELECT * FROM v1;
+drop view v1;
+
+# SELECT JSON_TYPE(CAST(CAST('2015-05-25 11:23:55' AS DATETIME) AS JSON));
+# CREATE VIEW v2 AS SELECT JSON_TYPE(CAST(CAST('2015-05-25 11:23:55' AS
+# DATETIME) AS JSON));
+# SELECT * FROM v2;
+# drop view v2;
+
+--echo #
+--echo # Bug#21198333 SIG 6 IN ITEM_CACHE_JSON::CACHE_VALUE AT SQL/ITEM.CC:9470
+--echo #
+--echo error ER_INVALID_JSON_TEXT_IN_PARAM
+SELECT MIN(JSON_EXTRACT('not json', '$'));
+
+--echo #
+--echo # Bug#21200657 DATA FROM DERIVED TABLE BASED
+--echo # ON JSN_QUOTE()/JSN_UNQUOTE() CALL IS TRUNCATED
+--echo #
+SELECT JSON_QUOTE('This is a string that should not be truncated') AS field1;
+SELECT JSON_UNQUOTE(JSON_QUOTE('This is a string that should not be truncated')) AS field1;
+
+SELECT * FROM (SELECT JSON_QUOTE('This is a string that should not be truncated') AS field1) AS DERIVED_TABLE;
+SELECT * FROM (SELECT JSON_UNQUOTE("This is a string that should not be truncated") AS field1) AS DERIVED_TABLE;
+SELECT * FROM (SELECT JSON_UNQUOTE(JSON_QUOTE('This is a string that should not be truncated')) AS field1) AS DERIVED_TABLE;
+
+--echo #
+--echo # Bug#21296173 JSON_OBJECT('KEY', BOOLEAN_LITERAL) USES VALUES 0, 1
+--echo # FOR BOOL WHEN USED VIA VIEW
+--echo #
+
+SELECT JSON_OBJECT('key1', false, 'key2', true);
+SELECT JSON_ARRAY('key1', false, 'key2', true);
+CREATE VIEW v1 AS SELECT JSON_OBJECT('key1', false, 'key2', true);
+SELECT * FROM v1;
+CREATE VIEW v2 AS SELECT JSON_ARRAY('key1', false, 'key2', true);
+SELECT * FROM v2;
+
+drop view v1;
+drop view v2;
+
+--echo #
+--echo # Bug#21293089 JSON_CONTAINS() RETURNS WRONG RESULT WITH EMPTY JSON ARRAY
+--echo #
+SELECT JSON_CONTAINS('[]', '{"a" : 1}');
+SELECT JSON_CONTAINS('[]', '[1, 2, 3, 4, 5]');
+SELECT JSON_CONTAINS('[]', '[1, 2, 3, 4, {"a" : 1}]');
+SELECT JSON_CONTAINS('[]', '{"a" : [1, 2, 3, 4, 5]}');
+SELECT JSON_CONTAINS('[]', '[]');
+
+--echo #
+--echo # Bug#21377136 STACK OVERFLOW IN RAPIDJSON::GENERICREADER
+--echo #
+--echo error ER_JSON_DOCUMENT_TOO_DEEP
+SELECT JSON_VALID(REPEAT('[', 100000));
+--echo error ER_JSON_DOCUMENT_TOO_DEEP
+SELECT JSON_VALID(REPEAT('{"a":', 100000));
+--echo error ER_JSON_DOCUMENT_TOO_DEEP
+SELECT JSON_VALID(REPEAT('{"a":[', 100000));
+--echo error ER_JSON_DOCUMENT_TOO_DEEP
+SELECT JSON_VALID(REPEAT('[{"a":', 100000));
+
+--echo #
+--echo # Bug#21381806 JSON: ASSERTION FAILED: ARG->NULL_VALUE
+--echo #
+SELECT JSON_SET(CASE WHEN 1 THEN NULL ELSE NULL END, '{}', '{}');
+SELECT JSON_VALID(CASE WHEN 1 THEN NULL ELSE NULL END);
+SELECT JSON_ARRAY(CASE WHEN 1 THEN NULL ELSE NULL END);
+
+--echo #
+--echo # Bug#21384048 ASSERTION FAILED: N >= 0 && N <= 308
+--echo # IN RAPIDJSON::INTERNAL::FASTPATH
+--echo #
+SELECT JSON_EXTRACT('-1E-36181012216111515851075235238', '$');
+SELECT JSON_EXTRACT('1E-36181012216111515851075235238', '$');
+SELECT JSON_EXTRACT('1E-325', '$');
+SELECT JSON_EXTRACT('1E-324', '$');
+SELECT JSON_EXTRACT('1E-323', '$');
+SELECT JSON_EXTRACT('1E+308', '$');
+--echo error ER_INVALID_JSON_TEXT_IN_PARAM
+SELECT JSON_EXTRACT('1E+309', '$');
+--echo error ER_INVALID_JSON_TEXT_IN_PARAM
+SELECT JSON_EXTRACT('1E+36181012216111515851075235238', '$');
+--echo error ER_INVALID_JSON_TEXT_IN_PARAM
+SELECT JSON_EXTRACT('-1E+36181012216111515851075235238', '$');
+
+--echo #
+--echo # Bug#21383284: ASSERTION IN SELECT_LEX::SETUP_CONDS
+--echo #
+--error ER_WRONG_ARGUMENTS
+SELECT 1 FROM dual WHERE JSON_SEARCH('{}', 'one', 'foo', 'too-long-escape');
+--echo error ER_INVALID_JSON_TEXT_IN_PARAM
+SELECT 1 FROM dual WHERE JSON_SEARCH('{}', 'one', 'foo', JSON_EXTRACT('', '$'));
+
+--echo #
+--echo # Bug#21442624 INCORRECT RESULT FROM JSON_SET WITH AUTO-WRAPPING
+--echo #
+
+SELECT JSON_SET('1', '$', 100);
+SELECT JSON_SET('1', '$[0]', 100);
+SELECT JSON_SET('1', '$[0][0]', 100);
+SELECT JSON_SET('1', '$[0][0][0]', 100);
+
+SELECT JSON_SET('[]', '$', 100);
+SELECT JSON_SET('[]', '$[0]', 100);
+SELECT JSON_SET('[]', '$[0][0]', 100);
+SELECT JSON_SET('[]', '$[0][0][0]', 100);
+
+SELECT JSON_SET('[1]', '$', 100);
+SELECT JSON_SET('[1]', '$[0]', 100);
+SELECT JSON_SET('[1]', '$[0][0]', 100);
+SELECT JSON_SET('[1]', '$[0][0][0]', 100);
+
+SELECT JSON_SET('[[1]]', '$', 100);
+SELECT JSON_SET('[[1]]', '$[0]', 100);
+SELECT JSON_SET('[[1]]', '$[0][0]', 100);
+SELECT JSON_SET('[[1]]', '$[0][0][0]', 100);
+
+SELECT JSON_SET('[[[1]]]', '$', 100);
+SELECT JSON_SET('[[[1]]]', '$[0]', 100);
+SELECT JSON_SET('[[[1]]]', '$[0][0]', 100);
+SELECT JSON_SET('[[[1]]]', '$[0][0][0]', 100);
+
+SELECT JSON_REPLACE('1', '$', 100);
+SELECT JSON_REPLACE('1', '$[0]', 100);
+SELECT JSON_REPLACE('1', '$[0][0]', 100);
+SELECT JSON_REPLACE('1', '$[0][0][0]', 100);
+
+SELECT JSON_REPLACE('[]', '$', 100);
+SELECT JSON_REPLACE('[]', '$[0]', 100);
+SELECT JSON_REPLACE('[]', '$[0][0]', 100);
+SELECT JSON_REPLACE('[]', '$[0][0][0]', 100);
+
+SELECT JSON_REPLACE('[1]', '$', 100);
+SELECT JSON_REPLACE('[1]', '$[0]', 100);
+SELECT JSON_REPLACE('[1]', '$[0][0]', 100);
+SELECT JSON_REPLACE('[1]', '$[0][0][0]', 100);
+
+SELECT JSON_REPLACE('[[1]]', '$', 100);
+SELECT JSON_REPLACE('[[1]]', '$[0]', 100);
+SELECT JSON_REPLACE('[[1]]', '$[0][0]', 100);
+SELECT JSON_REPLACE('[[1]]', '$[0][0][0]', 100);
+
+SELECT JSON_REPLACE('[[[1]]]', '$', 100);
+SELECT JSON_REPLACE('[[[1]]]', '$[0]', 100);
+SELECT JSON_REPLACE('[[[1]]]', '$[0][0]', 100);
+SELECT JSON_REPLACE('[[[1]]]', '$[0][0][0]', 100);
+
+
+--echo #
+--echo # Bug#21828321: JSON FUNCS CALL DBUG_ABORT OR EXIT() ON WINDOWS!
+--echo #
+# LEAST and GREATEST treat JSON arguments as strings for now. They used to hit
+# an assertion if used in a JSON context and all arguments were JSON values, or
+# a mix of NULLs and JSON values.
+SELECT JSON_ARRAY(LEAST(NULL, NULL), GREATEST(NULL, NULL), LEAST(j1, NULL),
+ GREATEST(NULL, j2), LEAST(j1, j2), GREATEST(j1, j2)) AS j
+FROM (SELECT CAST('1' AS JSON) AS j1, CAST('2' AS JSON) AS j2) t;
+
diff --git a/mysql-test/suite/parts/r/partition_repair_myisam.result b/mysql-test/suite/parts/r/partition_repair_myisam.result
index 3652698f634..6e99f1d3632 100644
--- a/mysql-test/suite/parts/r/partition_repair_myisam.result
+++ b/mysql-test/suite/parts/r/partition_repair_myisam.result
@@ -270,8 +270,8 @@ PARTITIONS 7;
SELECT COUNT(*) FROM t1_will_crash;
COUNT(*)
33
-SELECT (b % 7) AS `partition`, COUNT(*) AS rows FROM t1_will_crash GROUP BY (b % 7);
-partition rows
+SELECT (b % 7) AS `partition`, COUNT(*) AS rows_cnt FROM t1_will_crash GROUP BY (b % 7);
+partition rows_cnt
0 2
1 5
2 5
@@ -343,8 +343,8 @@ test.t1_will_crash repair status OK
SELECT COUNT(*) FROM t1_will_crash;
COUNT(*)
29
-SELECT (b % 7) AS `partition`, COUNT(*) AS rows FROM t1_will_crash GROUP BY (b % 7);
-partition rows
+SELECT (b % 7) AS `partition`, COUNT(*) AS rows_cnt FROM t1_will_crash GROUP BY (b % 7);
+partition rows_cnt
1 4
2 5
3 5
@@ -483,8 +483,8 @@ test.t1_will_crash repair status OK
SELECT COUNT(*) FROM t1_will_crash;
COUNT(*)
29
-SELECT (b % 7) AS `partition`, COUNT(*) AS rows FROM t1_will_crash GROUP BY (b % 7);
-partition rows
+SELECT (b % 7) AS `partition`, COUNT(*) AS rows_cnt FROM t1_will_crash GROUP BY (b % 7);
+partition rows_cnt
1 4
2 4
3 5
diff --git a/mysql-test/suite/parts/t/partition_repair_myisam.test b/mysql-test/suite/parts/t/partition_repair_myisam.test
index f7c503a8544..a21493ca03d 100644
--- a/mysql-test/suite/parts/t/partition_repair_myisam.test
+++ b/mysql-test/suite/parts/t/partition_repair_myisam.test
@@ -190,7 +190,7 @@ eval INSERT INTO t1_will_crash VALUES
('6 row 7 (crash before completely written to datafile)', 27, '$lt$lt');
--enable_query_log
SELECT COUNT(*) FROM t1_will_crash;
-SELECT (b % 7) AS `partition`, COUNT(*) AS rows FROM t1_will_crash GROUP BY (b % 7);
+SELECT (b % 7) AS `partition`, COUNT(*) AS rows_cnt FROM t1_will_crash GROUP BY (b % 7);
SELECT (b % 7) AS `partition`, b, a, length(c) FROM t1_will_crash ORDER BY `partition`, b, a;
FLUSH TABLES;
# testing p0, p1, p3, p6(1)
@@ -216,7 +216,7 @@ OPTIMIZE TABLE t1_will_crash;
CHECK TABLE t1_will_crash;
REPAIR TABLE t1_will_crash;
SELECT COUNT(*) FROM t1_will_crash;
-SELECT (b % 7) AS `partition`, COUNT(*) AS rows FROM t1_will_crash GROUP BY (b % 7);
+SELECT (b % 7) AS `partition`, COUNT(*) AS rows_cnt FROM t1_will_crash GROUP BY (b % 7);
SELECT (b % 7) AS `partition`, b, a, length(c) FROM t1_will_crash ORDER BY `partition`, b, a;
FLUSH TABLES;
@@ -282,7 +282,7 @@ SET @@optimizer_switch=@save_optimizer_switch;
ALTER TABLE t1_will_crash CHECK PARTITION p6;
ALTER TABLE t1_will_crash REPAIR PARTITION p6;
SELECT COUNT(*) FROM t1_will_crash;
-SELECT (b % 7) AS `partition`, COUNT(*) AS rows FROM t1_will_crash GROUP BY (b % 7);
+SELECT (b % 7) AS `partition`, COUNT(*) AS rows_cnt FROM t1_will_crash GROUP BY (b % 7);
SELECT (b % 7) AS `partition`, b, a, length(c) FROM t1_will_crash ORDER BY `partition`, b, a;
ALTER TABLE t1_will_crash CHECK PARTITION all EXTENDED;
DROP TABLE t1_will_crash;
diff --git a/mysql-test/suite/rpl/r/rpl_gtid_crash.result b/mysql-test/suite/rpl/r/rpl_gtid_crash.result
index 00cae145673..7b6e95bf718 100644
--- a/mysql-test/suite/rpl/r/rpl_gtid_crash.result
+++ b/mysql-test/suite/rpl/r/rpl_gtid_crash.result
@@ -4,7 +4,6 @@ connection server_1;
call mtr.add_suppression("Checking table:");
call mtr.add_suppression("client is using or hasn't closed the table properly");
call mtr.add_suppression("Table .* is marked as crashed and should be repaired");
-call mtr.add_suppression("InnoDB: Warning: database page corruption or a failed");
flush tables;
ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB;
CREATE TABLE t1 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB;
diff --git a/mysql-test/suite/rpl/r/rpl_killed_ddl.result b/mysql-test/suite/rpl/r/rpl_killed_ddl.result
index bb264a12af3..66309432efe 100644
--- a/mysql-test/suite/rpl/r/rpl_killed_ddl.result
+++ b/mysql-test/suite/rpl/r/rpl_killed_ddl.result
@@ -34,9 +34,9 @@ ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 DAY
DO INSERT INTO test.t1 VALUES (1);
CREATE FUNCTION f1 () RETURNS INT DETERMINISTIC
RETURN 1;
-CREATE PROCEDURE p1 (OUT rows INT)
+CREATE PROCEDURE p1 (OUT rows_cnt INT)
BEGIN
-SELECT COUNT(*) INTO rows FROM t1;
+SELECT COUNT(*) INTO rows_cnt FROM t1;
END;
//
CREATE SERVER s1
@@ -125,9 +125,9 @@ connection master;
include/rpl_diff.inc
connection master;
connection master1;
-CREATE PROCEDURE p2 (OUT rows INT)
+CREATE PROCEDURE p2 (OUT rows_cnt INT)
BEGIN
-SELECT COUNT(*) INTO rows FROM t2;
+SELECT COUNT(*) INTO rows_cnt FROM t2;
END;
//
source include/kill_query.inc;
@@ -135,7 +135,7 @@ connection master;
include/rpl_diff.inc
connection master;
connection master1;
-ALTER PROCEDURE p1 SQL SECURITY INVOKER COMMENT 'return rows of table t1';
+ALTER PROCEDURE p1 SQL SECURITY INVOKER COMMENT 'return rows_cnt of table t1';
source include/kill_query.inc;
connection master;
include/rpl_diff.inc
diff --git a/mysql-test/suite/rpl/t/rpl_gtid_crash.test b/mysql-test/suite/rpl/t/rpl_gtid_crash.test
index df3ba9a3420..b81cbd38cd3 100644
--- a/mysql-test/suite/rpl/t/rpl_gtid_crash.test
+++ b/mysql-test/suite/rpl/t/rpl_gtid_crash.test
@@ -12,11 +12,6 @@
call mtr.add_suppression("Checking table:");
call mtr.add_suppression("client is using or hasn't closed the table properly");
call mtr.add_suppression("Table .* is marked as crashed and should be repaired");
-# We have seen this warning a couple of times in Buildbot. Since we crash the
-# server deliberately, it seems possible that we could in rare cases crash in
-# the middle of a page write. The page is recovered from the doublewrite
-# buffer ("[Note] InnoDB: Recovered the page from the doublewrite buffer.").
-call mtr.add_suppression("InnoDB: Warning: database page corruption or a failed");
flush tables;
ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB;
diff --git a/mysql-test/suite/rpl/t/rpl_killed_ddl.test b/mysql-test/suite/rpl/t/rpl_killed_ddl.test
index 593051700a7..6415b3e8874 100644
--- a/mysql-test/suite/rpl/t/rpl_killed_ddl.test
+++ b/mysql-test/suite/rpl/t/rpl_killed_ddl.test
@@ -83,9 +83,9 @@ CREATE FUNCTION f1 () RETURNS INT DETERMINISTIC
RETURN 1;
DELIMITER //;
-CREATE PROCEDURE p1 (OUT rows INT)
+CREATE PROCEDURE p1 (OUT rows_cnt INT)
BEGIN
- SELECT COUNT(*) INTO rows FROM t1;
+ SELECT COUNT(*) INTO rows_cnt FROM t1;
END;
//
DELIMITER ;//
@@ -203,15 +203,15 @@ source include/kill_query_and_diff_master_slave.inc;
--let $rpl_diff_statement= SHOW PROCEDURE STATUS LIKE \'p%\'
DELIMITER //;
-send CREATE PROCEDURE p2 (OUT rows INT)
+send CREATE PROCEDURE p2 (OUT rows_cnt INT)
BEGIN
- SELECT COUNT(*) INTO rows FROM t2;
+ SELECT COUNT(*) INTO rows_cnt FROM t2;
END;
//
DELIMITER ;//
source include/kill_query_and_diff_master_slave.inc;
-send ALTER PROCEDURE p1 SQL SECURITY INVOKER COMMENT 'return rows of table t1';
+send ALTER PROCEDURE p1 SQL SECURITY INVOKER COMMENT 'return rows_cnt of table t1';
source include/kill_query_and_diff_master_slave.inc;
send DROP PROCEDURE p1;
diff --git a/mysql-test/suite/sys_vars/r/innodb_force_recovery_crash_basic.result b/mysql-test/suite/sys_vars/r/innodb_force_recovery_crash_basic.result
deleted file mode 100644
index 5af00f21c74..00000000000
--- a/mysql-test/suite/sys_vars/r/innodb_force_recovery_crash_basic.result
+++ /dev/null
@@ -1,33 +0,0 @@
-select @@global.innodb_force_recovery_crash in (0, 1);
-@@global.innodb_force_recovery_crash in (0, 1)
-1
-select @@global.innodb_force_recovery_crash;
-@@global.innodb_force_recovery_crash
-0
-select @@session.innodb_force_recovery_crash;
-ERROR HY000: Variable 'innodb_force_recovery_crash' is a GLOBAL variable
-show global variables like 'innodb_force_recovery_crash';
-Variable_name Value
-innodb_force_recovery_crash 0
-show session variables like 'innodb_force_recovery_crash';
-Variable_name Value
-innodb_force_recovery_crash 0
-select * from information_schema.global_variables where variable_name='innodb_force_recovery_crash';
-VARIABLE_NAME VARIABLE_VALUE
-INNODB_FORCE_RECOVERY_CRASH 0
-select * from information_schema.session_variables where variable_name='innodb_force_recovery_crash';
-VARIABLE_NAME VARIABLE_VALUE
-INNODB_FORCE_RECOVERY_CRASH 0
-set global innodb_force_recovery_crash=1;
-ERROR HY000: Variable 'innodb_force_recovery_crash' is a read only variable
-set global innodb_force_recovery_crash=0;
-ERROR HY000: Variable 'innodb_force_recovery_crash' is a read only variable
-select @@global.innodb_force_recovery_crash;
-@@global.innodb_force_recovery_crash
-0
-set session innodb_force_recovery_crash='some';
-ERROR HY000: Variable 'innodb_force_recovery_crash' is a read only variable
-set @@session.innodb_force_recovery_crash='some';
-ERROR HY000: Variable 'innodb_force_recovery_crash' is a read only variable
-set global innodb_force_recovery_crash='some';
-ERROR HY000: Variable 'innodb_force_recovery_crash' is a read only variable
diff --git a/mysql-test/suite/sys_vars/r/innodb_monitor_disable_basic.result b/mysql-test/suite/sys_vars/r/innodb_monitor_disable_basic.result
index 2a66a0d0931..ccd8e482756 100644
--- a/mysql-test/suite/sys_vars/r/innodb_monitor_disable_basic.result
+++ b/mysql-test/suite/sys_vars/r/innodb_monitor_disable_basic.result
@@ -181,16 +181,8 @@ compress_pages_decompressed disabled
compression_pad_increments disabled
compression_pad_decrements disabled
compress_saved disabled
-compress_trim_sect512 disabled
-compress_trim_sect1024 disabled
-compress_trim_sect2048 disabled
-compress_trim_sect4096 disabled
-compress_trim_sect8192 disabled
-compress_trim_sect16384 disabled
-compress_trim_sect32768 disabled
compress_pages_page_compressed disabled
compress_page_compressed_trim_op disabled
-compress_page_compressed_trim_op_saved disabled
compress_pages_page_decompressed disabled
compress_pages_page_compression_error disabled
compress_pages_encrypted disabled
diff --git a/mysql-test/suite/sys_vars/r/innodb_monitor_enable_basic.result b/mysql-test/suite/sys_vars/r/innodb_monitor_enable_basic.result
index 2a66a0d0931..ccd8e482756 100644
--- a/mysql-test/suite/sys_vars/r/innodb_monitor_enable_basic.result
+++ b/mysql-test/suite/sys_vars/r/innodb_monitor_enable_basic.result
@@ -181,16 +181,8 @@ compress_pages_decompressed disabled
compression_pad_increments disabled
compression_pad_decrements disabled
compress_saved disabled
-compress_trim_sect512 disabled
-compress_trim_sect1024 disabled
-compress_trim_sect2048 disabled
-compress_trim_sect4096 disabled
-compress_trim_sect8192 disabled
-compress_trim_sect16384 disabled
-compress_trim_sect32768 disabled
compress_pages_page_compressed disabled
compress_page_compressed_trim_op disabled
-compress_page_compressed_trim_op_saved disabled
compress_pages_page_decompressed disabled
compress_pages_page_compression_error disabled
compress_pages_encrypted disabled
diff --git a/mysql-test/suite/sys_vars/r/innodb_monitor_reset_all_basic.result b/mysql-test/suite/sys_vars/r/innodb_monitor_reset_all_basic.result
index 2a66a0d0931..ccd8e482756 100644
--- a/mysql-test/suite/sys_vars/r/innodb_monitor_reset_all_basic.result
+++ b/mysql-test/suite/sys_vars/r/innodb_monitor_reset_all_basic.result
@@ -181,16 +181,8 @@ compress_pages_decompressed disabled
compression_pad_increments disabled
compression_pad_decrements disabled
compress_saved disabled
-compress_trim_sect512 disabled
-compress_trim_sect1024 disabled
-compress_trim_sect2048 disabled
-compress_trim_sect4096 disabled
-compress_trim_sect8192 disabled
-compress_trim_sect16384 disabled
-compress_trim_sect32768 disabled
compress_pages_page_compressed disabled
compress_page_compressed_trim_op disabled
-compress_page_compressed_trim_op_saved disabled
compress_pages_page_decompressed disabled
compress_pages_page_compression_error disabled
compress_pages_encrypted disabled
diff --git a/mysql-test/suite/sys_vars/r/innodb_monitor_reset_basic.result b/mysql-test/suite/sys_vars/r/innodb_monitor_reset_basic.result
index 2a66a0d0931..ccd8e482756 100644
--- a/mysql-test/suite/sys_vars/r/innodb_monitor_reset_basic.result
+++ b/mysql-test/suite/sys_vars/r/innodb_monitor_reset_basic.result
@@ -181,16 +181,8 @@ compress_pages_decompressed disabled
compression_pad_increments disabled
compression_pad_decrements disabled
compress_saved disabled
-compress_trim_sect512 disabled
-compress_trim_sect1024 disabled
-compress_trim_sect2048 disabled
-compress_trim_sect4096 disabled
-compress_trim_sect8192 disabled
-compress_trim_sect16384 disabled
-compress_trim_sect32768 disabled
compress_pages_page_compressed disabled
compress_page_compressed_trim_op disabled
-compress_page_compressed_trim_op_saved disabled
compress_pages_page_decompressed disabled
compress_pages_page_compression_error disabled
compress_pages_encrypted disabled
diff --git a/mysql-test/suite/sys_vars/r/innodb_use_trim_basic.result b/mysql-test/suite/sys_vars/r/innodb_use_trim_basic.result
index 63292f5d3c8..6ab0a19fb57 100644
--- a/mysql-test/suite/sys_vars/r/innodb_use_trim_basic.result
+++ b/mysql-test/suite/sys_vars/r/innodb_use_trim_basic.result
@@ -1,12 +1,14 @@
SET @start_use_trim = @@global.innodb_use_trim;
SELECT @start_use_trim;
@start_use_trim
-0
+1
SELECT COUNT(@@GLOBAL.innodb_use_trim);
COUNT(@@GLOBAL.innodb_use_trim)
1
1 Expected
SET @@GLOBAL.innodb_use_trim=1;
+Warnings:
+Warning 131 Using innodb_use_trim is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
SELECT COUNT(@@GLOBAL.innodb_use_trim);
COUNT(@@GLOBAL.innodb_use_trim)
1
@@ -28,6 +30,8 @@ COUNT(VARIABLE_VALUE)
1
1 Expected
SET @@global.innodb_use_trim = @start_use_trim;
+Warnings:
+Warning 131 Using innodb_use_trim is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
SELECT @@global.innodb_use_trim;
@@global.innodb_use_trim
-0
+1
diff --git a/mysql-test/suite/sys_vars/r/sysvars_innodb,32bit.rdiff b/mysql-test/suite/sys_vars/r/sysvars_innodb,32bit.rdiff
index 41ec54bb4fa..ed57382a2a9 100644
--- a/mysql-test/suite/sys_vars/r/sysvars_innodb,32bit.rdiff
+++ b/mysql-test/suite/sys_vars/r/sysvars_innodb,32bit.rdiff
@@ -134,15 +134,6 @@
NUMERIC_BLOCK_SIZE 0
ENUM_VALUE_LIST NULL
READ_ONLY NO
-@@ -641,7 +641,7 @@
- GLOBAL_VALUE_ORIGIN COMPILE-TIME
- DEFAULT_VALUE 0
- VARIABLE_SCOPE GLOBAL
--VARIABLE_TYPE BIGINT UNSIGNED
-+VARIABLE_TYPE INT UNSIGNED
- VARIABLE_COMMENT InnoDB system tablespace size to be set in recovery.
- NUMERIC_MIN_VALUE 0
- NUMERIC_MAX_VALUE 4294967295
@@ -865,7 +865,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 120
@@ -543,19 +534,6 @@
VARIABLE_COMMENT Memory buffer size for index creation
NUMERIC_MIN_VALUE 65536
NUMERIC_MAX_VALUE 67108864
-@@ -2195,10 +2195,10 @@
- GLOBAL_VALUE_ORIGIN COMPILE-TIME
- DEFAULT_VALUE 6
- VARIABLE_SCOPE GLOBAL
--VARIABLE_TYPE BIGINT UNSIGNED
-+VARIABLE_TYPE INT UNSIGNED
- VARIABLE_COMMENT Maximum delay between polling for a spin lock (6 by default)
- NUMERIC_MIN_VALUE 0
--NUMERIC_MAX_VALUE 18446744073709551615
-+NUMERIC_MAX_VALUE 4294967295
- NUMERIC_BLOCK_SIZE 0
- ENUM_VALUE_LIST NULL
- READ_ONLY NO
@@ -2391,7 +2391,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 1
diff --git a/mysql-test/suite/sys_vars/r/sysvars_innodb.result b/mysql-test/suite/sys_vars/r/sysvars_innodb.result
index 8f655c91427..4b4e10141ab 100644
--- a/mysql-test/suite/sys_vars/r/sysvars_innodb.result
+++ b/mysql-test/suite/sys_vars/r/sysvars_innodb.result
@@ -594,20 +594,6 @@ NUMERIC_BLOCK_SIZE 0
ENUM_VALUE_LIST NULL
READ_ONLY NO
COMMAND_LINE_ARGUMENT OPTIONAL
-VARIABLE_NAME INNODB_COMPRESS_DEBUG
-SESSION_VALUE NULL
-GLOBAL_VALUE none
-GLOBAL_VALUE_ORIGIN COMPILE-TIME
-DEFAULT_VALUE none
-VARIABLE_SCOPE GLOBAL
-VARIABLE_TYPE ENUM
-VARIABLE_COMMENT Compress all tables, without specifying the COMPRESS table attribute
-NUMERIC_MIN_VALUE NULL
-NUMERIC_MAX_VALUE NULL
-NUMERIC_BLOCK_SIZE NULL
-ENUM_VALUE_LIST none,zlib,lz4,lz4hc
-READ_ONLY NO
-COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME INNODB_CONCURRENCY_TICKETS
SESSION_VALUE NULL
GLOBAL_VALUE 5000
@@ -1182,20 +1168,6 @@ NUMERIC_BLOCK_SIZE 0
ENUM_VALUE_LIST NULL
READ_ONLY YES
COMMAND_LINE_ARGUMENT REQUIRED
-VARIABLE_NAME INNODB_FORCE_RECOVERY_CRASH
-SESSION_VALUE NULL
-GLOBAL_VALUE 0
-GLOBAL_VALUE_ORIGIN COMPILE-TIME
-DEFAULT_VALUE 0
-VARIABLE_SCOPE GLOBAL
-VARIABLE_TYPE BIGINT UNSIGNED
-VARIABLE_COMMENT Kills the server during crash recovery.
-NUMERIC_MIN_VALUE 0
-NUMERIC_MAX_VALUE 100
-NUMERIC_BLOCK_SIZE 0
-ENUM_VALUE_LIST NULL
-READ_ONLY YES
-COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME INNODB_FT_AUX_TABLE
SESSION_VALUE NULL
GLOBAL_VALUE
@@ -2626,12 +2598,12 @@ READ_ONLY YES
COMMAND_LINE_ARGUMENT NONE
VARIABLE_NAME INNODB_USE_TRIM
SESSION_VALUE NULL
-GLOBAL_VALUE OFF
+GLOBAL_VALUE ON
GLOBAL_VALUE_ORIGIN COMPILE-TIME
-DEFAULT_VALUE OFF
+DEFAULT_VALUE ON
VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE BOOLEAN
-VARIABLE_COMMENT Use trim. Default FALSE.
+VARIABLE_COMMENT Deallocate (punch_hole|trim) unused portions of the page compressed page (on by default)
NUMERIC_MIN_VALUE NULL
NUMERIC_MAX_VALUE NULL
NUMERIC_BLOCK_SIZE NULL
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 f37ca909836..968312124dc 100644
--- a/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result
+++ b/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result
@@ -2053,6 +2053,20 @@ NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
+VARIABLE_NAME MAX_SESSION_MEM_USED
+SESSION_VALUE 9223372036854775807
+GLOBAL_VALUE 9223372036854775807
+GLOBAL_VALUE_ORIGIN COMPILE-TIME
+DEFAULT_VALUE 9223372036854775807
+VARIABLE_SCOPE SESSION
+VARIABLE_TYPE BIGINT UNSIGNED
+VARIABLE_COMMENT Amount of memory a single user session is allowed to allocate. This limits the value of the session variable MEM_USED
+NUMERIC_MIN_VALUE 8192
+NUMERIC_MAX_VALUE 18446744073709551615
+NUMERIC_BLOCK_SIZE 1
+ENUM_VALUE_LIST NULL
+READ_ONLY NO
+COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME MAX_SORT_LENGTH
SESSION_VALUE 1024
GLOBAL_VALUE 1024
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 15373702057..8ee6ce6492c 100644
--- a/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result
+++ b/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result
@@ -2249,6 +2249,20 @@ NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
+VARIABLE_NAME MAX_SESSION_MEM_USED
+SESSION_VALUE 9223372036854775807
+GLOBAL_VALUE 9223372036854775807
+GLOBAL_VALUE_ORIGIN COMPILE-TIME
+DEFAULT_VALUE 9223372036854775807
+VARIABLE_SCOPE SESSION
+VARIABLE_TYPE BIGINT UNSIGNED
+VARIABLE_COMMENT Amount of memory a single user session is allowed to allocate. This limits the value of the session variable MEM_USED
+NUMERIC_MIN_VALUE 8192
+NUMERIC_MAX_VALUE 18446744073709551615
+NUMERIC_BLOCK_SIZE 1
+ENUM_VALUE_LIST NULL
+READ_ONLY NO
+COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME MAX_SORT_LENGTH
SESSION_VALUE 1024
GLOBAL_VALUE 1024
@@ -4771,9 +4785,9 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME THREAD_POOL_MAX_THREADS
SESSION_VALUE NULL
-GLOBAL_VALUE 1000
+GLOBAL_VALUE 65536
GLOBAL_VALUE_ORIGIN COMPILE-TIME
-DEFAULT_VALUE 1000
+DEFAULT_VALUE 65536
VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE INT UNSIGNED
VARIABLE_COMMENT Maximum allowed number of worker threads in the thread pool
diff --git a/mysql-test/suite/sys_vars/r/thread_pool_max_threads_basic.result b/mysql-test/suite/sys_vars/r/thread_pool_max_threads_basic.result
index 289c0d56092..5622d97cb68 100644
--- a/mysql-test/suite/sys_vars/r/thread_pool_max_threads_basic.result
+++ b/mysql-test/suite/sys_vars/r/thread_pool_max_threads_basic.result
@@ -1,21 +1,21 @@
SET @start_global_value = @@global.thread_pool_max_threads;
select @@global.thread_pool_max_threads;
@@global.thread_pool_max_threads
-1000
+65536
select @@session.thread_pool_max_threads;
ERROR HY000: Variable 'thread_pool_max_threads' is a GLOBAL variable
show global variables like 'thread_pool_max_threads';
Variable_name Value
-thread_pool_max_threads 1000
+thread_pool_max_threads 65536
show session variables like 'thread_pool_max_threads';
Variable_name Value
-thread_pool_max_threads 1000
+thread_pool_max_threads 65536
select * from information_schema.global_variables where variable_name='thread_pool_max_threads';
VARIABLE_NAME VARIABLE_VALUE
-THREAD_POOL_MAX_THREADS 1000
+THREAD_POOL_MAX_THREADS 65536
select * from information_schema.session_variables where variable_name='thread_pool_max_threads';
VARIABLE_NAME VARIABLE_VALUE
-THREAD_POOL_MAX_THREADS 1000
+THREAD_POOL_MAX_THREADS 65536
set global thread_pool_max_threads=1;
select @@global.thread_pool_max_threads;
@@global.thread_pool_max_threads
diff --git a/mysql-test/suite/sys_vars/t/innodb_force_recovery_crash_basic.test b/mysql-test/suite/sys_vars/t/innodb_force_recovery_crash_basic.test
deleted file mode 100644
index cfbd10c4e31..00000000000
--- a/mysql-test/suite/sys_vars/t/innodb_force_recovery_crash_basic.test
+++ /dev/null
@@ -1,30 +0,0 @@
---source include/have_innodb.inc
---source include/have_debug.inc
-
-#
-# exists as global only
-#
-select @@global.innodb_force_recovery_crash in (0, 1);
-select @@global.innodb_force_recovery_crash;
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-select @@session.innodb_force_recovery_crash;
-show global variables like 'innodb_force_recovery_crash';
-show session variables like 'innodb_force_recovery_crash';
---disable_warnings
-select * from information_schema.global_variables where variable_name='innodb_force_recovery_crash';
-select * from information_schema.session_variables where variable_name='innodb_force_recovery_crash';
---enable_warnings
-
-# show that it's read-only
-#
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-set global innodb_force_recovery_crash=1;
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-set global innodb_force_recovery_crash=0;
-select @@global.innodb_force_recovery_crash;
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-set session innodb_force_recovery_crash='some';
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-set @@session.innodb_force_recovery_crash='some';
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-set global innodb_force_recovery_crash='some';
diff --git a/mysql-test/suite/vcol/disabled.def b/mysql-test/suite/vcol/disabled.def
new file mode 100644
index 00000000000..86480ca3a4c
--- /dev/null
+++ b/mysql-test/suite/vcol/disabled.def
@@ -0,0 +1 @@
+vcol_keys_myisam : MDEV-11836
diff --git a/mysql-test/suite/wsrep/r/binlog_format.result b/mysql-test/suite/wsrep/r/binlog_format.result
index 1ca90bd626d..83af2b67762 100644
--- a/mysql-test/suite/wsrep/r/binlog_format.result
+++ b/mysql-test/suite/wsrep/r/binlog_format.result
@@ -1,4 +1,4 @@
-call mtr.add_suppression("WSREP: MariaDB Galera does not support binlog format.*");
+call mtr.add_suppression("WSREP: MariaDB Galera and flashback do not support binlog format.*");
call mtr.add_suppression("WSREP: Cannot get fake transaction ID from storage engine.");
#
# MDEV-4227: Galera server should stop crashing on setting binlog_format STATEMENT
@@ -8,20 +8,20 @@ Variable_name Value
binlog_format ROW
SET binlog_format=STATEMENT;
Warnings:
-Warning 1105 MariaDB Galera does not support binlog format: STATEMENT
+Warning 1105 MariaDB Galera and flashback do not support binlog format: STATEMENT
SHOW WARNINGS;
Level Code Message
-Warning 1105 MariaDB Galera does not support binlog format: STATEMENT
+Warning 1105 MariaDB Galera and flashback do not support binlog format: STATEMENT
SHOW VARIABLES LIKE 'binlog_format';
Variable_name Value
binlog_format STATEMENT
CREATE TABLE IF NOT EXISTS test.t1 AS SELECT * FROM information_schema.routines WHERE 1 = 0;
SET binlog_format=MIXED;
Warnings:
-Warning 1105 MariaDB Galera does not support binlog format: MIXED
+Warning 1105 MariaDB Galera and flashback do not support binlog format: MIXED
SHOW WARNINGS;
Level Code Message
-Warning 1105 MariaDB Galera does not support binlog format: MIXED
+Warning 1105 MariaDB Galera and flashback do not support binlog format: MIXED
SHOW VARIABLES LIKE 'binlog_format';
Variable_name Value
binlog_format MIXED
diff --git a/mysql-test/suite/wsrep/t/binlog_format.test b/mysql-test/suite/wsrep/t/binlog_format.test
index 85864256862..02602b9cb2b 100644
--- a/mysql-test/suite/wsrep/t/binlog_format.test
+++ b/mysql-test/suite/wsrep/t/binlog_format.test
@@ -1,7 +1,7 @@
--source include/have_wsrep_provider.inc
--source include/have_binlog_format_row.inc
-call mtr.add_suppression("WSREP: MariaDB Galera does not support binlog format.*");
+call mtr.add_suppression("WSREP: MariaDB Galera and flashback do not support binlog format.*");
call mtr.add_suppression("WSREP: Cannot get fake transaction ID from storage engine.");
--echo #
diff --git a/mysql-test/t/cast.test b/mysql-test/t/cast.test
index 58f91571ebb..5316c12c857 100644
--- a/mysql-test/t/cast.test
+++ b/mysql-test/t/cast.test
@@ -472,3 +472,42 @@ select collation(cast("a" as char(10) ascii binary));
select collation(cast("a" as char(10) binary charset utf8));
select collation(cast("a" as char(10) binary ascii));
+--echo #
+--echo # MDEV-11030 Assertion `precision > 0' failed in decimal_bin_size
+--echo #
+
+SELECT * FROM (SELECT IFNULL(CONVERT(NULL, UNSIGNED), NULL)) sq;
+
+CREATE TABLE t1 AS SELECT IFNULL(CONVERT(NULL, UNSIGNED), NULL);
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 AS SELECT COALESCE(CONVERT(NULL, UNSIGNED), NULL);
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 AS SELECT CASE WHEN TRUE THEN CONVERT(NULL, UNSIGNED) ELSE NULL END;
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 AS SELECT IFNULL(CONVERT(NULL,SIGNED),CONVERT(NULL,UNSIGNED)) AS a;
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 AS SELECT
+ -1,
+ CONVERT(NULL,SIGNED),
+ CONCAT(CONVERT(NULL,SIGNED)),
+ 1,
+ CONVERT(NULL,UNSIGNED),
+ CONCAT(CONVERT(NULL,UNSIGNED));
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 AS SELECT
+ CONVERT('',SIGNED),
+ CONCAT(CONVERT('',SIGNED)),
+ CONVERT('',UNSIGNED),
+ CONCAT(CONVERT('',UNSIGNED));
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
diff --git a/mysql-test/t/cte_nonrecursive.test b/mysql-test/t/cte_nonrecursive.test
index 8dbde472c16..b3a127475f2 100644
--- a/mysql-test/t/cte_nonrecursive.test
+++ b/mysql-test/t/cte_nonrecursive.test
@@ -609,3 +609,15 @@ where
and T2.name <> T1.name);
drop table employees;
+
+--echo #
+--echo # MDEV-11818: EXPLAIN EXTENDED for a query with optimized away CTE table
+--echo #
+
+CREATE TABLE t1 (i INT, c VARCHAR(3));
+INSERT INTO t1 VALUES (1,'foo');
+
+EXPLAIN EXTENDED
+WITH cte AS ( SELECT * FROM t1 ) SELECT i FROM cte;
+
+DROP TABLE t1;
diff --git a/mysql-test/t/cte_recursive.test b/mysql-test/t/cte_recursive.test
index ea0f73be259..aacafcb73ec 100644
--- a/mysql-test/t/cte_recursive.test
+++ b/mysql-test/t/cte_recursive.test
@@ -1505,3 +1505,15 @@ select id, test_data
) as a;
drop table t1;
+
+--echo #
+--echo # MDEV-10773: ANALYZE for query with recursive CTE
+--echo #
+
+--replace_regex /"r_total_time_ms": [0-9]*[.]?[0-9]*(e[-+]?[0-9]+)?/"r_total_time_ms": "REPLACED"/
+analyze format=json
+with recursive src(counter) as
+(select 1
+ union
+ select counter+1 from src where counter<10
+) select * from src;
diff --git a/mysql-test/t/default.test b/mysql-test/t/default.test
index 5a020856c56..13eda13c7da 100644
--- a/mysql-test/t/default.test
+++ b/mysql-test/t/default.test
@@ -2011,6 +2011,36 @@ EXECUTE IMMEDIATE 'EXPLAIN EXTENDED SELECT * FROM t1 WHERE ?+a<=>?+a' USING DEFA
DROP TABLE t1;
+--echo #
+--echo # MDEV-11134 Assertion `fixed' failed in Item::const_charset_converter(THD*, CHARSET_INFO*, bool, const char*)
+--echo #
+
+SET NAMES utf8;
+PREPARE stmt FROM "CREATE OR REPLACE TABLE t1 (c CHAR(8) DEFAULT ?)";
+SET @a='';
+EXECUTE stmt USING @a;
+EXECUTE stmt USING @a;
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+SET @a='A';
+EXECUTE stmt USING @a;
+EXECUTE stmt USING @a;
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+SET @a=_utf8 0xC380; # LATIN CAPITAL LETTER A WITH GRAVE
+EXECUTE stmt USING @a;
+EXECUTE stmt USING @a;
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+SET @a=_utf8 0xD18F; # Cyrillic letter into a latin1 column
+--error ER_INVALID_DEFAULT
+EXECUTE stmt USING @a;
+--error ER_INVALID_DEFAULT
+EXECUTE stmt USING @a;
+DEALLOCATE PREPARE stmt;
+
+
+
--echo # end of 10.2 test
#
diff --git a/mysql-test/t/derived_cond_pushdown.test b/mysql-test/t/derived_cond_pushdown.test
index e43751472db..47d01617b83 100644
--- a/mysql-test/t/derived_cond_pushdown.test
+++ b/mysql-test/t/derived_cond_pushdown.test
@@ -1319,3 +1319,37 @@ SELECT * FROM v1 WHERE v1.d IN ( SELECT MIN(d) FROM t2 WHERE 0 );
DROP VIEW v1;
DROP TABLE t1,t2;
+
+--echo #
+--echo # MDEV-11820: second execution of PS for query
+--echo # with false subquery predicate in WHERE
+--echo #
+
+CREATE TABLE t1 (c VARCHAR(3)) ENGINE=MyISAM;
+INSERT INTO t1 VALUES ('foo'),('bar');
+CREATE ALGORITHM=TEMPTABLE VIEW v1 AS SELECT * FROM t1;
+CREATE TABLE t2 (a INT);
+INSERT INTO t2 VALUES (3), (4);
+
+PREPARE stmt1 FROM
+" SELECT * FROM v1 WHERE 1 IN (SELECT a FROM t2) OR c = 'foo'";
+PREPARE stmt2 FROM
+"EXPLAIN FORMAT=JSON
+ SELECT * FROM v1 WHERE 1 IN (SELECT a FROM t2) OR c = 'foo'";
+EXECUTE stmt1;
+EXECUTE stmt2;
+INSERT INTO t2 SELECT a+1 FROM t2;
+INSERT INTO t2 SELECT a+1 FROM t2;
+INSERT INTO t2 SELECT a+1 FROM t2;
+INSERT INTO t2 SELECT a+1 FROM t2;
+INSERT INTO t2 SELECT a+1 FROM t2;
+INSERT INTO t2 SELECT a+1 FROM t2;
+EXECUTE stmt1;
+EXECUTE stmt2;
+DEALLOCATE PREPARE stmt1;
+# the result here will change after the merge with the fix for mdev-11859
+DEALLOCATE PREPARE stmt2;
+
+DROP VIEW v1;
+DROP TABLE t1,t2;
+
diff --git a/mysql-test/t/func_json.test b/mysql-test/t/func_json.test
index 7ab136f177c..b9b4ab3726a 100644
--- a/mysql-test/t/func_json.test
+++ b/mysql-test/t/func_json.test
@@ -78,6 +78,8 @@ select json_extract('[10, 20, [30, 40]]', '$[2][*]');
select json_extract('[10, 20, [{"a":3}, 30, 40]]', '$[2][*]');
select json_extract('1', '$');
select json_extract('[10, 20, [30, 40], 1, 10]', '$[1]');
+select json_extract('[10, 20, [30, 40], 1, 10]', '$[1]', '$[25]');
+select json_extract( '[{"a": [3, 4]}, {"b": 2}]', '$[0].a', '$[1].a');
select json_insert('{"a":1, "b":{"c":1}, "d":[1, 2]}', '$.b.k1', 'word');
select json_insert('{"a":1, "b":{"c":1}, "d":[1, 2]}', '$.d[3]', 3);
@@ -177,3 +179,21 @@ create table json (j INT);
show create table json;
drop table json;
+select json_length( '[ 1, [ 2, 3, 4 ], 5 ]', '$[2]' );
+select json_length( '[ 1, [ 2, 3, 4 ], 5 ]', '$[2][0]' );
+select json_length( '[ 1, [ 2, 3, 4 ], 5 ]', '$[2][0][0]' );
+select json_length( '[ 1, [ 2, 3, 4 ], 5 ]', '$[2][0][0][0]' );
+select json_length( '[ 1, [ 2, 3, 4 ], {"a":5, "b":6} ]', '$[2]' );
+select json_length( '[ 1, [ 2, 3, 4 ], {"a":5, "b":6} ]', '$[2][0]' );
+select json_length( '[ 1, [ 2, 3, 4 ], {"a":5, "b":6} ]', '$[2][0][0]' );
+select json_length( '[ 1, [ 2, 3, 4 ], {"a":5, "b":6} ]', '$[2][0][0][0]' );
+select json_length( '{"a":{"b":{"d":1}}, "a":{"c":{"d":1, "j":2}}}', '$.a[0][0][0].c' );
+
+select json_set('1', '$[0]', 100);
+select json_set('1', '$[0][0]', 100);
+select json_set('1', '$[1]', 100);
+select json_set('{"a":12}', '$[0]', 100);
+select json_set('{"a":12}', '$[0].a', 100);
+select json_set('{"a":12}', '$[0][0].a', 100);
+select json_set('{"a":12}', '$[0][1].a', 100);
+
diff --git a/mysql-test/t/gis-json.test b/mysql-test/t/gis-json.test
new file mode 100644
index 00000000000..645c21bf011
--- /dev/null
+++ b/mysql-test/t/gis-json.test
@@ -0,0 +1,28 @@
+-- source include/have_geometry.inc
+
+select st_asgeojson(geomfromtext('POINT(1 1)'));
+select st_asgeojson(geomfromtext('LINESTRING(10 10,20 10,20 20,10 20,10 10)'));
+select st_asgeojson(geomfromtext('POLYGON((10 10,20 10,20 20,10 20,10 10))'));
+select st_asgeojson(geomfromtext('MULTIPOLYGON(((10 10,20 10,20 20,10 20,10 10)))'));
+select st_asgeojson(geomfromtext('multilinestring((10 10,20 10,20 20,10 20,10 10))'));
+select st_asgeojson(geomfromtext('multipoint(10 10,20 10,20 20,10 20,10 10)'));
+select st_asgeojson(st_geomfromtext('GEOMETRYCOLLECTION(POINT(100 0),LINESTRING(101 0,102 1))'));
+
+SELECT st_astext(st_geomfromgeojson('{"type":"point","coordinates":[1,2]}'));
+SELECT st_astext(st_geomfromgeojson('{"type":"LineString","coordinates":[[1,2],[4,5],[7,8]]}'));
+SELECT st_astext(st_geomfromgeojson('{"type": "polygon", "coordinates": [[[10, 10], [20, 10], [20, 20], [10, 20], [10, 10]]]}'));
+SELECT st_astext(st_geomfromgeojson('{"type":"multipoint","coordinates":[[1,2],[4,5],[7,8]]}'));
+SELECT st_astext(st_geomfromgeojson('{"type": "multilinestring", "coordinates": [[[10, 10], [20, 10], [20, 20], [10, 20], [10, 10]]]}'));
+SELECT st_astext(st_geomfromgeojson('{"type": "multipolygon", "coordinates": [[[[10, 10], [20, 10], [20, 20], [10, 20], [10, 10]]]]}'));
+SELECT st_astext(st_geomfromgeojson('{"type": "GeometryCollection", "geometries": [{"type": "Point","coordinates": [100.0, 0.0]}, {"type": "LineString","coordinates": [[101.0, 0.0],[102.0, 1.0]]}]}'));
+
+SELECT st_astext(st_geomfromgeojson('{"type":"point"}'));
+SELECT st_astext(st_geomfromgeojson('{"type":"point"'));
+SELECT st_astext(st_geomfromgeojson('{"type""point"}'));
+
+SELECT st_astext(st_geomfromgeojson('{ "type": "Feature", "geometry": { "type": "Point", "coordinates": [102.0, 0.5] } }'));
+SELECT st_astext(st_geomfromgeojson('{ "type": "FeatureCollection", "features": [{ "type": "Feature", "geometry": { "type": "Point", "coordinates": [102.0, 0.5] }, "properties": { "prop0": "value0" } }]}'));
+
+--echo #
+--echo # End of 10.2 tests
+--echo #
diff --git a/mysql-test/t/keywords.test b/mysql-test/t/keywords.test
index 40beee9e3c1..5c4c813ab39 100644
--- a/mysql-test/t/keywords.test
+++ b/mysql-test/t/keywords.test
@@ -175,6 +175,46 @@ set option=1;
set option option=1;
--echo #
+--echo # MDEV-9979 Keywords UNBOUNDED, PRECEDING, FOLLOWING, TIES, OTHERS should be non-reserved
+--echo #
+CREATE TABLE EXCLUDE (EXCLUDE INT);
+SELECT EXCLUDE FROM EXCLUDE;
+SELECT EXCLUDE EXCLUDE FROM EXCLUDE;
+SELECT EXCLUDE AS EXCLUDE FROM EXCLUDE;
+DROP TABLE EXCLUDE;
+
+CREATE TABLE UNBOUNDED (UNBOUNDED INT);
+SELECT UNBOUNDED FROM UNBOUNDED;
+SELECT UNBOUNDED UNBOUNDEX FROM UNBOUNDED;
+SELECT UNBOUNDED AS UNBOUNDEX FROM UNBOUNDED;
+DROP TABLE UNBOUNDED;
+
+CREATE TABLE PRECEDING (PRECEDING INT);
+SELECT PRECEDING FROM PRECEDING;
+SELECT PRECEDING PRECEDING FROM PRECEDING;
+SELECT PRECEDING AS PRECEDING FROM PRECEDING;
+DROP TABLE PRECEDING;
+
+CREATE TABLE FOLLOWING (FOLLOWING INT);
+SELECT FOLLOWING FROM FOLLOWING;
+SELECT FOLLOWING FOLLOWING FROM FOLLOWING;
+SELECT FOLLOWING AS FOLLOWING FROM FOLLOWING;
+DROP TABLE FOLLOWING;
+
+CREATE TABLE TIES (TIES INT);
+SELECT TIES FROM TIES;
+SELECT TIES TIES FROM TIES;
+SELECT TIES AS TIES FROM TIES;
+DROP TABLE TIES;
+
+CREATE TABLE OTHERS (OTHERS INT);
+SELECT OTHERS FROM OTHERS;
+SELECT OTHERS OTHERS FROM OTHERS;
+SELECT OTHERS AS OTHERS FROM OTHERS;
+DROP TABLE OTHERS;
+
+
+--echo #
--echo # MDEV-10585 EXECUTE IMMEDIATE statement
--echo #
diff --git a/mysql-test/t/partition_innodb_plugin.test b/mysql-test/t/partition_innodb_plugin.test
index a514736ff42..18ed0a27f96 100644
--- a/mysql-test/t/partition_innodb_plugin.test
+++ b/mysql-test/t/partition_innodb_plugin.test
@@ -36,11 +36,9 @@ call mtr.add_suppression("InnoDB: Error: table `test`.`t1` .* InnoDB internal");
--echo #
--echo # Bug#55091: Server crashes on ADD PARTITION after a failed attempt
--echo #
-SET @old_innodb_file_format = @@global.innodb_file_format;
SET @old_innodb_file_per_table = @@global.innodb_file_per_table;
SET @old_innodb_strict_mode = @@global.innodb_strict_mode;
-SET @@global.innodb_file_format = Barracuda,
-@@global.innodb_file_per_table = ON,
+SET @@global.innodb_file_per_table = ON,
@@global.innodb_strict_mode = ON;
--connect(con1,localhost,root,,)
@@ -90,7 +88,6 @@ DROP TABLE t1;
--disconnect con2
--connection default
SET @@global.innodb_strict_mode = @old_innodb_strict_mode;
-SET @@global.innodb_file_format = @old_innodb_file_format;
SET @@global.innodb_file_per_table = @old_innodb_file_per_table;
#
@@ -153,4 +150,3 @@ ROLLBACK;
disconnect con1;
connection default;
DROP TABLE `t``\""e`;
-SET NAMES DEFAULT;
diff --git a/mysql-test/t/ps.test b/mysql-test/t/ps.test
index 00e0c4086bb..74ab7659ac6 100644
--- a/mysql-test/t/ps.test
+++ b/mysql-test/t/ps.test
@@ -4287,3 +4287,32 @@ INSERT INTO t1 VALUES (1),(2),(3);
--error ER_INVALID_DEFAULT_PARAM
EXECUTE IMMEDIATE 'EXPLAIN EXTENDED SELECT * FROM t1 WHERE ?+a<=>?+a' USING DEFAULT,DEFAULT;
DROP TABLE t1;
+
+--echo #
+--echo # MDEV-11780 Crash with PREPARE + SP out parameter + literal
+--echo #
+
+DELIMITER $$;
+CREATE OR REPLACE PROCEDURE p1(OUT a INT)
+BEGIN
+ SET a=10;
+END;
+$$
+DELIMITER ;$$
+
+PREPARE stmt FROM 'CALL p1(?)';
+--error ER_SP_NOT_VAR_ARG
+EXECUTE stmt USING 10;
+--error ER_SP_NOT_VAR_ARG
+EXECUTE stmt USING DEFAULT;
+--error ER_SP_NOT_VAR_ARG
+EXECUTE stmt USING IGNORE;
+DEALLOCATE PREPARE stmt;
+
+--error ER_SP_NOT_VAR_ARG
+EXECUTE IMMEDIATE 'CALL p1(?)' USING 10;
+--error ER_SP_NOT_VAR_ARG
+EXECUTE IMMEDIATE 'CALL p1(?)' USING DEFAULT;
+--error ER_SP_NOT_VAR_ARG
+EXECUTE IMMEDIATE 'CALL p1(?)' USING IGNORE;
+DROP PROCEDURE p1;
diff --git a/mysql-test/t/set_statement.test b/mysql-test/t/set_statement.test
index a91c53c8dee..32f56e498df 100644
--- a/mysql-test/t/set_statement.test
+++ b/mysql-test/t/set_statement.test
@@ -618,8 +618,7 @@ SELECT @@sql_mode;
SET STATEMENT sql_mode='ansi' FOR PREPARE stmt FROM 'SELECT "t1".* FROM t1';
execute stmt;
ALTER TABLE t1 ADD COLUMN v3 int;
-# repreparation with other mode cause an error
---error ER_PARSE_ERROR
+# repreparation with other mode does not cause an error
execute stmt;
ALTER TABLE t1 drop COLUMN v3;
deallocate prepare stmt;
@@ -632,8 +631,7 @@ PREPARE stmt FROM 'SELECT "t1".* FROM t1';
SET sql_mode=default;
execute stmt;
ALTER TABLE t1 ADD COLUMN v3 int;
-# repreparation with other mode cause an error
---error ER_PARSE_ERROR
+# repreparation with other mode does not cause an error
execute stmt;
ALTER TABLE t1 drop COLUMN v3;
deallocate prepare stmt;
diff --git a/mysql-test/t/sql_mode.test b/mysql-test/t/sql_mode.test
index 869bf45dbf3..263437a0bf1 100644
--- a/mysql-test/t/sql_mode.test
+++ b/mysql-test/t/sql_mode.test
@@ -513,3 +513,17 @@ SET @@sql_mode= @org_mode;
--echo
--echo #End of Test for Bug#12601974
+
+--echo #
+--echo # MDEV-11848 Automatic statement repreparation changes query semantics
+--echo #
+SET sql_mode=DEFAULT;
+CREATE OR REPLACE TABLE t1 (a TEXT);
+PREPARE stmt FROM 'INSERT INTO t1 (a) VALUES (2||3)';
+EXECUTE stmt;
+SET sql_mode=ORACLE;
+EXECUTE stmt;
+ALTER TABLE t1 ADD b INT;
+EXECUTE stmt;
+SELECT * FROM t1;
+DROP TABLE t1;
diff --git a/mysql-test/t/subselect_sj2.test b/mysql-test/t/subselect_sj2.test
index 5d6639a6d5a..a948b086a85 100644
--- a/mysql-test/t/subselect_sj2.test
+++ b/mysql-test/t/subselect_sj2.test
@@ -1449,5 +1449,20 @@ SELECT * FROM t1 WHERE t1.id IN (
drop table t1,t2,t3;
+--echo #
+--echo # MDEV-11108: Assertion `uniq_tuple_length_arg <= table->file->max_key_length()' failed in SJ_TMP_TABLE::create_sj_weedout_tmp_table
+--echo #
+
+CREATE TABLE t1 (a INT) ENGINE=InnoDB;
+CREATE TABLE t2 (pk BLOB, b INT, PRIMARY KEY(pk(1000))) ENGINE=InnoDB;
+CREATE TABLE t3 (c INT) ENGINE=InnoDB;
+CREATE OR REPLACE ALGORITHM=MERGE VIEW v3 AS SELECT * FROM t3;
+
+INSERT INTO t3 VALUES (1),(2),(3),(4),(5),(6),(7),(8);
+SELECT * FROM t1, t2
+WHERE a IN ( SELECT b FROM t2 LEFT JOIN v3 ON ( c = b ) ) ;
+DROP TABLE t1,t2,t3;
+DROP VIEW v3;
+
--echo # This must be the last in the file:
set optimizer_switch=@subselect_sj2_tmp;
diff --git a/mysql-test/t/trigger_null-8605.test b/mysql-test/t/trigger_null-8605.test
index 748768a1849..34a57654b48 100644
--- a/mysql-test/t/trigger_null-8605.test
+++ b/mysql-test/t/trigger_null-8605.test
@@ -373,3 +373,17 @@ show columns from t1;
insert into t1 (a) values (3);
show columns from t1;
drop table t1;
+
+#
+# MDEV-11551 Server crashes in Field::is_real_null
+#
+create table t1 (
+ pk int primary key,
+ i int,
+ v1 int as (i) virtual,
+ v2 int as (i) virtual
+);
+create trigger tr before update on t1 for each row set @a = 1;
+--error ER_BAD_NULL_ERROR
+insert into t1 (pk, i) values (null, null);
+drop table t1;
diff --git a/mysql-test/t/win.test b/mysql-test/t/win.test
index 7052368cf9c..6444c4df6a4 100644
--- a/mysql-test/t/win.test
+++ b/mysql-test/t/win.test
@@ -1426,3 +1426,69 @@ select * from v4;
drop view v1,v2,v3,v4;
drop table t0,t1;
+
+--echo #
+--echo # MDEV-10875: window function in subquery
+--echo #
+
+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;
+
+SELECT * FROM t1 WHERE i IN ( SELECT COUNT(*) OVER (PARTITION BY c) FROM t2 );
+
+DROP TABLE t1, t2;
+
+--echo #
+--echo # MDEV-9976: window function without PARTITION BY and ORDER BY
+--echo #
+
+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);
+
+--sorted_result
+SELECT id, sum(a) OVER (PARTITION BY id
+ ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING)
+FROM t1;
+
+--sorted_result
+SELECT id, sum(a) OVER (ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING)
+FROM t1;
+
+DROP TABLE t1;
+
+--echo #
+--echo # MDEV-11867: window function with aggregation
+--echo # over the result of grouping
+--echo #
+
+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;
+
+select username, sum(amount), avg(sum(amount)) over (order by sum(amount) desc)
+ from t1
+group by username;
+
+drop table t1;
+
+
diff --git a/mysql-test/unstable-tests b/mysql-test/unstable-tests
index 7b5c2756f11..42985e1d66d 100644
--- a/mysql-test/unstable-tests
+++ b/mysql-test/unstable-tests
@@ -23,66 +23,83 @@
#
##############################################################################
-main.alter_table : Modified in 10.1.19
-main.analyze_stmt_slow_query_log : MDEV-7558 - wrong result
-main.create : Modified in 10.1.20
+main.alter_table : Modified in 10.1.21
+main.alter_table_trans : MDEV-11805 - timeout
+main.analyze_stmt_slow_query_log : Modified in 10.1.21
+main.cast : Modified in 10.1.21
+main.create : Modified in 10.1.21
main.create_delayed : MDEV-10605 - failed with timeout
main.create_drop_binlog : Uses binlog_start_pos.inc modified in 10.1.20
-main.create_or_replace : Modified in 10.1.19
+main.ctype_ucs : Modified in 10.1.21
+main.ctype_ucs2_def : Modified in 10.1.21
+main.ctype_ucs2_query_cache : Modified in 10.1.21
+main.ctype_utf16 : Modified in 10.1.21
+main.ctype_utf16_def : Modified in 10.1.21
main.ctype_utf16le : MDEV-10675: timeout or extra warnings
+main.ctype_utf32 : Modified in 10.1.21
main.ctype_utf8 : Modified in 10.1.20
main.ctype_utf8mb4 : Modified in 10.1.20
main.default : Modified in 10.1.20
main.derived : Modified in 10.1.20
main.derived_view : Modified in 10.1.20
-main.drop : Modified in 10.1.19
main.events_restart : MDEV-11221: assertion failure
+main.events_slowlog : Added in 10.1.21
main.fulltext_charsets : Added in 10.1.20
-main.func_time : Modified in 10.1.20
+main.func_time : Modified in 10.1.21
main.group_by : Modified in 10.1.20
main.group_by_innodb : Modified in 10.1.20
main.host_cache_size_functionality : MDEV-10606 - sporadic failure on shutdown
main.index_intersect_innodb : MDEV-10643 - failed with timeout
-main.index_merge_innodb : MDEV-7142 - Wrong execution plan
-main.information_schema : Modified in 10.1.19
+main.index_merge_innodb : MDEV-7142 - Wrong execution plan, also modified in 10.1.21
+main.information_schema_part : Modified in 10.1.21
main.innodb_mysql_lock : MDEV-7861 - sporadic lock detection failure
+main.join_cache : Modified in 10.1.21
main.kill_processlist-6619 : MDEV-10793 - wrong result in processlist
-main.loaddata : Modified in 10.1.20
+main.loaddata : Modified in 10.1.21
+main.log_slow : Modified in 10.1.21
main.lowercase_fs_on : Uses search_pattern_in_file.inc modified in 10.1.20
main.mdev-504 : MDEV-10607 - sporadic "can't connect"
main.mdev375 : MDEV-10607 - sporadic "can't connect"
main.merge : MDEV-10607 - sporadic "can't connect"
-main.mysql : Modified in 10.1.19
-main.mysql_not_windows : Modified in 10.1.19
main.mysqlbinlog : Uses binlog_start_pos.inc modified in 10.1.20
main.mysqldump-max : Uses binlog_start_pos.inc modified in 10.1.20
-main.mysqldump-nl : Added in 10.1.19
-main.mysqltest : MDEV-9269 - fails on Alpha; also modified in 10.1.19
+main.mysqlslap : MDEV-11801 - timeout
+main.mysqltest : MDEV-9269 - fails on Alpha
main.named_pipe : Uses search_pattern_in_file.inc modified in 10.1.20
-main.null : Modified in 10.1.19
+main.order_by : Modified in 10.1.21
main.order_by_optimizer_innodb : MDEV-10683 - wrong execution plan
main.parser : Modified in 10.1.20
-main.pool_of_threads : MDEV-10100 - sporadic error on detecting max connections
+main.pool_of_threads : Modified in 10.1.21
main.ps : MDEV-11017 - sporadic wrong Prepared_stmt_count
main.selectivity : Modified in 10.1.20
-main.selectivity_innodb : Modified in 10.1.19
main.show_explain : MDEV-10674 - sporadic failure
-main.sp : Modified in 10.1.20
+main.signal_demo3 : MDEV-11720 - Thread stack overrun on labrador
+main.sp : Modified in 10.1.21
+main.sp-prelocking : Modified in 10.1.21
main.sp-security : MDEV-10607 - sporadic "can't connect"
main.stat_tables_par_innodb : MDEV-10515 - sporadic wrong results
main.statistics : Modified in 10.1.20
main.status : MDEV-8510 - sporadic wrong result
-main.subselect : Modified in 10.1.20
+main.subselect : Modified in 10.1.21
+main.subselect2 : Modified in 10.1.21
+main.subselect4 : Modified in 10.1.21
main.subselect_innodb : MDEV-10614 - sporadic wrong results
+main.subselect_no_exists_to_in : Uses subselect.test modified in 10.1.21
+main.subselect_no_mat : Uses subselect.test modified in 10.1.21
+main.subselect_no_opts : Uses subselect.test modified in 10.1.21
+main.subselect_no_scache : Uses subselect.test modified in 10.1.21
+main.subselect_no_semijoin : Uses subselect.test modified in 10.1.21
+main.trigger_null-8605 : Modified in 10.1.21
main.type_datetime_hires : MDEV-10687 - timeout
main.type_decimal : Modified in 10.1.20
-main.view : Uses search_pattern_in_file.inc modified in 10.1.20
+main.union : Modified in 10.1.21
+main.view : Modified in 10.1.21
main.wait_timeout_not_windows : Uses search_pattern_in_file.inc modified in 10.1.20
#----------------------------------------------------------------
archive.archive-big : MDEV-10615 - table is marked as crashed
-archive.discover : MDEV-10510 - table is marked as crashed
+archive.discover : MDEV-10510 - table is marked as crashed; modified in 10.1.21
#----------------------------------------------------------------
@@ -101,6 +118,8 @@ binlog_encryption.* : Added in 10.1.20
#----------------------------------------------------------------
+connect.jdbc : Modified in 10.1.21
+connect.jdbc_new : Modified in 10.1.21
connect.tbl : MDEV-9844, MDEV-10179 - sporadic crashes, valgrind warnings, wrong results
#----------------------------------------------------------------
@@ -115,27 +134,28 @@ encryption.filekeys_nofile : Uses search_pattern_in_file.inc mo
encryption.filekeys_syntax : Uses search_pattern_in_file.inc modified in 10.1.20
encryption.filekeys_tooshort : Uses search_pattern_in_file.inc modified in 10.1.20
encryption.filekeys_unencfile : Uses search_pattern_in_file.inc modified in 10.1.20
-encryption.innodb-bad-key-change : uses keys2.txt modified in 10.1.19
-encryption.innodb-bad-key-change2 : uses keys2.txt modified in 10.1.19
-encryption.innodb-bad-key-change3 : Uses search_pattern_in_file.inc modified in 10.1.20
-encryption.innodb-bad-key-change4 : uses keys2.txt modified in 10.1.19
-encryption.innodb-bad-key-change5 : uses keys2.txt modified in 10.1.19
-encryption.innodb-bad-key-shutdown : MDEV-9105 - valgrind warnings, assertion failures, and uses keys2.txt modified in 10.1.19
-encryption.innodb-discard-import : Uses search_pattern_in_file.inc modified in 10.1.20
-encryption.innodb_encryption_discard_import : MDEV-11218 - wrong result, also uses search_pattern_in_file.inc modified in 10.1.20
+encryption.innodb-bad-key-change3 : Modified in 10.1.21
+encryption.innodb-bad-key-shutdown : MDEV-9105 - valgrind warnings, assertion failures
+encryption.innodb-discard-import : Modified in 10.1.21
+encryption.innodb-discard-import-change : Modified in 10.1.21
+encryption.innodb_encryption_discard_import : MDEV-11218 - wrong result, also modified in 10.1.21
encryption.innodb_encryption_filekeys : MDEV-9962 - timeouts
+encryption.innodb_encryption-page-compression : MDEV-11420 - Trying to access missing tablespace
encryption.innodb_encryption_row_compressed : Uses search_pattern_in_file.inc modified in 10.1.20
encryption.innodb_first_page : MDEV-10689 - crashes
-encryption.innodb-log-encrypt : Uses search_pattern_in_file.inc modified in 10.1.20
-encryption.innodb_lotoftables : MDEV-11531 - InnoDB error
-encryption.innodb-missing-key : Added in 10.1.19
+encryption.innodb-log-encrypt : Modified in 10.1.21
+encryption.innodb_lotoftables : MDEV-11531 - InnoDB error, also modified in 10.1.21
+encryption.innodb-missing-key : MDEV-9359 - assertion failure
encryption.innodb_onlinealter_encryption : MDEV-10099 - wrong results; also uses search_pattern_in_file.inc modified in 10.1.20
encryption.innodb-page_encryption : MDEV-10641 - mutex problem
-encryption.innodb_page_encryption_key_change : uses keys2.txt modified in 10.1.19
+encryption.innodb_scrub : MDEV-8139, also was modified in 10.1.21
+encryption.innodb_scrub_background : MDEV_8139, also was modified in 10.1.21
+encryption.innodb_scrub_compressed : MDEV-8139; also was modified and re-enabled in 10.1.21
#----------------------------------------------------------------
-extra/binlog_tests.database : Modified in 10.1.19 (merge)
+engines/iuds.* : Not maintained in timely manner
+engines/funcs.* : Not maintained in timely manner
#----------------------------------------------------------------
@@ -147,51 +167,57 @@ federated.federated_transactions : MDEV-10617, MDEV-10417 - Wrong checksum, time
#----------------------------------------------------------------
funcs_1.processlist_val_no_prot : MDEV-11223 - Wrong result
+
+funcs_2.innodb_charset : Modified in 10.1.21
funcs_2.memory_charset : MDEV-10290 - Timeout
funcs_2.myisam_charset : MDEV-11535 - Timeout
#----------------------------------------------------------------
-galera.* : Added to default suites in 10.1.19
-
-galera.galera_var_dirty_reads : Modified in 10.1.20
+galera.galera_var_cluster_address : Modified in 10.1.21
+galera.galera_var_dirty_reads : Modified in 10.1.21
+galera.MW-284 : Modified in 10.1.21
galera.rpl_row_annotate : Uses binlog_start_pos.inc modified in 10.1.20
+galera_split_brain : Modified in 10.1.21
-galera_3nodes.* : Added to default suites in 10.1.19, MDEV-11490
+galera_3nodes.* : MDEV-11490 - Warnings not suppressed
#----------------------------------------------------------------
+innodb.101_compatibility : Added in 10.1.21
innodb.binlog_consistent : MDEV-10618 - Server fails to start; also uses binlog_start_pos.inc modified in 10.1.20
+innodb.doublewrite : Added in 10.1.21
innodb.group_commit_binlog_pos : Uses binlog_start_pos.inc modified in 10.1.20
innodb.group_commit_binlog_pos_no_optimize_thread : Uses binlog_start_pos.inc modified in 10.1.20
+innodb.group_commit_crash : Modified in 10.1.21
+innodb.group_commit_crash_no_optimize_thread : Modified in 10.1.21
innodb.innodb-alter-table : MDEV-10619 - Testcase timeout
-innodb.innodb-bug-14068765 : MDEV-9105 - valgrind warnings, assertion failures, also uses innodb-util.pl added in 10.1.19
-innodb.innodb-bug-14084530 : MDEV-9105 - valgrind warnings, assertion failures, also uses innodb-util.pl added in 10.1.19
+innodb.innodb-bug-14068765 : MDEV-9105 - valgrind warnings, assertion failures
+innodb.innodb-bug-14084530 : MDEV-9105 - valgrind warnings, assertion failures
+innodb.innodb_bug14147491 : MDEV-11808, also modified in 10.1.21
+innodb.innodb_bug14676111 : MDEV-11802 - wrong result
innodb.innodb_bug30423 : MDEV-7311 - Wrong number of rows in the plan
-innodb.innodb-change-buffer-recovery : Uses search_pattern_in_file.inc modified in 10.1.20
+innodb.innodb-change-buffer-recovery : Modified in 10.1.21
innodb.innodb_defragment_fill_factor : Modified in 10.1.20
innodb.innodb-lock-schedule-algorithm : Modified in 10.1.20
innodb.innodb-page_compression_zip : MDEV-10641 - mutex problem
innodb.innodb_stats : MDEV-10682 - wrong result
innodb.innodb_sys_semaphore_waits : MDEV-10331 - wrong result
-innodb.innodb-wl5522 : MDEV-9105 - valgrind warnings, assertion failures, also uses innodb-util.pl added in 10.1.19
-innodb.innodb-wl5522-1 : MDEV-9105 - valgrind warnings, assertion failures, also uses innodb-util.pl added in 10.1.19
-innodb.innodb-wl5522-debug : Modified in 10.1.19
-innodb.innodb-wl5522-debug-zip : Modified in 10.1.20
-innodb.innodb-wl5522-zip : MDEV-9105 - valgrind warnings, assertion failures, also uses innodb-util.pl added in 10.1.19
+innodb.innodb-wl5522 : MDEV-9105 - valgrind warnings, assertion failures
+innodb.innodb-wl5522-1 : MDEV-9105 - valgrind warnings, assertion failures
+innodb.innodb-wl5522-debug-zip : Modified in 10.1.21
+innodb.log_data_file_size : Added in 10.1.21
innodb.table_index_statistics : Added in 10.1.20
innodb.trigger : Modified in 10.1.20
-innodb.xa_recovery : Modified in 10.1.19
+innodb.xa_recovery : Modified in 10.1.21
#----------------------------------------------------------------
innodb_fts.create : Added in 10.1.20
-innodb_fts.innodb_fts_misc : MDEV-11233 - Crash on CREATE FULLTEXT INDEX
#----------------------------------------------------------------
maria.collations : Added in 10.1.20
-maria.encrypt-wrong-key : uses keys2.txt modified in 10.1.19
maria.maria-connect : Uses binlog_start_pos.inc modified in 10.1.20
#----------------------------------------------------------------
@@ -225,24 +251,26 @@ perfschema.func_file_io : MDEV-5708 - fails for s390x
perfschema.func_mutex : MDEV-5708 - fails for s390x
perfschema.setup_actors : MDEV-10679 - rare crash
perfschema.socket_summary_by_event_name_func : MDEV-10622 - Socket summary tables do not match
+perfschema.stage_mdl_global : MDEV-11803 - wrong result on slow builders
perfschema.threads_mysql : MDEV-10677 - sporadic wrong result
#----------------------------------------------------------------
+plugins.cracklib_password_check : MDEV-11650 - valgrind warnings
plugins.feedback_plugin_send : MDEV-7932 - ssl failed for url
plugins.server_audit : MDEV-9562 - crashes on sol10-sparc
plugins.thread_pool_server_audit : MDEV-9562 - crashes on sol10-sparc
-
+plugins.two_password_validations : MDEV-11650 - valgrind warnings
#----------------------------------------------------------------
roles.role_case_sensitive-10744 : Added in 10.1.20
roles.create_and_drop_role : Modified in 10.1.20
-roles.create_and_grant_role : MDEV-11533 - Extra grant in output
#----------------------------------------------------------------
rpl.last_insert_id : MDEV-10625 - warnings in error log
+rpl.rpl_alter_extra_persistent : Added in 10.1.21
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
@@ -252,7 +280,6 @@ rpl.rpl_checksum_cache : MDEV-10626 - Testcase timeout
rpl.rpl_circular_for_4_hosts : MDEV-10627 - Testcase timeout
rpl.rpl_ddl : MDEV-10417 - Fails on Mips
rpl.rpl_domain_id_filter_restart : MDEV-10684 - Wrong result
-rpl.rpl_drop_db : Modified in 10.1.19
rpl.rpl_gtid_basic : MDEV-10681 - server startup problem
rpl.rpl_gtid_crash : MDEV-9501 - Warning: failed registering on master
rpl.rpl_gtid_errorlog : Uses search_pattern_in_file.inc modified in 10.1.20
@@ -260,6 +287,7 @@ rpl.rpl_gtid_master_promote : MDEV-10628 - Timeout in sync_with_master
rpl.rpl_gtid_mdev9033 : MDEV-10680 - warnings
rpl.rpl_gtid_stop_start : MDEV-10629 - Crash on shutdown
rpl.rpl_gtid_until : MDEV-10625 - warnings in error log
+rpl.rpl_heartbeat_basic : MDEV-11668 - wrong result
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
@@ -278,17 +306,21 @@ rpl.rpl_password_boundaries : MDEV-11534 - Slave IO warnings
rpl.rpl_row_drop_create_temp_table : MDEV-10626 - Testcase timeout
rpl.rpl_row_flsh_tbls : Uses binlog_start_pos.inc modified in 10.1.20
rpl.rpl_row_log_innodb : MDEV-10688 - Wrong result
+rpl.rpl_row_mysqlbinlog : Modified in 10.1.21
rpl.rpl_row_sp001 : MDEV-9329 - Fails on Ubuntu/s390x
rpl.rpl_semi_sync : MDEV-11220 - Wrong result
+rpl.rpl_semi_sync_event_after_sync : MDEV-11806 - warnings
rpl.rpl_semi_sync_uninstall_plugin : MDEV-7140 - Wrong plugin status
+rpl.rpl_semi_sync_wait_point : MDEV-11807 - timeout in wait condition
rpl.rpl_show_slave_hosts : MDEV-10681 - server startup problem
rpl.rpl_skip_replication : MDEV-9268 - Fails with timeout in sync_slave_with_master on Alpha
rpl.rpl_slave_grp_exec : MDEV-10514 - Unexpected deadlock
+rpl.rpl_special_charset : Modified in 10.1.21
rpl.rpl_stm_flsh_tbls : Uses binlog_start_pos.inc modified in 10.1.20
rpl.rpl_stop_slave_error : Uses search_pattern_in_file.inc modified in 10.1.20
rpl.rpl_sync : MDEV-10633 - Database page corruption
rpl.rpl_temporary_error2 : MDEV-10634 - Wrong number of retries
-rpl.sec_behind_master-5114 : MDEV-8518 - Wrong value of Seconds_Behind_Master
+rpl.sec_behind_master-5114 : Modified in 10.1.21
#----------------------------------------------------------------
@@ -301,9 +333,11 @@ spider/bg.ha_part : MDEV-9329 - Fails on Ubuntu/s390x
spider/bg.spider_fixes : MDEV-7098, MDEV-9329 - Mutex problem, failures on s390x
spider/bg.vp_fixes : MDEV-9329 - Fails on Ubuntu/s390x
+spider/handler.* : MDEV-10987, MDEV-10990 - Tests have not been maintained
+
#----------------------------------------------------------------
-sphinx.* : MDEV-10985, MDEV-10986 - Tests have not been maintained
+sphinx.* : MDEV-10986 - Tests have not been maintained
#----------------------------------------------------------------
@@ -325,6 +359,7 @@ sys_vars.replicate_ignore_db_basic : Modified in 10.1.20
sys_vars.replicate_ignore_table_basic : Modified in 10.1.20
sys_vars.replicate_wild_do_table_basic : Modified in 10.1.20
sys_vars.replicate_wild_ignore_table_basic : Modified in 10.1.20
+sys_vars.rpl_init_slave_func : MDEV-10149 - wrong results
sys_vars.sysvars_innodb : MDEV-6958 - error-prone rdiffs
sys_vars.sysvars_server_embedded : MDEV-6958 - error-prone rdiffs
sys_vars.table_open_cache_instances_basic : Modified in 10.1.20
@@ -339,6 +374,7 @@ tokudb.table_index_statistics : Added in 10.1.20
tokudb_bugs.checkpoint_lock : MDEV-10637 - Wrong processlist output
tokudb_bugs.checkpoint_lock_3 : MDEV-10637 - Wrong processlist output
+tokudb_bugs.xa : MDEV-11804 - Lock wait timeout
tokudb_rpl.rpl_parallel_optimistic : Added in 10.1.20
tokudb_rpl.rpl_tokudb_rfr_partition_table : Added in 10.1.20
@@ -355,9 +391,7 @@ vcol.vcol_keys_innodb : MDEV-10639 - Testcase timeout
#----------------------------------------------------------------
wsrep.binlog_format : MDEV-11532 - WSREP has not yet prepared node
-wsrep.mdev_10186 : Modified in 10.1.19
#----------------------------------------------------------------
-wsrep_info.* : suite.pm modified in 10.1.19
wsrep_info.plugin : MDEV-11530 - Warnings; also modified in 10.1.20
diff --git a/mysys/my_malloc.c b/mysys/my_malloc.c
index e533230106e..dc02d3896bd 100644
--- a/mysys/my_malloc.c
+++ b/mysys/my_malloc.c
@@ -48,7 +48,6 @@ static inline size_t malloc_size_and_flag(void *p, my_bool *is_thread_specific)
#define MALLOC_FIX_POINTER_FOR_FREE(p) (((char*) (p)) - MALLOC_PREFIX_SIZE)
#endif /* SAFEMALLOC */
-static MALLOC_SIZE_CB malloc_size_cb_func= NULL;
/**
Inform application that memory usage has changed
@@ -59,17 +58,19 @@ static MALLOC_SIZE_CB malloc_size_cb_func= NULL;
The type os size is long long, to be able to handle negative numbers to
decrement the memory usage
+
+ @return 0 - ok
+ 1 - failure, abort the allocation
*/
+static void dummy(long long size __attribute__((unused)),
+ my_bool is_thread_specific __attribute__((unused)))
+{}
-static void update_malloc_size(long long size, my_bool is_thread_specific)
-{
- if (malloc_size_cb_func)
- malloc_size_cb_func(size, is_thread_specific);
-}
+static MALLOC_SIZE_CB update_malloc_size= dummy;
void set_malloc_size_cb(MALLOC_SIZE_CB func)
{
- malloc_size_cb_func= func;
+ update_malloc_size= func ? func : dummy;
}
diff --git a/mysys_ssl/my_crypt.cc b/mysys_ssl/my_crypt.cc
index 49bd9af3f60..5411a908bf8 100644
--- a/mysys_ssl/my_crypt.cc
+++ b/mysys_ssl/my_crypt.cc
@@ -168,6 +168,9 @@ public:
*/
if (!ctx.encrypt)
{
+ /* encrypted string must contain authenticaton tag (see MDEV-11174) */
+ if (slen < MY_AES_BLOCK_SIZE)
+ return MY_AES_BAD_DATA;
slen-= MY_AES_BLOCK_SIZE;
if(!EVP_CIPHER_CTX_ctrl(&ctx, EVP_CTRL_GCM_SET_TAG, MY_AES_BLOCK_SIZE,
(void*)(src + slen)))
diff --git a/sql/item.cc b/sql/item.cc
index e1bb8c15b75..73dc5800c98 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -544,7 +544,14 @@ uint Item::decimal_precision() const
unsigned_flag);
return MY_MIN(prec, DECIMAL_MAX_PRECISION);
}
- return MY_MIN(max_char_length(), DECIMAL_MAX_PRECISION);
+ uint res= max_char_length();
+ /*
+ Return at least one decimal digit, even if Item::max_char_length()
+ returned 0. This is important to avoid attempts to create fields of types
+ INT(0) or DECIMAL(0,0) when converting NULL or empty strings to INT/DECIMAL:
+ CREATE TABLE t1 AS SELECT CONVERT(NULL,SIGNED) AS a;
+ */
+ return res ? MY_MIN(res, DECIMAL_MAX_PRECISION) : 1;
}
@@ -3297,11 +3304,19 @@ Item_param::Item_param(THD *thd, uint pos_in_query_arg):
Rewritable_query_parameter(pos_in_query_arg, 1),
Type_handler_hybrid_field_type(MYSQL_TYPE_VARCHAR),
state(NO_VALUE),
- indicators(0), indicator(STMT_INDICATOR_NONE),
/* Don't pretend to be a literal unless value for this item is set. */
item_type(PARAM_ITEM),
+ indicators(0), indicator(STMT_INDICATOR_NONE),
set_param_func(default_set_param_func),
- m_out_param_info(NULL)
+ m_out_param_info(NULL),
+ /*
+ Set m_is_settable_routine_parameter to "true" by default.
+ This is needed for client-server protocol,
+ whose parameters are always settable.
+ For dynamic SQL, settability depends on the type of Item passed
+ as an actual parameter. See Item_param::set_from_item().
+ */
+ m_is_settable_routine_parameter(true)
{
name= (char*) "?";
/*
@@ -3326,7 +3341,7 @@ void Item_param::set_null()
max_length= 0;
decimals= 0;
state= NULL_VALUE;
- item_type= Item::NULL_ITEM;
+ fix_type(Item::NULL_ITEM);
DBUG_VOID_RETURN;
}
@@ -3338,6 +3353,7 @@ void Item_param::set_int(longlong i, uint32 max_length_arg)
max_length= max_length_arg;
decimals= 0;
maybe_null= 0;
+ fix_type(Item::INT_ITEM);
DBUG_VOID_RETURN;
}
@@ -3349,6 +3365,7 @@ void Item_param::set_double(double d)
max_length= DBL_DIG + 8;
decimals= NOT_FIXED_DEC;
maybe_null= 0;
+ fix_type(Item::REAL_ITEM);
DBUG_VOID_RETURN;
}
@@ -3378,21 +3395,41 @@ void Item_param::set_decimal(const char *str, ulong length)
my_decimal_precision_to_length_no_truncation(decimal_value.precision(),
decimals, unsigned_flag);
maybe_null= 0;
+ fix_type(Item::DECIMAL_ITEM);
DBUG_VOID_RETURN;
}
-void Item_param::set_decimal(const my_decimal *dv)
+void Item_param::set_decimal(const my_decimal *dv, bool unsigned_arg)
{
state= DECIMAL_VALUE;
my_decimal2decimal(dv, &decimal_value);
decimals= (uint8) decimal_value.frac;
- unsigned_flag= !decimal_value.sign();
+ unsigned_flag= unsigned_arg;
max_length= my_decimal_precision_to_length(decimal_value.intg + decimals,
decimals, unsigned_flag);
+ fix_type(Item::DECIMAL_ITEM);
+}
+
+
+void Item_param::fix_temporal(uint32 max_length_arg, uint decimals_arg)
+{
+ state= TIME_VALUE;
+ max_length= max_length_arg;
+ decimals= decimals_arg;
+ fix_type(Item::DATE_ITEM);
}
+
+void Item_param::set_time(const MYSQL_TIME *tm,
+ uint32 max_length_arg, uint decimals_arg)
+{
+ value.time= *tm;
+ fix_temporal(max_length_arg, decimals_arg);
+}
+
+
/**
Set parameter value from MYSQL_TIME value.
@@ -3421,11 +3458,9 @@ void Item_param::set_time(MYSQL_TIME *tm, timestamp_type time_type,
&str, time_type, 0);
set_zero_time(&value.time, MYSQL_TIMESTAMP_ERROR);
}
-
- state= TIME_VALUE;
maybe_null= 0;
- max_length= max_length_arg;
- decimals= tm->second_part > 0 ? TIME_SECOND_PART_DIGITS : 0;
+ fix_temporal(max_length_arg,
+ tm->second_part > 0 ? TIME_SECOND_PART_DIGITS : 0);
DBUG_VOID_RETURN;
}
@@ -3446,6 +3481,7 @@ bool Item_param::set_str(const char *str, ulong length)
maybe_null= 0;
/* max_length and decimals are set after charset conversion */
/* sic: str may be not null-terminated, don't add DBUG_PRINT here */
+ fix_type(Item::STRING_ITEM);
DBUG_RETURN(FALSE);
}
@@ -3477,6 +3513,7 @@ bool Item_param::set_longdata(const char *str, ulong length)
DBUG_RETURN(TRUE);
state= LONG_DATA_VALUE;
maybe_null= 0;
+ fix_type(Item::STRING_ITEM);
DBUG_RETURN(FALSE);
}
@@ -3523,6 +3560,7 @@ bool Item_param::CONVERSION_INFO::convert(THD *thd, String *str)
bool Item_param::set_from_item(THD *thd, Item *item)
{
DBUG_ENTER("Item_param::set_from_item");
+ m_is_settable_routine_parameter= item->get_settable_routine_parameter();
if (limit_clause_param)
{
longlong val= item->val_int();
@@ -3535,7 +3573,6 @@ bool Item_param::set_from_item(THD *thd, Item *item)
{
unsigned_flag= item->unsigned_flag;
set_int(val, MY_INT64_NUM_DECIMAL_DIGITS);
- item_type= Item::INT_ITEM;
set_handler_by_result_type(item->result_type());
DBUG_RETURN(!unsigned_flag && value.integer < 0 ? 1 : 0);
}
@@ -3547,12 +3584,10 @@ bool Item_param::set_from_item(THD *thd, Item *item)
switch (item->cmp_type()) {
case REAL_RESULT:
set_double(tmp.value.m_double);
- item_type= Item::REAL_ITEM;
set_handler_by_field_type(MYSQL_TYPE_DOUBLE);
break;
case INT_RESULT:
set_int(tmp.value.m_longlong, MY_INT64_NUM_DECIMAL_DIGITS);
- item_type= Item::INT_ITEM;
set_handler_by_field_type(MYSQL_TYPE_LONGLONG);
break;
case STRING_RESULT:
@@ -3562,7 +3597,6 @@ bool Item_param::set_from_item(THD *thd, Item *item)
Exact value of max_length is not known unless data is converted to
charset of connection, so we have to set it later.
*/
- item_type= Item::STRING_ITEM;
set_handler_by_field_type(MYSQL_TYPE_VARCHAR);
if (set_str(tmp.m_string.ptr(), tmp.m_string.length()))
@@ -3571,24 +3605,13 @@ bool Item_param::set_from_item(THD *thd, Item *item)
}
case DECIMAL_RESULT:
{
- const my_decimal *ent_value= &tmp.m_decimal;
- my_decimal2decimal(ent_value, &decimal_value);
- state= DECIMAL_VALUE;
- decimals= ent_value->frac;
- max_length=
- my_decimal_precision_to_length_no_truncation(ent_value->precision(),
- decimals, unsigned_flag);
- item_type= Item::DECIMAL_ITEM;
+ set_decimal(&tmp.m_decimal, unsigned_flag);
set_handler_by_field_type(MYSQL_TYPE_NEWDECIMAL);
break;
}
case TIME_RESULT:
{
- value.time= tmp.value.m_time;
- state= TIME_VALUE;
- max_length= item->max_length;
- decimals= item->decimals;
- item_type= Item::DATE_ITEM;
+ set_time(&tmp.value.m_time, item->max_length, item->decimals);
set_handler(item->type_handler());
break;
}
@@ -3629,6 +3652,7 @@ void Item_param::reset()
state= NO_VALUE;
maybe_null= 1;
null_value= 0;
+ fixed= false;
/*
Don't reset item_type to PARAM_ITEM: it's only needed to guard
us from item optimizations at prepare stage, when item doesn't yet
@@ -3966,6 +3990,7 @@ bool Item_param::convert_str_value(THD *thd)
bool Item_param::basic_const_item() const
{
+ DBUG_ASSERT(fixed || state == NO_VALUE);
if (state == NO_VALUE || state == TIME_VALUE)
return FALSE;
return TRUE;
@@ -4100,6 +4125,7 @@ Item_param::set_param_type_and_swap_value(Item_param *src)
maybe_null= src->maybe_null;
null_value= src->null_value;
state= src->state;
+ fixed= src->fixed;
value= src->value;
decimal_value.swap(src->decimal_value);
@@ -4110,7 +4136,9 @@ Item_param::set_param_type_and_swap_value(Item_param *src)
void Item_param::set_default()
{
+ m_is_settable_routine_parameter= false;
state= DEFAULT_VALUE;
+ fixed= true;
/*
When Item_param is set to DEFAULT_VALUE:
- its val_str() and val_decimal() return NULL
@@ -4124,7 +4152,9 @@ void Item_param::set_default()
void Item_param::set_ignore()
{
+ m_is_settable_routine_parameter= false;
state= IGNORE_VALUE;
+ fixed= true;
null_value= true;
}
@@ -4170,18 +4200,15 @@ Item_param::set_value(THD *thd, sp_rcontext *ctx, Item **it)
str_value.charset());
collation.set(str_value.charset(), DERIVATION_COERCIBLE);
decimals= 0;
- item_type= Item::STRING_ITEM;
break;
}
case REAL_RESULT:
set_double(arg->val_real());
- item_type= Item::REAL_ITEM;
break;
case INT_RESULT:
set_int(arg->val_int(), arg->max_length);
- item_type= Item::INT_ITEM;
break;
case DECIMAL_RESULT:
@@ -4192,8 +4219,7 @@ Item_param::set_value(THD *thd, sp_rcontext *ctx, Item **it)
if (!dv)
return TRUE;
- set_decimal(dv);
- item_type= Item::DECIMAL_ITEM;
+ set_decimal(dv, !dv->sign());
break;
}
@@ -4203,7 +4229,6 @@ Item_param::set_value(THD *thd, sp_rcontext *ctx, Item **it)
DBUG_ASSERT(TRUE); // Abort in debug mode.
set_null(); // Set to NULL in release mode.
- item_type= Item::NULL_ITEM;
return FALSE;
}
diff --git a/sql/item.h b/sql/item.h
index 96e5a0560c5..f9f7515c460 100644
--- a/sql/item.h
+++ b/sql/item.h
@@ -2601,7 +2601,47 @@ class Item_param :public Item_basic_value,
public Rewritable_query_parameter,
public Type_handler_hybrid_field_type
{
-public:
+ /*
+ NO_VALUE is a special value meaning that the parameter has not been
+ assigned yet. Item_param::state is assigned to NO_VALUE in constructor
+ and is used at prepare time.
+
+ 1. At prepare time
+ Item_param::fix_fields() sets "fixed" to true,
+ but as Item_param::state is still NO_VALUE,
+ Item_param::basic_const_item() returns false. This prevents various
+ optimizations to happen at prepare time fix_fields().
+ For example, in this query:
+ PREPARE stmt FROM 'SELECT FORMAT(10000,2,?)';
+ Item_param::basic_const_item() is tested from
+ Item_func_format::fix_length_and_dec().
+
+ 2. At execute time:
+ When Item_param gets a value
+ (or a pseudo-value like DEFAULT_VALUE or IGNORE_VALUE):
+ - Item_param::state changes from NO_VALUE to something else
+ - Item_param::fixed is changed to true
+ All Item_param::set_xxx() make sure to do so.
+ In the state with an assigned value:
+ - Item_param::basic_const_item() returns true
+ - Item::type() returns NULL_ITEM, INT_ITEM, REAL_ITEM, DECIMAL_ITEM,
+ DATE_ITEM, STRING_ITEM, depending on the value assigned.
+ So in this state Item_param behaves in many cases like a literal.
+
+ When Item_param::cleanup() is called:
+ - Item_param::state does not change
+ - Item_param::fixed changes to false
+ Note, this puts Item_param into an inconsistent state:
+ - Item_param::basic_const_item() still returns "true"
+ - Item_param::type() still pretends to be a basic constant Item
+ Both are not expected in combination with fixed==false.
+ However, these methods are not really called in this state,
+ see asserts in Item_param::basic_const_item() and Item_param::type().
+
+ When Item_param::reset() is called:
+ - Item_param::state changes to NO_VALUE
+ - Item_param::fixed changes to false
+ */
enum enum_item_param_state
{
NO_VALUE, NULL_VALUE, INT_VALUE, REAL_VALUE,
@@ -2609,6 +2649,17 @@ public:
DECIMAL_VALUE, DEFAULT_VALUE, IGNORE_VALUE
} state;
+ enum Type item_type;
+
+ void fix_type(Type type)
+ {
+ item_type= type;
+ fixed= true;
+ }
+
+ void fix_temporal(uint32 max_length_arg, uint decimals_arg);
+
+public:
struct CONVERSION_INFO
{
/*
@@ -2677,8 +2728,6 @@ public:
MYSQL_TIME time;
} value;
- enum Type item_type;
-
const Type_handler *type_handler() const
{ return Type_handler_hybrid_field_type::type_handler(); }
enum_field_types field_type() const
@@ -2690,7 +2739,11 @@ public:
Item_param(THD *thd, uint pos_in_query_arg);
- enum Type type() const { return item_type; }
+ enum Type type() const
+ {
+ DBUG_ASSERT(fixed || state == NO_VALUE);
+ return item_type;
+ }
double val_real();
longlong val_int();
@@ -2705,10 +2758,11 @@ public:
void set_int(longlong i, uint32 max_length_arg);
void set_double(double i);
void set_decimal(const char *str, ulong length);
- void set_decimal(const my_decimal *dv);
+ void set_decimal(const my_decimal *dv, bool unsigned_arg);
bool set_str(const char *str, ulong length);
bool set_longdata(const char *str, ulong length);
void set_time(MYSQL_TIME *tm, timestamp_type type, uint32 max_length_arg);
+ void set_time(const MYSQL_TIME *tm, uint32 max_length_arg, uint decimals_arg);
bool set_from_item(THD *thd, Item *item);
void reset();
/*
@@ -2734,6 +2788,18 @@ public:
bool is_null()
{ DBUG_ASSERT(state != NO_VALUE); return state == NULL_VALUE; }
bool basic_const_item() const;
+ bool has_no_value() const
+ {
+ return state == NO_VALUE;
+ }
+ bool has_long_data_value() const
+ {
+ return state == LONG_DATA_VALUE;
+ }
+ bool has_int_value() const
+ {
+ return state == INT_VALUE;
+ }
/*
This method is used to make a copy of a basic constant item when
propagating constants in the optimizer. The reason to create a new
@@ -2757,7 +2823,7 @@ public:
Rewritable_query_parameter *get_rewritable_query_parameter()
{ return this; }
Settable_routine_parameter *get_settable_routine_parameter()
- { return this; }
+ { return m_is_settable_routine_parameter ? this : NULL; }
bool append_for_log(THD *thd, String *str);
bool check_vcol_func_processor(void *int_arg) {return FALSE;}
@@ -2777,6 +2843,7 @@ public:
private:
Send_field *m_out_param_info;
+ bool m_is_settable_routine_parameter;
};
diff --git a/sql/item_create.cc b/sql/item_create.cc
index a506ab948d1..add8da67810 100644
--- a/sql/item_create.cc
+++ b/sql/item_create.cc
@@ -1262,6 +1262,34 @@ protected:
#ifdef HAVE_SPATIAL
+class Create_func_geometry_from_json : public Create_native_func
+{
+public:
+ virtual Item *create_native(THD *thd, LEX_STRING name, List<Item> *item_list);
+
+ static Create_func_geometry_from_json s_singleton;
+
+protected:
+ Create_func_geometry_from_json() {}
+ virtual ~Create_func_geometry_from_json() {}
+};
+
+
+class Create_func_as_geojson : public Create_native_func
+{
+public:
+ virtual Item *create_native(THD *thd, LEX_STRING name, List<Item> *item_list);
+
+ static Create_func_as_geojson s_singleton;
+
+protected:
+ Create_func_as_geojson() {}
+ virtual ~Create_func_as_geojson() {}
+};
+#endif /*HAVE_SPATIAL*/
+
+
+#ifdef HAVE_SPATIAL
class Create_func_geometry_type : public Create_func_arg1
{
public:
@@ -4533,6 +4561,101 @@ Create_func_geometry_from_wkb::create_native(THD *thd, LEX_STRING name,
#ifdef HAVE_SPATIAL
+Create_func_geometry_from_json Create_func_geometry_from_json::s_singleton;
+
+Item*
+Create_func_geometry_from_json::create_native(THD *thd, LEX_STRING name,
+ List<Item> *item_list)
+{
+ Item *func= NULL;
+ int arg_count= 0;
+
+ if (item_list != NULL)
+ arg_count= item_list->elements;
+
+ switch (arg_count) {
+ case 1:
+ {
+ Item *json= item_list->pop();
+ func= new (thd->mem_root) Item_func_geometry_from_json(thd, json);
+ thd->lex->uncacheable(UNCACHEABLE_RAND);
+ break;
+ }
+ case 2:
+ {
+ Item *json= item_list->pop();
+ Item *options= item_list->pop();
+ func= new (thd->mem_root) Item_func_geometry_from_json(thd, json, options);
+ break;
+ }
+ case 3:
+ {
+ Item *json= item_list->pop();
+ Item *options= item_list->pop();
+ Item *srid= item_list->pop();
+ func= new (thd->mem_root) Item_func_geometry_from_json(thd, json, options,
+ srid);
+ break;
+ }
+ default:
+ {
+ my_error(ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT, MYF(0), name.str);
+ break;
+ }
+ }
+
+ return func;
+}
+
+
+Create_func_as_geojson Create_func_as_geojson::s_singleton;
+
+Item*
+Create_func_as_geojson::create_native(THD *thd, LEX_STRING name,
+ List<Item> *item_list)
+{
+ Item *func= NULL;
+ int arg_count= 0;
+
+ if (item_list != NULL)
+ arg_count= item_list->elements;
+
+ switch (arg_count) {
+ case 1:
+ {
+ Item *geom= item_list->pop();
+ func= new (thd->mem_root) Item_func_as_geojson(thd, geom);
+ thd->lex->uncacheable(UNCACHEABLE_RAND);
+ break;
+ }
+ case 2:
+ {
+ Item *geom= item_list->pop();
+ Item *max_dec= item_list->pop();
+ func= new (thd->mem_root) Item_func_as_geojson(thd, geom, max_dec);
+ break;
+ }
+ case 3:
+ {
+ Item *geom= item_list->pop();
+ Item *max_dec= item_list->pop();
+ Item *options= item_list->pop();
+ func= new (thd->mem_root) Item_func_as_geojson(thd, geom, max_dec, options);
+ break;
+ }
+ default:
+ {
+ my_error(ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT, MYF(0), name.str);
+ break;
+ }
+ }
+
+ return func;
+}
+#endif /*HAVE_SPATIAL*/
+
+
+#ifdef HAVE_SPATIAL
Create_func_geometry_type Create_func_geometry_type::s_singleton;
Item*
@@ -6723,6 +6846,7 @@ static Native_func_registry func_array[] =
{ { C_STRING_WITH_LEN("STR_TO_DATE") }, BUILDER(Create_func_str_to_date)},
{ { C_STRING_WITH_LEN("ST_AREA") }, GEOM_BUILDER(Create_func_area)},
{ { C_STRING_WITH_LEN("ST_ASBINARY") }, GEOM_BUILDER(Create_func_as_wkb)},
+ { { C_STRING_WITH_LEN("ST_ASGEOJSON") }, GEOM_BUILDER(Create_func_as_geojson)},
{ { C_STRING_WITH_LEN("ST_ASTEXT") }, GEOM_BUILDER(Create_func_as_wkt)},
{ { C_STRING_WITH_LEN("ST_ASWKB") }, GEOM_BUILDER(Create_func_as_wkb)},
{ { C_STRING_WITH_LEN("ST_ASWKT") }, GEOM_BUILDER(Create_func_as_wkt)},
@@ -6748,6 +6872,7 @@ static Native_func_registry func_array[] =
{ { C_STRING_WITH_LEN("ST_GEOMETRYFROMWKB") }, GEOM_BUILDER(Create_func_geometry_from_wkb)},
{ { C_STRING_WITH_LEN("ST_GEOMETRYN") }, GEOM_BUILDER(Create_func_geometryn)},
{ { C_STRING_WITH_LEN("ST_GEOMETRYTYPE") }, GEOM_BUILDER(Create_func_geometry_type)},
+ { { C_STRING_WITH_LEN("ST_GEOMFROMGEOJSON") }, GEOM_BUILDER(Create_func_geometry_from_json)},
{ { C_STRING_WITH_LEN("ST_GEOMFROMTEXT") }, GEOM_BUILDER(Create_func_geometry_from_text)},
{ { C_STRING_WITH_LEN("ST_GEOMFROMWKB") }, GEOM_BUILDER(Create_func_geometry_from_wkb)},
#ifndef DBUG_OFF
diff --git a/sql/item_func.h b/sql/item_func.h
index 368054222aa..fe0b7669b79 100644
--- a/sql/item_func.h
+++ b/sql/item_func.h
@@ -759,8 +759,15 @@ public:
}
void fix_length_and_dec()
{
- fix_char_length(MY_MIN(args[0]->max_char_length(),
- MY_INT64_NUM_DECIMAL_DIGITS));
+ uint32 char_length= MY_MIN(args[0]->max_char_length(),
+ MY_INT64_NUM_DECIMAL_DIGITS);
+ /*
+ args[0]->max_char_length() can return 0.
+ Reserve max_length to fit at least one character for one digit,
+ plus one character for the sign (if signed).
+ */
+ set_if_bigger(char_length, 1 + (unsigned_flag ? 0 : 1));
+ fix_char_length(char_length);
}
virtual void print(String *str, enum_query_type query_type);
uint decimal_precision() const { return args[0]->decimal_precision(); }
diff --git a/sql/item_geofunc.cc b/sql/item_geofunc.cc
index c856aa985b3..7ac2e054e8c 100644
--- a/sql/item_geofunc.cc
+++ b/sql/item_geofunc.cc
@@ -121,6 +121,65 @@ String *Item_func_geometry_from_wkb::val_str(String *str)
}
+void report_json_error_ex(String *js, json_engine_t *je,
+ const char *fname, int n_param,
+ Sql_condition::enum_warning_level lv);
+
+String *Item_func_geometry_from_json::val_str(String *str)
+{
+ DBUG_ASSERT(fixed == 1);
+ Geometry_buffer buffer;
+ String *js= args[0]->val_str_ascii(&tmp_js);
+ uint32 srid= 0;
+ json_engine_t je;
+
+ if ((null_value= args[0]->null_value))
+ return 0;
+
+ if ((arg_count == 2) && !args[1]->null_value)
+ srid= (uint32)args[1]->val_int();
+
+ str->set_charset(&my_charset_bin);
+ if (str->reserve(SRID_SIZE, 512))
+ return 0;
+ str->length(0);
+ str->q_append(srid);
+
+ json_scan_start(&je, js->charset(), (const uchar *) js->ptr(),
+ (const uchar *) js->end());
+
+ if ((null_value= !Geometry::create_from_json(&buffer, &je, str)))
+ {
+ int code= 0;
+
+ switch (je.s.error)
+ {
+ case Geometry::GEOJ_INCORRECT_GEOJSON:
+ code= ER_GEOJSON_INCORRECT;
+ break;
+ case Geometry::GEOJ_TOO_FEW_POINTS:
+ code= ER_GEOJSON_TOO_FEW_POINTS;
+ break;
+ case Geometry::GEOJ_POLYGON_NOT_CLOSED:
+ code= ER_GEOJSON_NOT_CLOSED;
+ break;
+ default:
+ report_json_error_ex(js, &je, func_name(), 0, Sql_condition::WARN_LEVEL_WARN);
+ return NULL;
+ }
+
+ if (code)
+ {
+ THD *thd= current_thd;
+ push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, code,
+ ER_THD(thd, code));
+ }
+ return 0;
+ }
+ return str;
+}
+
+
String *Item_func_as_wkt::val_str_ascii(String *str)
{
DBUG_ASSERT(fixed == 1);
@@ -170,6 +229,37 @@ String *Item_func_as_wkb::val_str(String *str)
}
+void Item_func_as_geojson::fix_length_and_dec()
+{
+ collation.set(default_charset(), DERIVATION_COERCIBLE, MY_REPERTOIRE_ASCII);
+ max_length=MAX_BLOB_WIDTH;
+ maybe_null= 1;
+}
+
+
+String *Item_func_as_geojson::val_str_ascii(String *str)
+{
+ DBUG_ASSERT(fixed == 1);
+ String arg_val;
+ String *swkb= args[0]->val_str(&arg_val);
+ Geometry_buffer buffer;
+ Geometry *geom= NULL;
+ const char *dummy;
+
+ if ((null_value=
+ (args[0]->null_value ||
+ !(geom= Geometry::construct(&buffer, swkb->ptr(), swkb->length())))))
+ return 0;
+
+ str->length(0);
+ str->set_charset(&my_charset_latin1);
+ if ((null_value= geom->as_json(str, FLOATING_POINT_DECIMALS, &dummy)))
+ return 0;
+
+ return str;
+}
+
+
String *Item_func_geometry_type::val_str_ascii(String *str)
{
DBUG_ASSERT(fixed == 1);
diff --git a/sql/item_geofunc.h b/sql/item_geofunc.h
index 1584090c29e..a164f9dec89 100644
--- a/sql/item_geofunc.h
+++ b/sql/item_geofunc.h
@@ -67,6 +67,23 @@ public:
{ return get_item_copy<Item_func_geometry_from_wkb>(thd, mem_root, this); }
};
+
+class Item_func_geometry_from_json: public Item_geometry_func
+{
+ String tmp_js;
+public:
+ Item_func_geometry_from_json(THD *thd, Item *js): Item_geometry_func(thd, js) {}
+ Item_func_geometry_from_json(THD *thd, Item *js, Item *opt):
+ Item_geometry_func(thd, js, opt) {}
+ Item_func_geometry_from_json(THD *thd, Item *js, Item *opt, Item *srid):
+ Item_geometry_func(thd, js, opt, srid) {}
+ const char *func_name() const { return "st_geomfromgeojson"; }
+ String *val_str(String *);
+ Item *get_copy(THD *thd, MEM_ROOT *mem_root)
+ { return get_item_copy<Item_func_geometry_from_json>(thd, mem_root, this); }
+};
+
+
class Item_func_as_wkt: public Item_str_ascii_func
{
public:
@@ -89,6 +106,23 @@ public:
{ return get_item_copy<Item_func_as_wkb>(thd, mem_root, this); }
};
+
+class Item_func_as_geojson: public Item_str_ascii_func
+{
+public:
+ Item_func_as_geojson(THD *thd, Item *js): Item_str_ascii_func(thd, js) {}
+ Item_func_as_geojson(THD *thd, Item *js, Item *max_dec_digits):
+ Item_str_ascii_func(thd, js, max_dec_digits) {}
+ Item_func_as_geojson(THD *thd, Item *js, Item *max_dec_digits, Item *opt):
+ Item_str_ascii_func(thd, js, max_dec_digits, opt) {}
+ const char *func_name() const { return "st_asgeojson"; }
+ void fix_length_and_dec();
+ String *val_str_ascii(String *);
+ Item *get_copy(THD *thd, MEM_ROOT *mem_root)
+ { return get_item_copy<Item_func_as_geojson>(thd, mem_root, this); }
+};
+
+
class Item_func_geometry_type: public Item_str_ascii_func
{
public:
diff --git a/sql/item_jsonfunc.cc b/sql/item_jsonfunc.cc
index a500170ead0..4731bada6ab 100644
--- a/sql/item_jsonfunc.cc
+++ b/sql/item_jsonfunc.cc
@@ -117,9 +117,9 @@ static int st_append_escaped(String *s, const String *a)
report_json_error_ex(js, je, func_name(), n_param, \
Sql_condition::WARN_LEVEL_WARN)
-static void report_json_error_ex(String *js, json_engine_t *je,
- const char *fname, int n_param,
- Sql_condition::enum_warning_level lv)
+void report_json_error_ex(String *js, json_engine_t *je,
+ const char *fname, int n_param,
+ Sql_condition::enum_warning_level lv)
{
THD *thd= current_thd;
int position= (const char *) je->s.c_str - js->ptr();
@@ -168,6 +168,7 @@ static void report_json_error_ex(String *js, json_engine_t *je,
#define NO_WILDCARD_ALLOWED 1
#define SHOULD_END_WITH_ARRAY 2
+#define TRIVIAL_PATH_NOT_ALLOWED 3
#define report_path_error(js, je, n_param) \
report_path_error_ex(js, je, func_name(), n_param,\
@@ -205,6 +206,11 @@ static void report_path_error_ex(String *ps, json_path_t *p,
code= ER_JSON_PATH_NO_WILDCARD;
break;
+ case TRIVIAL_PATH_NOT_ALLOWED:
+ code= ER_JSON_PATH_EMPTY;
+ break;
+
+
default:
return;
}
@@ -547,22 +553,43 @@ void Item_func_json_extract::fix_length_and_dec()
}
+static bool path_exact(const json_path_with_flags *paths_list, int n_paths,
+ const json_path_t *p)
+{
+ for (; n_paths > 0; n_paths--, paths_list++)
+ {
+ if (json_path_compare(&paths_list->p, p) == 0)
+ return TRUE;
+ }
+ return FALSE;
+}
+
+
+static bool path_ok(const json_path_with_flags *paths_list, int n_paths,
+ const json_path_t *p)
+{
+ for (; n_paths > 0; n_paths--, paths_list++)
+ {
+ if (json_path_compare(&paths_list->p, p) >= 0)
+ return TRUE;
+ }
+ return FALSE;
+}
+
+
String *Item_func_json_extract::val_str(String *str)
{
String *js= args[0]->val_str(&tmp_js);
- json_engine_t je;
- bool multiple_values_found= FALSE;
+ json_engine_t je, sav_je;
+ json_path_t p;
const uchar *value;
- const char *first_value= NULL;
- uint n_arg, v_len, first_len;
- uint array_counters[JSON_DEPTH_LIMIT];
+ int not_first_value= 0;
+ uint n_arg, v_len;
+ int possible_multiple_values;
if ((null_value= args[0]->null_value))
return 0;
- str->set_charset(js->charset());
- str->length(0);
-
for (n_arg=1; n_arg < arg_count; n_arg++)
{
json_path_with_flags *c_path= paths + n_arg - 1;
@@ -572,76 +599,69 @@ String *Item_func_json_extract::val_str(String *str)
if (s_p &&
json_path_setup(&c_path->p,s_p->charset(),(const uchar *) s_p->ptr(),
(const uchar *) s_p->ptr() + s_p->length()))
+ {
+ report_path_error(s_p, &c_path->p, n_arg);
goto return_null;
+ }
c_path->parsed= c_path->constant;
}
if (args[n_arg]->null_value)
goto return_null;
+ }
- json_scan_start(&je, js->charset(),(const uchar *) js->ptr(),
- (const uchar *) js->ptr() + js->length());
+ possible_multiple_values= arg_count > 2 ||
+ (paths[0].p.types_used & (JSON_PATH_WILD | JSON_PATH_DOUBLE_WILD));
- c_path->cur_step= c_path->p.steps;
+ str->set_charset(js->charset());
+ str->length(0);
- while (!json_find_path(&je, &c_path->p, &c_path->cur_step, array_counters))
- {
- if (json_read_value(&je))
- goto error;
+ if (possible_multiple_values && str->append("[", 1))
+ goto error;
- value= je.value_begin;
- if (json_value_scalar(&je))
- v_len= je.value_end - value;
- else
- {
- if (json_skip_level(&je))
- goto error;
- v_len= je.s.c_str - value;
- }
+ json_get_path_start(&je, js->charset(),(const uchar *) js->ptr(),
+ (const uchar *) js->ptr() + js->length(), &p);
- if (!multiple_values_found)
- {
- if (first_value == NULL)
- {
- /*
- Just remember the first value as we don't know yet
- if we need to create an array out of it or not.
- */
- first_value= (const char *) value;
- first_len= v_len;
- }
- else
- {
- multiple_values_found= TRUE; /* We have to make an JSON array. */
- if (str->append("[", 1) ||
- str->append(first_value, first_len))
- goto error; /* Out of memory. */
- }
+ while (json_get_path_next(&je, &p) == 0)
+ {
+ if (!path_exact(paths, arg_count-1, &p))
+ continue;
- }
- if (multiple_values_found &&
- (str->append(", ", 2) ||
- str->append((const char *) value, v_len)))
- goto error; /* Out of memory. */
-
- if (json_scan_next(&je))
- break;
+ value= je.value_begin;
+ if (json_value_scalar(&je))
+ v_len= je.value_end - value;
+ else
+ {
+ if (possible_multiple_values)
+ sav_je= je;
+ if (json_skip_level(&je))
+ goto error;
+ v_len= je.s.c_str - value;
+ if (possible_multiple_values)
+ je= sav_je;
}
+
+ if ((not_first_value && str->append(", ", 2)) ||
+ str->append((const char *) value, v_len))
+ goto error; /* Out of memory. */
+
+ not_first_value= 1;
+
+ if (!possible_multiple_values)
+ break;
}
if (je.s.error)
goto error;
- if (first_value == NULL)
+ if (!not_first_value)
{
/* Nothing was found. */
goto return_null;
}
- if (multiple_values_found ?
- str->append("]") :
- str->append(first_value, first_len))
+ if (possible_multiple_values && str->append("]"))
goto error; /* Out of memory. */
return str;
@@ -649,7 +669,6 @@ String *Item_func_json_extract::val_str(String *str)
error:
report_json_error(js, &je, 0);
return_null:
- /* TODO: launch error messages. */
null_value= 1;
return 0;
}
@@ -796,12 +815,14 @@ static int check_contains(json_engine_t *js, json_engine_t *value)
{
while (json_scan_next(js) == 0 && js->state != JST_ARRAY_END)
{
- json_level_t c_level;
+ int c_level, v_scalar;
DBUG_ASSERT(js->state == JST_VALUE);
if (json_read_value(js))
return FALSE;
- c_level= json_value_scalar(js) ? NULL : json_get_level(js);
+ if (!(v_scalar= json_value_scalar(js)))
+ c_level= json_get_level(js);
+
if (check_contains(js, value))
{
if (json_skip_level(js))
@@ -809,7 +830,7 @@ static int check_contains(json_engine_t *js, json_engine_t *value)
return TRUE;
}
if (value->s.error || js->s.error ||
- (c_level && json_skip_to_level(js, c_level)))
+ (!v_scalar && json_skip_to_level(js, c_level)))
return FALSE;
}
return FALSE;
@@ -955,6 +976,8 @@ return_null:
bool Item_func_json_contains_path::fix_fields(THD *thd, Item **ref)
{
return alloc_tmp_paths(thd, arg_count-2, &paths, &tmp_paths) ||
+ (p_found= (bool *) alloc_root(thd->mem_root,
+ (arg_count-2)*sizeof(bool))) == NULL ||
Item_int_func::fix_fields(thd, ref);
}
@@ -1010,6 +1033,7 @@ static int parse_one_or_all(const Item_func *f, Item *ooa_arg,
}
+#ifdef DUMMY
longlong Item_func_json_contains_path::val_int()
{
String *js= args[0]->val_str(&tmp_js);
@@ -1076,6 +1100,87 @@ return_null:
null_value= 1;
return 0;
}
+#endif /*DUMMY*/
+
+longlong Item_func_json_contains_path::val_int()
+{
+ String *js= args[0]->val_str(&tmp_js);
+ json_engine_t je;
+ uint n_arg;
+ longlong result;
+ json_path_t p;
+ int n_found;
+
+ if ((null_value= args[0]->null_value))
+ return 0;
+
+ if (parse_one_or_all(this, args[1], &ooa_parsed, ooa_constant, &mode_one))
+ goto null_return;;
+
+ for (n_arg=2; n_arg < arg_count; n_arg++)
+ {
+ json_path_with_flags *c_path= paths + n_arg - 2;
+ if (!c_path->parsed)
+ {
+ String *s_p= args[n_arg]->val_str(tmp_paths + (n_arg-2));
+ if (s_p &&
+ json_path_setup(&c_path->p,s_p->charset(),(const uchar *) s_p->ptr(),
+ (const uchar *) s_p->ptr() + s_p->length()))
+ {
+ report_path_error(s_p, &c_path->p, n_arg);
+ goto null_return;
+ }
+ c_path->parsed= c_path->constant;
+ }
+ if (args[n_arg]->null_value)
+ goto null_return;
+ }
+
+ json_get_path_start(&je, js->charset(),(const uchar *) js->ptr(),
+ (const uchar *) js->ptr() + js->length(), &p);
+
+
+ if (!mode_one)
+ {
+ bzero(p_found, (arg_count-2) * sizeof(bool));
+ n_found= arg_count - 2;
+ }
+
+ result= 0;
+ while (json_get_path_next(&je, &p) == 0)
+ {
+ int n_path= arg_count - 2;
+ json_path_with_flags *c_path= paths;
+ for (; n_path > 0; n_path--, c_path++)
+ {
+ if (json_path_compare(&c_path->p, &p) >= 0)
+ {
+ if (mode_one)
+ {
+ result= 1;
+ break;
+ }
+ /* mode_all */
+ if (p_found[n_path-1])
+ continue; /* already found */
+ if (--n_found == 0)
+ {
+ result= 1;
+ break;
+ }
+ p_found[n_path-1]= TRUE;
+ }
+ }
+ }
+
+ if (je.s.error == 0)
+ return result;
+
+ report_json_error(js, &je, 0);
+null_return:
+ null_value= 1;
+ return 0;
+}
static int append_json_value(String *str, Item *item, String *tmp_val)
@@ -1626,10 +1731,10 @@ longlong Item_func_json_length::val_int()
{
String *s_p= args[1]->val_str(&tmp_path);
if (s_p &&
- json_path_setup(&path.p, s_p->charset(), (const uchar *) s_p->ptr(),
- (const uchar *) s_p->ptr() + s_p->length()))
+ path_setup_nwc(&path.p, s_p->charset(), (const uchar *) s_p->ptr(),
+ (const uchar *) s_p->ptr() + s_p->length()))
{
- report_path_error(s_p, &path.p, 2);
+ report_path_error(s_p, &path.p, 1);
goto null_return;
}
path.parsed= path.constant;
@@ -1855,6 +1960,9 @@ String *Item_func_json_insert::val_str(String *str)
json_scan_start(&je, js->charset(),(const uchar *) js->ptr(),
(const uchar *) js->ptr() + js->length());
+ if (c_path->p.last_step < c_path->p.steps)
+ goto v_found;
+
c_path->cur_step= c_path->p.steps;
if (c_path->p.last_step >= c_path->p.steps &&
@@ -1875,13 +1983,22 @@ String *Item_func_json_insert::val_str(String *str)
if (je.value_type != JSON_VALUE_ARRAY)
{
const uchar *v_from= je.value_begin;
- if (!mode_insert)
- continue;
+ int do_array_autowrap;
+
+ if (mode_insert)
+ do_array_autowrap= !mode_replace || lp->n_item;
+ else
+ {
+ if (lp->n_item)
+ continue;
+ do_array_autowrap= 0;
+ }
+
str->length(0);
/* Wrap the value as an array. */
if (append_simple(str, js->ptr(), (const char *) v_from - js->ptr()) ||
- str->append("[", 1))
+ (do_array_autowrap && str->append("[", 1)))
goto js_error; /* Out of memory. */
if (je.value_type == JSON_VALUE_OBJECT)
@@ -1890,10 +2007,11 @@ String *Item_func_json_insert::val_str(String *str)
goto js_error;
}
- if (append_simple(str, v_from, je.s.c_str - v_from) ||
- str->append(", ", 2) ||
+ if ((do_array_autowrap &&
+ (append_simple(str, v_from, je.s.c_str - v_from) ||
+ str->append(", ", 2))) ||
append_json_value(str, args[n_arg+1], &tmp_val) ||
- str->append("]", 1) ||
+ (do_array_autowrap && str->append("]", 1)) ||
append_simple(str, je.s.c_str, js->end()-(const char *) je.s.c_str))
goto js_error; /* Out of memory. */
@@ -1925,7 +2043,7 @@ String *Item_func_json_insert::val_str(String *str)
v_to= (const char *) (je.s.c_str - je.sav_c_len);
str->length(0);
if (append_simple(str, js->ptr(), v_to - js->ptr()) ||
- str->append(", ", 2) ||
+ (n_item > 0 && str->append(", ", 2)) ||
append_json_value(str, args[n_arg+1], &tmp_val) ||
append_simple(str, v_to, js->end() - v_to))
goto js_error; /* Out of memory. */
@@ -2040,7 +2158,7 @@ String *Item_func_json_remove::val_str(String *str)
str->set_charset(js->charset());
json_string_set_cs(&key_name, js->charset());
- for (n_arg=1, n_path=0; n_arg < arg_count; n_arg+=2, n_path++)
+ for (n_arg=1, n_path=0; n_arg < arg_count; n_arg++, n_path++)
{
uint array_counters[JSON_DEPTH_LIMIT];
json_path_with_flags *c_path= paths + n_path;
@@ -2064,7 +2182,11 @@ String *Item_func_json_remove::val_str(String *str)
/* We search to the last step. */
c_path->p.last_step--;
if (c_path->p.last_step < c_path->p.steps)
+ {
+ c_path->p.s.error= TRIVIAL_PATH_NOT_ALLOWED;
+ report_path_error(s_p, &c_path->p, n_arg);
goto null_return;
+ }
}
c_path->parsed= c_path->constant;
}
@@ -2371,60 +2493,6 @@ static int append_json_path(String *str, const json_path_t *p)
}
-static int json_path_compare(const json_path_t *a, const json_path_t *b)
-{
- const json_path_step_t *sa= a->steps + 1;
- const json_path_step_t *sb= b->steps + 1;
-
- if (a->last_step - sa > b->last_step - sb)
- return -2;
-
- while (sa <= a->last_step)
- {
- if (sb > b->last_step)
- return -2;
-
- if (!((sa->type & sb->type) & JSON_PATH_KEY_OR_ARRAY))
- goto step_failed;
-
- if (sa->type & JSON_PATH_ARRAY)
- {
- if (!(sa->type & JSON_PATH_WILD) && sa->n_item != sb->n_item)
- goto step_failed;
- }
- else /* JSON_PATH_KEY */
- {
- if (!(sa->type & JSON_PATH_WILD) &&
- (sa->key_end - sa->key != sb->key_end - sb->key ||
- memcmp(sa->key, sb->key, sa->key_end - sa->key) != 0))
- goto step_failed;
- }
- sb++;
- sa++;
- continue;
-
-step_failed:
- if (!(sa->type & JSON_PATH_DOUBLE_WILD))
- return -1;
- sb++;
- }
-
- return sb <= b->last_step;
-}
-
-
-static bool path_ok(const json_path_with_flags *paths_list, int n_paths,
- const json_path_t *p)
-{
- for (; n_paths > 0; n_paths--, paths_list++)
- {
- if (json_path_compare(&paths_list->p, p) >= 0)
- return TRUE;
- }
- return FALSE;
-}
-
-
String *Item_func_json_search::val_str(String *str)
{
String *js= args[0]->val_str(&tmp_js);
@@ -2462,75 +2530,38 @@ String *Item_func_json_search::val_str(String *str)
goto null_return;
}
- json_scan_start(&je, js->charset(),(const uchar *) js->ptr(),
- (const uchar *) js->ptr() + js->length());
-
- p.last_step= p.steps;
- p.steps[0].type= JSON_PATH_ARRAY_WILD;
- p.steps[0].n_item= 0;
+ json_get_path_start(&je, js->charset(),(const uchar *) js->ptr(),
+ (const uchar *) js->ptr() + js->length(), &p);
- do
+ while (json_get_path_next(&je, &p) == 0)
{
- switch (je.state)
+ if (json_value_scalar(&je))
{
- case JST_KEY:
- p.last_step->key= je.s.c_str;
- while (json_read_keyname_chr(&je) == 0)
- p.last_step->key_end= je.s.c_str;
- if (je.s.error)
- goto js_error;
- /* Now we have je.state == JST_VALUE, so let's handle it. */
-
- case JST_VALUE:
- if (json_read_value(&je))
- goto js_error;
- if (json_value_scalar(&je))
+ if ((arg_count < 5 || path_ok(paths, arg_count - 4, &p)) &&
+ compare_json_value_wild(&je, s_str) != 0)
{
- if ((arg_count < 5 || path_ok(paths, n_arg - 4, &p)) &&
- compare_json_value_wild(&je, s_str) != 0)
+ ++n_path_found;
+ if (n_path_found == 1)
{
- ++n_path_found;
- if (n_path_found == 1)
- {
- sav_path= p;
- sav_path.last_step= sav_path.steps + (p.last_step - p.steps);
- }
- else
+ sav_path= p;
+ sav_path.last_step= sav_path.steps + (p.last_step - p.steps);
+ }
+ else
+ {
+ if (n_path_found == 2)
{
- if (n_path_found == 2)
- {
- if (str->append("[", 1) ||
- append_json_path(str, &sav_path))
+ if (str->append("[", 1) ||
+ append_json_path(str, &sav_path))
goto js_error;
- }
- if (str->append(", ", 2) || append_json_path(str, &p))
- goto js_error;
}
-
- if (mode_one)
- goto end;
+ if (str->append(", ", 2) || append_json_path(str, &p))
+ goto js_error;
}
- if (p.last_step->type & JSON_PATH_ARRAY)
- p.last_step->n_item++;
-
+ if (mode_one)
+ goto end;
}
- else
- {
- p.last_step++;
- p.last_step->type= (enum json_path_step_types) je.value_type;
- p.last_step->n_item= 0;
- }
- break;
- case JST_OBJ_END:
- case JST_ARRAY_END:
- p.last_step--;
- if (p.last_step->type & JSON_PATH_ARRAY)
- p.last_step->n_item++;
- break;
- default:
- break;
}
- } while (json_scan_next(&je) == 0);
+ }
if (je.s.error)
goto js_error;
@@ -2556,7 +2587,6 @@ end:
js_error:
report_json_error(js, &je, 0);
null_return:
- /* TODO: launch error messages. */
null_value= 1;
return 0;
}
diff --git a/sql/item_jsonfunc.h b/sql/item_jsonfunc.h
index 07741536f55..2ce94985a00 100644
--- a/sql/item_jsonfunc.h
+++ b/sql/item_jsonfunc.h
@@ -197,6 +197,7 @@ protected:
String *tmp_paths;
bool mode_one;
bool ooa_constant, ooa_parsed;
+ bool *p_found;
public:
Item_func_json_contains_path(THD *thd, List<Item> &list):
diff --git a/sql/item_sum.cc b/sql/item_sum.cc
index 879115d9b3b..12a92a5b911 100644
--- a/sql/item_sum.cc
+++ b/sql/item_sum.cc
@@ -151,6 +151,8 @@ bool Item_sum::check_sum_func(THD *thd, Item **ref)
curr_sel->name_visibility_map);
bool invalid= FALSE;
DBUG_ASSERT(curr_sel->name_visibility_map); // should be set already
+ if (window_func_sum_expr_flag)
+ return false;
/*
The value of max_arg_level is updated if an argument of the set function
contains a column reference resolved against a subquery whose level is
@@ -460,6 +462,7 @@ void Item_sum::mark_as_sum_func()
const_item_cache= false;
with_sum_func= 1;
with_field= 0;
+ window_func_sum_expr_flag= false;
}
diff --git a/sql/item_sum.h b/sql/item_sum.h
index 57750693515..e16459904f6 100644
--- a/sql/item_sum.h
+++ b/sql/item_sum.h
@@ -340,6 +340,9 @@ private:
*/
bool with_distinct;
+ /* TRUE if this is aggregate function of a window function */
+ bool window_func_sum_expr_flag;
+
public:
bool has_force_copy_fields() const { return force_copy_fields; }
@@ -551,6 +554,7 @@ public:
virtual void cleanup();
bool check_vcol_func_processor(void *arg);
virtual void setup_window_func(THD *thd, Window_spec *window_spec) {}
+ void mark_as_window_func_sum_expr() { window_func_sum_expr_flag= true; }
};
diff --git a/sql/lex.h b/sql/lex.h
index c40aa8f546d..baeae088234 100644
--- a/sql/lex.h
+++ b/sql/lex.h
@@ -517,8 +517,8 @@ static SYMBOL symbols[] = {
{ "ROLLUP", SYM(ROLLUP_SYM)},
{ "ROUTINE", SYM(ROUTINE_SYM)},
{ "ROW", SYM(ROW_SYM)},
- { "ROW_COUNT", SYM(ROW_COUNT_SYM)},
{ "ROWS", SYM(ROWS_SYM)},
+ { "ROW_COUNT", SYM(ROW_COUNT_SYM)},
{ "ROW_FORMAT", SYM(ROW_FORMAT_SYM)},
{ "RTREE", SYM(RTREE_SYM)},
{ "SAVEPOINT", SYM(SAVEPOINT_SYM)},
diff --git a/sql/log_event.cc b/sql/log_event.cc
index 0af348ab453..893781223fb 100644
--- a/sql/log_event.cc
+++ b/sql/log_event.cc
@@ -300,17 +300,34 @@ public:
constructor, but it would be possible to create a subclass
holding the IO_CACHE itself.
*/
- Write_on_release_cache(IO_CACHE *cache, FILE *file, flag_set flags = 0)
- : m_cache(cache), m_file(file), m_flags(flags)
+ Write_on_release_cache(IO_CACHE *cache, FILE *file, flag_set flags = 0, Log_event *ev = NULL)
+ : m_cache(cache), m_file(file), m_flags(flags), m_ev(ev)
{
reinit_io_cache(m_cache, WRITE_CACHE, 0L, FALSE, TRUE);
}
~Write_on_release_cache()
{
+#ifdef MYSQL_CLIENT
+ if(m_ev == NULL)
+ {
+ copy_event_cache_to_file_and_reinit(m_cache, m_file);
+ if (m_flags & FLUSH_F)
+ fflush(m_file);
+ }
+ else // if m_ev<>NULL, then storing the output in output_buf
+ {
+ LEX_STRING tmp_str;
+ if (copy_event_cache_to_string_and_reinit(m_cache, &tmp_str))
+ exit(1);
+ m_ev->output_buf.append(tmp_str.str, tmp_str.length);
+ my_free(tmp_str.str);
+ }
+#else /* MySQL_SERVER */
copy_event_cache_to_file_and_reinit(m_cache, m_file);
if (m_flags & FLUSH_F)
fflush(m_file);
+#endif
}
/*
@@ -340,6 +357,7 @@ private:
IO_CACHE *m_cache;
FILE *m_file;
flag_set m_flags;
+ Log_event *m_ev; // Used for Flashback
};
/*
@@ -2760,7 +2778,7 @@ log_event_print_value(IO_CACHE *file, const uchar *ptr,
d= (ulong) (i64 / 1000000);
t= (ulong) (i64 % 1000000);
- my_b_printf(file, "%04d-%02d-%02d %02d:%02d:%02d",
+ my_b_printf(file, "'%04d-%02d-%02d %02d:%02d:%02d'",
(int) (d / 10000), (int) (d % 10000) / 100, (int) (d % 100),
(int) (t / 10000), (int) (t % 10000) / 100, (int) t % 100);
return 8;
@@ -2994,22 +3012,30 @@ size_t
Rows_log_event::print_verbose_one_row(IO_CACHE *file, table_def *td,
PRINT_EVENT_INFO *print_event_info,
MY_BITMAP *cols_bitmap,
- const uchar *value, const uchar *prefix)
+ const uchar *value, const uchar *prefix,
+ const my_bool no_fill_output)
{
const uchar *value0= value;
const uchar *null_bits= value;
uint null_bit_index= 0;
char typestr[64]= "";
-
+
+#ifdef WHEN_FLASHBACK_REVIEW_READY
+ /* Storing the review SQL */
+ IO_CACHE *review_sql= &print_event_info->review_sql_cache;
+ LEX_STRING review_str;
+#endif
+
/*
Skip metadata bytes which gives the information about nullabity of master
columns. Master writes one bit for each affected column.
*/
value+= (bitmap_bits_set(cols_bitmap) + 7) / 8;
-
- my_b_printf(file, "%s", prefix);
-
+
+ if (!no_fill_output)
+ my_b_printf(file, "%s", prefix);
+
for (size_t i= 0; i < td->size(); i ++)
{
size_t size;
@@ -3018,41 +3044,102 @@ Rows_log_event::print_verbose_one_row(IO_CACHE *file, table_def *td,
if (bitmap_is_set(cols_bitmap, i) == 0)
continue;
-
- my_b_printf(file, "### @%d=", static_cast<int>(i + 1));
+
+ if (!no_fill_output)
+ my_b_printf(file, "### @%d=", static_cast<int>(i + 1));
+
if (!is_null)
{
size_t fsize= td->calc_field_size((uint)i, (uchar*) value);
if (value + fsize > m_rows_end)
{
- my_b_printf(file, "***Corrupted replication event was detected."
- " Not printing the value***\n");
+ if (!no_fill_output)
+ my_b_printf(file, "***Corrupted replication event was detected."
+ " Not printing the value***\n");
value+= fsize;
return 0;
}
}
- if (!(size= log_event_print_value(file,is_null? NULL: value,
- td->type(i), td->field_metadata(i),
- typestr, sizeof(typestr))))
+
+ if (!no_fill_output)
+ {
+ size= log_event_print_value(file,is_null? NULL: value,
+ td->type(i), td->field_metadata(i),
+ typestr, sizeof(typestr));
+#ifdef WHEN_FLASHBACK_REVIEW_READY
+ if (need_flashback_review)
+ {
+ String tmp_str, hex_str;
+ IO_CACHE tmp_cache;
+
+ // Using a tmp IO_CACHE to get the value output
+ open_cached_file(&tmp_cache, NULL, NULL, 0, MYF(MY_WME | MY_NABP));
+ size= log_event_print_value(&tmp_cache, is_null? NULL: value,
+ td->type(i), td->field_metadata(i),
+ typestr, sizeof(typestr));
+ if (copy_event_cache_to_string_and_reinit(&tmp_cache, &review_str))
+ exit(1);
+ close_cached_file(&tmp_cache);
+
+ switch (td->type(i)) // Converting a string to HEX format
+ {
+ case MYSQL_TYPE_VARCHAR:
+ case MYSQL_TYPE_VAR_STRING:
+ case MYSQL_TYPE_STRING:
+ case MYSQL_TYPE_BLOB:
+ // Avoid write_pos changed to a new area
+ // tmp_str.free();
+ tmp_str.append(review_str.str + 1, review_str.length - 2); // Removing quotation marks
+ if (hex_str.alloc(tmp_str.length()*2+1)) // If out of memory
+ {
+ fprintf(stderr, "\nError: Out of memory. "
+ "Could not print correct binlog event.\n");
+ exit(1);
+ }
+ octet2hex((char*) hex_str.ptr(), tmp_str.ptr(), tmp_str.length());
+ my_b_printf(review_sql, ", UNHEX('%s')", hex_str.ptr());
+ break;
+ default:
+ tmp_str.free();
+ tmp_str.append(review_str.str, review_str.length);
+ my_b_printf(review_sql, ", %s", tmp_str.ptr());
+ break;
+ }
+ my_free(revieww_str.str);
+ }
+#endif
+ }
+ else
+ {
+ IO_CACHE tmp_cache;
+ open_cached_file(&tmp_cache, NULL, NULL, 0, MYF(MY_WME | MY_NABP));
+ size= log_event_print_value(&tmp_cache,is_null? NULL: value,
+ td->type(i), td->field_metadata(i),
+ typestr, sizeof(typestr));
+ close_cached_file(&tmp_cache);
+ }
+
+ if (!size)
return 0;
if (!is_null)
value+= size;
- if (print_event_info->verbose > 1)
+ if (print_event_info->verbose > 1 && !no_fill_output)
{
my_b_write(file, (uchar*)" /* ", 4);
my_b_printf(file, "%s ", typestr);
-
+
my_b_printf(file, "meta=%d nullable=%d is_null=%d ",
td->field_metadata(i),
td->maybe_null(i), is_null);
my_b_write(file, (uchar*)"*/", 2);
}
-
- my_b_write_byte(file, '\n');
-
+
+ if (!no_fill_output)
+ my_b_write_byte(file, '\n');
+
null_bit_index++;
}
return value - value0;
@@ -3060,6 +3147,124 @@ Rows_log_event::print_verbose_one_row(IO_CACHE *file, table_def *td,
/**
+ Exchange the SET part and WHERE part for the Update events.
+ Revert the operations order for the Write and Delete events.
+ And then revert the events order from the last one to the first one.
+
+ @param[in] print_event_info PRINT_EVENT_INFO
+ @param[in] rows_buff Packed event buff
+*/
+
+void Rows_log_event::change_to_flashback_event(PRINT_EVENT_INFO *print_event_info,
+ uchar *rows_buff, Log_event_type ev_type)
+{
+ Table_map_log_event *map;
+ table_def *td;
+ DYNAMIC_ARRAY rows_arr;
+ uchar *swap_buff1, *swap_buff2;
+ uchar *rows_pos= rows_buff + m_rows_before_size;
+
+ if (!(map= print_event_info->m_table_map.get_table(m_table_id)) ||
+ !(td= map->create_table_def()))
+ return;
+
+ /* If the write rows event contained no values for the AI */
+ if (((get_general_type_code() == WRITE_ROWS_EVENT) && (m_rows_buf==m_rows_end)))
+ goto end;
+
+ (void) my_init_dynamic_array(&rows_arr, sizeof(LEX_STRING), 8, 8, MYF(0));
+
+ for (uchar *value= m_rows_buf; value < m_rows_end; )
+ {
+ uchar *start_pos= value;
+ size_t length1= 0;
+ if (!(length1= print_verbose_one_row(NULL, td, print_event_info,
+ &m_cols, value,
+ (const uchar*) "", TRUE)))
+ {
+ fprintf(stderr, "\nError row length: %zu\n", length1);
+ exit(1);
+ }
+ value+= length1;
+
+ swap_buff1= (uchar *) my_malloc(length1, MYF(0));
+ if (!swap_buff1)
+ {
+ fprintf(stderr, "\nError: Out of memory. "
+ "Could not exchange to flashback event.\n");
+ exit(1);
+ }
+ memcpy(swap_buff1, start_pos, length1);
+
+ // For Update_event, we have the second part
+ size_t length2= 0;
+ if (ev_type == UPDATE_ROWS_EVENT ||
+ ev_type == UPDATE_ROWS_EVENT_V1)
+ {
+ if (!(length2= print_verbose_one_row(NULL, td, print_event_info,
+ &m_cols, value,
+ (const uchar*) "", TRUE)))
+ {
+ fprintf(stderr, "\nError row length: %zu\n", length2);
+ exit(1);
+ }
+ value+= length2;
+
+ swap_buff2= (uchar *) my_malloc(length2, MYF(0));
+ if (!swap_buff2)
+ {
+ fprintf(stderr, "\nError: Out of memory. "
+ "Could not exchange to flashback event.\n");
+ 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);
+ }
+
+ /* 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;
+
+ one_row.length= length1 + length2;
+ one_row.str= (char *) my_malloc(one_row.length, MYF(0));
+ memcpy(one_row.str, start_pos, one_row.length);
+ if (one_row.str == NULL || push_dynamic(&rows_arr, (uchar *) &one_row))
+ {
+ fprintf(stderr, "\nError: Out of memory. "
+ "Could not push flashback event into array.\n");
+ exit(1);
+ }
+ }
+
+ /* Copying rows from the end to the begining into event */
+ for (uint i= rows_arr.elements; i > 0; --i)
+ {
+ LEX_STRING *one_row= dynamic_element(&rows_arr, i - 1, LEX_STRING*);
+
+ memcpy(rows_pos, (uchar *)one_row->str, one_row->length);
+ rows_pos+= one_row->length;
+ my_free(one_row->str);
+ }
+ delete_dynamic(&rows_arr);
+
+end:
+ delete td;
+}
+
+
+/**
Print a row event into IO cache in human readable form (in SQL format)
@param[in] file IO cache
@@ -3071,8 +3276,12 @@ void Rows_log_event::print_verbose(IO_CACHE *file,
Table_map_log_event *map;
table_def *td;
const char *sql_command, *sql_clause1, *sql_clause2;
+ const char *sql_command_short __attribute__((unused));
Log_event_type general_type_code= get_general_type_code();
-
+#ifdef WHEN_FLASHBACK_REVIEW_READY
+ IO_CACHE *review_sql= &print_event_info->review_sql_cache;
+#endif
+
if (m_extra_row_data)
{
uint8 extra_data_len= m_extra_row_data[EXTRA_ROW_INFO_LEN_OFFSET];
@@ -3102,19 +3311,23 @@ void Rows_log_event::print_verbose(IO_CACHE *file,
sql_command= "INSERT INTO";
sql_clause1= "### SET\n";
sql_clause2= NULL;
+ sql_command_short= "I";
break;
case DELETE_ROWS_EVENT:
sql_command= "DELETE FROM";
sql_clause1= "### WHERE\n";
sql_clause2= NULL;
+ sql_command_short= "D";
break;
case UPDATE_ROWS_EVENT:
sql_command= "UPDATE";
sql_clause1= "### WHERE\n";
sql_clause2= "### SET\n";
+ sql_command_short= "U";
break;
default:
sql_command= sql_clause1= sql_clause2= NULL;
+ sql_command_short= "";
DBUG_ASSERT(0); /* Not possible */
}
@@ -3140,6 +3353,13 @@ void Rows_log_event::print_verbose(IO_CACHE *file,
my_b_printf(file, "### %s %`s.%`s\n",
sql_command,
map->get_db_name(), map->get_table_name());
+
+#ifdef WHEN_FLASHBACK_REVIEW_READY
+ if (need_flashback_review)
+ my_b_printf(review_sql, "\nINSERT INTO `%s`.`%s` VALUES ('%s'",
+ map->get_review_dbname(), map->get_review_tablename(), sql_command_short);
+#endif
+
/* Print the first image */
if (!(length= print_verbose_one_row(file, td, print_event_info,
&m_cols, value,
@@ -3156,6 +3376,17 @@ void Rows_log_event::print_verbose(IO_CACHE *file,
goto end;
value+= length;
}
+#ifdef WHEN_FLASHBACK_REVIEW_READY
+ else
+ {
+ if (need_flashback_review)
+ for (size_t i= 0; i < td->size(); i ++)
+ my_b_printf(review_sql, ", NULL");
+ }
+
+ if (need_flashback_review)
+ my_b_printf(review_sql, ")%s\n", print_event_info->delimiter);
+#endif
}
end:
@@ -3171,7 +3402,7 @@ void Log_event::print_base64(IO_CACHE* file,
PRINT_EVENT_INFO* print_event_info,
bool more)
{
- const uchar *ptr= (const uchar *)temp_buf;
+ uchar *ptr= (uchar *)temp_buf;
uint32 size= uint4korr(ptr + EVENT_LEN_OFFSET);
DBUG_ENTER("Log_event::print_base64");
@@ -3183,6 +3414,51 @@ void Log_event::print_base64(IO_CACHE* file,
DBUG_VOID_RETURN;
}
+ if (is_flashback)
+ {
+ uint tmp_size= size;
+ Rows_log_event *ev= NULL;
+ Log_event_type ev_type = (enum Log_event_type) ptr[EVENT_TYPE_OFFSET];
+ if (checksum_alg != BINLOG_CHECKSUM_ALG_UNDEF &&
+ checksum_alg != BINLOG_CHECKSUM_ALG_OFF)
+ tmp_size-= BINLOG_CHECKSUM_LEN; // checksum is displayed through the header
+ switch (ev_type) {
+ case WRITE_ROWS_EVENT:
+ ptr[EVENT_TYPE_OFFSET]= DELETE_ROWS_EVENT;
+ ev= new Delete_rows_log_event((const char*) ptr, tmp_size,
+ glob_description_event);
+ ev->change_to_flashback_event(print_event_info, ptr, ev_type);
+ break;
+ case WRITE_ROWS_EVENT_V1:
+ ptr[EVENT_TYPE_OFFSET]= DELETE_ROWS_EVENT_V1;
+ ev= new Delete_rows_log_event((const char*) ptr, tmp_size,
+ glob_description_event);
+ ev->change_to_flashback_event(print_event_info, ptr, ev_type);
+ break;
+ case DELETE_ROWS_EVENT:
+ ptr[EVENT_TYPE_OFFSET]= WRITE_ROWS_EVENT;
+ ev= new Write_rows_log_event((const char*) ptr, tmp_size,
+ glob_description_event);
+ ev->change_to_flashback_event(print_event_info, ptr, ev_type);
+ break;
+ case DELETE_ROWS_EVENT_V1:
+ ptr[EVENT_TYPE_OFFSET]= WRITE_ROWS_EVENT_V1;
+ ev= new Write_rows_log_event((const char*) ptr, tmp_size,
+ glob_description_event);
+ ev->change_to_flashback_event(print_event_info, ptr, ev_type);
+ break;
+ case UPDATE_ROWS_EVENT:
+ case UPDATE_ROWS_EVENT_V1:
+ ev= new Update_rows_log_event((const char*) ptr, tmp_size,
+ glob_description_event);
+ ev->change_to_flashback_event(print_event_info, ptr, ev_type);
+ break;
+ default:
+ break;
+ }
+ delete ev;
+ }
+
if (my_base64_encode(ptr, (size_t) size, tmp_str))
{
DBUG_ASSERT(0);
@@ -3198,8 +3474,12 @@ void Log_event::print_base64(IO_CACHE* file,
if (!more)
my_b_printf(file, "'%s\n", print_event_info->delimiter);
}
-
+
+#ifdef WHEN_FLASHBACK_REVIEW_READY
+ if (print_event_info->verbose || need_flashback_review)
+#else
if (print_event_info->verbose)
+#endif
{
Rows_log_event *ev= NULL;
Log_event_type et= (Log_event_type) ptr[EVENT_TYPE_OFFSET];
@@ -3207,7 +3487,7 @@ void Log_event::print_base64(IO_CACHE* file,
if (checksum_alg != BINLOG_CHECKSUM_ALG_UNDEF &&
checksum_alg != BINLOG_CHECKSUM_ALG_OFF)
size-= BINLOG_CHECKSUM_LEN; // checksum is displayed through the header
-
+
switch (et)
{
case TABLE_MAP_EVENT:
@@ -3215,6 +3495,13 @@ void Log_event::print_base64(IO_CACHE* file,
Table_map_log_event *map;
map= new Table_map_log_event((const char*) ptr, size,
glob_description_event);
+#ifdef WHEN_FLASHBACK_REVIEW_READY
+ if (need_flashback_review)
+ {
+ map->set_review_dbname(m_review_dbname.ptr());
+ map->set_review_tablename(m_review_tablename.ptr());
+ }
+#endif
print_event_info->m_table_map.set_table(map->get_table_id(), map);
break;
}
@@ -3263,14 +3550,27 @@ void Log_event::print_base64(IO_CACHE* file,
default:
break;
}
-
+
if (ev)
{
+#ifdef WHEN_FLASHBACK_REVIEW_READY
+ ev->need_flashback_review= need_flashback_review;
+ if (print_event_info->verbose)
+ ev->print_verbose(file, print_event_info);
+ else
+ {
+ IO_CACHE tmp_cache;
+ open_cached_file(&tmp_cache, NULL, NULL, 0, MYF(MY_WME | MY_NABP));
+ ev->print_verbose(&tmp_cache, print_event_info);
+ close_cached_file(&tmp_cache);
+ }
+#else
ev->print_verbose(file, print_event_info);
+#endif
delete ev;
}
}
-
+
my_free(tmp_str);
DBUG_VOID_RETURN;
}
@@ -4631,7 +4931,7 @@ void Query_log_event::print_query_header(IO_CACHE* file,
void Query_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info)
{
- Write_on_release_cache cache(&print_event_info->head_cache, file);
+ Write_on_release_cache cache(&print_event_info->head_cache, file, 0, this);
/**
reduce the size of io cache so that the write function is called
@@ -4640,8 +4940,24 @@ void Query_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info)
DBUG_EXECUTE_IF ("simulate_file_write_error",
{(&cache)->write_pos= (&cache)->write_end- 500;});
print_query_header(&cache, print_event_info);
- my_b_write(&cache, (uchar*) query, q_len);
- my_b_printf(&cache, "\n%s\n", print_event_info->delimiter);
+ if (!is_flashback)
+ {
+ my_b_write(&cache, (uchar*) query, q_len);
+ my_b_printf(&cache, "\n%s\n", print_event_info->delimiter);
+ }
+ else // is_flashback == 1
+ {
+ if (strcmp("BEGIN", query) == 0)
+ {
+ my_b_write(&cache, (uchar*) "COMMIT", 6);
+ my_b_printf(&cache, "\n%s\n", print_event_info->delimiter);
+ }
+ else if (strcmp("COMMIT", query) == 0)
+ {
+ my_b_write(&cache, (uchar*) "BEGIN", 5);
+ my_b_printf(&cache, "\n%s\n", print_event_info->delimiter);
+ }
+ }
}
#endif /* MYSQL_CLIENT */
@@ -7351,11 +7667,11 @@ void
Gtid_log_event::print(FILE *file, PRINT_EVENT_INFO *print_event_info)
{
Write_on_release_cache cache(&print_event_info->head_cache, file,
- Write_on_release_cache::FLUSH_F);
+ Write_on_release_cache::FLUSH_F, this);
char buf[21];
char buf2[21];
- if (!print_event_info->short_form)
+ if (!print_event_info->short_form & !is_flashback)
{
print_header(&cache, print_event_info, FALSE);
longlong10_to_str(seq_no, buf, 10);
@@ -7401,11 +7717,12 @@ Gtid_log_event::print(FILE *file, PRINT_EVENT_INFO *print_event_info)
print_event_info->server_id_printed= true;
}
- my_b_printf(&cache, "/*!100001 SET @@session.gtid_seq_no=%s*/%s\n",
- buf, print_event_info->delimiter);
+ if (!is_flashback)
+ my_b_printf(&cache, "/*!100001 SET @@session.gtid_seq_no=%s*/%s\n",
+ buf, print_event_info->delimiter);
}
if (!(flags2 & FL_STANDALONE))
- my_b_printf(&cache, "BEGIN\n%s\n", print_event_info->delimiter);
+ my_b_printf(&cache, is_flashback ? "COMMIT\n%s\n" : "BEGIN\n%s\n", print_event_info->delimiter);
}
#endif /* MYSQL_SERVER */
@@ -8047,7 +8364,7 @@ bool Xid_log_event::write()
void Xid_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info)
{
Write_on_release_cache cache(&print_event_info->head_cache, file,
- Write_on_release_cache::FLUSH_F);
+ Write_on_release_cache::FLUSH_F, this);
if (!print_event_info->short_form)
{
@@ -8057,7 +8374,7 @@ void Xid_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info)
print_header(&cache, print_event_info, FALSE);
my_b_printf(&cache, "\tXid = %s\n", buf);
}
- my_b_printf(&cache, "COMMIT%s\n", print_event_info->delimiter);
+ my_b_printf(&cache, is_flashback ? "BEGIN%s\n" : "COMMIT%s\n", print_event_info->delimiter);
}
#endif /* MYSQL_CLIENT */
@@ -8706,7 +9023,7 @@ void Unknown_log_event::print(FILE* file_arg, PRINT_EVENT_INFO* print_event_info
void Stop_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info)
{
Write_on_release_cache cache(&print_event_info->head_cache, file,
- Write_on_release_cache::FLUSH_F);
+ Write_on_release_cache::FLUSH_F, this);
if (print_event_info->short_form)
return;
@@ -10042,6 +10359,7 @@ Rows_log_event::Rows_log_event(const char *buf, uint event_len,
m_rows_end= m_rows_buf + data_size;
m_rows_cur= m_rows_end;
memcpy(m_rows_buf, ptr_rows_data, data_size);
+ m_rows_before_size= ptr_rows_data - (const uchar *) buf; // Get the size that before SET part
}
else
m_cols.bitmap= 0; // to not free it
@@ -10958,6 +11276,10 @@ 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;
+#ifdef WHEN_FLASHBACK_REVIEW_READY
+ IO_CACHE *const sql= &print_event_info->review_sql_cache;
+#endif
+
if (!print_event_info->short_form)
{
bool const last_stmt_event= get_flags(STMT_END_F);
@@ -10970,8 +11292,19 @@ void Rows_log_event::print_helper(FILE *file,
if (get_flags(STMT_END_F))
{
- copy_event_cache_to_file_and_reinit(head, file);
- copy_event_cache_to_file_and_reinit(body, file);
+ reinit_io_cache(head, READ_CACHE, 0L, FALSE, FALSE);
+ output_buf.append(head, head->end_of_file);
+ reinit_io_cache(head, WRITE_CACHE, 0, FALSE, TRUE);
+
+ reinit_io_cache(body, READ_CACHE, 0L, FALSE, FALSE);
+ output_buf.append(body, body->end_of_file);
+ reinit_io_cache(body, WRITE_CACHE, 0, FALSE, TRUE);
+
+#ifdef WHEN_FLASHBACK_REVIEW_READY
+ reinit_io_cache(sql, READ_CACHE, 0L, FALSE, FALSE);
+ output_buf.append(sql, sql->end_of_file);
+ reinit_io_cache(sql, WRITE_CACHE, 0, FALSE, TRUE);
+#endif
}
}
#endif
@@ -12374,7 +12707,7 @@ void Write_rows_log_event::print(FILE *file, PRINT_EVENT_INFO* print_event_info)
{
DBUG_EXECUTE_IF("simulate_cache_read_error",
{DBUG_SET("+d,simulate_my_b_fill_error");});
- Rows_log_event::print_helper(file, print_event_info, "Write_rows");
+ Rows_log_event::print_helper(file, print_event_info, is_flashback ? "Delete_rows" : "Write_rows");
}
void Write_rows_compressed_log_event::print(FILE *file,
@@ -13048,7 +13381,7 @@ int Delete_rows_log_event::do_exec_row(rpl_group_info *rgi)
void Delete_rows_log_event::print(FILE *file,
PRINT_EVENT_INFO* print_event_info)
{
- Rows_log_event::print_helper(file, print_event_info, "Delete_rows");
+ Rows_log_event::print_helper(file, print_event_info, is_flashback ? "Write_rows" : "Delete_rows");
}
void Delete_rows_compressed_log_event::print(FILE *file,
@@ -13600,6 +13933,9 @@ 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);
+#ifdef WHEN_FLASHBACK_REVIEW_READY
+ open_cached_file(&review_sql_cache, NULL, NULL, 0, flags);
+#endif
}
#endif
diff --git a/sql/log_event.h b/sql/log_event.h
index 7b8704636af..c2829a9bb10 100644
--- a/sql/log_event.h
+++ b/sql/log_event.h
@@ -41,6 +41,7 @@
#include "rpl_utility.h"
#include "hash.h"
#include "rpl_tblmap.h"
+#include "sql_string.h"
#endif
#ifdef MYSQL_SERVER
@@ -52,7 +53,9 @@
#include "rpl_gtid.h"
/* Forward declarations */
+#ifndef MYSQL_CLIENT
class String;
+#endif
#define PREFIX_SQL_LOAD "SQL_LOAD-"
#define LONG_FIND_ROW_THRESHOLD 60 /* seconds */
@@ -845,9 +848,16 @@ typedef struct st_print_event_info
~st_print_event_info() {
close_cached_file(&head_cache);
close_cached_file(&body_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)
+#ifdef WHEN_FLASHBACK_REVIEW_READY
+ && my_b_inited(&review_sql_cache)
+#endif
+ ; }
/* Settings on how to print the events */
@@ -875,6 +885,10 @@ typedef struct st_print_event_info
*/
IO_CACHE head_cache;
IO_CACHE body_cache;
+#ifdef WHEN_FLASHBACK_REVIEW_READY
+ /* Storing the SQL for reviewing */
+ IO_CACHE review_sql_cache;
+#endif
} PRINT_EVENT_INFO;
#endif
@@ -1223,6 +1237,37 @@ public:
void print_base64(IO_CACHE* file, PRINT_EVENT_INFO* print_event_info,
bool is_more);
#endif
+
+ /* The following code used for Flashback */
+#ifdef MYSQL_CLIENT
+ my_bool is_flashback;
+ my_bool need_flashback_review;
+ String output_buf; // Storing the event output
+#ifdef WHEN_FLASHBACK_REVIEW_READY
+ String m_review_dbname;
+ String m_review_tablename;
+
+ void set_review_dbname(const char *name)
+ {
+ if (name)
+ {
+ m_review_dbname.free();
+ m_review_dbname.append(name);
+ }
+ }
+ void set_review_tablename(const char *name)
+ {
+ if (name)
+ {
+ m_review_tablename.free();
+ m_review_tablename.append(name);
+ }
+ }
+ const char *get_review_dbname() const { return m_review_dbname.ptr(); }
+ const char *get_review_tablename() const { return m_review_tablename.ptr(); }
+#endif
+#endif
+
/*
read_log_event() functions read an event from a binlog or relay
log; used by SHOW BINLOG EVENTS, the binlog_dump thread on the
@@ -4362,12 +4407,14 @@ public:
#ifdef MYSQL_CLIENT
/* not for direct call, each derived has its own ::print() */
virtual void print(FILE *file, PRINT_EVENT_INFO *print_event_info)= 0;
+ void change_to_flashback_event(PRINT_EVENT_INFO *print_event_info, uchar *rows_buff, Log_event_type ev_type);
void print_verbose(IO_CACHE *file,
PRINT_EVENT_INFO *print_event_info);
size_t print_verbose_one_row(IO_CACHE *file, table_def *td,
PRINT_EVENT_INFO *print_event_info,
MY_BITMAP *cols_bitmap,
- const uchar *ptr, const uchar *prefix);
+ const uchar *ptr, const uchar *prefix,
+ const my_bool no_fill_output= 0); // if no_fill_output=1, then print result is unnecessary
#endif
#ifdef MYSQL_SERVER
@@ -4506,6 +4553,8 @@ protected:
uchar *m_rows_cur; /* One-after the end of the data */
uchar *m_rows_end; /* One-after the end of the allocated space */
+ size_t m_rows_before_size; /* The length before m_rows_buf */
+
flag_set m_flags; /* Flags for row-level events */
Log_event_type m_type; /* Actual event type */
@@ -5040,6 +5089,29 @@ public:
};
+static inline bool copy_event_cache_to_string_and_reinit(IO_CACHE *cache, LEX_STRING *to)
+{
+ String tmp;
+
+ reinit_io_cache(cache, READ_CACHE, 0L, FALSE, FALSE);
+ if (tmp.append(cache, cache->end_of_file))
+ goto err;
+ reinit_io_cache(cache, WRITE_CACHE, 0, FALSE, TRUE);
+
+ /*
+ Can't change the order, because the String::release() will clear the
+ length.
+ */
+ to->length= tmp.length();
+ to->str= tmp.release();
+
+ return false;
+
+err:
+ perror("Out of memory: can't allocate memory in copy_event_cache_to_string_and_reinit().");
+ return true;
+}
+
static inline bool copy_event_cache_to_file_and_reinit(IO_CACHE *cache,
FILE *file)
{
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index 171f11a7326..3b0843f1cb4 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, 2016, MariaDB
+ Copyright (c) 2008, 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
@@ -385,7 +385,7 @@ bool opt_bin_log_compress;
uint opt_bin_log_compress_min_len;
my_bool opt_log, debug_assert_if_crashed_table= 0, opt_help= 0;
my_bool debug_assert_on_not_freed_memory= 0;
-my_bool disable_log_notes;
+my_bool disable_log_notes, opt_support_flashback= 0;
static my_bool opt_abort;
ulonglong log_output_options;
my_bool opt_userstat_running;
@@ -4079,8 +4079,8 @@ extern "C" {
static void my_malloc_size_cb_func(long long size, my_bool is_thread_specific)
{
THD *thd= current_thd;
-
- if (likely(is_thread_specific)) /* If thread specific memory */
+
+ if (is_thread_specific) /* If thread specific memory */
{
/*
When thread specfic is set, both mysqld_server_initialized and thd
@@ -4092,14 +4092,22 @@ static void my_malloc_size_cb_func(long long size, my_bool is_thread_specific)
(longlong) thd->status_var.local_memory_used,
size));
thd->status_var.local_memory_used+= size;
+ if (thd->status_var.local_memory_used > (int64)thd->variables.max_mem_used &&
+ !thd->killed)
+ {
+ char buf[1024];
+ thd->killed= KILL_QUERY;
+ my_snprintf(buf, sizeof(buf), "--max-thread-mem-used=%llu",
+ thd->variables.max_mem_used);
+ my_error(ER_OPTION_PREVENTS_STATEMENT, MYF(0), buf);
+ }
DBUG_ASSERT((longlong) thd->status_var.local_memory_used >= 0 ||
!debug_assert_on_not_freed_memory);
}
else if (likely(thd))
{
DBUG_PRINT("info", ("global thd memory_used: %lld size: %lld",
- (longlong) thd->status_var.global_memory_used,
- size));
+ (longlong) thd->status_var.global_memory_used, size));
thd->status_var.global_memory_used+= size;
}
else
@@ -7397,6 +7405,10 @@ struct my_option my_long_options[]=
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
/* We must always support the next option to make scripts like mysqltest
easier to do */
+ {"flashback", 0,
+ "Setup the server to use flashback. This enables binary log in row mode and will enable extra logging for DDL's needed by flashback feature",
+ &opt_support_flashback, &opt_support_flashback,
+ 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"gdb", 0,
"Set up signals usable for debugging. Deprecated, use --debug-gdb instead.",
&opt_debugging, &opt_debugging,
@@ -9571,6 +9583,18 @@ static int get_options(int *argc_ptr, char ***argv_ptr)
else
global_system_variables.option_bits&= ~OPTION_BIG_SELECTS;
+ if (opt_support_flashback)
+ {
+ /* Force binary logging */
+ if (!opt_bin_logname)
+ opt_bin_logname= (char*) ""; // Use default name
+ opt_bin_log= opt_bin_log_used= 1;
+
+ /* Force format to row */
+ binlog_format_used= 1;
+ global_system_variables.binlog_format= BINLOG_FORMAT_ROW;
+ }
+
if (!opt_bootstrap && WSREP_PROVIDER_EXISTS &&
global_system_variables.binlog_format != BINLOG_FORMAT_ROW)
{
diff --git a/sql/mysqld.h b/sql/mysqld.h
index 96944c012ce..9022b8cef03 100644
--- a/sql/mysqld.h
+++ b/sql/mysqld.h
@@ -114,6 +114,7 @@ extern uint opt_bin_log_compress_min_len;
extern my_bool opt_log, opt_bootstrap;
extern my_bool opt_backup_history_log;
extern my_bool opt_backup_progress_log;
+extern my_bool opt_support_flashback;
extern ulonglong log_output_options;
extern ulong log_backup_output_options;
extern my_bool opt_log_queries_not_using_indexes;
diff --git a/sql/opt_subselect.cc b/sql/opt_subselect.cc
index 461a2107437..5617b0c7212 100644
--- a/sql/opt_subselect.cc
+++ b/sql/opt_subselect.cc
@@ -4053,13 +4053,13 @@ SJ_TMP_TABLE::create_sj_weedout_tmp_table(THD *thd)
share->db_plugin= ha_lock_engine(0, TMP_ENGINE_HTON);
table->file= get_new_handler(share, &table->mem_root,
share->db_type());
- DBUG_ASSERT(uniq_tuple_length_arg <= table->file->max_key_length());
}
else
{
share->db_plugin= ha_lock_engine(0, heap_hton);
table->file= get_new_handler(share, &table->mem_root,
share->db_type());
+ DBUG_ASSERT(uniq_tuple_length_arg <= table->file->max_key_length());
}
if (!table->file)
goto err;
diff --git a/sql/share/errmsg-utf8.txt b/sql/share/errmsg-utf8.txt
index 69e0698a3b6..a0757644558 100644
--- a/sql/share/errmsg-utf8.txt
+++ b/sql/share/errmsg-utf8.txt
@@ -7438,5 +7438,15 @@ ER_JSON_PATH_ARRAY
eng "JSON path should end with an array identifier in argument %d to function '%s'"
ER_JSON_ONE_OR_ALL
eng "Argument 2 to function '%s' must be "one" or "all"."
+ER_UNSUPPORT_COMPRESSED_TEMPORARY_TABLE
+ eng "CREATE TEMPORARY TABLE is not allowed with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE."
+ER_GEOJSON_INCORRECT
+ eng "Incorrect GeoJSON format specified for st_geomfromgeojson function."
+ER_GEOJSON_TOO_FEW_POINTS
+ eng "Incorrect GeoJSON format - too few points for linestring specified."
+ER_GEOJSON_NOT_CLOSED
+ eng "Incorrect GeoJSON format - polygon not closed."
+ER_JSON_PATH_EMPTY
+ eng "Path expression '$' is not allowed in argument %d to function '%s'."
ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
eng "Illegal parameter data types %s and %s for operation '%s'"
diff --git a/sql/spatial.cc b/sql/spatial.cc
index 9c4fe168fe3..0e3976ba573 100644
--- a/sql/spatial.cc
+++ b/sql/spatial.cc
@@ -58,12 +58,14 @@ Geometry::Class_info *Geometry::ci_collection[Geometry::wkb_last+1]=
static Geometry::Class_info **ci_collection_end=
Geometry::ci_collection+Geometry::wkb_last + 1;
-Geometry::Class_info::Class_info(const char *name, int type_id,
- create_geom_t create_func):
+Geometry::Class_info::Class_info(const char *name, const char *geojson_name,
+ int type_id, create_geom_t create_func):
m_type_id(type_id), m_create_func(create_func)
{
m_name.str= (char *) name;
m_name.length= strlen(name);
+ m_geojson_name.str= (char *) geojson_name;
+ m_geojson_name.length= strlen(geojson_name);
ci_collection[type_id]= this;
}
@@ -105,26 +107,27 @@ static Geometry *create_geometrycollection(char *buffer)
-static Geometry::Class_info point_class("POINT",
+static Geometry::Class_info point_class("POINT", "Point",
Geometry::wkb_point, create_point);
-static Geometry::Class_info linestring_class("LINESTRING",
+static Geometry::Class_info linestring_class("LINESTRING", "LineString",
Geometry::wkb_linestring,
create_linestring);
-static Geometry::Class_info polygon_class("POLYGON",
+static Geometry::Class_info polygon_class("POLYGON", "Polygon",
Geometry::wkb_polygon,
create_polygon);
-static Geometry::Class_info multipoint_class("MULTIPOINT",
+static Geometry::Class_info multipoint_class("MULTIPOINT", "MultiPoint",
Geometry::wkb_multipoint,
create_multipoint);
static Geometry::Class_info
-multilinestring_class("MULTILINESTRING",
+multilinestring_class("MULTILINESTRING", "MultiLineString",
Geometry::wkb_multilinestring, create_multilinestring);
-static Geometry::Class_info multipolygon_class("MULTIPOLYGON",
+static Geometry::Class_info multipolygon_class("MULTIPOLYGON", "MultiPolygon",
Geometry::wkb_multipolygon,
create_multipolygon);
static Geometry::Class_info
-geometrycollection_class("GEOMETRYCOLLECTION",Geometry::wkb_geometrycollection,
+geometrycollection_class("GEOMETRYCOLLECTION", "GeometryCollection",
+ Geometry::wkb_geometrycollection,
create_geometrycollection);
static void get_point(double *x, double *y, const char *data)
@@ -230,6 +233,50 @@ int Geometry::as_wkt(String *wkt, const char **end)
}
+static const uchar type_keyname[]= "type";
+static const int type_keyname_len= 4;
+static const uchar coord_keyname[]= "coordinates";
+static const int coord_keyname_len= 11;
+static const uchar geometries_keyname[]= "geometries";
+static const int geometries_keyname_len= 10;
+static const uchar features_keyname[]= "features";
+static const int features_keyname_len= 8;
+static const uchar geometry_keyname[]= "geometry";
+static const int geometry_keyname_len= 8;
+
+static const int max_keyname_len= 11; /*'coordinates' keyname is the longest.*/
+
+static const uchar feature_type[]= "feature";
+static const int feature_type_len= 7;
+static const uchar feature_coll_type[]= "featurecollection";
+static const int feature_coll_type_len= 17;
+
+
+int Geometry::as_json(String *wkt, uint max_dec_digits, const char **end)
+{
+ uint32 len= (uint) get_class_info()->m_geojson_name.length;
+ if (wkt->reserve(4 + type_keyname_len + 2 + len + 2 + 2 +
+ coord_keyname_len + 4, 512))
+ return 1;
+ wkt->qs_append("{\"", 2);
+ wkt->qs_append((const char *) type_keyname, type_keyname_len);
+ wkt->qs_append("\": \"", 4);
+ wkt->qs_append(get_class_info()->m_geojson_name.str, len);
+ wkt->qs_append("\", \"", 4);
+ if (get_class_info() == &geometrycollection_class)
+ wkt->qs_append((const char *) geometries_keyname, geometries_keyname_len);
+ else
+ wkt->qs_append((const char *) coord_keyname, coord_keyname_len);
+
+ wkt->qs_append("\": ", 3);
+ if (get_data_as_json(wkt, max_dec_digits, end) ||
+ wkt->reserve(1))
+ return 1;
+ wkt->qs_append('}');
+ return 0;
+}
+
+
static double wkb_get_double(const char *ptr, Geometry::wkbByteOrder bo)
{
double res;
@@ -291,6 +338,196 @@ Geometry *Geometry::create_from_wkb(Geometry_buffer *buffer,
}
+Geometry *Geometry::create_from_json(Geometry_buffer *buffer,
+ json_engine_t *je, String *res)
+{
+ Class_info *ci= NULL;
+ const uchar *coord_start= NULL, *geom_start= NULL,
+ *features_start= NULL, *geometry_start= NULL;
+ Geometry *result;
+ uchar key_buf[max_keyname_len];
+ uint key_len;
+ int fcoll_type_found= 0, feature_type_found= 0;
+
+
+ if (json_read_value(je))
+ goto err_return;
+
+ if (je->value_type != JSON_VALUE_OBJECT)
+ {
+ je->s.error= GEOJ_INCORRECT_GEOJSON;
+ goto err_return;
+ }
+
+ while (json_scan_next(je) == 0 && je->state != JST_OBJ_END)
+ {
+ DBUG_ASSERT(je->state == JST_KEY);
+
+ key_len=0;
+ while (json_read_keyname_chr(je) == 0)
+ {
+ if (je->s.c_next > 127 || key_len >= max_keyname_len)
+ {
+ /* Symbol out of range, or keyname too long. No need to compare.. */
+ key_len=0;
+ break;
+ }
+ key_buf[key_len++]= je->s.c_next | 0x20; /* make it lowercase. */
+ }
+
+ if (je->s.error)
+ goto err_return;
+
+ if (key_len == type_keyname_len &&
+ memcmp(key_buf, type_keyname, type_keyname_len) == 0)
+ {
+ /*
+ Found the "type" key. Let's check it's a string and remember
+ the feature's type.
+ */
+ if (json_read_value(je))
+ goto err_return;
+
+ if (je->value_type == JSON_VALUE_STRING)
+ {
+ if ((ci= find_class((const char *) je->value, je->value_len)))
+ {
+ if ((coord_start=
+ (ci == &geometrycollection_class) ? geom_start : coord_start))
+ goto create_geom;
+ }
+ else if (je->value_len == feature_coll_type_len &&
+ my_strnncoll(&my_charset_latin1, je->value, je->value_len,
+ feature_coll_type, feature_coll_type_len) == 0)
+ {
+ /*
+ 'FeatureCollection' type found. Handle the 'Featurecollection'/'features'
+ GeoJSON construction.
+ */
+ if (features_start)
+ goto handle_feature_collection;
+ fcoll_type_found= 1;
+ }
+ else if (je->value_len == feature_type_len &&
+ my_strnncoll(&my_charset_latin1, je->value, je->value_len,
+ feature_type, feature_type_len) == 0)
+ {
+ if (geometry_start)
+ goto handle_geometry_key;
+ feature_type_found= 1;
+ }
+ }
+ }
+ else if (key_len == coord_keyname_len &&
+ memcmp(key_buf, coord_keyname, coord_keyname_len) == 0)
+ {
+ /*
+ Found the "coordinates" key. Let's check it's an array
+ and remember where it starts.
+ */
+ if (json_read_value(je))
+ goto err_return;
+
+ if (je->value_type == JSON_VALUE_ARRAY)
+ {
+ coord_start= je->value_begin;
+ if (ci && ci != &geometrycollection_class)
+ goto create_geom;
+ }
+ }
+ else if (key_len == geometries_keyname_len &&
+ memcmp(key_buf, geometries_keyname, geometries_keyname_len) == 0)
+ {
+ /*
+ Found the "geometries" key. Let's check it's an array
+ and remember where it starts.
+ */
+ if (json_read_value(je))
+ goto err_return;
+
+ if (je->value_type == JSON_VALUE_ARRAY)
+ {
+ geom_start= je->value_begin;
+ if (ci == &geometrycollection_class)
+ {
+ coord_start= geom_start;
+ goto create_geom;
+ }
+ }
+ }
+ else if (key_len == features_keyname_len &&
+ memcmp(key_buf, features_keyname, features_keyname_len) == 0)
+ {
+ /*
+ 'features' key found. Handle the 'Featurecollection'/'features'
+ GeoJSON construction.
+ */
+ if (json_read_value(je))
+ goto err_return;
+ if (je->value_type == JSON_VALUE_ARRAY)
+ {
+ features_start= je->value_begin;
+ if (fcoll_type_found)
+ goto handle_feature_collection;
+ }
+ }
+ else if (key_len == geometry_keyname_len &&
+ memcmp(key_buf, geometry_keyname, geometry_keyname_len) == 0)
+ {
+ if (json_read_value(je))
+ goto err_return;
+ if (je->value_type == JSON_VALUE_OBJECT)
+ {
+ geometry_start= je->value_begin;
+ if (feature_type_found)
+ goto handle_geometry_key;
+ }
+ }
+ else
+ {
+ if (json_skip_key(je))
+ goto err_return;
+ }
+ }
+
+ if (je->s.error == 0)
+ {
+ /*
+ We didn't find all the required keys. That are "type" and "coordinates"
+ or "geometries" for GeometryCollection.
+ */
+ je->s.error= GEOJ_INCORRECT_GEOJSON;
+ }
+ goto err_return;
+
+handle_feature_collection:
+ ci= &geometrycollection_class;
+ coord_start= features_start;
+
+create_geom:
+
+ json_scan_start(je, je->s.cs, coord_start, je->s.str_end);
+
+ if (res->reserve(1 + 4, 512))
+ goto err_return;
+
+ result= (*ci->m_create_func)(buffer->data);
+ res->q_append((char) wkb_ndr);
+ res->q_append((uint32) result->get_class_info()->m_type_id);
+ if (result->init_from_json(je, res))
+ goto err_return;
+
+ return result;
+
+handle_geometry_key:
+ json_scan_start(je, je->s.cs, geometry_start, je->s.str_end);
+ return create_from_json(buffer, je, res);
+
+err_return:
+ return NULL;
+}
+
+
Geometry *Geometry::create_from_opresult(Geometry_buffer *g_buf,
String *res, Gcalc_result_receiver &rr)
{
@@ -429,6 +666,47 @@ const char *Geometry::append_points(String *txt, uint32 n_points,
}
+static void append_json_point(String *txt, uint max_dec, const char *data)
+{
+ double x,y;
+ get_point(&x, &y, data);
+ txt->qs_append('[');
+ txt->qs_append(x);
+ txt->qs_append(", ", 2);
+ txt->qs_append(y);
+ txt->qs_append(']');
+}
+
+
+/*
+ Append N points from packed format to json
+
+ SYNOPSIS
+ append_json_points()
+ txt Append points here
+ n_points Number of points
+ data Packed data
+ offset Offset between points
+
+ RETURN
+ # end of data
+*/
+
+static const char *append_json_points(String *txt, uint max_dec,
+ uint32 n_points, const char *data, uint32 offset)
+{
+ txt->qs_append('[');
+ while (n_points--)
+ {
+ data+= offset;
+ append_json_point(txt, max_dec, data);
+ data+= POINT_DATA_SIZE;
+ txt->qs_append(", ", 2);
+ }
+ txt->length(txt->length() - 2);// Remove ending ', '
+ txt->qs_append(']');
+ return data;
+}
/*
Get most bounding rectangle (mbr) for X points
@@ -502,6 +780,58 @@ uint Gis_point::init_from_wkb(const char *wkb, uint len,
}
+static int read_point_from_json(json_engine_t *je, double *x, double *y)
+{
+ int n_coord= 0, err;
+ double tmp, *d;
+ char *endptr;
+
+ while (json_scan_next(je) == 0 && je->state != JST_ARRAY_END)
+ {
+ DBUG_ASSERT(je->state == JST_VALUE);
+ if (json_read_value(je))
+ return 1;
+
+ if (je->value_type != JSON_VALUE_NUMBER)
+ goto bad_coordinates;
+
+ d= (n_coord == 0) ? x : ((n_coord == 1) ? y : &tmp);
+ *d= my_strntod(je->s.cs, (char *) je->value,
+ je->value_len, &endptr, &err);
+ if (err)
+ goto bad_coordinates;
+ n_coord++;
+ }
+
+ return 0;
+bad_coordinates:
+ je->s.error= Geometry::GEOJ_INCORRECT_GEOJSON;
+ return 1;
+}
+
+
+bool Gis_point::init_from_json(json_engine_t *je, String *wkb)
+{
+ double x, y;
+ if (json_read_value(je))
+ return TRUE;
+
+ if (je->value_type != JSON_VALUE_ARRAY)
+ {
+ je->s.error= GEOJ_INCORRECT_GEOJSON;
+ return TRUE;
+ }
+
+ if (read_point_from_json(je, &x, &y) ||
+ wkb->reserve(POINT_DATA_SIZE))
+ return TRUE;
+
+ wkb->q_append(x);
+ wkb->q_append(y);
+ return FALSE;
+}
+
+
bool Gis_point::get_data_as_wkt(String *txt, const char **end) const
{
double x, y;
@@ -517,6 +847,17 @@ bool Gis_point::get_data_as_wkt(String *txt, const char **end) const
}
+bool Gis_point::get_data_as_json(String *txt, uint max_dec_digits,
+ const char **end) const
+{
+ if (txt->reserve(MAX_DIGITS_IN_DOUBLE * 2 + 4))
+ return 1;
+ append_json_point(txt, max_dec_digits, m_data);
+ *end= m_data+ POINT_DATA_SIZE;
+ return 0;
+}
+
+
bool Gis_point::get_mbr(MBR *mbr, const char **end) const
{
double x, y;
@@ -630,6 +971,43 @@ uint Gis_line_string::init_from_wkb(const char *wkb, uint len,
}
+bool Gis_line_string::init_from_json(json_engine_t *je, String *wkb)
+{
+ uint32 n_points= 0;
+ uint32 np_pos= wkb->length();
+ Gis_point p;
+
+ if (json_read_value(je))
+ return TRUE;
+
+ if (je->value_type != JSON_VALUE_ARRAY)
+ {
+ je->s.error= GEOJ_INCORRECT_GEOJSON;
+ return TRUE;
+ }
+
+ if (wkb->reserve(4, 512))
+ return TRUE;
+ wkb->length(wkb->length()+4); // Reserve space for n_points
+
+ while (json_scan_next(je) == 0 && je->state != JST_ARRAY_END)
+ {
+ DBUG_ASSERT(je->state == JST_VALUE);
+
+ if (p.init_from_json(je, wkb))
+ return TRUE;
+ n_points++;
+ }
+ if (n_points < 1)
+ {
+ je->s.error= GEOJ_TOO_FEW_POINTS;
+ return TRUE;
+ }
+ wkb->write_at_position(np_pos, n_points);
+ return FALSE;
+}
+
+
bool Gis_line_string::get_data_as_wkt(String *txt, const char **end) const
{
uint32 n_points;
@@ -661,6 +1039,28 @@ bool Gis_line_string::get_data_as_wkt(String *txt, const char **end) const
}
+bool Gis_line_string::get_data_as_json(String *txt, uint max_dec_digits,
+ const char **end) const
+{
+ uint32 n_points;
+ const char *data= m_data;
+
+ if (no_data(data, 4))
+ return 1;
+ n_points= uint4korr(data);
+ data += 4;
+
+ if (n_points < 1 ||
+ not_enough_points(data, n_points) ||
+ txt->reserve((MAX_DIGITS_IN_DOUBLE*2 + 6) * n_points + 2))
+ return 1;
+
+ *end= append_json_points(txt, max_dec_digits, n_points, data, 0);
+
+ return 0;
+}
+
+
bool Gis_line_string::get_mbr(MBR *mbr, const char **end) const
{
return (*end=get_mbr_for_points(mbr, m_data, 0)) == 0;
@@ -854,7 +1254,7 @@ bool Gis_polygon::init_from_wkt(Gis_read_stream *trs, String *wkb)
if (wkb->reserve(4, 512))
return 1;
- wkb->length(wkb->length()+4); // Reserve space for points
+ wkb->length(wkb->length()+4); // Reserve space for n_rings
for (;;)
{
Gis_line_string ls;
@@ -964,6 +1364,46 @@ uint Gis_polygon::init_from_wkb(const char *wkb, uint len, wkbByteOrder bo,
}
+bool Gis_polygon::init_from_json(json_engine_t *je, String *wkb)
+{
+ uint32 n_linear_rings= 0;
+ uint32 lr_pos= wkb->length();
+ int closed;
+
+ if (json_read_value(je))
+ return TRUE;
+
+ if (je->value_type != JSON_VALUE_ARRAY)
+ {
+ je->s.error= GEOJ_INCORRECT_GEOJSON;
+ return TRUE;
+ }
+
+ if (wkb->reserve(4, 512))
+ return TRUE;
+ wkb->length(wkb->length()+4); // Reserve space for n_rings
+
+ while (json_scan_next(je) == 0 && je->state != JST_ARRAY_END)
+ {
+ Gis_line_string ls;
+ DBUG_ASSERT(je->state == JST_VALUE);
+
+ uint32 ls_pos=wkb->length();
+ if (ls.init_from_json(je, wkb))
+ return TRUE;
+ ls.set_data_ptr(wkb->ptr() + ls_pos, wkb->length() - ls_pos);
+ if (ls.is_closed(&closed) || !closed)
+ {
+ je->s.error= GEOJ_POLYGON_NOT_CLOSED;
+ return TRUE;
+ }
+ n_linear_rings++;
+ }
+ wkb->write_at_position(lr_pos, n_linear_rings);
+ return FALSE;
+}
+
+
bool Gis_polygon::get_data_as_wkt(String *txt, const char **end) const
{
uint32 n_linear_rings;
@@ -996,6 +1436,39 @@ bool Gis_polygon::get_data_as_wkt(String *txt, const char **end) const
}
+bool Gis_polygon::get_data_as_json(String *txt, uint max_dec_digits,
+ const char **end) const
+{
+ uint32 n_linear_rings;
+ const char *data= m_data;
+
+ if (no_data(data, 4) || txt->reserve(1, 512))
+ return 1;
+
+ n_linear_rings= uint4korr(data);
+ data+= 4;
+
+ txt->qs_append('[');
+ while (n_linear_rings--)
+ {
+ uint32 n_points;
+ if (no_data(data, 4))
+ return 1;
+ n_points= uint4korr(data);
+ data+= 4;
+ if (not_enough_points(data, n_points) ||
+ txt->reserve(4 + (MAX_DIGITS_IN_DOUBLE * 2 + 6) * n_points))
+ return 1;
+ data= append_json_points(txt, max_dec_digits, n_points, data, 0);
+ txt->qs_append(", ", 2);
+ }
+ txt->length(txt->length() - 2);// Remove ending ', '
+ txt->qs_append(']');
+ *end= data;
+ return 0;
+}
+
+
bool Gis_polygon::get_mbr(MBR *mbr, const char **end) const
{
uint32 n_linear_rings;
@@ -1382,6 +1855,44 @@ uint Gis_multi_point::init_from_wkb(const char *wkb, uint len, wkbByteOrder bo,
}
+bool Gis_multi_point::init_from_json(json_engine_t *je, String *wkb)
+{
+ uint32 n_points= 0;
+ uint32 np_pos= wkb->length();
+ Gis_point p;
+
+ if (json_read_value(je))
+ return TRUE;
+
+ if (je->value_type != JSON_VALUE_ARRAY)
+ {
+ je->s.error= GEOJ_INCORRECT_GEOJSON;
+ return TRUE;
+ }
+
+ if (wkb->reserve(4, 512))
+ return TRUE;
+ wkb->length(wkb->length()+4); // Reserve space for n_points
+
+ while (json_scan_next(je) == 0 && je->state != JST_ARRAY_END)
+ {
+ DBUG_ASSERT(je->state == JST_VALUE);
+
+ if (wkb->reserve(1 + 4, 512))
+ return TRUE;
+ wkb->q_append((char) wkb_ndr);
+ wkb->q_append((uint32) wkb_point);
+
+ if (p.init_from_json(je, wkb))
+ return TRUE;
+ n_points++;
+ }
+
+ wkb->write_at_position(np_pos, n_points);
+ return FALSE;
+}
+
+
bool Gis_multi_point::get_data_as_wkt(String *txt, const char **end) const
{
uint32 n_points;
@@ -1399,6 +1910,24 @@ bool Gis_multi_point::get_data_as_wkt(String *txt, const char **end) const
}
+bool Gis_multi_point::get_data_as_json(String *txt, uint max_dec_digits,
+ const char **end) const
+{
+ uint32 n_points;
+ if (no_data(m_data, 4))
+ return 1;
+
+ n_points= uint4korr(m_data);
+ if (n_points > max_n_points ||
+ not_enough_points(m_data+4, n_points, WKB_HEADER_SIZE) ||
+ txt->reserve((MAX_DIGITS_IN_DOUBLE * 2 + 6) * n_points + 2))
+ return 1;
+ *end= append_json_points(txt, max_dec_digits, n_points, m_data+4,
+ WKB_HEADER_SIZE);
+ return 0;
+}
+
+
bool Gis_multi_point::get_mbr(MBR *mbr, const char **end) const
{
return (*end= get_mbr_for_points(mbr, m_data, WKB_HEADER_SIZE)) == 0;
@@ -1594,6 +2123,44 @@ uint Gis_multi_line_string::init_from_wkb(const char *wkb, uint len,
}
+bool Gis_multi_line_string::init_from_json(json_engine_t *je, String *wkb)
+{
+ uint32 n_line_strings= 0;
+ uint32 ls_pos= wkb->length();
+
+ if (json_read_value(je))
+ return TRUE;
+
+ if (je->value_type != JSON_VALUE_ARRAY)
+ {
+ je->s.error= GEOJ_INCORRECT_GEOJSON;
+ return TRUE;
+ }
+
+ if (wkb->reserve(4, 512))
+ return TRUE;
+ wkb->length(wkb->length()+4); // Reserve space for n_rings
+
+ while (json_scan_next(je) == 0 && je->state != JST_ARRAY_END)
+ {
+ Gis_line_string ls;
+ DBUG_ASSERT(je->state == JST_VALUE);
+
+ if (wkb->reserve(1 + 4, 512))
+ return TRUE;
+ wkb->q_append((char) wkb_ndr);
+ wkb->q_append((uint32) wkb_linestring);
+
+ if (ls.init_from_json(je, wkb))
+ return TRUE;
+
+ n_line_strings++;
+ }
+ wkb->write_at_position(ls_pos, n_line_strings);
+ return FALSE;
+}
+
+
bool Gis_multi_line_string::get_data_as_wkt(String *txt,
const char **end) const
{
@@ -1626,6 +2193,38 @@ bool Gis_multi_line_string::get_data_as_wkt(String *txt,
}
+bool Gis_multi_line_string::get_data_as_json(String *txt, uint max_dec_digits,
+ const char **end) const
+{
+ uint32 n_line_strings;
+ const char *data= m_data;
+
+ if (no_data(data, 4) || txt->reserve(1, 512))
+ return 1;
+ n_line_strings= uint4korr(data);
+ data+= 4;
+
+ txt->qs_append('[');
+ while (n_line_strings--)
+ {
+ uint32 n_points;
+ if (no_data(data, (WKB_HEADER_SIZE + 4)))
+ return 1;
+ n_points= uint4korr(data + WKB_HEADER_SIZE);
+ data+= WKB_HEADER_SIZE + 4;
+ if (not_enough_points(data, n_points) ||
+ txt->reserve(2 + (MAX_DIGITS_IN_DOUBLE * 2 + 6) * n_points))
+ return 1;
+ data= append_json_points(txt, max_dec_digits, n_points, data, 0);
+ txt->qs_append(", ", 2);
+ }
+ txt->length(txt->length() - 2);
+ txt->qs_append(']');
+ *end= data;
+ return 0;
+}
+
+
bool Gis_multi_line_string::get_mbr(MBR *mbr, const char **end) const
{
uint32 n_line_strings;
@@ -1912,6 +2511,44 @@ uint Gis_multi_polygon::init_from_opresult(String *bin,
}
+bool Gis_multi_polygon::init_from_json(json_engine_t *je, String *wkb)
+{
+ uint32 n_polygons= 0;
+ int np_pos= wkb->length();
+ Gis_polygon p;
+
+ if (json_read_value(je))
+ return TRUE;
+
+ if (je->value_type != JSON_VALUE_ARRAY)
+ {
+ je->s.error= GEOJ_INCORRECT_GEOJSON;
+ return TRUE;
+ }
+
+ if (wkb->reserve(4, 512))
+ return TRUE;
+ wkb->length(wkb->length()+4); // Reserve space for n_rings
+
+ while (json_scan_next(je) == 0 && je->state != JST_ARRAY_END)
+ {
+ DBUG_ASSERT(je->state == JST_VALUE);
+
+ if (wkb->reserve(1 + 4, 512))
+ return TRUE;
+ wkb->q_append((char) wkb_ndr);
+ wkb->q_append((uint32) wkb_polygon);
+
+ if (p.init_from_json(je, wkb))
+ return TRUE;
+
+ n_polygons++;
+ }
+ wkb->write_at_position(np_pos, n_polygons);
+ return FALSE;
+}
+
+
bool Gis_multi_polygon::get_data_as_wkt(String *txt, const char **end) const
{
uint32 n_polygons;
@@ -1956,6 +2593,51 @@ bool Gis_multi_polygon::get_data_as_wkt(String *txt, const char **end) const
}
+bool Gis_multi_polygon::get_data_as_json(String *txt, uint max_dec_digits,
+ const char **end) const
+{
+ uint32 n_polygons;
+ const char *data= m_data;
+
+ if (no_data(data, 4) || txt->reserve(1, 512))
+ return 1;
+ n_polygons= uint4korr(data);
+ data+= 4;
+
+ txt->q_append('[');
+ while (n_polygons--)
+ {
+ uint32 n_linear_rings;
+ if (no_data(data, 4 + WKB_HEADER_SIZE) ||
+ txt->reserve(1, 512))
+ return 1;
+ n_linear_rings= uint4korr(data+WKB_HEADER_SIZE);
+ data+= 4 + WKB_HEADER_SIZE;
+ txt->q_append('[');
+
+ while (n_linear_rings--)
+ {
+ if (no_data(data, 4))
+ return 1;
+ uint32 n_points= uint4korr(data);
+ data+= 4;
+ if (not_enough_points(data, n_points) ||
+ txt->reserve(2 + (MAX_DIGITS_IN_DOUBLE * 2 + 6) * n_points,
+ 512))
+ return 1;
+ data= append_json_points(txt, max_dec_digits, n_points, data, 0);
+ txt->qs_append(", ", 2);
+ }
+ txt->length(txt->length() - 2);
+ txt->qs_append("], ", 3);
+ }
+ txt->length(txt->length() - 2);
+ txt->q_append(']');
+ *end= data;
+ return 0;
+}
+
+
bool Gis_multi_polygon::get_mbr(MBR *mbr, const char **end) const
{
uint32 n_polygons;
@@ -2304,6 +2986,47 @@ uint Gis_geometry_collection::init_from_wkb(const char *wkb, uint len,
}
+bool Gis_geometry_collection::init_from_json(json_engine_t *je, String *wkb)
+{
+ uint32 n_objects= 0;
+ uint32 no_pos= wkb->length();
+ Geometry_buffer buffer;
+ Geometry *g;
+
+ if (json_read_value(je))
+ return TRUE;
+
+ if (je->value_type != JSON_VALUE_ARRAY)
+ {
+ je->s.error= GEOJ_INCORRECT_GEOJSON;
+ return TRUE;
+ }
+
+ if (wkb->reserve(4, 512))
+ return TRUE;
+ wkb->length(wkb->length()+4); // Reserve space for n_objects
+
+ while (json_scan_next(je) == 0 && je->state != JST_ARRAY_END)
+ {
+ json_engine_t sav_je= *je;
+
+ DBUG_ASSERT(je->state == JST_VALUE);
+
+ if (!(g= create_from_json(&buffer, je, wkb)))
+ return TRUE;
+
+ *je= sav_je;
+ if (json_skip_array_item(je))
+ return TRUE;
+
+ n_objects++;
+ }
+
+ wkb->write_at_position(no_pos, n_objects);
+ return FALSE;
+}
+
+
bool Gis_geometry_collection::get_data_as_wkt(String *txt,
const char **end) const
{
@@ -2348,6 +3071,44 @@ exit:
}
+bool Gis_geometry_collection::get_data_as_json(String *txt, uint max_dec_digits,
+ const char **end) const
+{
+ uint32 n_objects;
+ Geometry_buffer buffer;
+ Geometry *geom;
+ const char *data= m_data;
+
+ if (no_data(data, 4) || txt->reserve(1, 512))
+ return 1;
+ n_objects= uint4korr(data);
+ data+= 4;
+
+ txt->qs_append('[');
+ while (n_objects--)
+ {
+ uint32 wkb_type;
+
+ if (no_data(data, WKB_HEADER_SIZE))
+ return 1;
+ wkb_type= uint4korr(data + 1);
+ data+= WKB_HEADER_SIZE;
+
+ if (!(geom= create_by_typeid(&buffer, wkb_type)))
+ return 1;
+ geom->set_data_ptr(data, (uint) (m_data_end - data));
+ if (geom->as_json(txt, max_dec_digits, &data) ||
+ txt->append(STRING_WITH_LEN(", "), 512))
+ return 1;
+ }
+ txt->length(txt->length() - 2);
+ txt->qs_append(']');
+
+ *end= data;
+ return 0;
+}
+
+
bool Gis_geometry_collection::get_mbr(MBR *mbr, const char **end) const
{
uint32 n_objects;
diff --git a/sql/spatial.h b/sql/spatial.h
index 2e449844d47..3858c0d2e51 100644
--- a/sql/spatial.h
+++ b/sql/spatial.h
@@ -20,6 +20,7 @@
#include "sql_string.h" /* String, LEX_STRING */
#include <my_compiler.h>
+#include <json_lib.h>
#ifdef HAVE_SPATIAL
@@ -249,6 +250,13 @@ public:
wkb_xdr= 0, /* Big Endian */
wkb_ndr= 1 /* Little Endian */
};
+ enum geojson_errors
+ {
+ GEOJ_INCORRECT_GEOJSON= 1,
+ GEOJ_TOO_FEW_POINTS= 2,
+ GEOJ_POLYGON_NOT_CLOSED= 3,
+ };
+
/** Callback which creates Geometry objects on top of a given placement. */
typedef Geometry *(*create_geom_t)(char *);
@@ -257,9 +265,11 @@ public:
{
public:
LEX_STRING m_name;
+ LEX_STRING m_geojson_name;
int m_type_id;
create_geom_t m_create_func;
- Class_info(const char *name, int type_id, create_geom_t create_func);
+ Class_info(const char *name, const char *gejson_name,
+ int type_id, create_geom_t create_func);
};
virtual const Class_info *get_class_info() const=0;
@@ -271,8 +281,11 @@ public:
virtual uint init_from_opresult(String *bin,
const char *opres, uint res_len)
{ return init_from_wkb(opres + 4, UINT_MAX32, wkb_ndr, bin) + 4; }
+ virtual bool init_from_json(json_engine_t *je, String *wkb) {return true;}
virtual bool get_data_as_wkt(String *txt, const char **end) const=0;
+ virtual bool get_data_as_json(String *txt, uint max_dec_digits,
+ const char **end) const=0;
virtual bool get_mbr(MBR *mbr, const char **end) const=0;
virtual bool dimension(uint32 *dim, const char **end) const=0;
virtual int get_x(double *x) const { return -1; }
@@ -302,9 +315,12 @@ public:
bool init_stream=1);
static Geometry *create_from_wkb(Geometry_buffer *buffer,
const char *wkb, uint32 len, String *res);
+ static Geometry *create_from_json(Geometry_buffer *buffer,
+ json_engine_t *je, String *res);
static Geometry *create_from_opresult(Geometry_buffer *g_buf,
String *res, Gcalc_result_receiver &rr);
int as_wkt(String *wkt, const char **end);
+ int as_json(String *wkt, uint max_dec_digits, const char **end);
inline void set_data_ptr(const char *data, uint32 data_len)
{
@@ -379,7 +395,10 @@ public:
uint32 get_data_size() const;
bool init_from_wkt(Gis_read_stream *trs, String *wkb);
uint init_from_wkb(const char *wkb, uint len, wkbByteOrder bo, String *res);
+ bool init_from_json(json_engine_t *je, String *wkb);
bool get_data_as_wkt(String *txt, const char **end) const;
+ bool get_data_as_json(String *txt, uint max_dec_digits,
+ const char **end) const;
bool get_mbr(MBR *mbr, const char **end) const;
int get_xy(double *x, double *y) const
@@ -431,7 +450,10 @@ public:
uint32 get_data_size() const;
bool init_from_wkt(Gis_read_stream *trs, String *wkb);
uint init_from_wkb(const char *wkb, uint len, wkbByteOrder bo, String *res);
+ bool init_from_json(json_engine_t *je, String *wkb);
bool get_data_as_wkt(String *txt, const char **end) const;
+ bool get_data_as_json(String *txt, uint max_dec_digits,
+ const char **end) const;
bool get_mbr(MBR *mbr, const char **end) const;
int geom_length(double *len, const char **end) const;
int area(double *ar, const char **end) const;
@@ -462,7 +484,10 @@ public:
bool init_from_wkt(Gis_read_stream *trs, String *wkb);
uint init_from_wkb(const char *wkb, uint len, wkbByteOrder bo, String *res);
uint init_from_opresult(String *bin, const char *opres, uint res_len);
+ bool init_from_json(json_engine_t *je, String *wkb);
bool get_data_as_wkt(String *txt, const char **end) const;
+ bool get_data_as_json(String *txt, uint max_dec_digits,
+ const char **end) const;
bool get_mbr(MBR *mbr, const char **end) const;
int area(double *ar, const char **end) const;
int exterior_ring(String *result) const;
@@ -496,7 +521,10 @@ public:
bool init_from_wkt(Gis_read_stream *trs, String *wkb);
uint init_from_wkb(const char *wkb, uint len, wkbByteOrder bo, String *res);
uint init_from_opresult(String *bin, const char *opres, uint res_len);
+ bool init_from_json(json_engine_t *je, String *wkb);
bool get_data_as_wkt(String *txt, const char **end) const;
+ bool get_data_as_json(String *txt, uint max_dec_digits,
+ const char **end) const;
bool get_mbr(MBR *mbr, const char **end) const;
int num_geometries(uint32 *num) const;
int geometry_n(uint32 num, String *result) const;
@@ -522,7 +550,10 @@ public:
bool init_from_wkt(Gis_read_stream *trs, String *wkb);
uint init_from_wkb(const char *wkb, uint len, wkbByteOrder bo, String *res);
uint init_from_opresult(String *bin, const char *opres, uint res_len);
+ bool init_from_json(json_engine_t *je, String *wkb);
bool get_data_as_wkt(String *txt, const char **end) const;
+ bool get_data_as_json(String *txt, uint max_dec_digits,
+ const char **end) const;
bool get_mbr(MBR *mbr, const char **end) const;
int num_geometries(uint32 *num) const;
int geometry_n(uint32 num, String *result) const;
@@ -549,7 +580,10 @@ public:
uint32 get_data_size() const;
bool init_from_wkt(Gis_read_stream *trs, String *wkb);
uint init_from_wkb(const char *wkb, uint len, wkbByteOrder bo, String *res);
+ bool init_from_json(json_engine_t *je, String *wkb);
bool get_data_as_wkt(String *txt, const char **end) const;
+ bool get_data_as_json(String *txt, uint max_dec_digits,
+ const char **end) const;
bool get_mbr(MBR *mbr, const char **end) const;
int num_geometries(uint32 *num) const;
int geometry_n(uint32 num, String *result) const;
@@ -578,7 +612,10 @@ public:
bool init_from_wkt(Gis_read_stream *trs, String *wkb);
uint init_from_wkb(const char *wkb, uint len, wkbByteOrder bo, String *res);
uint init_from_opresult(String *bin, const char *opres, uint res_len);
+ bool init_from_json(json_engine_t *je, String *wkb);
bool get_data_as_wkt(String *txt, const char **end) const;
+ bool get_data_as_json(String *txt, uint max_dec_digits,
+ const char **end) const;
bool get_mbr(MBR *mbr, const char **end) const;
int area(double *ar, const char **end) const;
int geom_length(double *len, const char **end) const;
diff --git a/sql/sql_base.cc b/sql/sql_base.cc
index ac4b8a45107..3758b3ba710 100644
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@ -769,6 +769,23 @@ void close_thread_tables(THD *thd)
thd->derived_tables= 0;
}
+ if (thd->rec_tables)
+ {
+ TABLE *next;
+ /*
+ Close all temporary tables created for recursive table references.
+ This action was postponed because the table could be used in the
+ statements like ANALYZE WITH r AS (...) SELECT * from r
+ where r is defined through recursion.
+ */
+ for (table= thd->rec_tables ; table ; table= next)
+ {
+ next= table->next;
+ free_tmp_table(thd, table);
+ }
+ thd->rec_tables= 0;
+ }
+
/*
Mark all temporary tables used by this statement as free for reuse.
*/
diff --git a/sql/sql_class.cc b/sql/sql_class.cc
index 1c44a281de5..e5b2e6520f9 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, 2016, MariaDB
+ Copyright (c) 2008, 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
@@ -742,8 +742,8 @@ THD::THD(my_thread_id id, bool is_wsrep_applier)
#endif
{
ulong tmp;
+ bzero(&variables, sizeof(variables));
- mdl_context.init(this);
/*
We set THR_THD to temporally point to this THD to register all the
variables that allocates memory for this THD
@@ -753,8 +753,11 @@ THD::THD(my_thread_id id, bool is_wsrep_applier)
status_var.local_memory_used= sizeof(THD);
status_var.global_memory_used= 0;
variables.pseudo_thread_id= thread_id;
+ variables.max_mem_used= global_system_variables.max_mem_used;
main_da.init();
+ mdl_context.init(this);
+
/*
Pass nominal parameters to init_alloc_root only to ensure that
the destructor works OK in case of an error. The main_mem_root
@@ -800,7 +803,6 @@ THD::THD(my_thread_id id, bool is_wsrep_applier)
connection_name.str= 0;
connection_name.length= 0;
- bzero(&variables, sizeof(variables));
file_id = 0;
query_id= 0;
query_name_consts= 0;
diff --git a/sql/sql_class.h b/sql/sql_class.h
index 3a7454e0a89..295474d0d62 100644
--- a/sql/sql_class.h
+++ b/sql/sql_class.h
@@ -546,6 +546,7 @@ typedef struct system_variables
ulonglong sortbuff_size;
ulonglong group_concat_max_len;
ulonglong default_regex_flags;
+ ulonglong max_mem_used;
/**
Place holders to store Multi-source variables in sys_var.cc during
@@ -1380,6 +1381,11 @@ public:
*/
TABLE *derived_tables;
+ /*
+ Temporary tables created for recursive table references.
+ */
+ TABLE *rec_tables;
+
/*
During a MySQL session, one can lock tables in two modes: automatic
or manual. In automatic mode all necessary tables are locked just before
@@ -1460,6 +1466,7 @@ public:
open_tables= 0;
temporary_tables= 0;
derived_tables= 0;
+ rec_tables= 0;
extra_lock= 0;
lock= 0;
locked_tables_mode= LTM_NONE;
diff --git a/sql/sql_cte.cc b/sql/sql_cte.cc
index a4ceae52e5e..42cc20647a4 100644
--- a/sql/sql_cte.cc
+++ b/sql/sql_cte.cc
@@ -1246,6 +1246,12 @@ bool st_select_lex::check_subqueries_with_recursive_references()
void With_clause::print(String *str, enum_query_type query_type)
{
+ /*
+ Any with clause contains just definitions of CTE tables.
+ No data expansion is applied to these definitions.
+ */
+ query_type= (enum_query_type) (query_type | QT_NO_DATA_EXPANSION);
+
str->append(STRING_WITH_LEN("with "));
if (with_recursive)
str->append(STRING_WITH_LEN("recursive "));
diff --git a/sql/sql_derived.cc b/sql/sql_derived.cc
index 898b6336ae5..76cb27d7d62 100644
--- a/sql/sql_derived.cc
+++ b/sql/sql_derived.cc
@@ -1099,6 +1099,11 @@ bool mysql_derived_reinit(THD *thd, LEX *lex, TABLE_LIST *derived)
unit->types.empty();
/* for derived tables & PS (which can't be reset by Item_subselect) */
unit->reinit_exec_mechanism();
+ for (st_select_lex *sl= unit->first_select(); sl; sl= sl->next_select())
+ {
+ sl->cond_pushed_into_where= NULL;
+ sl->cond_pushed_into_having= NULL;
+ }
unit->set_thd(thd);
DBUG_RETURN(FALSE);
}
@@ -1129,23 +1134,24 @@ bool mysql_derived_reinit(THD *thd, LEX *lex, TABLE_LIST *derived)
bool pushdown_cond_for_derived(THD *thd, Item *cond, TABLE_LIST *derived)
{
+ DBUG_ENTER("pushdown_cond_for_derived");
if (!cond)
- return false;
+ DBUG_RETURN(false);
st_select_lex_unit *unit= derived->get_unit();
st_select_lex *sl= unit->first_select();
/* Do not push conditions into constant derived */
if (unit->executed)
- return false;
+ DBUG_RETURN(false);
/* Do not push conditions into recursive with tables */
if (derived->is_recursive_with_table())
- return false;
+ DBUG_RETURN(false);
/* Do not push conditions into unit with global ORDER BY ... LIMIT */
if (unit->fake_select_lex && unit->fake_select_lex->explicit_limit)
- return false;
+ DBUG_RETURN(false);
/* Check whether any select of 'unit' allows condition pushdown */
bool some_select_allows_cond_pushdown= false;
@@ -1158,7 +1164,7 @@ bool pushdown_cond_for_derived(THD *thd, Item *cond, TABLE_LIST *derived)
}
}
if (!some_select_allows_cond_pushdown)
- return false;
+ DBUG_RETURN(false);
/*
Build the most restrictive condition extractable from 'cond'
@@ -1173,7 +1179,7 @@ bool pushdown_cond_for_derived(THD *thd, Item *cond, TABLE_LIST *derived)
if (!extracted_cond)
{
/* Nothing can be pushed into the derived table */
- return false;
+ DBUG_RETURN(false);
}
/* Push extracted_cond into every select of the unit specifying 'derived' */
st_select_lex *save_curr_select= thd->lex->current_select;
@@ -1257,6 +1263,6 @@ bool pushdown_cond_for_derived(THD *thd, Item *cond, TABLE_LIST *derived)
sl->cond_pushed_into_having= extracted_cond_copy;
}
thd->lex->current_select= save_curr_select;
- return false;
+ DBUG_RETURN(false);
}
diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc
index d7a23a41002..f5e0244f75a 100644
--- a/sql/sql_prepare.cc
+++ b/sql/sql_prepare.cc
@@ -227,6 +227,7 @@ private:
SELECT_LEX and other classes).
*/
MEM_ROOT main_mem_root;
+ sql_mode_t m_sql_mode;
private:
bool set_db(const char *db, uint db_length);
bool set_parameters(String *expanded_query,
@@ -742,45 +743,35 @@ static void setup_one_conversion_function(THD *thd, Item_param *param,
switch (param_type) {
case MYSQL_TYPE_TINY:
param->set_param_func= set_param_tiny;
- param->item_type= Item::INT_ITEM;
break;
case MYSQL_TYPE_SHORT:
param->set_param_func= set_param_short;
- param->item_type= Item::INT_ITEM;
break;
case MYSQL_TYPE_LONG:
param->set_param_func= set_param_int32;
- param->item_type= Item::INT_ITEM;
break;
case MYSQL_TYPE_LONGLONG:
param->set_param_func= set_param_int64;
- param->item_type= Item::INT_ITEM;
break;
case MYSQL_TYPE_FLOAT:
param->set_param_func= set_param_float;
- param->item_type= Item::REAL_ITEM;
break;
case MYSQL_TYPE_DOUBLE:
param->set_param_func= set_param_double;
- param->item_type= Item::REAL_ITEM;
break;
case MYSQL_TYPE_DECIMAL:
case MYSQL_TYPE_NEWDECIMAL:
param->set_param_func= set_param_decimal;
- param->item_type= Item::DECIMAL_ITEM;
break;
case MYSQL_TYPE_TIME:
param->set_param_func= set_param_time;
- param->item_type= Item::STRING_ITEM;
break;
case MYSQL_TYPE_DATE:
param->set_param_func= set_param_date;
- param->item_type= Item::STRING_ITEM;
break;
case MYSQL_TYPE_DATETIME:
case MYSQL_TYPE_TIMESTAMP:
param->set_param_func= set_param_datetime;
- param->item_type= Item::STRING_ITEM;
break;
case MYSQL_TYPE_TINY_BLOB:
case MYSQL_TYPE_MEDIUM_BLOB:
@@ -792,7 +783,6 @@ static void setup_one_conversion_function(THD *thd, Item_param *param,
thd->variables.character_set_client;
DBUG_ASSERT(thd->variables.character_set_client);
param->value.cs_info.final_character_set_of_str_value= &my_charset_bin;
- param->item_type= Item::STRING_ITEM;
break;
default:
/*
@@ -821,7 +811,6 @@ static void setup_one_conversion_function(THD *thd, Item_param *param,
Exact value of max_length is not known unless data is converted to
charset of connection, so we have to set it later.
*/
- param->item_type= Item::STRING_ITEM;
}
}
param->set_handler_by_field_type((enum enum_field_types) param_type);
@@ -892,7 +881,7 @@ static bool insert_params_with_log(Prepared_statement *stmt, uchar *null_array,
for (Item_param **it= begin; it < end; ++it)
{
Item_param *param= *it;
- if (param->state != Item_param::LONG_DATA_VALUE)
+ if (!param->has_long_data_value())
{
if (is_param_null(null_array, (uint) (it - begin)))
param->set_null();
@@ -901,13 +890,12 @@ static bool insert_params_with_log(Prepared_statement *stmt, uchar *null_array,
if (read_pos >= data_end)
DBUG_RETURN(1);
param->set_param_func(param, &read_pos, (uint) (data_end - read_pos));
- if (param->state == Item_param::NO_VALUE)
+ if (param->has_no_value())
DBUG_RETURN(1);
- if (param->limit_clause_param && param->state != Item_param::INT_VALUE)
+ if (param->limit_clause_param && !param->has_int_value())
{
param->set_int(param->val_int(), MY_INT64_NUM_DECIMAL_DIGITS);
- param->item_type= Item::INT_ITEM;
if (!param->unsigned_flag && param->value.integer < 0)
DBUG_RETURN(1);
}
@@ -947,7 +935,7 @@ static bool insert_params(Prepared_statement *stmt, uchar *null_array,
for (Item_param **it= begin; it < end; ++it)
{
Item_param *param= *it;
- if (param->state != Item_param::LONG_DATA_VALUE)
+ if (!param->has_long_data_value())
{
if (is_param_null(null_array, (uint) (it - begin)))
param->set_null();
@@ -956,7 +944,7 @@ static bool insert_params(Prepared_statement *stmt, uchar *null_array,
if (read_pos >= data_end)
DBUG_RETURN(1);
param->set_param_func(param, &read_pos, (uint) (data_end - read_pos));
- if (param->state == Item_param::NO_VALUE)
+ if (param->has_no_value())
DBUG_RETURN(1);
}
}
@@ -989,7 +977,7 @@ static bool insert_bulk_params(Prepared_statement *stmt,
Item_param *param= *it;
if (reset)
param->reset();
- if (param->state != Item_param::LONG_DATA_VALUE)
+ if (!param->has_long_data_value())
{
if (param->indicators)
param->indicator= (enum_indicator_type) *((*read_pos)++);
@@ -1003,7 +991,7 @@ static bool insert_bulk_params(Prepared_statement *stmt,
if ((*read_pos) >= data_end)
DBUG_RETURN(1);
param->set_param_func(param, read_pos, (uint) (data_end - (*read_pos)));
- if (param->state == Item_param::NO_VALUE)
+ if (param->has_no_value())
DBUG_RETURN(1);
break;
case STMT_INDICATOR_NULL:
@@ -1093,7 +1081,7 @@ static bool emb_insert_params(Prepared_statement *stmt, String *expanded_query)
{
Item_param *param= *it;
setup_one_conversion_function(thd, param, client_param->buffer_type);
- if (param->state != Item_param::LONG_DATA_VALUE)
+ if (!param->has_long_data_value())
{
if (*client_param->is_null)
param->set_null();
@@ -1105,7 +1093,7 @@ static bool emb_insert_params(Prepared_statement *stmt, String *expanded_query)
client_param->length ?
*client_param->length :
client_param->buffer_length);
- if (param->state == Item_param::NO_VALUE)
+ if (param->has_no_value())
DBUG_RETURN(1);
}
}
@@ -1129,7 +1117,7 @@ static bool emb_insert_params_with_log(Prepared_statement *stmt, String *query)
{
Item_param *param= *it;
setup_one_conversion_function(thd, param, client_param->buffer_type);
- if (param->state != Item_param::LONG_DATA_VALUE)
+ if (!param->has_long_data_value())
{
if (*client_param->is_null)
param->set_null();
@@ -1141,7 +1129,7 @@ static bool emb_insert_params_with_log(Prepared_statement *stmt, String *query)
client_param->length ?
*client_param->length :
client_param->buffer_length);
- if (param->state == Item_param::NO_VALUE)
+ if (param->has_no_value())
DBUG_RETURN(1);
}
}
@@ -3616,7 +3604,8 @@ Prepared_statement::Prepared_statement(THD *thd_arg)
param_count(0),
last_errno(0),
flags((uint) IS_IN_USE),
- start_param(0)
+ start_param(0),
+ m_sql_mode(thd->variables.sql_mode)
{
init_sql_alloc(&main_mem_root, thd_arg->variables.query_alloc_block_size,
thd_arg->variables.query_prealloc_size, MYF(MY_THREAD_SPECIFIC));
@@ -3790,6 +3779,7 @@ bool Prepared_statement::prepare(const char *packet, uint packet_len)
Statement stmt_backup;
Query_arena *old_stmt_arena;
DBUG_ENTER("Prepared_statement::prepare");
+ DBUG_ASSERT(m_sql_mode == thd->variables.sql_mode);
/*
If this is an SQLCOM_PREPARE, we also increase Com_prepare_sql.
However, it seems handy if com_stmt_prepare is increased always,
@@ -4378,6 +4368,7 @@ Prepared_statement::reprepare()
bool error;
Prepared_statement copy(thd);
+ copy.m_sql_mode= m_sql_mode;
copy.set_sql_prepare(); /* To suppress sending metadata to the client. */
@@ -4387,9 +4378,12 @@ Prepared_statement::reprepare()
&cur_db_changed))
return TRUE;
+ sql_mode_t save_sql_mode= thd->variables.sql_mode;
+ thd->variables.sql_mode= m_sql_mode;
error= ((name.str && copy.set_name(&name)) ||
copy.prepare(query(), query_length()) ||
validate_metadata(&copy));
+ thd->variables.sql_mode= save_sql_mode;
if (cur_db_changed)
mysql_change_db(thd, &saved_cur_db_name, TRUE);
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 310f0673156..fb25342420f 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -21343,9 +21343,6 @@ create_sort_index(THD *thd, JOIN *join, JOIN_TAB *tab, Filesort *fsort)
table= tab->table;
select= fsort->select;
- /* Currently ORDER BY ... LIMIT is not supported in subqueries. */
- DBUG_ASSERT(join->group_list || !join->is_in_subquery());
-
table->status=0; // May be wrong if quick_select
if (!tab->preread_init_done && tab->preread_init())
diff --git a/sql/sql_trigger.cc b/sql/sql_trigger.cc
index bd02289b135..00540399abd 100644
--- a/sql/sql_trigger.cc
+++ b/sql/sql_trigger.cc
@@ -1206,7 +1206,7 @@ bool Table_triggers_list::prepare_record_accessors(TABLE *table)
(table->s->stored_fields != table->s->null_fields))
{
- int null_bytes= (table->s->stored_fields - table->s->null_fields + 7)/8;
+ int null_bytes= (table->s->fields - table->s->null_fields + 7)/8;
if (!(extra_null_bitmap= (uchar*)alloc_root(&table->mem_root, null_bytes)))
return 1;
if (!(record0_field= (Field **)alloc_root(&table->mem_root,
diff --git a/sql/sql_union.cc b/sql/sql_union.cc
index b30b5528741..71d0e331101 100644
--- a/sql/sql_union.cc
+++ b/sql/sql_union.cc
@@ -283,7 +283,14 @@ void select_union_recursive::cleanup()
tab->file->extra(HA_EXTRA_RESET_STATE);
tab->file->ha_delete_all_rows();
}
- free_tmp_table(thd, tab);
+ /*
+ The table will be closed later in close_thread_tables(),
+ because it might be used in the statements like
+ ANALYZE WITH r AS (...) SELECT * from r
+ where r is defined through recursion.
+ */
+ tab->next= thd->rec_tables;
+ thd->rec_tables= tab;
}
}
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index f6790502517..441e44d189d 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -972,15 +972,16 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
%parse-param { THD *thd }
%lex-param { THD *thd }
/*
- Currently there are 103 shift/reduce conflicts.
+ Currently there are 102 shift/reduce conflicts.
We should not introduce new conflicts any more.
*/
-%expect 103
+%expect 102
/*
Comments for TOKENS.
For each token, please include in the same line a comment that contains
the following tags:
+ SQL-2011-N : Non Reserved keywird as per SQL-2011
SQL-2003-R : Reserved keyword as per SQL-2003
SQL-2003-N : Non Reserved keyword as per SQL-2003
SQL-1999-R : Reserved keyword as per SQL-1999
@@ -1170,7 +1171,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
%token EVERY_SYM /* SQL-2003-N */
%token EXCHANGE_SYM
%token EXAMINED_SYM
-%token EXCLUDE_SYM
+%token EXCLUDE_SYM /* SQL-2011-N */
%token EXECUTE_SYM /* SQL-2003-R */
%token EXISTS /* SQL-2003-R */
%token EXIT_SYM
@@ -1191,7 +1192,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
%token FLOAT_SYM /* SQL-2003-R */
%token FLUSH_SYM
%token FOLLOWS_SYM /* MYSQL trigger*/
-%token FOLLOWING_SYM
+%token FOLLOWING_SYM /* SQL-2011-N */
%token FORCE_SYM
%token FOREIGN /* SQL-2003-R */
%token FOR_SYM /* SQL-2003-R */
@@ -1393,7 +1394,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
%token ORDER_SYM /* SQL-2003-R */
%token OR_OR_SYM /* OPERATOR */
%token OR_SYM /* SQL-2003-R */
-%token OTHERS_SYM
+%token OTHERS_SYM /* SQL-2011-N */
%token OUTER
%token OUTFILE
%token OUT_SYM /* SQL-2003-R */
@@ -1420,7 +1421,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
%token PORT_SYM
%token POSITION_SYM /* SQL-2003-N */
%token PRECEDES_SYM /* MYSQL */
-%token PRECEDING_SYM
+%token PRECEDING_SYM /* SQL-2011-N */
%token PRECISION /* SQL-2003-R */
%token PREPARE_SYM /* SQL-2003-R */
%token PRESERVE_SYM
@@ -1485,10 +1486,10 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
%token ROLLBACK_SYM /* SQL-2003-R */
%token ROLLUP_SYM /* SQL-2003-R */
%token ROUTINE_SYM /* SQL-2003-N */
-%token ROWS_SYM /* SQL-2003-R */
-%token ROW_FORMAT_SYM
%token ROW_SYM /* SQL-2003-R */
+%token ROWS_SYM /* SQL-2003-R */
%token ROW_COUNT_SYM /* SQL-2003-N */
+%token ROW_FORMAT_SYM
%token ROW_NUMBER_SYM
%token RTREE_SYM
%token SAVEPOINT_SYM /* SQL-2003-R */
@@ -1581,7 +1582,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
%token TEXT_SYM
%token THAN_SYM
%token THEN_SYM /* SQL-2003-R */
-%token TIES_SYM
+%token TIES_SYM /* SQL-2011-N */
%token TIMESTAMP /* SQL-2003-R */
%token TIMESTAMP_ADD
%token TIMESTAMP_DIFF
@@ -1602,7 +1603,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
%token TYPE_SYM /* SQL-2003-N */
%token UDF_RETURNS_SYM
%token ULONGLONG_NUM
-%token UNBOUNDED_SYM
+%token UNBOUNDED_SYM /* SQL-2011-N */
%token UNCOMMITTED_SYM /* SQL-2003-N */
%token UNDEFINED_SYM
%token UNDERSCORE_CHARSET
@@ -10411,6 +10412,9 @@ window_func:
simple_window_func
|
sum_expr
+ {
+ ((Item_sum *) $1)->mark_as_window_func_sum_expr();
+ }
;
simple_window_func:
@@ -14487,9 +14491,11 @@ keyword:
| DO_SYM {}
| END {}
| EXAMINED_SYM {}
+ | EXCLUDE_SYM {}
| EXECUTE_SYM {}
| FLUSH_SYM {}
| FOLLOWS_SYM {}
+ | FOLLOWING_SYM {}
| FORMAT_SYM {}
| GET_SYM {}
| HANDLER_SYM {}
@@ -14501,10 +14507,12 @@ keyword:
| OPEN_SYM {}
| OPTION {}
| OPTIONS_SYM {}
+ | OTHERS_SYM {}
| OWNER_SYM {}
| PARSER_SYM {}
| PORT_SYM {}
| PRECEDES_SYM {}
+ | PRECEDING_SYM {}
| PREPARE_SYM {}
| REMOVE_SYM {}
| REPAIR {}
@@ -14523,9 +14531,11 @@ keyword:
| START_SYM {}
| STOP_SYM {}
| STORED_SYM {}
+ | TIES_SYM {}
| TRUNCATE_SYM {}
| UNICODE_SYM {}
| UNINSTALL_SYM {}
+ | UNBOUNDED_SYM {}
| WRAPPER_SYM {}
| XA_SYM {}
| UPGRADE_SYM {}
@@ -14776,7 +14786,6 @@ keyword_sp:
| ROLE_SYM {}
| ROLLUP_SYM {}
| ROUTINE_SYM {}
- | ROWS_SYM {}
| ROW_COUNT_SYM {}
| ROW_FORMAT_SYM {}
| ROW_SYM {}
diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc
index bdfedc30d46..fa723e2707f 100644
--- a/sql/sys_vars.cc
+++ b/sql/sys_vars.cc
@@ -1,5 +1,5 @@
/* Copyright (c) 2002, 2015, Oracle and/or its affiliates.
- Copyright (c) 2012, 2016, MariaDB Corporation
+ Copyright (c) 2012, 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
@@ -449,16 +449,17 @@ static bool binlog_format_check(sys_var *self, THD *thd, set_var *var)
/*
MariaDB Galera does not support STATEMENT or MIXED binlog format currently.
*/
- if (WSREP(thd) && var->save_result.ulonglong_value != BINLOG_FORMAT_ROW)
+ if ((WSREP(thd) || opt_support_flashback) &&
+ var->save_result.ulonglong_value != BINLOG_FORMAT_ROW)
{
// Push a warning to the error log.
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, ER_UNKNOWN_ERROR,
- "MariaDB Galera does not support binlog format: %s",
+ "MariaDB Galera and flashback do not support binlog format: %s",
binlog_format_names[var->save_result.ulonglong_value]);
if (var->type == OPT_GLOBAL)
{
- WSREP_ERROR("MariaDB Galera does not support binlog format: %s",
+ WSREP_ERROR("MariaDB Galera and flashback do not support binlog format: %s",
binlog_format_names[var->save_result.ulonglong_value]);
return true;
}
@@ -3358,7 +3359,7 @@ static Sys_var_uint Sys_threadpool_max_threads(
"thread_pool_max_threads",
"Maximum allowed number of worker threads in the thread pool",
GLOBAL_VAR(threadpool_max_threads), CMD_LINE(REQUIRED_ARG),
- VALID_RANGE(1, 65536), DEFAULT(1000), BLOCK_SIZE(1),
+ VALID_RANGE(1, 65536), DEFAULT(65536), BLOCK_SIZE(1),
NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0),
ON_UPDATE(fix_tp_max_threads)
);
@@ -5468,6 +5469,13 @@ static Sys_var_ulong Sys_log_tc_size(
BLOCK_SIZE(my_getpagesize()));
#endif
+static Sys_var_ulonglong Sys_max_thread_mem(
+ "max_session_mem_used", "Amount of memory a single user session "
+ "is allowed to allocate. This limits the value of the "
+ "session variable MEM_USED", SESSION_VAR(max_mem_used),
+ CMD_LINE(REQUIRED_ARG), VALID_RANGE(8192, ULONGLONG_MAX),
+ DEFAULT(LONGLONG_MAX), BLOCK_SIZE(1));
+
#ifndef EMBEDDED_LIBRARY
static Sys_var_sesvartrack Sys_track_session_sys_vars(
diff --git a/storage/innobase/btr/btr0btr.cc b/storage/innobase/btr/btr0btr.cc
index 8acb96f1910..4bebb9ee7dd 100644
--- a/storage/innobase/btr/btr0btr.cc
+++ b/storage/innobase/btr/btr0btr.cc
@@ -335,12 +335,9 @@ btr_root_adjust_on_import(
} else {
/* Check that the table flags and the tablespace
flags match. */
- ulint flags = dict_tf_to_fsp_flags(
- table->flags,
- false,
- dict_table_is_encrypted(table));
+ ulint flags = dict_tf_to_fsp_flags(table->flags);
ulint fsp_flags = fil_space_get_flags(table->space);
- err = fsp_flags_are_equal(flags, fsp_flags)
+ err = flags == fsp_flags
? DB_SUCCESS : DB_CORRUPTION;
}
} else {
diff --git a/storage/innobase/btr/btr0cur.cc b/storage/innobase/btr/btr0cur.cc
index 87d88cea820..9033c399ce2 100644
--- a/storage/innobase/btr/btr0cur.cc
+++ b/storage/innobase/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, 2016, MariaDB Corporation.
+Copyright (c) 2015, 2017, MariaDB Corporation.
Portions of this file contain modifications contributed and copyrighted by
Google, Inc. Those modifications are gratefully acknowledged and are described
@@ -3048,12 +3048,12 @@ fail_err:
if (*rec) {
} else if (page_size.is_compressed()) {
+ ut_ad(!dict_table_is_temporary(index->table));
/* Reset the IBUF_BITMAP_FREE bits, because
page_cur_tuple_insert() will have attempted page
reorganize before failing. */
if (leaf
- && !dict_index_is_clust(index)
- && !dict_table_is_temporary(index->table)) {
+ && !dict_index_is_clust(index)) {
ibuf_reset_free_bits(block);
}
@@ -3638,7 +3638,7 @@ btr_cur_update_in_place(
#ifdef UNIV_DEBUG
{
rec_printer p(rec, offsets);
- DBUG_PRINT("ib_cur", ("update-in-place %s (" IB_ID_FMT ") by "IB_ID_FMT ": %s",
+ DBUG_PRINT("ib_cur", ("update-in-place %s (" IB_ID_FMT ") by " IB_ID_FMT ": %s",
index->name(), index->id, trx_id,
p.str().c_str()));
}
@@ -3649,6 +3649,8 @@ btr_cur_update_in_place(
/* Check that enough space is available on the compressed page. */
if (page_zip) {
+ ut_ad(!dict_table_is_temporary(index->table));
+
if (!btr_cur_update_alloc_zip(
page_zip, btr_cur_get_page_cur(cursor),
index, offsets, rec_offs_size(offsets),
@@ -3725,9 +3727,9 @@ func_exit:
if (page_zip
&& !(flags & BTR_KEEP_IBUF_BITMAP)
&& !dict_index_is_clust(index)
- && !dict_table_is_temporary(index->table)
&& page_is_leaf(buf_block_get_frame(block))) {
/* Update the free bits in the insert buffer. */
+ ut_ad(!dict_table_is_temporary(index->table));
ibuf_update_free_bits_zip(block, mtr);
}
@@ -3876,6 +3878,8 @@ any_extern:
#endif /* UNIV_ZIP_DEBUG */
if (page_zip) {
+ ut_ad(!dict_table_is_temporary(index->table));
+
if (page_zip_rec_needs_ext(new_rec_size, page_is_comp(page),
dict_index_get_n_fields(index),
dict_table_page_size(index->table))) {
@@ -3994,12 +3998,12 @@ any_extern:
func_exit:
if (!(flags & BTR_KEEP_IBUF_BITMAP)
- && !dict_index_is_clust(index)
- && !dict_table_is_temporary(index->table)) {
+ && !dict_index_is_clust(index)) {
/* Update the free bits in the insert buffer. */
if (page_zip) {
+ ut_ad(!dict_table_is_temporary(index->table));
ibuf_update_free_bits_zip(block, mtr);
- } else {
+ } else if (!dict_table_is_temporary(index->table)) {
ibuf_update_free_bits_low(block, max_ins_size, mtr);
}
}
@@ -4123,6 +4127,7 @@ btr_cur_pessimistic_update(
#ifdef UNIV_ZIP_DEBUG
ut_a(!page_zip || page_zip_validate(page_zip, page, index));
#endif /* UNIV_ZIP_DEBUG */
+ ut_ad(!page_zip || !dict_table_is_temporary(index->table));
/* The insert buffer tree should never be updated in place. */
ut_ad(!dict_index_is_ibuf(index));
ut_ad(trx_id > 0
@@ -4153,8 +4158,8 @@ btr_cur_pessimistic_update(
if (page_zip
&& optim_err != DB_ZIP_OVERFLOW
&& !dict_index_is_clust(index)
- && !dict_table_is_temporary(index->table)
&& page_is_leaf(page)) {
+ ut_ad(!dict_table_is_temporary(index->table));
ibuf_update_free_bits_zip(block, mtr);
}
@@ -4203,7 +4208,6 @@ btr_cur_pessimistic_update(
ut_ad(thr_get_trx(thr)->in_rollback);
DBUG_EXECUTE_IF("ib_blob_update_rollback", DBUG_SUICIDE(););
- RECOVERY_CRASH(99);
btr_rec_free_updated_extern_fields(
index, rec, page_zip, *offsets, update, true, mtr);
@@ -4327,14 +4331,14 @@ btr_cur_pessimistic_update(
page_cursor->rec, index, *offsets);
}
} else if (!dict_index_is_clust(index)
- && !dict_table_is_temporary(index->table)
&& page_is_leaf(page)) {
/* Update the free bits in the insert buffer.
This is the same block which was skipped by
BTR_KEEP_IBUF_BITMAP. */
if (page_zip) {
+ ut_ad(!dict_table_is_temporary(index->table));
ibuf_update_free_bits_zip(block, mtr);
- } else {
+ } else if (!dict_table_is_temporary(index->table)) {
ibuf_update_free_bits_low(block, max_ins_size,
mtr);
}
diff --git a/storage/innobase/btr/btr0pcur.cc b/storage/innobase/btr/btr0pcur.cc
index 377a332bd9f..ecf3f7c07cb 100644
--- a/storage/innobase/btr/btr0pcur.cc
+++ b/storage/innobase/btr/btr0pcur.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1996, 2015, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2016, MariaDB Corporation.
+Copyright (c) 2016, 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
@@ -120,24 +120,17 @@ btr_pcur_store_position(
page = page_align(rec);
offs = page_offset(rec);
-#ifdef UNIV_DEBUG
- if (dict_index_is_spatial(index)) {
- /* For spatial index, when we do positioning on parent
- buffer if necessary, it might not hold latches, but the
- tree must be locked to prevent change on the page */
- ut_ad((mtr_memo_contains_flagged(
- mtr, dict_index_get_lock(index),
- MTR_MEMO_X_LOCK | MTR_MEMO_SX_LOCK)
- || mtr_memo_contains_flagged(mtr, block,
- MTR_MEMO_PAGE_S_FIX
- | MTR_MEMO_PAGE_X_FIX))
- && (block->page.buf_fix_count > 0));
- } else {
- ut_ad(mtr_memo_contains_flagged(mtr, block,
- MTR_MEMO_PAGE_S_FIX
- | MTR_MEMO_PAGE_X_FIX));
- }
-#endif /* UNIV_DEBUG */
+ ut_ad(block->page.buf_fix_count);
+ /* For spatial index, when we do positioning on parent
+ buffer if necessary, it might not hold latches, but the
+ tree must be locked to prevent change on the page */
+ ut_ad(mtr_memo_contains_flagged(mtr, block,
+ MTR_MEMO_PAGE_S_FIX
+ | MTR_MEMO_PAGE_X_FIX)
+ || (dict_index_is_spatial(index)
+ && mtr_memo_contains_flagged(
+ mtr, dict_index_get_lock(index),
+ MTR_MEMO_X_LOCK | MTR_MEMO_SX_LOCK)));
if (page_is_empty(page)) {
/* It must be an empty index tree; NOTE that in this case
diff --git a/storage/innobase/btr/btr0scrub.cc b/storage/innobase/btr/btr0scrub.cc
index f361a9d8b1e..8051c517e3a 100644
--- a/storage/innobase/btr/btr0scrub.cc
+++ b/storage/innobase/btr/btr0scrub.cc
@@ -121,8 +121,8 @@ bool
btr_scrub_lock_dict_func(ulint space, bool lock_to_close_table,
const char * file, uint line)
{
- uint start = time(0);
- uint last = start;
+ time_t start = time(0);
+ time_t last = start;
while (mutex_enter_nowait(&(dict_sys->mutex))) {
/* if we lock to close a table, we wait forever
@@ -136,10 +136,11 @@ btr_scrub_lock_dict_func(ulint space, bool lock_to_close_table,
}
os_thread_sleep(250000);
- uint now = time(0);
+ time_t now = time(0);
+
if (now >= last + 30) {
fprintf(stderr,
- "WARNING: %s:%u waited %u seconds for"
+ "WARNING: %s:%u waited %lu seconds for"
" dict_sys lock, space: %lu"
" lock_to_close_table: %u\n",
file, line, now - start, space,
diff --git a/storage/innobase/buf/buf0buf.cc b/storage/innobase/buf/buf0buf.cc
index 2f4edfb5014..90ddf473232 100644
--- a/storage/innobase/buf/buf0buf.cc
+++ b/storage/innobase/buf/buf0buf.cc
@@ -35,6 +35,7 @@ Created 11/5/1995 Heikki Tuuri
#include "page0size.h"
#include "buf0buf.h"
+#include "os0api.h"
#ifdef UNIV_NONINL
#include "buf0buf.ic"
@@ -1999,6 +2000,11 @@ buf_pool_free_instance(
mutex_free(&buf_pool->zip_mutex);
mutex_free(&buf_pool->flush_list_mutex);
+ if (buf_pool->flush_rbt) {
+ rbt_free(buf_pool->flush_rbt);
+ buf_pool->flush_rbt = NULL;
+ }
+
for (bpage = UT_LIST_GET_LAST(buf_pool->LRU);
bpage != NULL;
bpage = prev_bpage) {
@@ -5943,7 +5949,6 @@ buf_page_io_complete(
ulint read_page_no;
ulint read_space_id;
byte* frame = NULL;
- bool compressed_page=false;
ut_ad(bpage->zip.data != NULL || ((buf_block_t*)bpage)->frame != NULL);
@@ -5957,8 +5962,6 @@ buf_page_io_complete(
ib::info() << "Page "
<< bpage->id
- << " in tablespace "
- << bpage->space
<< " encryption error key_version "
<< bpage->key_version;
@@ -5974,12 +5977,9 @@ buf_page_io_complete(
FALSE)) {
buf_pool->n_pend_unzip--;
- compressed_page = false;
ib::info() << "Page "
<< bpage->id
- << " in tablespace "
- << bpage->space
<< " zip_decompress failure.";
goto database_corrupted;
@@ -6005,13 +6005,13 @@ buf_page_io_complete(
} else if (read_space_id == 0 && read_page_no == 0) {
/* This is likely an uninitialized page. */
- } else if ((bpage->id.space() != 0
+ } else if ((bpage->id.space() != TRX_SYS_SPACE
&& bpage->id.space() != read_space_id)
|| bpage->id.page_no() != read_page_no) {
/* We did not compare space_id to read_space_id
- if bpage->space == 0, because the field on the
- page may contain garbage in MySQL < 4.1.1,
- which only supported bpage->space == 0. */
+ in the system tablespace, because the field
+ was written as garbage before MySQL 4.1.1,
+ which did not support innodb_file_per_table. */
ib::error() << "Space id and page no stored in "
"the page, read in are "
@@ -6019,37 +6019,16 @@ buf_page_io_complete(
<< ", should be " << bpage->id;
}
-#ifdef MYSQL_COMPRESSION
- compressed_page = Compression::is_compressed_page(frame);
-
- /* If the decompress failed then the most likely case is
- that we are reading in a page for which this instance doesn't
- support the compression algorithm. */
- if (compressed_page) {
-
- Compression::meta_t meta;
-
- Compression::deserialize_header(frame, &meta);
-
- ib::error()
- << "Page " << bpage->id << " "
- << "compressed with "
- << Compression::to_string(meta) << " "
- << "that is not supported by this instance";
- }
-#endif /* MYSQL_COMPRESSION */
-
/* From version 3.23.38 up we store the page checksum
to the 4 first bytes of the page end lsn field */
- if (compressed_page
- || buf_page_is_corrupted(
+ if (buf_page_is_corrupted(
true, frame, bpage->size,
fsp_is_checksum_disabled(bpage->id.space()))) {
/* Not a real corruption if it was triggered by
error injection */
DBUG_EXECUTE_IF("buf_page_is_corrupt_failure",
- if (bpage->space > TRX_SYS_SPACE
+ if (bpage->id.space() != TRX_SYS_SPACE
&& buf_mark_space_corrupt(bpage)) {
ib::info() <<
"Simulated page corruption";
@@ -6076,7 +6055,7 @@ database_corrupted:
/* Compressed and encrypted pages are basically gibberish avoid
printing the contents. */
- if (corrupted && !compressed_page) {
+ if (corrupted) {
ib::error()
<< "Database page corruption on disk"
@@ -6124,11 +6103,11 @@ database_corrupted:
}
ib_push_warning((void *)NULL, DB_DECRYPTION_FAILED,
- "Table in tablespace %lu encrypted."
+ "Table in tablespace %u encrypted."
"However key management plugin or used key_id %u is not found or"
" used encryption algorithm or method does not match."
" Can't continue opening the table.",
- (ulint)bpage->space, key_version);
+ bpage->id.space(), key_version);
buf_page_print(frame, bpage->size, BUF_PAGE_PRINT_NO_CRASH);
@@ -6152,9 +6131,6 @@ database_corrupted:
/* If space is being truncated then avoid ibuf operation.
During re-init we have already freed ibuf entries. */
if (uncompressed
-#ifdef MYSQL_COMPRESSION
- && !Compression::is_compressed_page(frame)
-#endif /* MYSQL_COMPRESSION */
&& !recv_no_ibuf_operations
&& !Tablespace::is_undo_tablespace(bpage->id.space())
&& bpage->id.space() != SRV_TMP_SPACE_ID
@@ -6164,11 +6140,11 @@ database_corrupted:
if (bpage && bpage->encrypted) {
fprintf(stderr,
- "InnoDB: Warning: Table in tablespace %lu encrypted."
+ "InnoDB: Warning: Table in tablespace %u encrypted."
"However key management plugin or used key_id %u is not found or"
" used encryption algorithm or method does not match."
" Can't continue opening the table.\n",
- (ulint)bpage->space, bpage->key_version);
+ bpage->id.space(), bpage->key_version);
} else {
ibuf_merge_or_delete_for_page(
(buf_block_t*) bpage, bpage->id,
@@ -7604,7 +7580,6 @@ buf_page_decrypt_after_read(
bpage->key_version = key_version;
bpage->page_encrypted = page_compressed_encrypted;
bpage->page_compressed = page_compressed;
- bpage->space = bpage->id.space();
if (page_compressed) {
/* the page we read is unencrypted */
@@ -7690,4 +7665,30 @@ buf_page_decrypt_after_read(
return (success);
}
+
+/**
+Should we punch hole to deallocate unused portion of the page.
+@param[in] bpage Page control block
+@return true if punch hole should be used, false if not */
+bool
+buf_page_should_punch_hole(
+ const buf_page_t* bpage)
+{
+ return (bpage->real_size != bpage->size.physical());
+}
+
+/**
+Calculate the length of trim (punch_hole) operation.
+@param[in] bpage Page control block
+@param[in] write_length Write length
+@return length of the trim or zero. */
+ulint
+buf_page_get_trim_length(
+ const buf_page_t* bpage,
+ ulint write_length)
+{
+ return (bpage->size.physical() - write_length);
+}
+
+
#endif /* !UNIV_INNOCHECKSUM */
diff --git a/storage/innobase/buf/buf0dblwr.cc b/storage/innobase/buf/buf0dblwr.cc
index 5f46576ad7e..4f83921a553 100644
--- a/storage/innobase/buf/buf0dblwr.cc
+++ b/storage/innobase/buf/buf0dblwr.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1995, 2015, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2013, 2016, MariaDB Corporation. All Rights Reserved.
+Copyright (c) 2013, 2017, MariaDB Corporation. 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
@@ -380,8 +380,6 @@ buf_dblwr_init_or_load_pages(
IORequest read_request(IORequest::READ);
- read_request.disable_compression();
-
err = os_file_read(
read_request,
file, read_buf, TRX_SYS_PAGE_NO * UNIV_PAGE_SIZE,
@@ -496,11 +494,6 @@ buf_dblwr_init_or_load_pages(
IORequest write_request(IORequest::WRITE);
- /* Recovered data file pages are written out
- as uncompressed. */
-
- write_request.disable_compression();
-
err = os_file_write(
write_request, path, file, page,
source_page_no * UNIV_PAGE_SIZE,
@@ -516,8 +509,9 @@ buf_dblwr_init_or_load_pages(
return(err);
}
- } else {
-
+ } else if (memcmp(field_ref_zero, page + FIL_PAGE_LSN, 8)) {
+ /* Each valid page header must contain
+ a nonzero FIL_PAGE_LSN field. */
recv_dblwr.add(page);
}
@@ -551,11 +545,9 @@ buf_dblwr_process(void)
for (recv_dblwr_t::list::iterator i = recv_dblwr.pages.begin();
i != recv_dblwr.pages.end();
++i, ++page_no_dblwr) {
- bool is_compressed = false;
-
- const byte* page = *i;
- ulint page_no = page_get_page_no(page);
- ulint space_id = page_get_space_id(page);
+ byte* page = *i;
+ ulint page_no = page_get_page_no(page);
+ ulint space_id = page_get_space_id(page);
fil_space_t* space = fil_space_get(space_id);
@@ -567,163 +559,130 @@ buf_dblwr_process(void)
fil_space_open_if_needed(space);
+ const page_id_t page_id(space_id, page_no);
+
if (page_no >= space->size) {
- /* Do not report the warning if the tablespace is
- schedule for truncate or was truncated and we have live
- MLOG_TRUNCATE record in redo. */
- bool skip_warning =
- srv_is_tablespace_truncated(space_id)
- || srv_was_tablespace_truncated(space);
-
- if (!skip_warning) {
- ib::warn() << "Page " << page_no_dblwr
- << " in the doublewrite buffer is"
- " not within space bounds: page "
- << page_id_t(space_id, page_no);
+ /* Do not report the warning if the tablespace
+ is scheduled for truncation or was truncated
+ and we have parsed an MLOG_TRUNCATE record. */
+ if (!srv_is_tablespace_truncated(space_id)
+ && !srv_was_tablespace_truncated(space)) {
+ ib::warn() << "A copy of page " << page_id
+ << " in the doublewrite buffer slot "
+ << page_no_dblwr
+ << " is not within space bounds";
}
- } else {
- const page_size_t page_size(space->flags);
- const page_id_t page_id(space_id, page_no);
+ continue;
+ }
- /* We want to ensure that for partial reads the
- unread portion of the page is NUL. */
- memset(read_buf, 0x0, page_size.physical());
+ const page_size_t page_size(space->flags);
+ ut_ad(!buf_page_is_zeroes(page, page_size));
- IORequest request;
+ /* We want to ensure that for partial reads the
+ unread portion of the page is NUL. */
+ memset(read_buf, 0x0, page_size.physical());
- request.dblwr_recover();
+ IORequest request;
- /* Read in the actual page from the file */
- dberr_t err = fil_io(
- request, true,
- page_id, page_size,
- 0, page_size.physical(), read_buf, NULL, NULL);
+ request.dblwr_recover();
- if (err != DB_SUCCESS) {
+ /* Read in the actual page from the file */
+ dberr_t err = fil_io(
+ request, true,
+ page_id, page_size,
+ 0, page_size.physical(), read_buf, NULL);
- ib::warn()
- << "Double write buffer recovery: "
- << page_id << " read failed with "
- << "error: " << ut_strerr(err);
- }
+ if (err != DB_SUCCESS) {
+ ib::warn()
+ << "Double write buffer recovery: "
+ << page_id << " read failed with "
+ << "error: " << ut_strerr(err);
+ }
- /* Is page compressed ? */
- is_compressed = fil_page_is_compressed_encrypted(read_buf) |
- fil_page_is_compressed(read_buf);
+ const bool is_all_zero = buf_page_is_zeroes(
+ read_buf, page_size);
- /* If page was compressed, decompress it before we
- check checksum. */
- if (is_compressed) {
- fil_decompress_page(NULL, read_buf, UNIV_PAGE_SIZE, NULL, true);
+ if (is_all_zero) {
+ /* 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 (fil_page_is_compressed_encrypted(read_buf) ||
+ fil_page_is_compressed(read_buf)) {
+ /* Decompress the page before
+ validating the checksum. */
+ fil_decompress_page(
+ NULL, read_buf, UNIV_PAGE_SIZE,
+ NULL, true);
}
- if (err != DB_SUCCESS) {
- ib::warn()
- << "Double write buffer recovery: "
- << page_id << " read failed with "
- << "error: " << ut_strerr(err);
+ if (fil_space_verify_crypt_checksum(
+ read_buf, page_size)
+ || !buf_page_is_corrupted(
+ true, read_buf, page_size, false)) {
+ /* The page is good; there is no need
+ to consult the doublewrite buffer. */
+ continue;
}
- if (fil_space_verify_crypt_checksum(read_buf, page_size)) {
-
- /* page is encrypted and checksum is OK */
- } else if (buf_page_is_corrupted(
- true, read_buf, page_size,
- fsp_is_checksum_disabled(space_id))) {
-
- ib::warn() << "Database page corruption or"
- << " a failed file read of page "
- << page_id
- << ". Trying to recover it from the"
- << " doublewrite buffer.";
-
- /* Is page compressed ? */
- is_compressed = fil_page_is_compressed_encrypted(page) |
- fil_page_is_compressed(page);
-
- /* If page was compressed, decompress it before we
- check checksum. */
- if (is_compressed) {
- fil_decompress_page(NULL, (byte*)page, UNIV_PAGE_SIZE, NULL, true);
- }
-
- if (fil_space_verify_crypt_checksum(page, page_size)) {
- /* the doublewrite buffer page is encrypted and OK */
- } else if (buf_page_is_corrupted(
- true, page, page_size,
- fsp_is_checksum_disabled(space_id))) {
-
- ib::error() << "Dump of the page:";
-
- buf_page_print(
- read_buf, page_size,
- BUF_PAGE_PRINT_NO_CRASH);
- ib::error() << "Dump of corresponding"
- " page in doublewrite buffer:";
-
- buf_page_print(
- page, page_size,
- BUF_PAGE_PRINT_NO_CRASH);
-
- ib::fatal() << "The page in the"
- " doublewrite buffer is"
- " corrupt. Cannot continue"
- " operation. You can try to"
- " recover the database with"
- " innodb_force_recovery=6";
- }
- } else if (buf_page_is_zeroes(read_buf, page_size)
- && !buf_page_is_zeroes(page, page_size)
- && !buf_page_is_corrupted(
- true, page, page_size,
- fsp_is_checksum_disabled(space_id))) {
-
- /* Database page contained only zeroes, while
- a valid copy is available in dblwr buffer. */
-
- } else {
-
- bool t1 = buf_page_is_zeroes(
- read_buf, page_size);
-
- bool t2 = buf_page_is_zeroes(page, page_size);
-
- bool t3 = buf_page_is_corrupted(
- true, page, page_size,
- fsp_is_checksum_disabled(space_id));
-
- if (t1 && !(t2 || t3)) {
+ /* We intentionally skip this message for
+ is_all_zero pages. */
+ ib::info()
+ << "Trying to recover page " << page_id
+ << " from the doublewrite buffer.";
+ }
- /* Database page contained only
- zeroes, while a valid copy is
- available in dblwr buffer. */
+ /* Next, validate the doublewrite page. */
+ if (fil_page_is_compressed_encrypted(page) ||
+ fil_page_is_compressed(page)) {
+ /* Decompress the page before
+ validating the checksum. */
+ fil_decompress_page(
+ NULL, page, UNIV_PAGE_SIZE, NULL, true);
+ }
- } else {
- continue;
- }
+ if (!fil_space_verify_crypt_checksum(page, page_size)
+ && buf_page_is_corrupted(true, page, page_size, false)) {
+ if (!is_all_zero) {
+ ib::warn() << "A doublewrite copy of page "
+ << page_id << " is corrupted.";
}
+ /* 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;
+ }
- /* Recovered data file pages are written out
- as uncompressed. */
-
- IORequest write_request(IORequest::WRITE);
+ if (page_no == 0) {
+ /* Check the FSP_SPACE_FLAGS. */
+ ulint flags = fsp_header_get_flags(page);
+ if (!fsp_flags_is_valid(flags)
+ && 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. */
+ }
- write_request.disable_compression();
+ /* Write the good page from the doublewrite buffer to
+ the intended position. */
- /* Write the good page from the doublewrite
- buffer to the intended position. */
+ IORequest write_request(IORequest::WRITE);
- fil_io(write_request, true,
- page_id, page_size,
- 0, page_size.physical(),
- const_cast<byte*>(page), NULL, NULL);
+ fil_io(write_request, true, page_id, page_size,
+ 0, page_size.physical(),
+ const_cast<byte*>(page), NULL);
- ib::info()
- << "Recovered page "
- << page_id
- << " from the doublewrite buffer.";
- }
+ ib::info() << "Recovered page " << page_id
+ << " from the doublewrite buffer.";
}
recv_dblwr.pages.clear();
@@ -953,7 +912,7 @@ buf_dblwr_write_block_to_datafile(
type |= IORequest::DO_NOT_WAKE;
}
- IORequest request(type);
+ IORequest request(type, const_cast<buf_page_t*>(bpage));
/* We request frame here to get correct buffer in case of
encryption and/or page compression */
@@ -965,7 +924,7 @@ buf_dblwr_write_block_to_datafile(
fil_io(request, sync, bpage->id, bpage->size, 0,
bpage->size.physical(),
(void*) frame,
- (void*) bpage, NULL);
+ (void*) bpage);
} else {
ut_ad(!bpage->size.is_compressed());
@@ -979,8 +938,8 @@ buf_dblwr_write_block_to_datafile(
buf_dblwr_check_page_lsn(block->frame);
fil_io(request,
- sync, bpage->id, bpage->size, 0, bpage->size.physical(),
- frame, block, (ulint *)&bpage->write_size);
+ sync, bpage->id, bpage->size, 0, bpage->real_size,
+ frame, block);
}
}
@@ -1082,7 +1041,7 @@ try_again:
fil_io(IORequestWrite, true,
page_id_t(TRX_SYS_SPACE, buf_dblwr->block1), univ_page_size,
- 0, len, (void*) write_buf, NULL, NULL);
+ 0, len, (void*) write_buf, NULL);
if (buf_dblwr->first_free <= TRX_SYS_DOUBLEWRITE_BLOCK_SIZE) {
/* No unwritten pages in the second block. */
@@ -1098,7 +1057,7 @@ try_again:
fil_io(IORequestWrite, true,
page_id_t(TRX_SYS_SPACE, buf_dblwr->block2), univ_page_size,
- 0, len, (void*) write_buf, NULL, NULL);
+ 0, len, (void*) write_buf, NULL);
flush:
/* increment the doublewrite flushed pages counter */
@@ -1333,7 +1292,6 @@ retry:
0,
univ_page_size.physical(),
(void *)(buf_dblwr->write_buf + univ_page_size.physical() * i),
- NULL,
NULL);
} else {
/* It is a regular page. Write it directly to the
@@ -1345,7 +1303,6 @@ retry:
0,
univ_page_size.physical(),
(void*) frame,
- NULL,
NULL);
}
diff --git a/storage/innobase/buf/buf0flu.cc b/storage/innobase/buf/buf0flu.cc
index 2738fbd0ec7..5fdb735e0d3 100644
--- a/storage/innobase/buf/buf0flu.cc
+++ b/storage/innobase/buf/buf0flu.cc
@@ -1093,11 +1093,11 @@ buf_flush_write_block_low(
ulint type = IORequest::WRITE | IORequest::DO_NOT_WAKE;
- IORequest request(type);
+ IORequest request(type, bpage);
fil_io(request,
sync, bpage->id, bpage->size, 0, bpage->size.physical(),
- frame, bpage, NULL);
+ frame, bpage);
} else {
if (flush_type == BUF_FLUSH_SINGLE_PAGE) {
buf_dblwr_write_single_page(bpage, sync);
diff --git a/storage/innobase/buf/buf0rea.cc b/storage/innobase/buf/buf0rea.cc
index ea3c1ceccf9..4d68ad5ac51 100644
--- a/storage/innobase/buf/buf0rea.cc
+++ b/storage/innobase/buf/buf0rea.cc
@@ -182,7 +182,7 @@ buf_read_page_low(
*err = fil_io(
request, sync, page_id, page_size, 0, page_size.physical(),
- dst, bpage, NULL);
+ dst, bpage);
if (sync) {
thd_wait_end(NULL);
diff --git a/storage/innobase/dict/dict0crea.cc b/storage/innobase/dict/dict0crea.cc
index cfea64d51c2..9321faed9c6 100644
--- a/storage/innobase/dict/dict0crea.cc
+++ b/storage/innobase/dict/dict0crea.cc
@@ -377,75 +377,6 @@ dict_build_table_def_step(
return(err);
}
-/** Build a tablespace to store various objects.
-@param[in,out] tablespace Tablespace object describing what to build.
-@return DB_SUCCESS or error code. */
-dberr_t
-dict_build_tablespace(
- Tablespace* tablespace)
-{
- dberr_t err = DB_SUCCESS;
- mtr_t mtr;
- ulint space = 0;
-
- ut_ad(mutex_own(&dict_sys->mutex));
- ut_ad(tablespace);
-
- DBUG_EXECUTE_IF("out_of_tablespace_disk",
- return(DB_OUT_OF_FILE_SPACE););
- /* Get a new space id. */
- dict_hdr_get_new_id(NULL, NULL, &space, NULL, false);
- if (space == ULINT_UNDEFINED) {
- return(DB_ERROR);
- }
- tablespace->set_space_id(space);
-
- Datafile* datafile = tablespace->first_datafile();
-
- /* We create a new generic empty tablespace.
- We initially let it be 4 pages:
- - page 0 is the fsp header and an extent descriptor page,
- - page 1 is an ibuf bitmap page,
- - page 2 is the first inode page,
- - page 3 will contain the root of the clustered index of the
- first table we create here. */
-
- err = fil_ibd_create(
- space,
- tablespace->name(),
- datafile->filepath(),
- tablespace->flags(),
- FIL_IBD_FILE_INITIAL_SIZE,
- tablespace->encryption_mode(),
- tablespace->key_id());
-
- if (err != DB_SUCCESS) {
- return(err);
- }
-
- /* Update SYS_TABLESPACES and SYS_DATAFILES */
- err = dict_replace_tablespace_and_filepath(
- tablespace->space_id(), tablespace->name(),
- datafile->filepath(), tablespace->flags());
- if (err != DB_SUCCESS) {
- os_file_delete(innodb_data_file_key, datafile->filepath());
- return(err);
- }
-
- mtr_start(&mtr);
- mtr.set_named_space(space);
-
- /* Once we allow temporary general tablespaces, we must do this;
- mtr_set_log_mode(&mtr, MTR_LOG_NO_REDO); */
- ut_a(!FSP_FLAGS_GET_TEMPORARY(tablespace->flags()));
-
- fsp_header_init(space, FIL_IBD_FILE_INITIAL_SIZE, &mtr);
-
- mtr_commit(&mtr);
-
- return(err);
-}
-
/** Builds a tablespace to contain a table, using file-per-table=1.
@param[in,out] table Table to build in its own tablespace.
@param[in] node Table create node
@@ -473,6 +404,7 @@ dict_build_tablespace_for_table(
DICT_TF2_FTS_AUX_HEX_NAME););
if (needs_file_per_table) {
+ ut_ad(!dict_table_is_temporary(table));
/* This table will need a new tablespace. */
ut_ad(dict_table_get_format(table) <= UNIV_FORMAT_MAX);
@@ -493,23 +425,10 @@ dict_build_tablespace_for_table(
table->space = static_cast<unsigned int>(space);
/* Determine the tablespace flags. */
- bool is_temp = dict_table_is_temporary(table);
- bool is_encrypted = dict_table_is_encrypted(table);
bool has_data_dir = DICT_TF_HAS_DATA_DIR(table->flags);
- ulint fsp_flags = dict_tf_to_fsp_flags(table->flags,
- is_temp,
- is_encrypted);
-
- /* Determine the full filepath */
- if (is_temp) {
- /* Temporary table filepath contains a full path
- and a filename without the extension. */
- ut_ad(table->dir_path_of_temp_table);
- filepath = fil_make_filepath(
- table->dir_path_of_temp_table,
- NULL, IBD, false);
+ ulint fsp_flags = dict_tf_to_fsp_flags(table->flags);
- } else if (has_data_dir) {
+ if (has_data_dir) {
ut_ad(table->data_dir_path);
filepath = fil_make_filepath(
table->data_dir_path,
@@ -545,7 +464,6 @@ dict_build_tablespace_for_table(
mtr_start(&mtr);
mtr.set_named_space(table->space);
- dict_disable_redo_if_temporary(table, &mtr);
bool ret = fsp_header_init(table->space,
FIL_IBD_FILE_INITIAL_SIZE,
@@ -556,15 +474,7 @@ dict_build_tablespace_for_table(
return(DB_ERROR);
}
} else {
- /* We do not need to build a tablespace for this table. It
- is already built. Just find the correct tablespace ID. */
-
- if (DICT_TF_HAS_SHARED_SPACE(table->flags)) {
- ut_ad(table->tablespace != NULL);
-
- ut_ad(table->space == fil_space_get_id_by_name(
- table->tablespace()));
- } else if (dict_table_is_temporary(table)) {
+ if (dict_table_is_temporary(table)) {
/* Use the shared temporary tablespace.
Note: The temp tablespace supports all non-Compressed
row formats whereas the system tablespace only
@@ -2097,7 +2007,7 @@ dict_foreign_def_get(
char* fk_def = (char *)mem_heap_alloc(foreign->heap, 4*1024);
const char* tbname;
char tablebuf[MAX_TABLE_NAME_LEN + 1] = "";
- int i;
+ unsigned i;
char* bufend;
tbname = dict_remove_db_name(foreign->id);
@@ -2115,7 +2025,7 @@ dict_foreign_def_get(
strlen(foreign->foreign_col_names[i]),
trx->mysql_thd);
strcat(fk_def, buf);
- if (i < foreign->n_fields-1) {
+ if (i < static_cast<unsigned>(foreign->n_fields-1)) {
strcat(fk_def, (char *)",");
}
}
@@ -2139,7 +2049,7 @@ dict_foreign_def_get(
trx->mysql_thd);
buf[bufend - buf] = '\0';
strcat(fk_def, buf);
- if (i < foreign->n_fields-1) {
+ if (i < (uint)foreign->n_fields-1) {
strcat(fk_def, (char *)",");
}
}
diff --git a/storage/innobase/dict/dict0dict.cc b/storage/innobase/dict/dict0dict.cc
index 0013a5f690f..21380cffae3 100644
--- a/storage/innobase/dict/dict0dict.cc
+++ b/storage/innobase/dict/dict0dict.cc
@@ -1696,25 +1696,17 @@ dict_table_rename_in_cache(
ib::info() << "Delete of " << filepath << " failed.";
}
-
ut_free(filepath);
} else if (dict_table_is_file_per_table(table)) {
- if (table->dir_path_of_temp_table != NULL) {
- ib::error() << "Trying to rename a TEMPORARY TABLE "
- << old_name
- << " ( " << table->dir_path_of_temp_table
- << " )";
- return(DB_ERROR);
- }
-
char* new_path = NULL;
char* old_path = fil_space_get_first_path(table->space);
+ ut_ad(!dict_table_is_temporary(table));
+
if (DICT_TF_HAS_DATA_DIR(table->flags)) {
new_path = os_file_make_new_pathname(
old_path, new_name);
-
err = RemoteDatafile::create_link_file(
new_name, new_path);
@@ -3526,7 +3518,6 @@ dict_foreign_find_index(
if (types_idx != index
&& !(index->type & DICT_FTS)
&& !dict_index_is_spatial(index)
- && !dict_index_has_virtual(index)
&& !index->to_be_dropped
&& dict_foreign_qualify_index(
table, col_names, columns, n_cols,
@@ -4034,6 +4025,23 @@ dict_scan_col(
break;
}
}
+
+ for (i = 0; i < dict_table_get_n_v_cols(table); i++) {
+
+ const char* col_name = dict_table_get_v_col_name(
+ table, i);
+
+ if (0 == innobase_strcasecmp(col_name, *name)) {
+ /* Found */
+ dict_v_col_t * vcol;
+ *success = TRUE;
+ vcol = dict_table_get_nth_v_col(table, i);
+ *column = &vcol->m_col;
+ strcpy((char*) *name, col_name);
+
+ break;
+ }
+ }
}
return(ptr);
@@ -5018,9 +5026,7 @@ col_loop1:
for (i = 0; i < foreign->n_fields; i++) {
foreign->foreign_col_names[i] = mem_heap_strdup(
- foreign->heap,
- dict_table_get_col_name(table,
- dict_col_get_no(columns[i])));
+ foreign->heap, column_names[i]);
}
ptr = dict_scan_table_name(cs, ptr, &referenced_table, name,
@@ -5338,6 +5344,7 @@ try_find_index:
ref_column_names, i,
foreign->foreign_index,
TRUE, FALSE, &index_error, &err_col, &err_index);
+
if (!index) {
mutex_enter(&dict_foreign_err_mutex);
dict_foreign_error_report_low(ef, create_name);
@@ -7040,8 +7047,6 @@ dict_foreign_qualify_index(
field = dict_index_get_nth_field(index, i);
col_no = dict_col_get_no(field->col);
- ut_ad(!dict_col_is_virtual(field->col));
-
if (field->prefix_len != 0) {
/* We do not accept column prefix
indexes here */
@@ -7067,6 +7072,15 @@ dict_foreign_qualify_index(
? col_names[col_no]
: dict_table_get_col_name(table, col_no);
+ if (dict_col_is_virtual(field->col)) {
+ for (ulint j = 0; j < table->n_v_def; j++) {
+ col_name = dict_table_get_v_col_name(table, j);
+ if (innobase_strcasecmp(field->name,col_name) == 0) {
+ break;
+ }
+ }
+ }
+
if (0 != innobase_strcasecmp(columns[i], col_name)) {
return(false);
}
@@ -7244,71 +7258,6 @@ dict_index_zip_pad_optimal_page_size(
return(ut_max(sz, min_sz));
}
-/** Convert a 32 bit integer table flags to the 32 bit FSP Flags.
-Fsp Flags are written into the tablespace header at the offset
-FSP_SPACE_FLAGS and are also stored in the fil_space_t::flags field.
-The following chart shows the translation of the low order bit.
-Other bits are the same.
- Low order bit
- | REDUNDANT | COMPACT | COMPRESSED | DYNAMIC
-dict_table_t::flags | 0 | 1 | 1 | 1
-fil_space_t::flags | 0 | 0 | 1 | 1
-@param[in] table_flags dict_table_t::flags
-@param[in] is_temp whether the tablespace is temporary
-@param[in] is_encrypted whether the tablespace is encrypted
-@return tablespace flags (fil_space_t::flags) */
-ulint
-dict_tf_to_fsp_flags(
- ulint table_flags,
- bool is_temp,
- bool is_encrypted)
-{
- DBUG_EXECUTE_IF("dict_tf_to_fsp_flags_failure",
- return(ULINT_UNDEFINED););
-
- bool has_atomic_blobs =
- DICT_TF_HAS_ATOMIC_BLOBS(table_flags);
- page_size_t page_size = dict_tf_get_page_size(table_flags);
- bool has_data_dir = DICT_TF_HAS_DATA_DIR(table_flags);
- bool is_shared = DICT_TF_HAS_SHARED_SPACE(table_flags);
- bool page_compression = DICT_TF_GET_PAGE_COMPRESSION(table_flags);
- ulint page_compression_level = DICT_TF_GET_PAGE_COMPRESSION_LEVEL(table_flags);
-
- ut_ad(!page_size.is_compressed() || has_atomic_blobs);
-
- /* General tablespaces that are not compressed do not get the
- flags for dynamic row format (POST_ANTELOPE & ATOMIC_BLOBS) */
- if (is_shared && !page_size.is_compressed()) {
- has_atomic_blobs = false;
- }
-
- ulint fsp_flags = fsp_flags_init(page_size,
- has_atomic_blobs,
- has_data_dir,
- is_shared,
- is_temp,
- 0,
- 0,
- 0,
- is_encrypted);
-
- /* In addition, tablespace flags also contain if the page
- compression is used for this table. */
- if (page_compression) {
- fsp_flags |= FSP_FLAGS_SET_PAGE_COMPRESSION(fsp_flags, page_compression);
- }
-
- /* In addition, tablespace flags also contain page compression level
- if page compression is used for this table. */
- if (page_compression && page_compression_level) {
- fsp_flags |= FSP_FLAGS_SET_PAGE_COMPRESSION_LEVEL(fsp_flags, page_compression_level);
- }
-
- ut_ad(fsp_flags_is_valid(fsp_flags));
-
- return(fsp_flags);
-}
-
/*************************************************************//**
Convert table flag to row format string.
@return row format name. */
diff --git a/storage/innobase/dict/dict0load.cc b/storage/innobase/dict/dict0load.cc
index b40d659e362..db14983cd8f 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, MariaDB Corporation.
+Copyright (c) 2016, 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
@@ -811,102 +811,6 @@ dict_get_first_path(
return(filepath);
}
-/** Gets the space name from SYS_TABLESPACES for a given space ID.
-@param[in] space_id Tablespace ID
-@param[in] callers_heap A heap to allocate from, may be NULL
-@return Tablespace name (caller is responsible to free it)
-@retval NULL if no dictionary entry was found. */
-static
-char*
-dict_space_get_name(
- ulint space_id,
- mem_heap_t* callers_heap)
-{
- mtr_t mtr;
- dict_table_t* sys_tablespaces;
- dict_index_t* sys_index;
- dtuple_t* tuple;
- dfield_t* dfield;
- byte* buf;
- btr_pcur_t pcur;
- const rec_t* rec;
- const byte* field;
- ulint len;
- char* space_name = NULL;
- mem_heap_t* heap = mem_heap_create(1024);
-
- ut_ad(mutex_own(&dict_sys->mutex));
-
- sys_tablespaces = dict_table_get_low("SYS_TABLESPACES");
- if (sys_tablespaces == NULL) {
- ut_a(!srv_sys_tablespaces_open);
- return(NULL);
- }
-
- sys_index = UT_LIST_GET_FIRST(sys_tablespaces->indexes);
-
- ut_ad(!dict_table_is_comp(sys_tablespaces));
- ut_ad(name_of_col_is(sys_tablespaces, sys_index,
- DICT_FLD__SYS_TABLESPACES__SPACE, "SPACE"));
- ut_ad(name_of_col_is(sys_tablespaces, sys_index,
- DICT_FLD__SYS_TABLESPACES__NAME, "NAME"));
-
- tuple = dtuple_create(heap, 1);
- dfield = dtuple_get_nth_field(tuple, DICT_FLD__SYS_TABLESPACES__SPACE);
-
- buf = static_cast<byte*>(mem_heap_alloc(heap, 4));
- mach_write_to_4(buf, space_id);
-
- dfield_set_data(dfield, buf, 4);
- dict_index_copy_types(tuple, sys_index, 1);
-
- mtr_start(&mtr);
-
- btr_pcur_open_on_user_rec(sys_index, tuple, PAGE_CUR_GE,
- BTR_SEARCH_LEAF, &pcur, &mtr);
-
- rec = btr_pcur_get_rec(&pcur);
-
- /* Get the tablespace name from this SYS_TABLESPACES record. */
- if (btr_pcur_is_on_user_rec(&pcur)) {
- field = rec_get_nth_field_old(
- rec, DICT_FLD__SYS_TABLESPACES__SPACE, &len);
- ut_a(len == 4);
-
- if (space_id == mach_read_from_4(field)) {
- /* A record for this space ID was found. */
- field = rec_get_nth_field_old(
- rec, DICT_FLD__SYS_TABLESPACES__NAME, &len);
-
- ut_ad(len > 0);
- ut_ad(len < OS_FILE_MAX_PATH);
-
- if (len > 0 && len != UNIV_SQL_NULL) {
- /* Found a tablespace name. */
- if (callers_heap == NULL) {
- space_name = mem_strdupl(
- reinterpret_cast<
- const char*>(field),
- len);
- } else {
- space_name = mem_heap_strdupl(
- callers_heap,
- reinterpret_cast<
- const char*>(field),
- len);
- }
- ut_ad(space_name);
- }
- }
- }
-
- btr_pcur_close(&pcur);
- mtr_commit(&mtr);
- mem_heap_free(heap);
-
- return(space_name);
-}
-
/** Update the record for space_id in SYS_TABLESPACES to this filepath.
@param[in] space_id Tablespace ID
@param[in] filepath Tablespace filepath
@@ -1144,106 +1048,6 @@ dict_sys_tablespaces_rec_read(
return(true);
}
-/** Load and check each general tablespace mentioned in the SYS_TABLESPACES.
-Ignore system and file-per-table tablespaces.
-If it is valid, add it to the file_system list.
-@param[in] validate true when the previous shutdown was not clean
-@return the highest space ID found. */
-UNIV_INLINE
-ulint
-dict_check_sys_tablespaces(
- bool validate)
-{
- ulint max_space_id = 0;
- btr_pcur_t pcur;
- const rec_t* rec;
- mtr_t mtr;
-
- DBUG_ENTER("dict_check_sys_tablespaces");
-
- ut_ad(rw_lock_own(dict_operation_lock, RW_LOCK_X));
- ut_ad(mutex_own(&dict_sys->mutex));
-
- /* Before traversing it, let's make sure we have
- SYS_TABLESPACES and SYS_DATAFILES loaded. */
- dict_table_get_low("SYS_TABLESPACES");
- dict_table_get_low("SYS_DATAFILES");
-
- mtr_start(&mtr);
-
- for (rec = dict_startscan_system(&pcur, &mtr, SYS_TABLESPACES);
- rec != NULL;
- rec = dict_getnext_system(&pcur, &mtr))
- {
- char space_name[NAME_LEN];
- ulint space_id = 0;
- ulint fsp_flags;
-
- if (!dict_sys_tablespaces_rec_read(rec, &space_id,
- space_name, &fsp_flags)) {
- continue;
- }
-
- /* Ignore system and file-per-table tablespaces. */
- if (is_system_tablespace(space_id)
- || !fsp_is_shared_tablespace(fsp_flags)) {
- continue;
- }
-
- /* Ignore tablespaces that already are in the tablespace
- cache. */
- if (fil_space_for_table_exists_in_mem(
- space_id, space_name, false, true, NULL, 0, NULL)) {
- /* Recovery can open a datafile that does not
- match SYS_DATAFILES. If they don't match, update
- SYS_DATAFILES. */
- char *dict_path = dict_get_first_path(space_id);
- char *fil_path = fil_space_get_first_path(space_id);
- if (dict_path && fil_path
- && strcmp(dict_path, fil_path)) {
- dict_update_filepath(space_id, fil_path);
- }
- ut_free(dict_path);
- ut_free(fil_path);
- continue;
- }
-
- /* Set the expected filepath from the data dictionary.
- If the file is found elsewhere (from an ISL or the default
- location) or this path is the same file but looks different,
- fil_ibd_open() will update the dictionary with what is
- opened. */
- char* filepath = dict_get_first_path(space_id);
-
- validate = true; /* Encryption */
-
- /* Check that the .ibd file exists. */
- dberr_t err = fil_ibd_open(
- validate,
- !srv_read_only_mode && srv_log_file_size != 0,
- FIL_TYPE_TABLESPACE,
- space_id,
- fsp_flags,
- space_name,
- filepath,
- NULL);
-
- if (err != DB_SUCCESS) {
- ib::warn() << "Ignoring tablespace "
- << id_name_t(space_name)
- << " because it could not be opened.";
- }
-
- max_space_id = ut_max(max_space_id, space_id);
-
- ut_free(filepath);
- }
-
- mtr_commit(&mtr);
-
- DBUG_RETURN(max_space_id);
-}
-
/** Read and return 5 integer fields from a SYS_TABLES record.
@param[in] rec A record of SYS_TABLES
@param[in] name Table Name, the same as SYS_TABLES.NAME
@@ -1363,7 +1167,6 @@ dict_check_sys_tables(
rec = dict_getnext_system(&pcur, &mtr)) {
const byte* field;
ulint len;
- char* space_name;
table_name_t table_name;
table_id_t table_id;
ulint space_id;
@@ -1395,39 +1198,24 @@ dict_check_sys_tables(
}
if (flags2 & DICT_TF2_DISCARDED) {
- ib::info() << "Ignoring tablespace " << table_name
+ ib::info() << "Ignoring tablespace for " << table_name
<< " because the DISCARD flag is set .";
ut_free(table_name.m_name);
continue;
}
/* If the table is not a predefined tablespace then it must
- be in a file-per-table or shared tablespace.
+ be in a file-per-table tablespace.
Note that flags2 is not available for REDUNDANT tables,
so don't check those. */
- ut_ad(DICT_TF_HAS_SHARED_SPACE(flags)
- || !DICT_TF_GET_COMPACT(flags)
+ ut_ad(!DICT_TF_GET_COMPACT(flags)
|| flags2 & DICT_TF2_USE_FILE_PER_TABLE);
- /* Look up the tablespace name in the data dictionary if this
- is a shared tablespace. For file-per-table, the table_name
- and the tablespace_name are the same.
- Some hidden tables like FTS AUX tables may not be found in
- the dictionary since they can always be found in the default
- location. If so, then dict_space_get_name() will return NULL,
- the space name must be the table_name, and the filepath can be
- discovered in the default location.*/
- char* shared_space_name = dict_space_get_name(space_id, NULL);
- space_name = shared_space_name == NULL
- ? table_name.m_name
- : shared_space_name;
-
/* Now that we have the proper name for this tablespace,
- whether it is a shared tablespace or a single table
- tablespace, look to see if it is already in the tablespace
- cache. */
+ look to see if it is already in the tablespace cache. */
if (fil_space_for_table_exists_in_mem(
- space_id, space_name, false, true, NULL, 0, NULL)) {
+ space_id, table_name.m_name,
+ false, true, NULL, 0, NULL, flags)) {
/* Recovery can open a datafile that does not
match SYS_DATAFILES. If they don't match, update
SYS_DATAFILES. */
@@ -1440,7 +1228,6 @@ dict_check_sys_tables(
ut_free(dict_path);
ut_free(fil_path);
ut_free(table_name.m_name);
- ut_free(shared_space_name);
continue;
}
@@ -1452,33 +1239,26 @@ dict_check_sys_tables(
char* filepath = dict_get_first_path(space_id);
/* Check that the .ibd file exists. */
- bool is_temp = flags2 & DICT_TF2_TEMPORARY;
- bool is_encrypted = flags2 & DICT_TF2_ENCRYPTION;
- ulint fsp_flags = dict_tf_to_fsp_flags(flags,
- is_temp,
- is_encrypted);
validate = true; /* Encryption */
dberr_t err = fil_ibd_open(
validate,
!srv_read_only_mode && srv_log_file_size != 0,
FIL_TYPE_TABLESPACE,
- space_id,
- fsp_flags,
- space_name,
+ space_id, dict_tf_to_fsp_flags(flags),
+ table_name.m_name,
filepath,
NULL);
if (err != DB_SUCCESS) {
- ib::warn() << "Ignoring tablespace "
- << id_name_t(space_name)
+ ib::warn() << "Ignoring tablespace for "
+ << table_name
<< " because it could not be opened.";
}
max_space_id = ut_max(max_space_id, space_id);
ut_free(table_name.m_name);
- ut_free(shared_space_name);
ut_free(filepath);
}
@@ -1488,7 +1268,6 @@ dict_check_sys_tables(
}
/** Check each tablespace found in the data dictionary.
-Look at each general tablespace found in SYS_TABLESPACES.
Then look at each table defined in SYS_TABLES that has a space_id > 0
to find all the file-per-table tablespaces.
@@ -1521,16 +1300,10 @@ dict_check_tablespaces_and_store_max_id(
fil_set_max_space_id_if_bigger(max_space_id);
- /* Open all general tablespaces found in SYS_TABLESPACES. */
- ulint max1 = dict_check_sys_tablespaces(validate);
-
/* Open all tablespaces referenced in SYS_TABLES.
This will update SYS_TABLESPACES and SYS_DATAFILES if it
finds any file-per-table tablespaces not already there. */
- ulint max2 = dict_check_sys_tables(validate);
-
- /* Store the max space_id found */
- max_space_id = ut_max(max1, max2);
+ max_space_id = dict_check_sys_tables(validate);
fil_set_max_space_id_if_bigger(max_space_id);
mutex_exit(&dict_sys->mutex);
@@ -2737,9 +2510,9 @@ dict_get_and_save_data_dir_path(
dict_table_t* table,
bool dict_mutex_own)
{
- bool is_temp = DICT_TF2_FLAG_IS_SET(table, DICT_TF2_TEMPORARY);
+ ut_ad(!dict_table_is_temporary(table));
- if (!is_temp && !table->data_dir_path && table->space) {
+ if (!table->data_dir_path && table->space) {
char* path = fil_space_get_first_path(table->space);
if (!dict_mutex_own) {
@@ -2770,72 +2543,6 @@ dict_get_and_save_data_dir_path(
}
}
-/** Make sure the tablespace name is saved in dict_table_t if the table
-uses a general tablespace.
-Try to read it from the fil_system_t first, then from SYS_TABLESPACES.
-@param[in] table Table object
-@param[in] dict_mutex_own) true if dict_sys->mutex is owned already */
-void
-dict_get_and_save_space_name(
- dict_table_t* table,
- bool dict_mutex_own)
-{
- /* Do this only for general tablespaces. */
- if (!DICT_TF_HAS_SHARED_SPACE(table->flags)) {
- return;
- }
-
- bool use_cache = true;
- if (table->tablespace != NULL) {
-
- if (srv_sys_tablespaces_open
- && dict_table_has_temp_general_tablespace_name(
- table->tablespace)) {
- /* We previous saved the temporary name,
- get the real one now. */
- use_cache = false;
- } else {
- /* Keep and use this name */
- return;
- }
- }
-
- if (use_cache) {
- fil_space_t* space = fil_space_acquire_silent(table->space);
-
- if (space != NULL) {
- /* Use this name unless it is a temporary general
- tablespace name and we can now replace it. */
- if (!srv_sys_tablespaces_open
- || !dict_table_has_temp_general_tablespace_name(
- space->name)) {
-
- /* Use this tablespace name */
- table->tablespace = mem_heap_strdup(
- table->heap, space->name);
-
- fil_space_release(space);
- return;
- }
- fil_space_release(space);
- }
- }
-
- /* Read it from the dictionary. */
- if (srv_sys_tablespaces_open) {
- if (!dict_mutex_own) {
- dict_mutex_enter_for_mysql();
- }
-
- table->tablespace = dict_space_get_name(
- table->space, table->heap);
-
- if (!dict_mutex_own) {
- dict_mutex_exit_for_mysql();
- }
- }
-}
-
/** Loads a table definition and also all its index definitions, and also
the cluster definition if the table is a member in a cluster. Also loads
all foreign key constraints where the foreign key is in the table or where
@@ -2900,6 +2607,8 @@ dict_load_tablespace(
mem_heap_t* heap,
dict_err_ignore_t ignore_err)
{
+ ut_ad(!dict_table_is_temporary(table));
+
/* The system tablespace is always available. */
if (is_system_tablespace(table->space)) {
return;
@@ -2912,43 +2621,12 @@ dict_load_tablespace(
return;
}
- if (dict_table_is_temporary(table)) {
- /* Do not bother to retry opening temporary tables. */
- table->ibd_file_missing = TRUE;
- return;
- }
-
- /* A file-per-table table name is also the tablespace name.
- A general tablespace name is not the same as the table name.
- Use the general tablespace name if it can be read from the
- dictionary, if not use 'innodb_general_##. */
- char* shared_space_name = NULL;
- char* space_name;
- if (DICT_TF_HAS_SHARED_SPACE(table->flags)) {
- if (srv_sys_tablespaces_open) {
- shared_space_name =
- dict_space_get_name(table->space, NULL);
-
- } else {
- /* Make the temporary tablespace name. */
- shared_space_name = static_cast<char*>(
- ut_malloc_nokey(
- strlen(general_space_name) + 20));
-
- sprintf(shared_space_name, "%s_" ULINTPF,
- general_space_name,
- static_cast<ulint>(table->space));
- }
- space_name = shared_space_name;
- } else {
- space_name = table->name.m_name;
- }
+ char* space_name = table->name.m_name;
/* The tablespace may already be open. */
if (fil_space_for_table_exists_in_mem(
table->space, space_name, false,
- true, heap, table->id, table)) {
- ut_free(shared_space_name);
+ true, heap, table->id, table, table->flags)) {
return;
}
@@ -2973,37 +2651,20 @@ dict_load_tablespace(
table->data_dir_path,
table->name.m_name, IBD, true);
}
-
- } else if (DICT_TF_HAS_SHARED_SPACE(table->flags)) {
- /* Set table->tablespace from either
- fil_system or SYS_TABLESPACES */
- dict_get_and_save_space_name(table, true);
-
- /* Set the filepath from either
- fil_system or SYS_DATAFILES. */
- filepath = dict_get_first_path(table->space);
- if (filepath == NULL) {
- ib::warn() << "Could not find the filepath"
- " for table " << table->name <<
- ", space ID " << table->space;
- }
}
/* Try to open the tablespace. We set the 2nd param (fix_dict) to
false because we do not have an x-lock on dict_operation_lock */
- ulint fsp_flags = dict_tf_to_fsp_flags(table->flags,
- false,
- dict_table_is_encrypted(table));
dberr_t err = fil_ibd_open(
true, false, FIL_TYPE_TABLESPACE, table->space,
- fsp_flags, space_name, filepath, table);
+ dict_tf_to_fsp_flags(table->flags),
+ space_name, filepath, table);
if (err != DB_SUCCESS) {
/* We failed to find a sensible tablespace file */
table->ibd_file_missing = TRUE;
}
- ut_free(shared_space_name);
ut_free(filepath);
}
diff --git a/storage/innobase/dict/dict0mem.cc b/storage/innobase/dict/dict0mem.cc
index f4726ecd329..9463c5103ca 100644
--- a/storage/innobase/dict/dict0mem.cc
+++ b/storage/innobase/dict/dict0mem.cc
@@ -163,10 +163,6 @@ dict_mem_table_create(
table->fts = NULL;
}
- if (DICT_TF_HAS_SHARED_SPACE(table->flags)) {
- dict_get_and_save_space_name(table, true);
- }
-
new(&table->foreign_set) dict_foreign_set();
new(&table->referenced_set) dict_foreign_set();
diff --git a/storage/innobase/fil/fil0crypt.cc b/storage/innobase/fil/fil0crypt.cc
index c5bae8a2b85..7f545cb4060 100644
--- a/storage/innobase/fil/fil0crypt.cc
+++ b/storage/innobase/fil/fil0crypt.cc
@@ -1200,7 +1200,7 @@ struct rotate_thread_t {
uint estimated_max_iops; /*!< estimation of max iops */
uint allocated_iops; /*!< allocated iops */
uint cnt_waited; /*!< #times waited during this slot */
- uint sum_waited_us; /*!< wait time during this slot */
+ uintmax_t sum_waited_us; /*!< wait time during this slot */
fil_crypt_stat_t crypt_stat; // statistics
@@ -2457,8 +2457,8 @@ fil_space_crypt_close_tablespace(
return;
}
- uint start = time(0);
- uint last = start;
+ time_t start = time(0);
+ time_t last = start;
mutex_enter(&crypt_data->mutex);
mutex_exit(&fil_crypt_threads_mutex);
@@ -2480,7 +2480,7 @@ fil_space_crypt_close_tablespace(
cnt = crypt_data->rotate_state.active_threads;
flushing = crypt_data->rotate_state.flushing;
- uint now = time(0);
+ time_t now = time(0);
if (now >= last + 30) {
ib::warn() << "Waited "
diff --git a/storage/innobase/fil/fil0fil.cc b/storage/innobase/fil/fil0fil.cc
index 773eb0406ae..81ee2b5f53a 100644
--- a/storage/innobase/fil/fil0fil.cc
+++ b/storage/innobase/fil/fil0fil.cc
@@ -58,6 +58,7 @@ Created 10/25/1995 Heikki Tuuri
#include "srv0start.h"
#include "trx0purge.h"
#include "ut0new.h"
+#include "os0api.h"
/** Tries to close a file in the LRU list. The caller must hold the fil_sys
mutex.
@@ -128,18 +129,13 @@ out of the LRU-list and keep a count of pending operations. When an operation
completes, we decrement the count and return the file node to the LRU-list if
the count drops to zero. */
-/** This tablespace name is used internally during recovery to open a
-general tablespace before the data dictionary are recovered and available. */
-const char general_space_name[] = "innodb_general";
-
/** Reference to the server data directory. Usually it is the
current working directory ".", but in the MySQL Embedded Server Library
it is an absolute path. */
const char* fil_path_to_mysql_datadir;
-Folder folder_mysql_datadir;
/** Common InnoDB file extentions */
-const char* dot_ext[] = { "", ".ibd", ".isl", ".cfg", ".cfp" };
+const char* dot_ext[] = { "", ".ibd", ".isl", ".cfg" };
/** The number of fsyncs done to the log */
ulint fil_n_log_flushes = 0;
@@ -220,12 +216,13 @@ fil_space_belongs_in_lru(
const fil_space_t* space) /*!< in: file space */
{
switch (space->purpose) {
+ case FIL_TYPE_TEMPORARY:
case FIL_TYPE_LOG:
return(false);
case FIL_TYPE_TABLESPACE:
- case FIL_TYPE_TEMPORARY:
- case FIL_TYPE_IMPORT:
return(fil_is_user_tablespace_id(space->id));
+ case FIL_TYPE_IMPORT:
+ return(true);
}
ut_ad(0);
@@ -284,7 +281,7 @@ fil_read(
void* buf)
{
return(fil_io(IORequestRead, true, page_id, page_size,
- byte_offset, len, buf, NULL, NULL));
+ byte_offset, len, buf, NULL));
}
/** Writes data to a space from a buffer. Remember that the possible incomplete
@@ -312,7 +309,7 @@ fil_write(
ut_ad(!srv_read_only_mode);
return(fil_io(IORequestWrite, true, page_id, page_size,
- byte_offset, len, buf, NULL, NULL));
+ byte_offset, len, buf, NULL));
}
/*******************************************************************//**
@@ -481,7 +478,6 @@ fil_space_is_flushed(
@param[in] size file size in entire database blocks
@param[in,out] space tablespace from fil_space_create()
@param[in] is_raw whether this is a raw device or partition
-@param[in] punch_hole true if supported for this node
@param[in] atomic_write true if the file could use atomic write
@param[in] max_pages maximum number of pages in file,
ULINT_MAX means the file size is unlimited.
@@ -494,7 +490,6 @@ fil_node_create_low(
ulint size,
fil_space_t* space,
bool is_raw,
- bool punch_hole,
bool atomic_write,
ulint max_pages = ULINT_MAX)
{
@@ -509,6 +504,8 @@ fil_node_create_low(
node = reinterpret_cast<fil_node_t*>(ut_zalloc_nokey(sizeof(*node)));
+ node->handle = OS_FILE_CLOSED;
+
node->name = mem_strdup(name);
ut_a(!is_raw || srv_start_raw_disk_in_use);
@@ -530,40 +527,6 @@ fil_node_create_low(
node->space = space;
- os_file_stat_t stat_info;
-
-#ifdef UNIV_DEBUG
- dberr_t err =
-#endif /* UNIV_DEBUG */
-
- os_file_get_status(
- node->name, &stat_info, false,
- fsp_is_system_temporary(space->id) ? true : srv_read_only_mode);
-
- ut_ad(err == DB_SUCCESS);
-
- node->block_size = stat_info.block_size;
-
- /* In this debugging mode, we can overcome the limitation of some
- OSes like Windows that support Punch Hole but have a hole size
- effectively too large. By setting the block size to be half the
- page size, we can bypass one of the checks that would normally
- turn Page Compression off. This execution mode allows compression
- to be tested even when full punch hole support is not available. */
- DBUG_EXECUTE_IF("ignore_punch_hole",
- node->block_size = ut_min(stat_info.block_size,
- static_cast<size_t>(UNIV_PAGE_SIZE / 2));
- );
-
- if (!IORequest::is_punch_hole_supported()
- || !punch_hole
- || node->block_size >= srv_page_size) {
-
- fil_no_punch_hole(node);
- } else {
- node->punch_hole = punch_hole;
- }
-
node->atomic_write = atomic_write;
UT_LIST_ADD_LAST(space->chain, node);
@@ -595,8 +558,7 @@ fil_node_create(
fil_node_t* node;
node = fil_node_create_low(
- name, size, space, is_raw, IORequest::is_punch_hole_supported(),
- atomic_write, max_pages);
+ name, size, space, is_raw, atomic_write, max_pages);
return(node == NULL ? NULL : node->name);
}
@@ -612,17 +574,12 @@ fil_node_open_file(
{
os_offset_t size_bytes;
bool success;
- byte* buf2;
- byte* page;
- ulint flags;
- ulint min_size;
- ulint space_id;
bool read_only_mode;
fil_space_t* space = node->space;
ut_ad(mutex_own(&fil_system->mutex));
ut_a(node->n_pending == 0);
- ut_a(!node->is_open);
+ ut_a(!node->is_open());
read_only_mode = !fsp_is_system_temporary(space->id)
&& srv_read_only_mode;
@@ -662,110 +619,80 @@ retry:
ut_a(size_bytes != (os_offset_t) -1);
ut_a(space->purpose != FIL_TYPE_LOG);
+ const page_size_t page_size(space->flags);
+ const ulint psize = page_size.physical();
+ const ulint min_size = FIL_IBD_FILE_INITIAL_SIZE
+ * psize;
+
+ if (size_bytes < min_size) {
+ ib::error() << "The size of the file " << node->name
+ << " is only " << size_bytes
+ << " bytes, should be at least " << min_size;
+ os_file_close(node->handle);
+ return(false);
+ }
/* Read the first page of the tablespace */
- buf2 = static_cast<byte*>(ut_malloc_nokey(2 * UNIV_PAGE_SIZE));
+ byte* buf2 = static_cast<byte*>(ut_malloc_nokey(2 * psize));
/* Align the memory for file i/o if we might have O_DIRECT
set */
- page = static_cast<byte*>(ut_align(buf2, UNIV_PAGE_SIZE));
- ut_ad(page == page_align(page));
+ byte* page = static_cast<byte*>(ut_align(buf2, psize));
IORequest request(IORequest::READ);
success = os_file_read(
request,
- node->handle, page, 0, UNIV_PAGE_SIZE);
+ node->handle, page, 0, psize);
srv_stats.page0_read.add(1);
- space_id = fsp_header_get_space_id(page);
- flags = fsp_header_get_flags(page);
-
- /* Close the file now that we have read the space id from it */
-
+ const ulint space_id
+ = fsp_header_get_space_id(page);
+ ulint flags = fsp_header_get_flags(page);
+ const ulint size = fsp_header_get_field(
+ page, FSP_SIZE);
+ const ulint free_limit = fsp_header_get_field(
+ page, FSP_FREE_LIMIT);
+ const ulint free_len = flst_get_len(
+ FSP_HEADER_OFFSET + FSP_FREE + page);
+ ut_free(buf2);
os_file_close(node->handle);
- const page_size_t page_size(flags);
-
- min_size = FIL_IBD_FILE_INITIAL_SIZE * page_size.physical();
-
- if (size_bytes < min_size) {
-
- ib::error() << "The size of tablespace " << space_id << " file "
- << node->name << " is only " << size_bytes
- << ", should be at least " << min_size << "!";
-
- ut_error;
- }
-
- if (space->flags != flags) {
- ulint sflags = (space->flags & ~FSP_FLAGS_MASK_DATA_DIR);
- ulint fflags = (flags & ~FSP_FLAGS_MASK_DATA_DIR_ORACLE);
-
- /* DATA_DIR option is on different place on MariaDB
- compared to MySQL. If this is the difference. Fix
- it. */
-
- if (sflags == fflags) {
- ib::warn()
- << "Tablespace " << space_id
- << " flags " << space->flags
- << " in the data dictionary but in file " << node->name
- << " are " << flags
- << ". Temporally corrected because DATA_DIR option to "
- << space->flags;
-
- flags = space->flags;
- } else {
- ib::fatal()
- << "Table flags are "
- << ib::hex(space->flags) << " in the data"
- " dictionary but the flags in file "
- << node->name << " are " << ib::hex(flags)
- << "!";
+ if (!fsp_flags_is_valid(flags)) {
+ ulint cflags = fsp_flags_convert_from_101(flags);
+ if (cflags == ULINT_UNDEFINED) {
+ ib::error()
+ << "Expected tablespace flags "
+ << ib::hex(flags)
+ << " but found " << ib::hex(flags)
+ << " in the file " << node->name;
+ return(false);
}
- }
-
- {
- ulint size = fsp_header_get_field(
- page, FSP_SIZE);
- ulint free_limit = fsp_header_get_field(
- page, FSP_FREE_LIMIT);
- ulint free_len = flst_get_len(
- FSP_HEADER_OFFSET + FSP_FREE + page);
-
- ut_ad(space->free_limit == 0
- || space->free_limit == free_limit);
- ut_ad(space->free_len == 0
- || space->free_len == free_len);
- space->size_in_header = size;
- space->free_limit = free_limit;
- space->free_len = free_len;
+ flags = cflags;
}
- ut_free(buf2);
-
-#ifdef MYSQL_ENCRYPTION
- /* For encrypted tablespace, we need to check the
- encrytion key and iv(initial vector) is readed. */
- if (FSP_FLAGS_GET_ENCRYPTION(flags)
- && !recv_recovery_is_on()) {
- if (space->encryption_type != Encryption::AES) {
- ib::error()
- << "Can't read encryption"
- << " key from file "
- << node->name << "!";
- return(false);
- }
+ if (UNIV_UNLIKELY(space_id != space->id)) {
+ ib::error()
+ << "Expected tablespace id " << space->id
+ << " but found " << space_id
+ << "in the file" << node->name;
+ return(false);
}
-#endif
+
+ ut_ad(space->free_limit == 0
+ || space->free_limit == free_limit);
+ ut_ad(space->free_len == 0
+ || space->free_len == free_len);
+ space->size_in_header = size;
+ space->free_limit = free_limit;
+ space->free_len = free_len;
if (node->size == 0) {
ulint extent_size;
- extent_size = page_size.physical() * FSP_EXTENT_SIZE;
+ extent_size = psize * FSP_EXTENT_SIZE;
/* After apply-incremental, tablespaces are not extended
to a whole megabyte. Do not cut off valid data. */
@@ -776,9 +703,7 @@ retry:
extent_size);
}
- node->size = (ulint)
- (size_bytes / page_size.physical());
-
+ node->size = static_cast<ulint>(size_bytes / psize);
space->size += node->size;
}
}
@@ -824,8 +749,7 @@ retry:
}
ut_a(success);
-
- node->is_open = true;
+ ut_a(node->is_open());
fil_system->n_open++;
fil_n_file_opened++;
@@ -849,20 +773,22 @@ fil_node_close_file(
bool ret;
ut_ad(mutex_own(&(fil_system->mutex)));
- ut_a(node->is_open);
+ ut_a(node->is_open());
ut_a(node->n_pending == 0);
ut_a(node->n_pending_flushes == 0);
ut_a(!node->being_extended);
ut_a(node->modification_counter == node->flush_counter
|| node->space->purpose == FIL_TYPE_TEMPORARY
- || srv_fast_shutdown == 2);
+ || srv_fast_shutdown == 2
+ || !srv_was_started);
ret = os_file_close(node->handle);
ut_a(ret);
/* printf("Closing file %s\n", node->name); */
- node->is_open = false;
+ node->handle = OS_FILE_CLOSED;
+ ut_ad(!node->is_open());
ut_a(fil_system->n_open > 0);
fil_system->n_open--;
fil_n_file_opened--;
@@ -984,7 +910,7 @@ fil_flush_low(fil_space_t* space)
continue;
}
- ut_a(node->is_open);
+ ut_a(node->is_open());
switch (space->purpose) {
case FIL_TYPE_TEMPORARY:
@@ -1027,7 +953,7 @@ retry:
goto retry;
}
- ut_a(node->is_open);
+ ut_a(node->is_open());
node->n_pending_flushes++;
mutex_exit(&fil_system->mutex);
@@ -1107,7 +1033,7 @@ fil_write_zeros(
err = os_aio(
request, OS_AIO_SYNC, node->name,
node->handle, buf, offset, n_bytes, read_only_mode,
- NULL, NULL, NULL);
+ NULL, NULL);
if (err != DB_SUCCESS) {
break;
@@ -1346,7 +1272,7 @@ fil_mutex_enter_and_prepare_for_io(
the insert buffer. The insert buffer is in
tablespace 0, and we cannot end up waiting in
this function. */
- } else if (!node || node->is_open) {
+ } else if (!node || node->is_open()) {
/* If the file is already open, no need to do
anything; if the space does not exist, we handle the
situation in the function which called this
@@ -1451,7 +1377,7 @@ fil_node_close_to_free(
ut_a(node->n_pending == 0);
ut_a(!node->being_extended);
- if (node->is_open) {
+ if (node->is_open()) {
/* We fool the assertion in fil_node_close_file() to think
there are no unflushed modifications in the file */
@@ -1525,7 +1451,8 @@ fil_space_free_low(
fil_space_t* space)
{
/* The tablespace must not be in fil_system->named_spaces. */
- ut_ad(srv_fast_shutdown == 2 || space->max_lsn == 0);
+ ut_ad(srv_fast_shutdown == 2 || !srv_was_started
+ || space->max_lsn == 0);
for (fil_node_t* node = UT_LIST_GET_FIRST(space->chain);
node != NULL; ) {
@@ -1617,8 +1544,9 @@ fil_space_create(
fil_space_t* space;
ut_ad(fil_system);
- ut_ad(fsp_flags_is_valid(flags));
- ut_ad(srv_page_size == UNIV_PAGE_SIZE_ORIG || flags != 0);
+ ut_ad(fsp_flags_is_valid(flags & ~FSP_FLAGS_MEM_MASK));
+ ut_ad(purpose == FIL_TYPE_LOG
+ || srv_page_size == UNIV_PAGE_SIZE_ORIG || flags != 0);
DBUG_EXECUTE_IF("fil_space_create_failure", return(NULL););
@@ -1695,8 +1623,6 @@ fil_space_create(
<< " " << fil_crypt_get_type(crypt_data));
}
- space->encryption_type = Encryption::NONE;
-
rw_lock_create(fil_space_latch_key, &space->latch, SYNC_FSP);
if (space->purpose == FIL_TYPE_TEMPORARY) {
@@ -1947,20 +1873,6 @@ fil_space_get_flags(
return(flags);
}
-/** Check if table is mark for truncate.
-@param[in] id space id
-@return true if tablespace is marked for truncate. */
-bool
-fil_space_is_being_truncated(
- ulint id)
-{
- bool mark_for_truncate;
- mutex_enter(&fil_system->mutex);
- mark_for_truncate = fil_space_get_by_id(id)->is_being_truncated;
- mutex_exit(&fil_system->mutex);
- return(mark_for_truncate);
-}
-
/** Open each fil_node_t of a named fil_space_t if not already open.
@param[in] name Tablespace name
@return true if all nodes are open */
@@ -1979,7 +1891,7 @@ fil_space_open(
node != NULL;
node = UT_LIST_GET_NEXT(chain, node)) {
- if (!node->is_open
+ if (!node->is_open()
&& !fil_node_open_file(node)) {
mutex_exit(&fil_system->mutex);
return(false);
@@ -2013,7 +1925,7 @@ fil_space_close(
node != NULL;
node = UT_LIST_GET_NEXT(chain, node)) {
- if (node->is_open) {
+ if (node->is_open()) {
fil_node_close_file(node);
}
}
@@ -2104,7 +2016,7 @@ fil_open_log_and_system_tablespace_files(void)
node != NULL;
node = UT_LIST_GET_NEXT(chain, node)) {
- if (!node->is_open) {
+ if (!node->is_open()) {
if (!fil_node_open_file(node)) {
/* This func is called during server's
startup. If some file of log or system
@@ -2149,6 +2061,7 @@ fil_close_all_files(void)
/* At shutdown, we should not have any files in this list. */
ut_ad(srv_fast_shutdown == 2
+ || !srv_was_started
|| UT_LIST_GET_LEN(fil_system->named_spaces) == 0);
mutex_enter(&fil_system->mutex);
@@ -2162,7 +2075,7 @@ fil_close_all_files(void)
node != NULL;
node = UT_LIST_GET_NEXT(chain, node)) {
- if (node->is_open) {
+ if (node->is_open()) {
fil_node_close_file(node);
}
}
@@ -2175,6 +2088,7 @@ fil_close_all_files(void)
mutex_exit(&fil_system->mutex);
ut_ad(srv_fast_shutdown == 2
+ || !srv_was_started
|| UT_LIST_GET_LEN(fil_system->named_spaces) == 0);
}
@@ -2208,7 +2122,7 @@ fil_close_log_files(
node != NULL;
node = UT_LIST_GET_NEXT(chain, node)) {
- if (node->is_open) {
+ if (node->is_open()) {
fil_node_close_file(node);
}
}
@@ -2402,6 +2316,7 @@ fil_op_write_log(
ulint len;
ut_ad(first_page_no == 0);
+ ut_ad(fsp_flags_is_valid(flags));
/* fil_name_parse() requires that there be at least one path
separator and that the file path end with ".ibd". */
@@ -2622,7 +2537,7 @@ fil_recreate_tablespace(
/* Align the memory for file i/o */
page = static_cast<byte*>(ut_align(buf, UNIV_PAGE_SIZE));
- flags = fsp_flags_set_page_size(flags, univ_page_size);
+ flags |= FSP_FLAGS_PAGE_SSIZE();
fsp_header_init_fields(page, space_id, flags);
@@ -2698,13 +2613,11 @@ fil_recreate_tablespace(
byte* page = buf_block_get_frame(block);
- if (!fsp_flags_is_compressed(flags)) {
-
+ if (!FSP_FLAGS_GET_ZIP_SSIZE(flags)) {
ut_ad(!page_size.is_compressed());
buf_flush_init_for_writing(
- block, page, NULL, recv_lsn,
- fsp_is_checksum_disabled(space_id));
+ block, page, NULL, recv_lsn, false);
err = fil_write(cur_page_id, page_size, 0,
page_size.physical(), page);
@@ -3146,13 +3059,7 @@ fil_delete_tablespace(
/* Delete the link file pointing to the ibd file we are deleting. */
if (FSP_FLAGS_HAS_DATA_DIR(space->flags)) {
-
RemoteDatafile::delete_link_file(space->name);
-
- } else if (FSP_FLAGS_GET_SHARED(space->flags)) {
-
- RemoteDatafile::delete_link_file(base_name(path));
-
}
mutex_enter(&fil_system->mutex);
@@ -3229,7 +3136,7 @@ fil_truncate_tablespace(
fil_node_t* node = UT_LIST_GET_FIRST(space->chain);
- ut_ad(node->is_open);
+ ut_ad(node->is_open());
space->size = node->size = size_in_pages;
@@ -3362,30 +3269,6 @@ fil_space_dec_redo_skipped_count(
mutex_exit(&fil_system->mutex);
}
-
-/**
-Check whether a single-table tablespace is redo skipped.
-@param[in] id space id
-@return true if redo skipped */
-bool
-fil_space_is_redo_skipped(
- ulint id)
-{
- fil_space_t* space;
- bool is_redo_skipped;
-
- mutex_enter(&fil_system->mutex);
-
- space = fil_space_get_by_id(id);
-
- ut_a(space != NULL);
-
- is_redo_skipped = space->redo_skipped_count > 0;
-
- mutex_exit(&fil_system->mutex);
-
- return(is_redo_skipped);
-}
#endif /* UNIV_DEBUG */
/*******************************************************************//**
@@ -3667,7 +3550,7 @@ func_exit:
} else if (node->modification_counter > node->flush_counter) {
/* Flush the space */
sleep = flush = true;
- } else if (node->is_open) {
+ } else if (node->is_open()) {
/* Close the file */
fil_node_close_file(node);
@@ -3762,10 +3645,9 @@ func_exit:
return(success);
}
-/** Create a new General or Single-Table tablespace
+/** Create a tablespace file.
@param[in] space_id Tablespace ID
@param[in] name Tablespace name in dbname/tablename format.
-For general tablespaces, the 'dbname/' part may be missing.
@param[in] path Path and filename of the datafile to create.
@param[in] flags Tablespace flags
@param[in] size Initial size of the tablespace file in
@@ -3788,9 +3670,7 @@ fil_ibd_create(
byte* buf2;
byte* page;
bool success;
- bool is_temp = FSP_FLAGS_GET_TEMPORARY(flags);
- bool has_data_dir = FSP_FLAGS_HAS_DATA_DIR(flags);
- bool has_shared_space = FSP_FLAGS_GET_SHARED(flags);
+ bool has_data_dir = FSP_FLAGS_HAS_DATA_DIR(flags) != 0;
fil_space_t* space = NULL;
fil_space_crypt_t *crypt_data = NULL;
@@ -3798,15 +3678,13 @@ fil_ibd_create(
ut_ad(!srv_read_only_mode);
ut_a(space_id < SRV_LOG_SPACE_FIRST_ID);
ut_a(size >= FIL_IBD_FILE_INITIAL_SIZE);
- ut_a(fsp_flags_is_valid(flags));
+ ut_a(fsp_flags_is_valid(flags & ~FSP_FLAGS_MEM_MASK));
/* Create the subdirectories in the path, if they are
not there already. */
- if (!has_shared_space) {
- err = os_file_create_subdirs_if_needed(path);
- if (err != DB_SUCCESS) {
- return(err);
- }
+ err = os_file_create_subdirs_if_needed(path);
+ if (err != DB_SUCCESS) {
+ return(err);
}
file = os_file_create(
@@ -3873,16 +3751,10 @@ fil_ibd_create(
success = true;
}
#endif /* HAVE_POSIX_FALLOCATE */
- if (!success)
- {
- success = os_file_set_size(
- path, file, size * UNIV_PAGE_SIZE, srv_read_only_mode);
- }
if (!success) {
- os_file_close(file);
- os_file_delete(innodb_data_file_key, path);
- return(DB_OUT_OF_FILE_SPACE);
+ success = os_file_set_size(
+ path, file, size * UNIV_PAGE_SIZE, srv_read_only_mode);
}
/* Note: We are actually punching a hole, previous contents will
@@ -3902,6 +3774,14 @@ fil_ibd_create(
}
}
+ ulint block_size = os_file_get_block_size(file, path);
+
+ if (!success) {
+ os_file_close(file);
+ os_file_delete(innodb_data_file_key, path);
+ return(DB_OUT_OF_FILE_SPACE);
+ }
+
/* printf("Creating tablespace %s id %lu\n", path, space_id); */
/* We have to write the space id to the file immediately and flush the
@@ -3919,10 +3799,7 @@ fil_ibd_create(
memset(page, '\0', UNIV_PAGE_SIZE);
- /* Add the UNIV_PAGE_SIZE to the table flags and write them to the
- tablespace header. */
- flags = fsp_flags_set_page_size(flags, univ_page_size);
-
+ flags |= FSP_FLAGS_PAGE_SSIZE();
fsp_header_init_fields(page, space_id, flags);
mach_write_to_4(page + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID, space_id);
@@ -3937,9 +3814,6 @@ fil_ibd_create(
err = os_file_write(
request, path, file, page, 0, page_size.physical());
-
- ut_ad(err != DB_IO_NO_PUNCH_HOLE);
-
} else {
page_zip_des_t page_zip;
page_zip_set_size(&page_zip, page_size.physical());
@@ -3957,10 +3831,6 @@ fil_ibd_create(
err = os_file_write(
request, path, file, page_zip.data, 0,
page_size.physical());
-
- ut_a(err != DB_IO_NO_PUNCH_HOLE);
-
- punch_hole = false;
}
ut_free(buf2);
@@ -3987,11 +3857,10 @@ fil_ibd_create(
return(DB_ERROR);
}
- if (has_data_dir || has_shared_space) {
+ if (has_data_dir) {
/* Make the ISL file if the IBD file is not
in the default location. */
- err = RemoteDatafile::create_link_file(name, path,
- has_shared_space);
+ err = RemoteDatafile::create_link_file(name, path);
if (err != DB_SUCCESS) {
os_file_close(file);
os_file_delete(innodb_data_file_key, path);
@@ -4006,56 +3875,45 @@ fil_ibd_create(
crypt_data = fil_space_create_crypt_data(mode, key_id);
}
- space = fil_space_create(name, space_id, flags, is_temp
- ? FIL_TYPE_TEMPORARY : FIL_TYPE_TABLESPACE,
- crypt_data, true);
+ space = fil_space_create(name, space_id, flags, FIL_TYPE_TABLESPACE,
+ crypt_data, true);
- if (!fil_node_create_low(
- path, size, space, false, punch_hole, TRUE)) {
+ fil_node_t* node = NULL;
+ if (space) {
+ node = fil_node_create_low(path, size, space, false, true);
+ }
+
+ if (!space || !node) {
if (crypt_data) {
free(crypt_data);
}
err = DB_ERROR;
- goto error_exit_1;
- }
-
-#ifdef MYSQL_ENCRYPTION
- /* For encryption tablespace, initial encryption information. */
- if (FSP_FLAGS_GET_ENCRYPTION(space->flags)) {
- err = fil_set_encryption(space->id,
- Encryption::AES,
- NULL,
- NULL);
- ut_ad(err == DB_SUCCESS);
- }
-#endif /* MYSQL_ENCRYPTION */
-
- if (!is_temp) {
+ } else {
mtr_t mtr;
const fil_node_t* file = UT_LIST_GET_FIRST(space->chain);
- mtr_start(&mtr);
+ mtr.start();
fil_op_write_log(
MLOG_FILE_CREATE2, space_id, 0, file->name,
- NULL, space->flags, &mtr);
+ NULL, space->flags & ~FSP_FLAGS_MEM_MASK, &mtr);
fil_name_write(space, 0, file, &mtr);
- mtr_commit(&mtr);
- }
+ mtr.commit();
- err = DB_SUCCESS;
+ node->block_size = block_size;
+ space->punch_hole = punch_hole;
- /* Error code is set. Cleanup the various variables used.
- These labels reflect the order in which variables are assigned or
- actions are done. */
-error_exit_1:
- if (err != DB_SUCCESS && (has_data_dir || has_shared_space)) {
- RemoteDatafile::delete_link_file(name);
+ err = DB_SUCCESS;
}
os_file_close(file);
+
if (err != DB_SUCCESS) {
+ if (has_data_dir) {
+ RemoteDatafile::delete_link_file(name);
+ }
+
os_file_delete(innodb_data_file_key, path);
}
@@ -4086,7 +3944,7 @@ statement to update the dictionary tables if they are incorrect.
@param[in] fix_dict true if the dictionary is available to be fixed
@param[in] purpose FIL_TYPE_TABLESPACE or FIL_TYPE_TEMPORARY
@param[in] id tablespace ID
-@param[in] flags tablespace flags
+@param[in] flags expected FSP_SPACE_FLAGS
@param[in] space_name tablespace name of the datafile
If file-per-table, it is the table name in the databasename/tablename format
@param[in] path_in expected filepath, usually read from dictionary
@@ -4106,14 +3964,11 @@ fil_ibd_open(
bool dict_filepath_same_as_default = false;
bool link_file_found = false;
bool link_file_is_bad = false;
- bool is_shared = FSP_FLAGS_GET_SHARED(flags);
- bool is_encrypted = FSP_FLAGS_GET_ENCRYPTION(flags);
Datafile df_default; /* default location */
Datafile df_dict; /* dictionary location */
RemoteDatafile df_remote; /* remote location */
ulint tablespaces_found = 0;
ulint valid_tablespaces_found = 0;
- bool for_import = (purpose == FIL_TYPE_IMPORT);
ut_ad(!fix_dict || rw_lock_own(dict_operation_lock, RW_LOCK_X));
@@ -4122,10 +3977,13 @@ fil_ibd_open(
ut_ad(!fix_dict || srv_log_file_size != 0);
ut_ad(fil_type_is_data(purpose));
- if (!fsp_flags_is_valid(flags)) {
+ /* Table flags can be ULINT_UNDEFINED if
+ dict_tf_to_fsp_flags_failure is set. */
+ if (flags == ULINT_UNDEFINED) {
return(DB_CORRUPTION);
}
+ ut_ad(fsp_flags_is_valid(flags & ~FSP_FLAGS_MEM_MASK));
df_default.init(space_name, flags);
df_dict.init(space_name, flags);
df_remote.init(space_name, flags);
@@ -4133,25 +3991,8 @@ fil_ibd_open(
/* Discover the correct file by looking in three possible locations
while avoiding unecessary effort. */
- if (is_shared) {
- /* Shared tablespaces will have a path_in since the filename
- is not generated from the tablespace name. Use the basename
- from this path_in with the default datadir as a filepath to
- the default location */
- ut_a(path_in);
- const char* sep = strrchr(path_in, OS_PATH_SEPARATOR);
- const char* basename = (sep == NULL) ? path_in : &sep[1];
- df_default.make_filepath(NULL, basename, IBD);
-
- /* Always validate shared tablespaces. */
- validate = true;
-
- /* Set the ISL filepath in the default location. */
- df_remote.set_link_filepath(path_in);
- } else {
- /* We will always look for an ibd in the default location. */
- df_default.make_filepath(NULL, space_name, IBD);
- }
+ /* We will always look for an ibd in the default location. */
+ df_default.make_filepath(NULL, space_name, IBD);
/* Look for a filepath embedded in an ISL where the default file
would be. */
@@ -4228,43 +4069,31 @@ fil_ibd_open(
normal, we only found 1. */
/* For encrypted tablespace, we need to check the
encryption in header of first page. */
- if (!validate && tablespaces_found == 1 && !is_encrypted) {
+ if (!validate && tablespaces_found == 1) {
goto skip_validate;
}
/* Read and validate the first page of these three tablespace
locations, if found. */
valid_tablespaces_found +=
- (df_remote.validate_to_dd(id, flags, for_import)
- == DB_SUCCESS) ? 1 : 0;
+ (df_remote.validate_to_dd(id, flags) == DB_SUCCESS);
valid_tablespaces_found +=
- (df_default.validate_to_dd(id, flags, for_import)
- == DB_SUCCESS) ? 1 : 0;
+ (df_default.validate_to_dd(id, flags) == DB_SUCCESS);
valid_tablespaces_found +=
- (df_dict.validate_to_dd(id, flags, for_import)
- == DB_SUCCESS) ? 1 : 0;
+ (df_dict.validate_to_dd(id, flags) == DB_SUCCESS);
/* Make sense of these three possible locations.
First, bail out if no tablespace files were found. */
if (valid_tablespaces_found == 0) {
- if (!is_encrypted) {
- /* The following call prints an error message.
- For encrypted tablespace we skip print, since it should
- be keyring plugin issues. */
- os_file_get_last_error(true);
- ib::error() << "Could not find a valid tablespace file for `"
- << space_name << "`. " << TROUBLESHOOT_DATADICT_MSG;
- }
-
+ os_file_get_last_error(true);
+ ib::error() << "Could not find a valid tablespace file for `"
+ << space_name << "`. " << TROUBLESHOOT_DATADICT_MSG;
return(DB_CORRUPTION);
}
- if (!validate && !is_encrypted) {
- return(DB_SUCCESS);
- }
- if (validate && is_encrypted && fil_space_get(id)) {
- return(DB_SUCCESS);
+ if (!validate) {
+ goto skip_validate;
}
/* Do not open any tablespaces if more than one tablespace with
@@ -4370,8 +4199,7 @@ fil_ibd_open(
RemoteDatafile::delete_link_file(space_name);
}
- } else if (!is_shared
- && (!link_file_found || link_file_is_bad)) {
+ } else if (!link_file_found || link_file_is_bad) {
ut_ad(df_dict.is_open());
/* Fix the link file if we got our filepath
from the dictionary but a link file did not
@@ -4401,9 +4229,7 @@ fil_ibd_open(
path_in is not suppled for file-per-table, we must assume
that it matched the ISL. */
if ((path_in != NULL && !dict_filepath_same_as_default)
- || (path_in == NULL
- && (DICT_TF_HAS_DATA_DIR(flags)
- || DICT_TF_HAS_SHARED_SPACE(flags)))
+ || (path_in == NULL && DICT_TF_HAS_DATA_DIR(flags))
|| df_remote.filepath() != NULL) {
dict_replace_tablespace_and_filepath(
id, space_name, df_default.filepath(), flags);
@@ -4425,28 +4251,16 @@ skip_validate:
df_remote.is_open() ? df_remote.filepath() :
df_dict.is_open() ? df_dict.filepath() :
df_default.filepath(), 0, space, false,
- true, TRUE) == NULL) {
+ true) == NULL) {
err = DB_ERROR;
}
-#ifdef MYSQL_ENCRYPTION
- /* For encryption tablespace, initialize encryption
- information.*/
- if (err == DB_SUCCESS && is_encrypted && !for_import) {
- Datafile& df_current = df_remote.is_open() ?
- df_remote: df_dict.is_open() ?
- df_dict : df_default;
-
- byte* key = df_current.m_encryption_key;
- byte* iv = df_current.m_encryption_iv;
- ut_ad(key && iv);
-
- err = fil_set_encryption(space->id, Encryption::AES,
- key, iv);
- ut_ad(err == DB_SUCCESS);
+ if (purpose != FIL_TYPE_IMPORT && !srv_read_only_mode) {
+ df_remote.close();
+ df_dict.close();
+ df_default.close();
+ fsp_flags_try_adjust(id, flags & ~FSP_FLAGS_MEM_MASK);
}
-#endif /* MYSQL_ENCRYPTION */
-
}
return(err);
@@ -4554,24 +4368,12 @@ fil_ibd_discover(
ulint space_id,
Datafile& df)
{
- Datafile df_def_gen; /* default general datafile */
Datafile df_def_per; /* default file-per-table datafile */
- RemoteDatafile df_rem_gen; /* remote general datafile*/
RemoteDatafile df_rem_per; /* remote file-per-table datafile */
- /* Look for the datafile in the default location. If it is
- a general tablespace, it will be in the datadir. */
+ /* Look for the datafile in the default location. */
const char* filename = df.filepath();
const char* basename = base_name(filename);
- df_def_gen.init(basename, 0);
- df_def_gen.make_filepath(NULL, basename, IBD);
- if (df_def_gen.open_read_only(false) == DB_SUCCESS
- && df_def_gen.validate_for_recovery() == DB_SUCCESS
- && df_def_gen.space_id() == space_id) {
- df.set_filepath(df_def_gen.filepath());
- df.open_read_only(false);
- return(true);
- }
/* If this datafile is file-per-table it will have a schema dir. */
ulint sep_found = 0;
@@ -4592,44 +4394,9 @@ fil_ibd_discover(
df.open_read_only(false);
return(true);
}
- }
-
- /* Did not find a general or file-per-table datafile in the
- default location. Look for a remote general tablespace. */
- df_rem_gen.set_name(basename);
- if (df_rem_gen.open_link_file() == DB_SUCCESS) {
-
- /* An ISL file was found with contents. */
- if (df_rem_gen.open_read_only(false) != DB_SUCCESS
- || df_rem_gen.validate_for_recovery() != DB_SUCCESS) {
-
- /* Assume that this ISL file is intended to be used.
- Do not continue looking for another if this file
- cannot be opened or is not a valid IBD file. */
- ib::error() << "ISL file '"
- << df_rem_gen.link_filepath()
- << "' was found but the linked file '"
- << df_rem_gen.filepath()
- << "' could not be opened or is not correct.";
- return(false);
- }
-
- /* Use this file if it has the space_id from the MLOG
- record. */
- if (df_rem_gen.space_id() == space_id) {
- df.set_filepath(df_rem_gen.filepath());
- df.open_read_only(false);
- return(true);
- }
- /* Since old MLOG records can use the same basename in
- multiple CREATE/DROP sequences, this ISL file could be
- pointing to a later version of this basename.ibd file
- which has a different space_id. Keep looking. */
- }
+ /* Look for a remote file-per-table tablespace. */
- /* Look for a remote file-per-table tablespace. */
- if (sep_found == 2) {
df_rem_per.set_name(db);
if (df_rem_per.open_link_file() == DB_SUCCESS) {
@@ -4721,14 +4488,9 @@ fil_ibd_load(
return(FIL_LOAD_OK);
}
- /* If the filepath in the redo log is a default location in or
- under the datadir, then just try to open it there. */
Datafile file;
file.set_filepath(filename);
- Folder folder(filename, dirname_length(filename));
- if (folder_mysql_datadir >= folder) {
- file.open_read_only(false);
- }
+ file.open_read_only(false);
if (!file.is_open()) {
/* The file has been moved or it is a remote datafile. */
@@ -4790,10 +4552,16 @@ fil_ibd_load(
ut_ad(space == NULL);
- bool is_temp = FSP_FLAGS_GET_TEMPORARY(file.flags());
+ /* Adjust the memory-based flags that would normally be set by
+ dict_tf_to_fsp_flags(). In recovery, we have no data dictionary. */
+ ulint flags = file.flags();
+ if (FSP_FLAGS_HAS_PAGE_COMPRESSION(flags)) {
+ flags |= page_zip_level
+ << FSP_FLAGS_MEM_COMPRESSION_LEVEL;
+ }
+
space = fil_space_create(
- file.name(), space_id, file.flags(),
- is_temp ? FIL_TYPE_TEMPORARY : FIL_TYPE_TABLESPACE,
+ file.name(), space_id, flags, FIL_TYPE_TABLESPACE,
file.get_crypt_info(), false);
if (space == NULL) {
@@ -4807,26 +4575,10 @@ fil_ibd_load(
the rounding formula for extents and pages is somewhat complex; we
let fil_node_open() do that task. */
- if (!fil_node_create_low(file.filepath(), 0, space,
- false, true, false)) {
+ if (!fil_node_create_low(file.filepath(), 0, space, false, false)) {
ut_error;
}
-#ifdef MYSQL_ENCRYPTION
- /* For encryption tablespace, initial encryption information. */
- if (FSP_FLAGS_GET_ENCRYPTION(space->flags)
- && file.m_encryption_key != NULL) {
- dberr_t err = fil_set_encryption(space->id,
- Encryption::AES,
- file.m_encryption_key,
- file.m_encryption_iv);
- if (err != DB_SUCCESS) {
- ib::error() << "Can't set encryption information for"
- " tablespace " << space->name << "!";
- }
- }
-#endif /* MYSQL_ENCRYPTION */
-
return(FIL_LOAD_OK);
}
@@ -4878,13 +4630,44 @@ fil_report_missing_tablespace(
<< " in the InnoDB data dictionary has tablespace id "
<< space_id << ","
" but tablespace with that id or name does not exist. Have"
- " you deleted or moved .ibd files? This may also be a table"
- " created with CREATE TEMPORARY TABLE whose .ibd and .frm"
- " files MySQL automatically removed, but the table still"
- " exists in the InnoDB internal data dictionary.";
+ " you deleted or moved .ibd files?";
+}
+
+/** Try to adjust FSP_SPACE_FLAGS if they differ from the expectations.
+(Typically when upgrading from MariaDB 10.1.0..10.1.20.)
+@param[in] space_id tablespace ID
+@param[in] flags desired tablespace flags */
+UNIV_INTERN
+void
+fsp_flags_try_adjust(ulint space_id, ulint flags)
+{
+ ut_ad(!srv_read_only_mode);
+ ut_ad(fsp_flags_is_valid(flags));
+
+ mtr_t mtr;
+ mtr_start(&mtr);
+ if (buf_block_t* b = buf_page_get(
+ page_id_t(space_id, 0), page_size_t(flags),
+ RW_X_LATCH, &mtr)) {
+ ulint f = fsp_header_get_flags(b->frame);
+ /* Suppress the message if only the DATA_DIR flag to differs. */
+ if ((f ^ flags) & ~(1U << FSP_FLAGS_POS_RESERVED)) {
+ ib::warn()
+ << "adjusting FSP_SPACE_FLAGS of tablespace "
+ << space_id
+ << " from " << ib::hex(f)
+ << " to " << ib::hex(flags);
+ }
+ if (f != flags) {
+ mlog_write_ulint(FSP_HEADER_OFFSET
+ + FSP_SPACE_FLAGS + b->frame,
+ flags, MLOG_4BYTES, &mtr);
+ }
+ }
+ mtr_commit(&mtr);
}
-/** Returns true if a matching tablespace exists in the InnoDB tablespace
+/** Determine if a matching tablespace exists in the InnoDB tablespace
memory cache. Note that if we have not done a crash recovery at the database
startup, there may be many tablespaces which are not yet in the memory cache.
@param[in] id Tablespace ID
@@ -4896,6 +4679,7 @@ error log if a matching tablespace is not found from memory.
@param[in] heap Heap memory
@param[in] table_id table id
@param[in] table table
+@param[in] table_flags table flags
@return true if a matching tablespace exists in the memory cache */
bool
fil_space_for_table_exists_in_mem(
@@ -4905,12 +4689,13 @@ fil_space_for_table_exists_in_mem(
bool adjust_space,
mem_heap_t* heap,
table_id_t table_id,
- dict_table_t* table)
+ dict_table_t* table,
+ ulint table_flags)
{
- fil_space_t* fnamespace = NULL;
+ fil_space_t* fnamespace;
fil_space_t* space;
- ut_ad(fil_system);
+ const ulint expected_flags = dict_tf_to_fsp_flags(table_flags);
mutex_enter(&fil_system->mutex);
@@ -4918,80 +4703,41 @@ fil_space_for_table_exists_in_mem(
space = fil_space_get_by_id(id);
- /* If tablespace contains encryption information
- copy it also to table. */
- if (space && space->crypt_data &&
- table && !table->crypt_data) {
- table->crypt_data = space->crypt_data;
- }
-
- if (space != NULL
- && FSP_FLAGS_GET_SHARED(space->flags)
- && adjust_space
- && srv_sys_tablespaces_open
- && 0 == strncmp(space->name, general_space_name,
- strlen(general_space_name))) {
- /* This name was assigned during recovery in fil_ibd_load().
- This general tablespace was opened from an MLOG_FILE_NAME log
- entry where the tablespace name does not exist. Replace the
- temporary name with this name and return this space. */
- HASH_DELETE(fil_space_t, name_hash, fil_system->name_hash,
- ut_fold_string(space->name), space);
- ut_free(space->name);
- space->name = mem_strdup(name);
- HASH_INSERT(fil_space_t, name_hash, fil_system->name_hash,
- ut_fold_string(space->name), space);
-
- mutex_exit(&fil_system->mutex);
-
- return(true);
- }
-
- if (space != NULL) {
- if (FSP_FLAGS_GET_SHARED(space->flags)
- && !srv_sys_tablespaces_open) {
-
- /* No need to check the name */
- mutex_exit(&fil_system->mutex);
- return(true);
- }
+ /* Look if there is a space with the same name; the name is the
+ directory path from the datadir to the file */
- /* If this space has the expected name, use it. */
- fnamespace = fil_space_get_by_name(name);
- if (space == fnamespace) {
- /* Found */
+ fnamespace = fil_space_get_by_name(name);
+ bool valid = space && !((space->flags ^ expected_flags)
+ & ~FSP_FLAGS_MEM_MASK);
- mutex_exit(&fil_system->mutex);
- return(true);
- }
+ if (valid && table && !table->crypt_data) {
+ table->crypt_data = space->crypt_data;
}
- /* Info from "fnamespace" comes from the ibd file itself, it can
- be different from data obtained from System tables since file
- operations are not transactional. If adjust_space is set, and the
- mismatching space are between a user table and its temp table, we
- shall adjust the ibd file name according to system table info */
- if (adjust_space
- && space != NULL
- && row_is_mysql_tmp_table_name(space->name)
- && !row_is_mysql_tmp_table_name(name)) {
-
+ if (!space) {
+ } else if (!valid || space == fnamespace) {
+ /* Found with the same file name, or got a flag mismatch. */
+ goto func_exit;
+ } else if (adjust_space
+ && row_is_mysql_tmp_table_name(space->name)
+ && !row_is_mysql_tmp_table_name(name)) {
+ /* Info from fnamespace comes from the ibd file
+ itself, it can be different from data obtained from
+ System tables since renaming files is not
+ transactional. We shall adjust the ibd file name
+ according to system table info. */
mutex_exit(&fil_system->mutex);
DBUG_EXECUTE_IF("ib_crash_before_adjust_fil_space",
DBUG_SUICIDE(););
- if (fnamespace) {
- const char* tmp_name;
+ const char* tmp_name = dict_mem_create_temporary_tablename(
+ heap, name, table_id);
- tmp_name = dict_mem_create_temporary_tablename(
- heap, name, table_id);
-
- fil_rename_tablespace(
- fnamespace->id,
- UT_LIST_GET_FIRST(fnamespace->chain)->name,
- tmp_name, NULL);
- }
+ fil_rename_tablespace(
+ fnamespace->id,
+ UT_LIST_GET_FIRST(fnamespace->chain)->name,
+ tmp_name, NULL);
DBUG_EXECUTE_IF("ib_crash_after_adjust_one_fil_space",
DBUG_SUICIDE(););
@@ -5006,16 +4752,12 @@ fil_space_for_table_exists_in_mem(
mutex_enter(&fil_system->mutex);
fnamespace = fil_space_get_by_name(name);
ut_ad(space == fnamespace);
- mutex_exit(&fil_system->mutex);
-
- return(true);
+ goto func_exit;
}
if (!print_error_if_does_not_exist) {
-
- mutex_exit(&fil_system->mutex);
-
- return(false);
+ valid = false;
+ goto func_exit;
}
if (space == NULL) {
@@ -5034,10 +4776,8 @@ fil_space_for_table_exists_in_mem(
}
error_exit:
ib::warn() << TROUBLESHOOT_DATADICT_MSG;
-
- mutex_exit(&fil_system->mutex);
-
- return(false);
+ valid = false;
+ goto func_exit;
}
if (0 != strcmp(space->name, name)) {
@@ -5056,9 +4796,19 @@ error_exit:
goto error_exit;
}
+func_exit:
+ if (valid) {
+ /* Adjust the flags that are in FSP_FLAGS_MEM_MASK.
+ FSP_SPACE_FLAGS will not be written back here. */
+ space->flags = expected_flags;
+ }
mutex_exit(&fil_system->mutex);
- return(false);
+ if (valid && !srv_read_only_mode) {
+ fsp_flags_try_adjust(id, expected_flags & ~FSP_FLAGS_MEM_MASK);
+ }
+
+ return(valid);
}
/** Return the space ID based on the tablespace name.
@@ -5192,7 +4942,7 @@ fil_node_prepare_for_io(
<< " exceeds the limit " << system->max_n_open;
}
- if (!node->is_open) {
+ if (!node->is_open()) {
/* File is closed: open it */
ut_a(node->n_pending == 0);
@@ -5296,33 +5046,6 @@ fil_report_invalid_page_access(
_exit(1);
}
-#ifdef MYSQL_ENCRYPTION
-/** Set encryption information for IORequest.
-@param[in,out] req_type IO request
-@param[in] page_id page id
-@param[in] space table space */
-inline
-void
-fil_io_set_encryption(
- IORequest& req_type,
- const page_id_t& page_id,
- fil_space_t* space)
-{
- /* Don't encrypt the log, page 0 of all tablespaces, all pages
- from the system tablespace. */
- if (!req_type.is_log() && page_id.page_no() > 0
- && space->encryption_type != Encryption::NONE)
- {
- req_type.encryption_key(space->encryption_key,
- space->encryption_klen,
- space->encryption_iv);
- req_type.encryption_algorithm(Encryption::AES);
- } else {
- req_type.clear_encrypted();
- }
-}
-#endif /* MYSQL_ENCRYPTION */
-
/** Reads or writes data. This operation could be asynchronous (aio).
@param[in,out] type IO context
@@ -5339,8 +5062,6 @@ fil_io_set_encryption(
aligned
@param[in] message message for aio handler if non-sync aio
used, else ignored
-@param[in] write_size actual payload size when written
- to avoid extra punch holes in compression
@return DB_SUCCESS, DB_TABLESPACE_DELETED or DB_TABLESPACE_TRUNCATED
if we are trying to do i/o on a tablespace which does not exist */
dberr_t
@@ -5352,8 +5073,7 @@ fil_io(
ulint byte_offset,
ulint len,
void* buf,
- void* message,
- ulint* write_size)
+ void* message)
{
os_offset_t offset;
IORequest req_type(type);
@@ -5586,35 +5306,7 @@ fil_io(
const char* name = node->name == NULL ? space->name : node->name;
-#ifdef MYSQL_COMPRESSION
- /* Don't compress the log, page 0 of all tablespaces, tables
- compresssed with the old scheme and all pages from the system
- tablespace. */
-
- if (req_type.is_write()
- && !req_type.is_log()
- && !page_size.is_compressed()
- && page_id.page_no() > 0
- && IORequest::is_punch_hole_supported()
- && node->punch_hole) {
-
- ut_ad(!req_type.is_log());
-
- req_type.set_punch_hole();
-
- req_type.compression_algorithm(space->compression_type);
-
- } else {
- req_type.clear_compressed();
- }
-#endif /* MYSQL_COMPRESSION */
-
-#ifdef MYSQL_ENCRYPTION
- /* Set encryption information. */
- fil_io_set_encryption(req_type, page_id, space);
-#endif /* MYSQL_ENCRYPTION */
-
- req_type.block_size(node->block_size);
+ req_type.set_fil_node(node);
/* Queue the aio request */
dberr_t err = os_aio(
@@ -5622,21 +5314,7 @@ fil_io(
mode, name, node->handle, buf, offset, len,
space->purpose != FIL_TYPE_TEMPORARY
&& srv_read_only_mode,
- node, message, write_size);
-
- if (err == DB_IO_NO_PUNCH_HOLE) {
-
- err = DB_SUCCESS;
-
- if (node->punch_hole) {
-
- ib::warn()
- << "Punch hole failed for '"
- << name << "'";
- }
-
- fil_no_punch_hole(node);
- }
+ node, message);
/* We an try to recover the page from the double write buffer if
the decompression fails or the page is corrupt. */
@@ -5813,8 +5491,8 @@ struct Check {
@param[in] elem file node to visit */
void operator()(const fil_node_t* elem)
{
- ut_a(elem->is_open || !elem->n_pending);
- n_open += elem->is_open;
+ ut_a(elem->is_open() || !elem->n_pending);
+ n_open += elem->is_open();
size += elem->size;
}
@@ -5868,7 +5546,7 @@ fil_validate(void)
ut_a(fil_node->n_pending == 0);
ut_a(!fil_node->being_extended);
- ut_a(fil_node->is_open);
+ ut_a(fil_node->is_open());
ut_a(fil_space_belongs_in_lru(fil_node->space));
}
@@ -6000,9 +5678,9 @@ struct fil_iterator_t {
for IO */
byte* io_buffer; /*!< Buffer to use for IO */
fil_space_crypt_t *crypt_data; /*!< MariaDB Crypt data (if encrypted) */
- byte* crypt_io_buffer; /*!< MariaDB IO buffer when encrypted */
- byte* encryption_key; /*!< Encryption key */
- byte* encryption_iv; /*!< Encryption iv */
+ byte* crypt_io_buffer; /*!< MariaDB IO buffer when
+ encrypted */
+ dict_table_t* table; /*!< Imported table */
};
/********************************************************************//**
@@ -6080,16 +5758,6 @@ fil_iterate(
dberr_t err = DB_SUCCESS;
IORequest read_request(read_type);
-#ifdef MYSQL_ENCRYPTION
- /* For encrypted table, set encryption information. */
- if (iter.encryption_key != NULL && offset != 0) {
- read_request.encryption_key(iter.encryption_key,
- ENCRYPTION_KEY_LEN,
- iter.encryption_iv);
- read_request.encryption_algorithm(Encryption::AES);
- }
-#endif /* MYSQL_ENCRYPTION */
-
byte* readptr = io_buffer;
byte* writeptr = io_buffer;
bool encrypted = false;
@@ -6220,16 +5888,21 @@ fil_iterate(
if (page_compressed) {
ulint len = 0;
- fil_compress_page(space_id,
+
+ byte * res = fil_compress_page(space_id,
src,
NULL,
size,
- fil_space_get_page_compression_level(space_id),
+ dict_table_page_compression_level(iter.table),
fil_space_get_block_size(space_id, offset, size),
encrypted,
&len,
NULL);
+ if (len != size) {
+ memset(res+len, 0, size-len);
+ }
+
updated = true;
}
@@ -6266,16 +5939,6 @@ fil_iterate(
IORequest write_request(write_type);
-#ifdef MYSQL_ENCRYPTION
- /* For encrypted table, set encryption information. */
- if (iter.encryption_key != NULL && offset != 0) {
- write_request.encryption_key(iter.encryption_key,
- ENCRYPTION_KEY_LEN,
- iter.encryption_iv);
- write_request.encryption_algorithm(Encryption::AES);
- }
-#endif /* MYSQL_ENCRYPTION */
-
/* A page was updated in the set, write back to disk.
Note: We don't have the compression algorithm, we write
out the imported file as uncompressed. */
@@ -6286,18 +5949,12 @@ fil_iterate(
iter.filepath, iter.file, writeptr,
offset, (ulint) n_bytes)) != DB_SUCCESS) {
- /* This is not a hard error */
- if (err == DB_IO_NO_PUNCH_HOLE) {
-
- err = DB_SUCCESS;
- write_type &= ~IORequest::PUNCH_HOLE;
-
- } else {
- ib::error() << "os_file_write() failed";
-
- return(err);
- }
+ ib::error() << "os_file_write() failed";
+ return(err);
}
+
+ /* Clean up the temporal buffer. */
+ memset(writeptr, 0, n_bytes);
}
return(DB_SUCCESS);
@@ -6416,6 +6073,7 @@ fil_tablespace_iterate(
iter.file_size = file_size;
iter.n_io_buffers = n_io_buffers;
iter.page_size = callback.get_page_size().physical();
+ iter.table = table;
/* read (optional) crypt data */
iter.crypt_data = fil_space_read_crypt_data(
@@ -6423,26 +6081,6 @@ fil_tablespace_iterate(
+ fsp_header_get_encryption_offset(
callback.get_page_size()));
-#ifdef MYSQL_ENCRYPTION
- /* Set encryption info. */
- iter.encryption_key = table->encryption_key;
- iter.encryption_iv = table->encryption_iv;
-
- /* Check encryption is matched or not. */
- ulint space_flags = callback.get_space_flags();
- if (FSP_FLAGS_GET_ENCRYPTION(space_flags)) {
- ut_ad(table->encryption_key != NULL);
-
- if (!dict_table_is_encrypted(table)) {
- ib::error() << "Table is not in an encrypted"
- " tablespace, but the data file which"
- " trying to import is an encrypted"
- " tablespace";
- err = DB_IO_NO_ENCRYPT_TABLESPACE;
- }
- }
-#endif /* MYSQL_ENCRYPTION */
-
if (err == DB_SUCCESS) {
/* Compressed pages can't be optimised for block IO
@@ -6507,15 +6145,6 @@ fil_tablespace_iterate(
return(err);
}
-/** Set the tablespace table size.
-@param[in] page a page belonging to the tablespace */
-void
-PageCallback::set_page_size(
- const buf_frame_t* page) UNIV_NOTHROW
-{
- m_page_size.copy_from(fsp_header_get_page_size(page));
-}
-
/********************************************************************//**
Delete the tablespace file and any related files like .cfg.
This should not be called for temporary tables.
@@ -6600,12 +6229,10 @@ fil_mtr_rename_log(
dberr_t err;
bool old_is_file_per_table =
- !is_system_tablespace(old_table->space)
- && !DICT_TF_HAS_SHARED_SPACE(old_table->flags);
+ !is_system_tablespace(old_table->space);
bool new_is_file_per_table =
- !is_system_tablespace(new_table->space)
- && !DICT_TF_HAS_SHARED_SPACE(new_table->flags);
+ !is_system_tablespace(new_table->space);
/* If neither table is file-per-table,
there will be no renaming of files. */
@@ -6850,15 +6477,12 @@ truncate_t::truncate(
{
dberr_t err = DB_SUCCESS;
char* path;
- bool has_data_dir = FSP_FLAGS_HAS_DATA_DIR(flags);
ut_a(!is_system_tablespace(space_id));
- if (has_data_dir) {
+ if (FSP_FLAGS_HAS_DATA_DIR(flags)) {
ut_ad(dir_path != NULL);
-
path = fil_make_filepath(dir_path, tablename, IBD, true);
-
} else {
path = fil_make_filepath(NULL, tablename, IBD, false);
}
@@ -6881,7 +6505,7 @@ truncate_t::truncate(
space->size = node->size = FIL_IBD_FILE_INITIAL_SIZE;
}
- const bool already_open = node->is_open;
+ const bool already_open = node->is_open();
if (!already_open) {
@@ -6902,7 +6526,7 @@ truncate_t::truncate(
return(DB_ERROR);
}
- node->is_open = true;
+ ut_a(node->is_open());
}
os_offset_t trunc_size = trunc_to_default
@@ -6932,7 +6556,7 @@ truncate_t::truncate(
err = DB_ERROR;
} else {
- node->is_open = false;
+ node->handle = OS_FILE_CLOSED;
}
}
@@ -6943,339 +6567,6 @@ truncate_t::truncate(
return(err);
}
-/**
-Note that the file system where the file resides doesn't support PUNCH HOLE.
-Called from AIO handlers when IO returns DB_IO_NO_PUNCH_HOLE
-@param[in,out] node Node to set */
-void
-fil_no_punch_hole(fil_node_t* node)
-{
- node->punch_hole = false;
-}
-
-#ifdef MYSQL_COMPRESSION
-
-/** Set the compression type for the tablespace of a table
-@param[in] table The table that should be compressed
-@param[in] algorithm Text representation of the algorithm
-@return DB_SUCCESS or error code */
-dberr_t
-fil_set_compression(
- dict_table_t* table,
- const char* algorithm)
-{
- ut_ad(table != NULL);
-
- /* We don't support Page Compression for the system tablespace,
- the temporary tablespace, or any general tablespace because
- COMPRESSION is set by TABLE DDL, not TABLESPACE DDL. There is
- no other technical reason. Also, do not use it for missing
- tables or tables with compressed row_format. */
- if (table->ibd_file_missing
- || !DICT_TF2_FLAG_IS_SET(table, DICT_TF2_USE_FILE_PER_TABLE)
- || DICT_TF2_FLAG_IS_SET(table, DICT_TF2_TEMPORARY)
- || page_size_t(table->flags).is_compressed()) {
-
- return(DB_IO_NO_PUNCH_HOLE_TABLESPACE);
- }
-
- dberr_t err;
- Compression compression;
-
- if (algorithm == NULL || strlen(algorithm) == 0) {
-
-#ifndef UNIV_DEBUG
- compression.m_type = Compression::NONE;
-#else
- /* This is a Debug tool for setting compression on all
- compressible tables not otherwise specified. */
- switch (srv_debug_compress) {
- case Compression::LZ4:
- case Compression::ZLIB:
- case Compression::NONE:
-
- compression.m_type =
- static_cast<Compression::Type>(
- srv_debug_compress);
- break;
-
- default:
- compression.m_type = Compression::NONE;
- }
-
-#endif /* UNIV_DEBUG */
-
- err = DB_SUCCESS;
-
- } else {
-
- err = Compression::check(algorithm, &compression);
- }
-
- fil_space_t* space = fil_space_get(table->space);
-
- if (space == NULL) {
- return(DB_NOT_FOUND);
- }
-
- space->compression_type = compression.m_type;
-
- if (space->compression_type != Compression::NONE) {
-
- const fil_node_t* node;
-
- node = UT_LIST_GET_FIRST(space->chain);
-
- if (!node->punch_hole) {
-
- return(DB_IO_NO_PUNCH_HOLE_FS);
- }
- }
-
- return(err);
-}
-
-/** Get the compression algorithm for a tablespace.
-@param[in] space_id Space ID to check
-@return the compression algorithm */
-Compression::Type
-fil_get_compression(
- ulint space_id)
-{
- fil_space_t* space = fil_space_get(space_id);
-
- return(space == NULL ? Compression::NONE : space->compression_type);
-}
-
-/** Set the encryption type for the tablespace
-@param[in] space_id Space ID of tablespace for which to set
-@param[in] algorithm Encryption algorithm
-@param[in] key Encryption key
-@param[in] iv Encryption iv
-@return DB_SUCCESS or error code */
-dberr_t
-fil_set_encryption(
- ulint space_id,
- Encryption::Type algorithm,
- byte* key,
- byte* iv)
-{
- ut_ad(!is_system_or_undo_tablespace(space_id));
-
- if (is_system_tablespace(space_id)) {
- return(DB_IO_NO_ENCRYPT_TABLESPACE);
- }
-
- mutex_enter(&fil_system->mutex);
-
- fil_space_t* space = fil_space_get_by_id(space_id);
-
- if (space == NULL) {
- mutex_exit(&fil_system->mutex);
- return(DB_NOT_FOUND);
- }
-
- ut_ad(algorithm != Encryption::NONE);
- space->encryption_type = algorithm;
- if (key == NULL) {
- Encryption::random_value(space->encryption_key);
- } else {
- memcpy(space->encryption_key,
- key, ENCRYPTION_KEY_LEN);
- }
-
- space->encryption_klen = ENCRYPTION_KEY_LEN;
- if (iv == NULL) {
- Encryption::random_value(space->encryption_iv);
- } else {
- memcpy(space->encryption_iv,
- iv, ENCRYPTION_KEY_LEN);
- }
-
- mutex_exit(&fil_system->mutex);
-
- return(DB_SUCCESS);
-}
-
-/** Rotate the tablespace keys by new master key.
-@return true if the re-encrypt suceeds */
-bool
-fil_encryption_rotate()
-{
- fil_space_t* space;
- mtr_t mtr;
- byte encrypt_info[ENCRYPTION_INFO_SIZE_V2];
-
- for (space = UT_LIST_GET_FIRST(fil_system->space_list);
- space != NULL; ) {
- /* Skip unencypted tablespaces. */
- if (is_system_or_undo_tablespace(space->id)
- || fsp_is_system_temporary(space->id)
- || space->purpose == FIL_TYPE_LOG) {
- space = UT_LIST_GET_NEXT(space_list, space);
- continue;
- }
-
- if (space->encryption_type != Encryption::NONE) {
- mtr_start(&mtr);
- mtr.set_named_space(space->id);
-
- space = mtr_x_lock_space(space->id, &mtr);
-
- memset(encrypt_info, 0, ENCRYPTION_INFO_SIZE_V2);
-
- if (!fsp_header_rotate_encryption(space,
- encrypt_info,
- &mtr)) {
- mtr_commit(&mtr);
- return(false);
- }
-
- mtr_commit(&mtr);
- }
-
- space = UT_LIST_GET_NEXT(space_list, space);
- DBUG_EXECUTE_IF("ib_crash_during_rotation_for_encryption",
- DBUG_SUICIDE(););
- }
-
- return(true);
-}
-#endif /* MYSQL_COMPRESSION */
-
-/** Build the basic folder name from the path and length provided
-@param[in] path pathname (may also include the file basename)
-@param[in] len length of the path, in bytes */
-void
-Folder::make_path(const char* path, size_t len)
-{
- if (is_absolute_path(path)) {
- m_folder = mem_strdupl(path, len);
- m_folder_len = len;
- }
- else {
- size_t n = 2 + len + strlen(fil_path_to_mysql_datadir);
- m_folder = static_cast<char*>(ut_malloc_nokey(n));
- m_folder_len = 0;
-
- if (path != fil_path_to_mysql_datadir) {
- /* Put the mysqld datadir into m_folder first. */
- ut_ad(fil_path_to_mysql_datadir[0] != '\0');
- m_folder_len = strlen(fil_path_to_mysql_datadir);
- memcpy(m_folder, fil_path_to_mysql_datadir,
- m_folder_len);
- if (m_folder[m_folder_len - 1] != OS_PATH_SEPARATOR) {
- m_folder[m_folder_len++] = OS_PATH_SEPARATOR;
- }
- }
-
- /* Append the path. */
- memcpy(m_folder + m_folder_len, path, len);
- m_folder_len += len;
- m_folder[m_folder_len] = '\0';
- }
-
- os_normalize_path(m_folder);
-}
-
-/** Resolve a relative path in m_folder to an absolute path
-in m_abs_path setting m_abs_len. */
-void
-Folder::make_abs_path()
-{
- my_realpath(m_abs_path, m_folder, MYF(0));
- m_abs_len = strlen(m_abs_path);
-
- ut_ad(m_abs_len + 1 < sizeof(m_abs_path));
-
- /* Folder::related_to() needs a trailing separator. */
- if (m_abs_path[m_abs_len - 1] != OS_PATH_SEPARATOR) {
- m_abs_path[m_abs_len] = OS_PATH_SEPARATOR;
- m_abs_path[++m_abs_len] = '\0';
- }
-}
-
-/** Constructor
-@param[in] path pathname (may also include the file basename)
-@param[in] len length of the path, in bytes */
-Folder::Folder(const char* path, size_t len)
-{
- make_path(path, len);
- make_abs_path();
-}
-
-/** Assignment operator
-@param[in] folder folder string provided */
-class Folder&
-Folder::operator=(const char* path)
-{
- ut_free(m_folder);
- make_path(path, strlen(path));
- make_abs_path();
-
- return(*this);
-}
-
-/** Determine if two folders are equal
-@param[in] other folder to compare to
-@return whether the folders are equal */
-bool Folder::operator==(const Folder& other) const
-{
- return(m_abs_len == other.m_abs_len
- && !memcmp(m_abs_path, other.m_abs_path, m_abs_len));
-}
-
-/** Determine if the left folder is the same or an ancestor of
-(contains) the right folder.
-@param[in] other folder to compare to
-@return whether this is the same or an ancestor of the other folder. */
-bool Folder::operator>=(const Folder& other) const
-{
- return(m_abs_len <= other.m_abs_len
- && (!memcmp(other.m_abs_path, m_abs_path, m_abs_len)));
-}
-
-/** Determine if the left folder is an ancestor of (contains)
-the right folder.
-@param[in] other folder to compare to
-@return whether this is an ancestor of the other folder */
-bool Folder::operator>(const Folder& other) const
-{
- return(m_abs_len < other.m_abs_len
- && (!memcmp(other.m_abs_path, m_abs_path, m_abs_len)));
-}
-
-/** Determine if the directory referenced by m_folder exists.
-@return whether the directory exists */
-bool
-Folder::exists()
-{
- bool exists;
- os_file_type_t type;
-
-#ifdef _WIN32
- /* Temporarily strip the trailing_separator since it will cause
- _stat64() to fail on Windows unless the path is the root of some
- drive; like "c:\". _stat64() will fail if it is "c:". */
- size_t len = strlen(m_abs_path);
- if (m_abs_path[m_abs_len - 1] == OS_PATH_SEPARATOR
- && m_abs_path[m_abs_len - 2] != ':') {
- m_abs_path[m_abs_len - 1] = '\0';
- }
-#endif /* WIN32 */
-
- bool ret = os_file_status(m_abs_path, &exists, &type);
-
-#ifdef _WIN32
- /* Put the separator back on. */
- if (m_abs_path[m_abs_len - 1] == '\0') {
- m_abs_path[m_abs_len - 1] = OS_PATH_SEPARATOR;
- }
-#endif /* WIN32 */
-
- return(ret && exists && type == OS_FILE_TYPE_DIR);
-}
-
/* Unit Tests */
#ifdef UNIV_ENABLE_UNIT_TEST_MAKE_FILEPATH
#define MF fil_make_filepath
@@ -7300,7 +6591,6 @@ test_make_filepath()
path = MF("/this/is/a/path/with/a/filename", NULL, IBD, false); DISPLAY;
path = MF("/this/is/a/path/with/a/filename", NULL, ISL, false); DISPLAY;
path = MF("/this/is/a/path/with/a/filename", NULL, CFG, false); DISPLAY;
- path = MF("/this/is/a/path/with/a/filename", NULL, CFP, false); DISPLAY;
path = MF("/this/is/a/path/with/a/filename.ibd", NULL, IBD, false); DISPLAY;
path = MF("/this/is/a/path/with/a/filename.ibd", NULL, IBD, false); DISPLAY;
path = MF("/this/is/a/path/with/a/filename.dat", NULL, IBD, false); DISPLAY;
@@ -7310,7 +6600,6 @@ test_make_filepath()
path = MF(NULL, "dbname/tablespacename", IBD, false); DISPLAY;
path = MF(NULL, "dbname/tablespacename", ISL, false); DISPLAY;
path = MF(NULL, "dbname/tablespacename", CFG, false); DISPLAY;
- path = MF(NULL, "dbname/tablespacename", CFP, false); DISPLAY;
path = MF(NULL, "dbname\\tablespacename", NO_EXT, false); DISPLAY;
path = MF(NULL, "dbname\\tablespacename", IBD, false); DISPLAY;
path = MF("/this/is/a/path", "dbname/tablespacename", IBD, false); DISPLAY;
@@ -7369,10 +6658,9 @@ fil_space_get_crypt_data(
byte *page = static_cast<byte*>(ut_align(buf, UNIV_PAGE_SIZE));
fil_read(page_id_t(space_id, 0), univ_page_size, 0, univ_page_size.physical(),
page);
- ulint flags = fsp_header_get_flags(page);
ulint offset = FSP_HEADER_OFFSET
+ fsp_header_get_encryption_offset(
- page_size_t(flags));
+ page_size_t(space->flags));
space->crypt_data = fil_space_read_crypt_data(space_id, page, offset);
ut_free(buf);
@@ -7608,7 +6896,7 @@ fil_node_t*
fil_space_get_node(
fil_space_t* space, /*!< in: file spage */
ulint space_id, /*!< in: space id */
- ulint* block_offset, /*!< in/out: offset in number of blocks */
+ os_offset_t* block_offset, /*!< in/out: offset in number of blocks */
ulint byte_offset, /*!< in: remainder of offset in bytes; in
aio this must be divisible by the OS block
size */
@@ -7644,14 +6932,16 @@ fil_space_get_node(
/********************************************************************//**
Return block size of node in file space
+@param[in] space_id space id
+@param[in] block_offset page offset
+@param[in] len page len
@return file block size */
UNIV_INTERN
ulint
fil_space_get_block_size(
-/*=====================*/
- ulint space_id,
- ulint block_offset,
- ulint len)
+ ulint space_id,
+ os_offset_t block_offset,
+ ulint len)
{
ulint block_size = 512;
ut_ad(!mutex_own(&fil_system->mutex));
@@ -7717,3 +7007,26 @@ fil_system_exit(void)
ut_ad(mutex_own(&fil_system->mutex));
mutex_exit(&fil_system->mutex);
}
+
+/**
+Get should we punch hole to tablespace.
+@param[in] node File node
+@return true, if punch hole should be tried, false if not. */
+bool
+fil_node_should_punch_hole(
+ const fil_node_t* node)
+{
+ return (node->space->punch_hole);
+}
+
+/**
+Set punch hole to tablespace to given value.
+@param[in] node File node
+@param[in] val value to be set. */
+void
+fil_space_set_punch_hole(
+ fil_node_t* node,
+ bool val)
+{
+ node->space->punch_hole = val;
+}
diff --git a/storage/innobase/fil/fil0pagecompress.cc b/storage/innobase/fil/fil0pagecompress.cc
index cd2c62e00c1..18f95c94d75 100644
--- a/storage/innobase/fil/fil0pagecompress.cc
+++ b/storage/innobase/fil/fil0pagecompress.cc
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (C) 2013, 2016, MariaDB Corporation. All Rights Reserved.
+Copyright (C) 2013, 2017, MariaDB Corporation. 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
@@ -162,8 +162,14 @@ fil_compress_page(
switch(comp_method) {
#ifdef HAVE_LZ4
case PAGE_LZ4_ALGORITHM:
+
+#ifdef HAVE_LZ4_COMPRESS_DEFAULT
+ err = LZ4_compress_default((const char *)buf,
+ (char *)out_buf+header_len, len, write_size);
+#else
err = LZ4_compress_limitedOutput((const char *)buf,
(char *)out_buf+header_len, len, write_size);
+#endif /* HAVE_LZ4_COMPRESS_DEFAULT */
write_size = err;
if (err == 0) {
@@ -355,6 +361,7 @@ fil_compress_page(
if (allocated) {
/* TODO: reduce number of memcpy's */
memcpy(buf, out_buf, len);
+ goto exit_free;
} else {
return(out_buf);
}
@@ -380,6 +387,7 @@ err_exit:
srv_stats.pages_page_compression_error.inc();
*out_len = len;
+exit_free:
if (allocated) {
ut_free(out_buf);
#ifdef HAVE_LZO
@@ -412,24 +420,26 @@ fil_decompress_page(
{
int err = 0;
ulint actual_size = 0;
- ulint compression_alg = 0;
+ ib_uint64_t compression_alg = 0;
byte *in_buf;
ulint ptype;
- ulint header_len = FIL_PAGE_DATA + FIL_PAGE_COMPRESSED_SIZE;
+ ulint header_len;
ut_ad(buf);
ut_ad(len);
ptype = mach_read_from_2(buf+FIL_PAGE_TYPE);
- if (ptype == FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED) {
- header_len += FIL_PAGE_COMPRESSION_METHOD_SIZE;
- }
-
- /* Do not try to uncompressed pages that are not compressed */
- if (ptype != FIL_PAGE_PAGE_COMPRESSED &&
- ptype != FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED &&
- ptype != FIL_PAGE_COMPRESSED) {
+ switch (ptype) {
+ case FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED:
+ header_len = FIL_PAGE_DATA + FIL_PAGE_COMPRESSED_SIZE
+ + FIL_PAGE_COMPRESSION_METHOD_SIZE;
+ break;
+ case FIL_PAGE_PAGE_COMPRESSED:
+ header_len = FIL_PAGE_DATA + FIL_PAGE_COMPRESSED_SIZE;
+ break;
+ default:
+ /* The page is not in our format. */
return;
}
@@ -443,9 +453,7 @@ fil_decompress_page(
/* Before actual decompress, make sure that page type is correct */
- if (mach_read_from_4(buf+FIL_PAGE_SPACE_OR_CHKSUM) != BUF_NO_CHECKSUM_MAGIC ||
- (ptype != FIL_PAGE_PAGE_COMPRESSED &&
- ptype != FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED)) {
+ if (mach_read_from_4(buf+FIL_PAGE_SPACE_OR_CHKSUM) != BUF_NO_CHECKSUM_MAGIC) {
ib::error() << "Corruption: We try to uncompress corrupted page:"
<< " CRC "
<< mach_read_from_4(buf+FIL_PAGE_SPACE_OR_CHKSUM)
@@ -461,7 +469,7 @@ fil_decompress_page(
/* Get compression algorithm */
if (ptype == FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED) {
- compression_alg = mach_read_from_2(buf+FIL_PAGE_DATA+FIL_PAGE_COMPRESSED_SIZE);
+ compression_alg = static_cast<ib_uint64_t>(mach_read_from_2(buf+FIL_PAGE_DATA+FIL_PAGE_COMPRESSED_SIZE));
} else {
compression_alg = mach_read_from_8(buf+FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION);
}
diff --git a/storage/innobase/fsp/fsp0file.cc b/storage/innobase/fsp/fsp0file.cc
index 0e1d2f3233b..22cd4862162 100644
--- a/storage/innobase/fsp/fsp0file.cc
+++ b/storage/innobase/fsp/fsp0file.cc
@@ -1,6 +1,7 @@
/*****************************************************************************
Copyright (c) 2013, 2016, 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
@@ -47,8 +48,6 @@ Datafile::init(
m_name = mem_strdup(name);
m_flags = flags;
- m_encryption_key = NULL;
- m_encryption_iv = NULL;
}
/** Release the resources. */
@@ -60,16 +59,10 @@ Datafile::shutdown()
ut_free(m_name);
m_name = NULL;
- ut_free(m_encryption_key);
- m_encryption_key = NULL;
-
/* The fil_space_t::crypt_data was freed in
fil_space_free_low(). Invalidate our redundant pointer. */
m_crypt_info = NULL;
- ut_free(m_encryption_iv);
- m_encryption_iv = NULL;
-
free_filepath();
free_first_page();
}
@@ -276,9 +269,8 @@ Datafile::same_as(
}
/** Allocate and set the datafile or tablespace name in m_name.
-If a name is provided, use it; else if the datafile is file-per-table,
-extract a file-per-table tablespace name from m_filepath; else it is a
-general tablespace, so just call it that for now. The value of m_name
+If a name is provided, use it; else extract a file-per-table
+tablespace name from m_filepath. The value of m_name
will be freed in the destructor.
@param[in] name tablespace name if known, NULL if not */
void
@@ -288,14 +280,8 @@ Datafile::set_name(const char* name)
if (name != NULL) {
m_name = mem_strdup(name);
- } else if (fsp_is_file_per_table(m_space_id, m_flags)) {
- m_name = fil_path_to_space_name(m_filepath);
} else {
- /* Give this general tablespace a temporary name. */
- m_name = static_cast<char*>(
- ut_malloc_nokey(strlen(general_space_name) + 20));
-
- sprintf(m_name, "%s_" ULINTPF, general_space_name, m_space_id);
+ m_name = fil_path_to_space_name(m_filepath);
}
}
@@ -358,17 +344,37 @@ Datafile::read_first_page(bool read_only_mode)
}
}
- if (err == DB_SUCCESS && m_order == 0) {
+ if (err != DB_SUCCESS) {
+ return(err);
+ }
+ if (m_order == 0) {
+ m_space_id = fsp_header_get_space_id(m_first_page);
m_flags = fsp_header_get_flags(m_first_page);
+ if (!fsp_flags_is_valid(m_flags)) {
+ ulint cflags = fsp_flags_convert_from_101(m_flags);
+ if (cflags == ULINT_UNDEFINED) {
+ ib::error()
+ << "Invalid flags " << ib::hex(m_flags)
+ << " in " << m_filepath;
+ return(DB_CORRUPTION);
+ } else {
+ m_flags = cflags;
+ }
+ }
+ }
- m_space_id = fsp_header_get_space_id(m_first_page);
+ const page_size_t ps(m_flags);
+ if (ps.physical() > page_size) {
+ ib::error() << "File " << m_filepath
+ << " should be longer than "
+ << page_size << " bytes";
+ return(DB_CORRUPTION);
}
m_crypt_info = fil_space_read_crypt_data(
m_space_id, m_first_page,
- FSP_HEADER_OFFSET + fsp_header_get_encryption_offset(
- fsp_header_get_page_size(m_first_page)));
+ FSP_HEADER_OFFSET + fsp_header_get_encryption_offset(ps));
return(err);
}
@@ -389,14 +395,10 @@ space ID and flags. The file should exist and be successfully opened
in order for this function to validate it.
@param[in] space_id The expected tablespace ID.
@param[in] flags The expected tablespace flags.
-@param[in] for_import if it is for importing
@retval DB_SUCCESS if tablespace is valid, DB_ERROR if not.
m_is_valid is also set true on success, else false. */
dberr_t
-Datafile::validate_to_dd(
- ulint space_id,
- ulint flags,
- bool for_import)
+Datafile::validate_to_dd(ulint space_id, ulint flags)
{
dberr_t err;
@@ -407,18 +409,17 @@ Datafile::validate_to_dd(
/* Validate this single-table-tablespace with the data dictionary,
but do not compare the DATA_DIR flag, in case the tablespace was
remotely located. */
- err = validate_first_page(0, for_import);
+ err = validate_first_page(0);
if (err != DB_SUCCESS) {
return(err);
}
+ flags &= ~FSP_FLAGS_MEM_MASK;
+
/* Make sure the datafile we found matched the space ID.
If the datafile is a file-per-table tablespace then also match
the row format and zip page size. */
- if (m_space_id == space_id
- && (m_flags & FSP_FLAGS_MASK_SHARED
- || (m_flags & ~FSP_FLAGS_MASK_DATA_DIR)
- == (flags & ~FSP_FLAGS_MASK_DATA_DIR))) {
+ if (m_space_id == space_id && m_flags == flags) {
/* Datafile matches the tablespace expected. */
return(DB_SUCCESS);
}
@@ -427,9 +428,10 @@ Datafile::validate_to_dd(
m_is_valid = false;
ib::error() << "In file '" << m_filepath << "', tablespace id and"
- " flags are " << m_space_id << " and " << m_flags << ", but in"
- " the InnoDB data dictionary they are " << space_id << " and "
- << flags << ". Have you moved InnoDB .ibd files around without"
+ " flags are " << m_space_id << " and " << ib::hex(m_flags)
+ << ", but in the InnoDB data dictionary they are "
+ << space_id << " and " << ib::hex(flags)
+ << ". Have you moved InnoDB .ibd files around without"
" using the commands DISCARD TABLESPACE and IMPORT TABLESPACE?"
" " << TROUBLESHOOT_DATADICT_MSG;
@@ -451,7 +453,7 @@ Datafile::validate_for_recovery()
ut_ad(is_open());
ut_ad(!srv_read_only_mode);
- err = validate_first_page(0, false);
+ err = validate_first_page(0);
switch (err) {
case DB_SUCCESS:
@@ -459,11 +461,6 @@ Datafile::validate_for_recovery()
break;
default:
- /* For encryption tablespace, we skip the retry step,
- since it is only because the keyring is not ready. */
- if (FSP_FLAGS_GET_ENCRYPTION(m_flags)) {
- return(err);
- }
/* Re-open the file in read-write mode Attempt to restore
page 0 from doublewrite and read the space ID from a survey
of the first few pages. */
@@ -484,14 +481,13 @@ Datafile::validate_for_recovery()
return(err);
}
- err = restore_from_doublewrite(0);
- if (err != DB_SUCCESS) {
- return(err);
+ if (restore_from_doublewrite()) {
+ return(DB_CORRUPTION);
}
/* Free the previously read first page and then re-validate. */
free_first_page();
- err = validate_first_page(0, false);
+ err = validate_first_page(0);
}
if (err == DB_SUCCESS) {
@@ -506,14 +502,11 @@ tablespace is opened. This occurs before the fil_space_t is created
so the Space ID found here must not already be open.
m_is_valid is set true on success, else false.
@param[out] flush_lsn contents of FIL_PAGE_FILE_FLUSH_LSN
-@param[in] for_import if it is for importing
-(only valid for the first file of the system tablespace)
@retval DB_SUCCESS on if the datafile is valid
@retval DB_CORRUPTION if the datafile is not readable
@retval DB_TABLESPACE_EXISTS if there is a duplicate space_id */
dberr_t
-Datafile::validate_first_page(lsn_t* flush_lsn,
- bool for_import)
+Datafile::validate_first_page(lsn_t* flush_lsn)
{
char* prev_name;
char* prev_filepath;
@@ -571,7 +564,9 @@ Datafile::validate_first_page(lsn_t* flush_lsn,
free_first_page();
return(DB_ERROR);
-
+ } else if (!fsp_flags_is_valid(m_flags)) {
+ /* Tablespace flags must be valid. */
+ error_txt = "Tablespace flags are invalid";
} else if (page_get_page_no(m_first_page) != 0) {
/* First page must be number 0 */
@@ -602,51 +597,6 @@ Datafile::validate_first_page(lsn_t* flush_lsn,
}
-#ifdef MYSQL_ENCRYPTION
- /* For encrypted tablespace, check the encryption info in the
- first page can be decrypt by master key, otherwise, this table
- can't be open. And for importing, we skip checking it. */
- if (FSP_FLAGS_GET_ENCRYPTION(m_flags) && !for_import) {
- m_encryption_key = static_cast<byte*>(
- ut_zalloc_nokey(ENCRYPTION_KEY_LEN));
- m_encryption_iv = static_cast<byte*>(
- ut_zalloc_nokey(ENCRYPTION_KEY_LEN));
-#ifdef UNIV_ENCRYPT_DEBUG
- fprintf(stderr, "Got from file %lu:", m_space_id);
-#endif
- if (!fsp_header_get_encryption_key(m_flags,
- m_encryption_key,
- m_encryption_iv,
- m_first_page)) {
- ib::error()
- << "Encryption information in"
- << " datafile: " << m_filepath
- << " can't be decrypted"
- << " , please confirm the keyfile"
- << " is match and keyring plugin"
- << " is loaded.";
-
- m_is_valid = false;
- free_first_page();
- ut_free(m_encryption_key);
- ut_free(m_encryption_iv);
- m_encryption_key = NULL;
- m_encryption_iv = NULL;
- return(DB_CORRUPTION);
- }
-
- if (recv_recovery_is_on()
- && memcmp(m_encryption_key,
- m_encryption_iv,
- ENCRYPTION_KEY_LEN) == 0) {
- ut_free(m_encryption_key);
- ut_free(m_encryption_iv);
- m_encryption_key = NULL;
- m_encryption_iv = NULL;
- }
- }
-#endif /* MYSQL_ENCRYPTION */
-
if (fil_space_read_name_and_filepath(
m_space_id, &prev_name, &prev_filepath)) {
@@ -740,30 +690,7 @@ Datafile::find_space_id()
err = os_file_read(
request, m_handle, page, n_bytes, page_size);
- if (err == DB_IO_DECOMPRESS_FAIL) {
-
- /* If the page was compressed on the fly then
- try and decompress the page */
-
- n_bytes = os_file_compressed_page_size(page);
-
- if (n_bytes != ULINT_UNDEFINED) {
-
- err = os_file_read(
- request,
- m_handle, page, page_size,
- UNIV_PAGE_SIZE_MAX);
-
- if (err != DB_SUCCESS) {
-
- ib::info()
- << "READ FAIL: "
- << "page_no:" << j;
- continue;
- }
- }
-
- } else if (err != DB_SUCCESS) {
+ if (err != DB_SUCCESS) {
ib::info()
<< "READ FAIL: page_no:" << j;
@@ -854,17 +781,15 @@ Datafile::find_space_id()
}
-/** Finds a given page of the given space id from the double write buffer
-and copies it to the corresponding .ibd file.
-@param[in] page_no Page number to restore
-@return DB_SUCCESS if page was restored from doublewrite, else DB_ERROR */
-dberr_t
-Datafile::restore_from_doublewrite(
- ulint restore_page_no)
+/** Restore the first page of the tablespace from
+the double write buffer.
+@return whether the operation failed */
+bool
+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, restore_page_no);
+ const byte* page = recv_sys->dblwr.find_page(m_space_id, 0);
+ const page_id_t page_id(m_space_id, 0);
if (page == NULL) {
/* If the first page of the given user tablespace is not there
@@ -872,23 +797,34 @@ Datafile::restore_from_doublewrite(
now. Hence this is treated as an error. */
ib::error()
- << "Corrupted page "
- << page_id_t(m_space_id, restore_page_no)
+ << "Corrupted page " << page_id
<< " of datafile '" << m_filepath
<< "' could not be found in the doublewrite buffer.";
- return(DB_CORRUPTION);
+ return(true);
}
- const ulint flags = mach_read_from_4(
+ ulint flags = mach_read_from_4(
FSP_HEADER_OFFSET + FSP_SPACE_FLAGS + page);
+ if (!fsp_flags_is_valid(flags)) {
+ 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;
+ /* The flags on the page should be converted later. */
+ }
+
const page_size_t page_size(flags);
- ut_a(page_get_page_no(page) == restore_page_no);
+ ut_a(page_get_page_no(page) == page_id.page_no());
- ib::info() << "Restoring page "
- << page_id_t(m_space_id, restore_page_no)
+ ib::info() << "Restoring page " << page_id
<< " of datafile '" << m_filepath
<< "' from the doublewrite buffer. Writing "
<< page_size.physical() << " bytes into file '"
@@ -896,14 +832,10 @@ Datafile::restore_from_doublewrite(
IORequest request(IORequest::WRITE);
- /* Note: The pages are written out as uncompressed because we don't
- have the compression algorithm information at this point. */
-
- request.disable_compression();
-
return(os_file_write(
request,
- m_filepath, m_handle, page, 0, page_size.physical()));
+ m_filepath, m_handle, page, 0, page_size.physical())
+ != DB_SUCCESS);
}
/** Create a link filename based on the contents of m_name,
@@ -986,19 +918,7 @@ the path provided without its suffix, plus DOT_ISL.
void
RemoteDatafile::set_link_filepath(const char* path)
{
- if (m_link_filepath != NULL) {
- return;
- }
-
- if (path != NULL && FSP_FLAGS_GET_SHARED(flags())) {
- /* Make the link_filepath based on the basename. */
- ut_ad(strcmp(&path[strlen(path) - strlen(DOT_IBD)],
- DOT_IBD) == 0);
-
- m_link_filepath = fil_make_filepath(NULL, base_name(path),
- ISL, false);
- } else {
- /* Make the link_filepath based on the m_name. */
+ if (m_link_filepath == NULL) {
m_link_filepath = fil_make_filepath(NULL, name(), ISL, false);
}
}
@@ -1008,14 +928,11 @@ under the 'datadir' of MySQL. The datadir is the directory of a
running mysqld program. We can refer to it by simply using the path ".".
@param[in] name tablespace name
@param[in] filepath remote filepath of tablespace datafile
-@param[in] is_shared true for general tablespace,
- false for file-per-table
@return DB_SUCCESS or error code */
dberr_t
RemoteDatafile::create_link_file(
const char* name,
- const char* filepath,
- bool is_shared)
+ const char* filepath)
{
bool success;
dberr_t err = DB_SUCCESS;
@@ -1025,31 +942,8 @@ RemoteDatafile::create_link_file(
ut_ad(!srv_read_only_mode);
ut_ad(0 == strcmp(&filepath[strlen(filepath) - 4], DOT_IBD));
- if (is_shared) {
- /* The default location for a shared tablespace is the
- datadir. We previously made sure that this filepath is
- not under the datadir. If it is in the datadir there
- is no need for a link file. */
-
- size_t len = dirname_length(filepath);
- if (len == 0) {
- /* File is in the datadir. */
- return(DB_SUCCESS);
- }
-
- Folder folder(filepath, len);
-
- if (folder_mysql_datadir == folder) {
- /* File is in the datadir. */
- return(DB_SUCCESS);
- }
+ link_filepath = fil_make_filepath(NULL, name, ISL, false);
- /* Use the file basename to build the ISL filepath. */
- link_filepath = fil_make_filepath(NULL, base_name(filepath),
- ISL, false);
- } else {
- link_filepath = fil_make_filepath(NULL, name, ISL, false);
- }
if (link_filepath == NULL) {
return(DB_ERROR);
}
@@ -1156,8 +1050,6 @@ RemoteDatafile::delete_link_file(
It is always created under the datadir of MySQL.
For file-per-table tablespaces, the isl file is expected to be
in a 'database' directory and called 'tablename.isl'.
-For general tablespaces, there will be no 'database' directory.
-The 'basename.isl' will be in the datadir.
The caller must free the memory returned if it is not null.
@param[in] link_filepath filepath of the ISL file
@return Filepath of the IBD file read from the ISL file */
@@ -1165,16 +1057,12 @@ char*
RemoteDatafile::read_link_file(
const char* link_filepath)
{
- char* filepath = NULL;
- FILE* file = NULL;
-
- file = fopen(link_filepath, "r+b");
+ FILE* file = fopen(link_filepath, "r+b");
if (file == NULL) {
return(NULL);
}
- filepath = static_cast<char*>(
- ut_malloc_nokey(OS_FILE_MAX_PATH));
+ char* filepath = static_cast<char*>(ut_malloc_nokey(OS_FILE_MAX_PATH));
os_file_read_string(file, filepath, OS_FILE_MAX_PATH);
fclose(file);
diff --git a/storage/innobase/fsp/fsp0fsp.cc b/storage/innobase/fsp/fsp0fsp.cc
index 4fa1d92a6fd..6886c5164f7 100644
--- a/storage/innobase/fsp/fsp0fsp.cc
+++ b/storage/innobase/fsp/fsp0fsp.cc
@@ -1,6 +1,7 @@
/*****************************************************************************
Copyright (c) 1995, 2016, 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
@@ -52,14 +53,19 @@ Created 11/29/1995 Heikki Tuuri
// JAN: MySQL 5.7 Encryption
// #include <my_aes.h>
-/** Returns an extent to the free list of a space.
-@param[in] page_id page id in the extent
+typedef ulint page_no_t;
+
+/** Return an extent to the free list of a space.
+@param[in,out] space tablespace
+@param[in] offset page number in the extent
@param[in] page_size page size
@param[in,out] mtr mini-transaction */
+MY_ATTRIBUTE((nonnull))
static
void
fsp_free_extent(
- const page_id_t& page_id,
+ fil_space_t* space,
+ page_no_t offset,
const page_size_t& page_size,
mtr_t* mtr);
@@ -71,7 +77,7 @@ void
fseg_mark_page_used(
/*================*/
fseg_inode_t* seg_inode,/*!< in: segment inode */
- ulint page, /*!< in: page offset */
+ page_no_t page, /*!< in: page offset */
xdes_t* descr, /*!< in: extent descriptor */
mtr_t* mtr); /*!< in/out: mini-transaction */
@@ -79,15 +85,16 @@ fseg_mark_page_used(
We think of the extent lists of the segment catenated in the order
FSEG_FULL -> FSEG_NOT_FULL -> FSEG_FREE.
@param[in] inode segment inode
-@param[in] space_id space id
+@param[in] space tablespace
@param[in] page_size page size
@param[in,out] mtr mini-transaction
@return the first extent descriptor, or NULL if none */
+MY_ATTRIBUTE((nonnull, warn_unused_result))
static
xdes_t*
fseg_get_first_extent(
fseg_inode_t* inode,
- ulint space_id,
+ const fil_space_t* space,
const page_size_t& page_size,
mtr_t* mtr);
@@ -147,185 +154,33 @@ fseg_alloc_free_page_low(
MY_ATTRIBUTE((warn_unused_result));
/** Gets a pointer to the space header and x-locks its page.
-@param[in] id space id
+@param[in] space tablespace
@param[in] page_size page size
@param[in,out] mtr mini-transaction
@return pointer to the space header, page x-locked */
UNIV_INLINE
fsp_header_t*
fsp_get_space_header(
- ulint id,
+ const fil_space_t* space,
const page_size_t& page_size,
mtr_t* mtr)
{
buf_block_t* block;
fsp_header_t* header;
- ut_ad(id != 0 || !page_size.is_compressed());
+ ut_ad(space->purpose != FIL_TYPE_LOG);
+ ut_ad(!FSP_FLAGS_GET_ZIP_SSIZE(space->flags)
+ == !page_size.is_compressed());
- block = buf_page_get(page_id_t(id, 0), page_size, RW_SX_LATCH, mtr);
+ block = buf_page_get(page_id_t(space->id, 0), page_size,
+ RW_SX_LATCH, mtr);
header = FSP_HEADER_OFFSET + buf_block_get_frame(block);
buf_block_dbg_add_level(block, SYNC_FSP_PAGE);
- ut_ad(id == mach_read_from_4(FSP_SPACE_ID + header));
-#ifdef UNIV_DEBUG
- const ulint flags = mach_read_from_4(FSP_SPACE_FLAGS + header);
- ut_ad(page_size_t(flags).equals_to(page_size));
-#endif /* UNIV_DEBUG */
+ ut_ad(space->id == mach_read_from_4(FSP_SPACE_ID + header));
return(header);
}
-/** Convert a 32 bit integer tablespace flags to the 32 bit table flags.
-This can only be done for a tablespace that was built as a file-per-table
-tablespace. Note that the fsp_flags cannot show the difference between a
-Compact and Redundant table, so an extra Compact boolean must be supplied.
- Low order bit
- | REDUNDANT | COMPACT | COMPRESSED | DYNAMIC
-fil_space_t::flags | 0 | 0 | 1 | 1
-dict_table_t::flags | 0 | 1 | 1 | 1
-@param[in] fsp_flags fil_space_t::flags
-@param[in] compact true if not Redundant row format
-@return tablespace flags (fil_space_t::flags) */
-ulint
-fsp_flags_to_dict_tf(
- ulint fsp_flags,
- bool compact)
-{
- /* If the table in this file-per-table tablespace is Compact
- row format, the low order bit will not indicate Compact. */
- bool post_antelope = FSP_FLAGS_GET_POST_ANTELOPE(fsp_flags);
- ulint zip_ssize = FSP_FLAGS_GET_ZIP_SSIZE(fsp_flags);
- bool atomic_blobs = FSP_FLAGS_HAS_ATOMIC_BLOBS(fsp_flags);
- bool data_dir = FSP_FLAGS_HAS_DATA_DIR(fsp_flags);
- bool shared_space = FSP_FLAGS_GET_SHARED(fsp_flags);
- bool page_compressed = FSP_FLAGS_GET_PAGE_COMPRESSION(fsp_flags);
- ulint comp_level = FSP_FLAGS_GET_PAGE_COMPRESSION_LEVEL(fsp_flags);
-
- /* FSP_FLAGS_GET_TEMPORARY(fsp_flags) does not have an equivalent
- flag position in the table flags. But it would go into flags2 if
- any code is created where that is needed. */
-
- ulint flags = dict_tf_init(post_antelope | compact, zip_ssize,
- atomic_blobs, data_dir, shared_space,
- page_compressed, comp_level, 0);
-
- return(flags);
-}
-
-/** Validate the tablespace flags.
-These flags are stored in the tablespace header at offset FSP_SPACE_FLAGS.
-They should be 0 for ROW_FORMAT=COMPACT and ROW_FORMAT=REDUNDANT.
-The newer row formats, COMPRESSED and DYNAMIC, use a file format > Antelope
-so they should have a file format number plus the DICT_TF_COMPACT bit set.
-@param[in] flags Tablespace flags
-@return true if valid, false if not */
-bool
-fsp_flags_is_valid(
- ulint flags)
-{
- bool post_antelope = FSP_FLAGS_GET_POST_ANTELOPE(flags);
- ulint zip_ssize = FSP_FLAGS_GET_ZIP_SSIZE(flags);
- bool atomic_blobs = FSP_FLAGS_HAS_ATOMIC_BLOBS(flags);
- ulint page_ssize = FSP_FLAGS_GET_PAGE_SSIZE(flags);
- bool has_data_dir = FSP_FLAGS_HAS_DATA_DIR(flags);
- bool is_shared = FSP_FLAGS_GET_SHARED(flags);
- bool is_temp = FSP_FLAGS_GET_TEMPORARY(flags);
- bool is_encryption = FSP_FLAGS_GET_ENCRYPTION(flags);
- ulint unused = FSP_FLAGS_GET_UNUSED(flags);
- bool page_compression = FSP_FLAGS_GET_PAGE_COMPRESSION(flags);
- ulint page_compression_level = FSP_FLAGS_GET_PAGE_COMPRESSION_LEVEL(flags);
-
- const char *file;
- ulint line;
-
-#define GOTO_ERROR file = __FILE__; line = __LINE__; goto err_exit;
-
- DBUG_EXECUTE_IF("fsp_flags_is_valid_failure", return(false););
-
- /* The Antelope row formats REDUNDANT and COMPACT did
- not use tablespace flags, so the entire 4-byte field
- is zero for Antelope row formats. */
- if (flags == 0) {
- return(true);
- }
-
- /* Barracuda row formats COMPRESSED and DYNAMIC use a feature called
- ATOMIC_BLOBS which builds on the page structure introduced for the
- COMPACT row format by allowing long fields to be broken into prefix
- and externally stored parts. So if it is Post_antelope, it uses
- Atomic BLOBs. */
- if (post_antelope != atomic_blobs) {
- GOTO_ERROR;
- return(false);
- }
-
- /* Make sure there are no bits that we do not know about. */
- if (unused != 0) {
- GOTO_ERROR;
- }
-
- /* The zip ssize can be zero if it is other than compressed row format,
- or it could be from 1 to the max. */
- if (zip_ssize > PAGE_ZIP_SSIZE_MAX) {
- GOTO_ERROR;
- }
-
- /* The actual page size must be within 4k and 16K (3 =< ssize =< 5). */
- if (page_ssize != 0
- && (page_ssize < UNIV_PAGE_SSIZE_MIN
- || page_ssize > UNIV_PAGE_SSIZE_MAX)) {
- GOTO_ERROR;
- }
-
- /* Only single-table tablespaces use the DATA DIRECTORY clause.
- It is not compatible with the TABLESPACE clause. Nor is it
- compatible with the TEMPORARY clause. */
- if (has_data_dir && (is_shared || is_temp)) {
- GOTO_ERROR;
- return(false);
- }
-
- /* Only single-table and not temp tablespaces use the encryption
- clause. */
- if (is_encryption && (is_shared || is_temp)) {
- GOTO_ERROR;
- }
-
- /* Page compression level requires page compression and atomic blobs
- to be set */
- if (page_compression_level || page_compression) {
- if (!page_compression || !atomic_blobs) {
- GOTO_ERROR;
- }
- }
-
-#if UNIV_FORMAT_MAX != UNIV_FORMAT_B
-# error UNIV_FORMAT_MAX != UNIV_FORMAT_B, Add more validations.
-#endif
-#if FSP_FLAGS_POS_UNUSED != 13
- //# error You have added a new FSP_FLAG without adding a validation check.
-#endif
-
- return(true);
-
-err_exit:
- ib::error() << "Tablespace flags: " << flags << " corrupted "
- << " in file: " << file << " line: " << line
- << " post_antelope: " << post_antelope
- << " atomic_blobs: " << atomic_blobs
- << " unused: " << unused
- << " zip_ssize: " << zip_ssize << " max: " << PAGE_ZIP_SSIZE_MAX
- << " page_ssize: " << page_ssize
- << " " << UNIV_PAGE_SSIZE_MIN << ":" << UNIV_PAGE_SSIZE_MAX
- << " has_data_dir: " << has_data_dir
- << " is_shared: " << is_shared
- << " is_temp: " << is_temp
- << " is_encryption: " << is_encryption
- << " page_compressed: " << page_compression
- << " page_compression_level: " << page_compression_level;
- return (false);
-}
-
/** Check if checksum is disabled for the given space.
@param[in] space_id tablespace ID
@return true if checksum is disabled for given space. */
@@ -336,19 +191,6 @@ fsp_is_checksum_disabled(
return(fsp_is_system_temporary(space_id));
}
-/** Check if tablespace is file-per-table.
-@param[in] space_id tablespace ID
-@param[in] fsp_flags tablespace flags
-@return true if tablespace is file-per-table. */
-bool
-fsp_is_file_per_table(
- ulint space_id,
- ulint fsp_flags)
-{
- return(!is_system_tablespace(space_id)
- && !fsp_is_shared_tablespace(fsp_flags));
-}
-
#ifdef UNIV_DEBUG
/** Skip some of the sanity checks that are time consuming even in debug mode
and can affect frequent verification runs that are done to ensure stability of
@@ -576,7 +418,7 @@ xdes_init(
/** Get pointer to a the extent descriptor of a page.
@param[in,out] sp_header tablespace header page, x-latched
-@param[in] space tablespace identifier
+@param[in] space tablespace
@param[in] offset page offset
@param[in,out] mtr mini-transaction
@param[in] init_space whether the tablespace is being initialized
@@ -587,43 +429,36 @@ exist in the space or if the offset exceeds free limit */
UNIV_INLINE MY_ATTRIBUTE((warn_unused_result))
xdes_t*
xdes_get_descriptor_with_space_hdr(
- fsp_header_t* sp_header,
- ulint space,
- ulint offset,
- mtr_t* mtr,
- bool init_space = false,
- buf_block_t** desc_block = NULL)
+ fsp_header_t* sp_header,
+ const fil_space_t* space,
+ page_no_t offset,
+ mtr_t* mtr,
+ bool init_space = false,
+ buf_block_t** desc_block = NULL)
{
ulint limit;
ulint size;
ulint descr_page_no;
- ulint flags;
page_t* descr_page;
-#ifdef UNIV_DEBUG
- const fil_space_t* fspace = fil_space_get(space);
- ut_ad(fspace != NULL);
-#endif /* UNIV_DEBUG */
- ut_ad(mtr_memo_contains(mtr, &fspace->latch, MTR_MEMO_X_LOCK));
+ 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(page_offset(sp_header) == FSP_HEADER_OFFSET);
/* Read free limit and space size */
limit = mach_read_from_4(sp_header + FSP_FREE_LIMIT);
size = mach_read_from_4(sp_header + FSP_SIZE);
- flags = mach_read_from_4(sp_header + FSP_SPACE_FLAGS);
- ut_ad(limit == fspace->free_limit
- || (fspace->free_limit == 0
+ ut_ad(limit == space->free_limit
+ || (space->free_limit == 0
&& (init_space
- || fspace->purpose == FIL_TYPE_TEMPORARY
+ || space->purpose == FIL_TYPE_TEMPORARY
|| (srv_startup_is_before_trx_rollback_phase
- && fspace->id <= srv_undo_tablespaces))));
- ut_ad(size == fspace->size_in_header);
- ut_ad(flags == fspace->flags);
+ && space->id <= srv_undo_tablespaces))));
+ ut_ad(size == space->size_in_header);
if ((offset >= size) || (offset >= limit)) {
return(NULL);
}
- const page_size_t page_size(flags);
+ const page_size_t page_size(space->flags);
descr_page_no = xdes_calc_descriptor_page(page_size, offset);
@@ -636,7 +471,7 @@ xdes_get_descriptor_with_space_hdr(
block = NULL;
} else {
block = buf_page_get(
- page_id_t(space, descr_page_no), page_size,
+ page_id_t(space->id, descr_page_no), page_size,
RW_SX_LATCH, mtr);
buf_block_dbg_add_level(block, SYNC_FSP_PAGE);
@@ -652,63 +487,60 @@ xdes_get_descriptor_with_space_hdr(
+ XDES_SIZE * xdes_calc_descriptor_index(page_size, offset));
}
-/** Gets pointer to a the extent descriptor of a page.
-The page where the extent descriptor resides is x-locked. If the page offset
-is equal to the free limit of the space, adds new extents from above the free
-limit to the space free list, if not free limit == space size. This adding
-is necessary to make the descriptor defined, as they are uninitialized
-above the free limit.
-@param[in] space_id space id
+/** Get the extent descriptor of a page.
+The page where the extent descriptor resides is x-locked. If the page
+offset is equal to the free limit of the space, we will add new
+extents from above the free limit to the space free list, if not free
+limit == space size. This adding is necessary to make the descriptor
+defined, as they are uninitialized above the free limit.
+@param[in] space tablespace
@param[in] offset page offset; if equal to the free limit, we
try to add new extents to the space free list
@param[in] page_size page size
@param[in,out] mtr mini-transaction
-@return pointer to the extent descriptor, NULL if the page does not
-exist in the space or if the offset exceeds the free limit */
+@return the extent descriptor */
+static
xdes_t*
xdes_get_descriptor(
- ulint space_id,
- ulint offset,
+ const fil_space_t* space,
+ page_no_t offset,
const page_size_t& page_size,
mtr_t* mtr)
{
buf_block_t* block;
fsp_header_t* sp_header;
- block = buf_page_get(page_id_t(space_id, 0), page_size,
+ block = buf_page_get(page_id_t(space->id, 0), page_size,
RW_SX_LATCH, mtr);
buf_block_dbg_add_level(block, SYNC_FSP_PAGE);
sp_header = FSP_HEADER_OFFSET + buf_block_get_frame(block);
- return(xdes_get_descriptor_with_space_hdr(sp_header, space_id, offset,
- mtr));
+ return(xdes_get_descriptor_with_space_hdr(
+ sp_header, space, offset, mtr));
}
-/********************************************************************//**
-Gets pointer to a the extent descriptor if the file address
-of the descriptor list node is known. The page where the
+/** Get a pointer to the extent descriptor. The page where the
extent descriptor resides is x-locked.
+@param[in] space tablespace
+@param[in] page_size page size
+@param[in] lst_node file address of the list node
+ contained in the descriptor
+@param[in,out] mtr mini-transaction
@return pointer to the extent descriptor */
+MY_ATTRIBUTE((nonnull, warn_unused_result))
UNIV_INLINE
xdes_t*
xdes_lst_get_descriptor(
-/*====================*/
- ulint space, /*!< in: space id */
+ const fil_space_t* space,
const page_size_t& page_size,
- fil_addr_t lst_node,/*!< in: file address of the list node
- contained in the descriptor */
- mtr_t* mtr) /*!< in/out: mini-transaction */
+ fil_addr_t lst_node,
+ mtr_t* mtr)
{
- xdes_t* descr;
-
- ut_ad(mtr);
- ut_ad(mtr_memo_contains(mtr, fil_space_get_latch(space, NULL),
- MTR_MEMO_X_LOCK));
- descr = fut_get_ptr(space, page_size, lst_node, RW_SX_LATCH, mtr)
- - XDES_FLST_NODE;
-
- return(descr);
+ ut_ad(mtr_memo_contains(mtr, &space->latch, MTR_MEMO_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);
}
/********************************************************************//**
@@ -763,30 +595,28 @@ updating an allocation bitmap page.
static
void
fsp_space_modify_check(
- ulint id,
- const mtr_t* mtr)
+ const fil_space_t* space,
+ const mtr_t* mtr)
{
switch (mtr->get_log_mode()) {
case MTR_LOG_SHORT_INSERTS:
case MTR_LOG_NONE:
/* These modes are only allowed within a non-bitmap page
when there is a higher-level redo log record written. */
+ ut_ad(space->purpose == FIL_TYPE_TABLESPACE
+ || space->purpose == FIL_TYPE_TEMPORARY);
break;
case MTR_LOG_NO_REDO:
- {
- const fil_type_t type = fil_space_get_type(id);
- ut_a(srv_is_tablespace_truncated(id)
- || fil_space_is_being_truncated(id)
- || fil_space_get_flags(id) == ULINT_UNDEFINED
- || type == FIL_TYPE_TEMPORARY
- || type == FIL_TYPE_IMPORT
- || fil_space_is_redo_skipped(id));
- }
+ ut_ad(space->purpose == FIL_TYPE_TEMPORARY
+ || space->purpose == FIL_TYPE_IMPORT
+ || space->redo_skipped_count
+ || space->is_being_truncated
+ || srv_is_tablespace_truncated(space->id));
return;
case MTR_LOG_ALL:
/* We may only write redo log for a persistent tablespace. */
- ut_ad(fil_space_get_type(id) == FIL_TYPE_TABLESPACE);
- ut_ad(mtr->is_named_space(id));
+ ut_ad(space->purpose == FIL_TYPE_TABLESPACE);
+ ut_ad(mtr->is_named_space(space->id));
return;
}
@@ -795,17 +625,21 @@ fsp_space_modify_check(
#endif /* UNIV_DEBUG */
/** Initialize a file page.
+@param[in] space tablespace
@param[in,out] block file page
@param[in,out] mtr mini-transaction */
+MY_ATTRIBUTE((nonnull))
static
void
fsp_init_file_page(
- buf_block_t* block,
- mtr_t* mtr)
+ const fil_space_t* space MY_ATTRIBUTE((unused)),
+ buf_block_t* block,
+ mtr_t* mtr)
{
+ ut_d(fsp_space_modify_check(space, mtr));
+ ut_ad(space->id == block->page.id.space());
fsp_init_file_page_low(block);
- ut_d(fsp_space_modify_check(block->page.id.space(), mtr));
mlog_write_initial_log_record(buf_block_get_frame(block),
MLOG_INIT_FILE_PAGE2, mtr);
}
@@ -861,6 +695,7 @@ fsp_header_init_fields(
ulint space_id, /*!< in: space id */
ulint flags) /*!< in: tablespace flags (FSP_SPACE_FLAGS) */
{
+ flags &= ~FSP_FLAGS_MEM_MASK;
ut_a(fsp_flags_is_valid(flags));
mach_write_to_4(FSP_HEADER_OFFSET + FSP_SPACE_ID + page,
@@ -869,178 +704,6 @@ fsp_header_init_fields(
flags);
}
-#if 0 /* MySQL 5.7 Encryption */
-/** Fill the encryption info.
-@param[in] space tablespace
-@param[in,out] encrypt_info buffer for encrypt key.
-@return true if success. */
-bool
-fsp_header_fill_encryption_info(
- fil_space_t* space,
- byte* encrypt_info)
-{
- byte* ptr;
- lint elen;
- ulint master_key_id;
- byte* master_key;
- byte key_info[ENCRYPTION_KEY_LEN * 2];
- ulint crc;
- Encryption::Version version;
-#ifdef UNIV_ENCRYPT_DEBUG
- const byte* data;
- ulint i;
-#endif
-
- /* Get master key from key ring */
- Encryption::get_master_key(&master_key_id, &master_key, &version);
- if (master_key == NULL) {
- return(false);
- }
-
- memset(encrypt_info, 0, ENCRYPTION_INFO_SIZE_V2);
- memset(key_info, 0, ENCRYPTION_KEY_LEN * 2);
-
- /* Use the new master key to encrypt the tablespace
- key. */
- ut_ad(encrypt_info != NULL);
- ptr = encrypt_info;
-
- /* Write magic header. */
- if (version == Encryption::ENCRYPTION_VERSION_1) {
- memcpy(ptr, ENCRYPTION_KEY_MAGIC_V1, ENCRYPTION_MAGIC_SIZE);
- } else {
- memcpy(ptr, ENCRYPTION_KEY_MAGIC_V2, ENCRYPTION_MAGIC_SIZE);
- }
- ptr += ENCRYPTION_MAGIC_SIZE;
-
- /* Write master key id. */
- mach_write_to_4(ptr, master_key_id);
- ptr += sizeof(ulint);
-
- /* Write server uuid. */
- if (version == Encryption::ENCRYPTION_VERSION_2) {
- memcpy(ptr, Encryption::uuid, ENCRYPTION_SERVER_UUID_LEN);
- ptr += ENCRYPTION_SERVER_UUID_LEN;
- }
-
- /* Write tablespace key to temp space. */
- memcpy(key_info,
- space->encryption_key,
- ENCRYPTION_KEY_LEN);
-
- /* Write tablespace iv to temp space. */
- memcpy(key_info + ENCRYPTION_KEY_LEN,
- space->encryption_iv,
- ENCRYPTION_KEY_LEN);
-
-#ifdef UNIV_ENCRYPT_DEBUG
- fprintf(stderr, "Set %lu:%lu ",space->id,
- Encryption::master_key_id);
- for (data = (const byte*) master_key, i = 0;
- i < ENCRYPTION_KEY_LEN; i++)
- fprintf(stderr, "%02lx", (ulong)*data++);
- fprintf(stderr, " ");
- for (data = (const byte*) space->encryption_key,
- i = 0; i < ENCRYPTION_KEY_LEN; i++)
- fprintf(stderr, "%02lx", (ulong)*data++);
- fprintf(stderr, " ");
- for (data = (const byte*) space->encryption_iv,
- i = 0; i < ENCRYPTION_KEY_LEN; i++)
- fprintf(stderr, "%02lx", (ulong)*data++);
- fprintf(stderr, "\n");
-#endif
- /* Encrypt tablespace key and iv. */
- elen = my_aes_encrypt(
- key_info,
- ENCRYPTION_KEY_LEN * 2,
- ptr,
- master_key,
- ENCRYPTION_KEY_LEN,
- my_aes_256_ecb,
- NULL, false);
-
- if (elen == MY_AES_BAD_DATA) {
- my_free(master_key);
- return(false);
- }
-
- ptr += ENCRYPTION_KEY_LEN * 2;
-
- /* Write checksum bytes. */
- crc = ut_crc32(key_info, ENCRYPTION_KEY_LEN * 2);
- mach_write_to_4(ptr, crc);
-
- my_free(master_key);
- return(true);
-}
-#endif /* ! */
-
-/** Rotate the encryption info in the space header.
-@param[in] space tablespace
-@param[in] encrypt_info buffer for re-encrypt key.
-@param[in,out] mtr mini-transaction
-@return true if success. */
-bool
-fsp_header_rotate_encryption(
- fil_space_t* space,
- byte* encrypt_info,
- mtr_t* mtr)
-{
- buf_block_t* block;
- ulint offset;
-
- ut_ad(mtr);
-
- const page_size_t page_size(space->flags);
-
-#if MYSQL_ENCRYPTION
- page_t* page;
- ulint master_key_id;
- ut_ad(space->encryption_type != Encryption::NONE);
- /* Fill encryption info. */
- if (!fsp_header_fill_encryption_info(space,
- encrypt_info)) {
- return(false);
- }
-#endif
-
- /* Save the encryption info to the page 0. */
- block = buf_page_get(page_id_t(space->id, 0),
- page_size,
- RW_SX_LATCH, mtr);
- buf_block_dbg_add_level(block, SYNC_FSP_PAGE);
- ut_ad(space->id == page_get_space_id(buf_block_get_frame(block)));
-
- offset = fsp_header_get_encryption_offset(page_size);
- ut_ad(offset != 0 && offset < UNIV_PAGE_SIZE);
-
-
-#if MYSQL_ENCRYPTION
- page = buf_block_get_frame(block);
- /* If is in recovering, skip all master key id is rotated
- tablespaces. */
- master_key_id = mach_read_from_4(
- page + offset + ENCRYPTION_MAGIC_SIZE);
- if (recv_recovery_is_on()
- && master_key_id == Encryption::master_key_id) {
- ut_ad(memcmp(page + offset,
- ENCRYPTION_KEY_MAGIC_V1,
- ENCRYPTION_MAGIC_SIZE) == 0
- || memcmp(page + offset,
- ENCRYPTION_KEY_MAGIC_V2,
- ENCRYPTION_MAGIC_SIZE) == 0);
- return(true);
- }
-
- mlog_write_string(page + offset,
- encrypt_info,
- ENCRYPTION_INFO_SIZE_V2,
- mtr);
-#endif /* MYSQL_ENCRYPTION */
-
- return(true);
-}
-
/** Initializes the space header of a new created space and creates also the
insert buffer tree root if space == 0.
@param[in] space_id space id
@@ -1074,7 +737,7 @@ fsp_header_init(
/* The prior contents of the file page should be ignored */
- fsp_init_file_page(block, mtr);
+ fsp_init_file_page(space, block, mtr);
page = buf_block_get_frame(block);
mlog_write_ulint(page + FIL_PAGE_TYPE, FIL_PAGE_TYPE_FSP_HDR,
@@ -1087,7 +750,8 @@ fsp_header_init(
mlog_write_ulint(header + FSP_SIZE, size, MLOG_4BYTES, mtr);
mlog_write_ulint(header + FSP_FREE_LIMIT, 0, MLOG_4BYTES, mtr);
- mlog_write_ulint(header + FSP_SPACE_FLAGS, space->flags,
+ mlog_write_ulint(header + FSP_SPACE_FLAGS,
+ space->flags & ~FSP_FLAGS_MEM_MASK,
MLOG_4BYTES, mtr);
mlog_write_ulint(header + FSP_FRAG_N_USED, 0, MLOG_4BYTES, mtr);
@@ -1102,31 +766,6 @@ fsp_header_init(
fsp_fill_free_list(!is_system_tablespace(space_id),
space, header, mtr);
-#if 0 /* MySQL 5.7 Encryption */
- /* For encryption tablespace, we need to save the encryption
- info to the page 0. */
- if (FSP_FLAGS_GET_ENCRYPTION(space->flags)) {
- ulint offset = fsp_header_get_encryption_offset(page_size);
- byte encryption_info[ENCRYPTION_INFO_SIZE_V2];
-
- if (offset == 0)
- return(false);
-
- if (!fsp_header_fill_encryption_info(space,
- encryption_info)) {
- space->encryption_type = Encryption::NONE;
- memset(space->encryption_key, 0, ENCRYPTION_KEY_LEN);
- memset(space->encryption_iv, 0, ENCRYPTION_KEY_LEN);
- return(false);
- }
-
- mlog_write_string(page + offset,
- encryption_info,
- ENCRYPTION_INFO_SIZE_V2,
- mtr);
- }
-#endif /* ! */
-
if (space_id == srv_sys_space.space_id()) {
if (btr_create(DICT_CLUSTERED | DICT_UNIVERSAL | DICT_IBUF,
0, univ_page_size, DICT_IBUF_ID_MIN + space_id,
@@ -1171,174 +810,6 @@ fsp_header_get_space_id(
return(id);
}
-/** Reads the page size from the first page of a tablespace.
-@param[in] page first page of a tablespace
-@return page size */
-page_size_t
-fsp_header_get_page_size(
- const page_t* page)
-{
- return(page_size_t(fsp_header_get_flags(page)));
-}
-
-#if 0 /* MySQL 5.7 Encryption */
-/** Decoding the encryption info
-from the first page of a tablespace.
-@param[in/out] key key
-@param[in/out] iv iv
-@param[in] encryption_info encrytion info.
-@return true if success */
-bool
-fsp_header_decode_encryption_info(
- byte* key,
- byte* iv,
- byte* encryption_info)
-{
- byte* ptr;
- ulint master_key_id;
- byte* master_key = NULL;
- lint elen;
- byte key_info[ENCRYPTION_KEY_LEN * 2];
- ulint crc1;
- ulint crc2;
- char srv_uuid[ENCRYPTION_SERVER_UUID_LEN + 1];
- Encryption::Version version;
-#ifdef UNIV_ENCRYPT_DEBUG
- const byte* data;
- ulint i;
-#endif
-
- ptr = encryption_info;
-
- /* For compatibility with 5.7.11, we need to handle the
- encryption information which created in this old version. */
- if (memcmp(ptr, ENCRYPTION_KEY_MAGIC_V1,
- ENCRYPTION_MAGIC_SIZE) == 0) {
- version = Encryption::ENCRYPTION_VERSION_1;
- } else {
- version = Encryption::ENCRYPTION_VERSION_2;
- }
- /* Check magic. */
- if (version == Encryption::ENCRYPTION_VERSION_2
- && memcmp(ptr, ENCRYPTION_KEY_MAGIC_V2, ENCRYPTION_MAGIC_SIZE) != 0) {
- /* We ignore report error for recovery,
- since the encryption info maybe hasn't writen
- into datafile when the table is newly created. */
- if (!recv_recovery_is_on()) {
- return(false);
- } else {
- return(true);
- }
- }
- ptr += ENCRYPTION_MAGIC_SIZE;
-
- /* Get master key id. */
- master_key_id = mach_read_from_4(ptr);
- ptr += sizeof(ulint);
-
- /* Get server uuid. */
- if (version == Encryption::ENCRYPTION_VERSION_2) {
- memset(srv_uuid, 0, ENCRYPTION_SERVER_UUID_LEN + 1);
- memcpy(srv_uuid, ptr, ENCRYPTION_SERVER_UUID_LEN);
- ptr += ENCRYPTION_SERVER_UUID_LEN;
- }
-
- /* Get master key by key id. */
- memset(key_info, 0, ENCRYPTION_KEY_LEN * 2);
- if (version == Encryption::ENCRYPTION_VERSION_1) {
- Encryption::get_master_key(master_key_id, NULL, &master_key);
- } else {
- Encryption::get_master_key(master_key_id, srv_uuid, &master_key);
- }
- if (master_key == NULL) {
- return(false);
- }
-
-#ifdef UNIV_ENCRYPT_DEBUG
- fprintf(stderr, "%lu ", master_key_id);
- for (data = (const byte*) master_key, i = 0;
- i < ENCRYPTION_KEY_LEN; i++)
- fprintf(stderr, "%02lx", (ulong)*data++);
-#endif
-
- /* Decrypt tablespace key and iv. */
- elen = my_aes_decrypt(
- ptr,
- ENCRYPTION_KEY_LEN * 2,
- key_info,
- master_key,
- ENCRYPTION_KEY_LEN,
- my_aes_256_ecb, NULL, false);
-
- if (elen == MY_AES_BAD_DATA) {
- my_free(master_key);
- return(NULL);
- }
-
- /* Check checksum bytes. */
- ptr += ENCRYPTION_KEY_LEN * 2;
-
- crc1 = mach_read_from_4(ptr);
- crc2 = ut_crc32(key_info, ENCRYPTION_KEY_LEN * 2);
- if (crc1 != crc2) {
- ib::error() << "Failed to decrpt encryption information,"
- << " please check key file is not changed!";
- return(false);
- }
-
- /* Get tablespace key */
- memcpy(key, key_info, ENCRYPTION_KEY_LEN);
-
- /* Get tablespace iv */
- memcpy(iv, key_info + ENCRYPTION_KEY_LEN,
- ENCRYPTION_KEY_LEN);
-
-#ifdef UNIV_ENCRYPT_DEBUG
- fprintf(stderr, " ");
- for (data = (const byte*) key,
- i = 0; i < ENCRYPTION_KEY_LEN; i++)
- fprintf(stderr, "%02lx", (ulong)*data++);
- fprintf(stderr, " ");
- for (data = (const byte*) iv,
- i = 0; i < ENCRYPTION_KEY_LEN; i++)
- fprintf(stderr, "%02lx", (ulong)*data++);
- fprintf(stderr, "\n");
-#endif
-
- my_free(master_key);
-
- if (Encryption::master_key_id < master_key_id) {
- Encryption::master_key_id = master_key_id;
- memcpy(Encryption::uuid, srv_uuid, ENCRYPTION_SERVER_UUID_LEN);
- }
-
- return(true);
-}
-
-/** Reads the encryption key from the first page of a tablespace.
-@param[in] fsp_flags tablespace flags
-@param[in/out] key tablespace key
-@param[in/out] iv tablespace iv
-@param[in] page first page of a tablespace
-@return true if success */
-bool
-fsp_header_get_encryption_key(
- ulint fsp_flags,
- byte* key,
- byte* iv,
- page_t* page)
-{
- ulint offset;
- const page_size_t page_size(fsp_flags);
- offset = fsp_header_get_encryption_offset(page_size);
- if (offset == 0) {
- return(false);
- }
-
- return(fsp_header_decode_encryption_info(key, iv, page + offset));
-}
-#endif /* ! */
-
/**********************************************************************//**
Increases the space size field of a space. */
void
@@ -1354,10 +825,10 @@ fsp_header_inc_size(
ut_ad(mtr);
fil_space_t* space = mtr_x_lock_space(space_id, mtr);
- ut_d(fsp_space_modify_check(space_id, mtr));
+ ut_d(fsp_space_modify_check(space, mtr));
header = fsp_get_space_header(
- space_id, page_size_t(space->flags), mtr);
+ space, page_size_t(space->flags), mtr);
size = mach_read_from_4(header + FSP_SIZE);
ut_ad(size == space->size_in_header);
@@ -1384,12 +855,9 @@ fsp_header_get_tablespace_size(void)
mtr_start(&mtr);
-#ifdef UNIV_DEBUG
- fil_space_t* space =
-#endif /* UNIV_DEBUG */
- mtr_x_lock_space(TRX_SYS_SPACE, &mtr);
+ fil_space_t* space = mtr_x_lock_space(TRX_SYS_SPACE, &mtr);
- header = fsp_get_space_header(TRX_SYS_SPACE, univ_page_size, &mtr);
+ header = fsp_get_space_header(space, univ_page_size, &mtr);
size = mach_read_from_4(header + FSP_SIZE);
ut_ad(space->size_in_header == size);
@@ -1418,7 +886,7 @@ fsp_try_extend_data_file_with_pages(
ulint size;
ut_a(!is_system_tablespace(space->id));
- ut_d(fsp_space_modify_check(space->id, mtr));
+ ut_d(fsp_space_modify_check(space, mtr));
size = mach_read_from_4(header + FSP_SIZE);
ut_ad(size == space->size_in_header);
@@ -1452,7 +920,7 @@ fsp_try_extend_data_file(
"ran out of space. Please add another file or use"
" 'autoextend' for the last file in setting";
- ut_d(fsp_space_modify_check(space->id, mtr));
+ ut_d(fsp_space_modify_check(space, mtr));
if (space->id == srv_sys_space.space_id()
&& !srv_sys_space.can_auto_extend_last_file()) {
@@ -1462,8 +930,8 @@ fsp_try_extend_data_file(
to reset the flag to false as dealing with this
error requires server restart. */
if (!srv_sys_space.get_tablespace_full_status()) {
- ib::error() << "Tablespace " << srv_sys_space.name()
- << " " << OUT_OF_SPACE_MSG
+ ib::error() << "The InnoDB system tablespace "
+ << OUT_OF_SPACE_MSG
<< " innodb_data_file_path.";
srv_sys_space.set_tablespace_full_status(true);
}
@@ -1476,8 +944,8 @@ fsp_try_extend_data_file(
to reset the flag to false as dealing with this
error requires server restart. */
if (!srv_tmp_space.get_tablespace_full_status()) {
- ib::error() << "Tablespace " << srv_tmp_space.name()
- << " " << OUT_OF_SPACE_MSG
+ ib::error() << "The InnoDB temporary tablespace "
+ << OUT_OF_SPACE_MSG
<< " innodb_temp_data_file_path.";
srv_tmp_space.set_tablespace_full_status(true);
}
@@ -1537,7 +1005,7 @@ fsp_try_extend_data_file(
}
/** Calculate the number of pages to extend a datafile.
-We extend single-table and general tablespaces first one extent at a time,
+We extend single-table tablespaces first one extent at a time,
but 4 at a time for bigger tablespaces. It is not enough to extend always
by one extent, because we need to add at least one extent to FSP_FREE.
A single extent descriptor page will track many extents. And the extent
@@ -1596,7 +1064,6 @@ fsp_fill_free_list(
{
ulint limit;
ulint size;
- ulint flags;
xdes_t* descr;
ulint count = 0;
ulint frag_n_used;
@@ -1605,18 +1072,16 @@ fsp_fill_free_list(
ut_ad(header != NULL);
ut_ad(mtr != NULL);
ut_ad(page_offset(header) == FSP_HEADER_OFFSET);
- ut_d(fsp_space_modify_check(space->id, mtr));
+ ut_d(fsp_space_modify_check(space, mtr));
/* Check if we can fill free list from above the free list limit */
size = mach_read_from_4(header + FSP_SIZE);
limit = mach_read_from_4(header + FSP_FREE_LIMIT);
- flags = mach_read_from_4(header + FSP_SPACE_FLAGS);
ut_ad(size == space->size_in_header);
ut_ad(limit == space->free_limit);
- ut_ad(flags == space->flags);
- const page_size_t page_size(flags);
+ const page_size_t page_size(space->flags);
if (size < limit + FSP_EXTENT_SIZE * FSP_FREE_ADD) {
bool skip_resize = init_space;
@@ -1667,7 +1132,7 @@ fsp_fill_free_list(
buf_block_dbg_add_level(block, SYNC_FSP_PAGE);
- fsp_init_file_page(block, mtr);
+ fsp_init_file_page(space, block, mtr);
mlog_write_ulint(buf_block_get_frame(block)
+ FIL_PAGE_TYPE,
FIL_PAGE_TYPE_XDES,
@@ -1705,7 +1170,7 @@ fsp_fill_free_list(
buf_block_dbg_add_level(block, SYNC_FSP_PAGE);
- fsp_init_file_page(block, &ibuf_mtr);
+ fsp_init_file_page(space, block, &ibuf_mtr);
ibuf_bitmap_page_init(block, &ibuf_mtr);
@@ -1715,7 +1180,7 @@ fsp_fill_free_list(
buf_block_t* desc_block = NULL;
descr = xdes_get_descriptor_with_space_hdr(
- header, space->id, i, mtr, init_space, &desc_block);
+ header, space, i, mtr, init_space, &desc_block);
if (desc_block != NULL) {
fil_block_check_type(
desc_block, FIL_PAGE_TYPE_XDES, mtr);
@@ -1752,7 +1217,7 @@ fsp_fill_free_list(
}
/** Allocates a new free extent.
-@param[in] space_id tablespace identifier
+@param[in,out] space tablespace
@param[in] page_size page size
@param[in] hint hint of which extent would be desirable: any
page offset in the extent goes; the hint must not be > FSP_FREE_LIMIT
@@ -1761,7 +1226,7 @@ page offset in the extent goes; the hint must not be > FSP_FREE_LIMIT
static
xdes_t*
fsp_alloc_free_extent(
- ulint space_id,
+ fil_space_t* space,
const page_size_t& page_size,
ulint hint,
mtr_t* mtr)
@@ -1771,13 +1236,10 @@ fsp_alloc_free_extent(
xdes_t* descr;
buf_block_t* desc_block = NULL;
- header = fsp_get_space_header(space_id, page_size, mtr);
+ header = fsp_get_space_header(space, page_size, mtr);
descr = xdes_get_descriptor_with_space_hdr(
- header, space_id, hint, mtr, false, &desc_block);
-
- fil_space_t* space = fil_space_get(space_id);
- ut_a(space != NULL);
+ header, space, hint, mtr, false, &desc_block);
if (desc_block != NULL) {
fil_block_check_type(desc_block, FIL_PAGE_TYPE_XDES, mtr);
@@ -1801,7 +1263,7 @@ fsp_alloc_free_extent(
}
descr = xdes_lst_get_descriptor(
- space_id, page_size, first, mtr);
+ space, page_size, first, mtr);
}
flst_remove(header + FSP_FREE, descr + XDES_FLST_NODE, mtr);
@@ -1850,7 +1312,8 @@ fsp_alloc_from_free_frag(
NOTE: If init_mtr != mtr, the block will only be initialized if it was
not previously x-latched. It is assumed that the block has been
x-latched only by mtr, and freed in mtr in that case.
-@param[in] page_id page id of the allocated page
+@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
@@ -1860,19 +1323,21 @@ or rw_lock_x_lock_count(&block->lock) == 1 */
static
buf_block_t*
fsp_page_create(
- const page_id_t& page_id,
+ 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)
{
- buf_block_t* block = buf_page_create(page_id, page_size, init_mtr);
+ ut_ad(page_size.equals_to(page_size_t(space->flags)));
- ut_ad(mtr_memo_contains(mtr, block, MTR_MEMO_PAGE_X_FIX)
- == rw_lock_own(&block->lock, RW_LOCK_X));
+ buf_block_t* block = buf_page_create(page_id_t(space->id, offset),
+ page_size, init_mtr);
- ut_ad(mtr_memo_contains(mtr, block, MTR_MEMO_PAGE_SX_FIX)
- == rw_lock_own(&block->lock, RW_LOCK_SX));
+ 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);
@@ -1898,12 +1363,8 @@ fsp_page_create(
/* Initialize the page, unless it was already
SX-latched in mtr. (In this case, we would want to
allocate another page that has not been freed in mtr.) */
- ut_ad(init_mtr == mtr
- || !mtr_memo_contains_flagged(mtr, block,
- MTR_MEMO_PAGE_X_FIX
- | MTR_MEMO_PAGE_SX_FIX));
-
- fsp_init_file_page(block, init_mtr);
+ ut_ad(init_mtr == mtr || !latched);
+ fsp_init_file_page(space, block, init_mtr);
}
return(block);
@@ -1911,7 +1372,7 @@ fsp_page_create(
/** Allocates a single free page from a space.
The page is marked as used.
-@param[in] space space id
+@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
@@ -1925,7 +1386,7 @@ initialized (may be the same as mtr)
static MY_ATTRIBUTE((warn_unused_result))
buf_block_t*
fsp_alloc_free_page(
- ulint space,
+ fil_space_t* space,
const page_size_t& page_size,
ulint hint,
rw_lock_type_t rw_latch,
@@ -1936,8 +1397,7 @@ fsp_alloc_free_page(
fil_addr_t first;
xdes_t* descr;
ulint free;
- ulint page_no;
- ulint space_size;
+ const ulint space_id = space->id;
ut_ad(mtr);
ut_ad(init_mtr);
@@ -1996,18 +1456,18 @@ fsp_alloc_free_page(
ut_error;
}
- page_no = xdes_get_offset(descr) + free;
+ page_no_t page_no = xdes_get_offset(descr) + free;
- space_size = mach_read_from_4(header + FSP_SIZE);
- ut_ad(space_size == fil_space_get(space)->size_in_header
- || (space == TRX_SYS_SPACE
+ page_no_t space_size = mach_read_from_4(header + FSP_SIZE);
+ ut_ad(space_size == space->size_in_header
+ || (space_id == TRX_SYS_SPACE
&& srv_startup_is_before_trx_rollback_phase));
if (space_size <= page_no) {
/* It must be that we are extending a single-table tablespace
whose size is still < 64 pages */
- ut_a(!is_system_tablespace(space));
+ 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"
@@ -2016,9 +1476,7 @@ fsp_alloc_free_page(
return(NULL);
}
- fil_space_t* fspace = fil_space_get(space);
-
- if (!fsp_try_extend_data_file_with_pages(fspace, page_no,
+ if (!fsp_try_extend_data_file_with_pages(space, page_no,
header, mtr)) {
/* No disk space left */
return(NULL);
@@ -2026,19 +1484,21 @@ fsp_alloc_free_page(
}
fsp_alloc_from_free_frag(header, descr, free, mtr);
- return(fsp_page_create(page_id_t(space, page_no), page_size,
- rw_latch, mtr, init_mtr));
+ return(fsp_page_create(space, page_no, page_size, rw_latch,
+ mtr, init_mtr));
}
/** Frees a single page of a space.
The page is marked as free and clean.
+@param[in,out] space tablespace
@param[in] page_id page id
@param[in] page_size page size
@param[in,out] mtr mini-transaction */
static
void
fsp_free_page(
- const page_id_t& page_id,
+ fil_space_t* space,
+ ulint offset,
const page_size_t& page_size,
mtr_t* mtr)
{
@@ -2048,24 +1508,22 @@ fsp_free_page(
ulint frag_n_used;
ut_ad(mtr);
- ut_d(fsp_space_modify_check(page_id.space(), mtr));
+ ut_d(fsp_space_modify_check(space, mtr));
/* fprintf(stderr, "Freeing page %lu in space %lu\n", page, space); */
- header = fsp_get_space_header(
- page_id.space(), page_size, mtr);
+ header = fsp_get_space_header(space, page_size, mtr);
descr = xdes_get_descriptor_with_space_hdr(
- header, page_id.space(), page_id.page_no(), mtr);
+ header, space, offset, mtr);
state = xdes_get_state(descr, mtr);
- if (state != XDES_FREE_FRAG && state != XDES_FULL_FRAG) {
+ if (UNIV_UNLIKELY(state != XDES_FREE_FRAG
+ && state != XDES_FULL_FRAG)) {
ib::error() << "File space extent descriptor of page "
- << page_id << " has state " << state;
- fputs("InnoDB: Dump of descriptor: ", stderr);
- ut_print_buf(stderr, ((byte*) descr) - 50, 200);
- putc('\n', stderr);
+ << page_id_t(space->id, offset)
+ << " has state " << state;
/* Crash in debug version, so that we get a core dump
of this corruption. */
ut_ad(0);
@@ -2081,12 +1539,11 @@ fsp_free_page(
}
if (xdes_mtr_get_bit(descr, XDES_FREE_BIT,
- page_id.page_no() % FSP_EXTENT_SIZE, mtr)) {
+ offset % FSP_EXTENT_SIZE, mtr)) {
ib::error() << "File space extent descriptor of page "
- << page_id << " says it is free. Dump of descriptor: ";
- ut_print_buf(stderr, ((byte*) descr) - 50, 200);
- putc('\n', stderr);
+ << page_id_t(space->id, offset)
+ << " says it is free.";
/* Crash in debug version, so that we get a core dump
of this corruption. */
ut_ad(0);
@@ -2097,7 +1554,7 @@ fsp_free_page(
return;
}
- const ulint bit = page_id.page_no() % FSP_EXTENT_SIZE;
+ const ulint bit = offset % FSP_EXTENT_SIZE;
xdes_set_bit(descr, XDES_FREE_BIT, bit, TRUE, mtr);
xdes_set_bit(descr, XDES_CLEAN_BIT, bit, TRUE, mtr);
@@ -2124,37 +1581,39 @@ fsp_free_page(
/* The extent has become free: move it to another list */
flst_remove(header + FSP_FREE_FRAG, descr + XDES_FLST_NODE,
mtr);
- fsp_free_extent(page_id, page_size, mtr);
+ fsp_free_extent(space, offset, page_size, mtr);
}
}
-/** Returns an extent to the free list of a space.
-@param[in] page_id page id in the extent
+/** Return an extent to the free list of a space.
+@param[in,out] space tablespace
+@param[in] offset page number in the extent
@param[in] page_size page size
@param[in,out] mtr mini-transaction */
static
void
fsp_free_extent(
- const page_id_t& page_id,
+ fil_space_t* space,
+ page_no_t offset,
const page_size_t& page_size,
mtr_t* mtr)
{
fsp_header_t* header;
xdes_t* descr;
- ut_ad(mtr);
+ ut_ad(mtr_memo_contains(mtr, &space->latch, MTR_MEMO_X_LOCK));
- header = fsp_get_space_header(page_id.space(), page_size, mtr);
+ header = fsp_get_space_header(space, page_size, mtr);
descr = xdes_get_descriptor_with_space_hdr(
- header, page_id.space(), page_id.page_no(), mtr);
+ header, space, offset, mtr);
ut_a(xdes_get_state(descr, mtr) != XDES_FREE);
xdes_init(descr, mtr);
flst_add_last(header + FSP_FREE, descr + XDES_FLST_NODE, mtr);
- fil_space_get(page_id.space())->free_len++;
+ space->free_len++;
}
/** Returns the nth inode slot on an inode page.
@@ -2242,33 +1701,34 @@ fsp_seg_inode_page_find_free(
return(ULINT_UNDEFINED);
}
-/**********************************************************************//**
-Allocates a new file segment inode page.
-@return TRUE if could be allocated */
+/** Allocate a file segment inode page.
+@param[in,out] space tablespace
+@param[in,out] space_header tablespace header
+@param[in,out] mtr mini-transaction
+@return whether the allocation succeeded */
+MY_ATTRIBUTE((nonnull, warn_unused_result))
static
-ibool
+bool
fsp_alloc_seg_inode_page(
-/*=====================*/
- fsp_header_t* space_header, /*!< in: space header */
- mtr_t* mtr) /*!< in/out: mini-transaction */
+ fil_space_t* space,
+ fsp_header_t* space_header,
+ mtr_t* mtr)
{
fseg_inode_t* inode;
buf_block_t* block;
page_t* page;
- ulint space;
ut_ad(page_offset(space_header) == FSP_HEADER_OFFSET);
+ ut_ad(page_get_space_id(page_align(space_header)) == space->id);
- space = page_get_space_id(page_align(space_header));
-
- const page_size_t page_size(mach_read_from_4(FSP_SPACE_FLAGS
- + space_header));
+ 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, RW_SX_LATCH, mtr, mtr);
if (block == NULL) {
- return(FALSE);
+ return(false);
}
buf_block_dbg_add_level(block, SYNC_FSP_PAGE);
@@ -2291,18 +1751,22 @@ fsp_alloc_seg_inode_page(
space_header + FSP_SEG_INODES_FREE,
page + FSEG_INODE_PAGE_NODE, mtr);
- return(TRUE);
+ return(true);
}
-/**********************************************************************//**
-Allocates a new file segment inode.
-@return segment inode, or NULL if not enough space */
+/** Allocate a file segment inode.
+@param[in,out] space tablespace
+@param[in,out] space_header tablespace header
+@param[in,out] mtr mini-transaction
+@return segment inode
+@retval NULL if not enough space */
+MY_ATTRIBUTE((nonnull, warn_unused_result))
static
fseg_inode_t*
fsp_alloc_seg_inode(
-/*================*/
- fsp_header_t* space_header, /*!< in: space header */
- mtr_t* mtr) /*!< in/out: mini-transaction */
+ fil_space_t* space,
+ fsp_header_t* space_header,
+ mtr_t* mtr)
{
buf_block_t* block;
page_t* page;
@@ -2313,14 +1777,12 @@ fsp_alloc_seg_inode(
/* Allocate a new segment inode page if needed. */
if (flst_get_len(space_header + FSP_SEG_INODES_FREE) == 0
- && !fsp_alloc_seg_inode_page(space_header, mtr)) {
+ && !fsp_alloc_seg_inode_page(space, space_header, mtr)) {
return(NULL);
}
- const page_size_t page_size(
- mach_read_from_4(FSP_SPACE_FLAGS + space_header));
-
+ const page_size_t page_size(space->flags);
const page_id_t page_id(
- page_get_space_id(page_align(space_header)),
+ space->id,
flst_get_first(space_header + FSP_SEG_INODES_FREE, mtr).page);
block = buf_page_get(page_id, page_size, RW_SX_LATCH, mtr);
@@ -2353,14 +1815,14 @@ fsp_alloc_seg_inode(
}
/** Frees a file segment inode.
-@param[in] space space id
+@param[in,out] space tablespace
@param[in] page_size page size
@param[in,out] inode segment inode
@param[in,out] mtr mini-transaction */
static
void
fsp_free_seg_inode(
- ulint space,
+ fil_space_t* space,
const page_size_t& page_size,
fseg_inode_t* inode,
mtr_t* mtr)
@@ -2399,8 +1861,7 @@ fsp_free_seg_inode(
flst_remove(space_header + FSP_SEG_INODES_FREE,
page + FSEG_INODE_PAGE_NODE, mtr);
- fsp_free_page(page_id_t(space, page_get_page_no(page)),
- page_size, mtr);
+ fsp_free_page(space, page_get_page_no(page), page_size, mtr);
}
}
@@ -2617,10 +2078,10 @@ fseg_create_general(
ut_ad(mtr);
ut_ad(byte_offset + FSEG_HEADER_SIZE
<= UNIV_PAGE_SIZE - FIL_PAGE_DATA_END);
- ut_d(fsp_space_modify_check(space_id, mtr));
fil_space_t* space = mtr_x_lock_space(space_id, mtr);
const page_size_t page_size(space->flags);
+ ut_d(fsp_space_modify_check(space, mtr));
if (page != 0) {
block = buf_page_get(page_id_t(space_id, page), page_size,
@@ -2651,9 +2112,9 @@ fseg_create_general(
DBUG_RETURN(NULL);
}
- space_header = fsp_get_space_header(space_id, page_size, mtr);
+ space_header = fsp_get_space_header(space, page_size, mtr);
- inode = fsp_alloc_seg_inode(space_header, mtr);
+ inode = fsp_alloc_seg_inode(space, space_header, mtr);
if (inode == NULL) {
@@ -2695,7 +2156,7 @@ fseg_create_general(
if (block == NULL) {
- fsp_free_seg_inode(space_id, page_size, inode, mtr);
+ fsp_free_seg_inode(space, page_size, inode, mtr);
goto funct_exit;
}
@@ -2807,7 +2268,7 @@ This happens if the segment is big enough to allow extents in the free list,
the free list is empty, and the extents can be allocated consecutively from
the hint onward.
@param[in] inode segment inode
-@param[in] space space id
+@param[in] space tablespace
@param[in] page_size page size
@param[in] hint hint which extent would be good as the first
extent
@@ -2816,7 +2277,7 @@ static
void
fseg_fill_free_list(
fseg_inode_t* inode,
- ulint space,
+ fil_space_t* space,
const page_size_t& page_size,
ulint hint,
mtr_t* mtr)
@@ -2876,7 +2337,7 @@ the segment, then tries to allocate from the space free list.
NOTE that the extent returned still resides in the segment free list, it is
not yet taken off it!
@param[in] inode segment inode
-@param[in] space space id
+@param[in,out] space tablespace
@param[in] page_size page size
@param[in,out] mtr mini-transaction
@retval NULL if no page could be allocated
@@ -2887,7 +2348,7 @@ static
xdes_t*
fseg_alloc_free_extent(
fseg_inode_t* inode,
- ulint space,
+ fil_space_t* space,
const page_size_t& page_size,
mtr_t* mtr)
{
@@ -2987,21 +2448,21 @@ fseg_alloc_free_page_low(
seg_id = mach_read_from_8(seg_inode + FSEG_ID);
ut_ad(seg_id);
- ut_d(fsp_space_modify_check(space_id, mtr));
+ ut_d(fsp_space_modify_check(space, mtr));
ut_ad(fil_page_get_type(page_align(seg_inode)) == FIL_PAGE_INODE);
reserved = fseg_n_reserved_pages_low(seg_inode, &used, mtr);
- space_header = fsp_get_space_header(space_id, page_size, mtr);
+ space_header = fsp_get_space_header(space, page_size, mtr);
- descr = xdes_get_descriptor_with_space_hdr(space_header, space_id,
+ descr = xdes_get_descriptor_with_space_hdr(space_header, space,
hint, mtr);
if (descr == NULL) {
/* Hint outside space or too high above free limit: reset
hint */
/* The file space header page is always allocated. */
hint = 0;
- descr = xdes_get_descriptor(space_id, hint, page_size, mtr);
+ descr = xdes_get_descriptor(space, hint, page_size, mtr);
}
/* In the big if-else below we look for ret_page and ret_descr */
@@ -3028,8 +2489,7 @@ take_hinted_page:
=========================================================
the hinted page
===============*/
- ret_descr = fsp_alloc_free_extent(
- space_id, page_size, hint, mtr);
+ ret_descr = fsp_alloc_free_extent(space, page_size, hint, mtr);
ut_a(ret_descr == descr);
@@ -3039,7 +2499,7 @@ take_hinted_page:
ret_descr + XDES_FLST_NODE, mtr);
/* Try to fill the segment free list */
- fseg_fill_free_list(seg_inode, space_id, page_size,
+ fseg_fill_free_list(seg_inode, space, page_size,
hint + FSP_EXTENT_SIZE, mtr);
goto take_hinted_page;
/*-----------------------------------------------------------*/
@@ -3048,7 +2508,7 @@ take_hinted_page:
&& (used >= FSEG_FRAG_LIMIT)
&& (!!(ret_descr
= fseg_alloc_free_extent(
- seg_inode, space_id, page_size, mtr)))) {
+ seg_inode, space, page_size, mtr)))) {
/* 3. We take any free extent (which was already assigned above
===============================================================
@@ -3094,7 +2554,7 @@ take_hinted_page:
return(NULL);
}
- ret_descr = xdes_lst_get_descriptor(space_id, page_size,
+ ret_descr = xdes_lst_get_descriptor(space, page_size,
first, mtr);
ret_page = xdes_get_offset(ret_descr)
+ xdes_find_bit(ret_descr, XDES_FREE_BIT, TRUE,
@@ -3105,7 +2565,7 @@ take_hinted_page:
/* 6. We allocate an individual page from the space
===================================================*/
buf_block_t* block = fsp_alloc_free_page(
- space_id, page_size, hint, rw_latch, mtr, init_mtr);
+ space, page_size, hint, rw_latch, mtr, init_mtr);
ut_ad(!has_done_reservation || block != NULL);
@@ -3128,7 +2588,7 @@ take_hinted_page:
/* 7. We allocate a new extent and take its first page
======================================================*/
ret_descr = fseg_alloc_free_extent(seg_inode,
- space_id, page_size, mtr);
+ space, page_size, mtr);
if (ret_descr == NULL) {
ret_page = FIL_NULL;
@@ -3176,7 +2636,7 @@ got_hinted_page:
The extent is still in the appropriate list (FSEG_NOT_FULL
or FSEG_FREE), and the page is not yet marked as used. */
- ut_ad(xdes_get_descriptor(space_id, ret_page, page_size, mtr)
+ ut_ad(xdes_get_descriptor(space, ret_page, page_size, mtr)
== ret_descr);
ut_ad(xdes_mtr_get_bit(
@@ -3186,10 +2646,8 @@ got_hinted_page:
fseg_mark_page_used(seg_inode, ret_page, ret_descr, mtr);
}
- ut_ad(space->flags
- == mach_read_from_4(FSP_SPACE_FLAGS + space_header));
- return(fsp_page_create(page_id_t(space_id, ret_page), page_size,
- rw_latch, mtr, init_mtr));
+ return(fsp_page_create(space, ret_page, page_size, rw_latch,
+ mtr, init_mtr));
}
/**********************************************************************//**
@@ -3299,7 +2757,7 @@ fsp_reserve_free_pages(
ut_a(size < FSP_EXTENT_SIZE);
descr = xdes_get_descriptor_with_space_hdr(
- space_header, space->id, 0, mtr);
+ space_header, space, 0, mtr);
n_used = xdes_get_n_used(descr, mtr);
ut_a(n_used <= size);
@@ -3373,7 +2831,7 @@ fsp_reserve_free_extents(
fil_space_t* space = mtr_x_lock_space(space_id, mtr);
const page_size_t page_size(space->flags);
- space_header = fsp_get_space_header(space_id, page_size, mtr);
+ space_header = fsp_get_space_header(space, page_size, mtr);
try_again:
size = mach_read_from_4(space_header + FSP_SIZE);
ut_ad(size == space->size_in_header);
@@ -3589,7 +3047,8 @@ fseg_mark_page_used(
/** Frees a single page of a segment.
@param[in] seg_inode segment inode
-@param[in] page_id page id
+@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
@@ -3598,7 +3057,8 @@ static
void
fseg_free_page_low(
fseg_inode_t* seg_inode,
- const page_id_t& page_id,
+ fil_space_t* space,
+ page_no_t offset,
const page_size_t& page_size,
bool ahi,
mtr_t* mtr)
@@ -3615,30 +3075,27 @@ fseg_free_page_low(
ut_ad(mach_read_from_4(seg_inode + FSEG_MAGIC_N)
== FSEG_MAGIC_N_VALUE);
ut_ad(!((page_offset(seg_inode) - FSEG_ARR_OFFSET) % FSEG_INODE_SIZE));
- ut_d(fsp_space_modify_check(page_id.space(), mtr));
+ ut_d(fsp_space_modify_check(space, mtr));
/* 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, page_size);
+ btr_search_drop_page_hash_when_freed(
+ page_id_t(space->id, offset), page_size);
}
- descr = xdes_get_descriptor(page_id.space(), page_id.page_no(),
- page_size, mtr);
+ descr = xdes_get_descriptor(space, offset, page_size, mtr);
if (xdes_mtr_get_bit(descr, XDES_FREE_BIT,
- page_id.page_no() % FSP_EXTENT_SIZE, mtr)) {
- fputs("InnoDB: Dump of the tablespace extent descriptor: ",
- stderr);
- ut_print_buf(stderr, descr, 40);
- ib::error() << "InnoDB is trying to free page " << page_id
+ offset % FSP_EXTENT_SIZE, mtr)) {
+ ib::fatal() << "InnoDB is trying to free page "
+ << page_id_t(space->id, offset)
<< " though it is already marked as free in the"
" tablespace! The tablespace free space info is"
" corrupt. You may need to dump your tables and"
- " recreate the whole database!";
-crash:
- ib::fatal() << FORCE_RECOVERY_MSG;
+ " recreate the whole database!"
+ << FORCE_RECOVERY_MSG;
}
state = xdes_get_state(descr, mtr);
@@ -3648,7 +3105,7 @@ crash:
for (i = 0;; i++) {
if (fseg_get_nth_frag_page_no(seg_inode, i, mtr)
- == page_id.page_no()) {
+ == offset) {
fseg_set_nth_frag_page_no(seg_inode, i,
FIL_NULL, mtr);
@@ -3656,7 +3113,7 @@ crash:
}
}
- fsp_free_page(page_id, page_size, mtr);
+ fsp_free_page(space, offset, page_size, mtr);
return;
}
@@ -3674,10 +3131,11 @@ crash:
ut_print_buf(stderr, seg_inode, 40);
putc('\n', stderr);
- ib::error() << "InnoDB is trying to free page " << page_id
+ ib::fatal() << "InnoDB is trying to free page "
+ << page_id_t(space->id, offset)
<< ", which does not belong to segment " << descr_id
- << " but belongs to segment " << seg_id << ".";
- goto crash;
+ << " but belongs to segment " << seg_id << "."
+ << FORCE_RECOVERY_MSG;
}
not_full_n_used = mtr_read_ulint(seg_inode + FSEG_NOT_FULL_N_USED,
@@ -3697,7 +3155,7 @@ crash:
not_full_n_used - 1, MLOG_4BYTES, mtr);
}
- const ulint bit = page_id.page_no() % FSP_EXTENT_SIZE;
+ const ulint bit = offset % FSP_EXTENT_SIZE;
xdes_set_bit(descr, XDES_FREE_BIT, bit, TRUE, mtr);
xdes_set_bit(descr, XDES_CLEAN_BIT, bit, TRUE, mtr);
@@ -3706,7 +3164,7 @@ crash:
/* The extent has become free: free it to space */
flst_remove(seg_inode + FSEG_NOT_FULL,
descr + XDES_FLST_NODE, mtr);
- fsp_free_extent(page_id, page_size, mtr);
+ fsp_free_extent(space, offset, page_size, mtr);
}
}
@@ -3725,7 +3183,7 @@ fseg_free_page(
DBUG_ENTER("fseg_free_page");
fseg_inode_t* seg_inode;
buf_block_t* iblock;
- const fil_space_t* space = mtr_x_lock_space(space_id, mtr);
+ fil_space_t* space = mtr_x_lock_space(space_id, mtr);
const page_size_t page_size(space->flags);
DBUG_LOG("fseg_free_page", "space_id: " << space_id
@@ -3735,11 +3193,9 @@ fseg_free_page(
&iblock);
fil_block_check_type(iblock, FIL_PAGE_INODE, mtr);
- const page_id_t page_id(space_id, page);
-
- fseg_free_page_low(seg_inode, page_id, page_size, ahi, mtr);
+ fseg_free_page_low(seg_inode, space, page, page_size, ahi, mtr);
- ut_d(buf_page_set_file_page_was_freed(page_id));
+ ut_d(buf_page_set_file_page_was_freed(page_id_t(space_id, page)));
DBUG_VOID_RETURN;
}
@@ -3770,7 +3226,7 @@ fseg_page_is_free(
== FSEG_MAGIC_N_VALUE);
ut_ad(!((page_offset(seg_inode) - FSEG_ARR_OFFSET) % FSEG_INODE_SIZE));
- descr = xdes_get_descriptor(space_id, page, page_size, &mtr);
+ descr = xdes_get_descriptor(space, page, page_size, &mtr);
ut_a(descr);
is_free = xdes_mtr_get_bit(
@@ -3781,19 +3237,24 @@ fseg_page_is_free(
return(is_free);
}
-/**********************************************************************//**
-Frees an extent of a segment to the space free list. */
-static MY_ATTRIBUTE((nonnull))
+/** Free an extent of a segment to the space free list.
+@param[in,out] seg_inode segment inode
+@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
void
fseg_free_extent(
-/*=============*/
- fseg_inode_t* seg_inode, /*!< in: segment inode */
- ulint space, /*!< in: space id */
+ fseg_inode_t* seg_inode,
+ fil_space_t* space,
const page_size_t& page_size,
- ulint page, /*!< in: a page in the extent */
- bool ahi, /*!< in: whether we may need to drop
- the adaptive hash index */
- mtr_t* mtr) /*!< in/out: mini-transaction */
+ ulint page,
+ bool ahi,
+ mtr_t* mtr)
{
ulint first_page_in_extent;
xdes_t* descr;
@@ -3801,7 +3262,6 @@ fseg_free_extent(
ulint descr_n_used;
ulint i;
- ut_ad(seg_inode != NULL);
ut_ad(mtr != NULL);
descr = xdes_get_descriptor(space, page, page_size, mtr);
@@ -3823,7 +3283,7 @@ fseg_free_extent(
is hashed */
btr_search_drop_page_hash_when_freed(
- page_id_t(space,
+ page_id_t(space->id,
first_page_in_extent + i),
page_size);
}
@@ -3850,13 +3310,13 @@ fseg_free_extent(
MLOG_4BYTES, mtr);
}
- fsp_free_extent(page_id_t(space, page), page_size, mtr);
+ fsp_free_extent(space, page, page_size, mtr);
#ifdef UNIV_DEBUG
for (i = 0; i < FSP_EXTENT_SIZE; i++) {
buf_page_set_file_page_was_freed(
- page_id_t(space, first_page_in_extent + i));
+ page_id_t(space->id, first_page_in_extent + i));
}
#endif /* UNIV_DEBUG */
}
@@ -3890,10 +3350,10 @@ fseg_free_step(
space_id = page_get_space_id(page_align(header));
header_page = page_get_page_no(page_align(header));
- const fil_space_t* space = mtr_x_lock_space(space_id, mtr);
+ fil_space_t* space = mtr_x_lock_space(space_id, mtr);
const page_size_t page_size(space->flags);
- descr = xdes_get_descriptor(space_id, header_page, page_size, mtr);
+ descr = xdes_get_descriptor(space, header_page, page_size, mtr);
/* Check that the header resides on a page which has not been
freed yet */
@@ -3911,13 +3371,13 @@ fseg_free_step(
}
fil_block_check_type(iblock, FIL_PAGE_INODE, mtr);
- descr = fseg_get_first_extent(inode, space_id, page_size, mtr);
+ descr = fseg_get_first_extent(inode, space, page_size, mtr);
if (descr != NULL) {
/* Free the extent held by the segment */
page = xdes_get_offset(descr);
- fseg_free_extent(inode, space_id, page_size, page, ahi, mtr);
+ fseg_free_extent(inode, space, page_size, page, ahi, mtr);
DBUG_RETURN(FALSE);
}
@@ -3927,21 +3387,21 @@ fseg_free_step(
if (n == ULINT_UNDEFINED) {
/* Freeing completed: free the segment inode */
- fsp_free_seg_inode(space_id, page_size, inode, mtr);
+ fsp_free_seg_inode(space, page_size, inode, mtr);
DBUG_RETURN(TRUE);
}
fseg_free_page_low(
- inode,
- page_id_t(space_id, fseg_get_nth_frag_page_no(inode, n, mtr)),
+ inode, space,
+ fseg_get_nth_frag_page_no(inode, n, mtr),
page_size, ahi, mtr);
n = fseg_find_last_used_frag_page_slot(inode, mtr);
if (n == ULINT_UNDEFINED) {
/* Freeing completed: free the segment inode */
- fsp_free_seg_inode(space_id, page_size, inode, mtr);
+ fsp_free_seg_inode(space, page_size, inode, mtr);
DBUG_RETURN(TRUE);
}
@@ -3972,20 +3432,20 @@ fseg_free_step_not_header(
space_id = page_get_space_id(page_align(header));
ut_ad(mtr->is_named_space(space_id));
- const fil_space_t* space = mtr_x_lock_space(space_id, mtr);
+ fil_space_t* space = mtr_x_lock_space(space_id, mtr);
const page_size_t page_size(space->flags);
buf_block_t* iblock;
inode = fseg_inode_get(header, space_id, page_size, mtr, &iblock);
fil_block_check_type(iblock, FIL_PAGE_INODE, mtr);
- descr = fseg_get_first_extent(inode, space_id, page_size, mtr);
+ descr = fseg_get_first_extent(inode, space, page_size, mtr);
if (descr != NULL) {
/* Free the extent held by the segment */
page = xdes_get_offset(descr);
- fseg_free_extent(inode, space_id, page_size, page, ahi, mtr);
+ fseg_free_extent(inode, space, page_size, page, ahi, mtr);
return(FALSE);
}
@@ -4005,8 +3465,7 @@ fseg_free_step_not_header(
return(TRUE);
}
- fseg_free_page_low(inode, page_id_t(space_id, page_no), page_size, ahi,
- mtr);
+ fseg_free_page_low(inode, space, page_no, page_size, ahi, mtr);
return(FALSE);
}
@@ -4015,28 +3474,24 @@ fseg_free_step_not_header(
We think of the extent lists of the segment catenated in the order
FSEG_FULL -> FSEG_NOT_FULL -> FSEG_FREE.
@param[in] inode segment inode
-@param[in] space_id space id
+@param[in] space tablespace
@param[in] page_size page size
@param[in,out] mtr mini-transaction
@return the first extent descriptor, or NULL if none */
+MY_ATTRIBUTE((nonnull, warn_unused_result))
static
xdes_t*
fseg_get_first_extent(
fseg_inode_t* inode,
- ulint space_id,
+ const fil_space_t* space,
const page_size_t& page_size,
mtr_t* mtr)
{
fil_addr_t first;
- xdes_t* descr;
-
- ut_ad(inode && mtr);
- ut_ad(space_id == page_get_space_id(page_align(inode)));
+ ut_ad(space->id == page_get_space_id(page_align(inode)));
ut_ad(mach_read_from_4(inode + FSEG_MAGIC_N) == FSEG_MAGIC_N_VALUE);
- first = fil_addr_null;
-
if (flst_get_len(inode + FSEG_FULL) > 0) {
first = flst_get_first(inode + FSEG_FULL, mtr);
@@ -4048,15 +3503,14 @@ fseg_get_first_extent(
} else if (flst_get_len(inode + FSEG_FREE) > 0) {
first = flst_get_first(inode + FSEG_FREE, mtr);
- }
-
- if (first.page == FIL_NULL) {
-
+ } else {
return(NULL);
}
- descr = xdes_lst_get_descriptor(space_id, page_size, first, mtr);
- return(descr);
+ ut_ad(first.page != FIL_NULL);
+
+ return(first.page == FIL_NULL ? NULL
+ : xdes_lst_get_descriptor(space, page_size, first, mtr));
}
#ifdef UNIV_DEBUG
@@ -4073,7 +3527,6 @@ fseg_validate_low(
ulint space_id;
ib_id_t seg_id;
mtr_t mtr;
- xdes_t* descr;
fil_addr_t node_addr;
ulint n_used = 0;
ulint n_used2 = 0;
@@ -4097,11 +3550,8 @@ fseg_validate_low(
mtr_start(&mtr);
const fil_space_t* space = mtr_x_lock_space(
space_id, &mtr);
-
- const page_size_t page_size(space->flags);
-
- descr = xdes_lst_get_descriptor(space_id, page_size,
- node_addr, &mtr);
+ const xdes_t* descr = xdes_lst_get_descriptor(
+ space, page_size_t(space->flags), node_addr, &mtr);
ut_a(xdes_get_n_used(descr, &mtr) == 0);
ut_a(xdes_get_state(descr, &mtr) == XDES_FSEG);
@@ -4119,10 +3569,8 @@ fseg_validate_low(
mtr_start(&mtr);
const fil_space_t* space = mtr_x_lock_space(
space_id, &mtr);
- const page_size_t page_size(space->flags);
-
- descr = xdes_lst_get_descriptor(space_id, page_size,
- node_addr, &mtr);
+ const xdes_t* descr = xdes_lst_get_descriptor(
+ space, page_size_t(space->flags), node_addr, &mtr);
ut_a(xdes_get_n_used(descr, &mtr) > 0);
ut_a(xdes_get_n_used(descr, &mtr) < FSP_EXTENT_SIZE);
@@ -4143,10 +3591,8 @@ fseg_validate_low(
mtr_start(&mtr);
const fil_space_t* space = mtr_x_lock_space(
space_id, &mtr);
- const page_size_t page_size(space->flags);
-
- descr = xdes_lst_get_descriptor(space_id, page_size,
- node_addr, &mtr);
+ const xdes_t* descr = xdes_lst_get_descriptor(
+ space, page_size_t(space->flags), node_addr, &mtr);
ut_a(xdes_get_n_used(descr, &mtr) == FSP_EXTENT_SIZE);
ut_a(xdes_get_state(descr, &mtr) == XDES_FSEG);
@@ -4293,10 +3739,10 @@ fsp_page_is_free_func(
{
ut_ad(mtr);
- const fil_space_t* space = mtr_x_lock_space(space_id, mtr);
+ fil_space_t* space = mtr_x_lock_space(space_id, mtr);
const page_size_t page_size(space->flags);
- xdes_t* descr = xdes_get_descriptor(space_id, page_no, page_size, mtr);
+ xdes_t* descr = xdes_get_descriptor(space, page_no, page_size, mtr);
ut_a(descr);
return xdes_mtr_get_bit(
diff --git a/storage/innobase/fsp/fsp0space.cc b/storage/innobase/fsp/fsp0space.cc
index b72590e48e8..76269a749f9 100644
--- a/storage/innobase/fsp/fsp0space.cc
+++ b/storage/innobase/fsp/fsp0space.cc
@@ -1,6 +1,7 @@
/*****************************************************************************
Copyright (c) 2013, 2015, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2017, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -18,7 +19,7 @@ this program; if not, write to the Free Software Foundation, Inc.,
/**************************************************//**
@file fsp/fsp0space.cc
-General shared tablespace implementation.
+Shared tablespace implementation.
Created 2012-11-16 by Sunny Bains as srv/srv0space.cc
*******************************************************/
@@ -125,15 +126,13 @@ Tablespace::open_or_create(bool is_temp)
if (it == begin) {
/* First data file. */
- ulint flags;
-
- flags = fsp_flags_set_page_size(0, univ_page_size);
-
/* Create the tablespace entry for the multi-file
tablespace in the tablespace manager. */
space = fil_space_create(
- m_name, m_space_id, flags, is_temp
- ? FIL_TYPE_TEMPORARY : FIL_TYPE_TABLESPACE, it->m_crypt_info,
+ m_name, m_space_id, FSP_FLAGS_PAGE_SSIZE(),
+ is_temp
+ ? FIL_TYPE_TEMPORARY : FIL_TYPE_TABLESPACE,
+ it->m_crypt_info,
false);
}
diff --git a/storage/innobase/fsp/fsp0sysspace.cc b/storage/innobase/fsp/fsp0sysspace.cc
index 9a9e7051403..6f7d09b6faa 100644
--- a/storage/innobase/fsp/fsp0sysspace.cc
+++ b/storage/innobase/fsp/fsp0sysspace.cc
@@ -577,11 +577,11 @@ SysTablespace::read_lsn_and_check_flags(lsn_t* flushed_lsn)
first datafile. */
for (int retry = 0; retry < 2; ++retry) {
- err = it->validate_first_page(flushed_lsn, false);
+ err = it->validate_first_page(flushed_lsn);
if (err != DB_SUCCESS
&& (retry == 1
- || it->restore_from_doublewrite(0) != DB_SUCCESS)) {
+ || it->restore_from_doublewrite())) {
it->close();
diff --git a/storage/innobase/fts/fts0fts.cc b/storage/innobase/fts/fts0fts.cc
index d74f8cfa5bf..f05ad4421f6 100644
--- a/storage/innobase/fts/fts0fts.cc
+++ b/storage/innobase/fts/fts0fts.cc
@@ -1780,13 +1780,6 @@ fts_create_in_mem_aux_table(
aux_table_name, table->space, n_cols, 0, table->flags,
fts_get_table_flags2_for_aux_tables(table->flags2));
- if (DICT_TF_HAS_SHARED_SPACE(table->flags)) {
- ut_ad(table->space == fil_space_get_id_by_name(
- table->tablespace()));
- new_table->tablespace = mem_heap_strdup(
- new_table->heap, table->tablespace);
- }
-
if (DICT_TF_HAS_DATA_DIR(table->flags)) {
ut_ad(table->data_dir_path != NULL);
new_table->data_dir_path = mem_heap_strdup(
@@ -1838,7 +1831,7 @@ fts_create_one_common_table(
FTS_CONFIG_TABLE_VALUE_COL_LEN);
}
- error = row_create_table_for_mysql(new_table, NULL, trx, false,
+ error = row_create_table_for_mysql(new_table, trx, false,
FIL_SPACE_ENCRYPTION_DEFAULT, FIL_DEFAULT_ENCRYPTION_KEY);
if (error == DB_SUCCESS) {
@@ -2055,7 +2048,7 @@ fts_create_one_index_table(
(DATA_MTYPE_MAX << 16) | DATA_UNSIGNED | DATA_NOT_NULL,
FTS_INDEX_ILIST_LEN);
- error = row_create_table_for_mysql(new_table, NULL, trx, false,
+ error = row_create_table_for_mysql(new_table, trx, false,
FIL_SPACE_ENCRYPTION_DEFAULT, FIL_DEFAULT_ENCRYPTION_KEY);
if (error == DB_SUCCESS) {
diff --git a/storage/innobase/gis/gis0sea.cc b/storage/innobase/gis/gis0sea.cc
index 99543ef8c9c..0bc96199486 100644
--- a/storage/innobase/gis/gis0sea.cc
+++ b/storage/innobase/gis/gis0sea.cc
@@ -1,6 +1,7 @@
/*****************************************************************************
Copyright (c) 2016, 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
@@ -129,12 +130,10 @@ rtr_pcur_getnext_from_path(
|| latch_mode & BTR_MODIFY_LEAF);
mtr_s_lock(dict_index_get_lock(index), mtr);
} else {
- ut_ad(mtr_memo_contains(mtr, dict_index_get_lock(index),
- MTR_MEMO_SX_LOCK)
- || mtr_memo_contains(mtr, dict_index_get_lock(index),
- MTR_MEMO_S_LOCK)
- || mtr_memo_contains(mtr, dict_index_get_lock(index),
- MTR_MEMO_X_LOCK));
+ ut_ad(mtr_memo_contains_flagged(mtr, &index->lock,
+ MTR_MEMO_SX_LOCK
+ | MTR_MEMO_S_LOCK
+ | MTR_MEMO_X_LOCK));
}
const page_size_t& page_size = dict_table_page_size(index->table);
@@ -601,10 +600,9 @@ rtr_pcur_open_low(
}
if (latch_mode & BTR_MODIFY_TREE) {
- ut_ad(mtr_memo_contains(mtr, dict_index_get_lock(index),
- MTR_MEMO_X_LOCK)
- || mtr_memo_contains(mtr, dict_index_get_lock(index),
- MTR_MEMO_SX_LOCK));
+ ut_ad(mtr_memo_contains_flagged(mtr, &index->lock,
+ MTR_MEMO_X_LOCK
+ | MTR_MEMO_SX_LOCK));
tree_latched = true;
}
diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
index 4e1d8e3367b..b353be635f5 100644
--- a/storage/innobase/handler/ha_innodb.cc
+++ b/storage/innobase/handler/ha_innodb.cc
@@ -313,26 +313,28 @@ This THDs must be destroyed rather early in the server shutdown sequence.
This service thread creates a THD and idly waits for it to get a signal to
die. Then it notifies all purge workers to shutdown.
*/
-st_my_thread_var *thd_destructor_myvar= NULL;
-mysql_cond_t thd_destructor_cond;
-pthread_t thd_destructor_thread;
+static volatile st_my_thread_var *thd_destructor_myvar= NULL;
+static pthread_t thd_destructor_thread;
pthread_handler_t
thd_destructor_proxy(void *)
{
mysql_mutex_t thd_destructor_mutex;
+ mysql_cond_t thd_destructor_cond;
my_thread_init();
mysql_mutex_init(PSI_NOT_INSTRUMENTED, &thd_destructor_mutex, 0);
mysql_cond_init(PSI_NOT_INSTRUMENTED, &thd_destructor_cond, 0);
- thd_destructor_myvar = _my_thread_var();
+ st_my_thread_var *myvar= _my_thread_var();
THD *thd= create_thd();
thd_proc_info(thd, "InnoDB background thread");
+ myvar->current_mutex = &thd_destructor_mutex;
+ myvar->current_cond = &thd_destructor_cond;
+
mysql_mutex_lock(&thd_destructor_mutex);
- thd_destructor_myvar->current_mutex = &thd_destructor_mutex;
- thd_destructor_myvar->current_cond = &thd_destructor_cond;
+ thd_destructor_myvar = myvar;
/* wait until the server wakes the THD to abort and die */
while (!thd_destructor_myvar->abort)
mysql_cond_wait(&thd_destructor_cond, &thd_destructor_mutex);
@@ -382,25 +384,6 @@ get_row_format(
static ulong innodb_default_row_format = DEFAULT_ROW_FORMAT_DYNAMIC;
-#ifdef UNIV_DEBUG
-/** Values for --innodb-debug-compress names. */
-static const char* innodb_debug_compress_names[] = {
- "none",
- "zlib",
- "lz4",
- "lz4hc",
- NullS
-};
-
-/** Enumeration of --innodb-debug-compress */
-static TYPELIB innodb_debug_compress_typelib = {
- array_elements(innodb_debug_compress_names) - 1,
- "innodb_debug_compress_typelib",
- innodb_debug_compress_names,
- NULL
-};
-#endif /* UNIV_DEBUG */
-
/** Possible values for system variable "innodb_stats_method". The values
are defined the same as its corresponding MyISAM system variable
"myisam_stats_method"(see "myisam_stats_method_names"), for better usability */
@@ -493,20 +476,6 @@ static const char* innobase_change_buffering_values[IBUF_USE_COUNT] = {
"all" /* IBUF_USE_ALL */
};
-
-/* This tablespace name is reserved by InnoDB in order to explicitly
-create a file_per_table tablespace for the table. */
-const char reserved_file_per_table_space_name[] = "innodb_file_per_table";
-
-/* This tablespace name is reserved by InnoDB for the system tablespace
-which uses space_id 0 and stores extra types of system pages like UNDO
-and doublewrite. */
-const char reserved_system_space_name[] = "innodb_system";
-
-/* This tablespace name is reserved by InnoDB for the predefined temporary
-tablespace. */
-const char reserved_temporary_space_name[] = "innodb_temporary";
-
/* Call back function array defined by MySQL and used to
retrieve FTS results. */
const struct _ft_vft ft_vft_result = {NULL,
@@ -608,8 +577,7 @@ static PSI_mutex_info all_innodb_mutexes[] = {
PSI_KEY(rtr_path_mutex),
PSI_KEY(rtr_ssn_mutex),
PSI_KEY(trx_sys_mutex),
- PSI_KEY(zip_pad_mutex),
- PSI_KEY(master_key_id_mutex),
+ PSI_KEY(zip_pad_mutex)
};
# endif /* UNIV_PFS_MUTEX */
@@ -961,6 +929,7 @@ static ibool innodb_have_lz4=IF_LZ4(1, 0);
static ibool innodb_have_lzma=IF_LZMA(1, 0);
static ibool innodb_have_bzip2=IF_BZIP2(1, 0);
static ibool innodb_have_snappy=IF_SNAPPY(1, 0);
+static ibool innodb_have_punch_hole=IF_PUNCH_HOLE(1, 0);
static
int
@@ -1168,20 +1137,6 @@ static SHOW_VAR innodb_status_variables[]= {
/* Status variables for page compression */
{"page_compression_saved",
(char*) &export_vars.innodb_page_compression_saved, SHOW_LONGLONG},
- {"page_compression_trim_sect512",
- (char*) &export_vars.innodb_page_compression_trim_sect512, SHOW_LONGLONG},
- {"page_compression_trim_sect1024",
- (char*) &export_vars.innodb_page_compression_trim_sect1024, SHOW_LONGLONG},
- {"page_compression_trim_sect2048",
- (char*) &export_vars.innodb_page_compression_trim_sect2048, SHOW_LONGLONG},
- {"page_compression_trim_sect4096",
- (char*) &export_vars.innodb_page_compression_trim_sect4096, SHOW_LONGLONG},
- {"page_compression_trim_sect8192",
- (char*) &export_vars.innodb_page_compression_trim_sect8192, SHOW_LONGLONG},
- {"page_compression_trim_sect16384",
- (char*) &export_vars.innodb_page_compression_trim_sect16384, SHOW_LONGLONG},
- {"page_compression_trim_sect32768",
- (char*) &export_vars.innodb_page_compression_trim_sect32768, SHOW_LONGLONG},
{"num_index_pages_written",
(char*) &export_vars.innodb_index_pages_written, SHOW_LONGLONG},
{"num_non_index_pages_written",
@@ -1190,8 +1145,6 @@ static SHOW_VAR innodb_status_variables[]= {
(char*) &export_vars.innodb_pages_page_compressed, SHOW_LONGLONG},
{"num_page_compressed_trim_op",
(char*) &export_vars.innodb_page_compressed_trim_op, SHOW_LONGLONG},
- {"num_page_compressed_trim_op_saved",
- (char*) &export_vars.innodb_page_compressed_trim_op_saved, SHOW_LONGLONG},
{"num_pages_page_decompressed",
(char*) &export_vars.innodb_pages_page_decompressed, SHOW_LONGLONG},
{"num_pages_page_compression_error",
@@ -1210,6 +1163,8 @@ static SHOW_VAR innodb_status_variables[]= {
(char*) &innodb_have_bzip2, SHOW_BOOL},
{"have_snappy",
(char*) &innodb_have_snappy, SHOW_BOOL},
+ {"have_punch_hole",
+ (char*) &innodb_have_punch_hole, SHOW_BOOL},
/* Defragmentation */
{"defragment_compression_failures",
@@ -1498,20 +1453,6 @@ innobase_rollback_by_xid(
XID* xid); /*!< in: X/Open XA transaction
identification */
-#ifdef MYSQL_TABLESPACES
-/** This API handles CREATE, ALTER & DROP commands for InnoDB tablespaces.
-@param[in] hton Handlerton of InnoDB
-@param[in] thd Connection
-@param[in] alter_info Describies the command and how to do it.
-@return MySQL error code*/
-static
-int
-innobase_alter_tablespace(
- handlerton* hton,
- THD* thd,
- st_alter_tablespace* alter_info);
-#endif /* MYSQL_TABLESPACES */
-
/** 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
@@ -2355,8 +2296,6 @@ convert_error_code_to_mysql(
return(HA_ERR_TABLE_CORRUPT);
case DB_FTS_TOO_MANY_WORDS_IN_PHRASE:
return(HA_ERR_FTS_TOO_MANY_WORDS_IN_PHRASE);
- case DB_WRONG_FILE_NAME:
- return(HA_ERR_GENERIC); // when can this happen?
case DB_COMPUTE_VALUE_FAILED:
return(HA_ERR_GENERIC); // impossible
}
@@ -2829,118 +2768,6 @@ innobase_raw_format(
return(ut_str_sql_format(buf_tmp, buf_tmp_used, buf, buf_size));
}
-#ifdef MYSQL_COMPRESSION
-/** Check if the string is "empty" or "none".
-@param[in] algorithm Compression algorithm to check
-@return true if no algorithm requested */
-bool
-Compression::is_none(const char* algorithm)
-{
- /* NULL is the same as NONE */
- if (algorithm == NULL
- || *algorithm == 0
- || innobase_strcasecmp(algorithm, "none") == 0) {
- return(true);
- }
-
- return(false);
-}
-
-/** Check for supported COMPRESS := (ZLIB | LZ4 | NONE) supported values
-@param[in] name Name of the compression algorithm
-@param[out] compression The compression algorithm
-@return DB_SUCCESS or DB_UNSUPPORTED */
-dberr_t
-Compression::check(
- const char* algorithm,
- Compression* compression)
-{
- if (is_none(algorithm)) {
-
- compression->m_type = NONE;
-
- } else if (innobase_strcasecmp(algorithm, "zlib") == 0) {
-
- compression->m_type = ZLIB;
-
- } else if (innobase_strcasecmp(algorithm, "lz4") == 0) {
-
- compression->m_type = LZ4;
-
- } else {
- return(DB_UNSUPPORTED);
- }
-
- return(DB_SUCCESS);
-}
-
-/** Check for supported COMPRESS := (ZLIB | LZ4 | NONE) supported values
-@param[in] name Name of the compression algorithm
-@param[out] compression The compression algorithm
-@return DB_SUCCESS or DB_UNSUPPORTED */
-dberr_t
-Compression::validate(const char* algorithm)
-{
- Compression compression;
-
- return(check(algorithm, &compression));
-}
-#endif /* MYSQL_COMPRESSION */
-
-#ifdef MYSQL_ENCRYPTION
-/** Check if the string is "" or "n".
-@param[in] algorithm Encryption algorithm to check
-@return true if no algorithm requested */
-bool
-Encryption::is_none(const char* algorithm)
-{
- /* NULL is the same as NONE */
- if (algorithm == NULL
- || innobase_strcasecmp(algorithm, "n") == 0
- || innobase_strcasecmp(algorithm, "") == 0) {
- return(true);
- }
-
- return(false);
-}
-
-/** Check the encryption option and set it
-@param[in] option encryption option
-@param[in/out] encryption The encryption algorithm
-@return DB_SUCCESS or DB_UNSUPPORTED */
-dberr_t
-Encryption::set_algorithm(
- const char* option,
- Encryption* encryption)
-{
- if (is_none(option)) {
-
- encryption->m_type = NONE;
-
- } else if (innobase_strcasecmp(option, "y") == 0) {
-
- encryption->m_type = AES;
-
- } else {
- return(DB_UNSUPPORTED);
- }
-
- return(DB_SUCCESS);
-}
-
-/** Check for supported ENCRYPT := (Y | N) supported values
-@param[in] option Encryption option
-@param[out] encryption The encryption algorithm
-@return DB_SUCCESS or DB_UNSUPPORTED */
-dberr_t
-Encryption::validate(const char* option)
-{
- Encryption encryption;
-
- return(encryption.set_algorithm(option, &encryption));
-}
-#endif /* MYSQL_ENCRYPTION */
-
/*********************************************************************//**
Compute the next autoinc value.
@@ -3667,7 +3494,7 @@ innobase_invalidate_query_cache(
TRUE);
}
-/** Quote a standard SQL identifier like tablespace, index or column name.
+/** Quote a standard SQL identifier like index or column name.
@param[in] file output stream
@param[in] trx InnoDB transaction, or NULL
@param[in] id identifier to quote */
@@ -3961,67 +3788,6 @@ innobase_init_abort()
DBUG_RETURN(1);
}
-
-#ifdef MYSQL_ENCRYPTION
-/* mutex protecting the master_key_id */
-ib_mutex_t master_key_id_mutex;
-
-/** Rotate the encrypted tablespace keys according to master key
-rotation.
-@return false on success, true on failure */
-bool
-innobase_encryption_key_rotation()
-{
- byte* master_key = NULL;
- bool ret = FALSE;
-
- /* Require the mutex to block other rotate request. */
- mutex_enter(&master_key_id_mutex);
-
- /* Check if keyring loaded and the currently master key
- can be fetched. */
- if (Encryption::master_key_id != 0) {
- ulint master_key_id;
- Encryption::Version version;
-
- Encryption::get_master_key(&master_key_id,
- &master_key,
- &version);
- if (master_key == NULL) {
- mutex_exit(&master_key_id_mutex);
- my_error(ER_CANNOT_FIND_KEY_IN_KEYRING, MYF(0));
- return(true);
- }
- my_free(master_key);
- }
-
- master_key = NULL;
-
- /* Generate the new master key. */
- Encryption::create_master_key(&master_key);
-
- if (master_key == NULL) {
- my_error(ER_CANNOT_FIND_KEY_IN_KEYRING, MYF(0));
- mutex_exit(&master_key_id_mutex);
- return(true);
- }
-
- ret = !fil_encryption_rotate();
-
- my_free(master_key);
-
- /* If rotation failure, return error */
- if (ret) {
- my_error(ER_CANNOT_FIND_KEY_IN_KEYRING, MYF(0));
- }
-
- /* Release the mutex. */
- mutex_exit(&master_key_id_mutex);
-
- return(ret);
-}
-#endif /* MYSQL_ENCRYPTION */
-
/** Return partitioning flags. */
static uint innobase_partition_flags()
{
@@ -4053,6 +3819,10 @@ static const char* deprecated_file_format_check
static const char* deprecated_file_format_max
= DEPRECATED_FORMAT_PARAMETER("innodb_file_format_max");
+/** Deprecation message about innodb_use_trim */
+static const char* deprecated_use_trim
+ = DEPRECATED_FORMAT_PARAMETER("innodb_use_trim");
+
/** Update log_checksum_algorithm_ptr with a pointer to the function
corresponding to whether checksums are enabled.
@param[in] check whether redo log block checksums are enabled */
@@ -4088,7 +3858,6 @@ innobase_init(
uint format_id;
ulong num_pll_degree;
ulint srv_buf_pool_size_org = 0;
- ulint fsp_flags =0;
DBUG_ENTER("innobase_init");
handlerton* innobase_hton= (handlerton*) p;
@@ -4117,9 +3886,6 @@ innobase_init(
innobase_hton->commit_checkpoint_request=innobase_checkpoint_request;
innobase_hton->create = innobase_create_handler;
-#ifdef MYSQL_TABLESPACES
- innobase_hton->alter_tablespace = innobase_alter_tablespace;
-#endif
innobase_hton->drop_database = innobase_drop_database;
innobase_hton->panic = innobase_end;
innobase_hton->partition_flags= innobase_partition_flags;
@@ -4160,11 +3926,6 @@ innobase_init(
innodb_remember_check_sysvar_funcs();
-#ifdef MYSQL_ENCRYPTION
- innobase_hton->rotate_encryption_master_key =
- innobase_encryption_key_rotation;
-#endif
-
ut_a(DATA_MYSQL_TRUE_VARCHAR == (ulint)MYSQL_TYPE_VARCHAR);
#ifndef DBUG_OFF
@@ -4204,21 +3965,15 @@ innobase_init(
any functions that could possibly allocate memory. */
ut_new_boot();
- if (UNIV_PAGE_SIZE != UNIV_PAGE_SIZE_DEF) {
- ib::info() << "innodb_page_size has been "
- << "changed from default value "
- << UNIV_PAGE_SIZE_DEF << " to " << UNIV_PAGE_SIZE;
-
- /* There is hang on buffer pool when trying to get a new
- page if buffer pool size is too small for large page sizes */
- if (UNIV_PAGE_SIZE > UNIV_PAGE_SIZE_DEF
- && innobase_buffer_pool_size < (24 * 1024 * 1024)) {
- ib::info() << "innodb_page_size="
- << UNIV_PAGE_SIZE << " requires "
- << "innodb_buffer_pool_size > 24M current "
- << innobase_buffer_pool_size;
- goto error;
- }
+ /* The buffer pool needs to be able to accommodate enough many
+ 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="
+ << UNIV_PAGE_SIZE << " requires "
+ << "innodb_buffer_pool_size > 24M current "
+ << innobase_buffer_pool_size;
+ goto error;
}
#ifndef HAVE_LZ4
@@ -4293,7 +4048,6 @@ innobase_init(
ut_a(default_path);
fil_path_to_mysql_datadir = default_path;
- folder_mysql_datadir = fil_path_to_mysql_datadir;
/* Set InnoDB initialization parameters according to the values
read from MySQL .cnf file */
@@ -4327,13 +4081,8 @@ innobase_init(
page_size_t(srv_page_size, srv_page_size, false));
srv_sys_space.set_space_id(TRX_SYS_SPACE);
-
- /* Create the filespace flags. */
- fsp_flags = fsp_flags_init(
- univ_page_size, false, false, false, false, false, 0, 0);
- srv_sys_space.set_flags(fsp_flags);
-
- srv_sys_space.set_name(reserved_system_space_name);
+ srv_sys_space.set_flags(FSP_FLAGS_PAGE_SSIZE());
+ srv_sys_space.set_name("innodb_system");
srv_sys_space.set_path(srv_data_home);
/* Supports raw devices */
@@ -4351,13 +4100,9 @@ innobase_init(
/* We set the temporary tablspace id later, after recovery.
The temp tablespace doesn't support raw devices.
Set the name and path. */
- srv_tmp_space.set_name(reserved_temporary_space_name);
+ srv_tmp_space.set_name("innodb_temporary");
srv_tmp_space.set_path(srv_data_home);
-
- /* Create the filespace flags with the temp flag set. */
- fsp_flags = fsp_flags_init(
- univ_page_size, false, false, false, true, false, 0, 0);
- srv_tmp_space.set_flags(fsp_flags);
+ srv_tmp_space.set_flags(FSP_FLAGS_PAGE_SSIZE());
if (!srv_tmp_space.parse_params(innobase_temp_data_file_path, false)) {
DBUG_RETURN(innobase_init_abort());
@@ -4545,9 +4290,7 @@ innobase_change_buffering_inited_ok:
srv_log_file_size = (ib_uint64_t) innobase_log_file_size;
if (UNIV_PAGE_SIZE_DEF != srv_page_size) {
- ib::warn() << "innodb-page-size has been changed from the"
- " default value " << UNIV_PAGE_SIZE_DEF << " to "
- << srv_page_size << ".";
+ ib::info() << "innodb_page_size=" << srv_page_size;
}
if (srv_log_write_ahead_size > srv_page_size) {
@@ -4713,12 +4456,6 @@ innobase_change_buffering_inited_ok:
}
*/
- if (!srv_read_only_mode) {
- mysql_thread_create(thd_destructor_thread_key,
- &thd_destructor_thread,
- NULL, thd_destructor_proxy, NULL);
- }
-
/* Since we in this module access directly the fields of a trx
struct, and due to different headers and flags it might happen that
ib_mutex_t has a different size in this module and in InnoDB
@@ -4739,14 +4476,16 @@ innobase_change_buffering_inited_ok:
}
if (err != DB_SUCCESS) {
+ innodb_shutdown();
DBUG_RETURN(innobase_init_abort());
+ } else if (!srv_read_only_mode) {
+ mysql_thread_create(thd_destructor_thread_key,
+ &thd_destructor_thread,
+ NULL, thd_destructor_proxy, NULL);
+ while (!thd_destructor_myvar)
+ os_thread_sleep(20);
}
-#ifdef MYSQL_ENCRYPTION
- /* Create mutex to protect encryption master_key_id. */
- mutex_create(LATCH_ID_MASTER_KEY_ID_MUTEX, &master_key_id_mutex);
-#endif
-
/* Adjust the innodb_undo_logs config object */
innobase_undo_logs_init_default_max();
@@ -4850,21 +4589,17 @@ innobase_end(
hash_table_free(innobase_open_tables);
innobase_open_tables = NULL;
-#ifdef MYSQL_ENCRYPTION
- mutex_free(&master_key_id_mutex);
-#endif
-
if (!abort_loop && thd_destructor_myvar) {
// may be UNINSTALL PLUGIN statement
thd_destructor_myvar->abort = 1;
mysql_cond_broadcast(thd_destructor_myvar->current_cond);
}
- if (innobase_shutdown_for_mysql() != DB_SUCCESS) {
- err = 1;
- }
-
+ innodb_shutdown();
innobase_space_shutdown();
+ if (!srv_read_only_mode) {
+ pthread_join(thd_destructor_thread, NULL);
+ }
mysql_mutex_destroy(&innobase_share_mutex);
mysql_mutex_destroy(&commit_cond_m);
@@ -5759,14 +5494,8 @@ innobase_kill_query(
trx_mutex_taken = true;
}
-#ifdef UNIV_DEBUG
- dberr_t err =
-#endif
lock_trx_handle_wait(trx, true, true);
- ut_ad(err == DB_SUCCESS || err == DB_LOCK_WAIT
- || err == DB_DEADLOCK);
-
if (lock_mutex_taken) {
lock_mutex_exit();
}
@@ -6887,28 +6616,6 @@ ha_innobase::open(
is_part = NULL;
}
-#ifdef MYSQL_ENCRYPTION
- /* For encrypted table, check if the encryption info in data
- file can't be retrieved properly, mark it as corrupted. */
- if (ib_table != NULL
- && dict_table_is_encrypted(ib_table)
- && ib_table->ibd_file_missing
- && !dict_table_is_discarded(ib_table)) {
-
- /* Mark this table as corrupted, so the drop table
- or force recovery can still use it, but not others. */
-
- dict_table_close(ib_table, FALSE, FALSE);
- ib_table = NULL;
- is_part = NULL;
-
- free_share(m_share);
- my_error(ER_CANNOT_FIND_KEY_IN_KEYRING, MYF(0));
-
- DBUG_RETURN(HA_ERR_TABLE_CORRUPT);
- }
-#endif
-
if (NULL == ib_table) {
if (is_part) {
@@ -7194,34 +6901,6 @@ ha_innobase::open(
}
info(HA_STATUS_NO_LOCK | HA_STATUS_VARIABLE | HA_STATUS_CONST);
-
-#ifdef MYSQL_COMPRESSION
- dberr_t err = fil_set_compression(m_prebuilt->table,
- table->s->compress.str);
-
- switch (err) {
- case DB_NOT_FOUND:
- case DB_UNSUPPORTED:
- /* We will do another check before the create
- table and push the error to the client there. */
- break;
-
- case DB_IO_NO_PUNCH_HOLE_TABLESPACE:
- /* We did the check in the 'if' above. */
-
- case DB_IO_NO_PUNCH_HOLE_FS:
- /* During open we can't check whether the FS supports
- punch hole or not, at least on Linux. */
- break;
-
- default:
- ut_error;
-
- case DB_SUCCESS:
- break;
- }
-#endif
-
DBUG_RETURN(0);
}
@@ -12030,11 +11709,6 @@ create_table_info_t::create_table_def()
/* For single-table tablespaces, we pass 0 as the space id, and then
determine the actual space id when the tablespace is created. */
- if (DICT_TF_HAS_SHARED_SPACE(m_flags)) {
- ut_ad(m_tablespace != NULL && m_tablespace[0] != '\0');
-
- space_id = fil_space_get_id_by_name(m_tablespace);
- }
/* Adjust the number of columns for the FTS hidden field */
actual_n_cols = n_cols;
@@ -12051,11 +11725,6 @@ create_table_info_t::create_table_def()
? doc_id_col : n_cols - num_v;
}
- if (strlen(m_temp_path) != 0) {
- table->dir_path_of_temp_table =
- mem_heap_strdup(table->heap, m_temp_path);
- }
-
if (DICT_TF_HAS_DATA_DIR(m_flags)) {
ut_a(strlen(m_remote_path));
@@ -12066,13 +11735,6 @@ create_table_info_t::create_table_def()
table->data_dir_path = NULL;
}
- if (DICT_TF_HAS_SHARED_SPACE(m_flags)) {
- ut_ad(strlen(m_tablespace));
- table->tablespace = mem_heap_strdup(table->heap, m_tablespace);
- } else {
- table->tablespace = NULL;
- }
-
heap = mem_heap_create(1000);
for (i = 0; i < n_cols; i++) {
@@ -12251,138 +11913,36 @@ err_col:
on re-start we don't need to restore temp-table and so no entry is
needed in SYSTEM tables. */
if (dict_table_is_temporary(table)) {
-#ifdef MYSQL_COMPRESSION
- if (m_create_info->compress.length > 0) {
- push_warning_printf(
- m_thd,
- Sql_condition::WARN_LEVEL_WARN,
- HA_ERR_UNSUPPORTED,
- "InnoDB: Compression not supported for "
- "temporary tables");
-
- err = DB_UNSUPPORTED;
+ /* Get a new table ID */
+ dict_table_assign_new_id(table, m_trx);
- dict_mem_table_free(table);
- } else if (m_create_info->encrypt_type.length > 0
- && !Encryption::is_none(
- m_create_info->encrypt_type.str)) {
-
- my_error(ER_TABLESPACE_CANNOT_ENCRYPT, MYF(0));
- err = DB_UNSUPPORTED;
- dict_mem_table_free(table);
- } else {
-#endif /* MYSQL_COMPRESSION */
- /* Get a new table ID */
- dict_table_assign_new_id(table, m_trx);
-
- /* Create temp tablespace if configured. */
- err = dict_build_tablespace_for_table(table, NULL);
+ /* Create temp tablespace if configured. */
+ err = dict_build_tablespace_for_table(table, NULL);
- if (err == DB_SUCCESS) {
- /* Temp-table are maintained in memory and so
- can_be_evicted is FALSE. */
- mem_heap_t* temp_table_heap;
+ if (err == DB_SUCCESS) {
+ /* Temp-table are maintained in memory and so
+ can_be_evicted is FALSE. */
+ mem_heap_t* temp_table_heap;
- temp_table_heap = mem_heap_create(256);
+ temp_table_heap = mem_heap_create(256);
- dict_table_add_to_cache(
- table, FALSE, temp_table_heap);
+ dict_table_add_to_cache(
+ table, FALSE, temp_table_heap);
- DBUG_EXECUTE_IF("ib_ddl_crash_during_create2",
- DBUG_SUICIDE(););
+ DBUG_EXECUTE_IF("ib_ddl_crash_during_create2",
+ DBUG_SUICIDE(););
- mem_heap_free(temp_table_heap);
- }
-#ifdef MYSQL_COMPRESSION
+ mem_heap_free(temp_table_heap);
}
-#endif
-
} else {
- const char* algorithm = NULL;
-
-#if MYSQL_COMPRESSION
- const char* algorithm = m_create_info->compress.str;
-
- if (!(m_flags2 & DICT_TF2_USE_FILE_PER_TABLE)
- && m_create_info->compress.length > 0
- && !Compression::is_none(algorithm)) {
-
- push_warning_printf(
- m_thd,
- Sql_condition::WARN_LEVEL_WARN,
- HA_ERR_UNSUPPORTED,
- "InnoDB: Compression not supported for "
- "shared tablespaces");
-
- algorithm = NULL;
-
- err = DB_UNSUPPORTED;
- dict_mem_table_free(table);
-
- } else if (Compression::validate(algorithm) != DB_SUCCESS
- || m_form->s->row_type == ROW_TYPE_COMPRESSED
- || m_create_info->key_block_size > 0) {
-
- algorithm = NULL;
- }
-
- const char* encrypt = m_create_info->encrypt_type.str;
-
- if (!(m_flags2 & DICT_TF2_USE_FILE_PER_TABLE)
- && m_create_info->encrypt_type.length > 0
- && !Encryption::is_none(encrypt)) {
-
- my_error(ER_TABLESPACE_CANNOT_ENCRYPT, MYF(0));
- err = DB_UNSUPPORTED;
- dict_mem_table_free(table);
-
- } else if (!Encryption::is_none(encrypt)) {
- /* Set the encryption flag. */
- byte* master_key = NULL;
- ulint master_key_id;
- Encryption::Version version;
-
- /* Check if keyring is ready. */
- Encryption::get_master_key(&master_key_id,
- &master_key,
- &version);
-
- if (master_key == NULL) {
- my_error(ER_CANNOT_FIND_KEY_IN_KEYRING,
- MYF(0));
- err = DB_UNSUPPORTED;
- dict_mem_table_free(table);
- } else {
- my_free(master_key);
- DICT_TF2_FLAG_SET(table,
- DICT_TF2_ENCRYPTION);
- }
- }
-#endif /* MYSQL_COMPRESSION */
-
if (err == DB_SUCCESS) {
err = row_create_table_for_mysql(
- table, algorithm, m_trx, false,
+ table, m_trx, false,
(fil_encryption_t)options->encryption,
- options->encryption_key_id);
+ (ulint)options->encryption_key_id);
}
- if (err == DB_IO_NO_PUNCH_HOLE_FS) {
-
- ut_ad(!dict_table_in_shared_tablespace(table));
-
- push_warning_printf(
- m_thd,
- Sql_condition::WARN_LEVEL_WARN,
- HA_ERR_UNSUPPORTED,
- "InnoDB: Punch hole not supported by the "
- "file system or the tablespace page size "
- "is not large enough. Compression disabled");
-
- err = DB_SUCCESS;
- }
-
DBUG_EXECUTE_IF("ib_crash_during_create_for_encryption",
DBUG_SUICIDE(););
}
@@ -12637,7 +12197,7 @@ create_table_info_t::create_option_data_directory_is_valid()
&& m_create_info->data_file_name[0] != '\0');
/* Use DATA DIRECTORY only with file-per-table. */
- if (!m_use_shared_space && !m_allow_file_per_table) {
+ if (!m_allow_file_per_table) {
push_warning(
m_thd, Sql_condition::WARN_LEVEL_WARN,
ER_ILLEGAL_HA_CREATE_OPTION,
@@ -12662,272 +12222,6 @@ create_table_info_t::create_option_data_directory_is_valid()
return(is_valid);
}
-
-#ifdef MYSQL_TABLESPACES
-#define IDENT_NAME_OK 0
-static int check_tablespace_name(const char *name)
-{
- CHARSET_INFO *cs= system_charset_info;
- return cs->cset->numchars(cs, name, name + strlen(name)) > NAME_CHAR_LEN;
-}
-
-
-/** Validate the tablespace name provided for a tablespace DDL
-@param[in] name A proposed tablespace name
-@param[in] for_table Caller is putting a table here
-@return MySQL handler error code like HA_... */
-static
-int
-validate_tablespace_name(
- const char* name,
- bool for_table)
-{
- int err = 0;
-
- /* This prefix is reserved by InnoDB for use in internal tablespace names. */
- const char reserved_space_name_prefix[] = "innodb_";
-
- if (check_tablespace_name(name) != IDENT_NAME_OK) {
- err = HA_WRONG_CREATE_OPTION;
- }
-
- /* The tablespace name cannot start with `innodb_`. */
- if (strlen(name) >= sizeof(reserved_space_name_prefix) - 1
- && 0 == memcmp(name, reserved_space_name_prefix,
- sizeof(reserved_space_name_prefix) - 1)) {
-
- /* Use a different message for reserved names */
- if (0 == strcmp(name, reserved_file_per_table_space_name)
- || 0 == strcmp(name, reserved_system_space_name)
- || 0 == strcmp(name, reserved_temporary_space_name)) {
- /* Allow these names if the caller is putting a
- table into one of these by CREATE/ALTER TABLE */
- if (!for_table) {
- my_printf_error(
- ER_WRONG_TABLESPACE_NAME,
- "InnoDB: `%s` is a reserved"
- " tablespace name.",
- MYF(0), name);
- err = HA_WRONG_CREATE_OPTION;
- }
- } else {
- my_printf_error(ER_WRONG_TABLESPACE_NAME,
- "InnoDB: A general tablespace"
- " name cannot start with `%s`.",
- MYF(0), reserved_space_name_prefix);
- err = HA_WRONG_CREATE_OPTION;
- }
- }
-
- /* The tablespace name cannot contain a '/'. */
- if (memchr(name, '/', strlen(name)) != NULL) {
- my_printf_error(ER_WRONG_TABLESPACE_NAME,
- "InnoDB: A general tablespace name cannot"
- " contain '/'.", MYF(0));
- err = HA_WRONG_CREATE_OPTION;
- }
-
- return(err);
-}
-
-/** Validate TABLESPACE option.
-@return true if valid, false if not. */
-bool
-create_table_info_t::create_option_tablespace_is_valid()
-{
- if (!m_use_shared_space) {
- return(true);
- }
-
- if (0 != validate_tablespace_name(m_create_info->tablespace, true)) {
- return(false);
- }
-
- /* Look up the tablespace name in the fil_system. */
- ulint space_id = fil_space_get_id_by_name(
- m_create_info->tablespace);
-
- if (space_id == ULINT_UNDEFINED) {
- my_printf_error(ER_TABLESPACE_MISSING,
- "InnoDB: A general tablespace named"
- " `%s` cannot be found.", MYF(0),
- m_create_info->tablespace);
- return(false);
- }
-
- /* Cannot add a second table to a file-per-table tablespace. */
- ulint fsp_flags = fil_space_get_flags(space_id);
- if (fsp_is_file_per_table(space_id, fsp_flags)) {
- my_printf_error(ER_ILLEGAL_HA_CREATE_OPTION,
- "InnoDB: Tablespace `%s` is file-per-table so no"
- " other table can be added to it.", MYF(0),
- m_create_info->tablespace);
- return(false);
- }
-
- /* If TABLESPACE=innodb_file_per_table this function is not called
- since tablespace_is_shared_space() will return false. Any other
- tablespace is incompatible with the DATA DIRECTORY phrase.
- On any ALTER TABLE that contains a DATA DIRECTORY, MySQL will issue
- a warning like "<DATA DIRECTORY> option ignored." The check below is
- needed for CREATE TABLE only. ALTER TABLE may be moving remote
- file-per-table table to a general tablespace, in which case the
- create_info->data_file_name is not null. */
- bool is_create_table = (thd_sql_command(m_thd) == SQLCOM_CREATE_TABLE);
- if (is_create_table
- && m_create_info->data_file_name != NULL
- && m_create_info->data_file_name[0] != '\0') {
- my_printf_error(ER_ILLEGAL_HA_CREATE_OPTION,
- "InnoDB: DATA DIRECTORY cannot be used"
- " with a TABLESPACE assignment.", MYF(0));
- return(false);
- }
-
- /* Temp tables only belong in temp tablespaces. */
- if (m_create_info->options & HA_LEX_CREATE_TMP_TABLE) {
- if (!FSP_FLAGS_GET_TEMPORARY(fsp_flags)) {
- my_printf_error(ER_ILLEGAL_HA_CREATE_OPTION,
- "InnoDB: Tablespace `%s` cannot contain"
- " TEMPORARY tables.", MYF(0),
- m_create_info->tablespace);
- return(false);
- }
-
- /* Restrict Compressed Temporary General tablespaces. */
- if (m_create_info->key_block_size
- || m_create_info->row_type == ROW_TYPE_COMPRESSED) {
- my_printf_error(ER_ILLEGAL_HA_CREATE_OPTION,
- "InnoDB: Temporary tablespace `%s` cannot"
- " contain COMPRESSED tables.", MYF(0),
- m_create_info->tablespace);
- return(false);
- }
- } else if (FSP_FLAGS_GET_TEMPORARY(fsp_flags)) {
- my_printf_error(ER_ILLEGAL_HA_CREATE_OPTION,
- "InnoDB: Tablespace `%s` can only contain"
- " TEMPORARY tables.", MYF(0),
- m_create_info->tablespace);
- return(false);
- }
-
- /* Make sure the physical page size of the table matches the
- file block size of the tablespace. */
- ulint block_size_needed;
- bool table_is_compressed;
- if (m_create_info->key_block_size) {
- block_size_needed = m_create_info->key_block_size * 1024;
- table_is_compressed = true;
- } else if (m_create_info->row_type == ROW_TYPE_COMPRESSED) {
- block_size_needed = ut_min(
- UNIV_PAGE_SIZE / 2,
- static_cast<ulint>(UNIV_ZIP_SIZE_MAX));
- table_is_compressed = true;
- } else {
- block_size_needed = UNIV_PAGE_SIZE;
- table_is_compressed = false;
- }
-
- const page_size_t page_size(fsp_flags);
-
- /* The compression code needs some work in order for a general
- tablespace to contain both compressed and non-compressed tables
- together in the same tablespace. The problem seems to be that
- each page is either compressed or not based on the fsp flags,
- which is shared by all tables in that general tablespace. */
- if (table_is_compressed && page_size.physical() == UNIV_PAGE_SIZE) {
- my_printf_error(ER_ILLEGAL_HA_CREATE_OPTION,
- "InnoDB: Tablespace `%s` cannot contain a"
- " COMPRESSED table", MYF(0),
- m_create_info->tablespace);
- return(false);
- }
-
- if (block_size_needed != page_size.physical()) {
- my_printf_error(ER_ILLEGAL_HA_CREATE_OPTION,
- "InnoDB: Tablespace `%s` uses block size " ULINTPF
- " and cannot contain a table with physical"
- " page size " ULINTPF, MYF(0),
- m_create_info->tablespace,
- page_size.physical(),
- block_size_needed);
- return(false);
- }
-
- return(true);
-}
-#endif
-
-#ifdef MYSQL_COMPRESSION
-/** Validate the COPMRESSION option.
-@return true if valid, false if not. */
-bool
-create_table_info_t::create_option_compression_is_valid()
-{
- dberr_t err;
- Compression compression;
-
- if (m_create_info->compress.length == 0) {
- return(true);
- }
-
- err = Compression::check(m_create_info->compress.str, &compression);
-
- if (err == DB_UNSUPPORTED) {
- push_warning_printf(
- m_thd,
- Sql_condition::WARN_LEVEL_WARN,
- ER_UNSUPPORTED_EXTENSION,
- "InnoDB: Unsupported compression algorithm '%s'",
- m_create_info->compress.str);
- return(false);
- }
-
- /* Allow Compression=NONE on any tablespace or row format. */
- if (compression.m_type == Compression::NONE) {
- return(true);
- }
-
- static char intro[] = "InnoDB: Page Compression is not supported";
-
- if (m_create_info->key_block_size != 0
- || m_create_info->row_type == ROW_TYPE_COMPRESSED) {
- push_warning_printf(
- m_thd, Sql_condition::WARN_LEVEL_WARN,
- ER_UNSUPPORTED_EXTENSION,
- "%s with row_format=compressed or"
- " key_block_size > 0", intro);
- return(false);
- }
-
- if (m_create_info->options & HA_LEX_CREATE_TMP_TABLE) {
- push_warning_printf(
- m_thd, Sql_condition::WARN_LEVEL_WARN,
- HA_ERR_UNSUPPORTED,
- "%s for temporary tables", intro);
- return(false);
- }
-
- if (tablespace_is_general_space(m_create_info)) {
- push_warning_printf(
- m_thd, Sql_condition::WARN_LEVEL_WARN,
- HA_ERR_UNSUPPORTED,
- "%s for shared general tablespaces", intro);
- return(false);
- }
-
- /* The only non-file-per-table tablespace left is the system space. */
- if (!m_use_file_per_table) {
- push_warning_printf(
- m_thd, Sql_condition::WARN_LEVEL_WARN,
- HA_ERR_UNSUPPORTED,
- "%s for the system tablespace", intro);
- return(false);
- }
-
- return(true);
-}
-#endif /* MYSQL_COMPRESSION */
-
/** Validate the create options. Check that the options KEY_BLOCK_SIZE,
ROW_FORMAT, DATA DIRECTORY, TEMPORARY & TABLESPACE are compatible with
each other and other settings. These CREATE OPTIONS are not validated
@@ -12942,29 +12236,24 @@ create_table_info_t::create_options_are_invalid()
const char* ret = NULL;
enum row_type row_format = m_create_info->row_type;
+ const bool is_temp
+ = m_create_info->options & HA_LEX_CREATE_TMP_TABLE;
ut_ad(m_thd != NULL);
- ut_ad(m_create_info != NULL);
-#ifdef MYSQL_TABLESPACES
- /* The TABLESPACE designation on a CREATE TABLE is not subject to
- non-strict-mode. If it is incorrect or is incompatible with other
- options, then we will return an error. Make sure the tablespace exists
- and is compatible with this table */
- if (!create_option_tablespace_is_valid()) {
- return("TABLESPACE");
- }
-#endif
-
- /* If innodb_strict_mode is not set don't do any more validation.
- Also, if this table is being put into a shared general tablespace
- we ALWAYS act like strict mode is ON. */
- if (!m_use_shared_space && !(THDVAR(m_thd, strict_mode))) {
+ /* If innodb_strict_mode is not set don't do any more validation. */
+ if (!THDVAR(m_thd, strict_mode)) {
return(NULL);
}
/* Check if a non-zero KEY_BLOCK_SIZE was specified. */
if (has_key_block_size) {
+ if (is_temp) {
+ my_error(ER_UNSUPPORT_COMPRESSED_TEMPORARY_TABLE,
+ MYF(0));
+ return("KEY_BLOCK_SIZE");
+ }
+
switch (m_create_info->key_block_size) {
ulint kbs_max;
case 1:
@@ -12990,11 +12279,6 @@ create_table_info_t::create_options_are_invalid()
ret = "KEY_BLOCK_SIZE";
}
- /* The following checks do not appy to shared tablespaces */
- if (m_use_shared_space) {
- break;
- }
-
/* Valid KEY_BLOCK_SIZE, check its dependencies. */
if (!m_allow_file_per_table) {
push_warning(
@@ -13029,47 +12313,39 @@ create_table_info_t::create_options_are_invalid()
other incompatibilities. */
switch (row_format) {
case ROW_TYPE_COMPRESSED:
- if (!m_use_shared_space) {
- if (!m_allow_file_per_table) {
- push_warning_printf(
- m_thd, Sql_condition::WARN_LEVEL_WARN,
- ER_ILLEGAL_HA_CREATE_OPTION,
- "InnoDB: ROW_FORMAT=%s requires"
- " innodb_file_per_table.",
- get_row_format_name(row_format));
- ret = "ROW_FORMAT";
- }
- if (srv_file_format < UNIV_FORMAT_B) {
- push_warning_printf(
- m_thd, Sql_condition::WARN_LEVEL_WARN,
- ER_ILLEGAL_HA_CREATE_OPTION,
- "InnoDB: ROW_FORMAT=%s requires"
- " innodb_file_format > Antelope.",
- get_row_format_name(row_format));
- ret = "ROW_FORMAT";
- }
+ if (is_temp) {
+ my_error(ER_UNSUPPORT_COMPRESSED_TEMPORARY_TABLE,
+ MYF(0));
+ return("ROW_FORMAT");
+ }
+ if (!m_allow_file_per_table) {
+ push_warning_printf(
+ m_thd, Sql_condition::WARN_LEVEL_WARN,
+ ER_ILLEGAL_HA_CREATE_OPTION,
+ "InnoDB: ROW_FORMAT=%s requires"
+ " innodb_file_per_table.",
+ get_row_format_name(row_format));
+ ret = "ROW_FORMAT";
+ }
+ if (srv_file_format < UNIV_FORMAT_B) {
+ push_warning_printf(
+ m_thd, Sql_condition::WARN_LEVEL_WARN,
+ ER_ILLEGAL_HA_CREATE_OPTION,
+ "InnoDB: ROW_FORMAT=%s requires"
+ " innodb_file_format > Antelope.",
+ get_row_format_name(row_format));
+ ret = "ROW_FORMAT";
}
break;
case ROW_TYPE_DYNAMIC:
- if (!m_use_shared_space) {
- if (!m_allow_file_per_table) {
- push_warning_printf(
- m_thd, Sql_condition::WARN_LEVEL_WARN,
- ER_ILLEGAL_HA_CREATE_OPTION,
- "InnoDB: ROW_FORMAT=%s requires"
- " innodb_file_per_table.",
- get_row_format_name(row_format));
- ret = "ROW_FORMAT";
- }
- if (srv_file_format < UNIV_FORMAT_B) {
- push_warning_printf(
- m_thd, Sql_condition::WARN_LEVEL_WARN,
- ER_ILLEGAL_HA_CREATE_OPTION,
- "InnoDB: ROW_FORMAT=%s requires"
- " innodb_file_format > Antelope.",
- get_row_format_name(row_format));
- ret = "ROW_FORMAT";
- }
+ if (!is_temp && srv_file_format < UNIV_FORMAT_B) {
+ push_warning_printf(
+ m_thd, Sql_condition::WARN_LEVEL_WARN,
+ ER_ILLEGAL_HA_CREATE_OPTION,
+ "InnoDB: ROW_FORMAT=%s requires"
+ " innodb_file_format > Antelope.",
+ get_row_format_name(row_format));
+ ret = "ROW_FORMAT";
}
/* FALLTRHOUGH */
case ROW_TYPE_COMPACT:
@@ -13127,25 +12403,6 @@ create_table_info_t::create_options_are_invalid()
}
}
-#ifdef MYSQL_COMPRESSION
- /* Validate the page compression parameter. */
- if (!create_option_compression_is_valid()) {
- return("COMPRESSION");
- }
-
- /* Check the encryption option. */
- if (ret == NULL && m_create_info->encrypt_type.length > 0) {
- dberr_t err;
-
- err = Encryption::validate(m_create_info->encrypt_type.str);
-
- if (err == DB_UNSUPPORTED) {
- my_error(ER_INVALID_ENCRYPTION_OPTION, MYF(0));
- ret = "ENCRYPTION";
- }
- }
-#endif
-
return(ret);
}
@@ -13306,24 +12563,16 @@ ha_innobase::update_create_info(
create_info->auto_increment_value = stats.auto_increment_value;
}
+ if (dict_table_is_temporary(m_prebuilt->table)) {
+ return;
+ }
+
/* Update the DATA DIRECTORY name from SYS_DATAFILES. */
dict_get_and_save_data_dir_path(m_prebuilt->table, false);
if (m_prebuilt->table->data_dir_path) {
create_info->data_file_name = m_prebuilt->table->data_dir_path;
}
-
- /* Update the TABLESPACE name from the Data Dictionary. */
- dict_get_and_save_space_name(m_prebuilt->table, false);
-
- /* Put this tablespace name into the create_info structure so that
- SHOW CREATE TABLE will display TABLESPACE=name. This also affects
- an ALTER TABLE which must know the current TABLESPACE so that the
- table will stay there. */
- if (m_prebuilt->table->tablespace != NULL
- && create_info->tablespace == NULL) {
- create_info->tablespace = m_prebuilt->table->tablespace;
- }
}
/*****************************************************************//**
@@ -13342,8 +12591,7 @@ innobase_fts_load_stopword(
THDVAR(thd, ft_enable_stopword), FALSE));
}
-/** Parse the table name into normal name and either temp path or remote path
-if needed.
+/** Parse the table name into normal name and remote path if needed.
@param[in] name Table name (db/table or full path).
@return 0 if successful, otherwise, error number */
int
@@ -13376,18 +12624,7 @@ create_table_info_t::parse_table_name(
}
#endif
- m_temp_path[0] = '\0';
m_remote_path[0] = '\0';
- m_tablespace[0] = '\0';
-
- /* A full path is provided by the server for TEMPORARY tables not
- targeted for a tablespace or when DATA DIRECTORY is given.
- So these two are not compatible. Likewise, DATA DIRECTORY is not
- compatible with a TABLESPACE assignment. */
- if ((m_create_info->options & HA_LEX_CREATE_TMP_TABLE)
- && !m_use_shared_space) {
- strncpy(m_temp_path, name, FN_REFLEN - 1);
- }
/* Make sure DATA DIRECTORY is compatible with other options
and set the remote path. In the case of either;
@@ -13416,21 +12653,11 @@ create_table_info_t::parse_table_name(
"INDEX DIRECTORY");
}
- /* The TABLESPACE designation has already been validated by
- create_option_tablespace_is_valid() irregardless of strict-mode.
- So it only needs to be copied now. */
- if (m_use_shared_space) {
- strncpy(m_tablespace, m_create_info->tablespace,
- NAME_LEN - 1);
- }
-
DBUG_RETURN(0);
}
/** Determine InnoDB table flags.
If strict_mode=OFF, this will adjust the flags to what should be assumed.
-However, if an existing general tablespace is being targeted, we will NOT
-assume anything or adjust these flags.
@retval true if successful, false if error */
bool
create_table_info_t::innobase_table_flags()
@@ -13438,11 +12665,14 @@ create_table_info_t::innobase_table_flags()
DBUG_ENTER("innobase_table_flags");
const char* fts_doc_id_index_bad = NULL;
- bool zip_allowed = true;
ulint zip_ssize = 0;
enum row_type row_type;
rec_format_t innodb_row_format =
get_row_format(innodb_default_row_format);
+ const bool is_temp
+ = m_create_info->options & HA_LEX_CREATE_TMP_TABLE;
+ bool zip_allowed
+ = !is_temp;
const ulint zip_ssize_max =
ut_min(static_cast<ulint>(UNIV_PAGE_SSIZE_MAX),
@@ -13461,40 +12691,6 @@ create_table_info_t::innobase_table_flags()
m_flags = 0;
m_flags2 = 0;
-#ifdef MYSQL_COMPRESSION
- /* Validate the page compression parameter. */
- if (!create_option_compression_is_valid()) {
- /* No need to do anything. Warnings were issued.
- The compresion setting will be ignored later.
- If inodb_strict_mode=ON, this is called twice unless
- there was a problem before.
- If inodb_strict_mode=OFF, this is the only call. */
- }
-#endif
-
-#ifdef MYSQL_ENCRYPTION
- /* Validate the page encryption parameter. */
- if (m_create_info->encrypt_type.length > 0) {
-
- const char* encryption = m_create_info->encrypt_type.str;
-
- if (Encryption::validate(encryption) != DB_SUCCESS) {
- /* Incorrect encryption option */
- my_error(ER_INVALID_ENCRYPTION_OPTION, MYF(0));
- DBUG_RETURN(false);
- }
-
- if (m_use_shared_space
- || (m_create_info->options & HA_LEX_CREATE_TMP_TABLE)) {
- if (!Encryption::is_none(encryption)) {
- /* Can't encrypt shared tablespace */
- my_error(ER_TABLESPACE_CANNOT_ENCRYPT, MYF(0));
- DBUG_RETURN(false);
- }
- }
- }
-#endif /* MYSQL_ENCRYPTION */
-
/* Check if there are any FTS indexes defined on this table. */
for (uint i = 0; i < m_form->s->keys; i++) {
const KEY* key = &m_form->key_info[i];
@@ -13504,8 +12700,7 @@ create_table_info_t::innobase_table_flags()
/* We don't support FTS indexes in temporary
tables. */
- if (m_create_info->options & HA_LEX_CREATE_TMP_TABLE) {
-
+ if (is_temp) {
my_error(ER_INNODB_NO_FT_TEMP_TABLE, MYF(0));
DBUG_RETURN(false);
}
@@ -13513,12 +12708,6 @@ create_table_info_t::innobase_table_flags()
if (fts_doc_id_index_bad) {
goto index_bad;
}
- } else if (key->flags & HA_SPATIAL) {
- if (m_create_info->options & HA_LEX_CREATE_TMP_TABLE
- && !m_use_file_per_table) {
- my_error(ER_TABLE_CANT_HANDLE_SPKEYS, MYF(0));
- DBUG_RETURN(false);
- }
}
if (innobase_strcasecmp(key->name, FTS_DOC_ID_INDEX_NAME)) {
@@ -13558,7 +12747,14 @@ index_bad:
}
/* Make sure compressed row format is allowed. */
- if (!m_allow_file_per_table && !m_use_shared_space) {
+ if (is_temp) {
+ push_warning(
+ m_thd, Sql_condition::WARN_LEVEL_WARN,
+ ER_ILLEGAL_HA_CREATE_OPTION,
+ "InnoDB: KEY_BLOCK_SIZE is ignored"
+ " for TEMPORARY TABLE.");
+ zip_allowed = false;
+ } else if (!m_allow_file_per_table) {
push_warning(
m_thd, Sql_condition::WARN_LEVEL_WARN,
ER_ILLEGAL_HA_CREATE_OPTION,
@@ -13567,8 +12763,7 @@ index_bad:
zip_allowed = false;
}
- if (file_format_allowed < UNIV_FORMAT_B
- && !m_use_shared_space) {
+ if (file_format_allowed < UNIV_FORMAT_B) {
push_warning(
m_thd, Sql_condition::WARN_LEVEL_WARN,
ER_ILLEGAL_HA_CREATE_OPTION,
@@ -13629,37 +12824,29 @@ index_bad:
innodb_row_format = REC_FORMAT_COMPACT;
break;
case ROW_TYPE_COMPRESSED:
- /* ROW_FORMAT=COMPRESSED requires file_per_table and
- file_format=Barracuda unless there is a target tablespace. */
- if (!m_allow_file_per_table
- && !m_use_shared_space) {
+ if (is_temp) {
+ push_warning_printf(
+ m_thd, Sql_condition::WARN_LEVEL_WARN,
+ ER_ILLEGAL_HA_CREATE_OPTION,
+ "InnoDB: ROW_FORMAT=%s is ignored for"
+ " TEMPORARY TABLE.",
+ get_row_format_name(row_type));
+ } else if (!m_allow_file_per_table) {
push_warning_printf(
m_thd, Sql_condition::WARN_LEVEL_WARN,
ER_ILLEGAL_HA_CREATE_OPTION,
"InnoDB: ROW_FORMAT=COMPRESSED requires"
" innodb_file_per_table.");
- } else if (file_format_allowed == UNIV_FORMAT_A
- && !m_use_shared_space) {
+ } else if (file_format_allowed == UNIV_FORMAT_A) {
push_warning_printf(
m_thd, Sql_condition::WARN_LEVEL_WARN,
ER_ILLEGAL_HA_CREATE_OPTION,
"InnoDB: ROW_FORMAT=COMPRESSED requires"
" innodb_file_format > Antelope.");
-
} else {
- switch(row_type) {
- case ROW_TYPE_COMPRESSED:
- innodb_row_format = REC_FORMAT_COMPRESSED;
- break;
- case ROW_TYPE_DYNAMIC:
- innodb_row_format = REC_FORMAT_DYNAMIC;
- break;
- default:
- /* Not possible, avoid compiler warning */
- break;
- }
- break; /* Correct row_format */
+ innodb_row_format = REC_FORMAT_COMPRESSED;
+ break;
}
zip_allowed = false;
/* fall through to set row_type = DYNAMIC */
@@ -13687,28 +12874,28 @@ index_bad:
zip_allowed = false;
}
+ ut_ad(!is_temp || !zip_allowed);
+ ut_ad(!is_temp || innodb_row_format != REC_FORMAT_COMPRESSED);
+
/* Set the table flags */
if (!zip_allowed) {
zip_ssize = 0;
}
- if (m_create_info->options & HA_LEX_CREATE_TMP_TABLE) {
+ if (is_temp) {
m_flags2 |= DICT_TF2_TEMPORARY;
+ } else if (m_use_file_per_table) {
+ m_flags2 |= DICT_TF2_USE_FILE_PER_TABLE;
}
/* Set the table flags */
dict_tf_set(&m_flags, innodb_row_format, zip_ssize,
- m_use_data_dir, m_use_shared_space,
+ m_use_data_dir,
options->page_compressed,
options->page_compression_level == 0 ?
- default_compression_level : options->page_compression_level,
+ default_compression_level : static_cast<ulint>(options->page_compression_level),
0);
- if (m_use_file_per_table) {
- ut_ad(!m_use_shared_space);
- m_flags2 |= DICT_TF2_USE_FILE_PER_TABLE;
- }
-
/* Set the flags2 when create table or alter tables */
m_flags2 |= DICT_TF2_FTS_AUX_HEX_NAME;
DBUG_EXECUTE_IF("innodb_test_wrong_fts_aux_table_name",
@@ -13891,42 +13078,25 @@ void
create_table_info_t::set_tablespace_type(
bool table_being_altered_is_file_per_table)
{
- /* Note whether this table will be created using a shared,
- general or system tablespace. */
- m_use_shared_space = tablespace_is_shared_space(m_create_info);
-
/** Allow file_per_table for this table either because:
1) the setting innodb_file_per_table=on,
- 2) the table being altered is currently file_per_table
- 3) explicitly requested by tablespace=innodb_file_per_table. */
+ 2) the table being altered is currently file_per_table */
m_allow_file_per_table =
m_innodb_file_per_table
- || table_being_altered_is_file_per_table
- || tablespace_is_file_per_table(m_create_info);
-
- /* All noncompresed temporary tables will be put into the
- system temporary tablespace. */
- bool is_noncompressed_temporary =
- m_create_info->options & HA_LEX_CREATE_TMP_TABLE
- && !(m_create_info->row_type == ROW_TYPE_COMPRESSED
- || m_create_info->key_block_size > 0);
+ || table_being_altered_is_file_per_table;
/* Ignore the current innodb-file-per-table setting if we are
- creating a temporary, non-compressed table or if the
- TABLESPACE= phrase is using an existing shared tablespace. */
+ creating a temporary table. */
m_use_file_per_table =
m_allow_file_per_table
- && !is_noncompressed_temporary
- && !m_use_shared_space;
+ && !(m_create_info->options & HA_LEX_CREATE_TMP_TABLE);
/* DATA DIRECTORY must have m_use_file_per_table but cannot be
used with TEMPORARY tables. */
m_use_data_dir =
m_use_file_per_table
- && !(m_create_info->options & HA_LEX_CREATE_TMP_TABLE)
&& (m_create_info->data_file_name != NULL)
&& (m_create_info->data_file_name[0] != '\0');
- ut_ad(!(m_use_shared_space && m_use_data_dir));
}
/** Initialize the create_table_info_t object.
@@ -14352,9 +13522,7 @@ ha_innobase::create(
{
int error;
char norm_name[FN_REFLEN]; /* {database}/{tablename} */
- char temp_path[FN_REFLEN]; /* Absolute path of temp frm */
char remote_path[FN_REFLEN]; /* Absolute path of table */
- char tablespace[NAME_LEN]; /* Tablespace name identifier */
trx_t* trx;
DBUG_ENTER("ha_innobase::create");
@@ -14362,9 +13530,7 @@ ha_innobase::create(
form,
create_info,
norm_name,
- temp_path,
- remote_path,
- tablespace);
+ remote_path);
/* Initialize the object. */
if ((error = info.initialize())) {
@@ -14457,16 +13623,6 @@ ha_innobase::discard_or_import_tablespace(
DBUG_RETURN(HA_ERR_TABLE_NEEDS_UPGRADE);
}
- if (DICT_TF_HAS_SHARED_SPACE(dict_table->flags)) {
- my_printf_error(ER_NOT_ALLOWED_COMMAND,
- "InnoDB: Cannot %s table `%s` because it is in"
- " a general tablespace. It must be file-per-table.",
- MYF(0), discard ? "discard" : "import",
- dict_table->name.m_name);
-
- DBUG_RETURN(HA_ERR_NOT_ALLOWED_COMMAND);
- }
-
TrxInInnoDB trx_in_innodb(m_prebuilt->trx);
if (trx_in_innodb.is_aborted()) {
@@ -14799,410 +13955,6 @@ ha_innobase::delete_table(
DBUG_RETURN(convert_error_code_to_mysql(err, 0, NULL));
}
-#ifdef MYSQL_TABLESPACES
-/** Validate the parameters in st_alter_tablespace
-before using them in InnoDB tablespace functions.
-@param[in] thd Connection
-@param[in] alter_info How to do the command.
-@return MySQL handler error code like HA_... */
-static
-int
-validate_create_tablespace_info(
- THD* thd,
- st_alter_tablespace* alter_info)
-{
- ulint space_id;
-
- /* The parser ensures that these fields are provided. */
- ut_a(alter_info->tablespace_name);
- ut_a(alter_info->data_file_name);
-
- if (high_level_read_only) {
- return(HA_ERR_INNODB_READ_ONLY);
- }
-
- /* From this point forward, push a warning for each problem found
- instead of returning immediately*/
- int error = validate_tablespace_name(
- alter_info->tablespace_name, false);
-
- /* Make sure the tablespace is not already open. */
- space_id = fil_space_get_id_by_name(alter_info->tablespace_name);
- if (space_id != ULINT_UNDEFINED) {
- my_printf_error(ER_TABLESPACE_EXISTS,
- "InnoDB: A tablespace named `%s`"
- " already exists.", MYF(0),
- alter_info->tablespace_name);
- error = HA_ERR_TABLESPACE_EXISTS;
- }
- if (alter_info->file_block_size) {
- /* Check for a bad file block size. */
- if (!ut_is_2pow(alter_info->file_block_size)
- || alter_info->file_block_size < UNIV_ZIP_SIZE_MIN
- || alter_info->file_block_size > UNIV_PAGE_SIZE_MAX) {
- my_printf_error(ER_ILLEGAL_HA_CREATE_OPTION,
- "InnoDB does not support"
- " FILE_BLOCK_SIZE=%llu", MYF(0),
- alter_info->file_block_size);
- error = HA_WRONG_CREATE_OPTION;
-
- /* Don't allow a file block size larger than UNIV_PAGE_SIZE. */
- } else if (alter_info->file_block_size > UNIV_PAGE_SIZE) {
- my_printf_error(ER_ILLEGAL_HA_CREATE_OPTION,
- "InnoDB: Cannot create a tablespace"
- " with FILE_BLOCK_SIZE=%llu because"
- " INNODB_PAGE_SIZE=%lu.", MYF(0),
- alter_info->file_block_size,
- UNIV_PAGE_SIZE);
- error = HA_WRONG_CREATE_OPTION;
-
- /* Don't allow a compressed tablespace when page size > 16k. */
- } else if (UNIV_PAGE_SIZE > UNIV_PAGE_SIZE_DEF
- && alter_info->file_block_size != UNIV_PAGE_SIZE) {
- my_printf_error(ER_ILLEGAL_HA_CREATE_OPTION,
- "InnoDB: Cannot create a COMPRESSED"
- " tablespace when innodb_page_size >"
- " 16k.", MYF(0));
- error = HA_WRONG_CREATE_OPTION;
- }
- }
-
- /* Validate the ADD DATAFILE name. */
- char* filepath = mem_strdup(alter_info->data_file_name);
- os_normalize_path(filepath);
-
- /* It must end with '.ibd' and contain a basename of at least
- 1 character before the.ibd extension. */
- ulint dirname_len = dirname_length(filepath);
- const char* basename = filepath + dirname_len;
- ulint basename_len = strlen(basename);
- if (basename_len < 5) {
- my_error(ER_WRONG_FILE_NAME, MYF(0),
- alter_info->data_file_name);
- ut_free(filepath);
- return(HA_WRONG_CREATE_OPTION);
- }
-
- if (memcmp(&basename[basename_len - 4], DOT_IBD, 5)) {
- my_error(ER_WRONG_FILE_NAME, MYF(0),
- alter_info->data_file_name);
- my_printf_error(ER_WRONG_FILE_NAME,
- "An IBD filepath must end with `.ibd`.",
- MYF(0));
- ut_free(filepath);
- return(HA_WRONG_CREATE_OPTION);
- }
-
- /* Do not allow an invalid colon in the file name. */
- const char* colon = strchr(filepath, ':');
- if (colon != NULL) {
-#ifdef _WIN32
- /* Do not allow names like "C:name.ibd" because it
- specifies the "C:" drive but allows a relative location.
- It should be like "c:\". If a single colon is used it must
- be the second byte the the third byte must be a separator. */
- if (colon != &filepath[1]
- || (colon[1] != OS_PATH_SEPARATOR)
- || NULL != strchr(&colon[1], ':')) {
-#endif /* _WIN32 */
- my_error(ER_WRONG_FILE_NAME, MYF(0),
- alter_info->data_file_name);
- my_printf_error(ER_WRONG_FILE_NAME,
- "Invalid use of ':'.", MYF(0));
- ut_free(filepath);
- return(HA_WRONG_CREATE_OPTION);
-#ifdef _WIN32
- }
-#endif /* _WIN32 */
- }
-
-#ifndef _WIN32
- /* On Non-Windows platforms, '\\' is a valid file name character.
- But for InnoDB datafiles, we always assume it is a directory
- separator and convert these to '/' */
- if (strchr(alter_info->data_file_name, '\\') != NULL) {
- ib::warn() << "Converting backslash to forward slash in"
- " ADD DATAFILE " << alter_info->data_file_name;
- }
-#endif /* _WIN32 */
-
- /* The directory path must be pre-existing. */
- Folder folder(filepath, dirname_len);
- ut_free(filepath);
- if (!folder.exists()) {
- my_error(ER_WRONG_FILE_NAME, MYF(0),
- alter_info->data_file_name);
- my_printf_error(ER_WRONG_FILE_NAME,
- "The directory does not exist.", MYF(0));
- return(HA_WRONG_CREATE_OPTION);
- }
-
- /* CREATE TABLESPACE...ADD DATAFILE can be inside but not under
- the datadir.*/
- if (folder_mysql_datadir > folder) {
- my_error(ER_WRONG_FILE_NAME, MYF(0),
- alter_info->data_file_name);
- my_printf_error(ER_WRONG_FILE_NAME,
- "CREATE TABLESPACE data file"
- " cannot be under the datadir.", MYF(0));
- error = HA_WRONG_CREATE_OPTION;
- }
-
- return(error);
-}
-
-/** CREATE a tablespace.
-@param[in] hton Handlerton of InnoDB
-@param[in] thd Connection
-@param[in] alter_info How to do the command
-@return MySQL error code*/
-static
-int
-innobase_create_tablespace(
- handlerton* hton,
- THD* thd,
- st_alter_tablespace* alter_info)
-{
- trx_t* trx;
- int error=0;
- Tablespace tablespace;
-
- DBUG_ENTER("innobase_create_tablespace");
- DBUG_ASSERT(hton == innodb_hton_ptr);
-
- /* Be sure the input parameters are valid before continuing. */
- error = validate_create_tablespace_info(thd, alter_info);
- if (error) {
- DBUG_RETURN(error);
- }
-
- /* Create the tablespace object. */
- tablespace.set_name(alter_info->tablespace_name);
-
- dberr_t err = tablespace.add_datafile(alter_info->data_file_name);
- if (err != DB_SUCCESS) {
- DBUG_RETURN(convert_error_code_to_mysql(err, 0, NULL));
- }
-
- /* Get the transaction associated with the current thd and make
- sure it will not block this DDL. */
- trx_t* parent_trx = check_trx_exists(thd);
-
- /* In case MySQL calls this in the middle of a SELECT
- query, release possible adaptive hash latch to avoid
- deadlocks of threads */
- trx_search_latch_release_if_reserved(parent_trx);
-
- /* Allocate a new transaction for this DDL */
- trx = innobase_trx_allocate(thd);
- ++trx->will_lock;
-
- trx_start_if_not_started(trx, true);
- row_mysql_lock_data_dictionary(trx);
-
- /* In FSP_FLAGS, a zip_ssize of zero means that the tablespace
- holds non-compresssed tables. A non-zero zip_ssize means that
- the general tablespace can ONLY contain compressed tables. */
- ulint zip_size = static_cast<ulint>(alter_info->file_block_size);
- ut_ad(zip_size <= UNIV_PAGE_SIZE_MAX);
- if (zip_size == 0) {
- zip_size = UNIV_PAGE_SIZE;
- }
-
- bool zipped = (zip_size != UNIV_PAGE_SIZE);
- page_size_t page_size(zip_size, UNIV_PAGE_SIZE, zipped);
- bool atomic_blobs = page_size.is_compressed();
-
- /* Create the filespace flags */
- ulint fsp_flags = fsp_flags_init(
- page_size, /* page sizes and a flag if compressed */
- atomic_blobs, /* needed only for compressed tables */
- false, /* This is not a file-per-table tablespace */
- true, /* This is a general shared tablespace */
- false, /* Temporary General Tablespaces not allowed */
- false, /* Page compression is not used. */
- 0, /* Page compression level 0 */
- 0);
-
- tablespace.set_flags(fsp_flags);
-
- err = dict_build_tablespace(&tablespace);
- if (err != DB_SUCCESS) {
- error = convert_error_code_to_mysql(err, 0, NULL);
- trx_rollback_for_mysql(trx);
- goto cleanup;
- }
-
- innobase_commit_low(trx);
-
-cleanup:
- row_mysql_unlock_data_dictionary(trx);
- trx_free_for_mysql(trx);
-
- DBUG_RETURN(error);
-}
-
-/** DROP a tablespace.
-@param[in] hton Handlerton of InnoDB
-@param[in] thd Connection
-@param[in] alter_info How to do the command
-@return MySQL error code*/
-static
-int
-innobase_drop_tablespace(
- handlerton* hton,
- THD* thd,
- st_alter_tablespace* alter_info)
-{
- trx_t* trx;
- dberr_t err;
- int error = 0;
- ulint space_id;
-
- DBUG_ENTER("innobase_drop_tablespace");
- DBUG_ASSERT(hton == innodb_hton_ptr);
-
- if (srv_read_only_mode) {
- DBUG_RETURN(HA_ERR_INNODB_READ_ONLY);
- }
-
- error = validate_tablespace_name(alter_info->tablespace_name, false);
- if (error != 0) {
- DBUG_RETURN(error);
- }
-
- /* Be sure that this tablespace is known and valid. */
- space_id = fil_space_get_id_by_name(alter_info->tablespace_name);
- if (space_id == ULINT_UNDEFINED) {
-
- space_id = dict_space_get_id(alter_info->tablespace_name);
- if (space_id == ULINT_UNDEFINED) {
- DBUG_RETURN(HA_ERR_NO_SUCH_TABLE);
- // DBUG_RETURN(HA_ERR_TABLESPACE_MISSING);
- }
-
- /* The datafile is not open but the tablespace is in
- sys_tablespaces, so we can try to drop the metadata. */
- }
-
- /* The tablespace can only be dropped if it is empty. */
- if (!dict_space_is_empty(space_id)) {
- DBUG_RETURN(HA_ERR_TABLE_READONLY);
- //DBUG_RETURN(HA_ERR_TABLESPACE_IS_NOT_EMPTY);
- }
-
- /* Get the transaction associated with the current thd and make sure
- it will not block this DDL. */
- trx_t* parent_trx = check_trx_exists(thd);
-
- /* In case MySQL calls this in the middle of a SELECT
- query, release possible adaptive hash latch to avoid
- deadlocks of threads */
- trx_search_latch_release_if_reserved(parent_trx);
-
- /* Allocate a new transaction for this DDL */
- trx = innobase_trx_allocate(thd);
- ++trx->will_lock;
-
- trx_start_if_not_started(trx, true);
- row_mysql_lock_data_dictionary(trx);
-
- /* Update SYS_TABLESPACES and SYS_DATAFILES */
- err = dict_delete_tablespace_and_datafiles(space_id, trx);
- if (err != DB_SUCCESS) {
- ib::error() << "Unable to delete the dictionary entries"
- " for tablespace `" << alter_info->tablespace_name
- << "`, Space ID " << space_id;
- goto have_error;
- }
-
- /* Delete the physical files, fil_space_t & fil_node_t entries. */
- err = fil_delete_tablespace(space_id, BUF_REMOVE_FLUSH_NO_WRITE);
- switch (err) {
- case DB_TABLESPACE_NOT_FOUND:
- /* OK if the physical file is mising.
- We deleted the metadata. */
- case DB_SUCCESS:
- innobase_commit_low(trx);
- break;
- default:
- ib::error() << "Unable to delete the tablespace `"
- << alter_info->tablespace_name
- << "`, Space ID " << space_id;
-have_error:
- error = convert_error_code_to_mysql(err, 0, NULL);
- trx_rollback_for_mysql(trx);
- }
-
- row_mysql_unlock_data_dictionary(trx);
- trx_free_for_mysql(trx);
-
- DBUG_RETURN(error);
-}
-
-/** This API handles CREATE, ALTER & DROP commands for InnoDB tablespaces.
-@param[in] hton Handlerton of InnoDB
-@param[in] thd Connection
-@param[in] alter_info How to do the command
-@return MySQL error code*/
-static
-int
-innobase_alter_tablespace(
- handlerton* hton,
- THD* thd,
- st_alter_tablespace* alter_info)
-{
- int error; /* return zero for success */
- DBUG_ENTER("innobase_alter_tablespace");
-
- switch (alter_info->ts_cmd_type) {
- case CREATE_TABLESPACE:
- error = innobase_create_tablespace(hton, thd, alter_info);
- break;
-
- case DROP_TABLESPACE:
- error = innobase_drop_tablespace(hton, thd, alter_info);
- break;
-
- default:
- error = HA_ADMIN_NOT_IMPLEMENTED;
- }
-
- if (error) {
- /* These are the most common message params */
- const char* object_type = "TABLESPACE";
- const char* object = alter_info->tablespace_name;
-
- /* Modify those params as needed. */
- switch (alter_info->ts_cmd_type) {
- case DROP_TABLESPACE:
- ib_errf(thd, IB_LOG_LEVEL_ERROR,
- ER_DROP_FILEGROUP_FAILED,
- "%s %s", object_type, object);
- break;
- case CREATE_TABLESPACE:
- ib_errf(thd, IB_LOG_LEVEL_ERROR,
- ER_CREATE_FILEGROUP_FAILED,
- "%s %s", object_type, object);
- break;
- case CREATE_LOGFILE_GROUP:
- my_error(ER_ILLEGAL_HA_CREATE_OPTION, MYF(0),
- innobase_hton_name, "LOGFILE GROUP");
- break;
- case ALTER_TABLESPACE:
- case ALTER_ACCESS_MODE_TABLESPACE:
- case DROP_LOGFILE_GROUP:
- case ALTER_LOGFILE_GROUP:
- case CHANGE_FILE_TABLESPACE:
- case TS_CMD_NOT_DEFINED:
- break;
- }
- }
-
- DBUG_RETURN(error);
-}
-#endif /* MYSQL_TABLESPACES */
-
/** 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
@@ -21888,6 +20640,25 @@ wsrep_fake_trx_id(
#endif /* WITH_WSREP */
+/** Update the innodb_use_trim parameter.
+@param[in] thd thread handle
+@param[in] var system variable
+@param[out] var_ptr current value
+@param[in] save immediate result from check function */
+static
+void
+innodb_use_trim_update(
+ THD* thd,
+ struct st_mysql_sys_var* var,
+ void* var_ptr,
+ const void* save)
+{
+ srv_use_trim = *static_cast<const my_bool*>(save);
+
+ push_warning(thd, Sql_condition::WARN_LEVEL_WARN,
+ HA_ERR_WRONG_COMMAND, deprecated_use_trim);
+}
+
/* plugin options */
static MYSQL_SYSVAR_ENUM(checksum_algorithm, srv_checksum_algorithm,
@@ -22545,13 +21316,6 @@ static MYSQL_SYSVAR_ULONG(force_recovery, srv_force_recovery,
"Helps to save your data in case the disk image of the database becomes corrupt.",
NULL, NULL, 0, 0, 6, 0);
-#ifndef DBUG_OFF
-static MYSQL_SYSVAR_ULONG(force_recovery_crash, srv_force_recovery_crash,
- PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
- "Kills the server during crash recovery.",
- NULL, NULL, 0, 0, 100, 0);
-#endif /* !DBUG_OFF */
-
static MYSQL_SYSVAR_ULONG(page_size, srv_page_size,
PLUGIN_VAR_OPCMDARG | PLUGIN_VAR_READONLY,
"Page size to use for all InnoDB tablespaces.",
@@ -22788,11 +21552,6 @@ static MYSQL_SYSVAR_BOOL(disable_background_merge,
PLUGIN_VAR_NOCMDARG | PLUGIN_VAR_RQCMDARG,
"Disable change buffering merges by the master thread",
NULL, NULL, FALSE);
-
-static MYSQL_SYSVAR_ENUM(compress_debug, srv_debug_compress,
- PLUGIN_VAR_RQCMDARG,
- "Compress all tables, without specifying the COMPRESS table attribute",
- NULL, NULL, Compression::NONE, &innodb_debug_compress_typelib);
#endif /* UNIV_DEBUG || UNIV_IBUF_DEBUG */
static MYSQL_SYSVAR_ULONG(buf_dump_status_frequency, srv_buf_dump_status_frequency,
@@ -22994,8 +21753,8 @@ static MYSQL_SYSVAR_BOOL(force_primary_key,
static MYSQL_SYSVAR_BOOL(use_trim, srv_use_trim,
PLUGIN_VAR_OPCMDARG,
- "Use trim. Default FALSE.",
- NULL, NULL, FALSE);
+ "Deallocate (punch_hole|trim) unused portions of the page compressed page (on by default)",
+ NULL, innodb_use_trim_update, TRUE);
static const char *page_compression_algorithms[]= { "none", "zlib", "lz4", "lzo", "lzma", "bzip2", "snappy", 0 };
static TYPELIB page_compression_algorithms_typelib=
@@ -23199,9 +21958,6 @@ static struct st_mysql_sys_var* innobase_system_variables[]= {
MYSQL_SYSVAR(flush_log_at_trx_commit),
MYSQL_SYSVAR(flush_method),
MYSQL_SYSVAR(force_recovery),
-#ifndef DBUG_OFF
- MYSQL_SYSVAR(force_recovery_crash),
-#endif /* !DBUG_OFF */
MYSQL_SYSVAR(fill_factor),
MYSQL_SYSVAR(ft_cache_size),
MYSQL_SYSVAR(ft_total_cache_size),
@@ -23329,7 +22085,6 @@ static struct st_mysql_sys_var* innobase_system_variables[]= {
MYSQL_SYSVAR(data_file_size_debug),
MYSQL_SYSVAR(fil_make_page_dirty_debug),
MYSQL_SYSVAR(saved_page_number_debug),
- MYSQL_SYSVAR(compress_debug),
MYSQL_SYSVAR(disable_resize_buffer_pool_debug),
MYSQL_SYSVAR(page_cleaner_disabled_debug),
MYSQL_SYSVAR(dict_stats_disabled_debug),
diff --git a/storage/innobase/handler/ha_innodb.h b/storage/innobase/handler/ha_innodb.h
index cef39e594b9..d11d5913f34 100644
--- a/storage/innobase/handler/ha_innodb.h
+++ b/storage/innobase/handler/ha_innodb.h
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 2000, 2016, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2013, 2016, MariaDB Corporation.
+Copyright (c) 2013, 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
@@ -23,19 +23,6 @@ this program; if not, write to the Free Software Foundation, Inc.,
system clustered index when there is no primary key. */
extern const char innobase_index_reserve_name[];
-/* "innodb_file_per_table" tablespace name is reserved by InnoDB in order
-to explicitly create a file_per_table tablespace for the table. */
-extern const char reserved_file_per_table_space_name[];
-
-/* "innodb_system" tablespace name is reserved by InnoDB for the
-system tablespace which uses space_id 0 and stores extra types of
-system pages like UNDO and doublewrite. */
-extern const char reserved_system_space_name[];
-
-/* "innodb_temporary" tablespace name is reserved by InnoDB for the
-predefined shared temporary tablespace. */
-extern const char reserved_temporary_space_name[];
-
/* Structure defines translation table between mysql index and InnoDB
index structures */
struct innodb_idx_translate_t {
@@ -677,52 +664,6 @@ extern const char reserved_file_per_table_space_name[];
//extern "C" int wsrep_trx_is_aborting(void *thd_ptr);
#endif
-/** Check if the explicit tablespace targeted is file_per_table.
-@param[in] create_info Metadata for the table to create.
-@return true if the table is intended to use a file_per_table tablespace. */
-UNIV_INLINE
-bool
-tablespace_is_file_per_table(
- const HA_CREATE_INFO* create_info)
-{
- return(create_info->tablespace != NULL
- && (0 == strcmp(create_info->tablespace,
- reserved_file_per_table_space_name)));
-}
-
-/** Check if table will be explicitly put in an existing shared general
-or system tablespace.
-@param[in] create_info Metadata for the table to create.
-@return true if the table will use a shared general or system tablespace. */
-UNIV_INLINE
-bool
-tablespace_is_shared_space(
-const HA_CREATE_INFO* create_info)
-{
- return(create_info->tablespace != NULL
- && create_info->tablespace[0] != '\0'
- && (0 != strcmp(create_info->tablespace,
- reserved_file_per_table_space_name)));
-}
-
-/** Check if table will be explicitly put in a general tablespace.
-@param[in] create_info Metadata for the table to create.
-@return true if the table will use a general tablespace. */
-UNIV_INLINE
-bool
-tablespace_is_general_space(
- const HA_CREATE_INFO* create_info)
-{
- return(create_info->tablespace != NULL
- && create_info->tablespace[0] != '\0'
- && (0 != strcmp(create_info->tablespace,
- reserved_file_per_table_space_name))
- && (0 != strcmp(create_info->tablespace,
- reserved_temporary_space_name))
- && (0 != strcmp(create_info->tablespace,
- reserved_system_space_name)));
-}
-
/** Parse hint for table and its indexes, and update the information
in dictionary.
@param[in] thd Connection thread
@@ -747,16 +688,12 @@ public:
TABLE* form,
HA_CREATE_INFO* create_info,
char* table_name,
- char* temp_path,
- char* remote_path,
- char* tablespace)
+ char* remote_path)
:m_thd(thd),
m_form(form),
m_create_info(create_info),
m_table_name(table_name),
- m_temp_path(temp_path),
m_remote_path(remote_path),
- m_tablespace(tablespace),
m_innodb_file_per_table(srv_file_per_table)
{}
@@ -795,9 +732,6 @@ public:
/** Validate TABLESPACE option. */
bool create_option_tablespace_is_valid();
- /** Validate COMPRESSION option. */
- bool create_option_compression_is_valid();
-
/** Prepare to create a table. */
int prepare_create_table(const char* name);
@@ -868,19 +802,10 @@ private:
/** Table name */
char* m_table_name;
- /** If this is a table explicitly created by the user with the
- TEMPORARY keyword, then this parameter is the dir path where the
- table should be placed if we create an .ibd file for it
- (no .ibd extension in the path, though).
- Otherwise this is a zero length-string */
- char* m_temp_path;
/** Remote path (DATA DIRECTORY) or zero length-string */
char* m_remote_path;
- /** Tablespace name or zero length-string. */
- char* m_tablespace;
-
/** Local copy of srv_file_per_table. */
bool m_innodb_file_per_table;
@@ -897,9 +822,6 @@ private:
/** Using DATA DIRECTORY */
bool m_use_data_dir;
- /** Using a Shared General Tablespace */
- bool m_use_shared_space;
-
/** Table flags */
ulint m_flags;
diff --git a/storage/innobase/handler/ha_innopart.cc b/storage/innobase/handler/ha_innopart.cc
index 09a60be1577..6cdbd226b24 100644
--- a/storage/innobase/handler/ha_innopart.cc
+++ b/storage/innobase/handler/ha_innopart.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
-Copyright (c) 2016, MariaDB Corporation.
+Copyright (c) 2016, 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
@@ -2464,35 +2464,6 @@ ha_innopart::update_part_elem(
}
part_elem->index_file_name = NULL;
- dict_get_and_save_space_name(ib_table, false);
- if (ib_table->tablespace != NULL) {
- ut_ad(part_elem->tablespace_name == NULL
- || 0 == strcmp(part_elem->tablespace_name,
- ib_table->tablespace));
- if (part_elem->tablespace_name == NULL
- || strcmp(ib_table->tablespace,
- part_elem->tablespace_name) != 0) {
-
- /* Play safe and allocate memory from TABLE and copy
- instead of expose the internal data dictionary. */
- part_elem->tablespace_name =
- strdup_root(&table->mem_root,
- ib_table->tablespace);
- }
- }
- else {
- ut_ad(part_elem->tablespace_name == NULL
- || 0 == strcmp(part_elem->tablespace_name,
- "innodb_file_per_table"));
- if (part_elem->tablespace_name != NULL
- && 0 != strcmp(part_elem->tablespace_name,
- "innodb_file_per_table")) {
-
- /* Update part_elem tablespace to NULL same as in
- innodb data dictionary ib_table. */
- part_elem->tablespace_name = NULL;
- }
- }
}
/** Update create_info.
@@ -2558,7 +2529,7 @@ ha_innopart::update_create_info(
DBUG_VOID_RETURN;
}
- /* part_elem->data_file_name and tablespace_name should be correct from
+ /* part_elem->data_file_name should be correct from
the .frm, but may have been changed, so update from SYS_DATAFILES.
index_file_name is ignored, so remove it. */
@@ -2592,17 +2563,11 @@ set_create_info_dir(
if (part_elem->data_file_name != NULL
&& part_elem->data_file_name[0] != '\0') {
info->data_file_name = part_elem->data_file_name;
- /* Also implies non-default tablespace. */
- info->tablespace = NULL;
}
if (part_elem->index_file_name != NULL
&& part_elem->index_file_name[0] != '\0') {
info->index_file_name = part_elem->index_file_name;
}
- if (part_elem->tablespace_name != NULL
- && part_elem->tablespace_name[0] != '\0') {
- info->tablespace = part_elem->tablespace_name;
- }
}
/** Set flags and append '/' to remote path if necessary. */
@@ -2642,17 +2607,13 @@ ha_innopart::create(
int error;
/** {database}/{tablename} */
char table_name[FN_REFLEN];
- /** absolute path of temp frm */
- char temp_path[FN_REFLEN];
/** absolute path of table */
char remote_path[FN_REFLEN];
char partition_name[FN_REFLEN];
- char tablespace_name[NAME_LEN + 1];
char* table_name_end;
size_t table_name_len;
char* partition_name_start;
char table_data_file_name[FN_REFLEN];
- char table_level_tablespace_name[NAME_LEN + 1];
const char* index_file_name;
size_t len;
@@ -2660,9 +2621,7 @@ ha_innopart::create(
form,
create_info,
table_name,
- temp_path,
- remote_path,
- tablespace_name);
+ remote_path);
DBUG_ENTER("ha_innopart::create");
ut_ad(create_info != NULL);
@@ -2687,7 +2646,6 @@ ha_innopart::create(
if (error != 0) {
DBUG_RETURN(error);
}
- ut_ad(temp_path[0] == '\0');
strcpy(partition_name, table_name);
partition_name_start = partition_name + strlen(partition_name);
table_name_len = strlen(table_name);
@@ -2708,11 +2666,6 @@ ha_innopart::create(
table_data_file_name[0] = '\0';
}
index_file_name = create_info->index_file_name;
- if (create_info->tablespace != NULL) {
- strcpy(table_level_tablespace_name, create_info->tablespace);
- } else {
- table_level_tablespace_name[0] = '\0';
- }
info.allocate_trx();
@@ -2798,15 +2751,12 @@ ha_innopart::create(
table_data_file_name;
create_info->index_file_name =
index_file_name;
- create_info->tablespace =
- table_level_tablespace_name;
set_create_info_dir(part_elem, create_info);
}
}
/* Reset table level DATA/INDEX DIRECTORY. */
create_info->data_file_name = table_data_file_name;
create_info->index_file_name = index_file_name;
- create_info->tablespace = table_level_tablespace_name;
}
innobase_commit_low(info.trx());
@@ -4238,27 +4188,13 @@ ha_innopart::create_new_partition(
{
int error;
char norm_name[FN_REFLEN];
- const char* tablespace_name_backup = create_info->tablespace;
const char* data_file_name_backup = create_info->data_file_name;
DBUG_ENTER("ha_innopart::create_new_partition");
/* Delete by ddl_log on failure. */
normalize_table_name(norm_name, part_name);
set_create_info_dir(part_elem, create_info);
- /* The below check is the same as for CREATE TABLE, but since we are
- doing an alter here it will not trigger the check in
- create_option_tablespace_is_valid(). */
- if (tablespace_is_shared_space(create_info)
- && create_info->data_file_name != NULL
- && create_info->data_file_name[0] != '\0') {
- my_printf_error(ER_ILLEGAL_HA_CREATE_OPTION,
- "InnoDB: DATA DIRECTORY cannot be used"
- " with a TABLESPACE assignment.", MYF(0));
- DBUG_RETURN(HA_WRONG_CREATE_OPTION);
- }
-
error = ha_innobase::create(norm_name, table, create_info);
- create_info->tablespace = tablespace_name_backup;
create_info->data_file_name = data_file_name_backup;
if (error == HA_ERR_FOUND_DUPP_KEY) {
DBUG_RETURN(HA_ERR_TABLE_EXIST);
diff --git a/storage/innobase/handler/handler0alter.cc b/storage/innobase/handler/handler0alter.cc
index ca14542c9b5..a2fbb47c46d 100644
--- a/storage/innobase/handler/handler0alter.cc
+++ b/storage/innobase/handler/handler0alter.cc
@@ -588,21 +588,6 @@ ha_innobase::check_if_supported_inplace_alter(
DBUG_RETURN(HA_ALTER_INPLACE_NOT_SUPPORTED);
}
-#ifdef MYSQL_ENCRYPTION
- /* We don't support change encryption attribute with
- inplace algorithm. */
- char* old_encryption = this->table->s->encrypt_type.str;
- char* new_encryption = altered_table->s->encrypt_type.str;
-
- if (Encryption::is_none(old_encryption)
- != Encryption::is_none(new_encryption)) {
- ha_alter_info->unsupported_reason =
- innobase_get_err_msg(
- ER_UNSUPPORTED_ALTER_ENCRYPTION_INPLACE);
- DBUG_RETURN(HA_ALTER_INPLACE_NOT_SUPPORTED);
- }
-#endif /* MYSQL_ENCRYPTION */
-
update_thd();
trx_search_latch_release_if_reserved(m_prebuilt->trx);
@@ -4373,7 +4358,6 @@ prepare_inplace_alter_table_dict(
dict_index_t* fts_index = NULL;
ulint new_clustered = 0;
dberr_t error;
- const char* punch_hole_warning = NULL;
ulint num_fts_index;
dict_add_v_col_t* add_v = NULL;
ha_innobase_inplace_ctx*ctx;
@@ -4549,7 +4533,6 @@ prepare_inplace_alter_table_dict(
ulint z = 0;
ulint key_id = FIL_DEFAULT_ENCRYPTION_KEY;
fil_encryption_t mode = FIL_SPACE_ENCRYPTION_DEFAULT;
- const char* compression=NULL;
crypt_data = fil_space_get_crypt_data(ctx->prebuilt->table->space);
@@ -4596,20 +4579,6 @@ prepare_inplace_alter_table_dict(
goto new_clustered_failed;
}
- /* Use the old tablespace unless the tablespace
- is changing. */
- if (DICT_TF_HAS_SHARED_SPACE(user_table->flags)
- && (ha_alter_info->create_info->tablespace == NULL
- || (0 == strcmp(ha_alter_info->create_info->tablespace,
- user_table->tablespace)))) {
- space_id = user_table->space;
- } else if (tablespace_is_shared_space(
- ha_alter_info->create_info)) {
- space_id = fil_space_get_id_by_name(
- ha_alter_info->create_info->tablespace);
- ut_a(space_id != ULINT_UNDEFINED);
- }
-
/* The initial space id 0 may be overridden later if this
table is going to be a file_per_table tablespace. */
ctx->new_table = dict_mem_table_create(
@@ -4747,39 +4716,11 @@ prepare_inplace_alter_table_dict(
ctx->new_table->fts->doc_col = fts_doc_id_col;
}
-#ifdef MYSQL_COMPRESSION
- compression = ha_alter_info->create_info->compress.str;
-
- if (Compression::validate(compression) != DB_SUCCESS) {
-
- compression = NULL;
- }
-#endif /* MYSQL_COMPRESSION */
-
error = row_create_table_for_mysql(
- ctx->new_table, compression, ctx->trx, false, mode, key_id);
-
- punch_hole_warning =
- (error == DB_IO_NO_PUNCH_HOLE_FS)
- ? "Punch hole is not supported by the file system"
- : "Page Compression is not supported for this"
- " tablespace";
+ ctx->new_table, ctx->trx, false, mode, key_id);
switch (error) {
dict_table_t* temp_table;
- case DB_IO_NO_PUNCH_HOLE_FS:
- case DB_IO_NO_PUNCH_HOLE_TABLESPACE:
- push_warning_printf(
- ctx->prebuilt->trx->mysql_thd,
- Sql_condition::WARN_LEVEL_WARN,
- HA_ERR_UNSUPPORTED,
- "%s. Compression disabled for '%s'",
- punch_hole_warning,
- ctx->new_table->name.m_name);
-
- error = DB_SUCCESS;
-
-
case DB_SUCCESS:
/* We need to bump up the table ref count and
before we can use it we need to open the
@@ -5225,9 +5166,6 @@ innobase_check_foreign_key_index(
ulint n_drop_fk) /*!< in: Number of foreign keys
to drop */
{
- ut_ad(index != NULL);
- ut_ad(indexed_table != NULL);
-
const dict_foreign_set* fks = &indexed_table->referenced_set;
/* Check for all FK references from other tables to the index. */
@@ -5641,37 +5579,15 @@ ha_innobase::prepare_inplace_alter_table(
/* ALTER TABLE will not implicitly move a table from a single-table
tablespace to the system tablespace when innodb_file_per_table=OFF.
But it will implicitly move a table from the system tablespace to a
- single-table tablespace if innodb_file_per_table = ON.
- Tables found in a general tablespace will stay there unless ALTER
- TABLE contains another TABLESPACE=name. If that is found it will
- explicitly move a table to the named tablespace.
- So if you specify TABLESPACE=`innodb_system` a table can be moved
- into the system tablespace from either a general or file-per-table
- tablespace. But from then on, it is labeled as using a shared space
- (the create options have tablespace=='innodb_system' and the
- SHARED_SPACE flag is set in the table flags) so it can no longer be
- implicitly moved to a file-per-table tablespace. */
- bool in_system_space = is_system_tablespace(indexed_table->space);
- bool is_file_per_table = !in_system_space
- && !DICT_TF_HAS_SHARED_SPACE(indexed_table->flags);
-#ifdef UNIV_DEBUG
- bool in_general_space = !in_system_space
- && DICT_TF_HAS_SHARED_SPACE(indexed_table->flags);
-
- /* The table being altered can only be in a system tablespace,
- or its own file-per-table tablespace, or a general tablespace. */
- ut_ad(1 == in_system_space + is_file_per_table + in_general_space);
-#endif /* UNIV_DEBUG */
+ single-table tablespace if innodb_file_per_table = ON. */
create_table_info_t info(m_user_thd,
altered_table,
ha_alter_info->create_info,
NULL,
- NULL,
- NULL,
NULL);
- info.set_tablespace_type(is_file_per_table);
+ info.set_tablespace_type(indexed_table->space != TRX_SYS_SPACE);
if (ha_alter_info->handler_flags & Alter_inplace_info::ADD_INDEX) {
if (info.gcols_in_fulltext_or_spatial()) {
@@ -7338,7 +7254,7 @@ innobase_enlarge_columns_try(
== IS_EQUAL_PACK_LENGTH
&& innobase_enlarge_column_try(
user_table, trx, table_name,
- idx, cf->length, is_v)) {
+ idx, static_cast<ulint>(cf->length), is_v)) {
return(true);
}
@@ -9093,10 +9009,6 @@ foreign_fail:
}
}
- /* We don't support compression for the system tablespace nor
- the temporary tablespace. Only because they are shared tablespaces.
- There is no other technical reason. */
-
innobase_parse_hint_from_comment(
m_user_thd, m_prebuilt->table, altered_table->s);
diff --git a/storage/innobase/handler/i_s.cc b/storage/innobase/handler/i_s.cc
index 01fadaf8e10..a400ee54758 100644
--- a/storage/innobase/handler/i_s.cc
+++ b/storage/innobase/handler/i_s.cc
@@ -6050,8 +6050,6 @@ i_s_dict_fill_sys_tables(
if (is_system_tablespace(table->space)) {
space_type = "System";
- } else if (DICT_TF_HAS_SHARED_SPACE(table->flags)) {
- space_type = "General";
} else {
space_type = "Single";
}
@@ -8045,9 +8043,6 @@ i_s_dict_fill_sys_tablespaces(
file_format = trx_sys_file_format_id_to_name(atomic_blobs);
if (is_system_tablespace(space)) {
row_format = "Compact or Redundant";
- } else if (fsp_is_shared_tablespace(flags) && !is_compressed) {
- file_format = "Any";
- row_format = "Any";
} else if (is_compressed) {
row_format = "Compressed";
} else if (atomic_blobs) {
@@ -8058,8 +8053,6 @@ i_s_dict_fill_sys_tablespaces(
if (is_system_tablespace(space)) {
space_type = "System";
- } else if (fsp_is_shared_tablespace(flags)) {
- space_type = "General";
} else {
space_type = "Single";
}
@@ -8089,8 +8082,7 @@ i_s_dict_fill_sys_tablespaces(
space_type));
char* filepath = NULL;
- if (FSP_FLAGS_HAS_DATA_DIR(flags)
- || FSP_FLAGS_GET_SHARED(flags)) {
+ if (FSP_FLAGS_HAS_DATA_DIR(flags)) {
mutex_enter(&dict_sys->mutex);
filepath = dict_get_first_path(space);
mutex_exit(&dict_sys->mutex);
diff --git a/storage/innobase/ibuf/ibuf0ibuf.cc b/storage/innobase/ibuf/ibuf0ibuf.cc
index 612a2f9a690..e6c36b425e6 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, MariaDB Corporation.
+Copyright (c) 2016, 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
@@ -1227,8 +1227,9 @@ ibuf_rec_get_page_no_func(
const byte* field;
ulint len;
- ut_ad(mtr_memo_contains_page(mtr, rec, MTR_MEMO_PAGE_X_FIX)
- || mtr_memo_contains_page(mtr, rec, MTR_MEMO_PAGE_S_FIX));
+ ut_ad(mtr_memo_contains_page_flagged(mtr, rec,
+ MTR_MEMO_PAGE_X_FIX
+ | MTR_MEMO_PAGE_S_FIX));
ut_ad(ibuf_inside(mtr));
ut_ad(rec_get_n_fields_old(rec) > 2);
@@ -1265,8 +1266,8 @@ ibuf_rec_get_space_func(
const byte* field;
ulint len;
- ut_ad(mtr_memo_contains_page(mtr, rec, MTR_MEMO_PAGE_X_FIX)
- || mtr_memo_contains_page(mtr, rec, MTR_MEMO_PAGE_S_FIX));
+ ut_ad(mtr_memo_contains_page_flagged(mtr, rec, MTR_MEMO_PAGE_X_FIX
+ | MTR_MEMO_PAGE_S_FIX));
ut_ad(ibuf_inside(mtr));
ut_ad(rec_get_n_fields_old(rec) > 2);
@@ -1315,8 +1316,8 @@ ibuf_rec_get_info_func(
ulint info_len_local;
ulint counter_local;
- ut_ad(mtr_memo_contains_page(mtr, rec, MTR_MEMO_PAGE_X_FIX)
- || mtr_memo_contains_page(mtr, rec, MTR_MEMO_PAGE_S_FIX));
+ ut_ad(mtr_memo_contains_page_flagged(mtr, rec, MTR_MEMO_PAGE_X_FIX
+ | MTR_MEMO_PAGE_S_FIX));
ut_ad(ibuf_inside(mtr));
fields = rec_get_n_fields_old(rec);
ut_a(fields > IBUF_REC_FIELD_USER);
@@ -1387,8 +1388,8 @@ ibuf_rec_get_op_type_func(
{
ulint len;
- ut_ad(mtr_memo_contains_page(mtr, rec, MTR_MEMO_PAGE_X_FIX)
- || mtr_memo_contains_page(mtr, rec, MTR_MEMO_PAGE_S_FIX));
+ ut_ad(mtr_memo_contains_page_flagged(mtr, rec, MTR_MEMO_PAGE_X_FIX
+ | MTR_MEMO_PAGE_S_FIX));
ut_ad(ibuf_inside(mtr));
ut_ad(rec_get_n_fields_old(rec) > 2);
@@ -1586,8 +1587,8 @@ ibuf_build_entry_from_ibuf_rec_func(
ulint comp;
dict_index_t* index;
- ut_ad(mtr_memo_contains_page(mtr, ibuf_rec, MTR_MEMO_PAGE_X_FIX)
- || mtr_memo_contains_page(mtr, ibuf_rec, MTR_MEMO_PAGE_S_FIX));
+ ut_ad(mtr_memo_contains_page_flagged(mtr, ibuf_rec, MTR_MEMO_PAGE_X_FIX
+ | MTR_MEMO_PAGE_S_FIX));
ut_ad(ibuf_inside(mtr));
data = rec_get_nth_field_old(ibuf_rec, IBUF_REC_FIELD_MARKER, &len);
@@ -1708,8 +1709,8 @@ ibuf_rec_get_volume_func(
ibuf_op_t op;
ulint info_len;
- ut_ad(mtr_memo_contains_page(mtr, ibuf_rec, MTR_MEMO_PAGE_X_FIX)
- || mtr_memo_contains_page(mtr, ibuf_rec, MTR_MEMO_PAGE_S_FIX));
+ ut_ad(mtr_memo_contains_page_flagged(mtr, ibuf_rec, MTR_MEMO_PAGE_X_FIX
+ | MTR_MEMO_PAGE_S_FIX));
ut_ad(ibuf_inside(mtr));
ut_ad(rec_get_n_fields_old(ibuf_rec) > 2);
@@ -2291,8 +2292,8 @@ ibuf_get_merge_page_nos_func(
ulint limit;
ulint n_pages;
- ut_ad(mtr_memo_contains_page(mtr, rec, MTR_MEMO_PAGE_X_FIX)
- || mtr_memo_contains_page(mtr, rec, MTR_MEMO_PAGE_S_FIX));
+ ut_ad(mtr_memo_contains_page_flagged(mtr, rec, MTR_MEMO_PAGE_X_FIX
+ | MTR_MEMO_PAGE_S_FIX));
ut_ad(ibuf_inside(mtr));
*n_stored = 0;
@@ -2875,8 +2876,8 @@ ibuf_get_volume_buffered_count_func(
const byte* types;
ulint n_fields;
- ut_ad(mtr_memo_contains_page(mtr, rec, MTR_MEMO_PAGE_X_FIX)
- || mtr_memo_contains_page(mtr, rec, MTR_MEMO_PAGE_S_FIX));
+ ut_ad(mtr_memo_contains_page_flagged(mtr, rec, MTR_MEMO_PAGE_X_FIX
+ | MTR_MEMO_PAGE_S_FIX));
ut_ad(ibuf_inside(mtr));
n_fields = rec_get_n_fields_old(rec);
@@ -3248,8 +3249,8 @@ ibuf_get_entry_counter_low_func(
ulint len;
ut_ad(ibuf_inside(mtr));
- ut_ad(mtr_memo_contains_page(mtr, rec, MTR_MEMO_PAGE_X_FIX)
- || mtr_memo_contains_page(mtr, rec, MTR_MEMO_PAGE_S_FIX));
+ ut_ad(mtr_memo_contains_page_flagged(mtr, rec, MTR_MEMO_PAGE_X_FIX
+ | MTR_MEMO_PAGE_S_FIX));
ut_ad(rec_get_n_fields_old(rec) > 2);
field = rec_get_nth_field_old(rec, IBUF_REC_FIELD_MARKER, &len);
diff --git a/storage/innobase/include/buf0buf.h b/storage/innobase/include/buf0buf.h
index 1d535c58e77..de23e998020 100644
--- a/storage/innobase/include/buf0buf.h
+++ b/storage/innobase/include/buf0buf.h
@@ -1615,7 +1615,6 @@ public:
if written again we check is TRIM
operation needed. */
- ulint space; /*!< space id */
unsigned key_version; /*!< key version for this block */
bool page_encrypted; /*!< page is page encrypted */
bool page_compressed;/*!< page is page compressed */
diff --git a/storage/innobase/include/buf0buf.ic b/storage/innobase/include/buf0buf.ic
index f2b1b151598..5e75c446bbd 100644
--- a/storage/innobase/include/buf0buf.ic
+++ b/storage/innobase/include/buf0buf.ic
@@ -734,9 +734,6 @@ buf_block_get_frame(
case BUF_BLOCK_ZIP_PAGE:
case BUF_BLOCK_ZIP_DIRTY:
case BUF_BLOCK_NOT_USED:
- if (block->page.encrypted) {
- goto ok;
- }
ut_error;
break;
case BUF_BLOCK_FILE_PAGE:
diff --git a/storage/innobase/include/data0data.ic b/storage/innobase/include/data0data.ic
index 71698cc12b3..2fe5190591b 100644
--- a/storage/innobase/include/data0data.ic
+++ b/storage/innobase/include/data0data.ic
@@ -467,7 +467,6 @@ dtuple_create_from_mem(
dtuple_t* tuple;
ulint n_t_fields = n_fields + n_v_fields;
- ut_ad(buf != NULL);
ut_a(buf_size >= DTUPLE_EST_ALLOC(n_t_fields));
tuple = (dtuple_t*) buf;
diff --git a/storage/innobase/include/db0err.h b/storage/innobase/include/db0err.h
index 32f9117af84..972d99553b9 100644
--- a/storage/innobase/include/db0err.h
+++ b/storage/innobase/include/db0err.h
@@ -146,24 +146,6 @@ enum dberr_t {
DB_IO_ERROR = 100, /*!< Generic IO error */
- DB_IO_DECOMPRESS_FAIL, /*!< Failure to decompress a page
- after reading it from disk */
-
- DB_IO_NO_PUNCH_HOLE, /*!< Punch hole not supported by
- InnoDB */
-
- DB_IO_NO_PUNCH_HOLE_FS, /*!< The file system doesn't support
- punch hole */
-
- DB_IO_NO_PUNCH_HOLE_TABLESPACE, /*!< The tablespace doesn't support
- punch hole */
-
- DB_IO_DECRYPT_FAIL, /*!< Failure to decrypt a page
- after reading it from disk */
-
- DB_IO_NO_ENCRYPT_TABLESPACE, /*!< The tablespace doesn't support
- encrypt */
-
DB_IO_PARTIAL_FAILED, /*!< Partial IO request failed */
DB_FORCED_ABORT, /*!< Transaction was forced to rollback
@@ -172,14 +154,15 @@ enum dberr_t {
DB_TABLE_CORRUPT, /*!< Table/clustered index is
corrupted */
- DB_WRONG_FILE_NAME, /*!< Invalid Filename */
-
DB_COMPUTE_VALUE_FAILED, /*!< Compute generated value failed */
DB_NO_FK_ON_S_BASE_COL, /*!< Cannot add foreign constrain
placed on the base column of
stored column */
+ DB_IO_NO_PUNCH_HOLE, /*!< Punch hole not supported by
+ file system. */
+
/* The following are partial failure codes */
DB_FAIL = 1000,
DB_OVERFLOW,
diff --git a/storage/innobase/include/dict0crea.h b/storage/innobase/include/dict0crea.h
index 51cef91d318..9065f7ebf3d 100644
--- a/storage/innobase/include/dict0crea.h
+++ b/storage/innobase/include/dict0crea.h
@@ -67,13 +67,6 @@ dict_create_table_step(
/*===================*/
que_thr_t* thr); /*!< in: query thread */
-/** Builds a tablespace to store various objects.
-@param[in,out] tablespace Tablespace object describing what to build.
-@return DB_SUCCESS or error code. */
-dberr_t
-dict_build_tablespace(
- Tablespace* tablespace);
-
/** Builds a tablespace to contain a table, using file-per-table=1.
@param[in,out] table Table to build in its own tablespace.
@param[in] node Table create node
diff --git a/storage/innobase/include/dict0dict.h b/storage/innobase/include/dict0dict.h
index ca3951dd309..77a2013927e 100644
--- a/storage/innobase/include/dict0dict.h
+++ b/storage/innobase/include/dict0dict.h
@@ -992,7 +992,9 @@ dict_tf_get_format(
@param[in] format, File Format
@param[in] zip_ssize Zip Shift Size
@param[in] use_data_dir Table uses DATA DIRECTORY
-@param[in] shared_space Table uses a General Shared Tablespace */
+@param[in] page_compressed Table uses page compression
+@param[in] page_compression_level Page compression level
+@param[in] not_used For future */
UNIV_INLINE
void
dict_tf_set(
@@ -1000,25 +1002,6 @@ dict_tf_set(
rec_format_t format,
ulint zip_ssize,
bool use_data_dir,
- bool shared_space,
- bool page_compressed,
- ulint page_compression_level,
- ulint not_used);
-
-/** Initialize a dict_table_t::flags pointer.
-@param[in] compact, Table uses Compact or greater
-@param[in] zip_ssize Zip Shift Size (log 2 minus 9)
-@param[in] atomic_blobs Table uses Compressed or Dynamic
-@param[in] data_dir Table uses DATA DIRECTORY
-@param[in] shared_space Table uses a General Shared Tablespace */
-UNIV_INLINE
-ulint
-dict_tf_init(
- bool compact,
- ulint zip_ssize,
- bool atomic_blobs,
- bool data_dir,
- bool shared_space,
bool page_compressed,
ulint page_compression_level,
ulint not_used);
@@ -1034,14 +1017,10 @@ dict_table_t::flags | 0 | 1 | 1 | 1
fil_space_t::flags | 0 | 0 | 1 | 1
==================================================================
@param[in] table_flags dict_table_t::flags
-@param[in] is_temp whether the tablespace is temporary
-@param[in] is_encrypted whether the tablespace is encrypted
@return tablespace flags (fil_space_t::flags) */
+UNIV_INLINE
ulint
-dict_tf_to_fsp_flags(
- ulint table_flags,
- bool is_temp,
- bool is_encrypted = false)
+dict_tf_to_fsp_flags(ulint table_flags)
MY_ATTRIBUTE((const));
/** Extract the page size from table flags.
@@ -1976,25 +1955,6 @@ dict_table_is_temporary(
MY_ATTRIBUTE((warn_unused_result));
/********************************************************************//**
-Check if it is a encrypted table.
-@return true if table encryption flag is set. */
-UNIV_INLINE
-bool
-dict_table_is_encrypted(
-/*====================*/
- const dict_table_t* table) /*!< in: table to check */
- MY_ATTRIBUTE((warn_unused_result));
-
-/** Check if the table is in a shared tablespace (System or General).
-@param[in] id Space ID to check
-@return true if id is a shared tablespace, false if not. */
-UNIV_INLINE
-bool
-dict_table_in_shared_tablespace(
- const dict_table_t* table)
- MY_ATTRIBUTE((warn_unused_result));
-
-/********************************************************************//**
Turn-off redo-logging if temporary table. */
UNIV_INLINE
void
diff --git a/storage/innobase/include/dict0dict.ic b/storage/innobase/include/dict0dict.ic
index c7d553f5daa..905a1b78782 100644
--- a/storage/innobase/include/dict0dict.ic
+++ b/storage/innobase/include/dict0dict.ic
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2013, 2016, MariaDB Corporation
+Copyright (c) 2013, 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
@@ -660,7 +660,6 @@ dict_tf_is_valid(
ulint zip_ssize = DICT_TF_GET_ZIP_SSIZE(flags);
bool atomic_blobs = DICT_TF_HAS_ATOMIC_BLOBS(flags);
bool data_dir = DICT_TF_HAS_DATA_DIR(flags);
- bool shared_space = DICT_TF_HAS_SHARED_SPACE(flags);
ulint unused = DICT_TF_GET_UNUSED(flags);
bool page_compression = DICT_TF_GET_PAGE_COMPRESSION(flags);
ulint page_compression_level = DICT_TF_GET_PAGE_COMPRESSION_LEVEL(flags);
@@ -711,11 +710,6 @@ dict_tf_is_valid(
}
- /* HAS_DATA_DIR and SHARED_SPACE are mutually exclusive. */
- if (data_dir && shared_space) {
- flags_corrupt = true;
- }
-
if (flags_corrupt) {
ib::error()
<< "InnoDB: Error: table unused flags are:" << flags
@@ -726,8 +720,7 @@ dict_tf_is_valid(
<< " data_dir:" << data_dir
<< " zip_ssize:" << zip_ssize
<< " page_compression:" << page_compression
- << " page_compression_level:" << page_compression_level
- << " shared_space:" << shared_space;
+ << " page_compression_level:" << page_compression_level;
return (false);
} else {
return(true);
@@ -753,13 +746,6 @@ dict_tf2_is_valid(
return(false);
}
- bool file_per_table = ((flags2 & DICT_TF2_USE_FILE_PER_TABLE) != 0);
- bool shared_space = DICT_TF_HAS_SHARED_SPACE(flags);
-
- if (file_per_table && shared_space) {
- return(false);
- }
-
return(true);
}
@@ -931,7 +917,6 @@ dict_table_get_format(
@param[in] format File Format
@param[in] zip_ssize Zip Shift Size
@param[in] use_data_dir Table uses DATA DIRECTORY
-@param[in] shared_space Table uses a General Shared Tablespace
@param[in] page_compressed Table uses page compression
@param[in] page_compression_level Page compression level
@param[in] not_used For future */
@@ -943,7 +928,6 @@ dict_tf_set(
rec_format_t format,
ulint zip_ssize,
bool use_data_dir,
- bool shared_space,
bool page_compressed,
ulint page_compression_level,
ulint not_used)
@@ -973,10 +957,6 @@ dict_tf_set(
*flags |= (1 << DICT_TF_POS_DATA_DIR);
}
- if (shared_space) {
- *flags |= (1 << DICT_TF_POS_SHARED_SPACE);
- }
-
if (page_compressed) {
*flags |= (1 << DICT_TF_POS_ATOMIC_BLOBS)
| (1 << DICT_TF_POS_PAGE_COMPRESSION)
@@ -988,60 +968,56 @@ dict_tf_set(
}
}
-/** Initialize a dict_table_t::flags pointer.
-@param[in] compact, Table uses Compact or greater
-@param[in] zip_ssize Zip Shift Size (log 2 minus 9)
-@param[in] atomic_blobs Table uses Compressed or Dynamic
-@param[in] data_dir Table uses DATA DIRECTORY
-@param[in] shared_space Table uses a General Shared Tablespace
-@param[in] page_compression Table uses page compression
-@param[in] page_compression_level used compression level
-@param[in] not_used For future */
+/** Convert a 32 bit integer table flags to the 32 bit FSP Flags.
+Fsp Flags are written into the tablespace header at the offset
+FSP_SPACE_FLAGS and are also stored in the fil_space_t::flags field.
+The following chart shows the translation of the low order bit.
+Other bits are the same.
+========================= Low order bit ==========================
+ | REDUNDANT | COMPACT | COMPRESSED | DYNAMIC
+dict_table_t::flags | 0 | 1 | 1 | 1
+fil_space_t::flags | 0 | 0 | 1 | 1
+==================================================================
+@param[in] table_flags dict_table_t::flags
+@return tablespace flags (fil_space_t::flags) */
UNIV_INLINE
ulint
-dict_tf_init(
- bool compact,
- ulint zip_ssize,
- bool atomic_blobs,
- bool data_dir,
- bool shared_space,
- bool page_compressed,
- ulint page_compression_level,
- ulint not_used)
+dict_tf_to_fsp_flags(ulint table_flags)
{
- ulint flags = 0;
+ ulint fsp_flags;
+ ulint page_compression_level = DICT_TF_GET_PAGE_COMPRESSION_LEVEL(
+ table_flags);
+ ulint atomic_writes = DICT_TF_GET_ATOMIC_WRITES(table_flags);
- if (compact) {
- flags |= DICT_TF_COMPACT;
- }
+ ut_ad((DICT_TF_GET_PAGE_COMPRESSION(table_flags) == 0)
+ == (page_compression_level == 0));
- if (zip_ssize) {
- flags |= (zip_ssize << DICT_TF_POS_ZIP_SSIZE);
- }
+ DBUG_EXECUTE_IF("dict_tf_to_fsp_flags_failure",
+ return(ULINT_UNDEFINED););
- if (atomic_blobs) {
- flags |= (1 << DICT_TF_POS_ATOMIC_BLOBS);
- }
+ /* Adjust bit zero. */
+ fsp_flags = DICT_TF_HAS_ATOMIC_BLOBS(table_flags) ? 1 : 0;
- if (data_dir) {
- flags |= (1 << DICT_TF_POS_DATA_DIR);
- }
+ /* ZIP_SSIZE and ATOMIC_BLOBS are at the same position. */
+ fsp_flags |= table_flags
+ & (DICT_TF_MASK_ZIP_SSIZE | DICT_TF_MASK_ATOMIC_BLOBS);
+
+ fsp_flags |= FSP_FLAGS_PAGE_SSIZE();
- if (shared_space) {
- flags |= (1 << DICT_TF_POS_SHARED_SPACE);
+ if (page_compression_level) {
+ fsp_flags |= FSP_FLAGS_MASK_PAGE_COMPRESSION;
}
- if (page_compressed) {
- flags |= (1 << DICT_TF_POS_ATOMIC_BLOBS)
- | (1 << DICT_TF_POS_PAGE_COMPRESSION)
- | (page_compression_level << DICT_TF_POS_PAGE_COMPRESSION_LEVEL);
+ ut_a(fsp_flags_is_valid(fsp_flags));
- ut_ad(zip_ssize == 0);
- ut_ad(dict_tf_get_page_compression(flags) == TRUE);
- ut_ad(dict_tf_get_page_compression_level(flags) == page_compression_level);
+ if (DICT_TF_HAS_DATA_DIR(table_flags)) {
+ fsp_flags |= 1U << FSP_FLAGS_MEM_DATA_DIR;
}
- return(flags);
+ fsp_flags |= atomic_writes << FSP_FLAGS_MEM_ATOMIC_WRITES;
+ fsp_flags |= page_compression_level << FSP_FLAGS_MEM_COMPRESSION_LEVEL;
+
+ return(fsp_flags);
}
/********************************************************************//**
@@ -1073,8 +1049,7 @@ dict_sys_tables_type_to_tf(
| DICT_TF_MASK_ATOMIC_BLOBS
| DICT_TF_MASK_DATA_DIR
| DICT_TF_MASK_PAGE_COMPRESSION
- | DICT_TF_MASK_PAGE_COMPRESSION_LEVEL
- | DICT_TF_MASK_SHARED_SPACE);
+ | DICT_TF_MASK_PAGE_COMPRESSION_LEVEL);
ut_ad(!DICT_TF_GET_ZIP_SSIZE(flags) || DICT_TF_HAS_ATOMIC_BLOBS(flags));
return(flags);
@@ -1109,8 +1084,7 @@ dict_tf_to_sys_tables_type(
| DICT_TF_MASK_ATOMIC_BLOBS
| DICT_TF_MASK_DATA_DIR
| DICT_TF_MASK_PAGE_COMPRESSION
- | DICT_TF_MASK_PAGE_COMPRESSION_LEVEL
- | DICT_TF_MASK_SHARED_SPACE);
+ | DICT_TF_MASK_PAGE_COMPRESSION_LEVEL);
return(type);
}
@@ -1268,7 +1242,6 @@ ulint
dict_index_get_n_unique_in_tree_nonleaf(
const dict_index_t* index)
{
- ut_ad(index != NULL);
ut_ad(index->magic_n == DICT_INDEX_MAGIC_N);
ut_ad(index->cached);
@@ -1745,30 +1718,6 @@ dict_table_is_temporary(
}
/********************************************************************//**
-Check if it is a encrypted table.
-@return true if table encrypted flag is set. */
-UNIV_INLINE
-bool
-dict_table_is_encrypted(
-/*====================*/
- const dict_table_t* table) /*!< in: table to check */
-{
- return(DICT_TF2_FLAG_IS_SET(table, DICT_TF2_ENCRYPTION));
-}
-
-/** Check if the table is in a shared tablespace (System or General).
-@param[in] id Space ID to check
-@return true if id is a shared tablespace, false if not. */
-UNIV_INLINE
-bool
-dict_table_in_shared_tablespace(
- const dict_table_t* table)
-{
- return(is_system_tablespace(table->space)
- || DICT_TF_HAS_SHARED_SPACE(table->flags));
-}
-
-/********************************************************************//**
Turn-off redo-logging if temporary table. */
UNIV_INLINE
void
@@ -1790,8 +1739,8 @@ A patch was added to v3.23.52 which initializes the MIX_LEN field to 0.
Since file-per-table tablespaces were added in 4.1, any SYS_TABLES
record with a non-zero space ID will have a reliable MIX_LEN field.
However, this test does not use flags2 from SYS_TABLES.MIX_LEN. Instead,
-assume that if the tablespace is not a predefined system tablespace and it
-is not a general shared tablespace, then it must be file-per-table.
+assume that if the tablespace is not a predefined system tablespace,
+ then it must be file-per-table.
Also, during ALTER TABLE, the DICT_TF2_USE_FILE_PER_TABLE flag may not be
set on one of the file-per-table tablespaces.
This test cannot be done on a table in the process of being created
@@ -1804,8 +1753,7 @@ dict_table_is_file_per_table(
const dict_table_t* table) /*!< in: table to check */
{
bool is_file_per_table =
- !is_system_tablespace(table->space)
- && !DICT_TF_HAS_SHARED_SPACE(table->flags);
+ !is_system_tablespace(table->space);
/* If the table is file-per-table and it is not redundant, then
it should have the flags2 bit for DICT_TF2_USE_FILE_PER_TABLE. */
@@ -1813,7 +1761,7 @@ dict_table_is_file_per_table(
|| !DICT_TF_GET_COMPACT(table->flags)
|| DICT_TF2_FLAG_IS_SET(table, DICT_TF2_USE_FILE_PER_TABLE));
- return(is_file_per_table );
+ return(is_file_per_table);
}
/** Get reference count.
@@ -1845,20 +1793,6 @@ dict_table_t::release()
--n_ref_count;
}
-/** Check if tablespace name is "innodb_general".
-@param[in] tablespace_name tablespace name
-@retval true if name is "innodb_general"
-@retval false if name is not "innodb_general" */
-inline
-bool
-dict_table_has_temp_general_tablespace_name(
- const char* tablespace_name) {
-
- return(tablespace_name != NULL
- && strncmp(tablespace_name, general_space_name,
- strlen(general_space_name)) == 0);
-}
-
/** Encode the number of columns and number of virtual columns in a
4 bytes value. We could do this because the number of columns in
InnoDB is limited to 1017
@@ -1930,4 +1864,3 @@ dict_table_have_virtual_index(
return(false);
}
-
diff --git a/storage/innobase/include/dict0load.h b/storage/innobase/include/dict0load.h
index 6d01c38c432..0a862bb17a9 100644
--- a/storage/innobase/include/dict0load.h
+++ b/storage/innobase/include/dict0load.h
@@ -1,6 +1,7 @@
/*****************************************************************************
Copyright (c) 1996, 2016, 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
@@ -201,15 +202,6 @@ dict_get_and_save_data_dir_path(
dict_table_t* table,
bool dict_mutex_own);
-/** Make sure the tablespace name is saved in dict_table_t if needed.
-Try to read it from the file dictionary first, then from SYS_TABLESPACES.
-@param[in] table Table object
-@param[in] dict_mutex_own) true if dict_sys->mutex is owned already */
-void
-dict_get_and_save_space_name(
- dict_table_t* table,
- bool dict_mutex_own);
-
/** Loads a table definition and also all its index definitions, and also
the cluster definition if the table is a member in a cluster. Also loads
all foreign key constraints where the foreign key is in the table or where
diff --git a/storage/innobase/include/dict0mem.h b/storage/innobase/include/dict0mem.h
index 538306f7af8..ccfc46f7941 100644
--- a/storage/innobase/include/dict0mem.h
+++ b/storage/innobase/include/dict0mem.h
@@ -137,12 +137,8 @@ This flag prevents older engines from attempting to open the table and
allows InnoDB to update_create_info() accordingly. */
#define DICT_TF_WIDTH_DATA_DIR 1
-/** Width of the SHARED tablespace flag.
-It is used to identify tables that exist inside a shared general tablespace.
-If a table is created with the TABLESPACE=tsname option, an older engine will
-not be able to find that table. This flag prevents older engines from attempting
-to open the table and allows InnoDB to quickly find the tablespace. */
-
+/** Width of the SHARED tablespace flag (Oracle MYSQL 5.7).
+Not supported by MariaDB. */
#define DICT_TF_WIDTH_SHARED_SPACE 1
/**
@@ -226,10 +222,6 @@ DEFAULT=0, ON = 1, OFF = 2
#define DICT_TF_MASK_DATA_DIR \
((~(~0U << DICT_TF_WIDTH_DATA_DIR)) \
<< DICT_TF_POS_DATA_DIR)
-/** Bit mask of the SHARED_SPACE field */
-#define DICT_TF_MASK_SHARED_SPACE \
- ((~(~0U << DICT_TF_WIDTH_SHARED_SPACE)) \
- << DICT_TF_POS_SHARED_SPACE)
/** Bit mask of the PAGE_COMPRESSION field */
#define DICT_TF_MASK_PAGE_COMPRESSION \
((~(~0U << DICT_TF_WIDTH_PAGE_COMPRESSION)) \
@@ -267,10 +259,6 @@ DEFAULT=0, ON = 1, OFF = 2
#define DICT_TF_HAS_DATA_DIR(flags) \
((flags & DICT_TF_MASK_DATA_DIR) \
>> DICT_TF_POS_DATA_DIR)
-/** Return the value of the SHARED_SPACE field */
-#define DICT_TF_HAS_SHARED_SPACE(flags) \
- ((flags & DICT_TF_MASK_SHARED_SPACE) \
- >> DICT_TF_POS_SHARED_SPACE)
/** Return the value of the PAGE_COMPRESSION field */
#define DICT_TF_GET_PAGE_COMPRESSION(flags) \
((flags & DICT_TF_MASK_PAGE_COMPRESSION) \
@@ -307,7 +295,8 @@ for unknown bits in order to protect backward incompatibility. */
/* @{ */
/** Total number of bits in table->flags2. */
#define DICT_TF2_BITS 9
-#define DICT_TF2_UNUSED_BIT_MASK (~0U << DICT_TF2_BITS)
+#define DICT_TF2_UNUSED_BIT_MASK (~0U << DICT_TF2_BITS | \
+ 1U << DICT_TF_POS_SHARED_SPACE)
#define DICT_TF2_BIT_MASK ~DICT_TF2_UNUSED_BIT_MASK
/** TEMPORARY; TRUE for tables from CREATE TEMPORARY TABLE. */
@@ -334,9 +323,6 @@ use its own tablespace instead of the system tablespace. */
index tables) of a FTS table are in HEX format. */
#define DICT_TF2_FTS_AUX_HEX_NAME 64
-/** Encryption table bit. */
-#define DICT_TF2_ENCRYPTION 256
-
/* @} */
#define DICT_TF2_FLAG_SET(table, flag) \
@@ -1389,19 +1375,9 @@ struct dict_table_t {
/** Table name. */
table_name_t name;
- /** NULL or the directory path where a TEMPORARY table that was
- explicitly created by a user should be placed if innodb_file_per_table
- is defined in my.cnf. In Unix this is usually "/tmp/...",
- in Windows "temp\...". */
- const char* dir_path_of_temp_table;
-
/** NULL or the directory path specified by DATA DIRECTORY. */
char* data_dir_path;
- /** NULL or the tablespace name that this table is assigned to,
- specified by the TABLESPACE option.*/
- id_name_t tablespace;
-
/** Space where the clustered index of the table is placed. */
uint32_t space;
@@ -1779,12 +1755,6 @@ public:
/** mysql_row_templ_t for base columns used for compute the virtual
columns */
dict_vcol_templ_t* vc_templ;
-
- /** encryption key, it's only for export/import */
- byte* encryption_key;
-
- /** encryption iv, it's only for export/import */
- byte* encryption_iv;
};
/*******************************************************************//**
diff --git a/storage/innobase/include/dict0pagecompress.h b/storage/innobase/include/dict0pagecompress.h
index f8873aec965..6641f6ba85f 100644
--- a/storage/innobase/include/dict0pagecompress.h
+++ b/storage/innobase/include/dict0pagecompress.h
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (C) 2013 SkySQL Ab. All Rights Reserved.
+Copyright (C) 2013, 2017, MariaDB Corporation. 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
@@ -56,17 +56,6 @@ dict_table_page_compression_level(
const dict_table_t* table) /*!< in: table */
__attribute__((const));
-/********************************************************************//**
-Verify that dictionary flags match tablespace flags
-@return true if flags match, false if not */
-UNIV_INLINE
-ibool
-dict_tf_verify_flags(
-/*=================*/
- ulint table_flags, /*!< in: dict_table_t::flags */
- ulint fsp_flags) /*!< in: fil_space_t::flags */
- __attribute__((const));
-
#ifndef UNIV_NONINL
#include "dict0pagecompress.ic"
#endif
diff --git a/storage/innobase/include/dict0pagecompress.ic b/storage/innobase/include/dict0pagecompress.ic
index 05a26f00711..67f4a26723f 100644
--- a/storage/innobase/include/dict0pagecompress.ic
+++ b/storage/innobase/include/dict0pagecompress.ic
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (C) 2013 SkySQL Ab. All Rights Reserved.
+Copyright (C) 2013, 2017, MariaDB Corporation. 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
@@ -25,80 +25,6 @@ Created 11/12/2013 Jan Lindström jan.lindstrom@skysql.com
***********************************************************************/
/********************************************************************//**
-Verify that dictionary flags match tablespace flags
-@return true if flags match, false if not */
-UNIV_INLINE
-ibool
-dict_tf_verify_flags(
-/*=================*/
- ulint table_flags, /*!< in: dict_table_t::flags */
- ulint fsp_flags) /*!< in: fil_space_t::flags */
-{
- ulint table_unused = DICT_TF_GET_UNUSED(table_flags);
- ulint compact = DICT_TF_GET_COMPACT(table_flags);
- ulint ssize = DICT_TF_GET_ZIP_SSIZE(table_flags);
- ulint atomic_blobs = DICT_TF_HAS_ATOMIC_BLOBS(table_flags);
- ulint data_dir = DICT_TF_HAS_DATA_DIR(table_flags);
- ulint page_compression = DICT_TF_GET_PAGE_COMPRESSION(table_flags);
- ulint page_compression_level = DICT_TF_GET_PAGE_COMPRESSION_LEVEL(table_flags);
- ulint post_antelope = FSP_FLAGS_GET_POST_ANTELOPE(fsp_flags);
- ulint zip_ssize = FSP_FLAGS_GET_ZIP_SSIZE(fsp_flags);
- ulint fsp_atomic_blobs = FSP_FLAGS_HAS_ATOMIC_BLOBS(fsp_flags);
- ulint page_ssize = FSP_FLAGS_GET_PAGE_SSIZE(fsp_flags);
- ulint fsp_unused = FSP_FLAGS_GET_UNUSED(fsp_flags);
- ulint fsp_page_compression = FSP_FLAGS_GET_PAGE_COMPRESSION(fsp_flags);
- ulint fsp_page_compression_level = FSP_FLAGS_GET_PAGE_COMPRESSION_LEVEL(fsp_flags);
-
- DBUG_EXECUTE_IF("dict_tf_verify_flags_failure",
- return(ULINT_UNDEFINED););
-
- ut_a(!table_unused);
- ut_a(!fsp_unused);
- ut_a(page_ssize == 0 || page_ssize != 0); /* silence compiler */
- ut_a(compact == 0 || compact == 1); /* silence compiler */
- ut_a(data_dir == 0 || data_dir == 1); /* silence compiler */
- ut_a(post_antelope == 0 || post_antelope == 1); /* silence compiler */
-
- if (ssize != zip_ssize) {
- fprintf(stderr,
- "InnoDB: Error: table flags has zip_ssize %ld"
- " in the data dictionary\n"
- "InnoDB: but the flags in file has zip_ssize %ld\n",
- ssize, zip_ssize);
- return (FALSE);
- }
- if (atomic_blobs != fsp_atomic_blobs) {
- fprintf(stderr,
- "InnoDB: Error: table flags has atomic_blobs %ld"
- " in the data dictionary\n"
- "InnoDB: but the flags in file has atomic_blobs %ld\n",
- atomic_blobs, fsp_atomic_blobs);
-
- return (FALSE);
- }
- if (page_compression != fsp_page_compression) {
- fprintf(stderr,
- "InnoDB: Error: table flags has page_compression %ld"
- " in the data dictionary\n"
- "InnoDB: but the flags in file ahas page_compression %ld\n",
- page_compression, fsp_page_compression);
-
- return (FALSE);
- }
- if (page_compression_level != fsp_page_compression_level) {
- fprintf(stderr,
- "InnoDB: Error: table flags has page_compression_level %ld"
- " in the data dictionary\n"
- "InnoDB: but the flags in file has page_compression_level %ld\n",
- page_compression_level, fsp_page_compression_level);
-
- return (FALSE);
- }
-
- return(TRUE);
-}
-
-/********************************************************************//**
Extract the page compression level from dict_table_t::flags.
These flags are in memory, so assert that they are valid.
@return page compression level, or 0 if not compressed */
diff --git a/storage/innobase/include/fil0fil.h b/storage/innobase/include/fil0fil.h
index 0197dfaabb4..047e43d34e4 100644
--- a/storage/innobase/include/fil0fil.h
+++ b/storage/innobase/include/fil0fil.h
@@ -38,13 +38,10 @@ Created 10/25/1995 Heikki Tuuri
#include <list>
#include <vector>
-extern const char general_space_name[];
-
// Forward declaration
struct trx_t;
class page_id_t;
class truncate_t;
-struct btr_create_t;
/* structure containing encryption specification */
typedef struct fil_space_crypt_struct fil_space_crypt_t;
@@ -133,7 +130,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 */
- ulint flags; /*!< tablespace flags; see
+ ulint flags; /*!< FSP_SPACE_FLAGS and FSP_FLAGS_MEM_ flags;
+ see fsp0types.h,
fsp_flags_is_valid(),
page_size_t(ulint) (constructor) */
ulint n_reserved_extents;
@@ -166,21 +164,6 @@ struct fil_space_t {
UT_LIST_NODE_T(fil_space_t) space_list;
/*!< list of all spaces */
- /** Compression algorithm */
- Compression::Type compression_type;
-
- /** Encryption algorithm */
- Encryption::Type encryption_type;
-
- /** Encrypt key */
- byte encryption_key[ENCRYPTION_KEY_LEN];
-
- /** Encrypt key length*/
- ulint encryption_klen;
-
- /** Encrypt initial vector */
- byte encryption_iv[ENCRYPTION_KEY_LEN];
-
/** MariaDB encryption data */
fil_space_crypt_t* crypt_data;
@@ -202,6 +185,10 @@ struct fil_space_t {
@param[in] n_reserved number of reserved extents */
void release_free_extents(ulint n_reserved);
+ /** True if file system storing this tablespace supports
+ punch hole */
+ bool punch_hole;
+
ulint magic_n;/*!< FIL_SPACE_MAGIC_N */
};
@@ -214,8 +201,6 @@ struct fil_node_t {
fil_space_t* space;
/** file name; protected by fil_system->mutex and log_sys->mutex. */
char* name;
- /** whether this file is open */
- bool is_open;
/** file handle (valid if is_open) */
os_file_t handle;
/** event that groups and serializes calls to fsync */
@@ -246,17 +231,20 @@ struct fil_node_t {
/** link to the fil_system->LRU list (keeping track of open files) */
UT_LIST_NODE_T(fil_node_t) LRU;
- /** whether the file system of this file supports PUNCH HOLE */
- bool punch_hole;
-
- /** block size to use for punching holes */
- ulint block_size;
-
/** whether this file could use atomic write (data file) */
bool atomic_write;
+ /** Filesystem block size */
+ ulint block_size;
+
/** FIL_NODE_MAGIC_N */
ulint magic_n;
+
+ /** @return whether this file is open */
+ bool is_open() const
+ {
+ return(handle != OS_FILE_CLOSED);
+ }
};
/** Value of fil_node_t::magic_n */
@@ -267,110 +255,17 @@ enum ib_extention {
NO_EXT = 0,
IBD = 1,
ISL = 2,
- CFG = 3,
- CFP = 4
+ CFG = 3
};
extern const char* dot_ext[];
#define DOT_IBD dot_ext[IBD]
#define DOT_ISL dot_ext[ISL]
#define DOT_CFG dot_ext[CFG]
-#define DOT_CPF dot_ext[CFP]
-
-/** Wrapper for a path to a directory.
-This folder may or may not yet esist. Since not all directory paths
-end in "/", we should only use this for a directory path or a filepath
-that has a ".ibd" extension. */
-class Folder
-{
-public:
- /** Default constructor */
- Folder() : m_folder(NULL) {}
-
- /** Constructor
- @param[in] path pathname (not necessarily NUL-terminated)
- @param[in] len length of the path, in bytes */
- Folder(const char* path, size_t len);
-
- /** Assignment operator
- @param[in] folder folder string provided */
- class Folder& operator=(const char* path);
-
- /** Destructor */
- ~Folder()
- {
- ut_free(m_folder);
- }
-
- /** Implicit type conversion
- @return the wrapped object */
- operator const char*() const
- {
- return(m_folder);
- }
-
- /** Explicit type conversion
- @return the wrapped object */
- const char* operator()() const
- {
- return(m_folder);
- }
-
- /** return the length of m_folder
- @return the length of m_folder */
- size_t len()
- {
- return m_folder_len;
- }
-
- /** Determine if two folders are equal
- @param[in] other folder to compare to
- @return whether the folders are equal */
- bool operator==(const Folder& other) const;
-
- /** Determine if the left folder is the same or an ancestor of
- (contains) the right folder.
- @param[in] other folder to compare to
- @return whether this is the same or an ancestor or the other folder. */
- bool operator>=(const Folder& other) const;
-
- /** Determine if the left folder is an ancestor of (contains)
- the right folder.
- @param[in] other folder to compare to
- @return whether this is an ancestor of the other folder */
- bool operator>(const Folder& other) const;
-
- /** Determine if the directory referenced by m_folder exists.
- @return whether the directory exists */
- bool exists();
-
-private:
- /** Build the basic folder name from the path and length provided
- @param[in] path pathname (not necessarily NUL-terminated)
- @param[in] len length of the path, in bytes */
- void make_path(const char* path, size_t len);
-
- /** Resolve a relative path in m_folder to an absolute path
- in m_abs_path setting m_abs_len. */
- void make_abs_path();
-
- /** The wrapped folder string */
- char* m_folder;
-
- /** Length of m_folder */
- size_t m_folder_len;
-
- /** A full absolute path to the same file. */
- char m_abs_path[FN_REFLEN + 2];
-
- /** Length of m_abs_path to the deepest folder */
- size_t m_abs_len;
-};
/** When mysqld is run, the default directory "." is the mysqld datadir,
but in the MySQL Embedded Server Library and mysqlbackup it is not the default
directory, and we must set the base file path explicitly */
extern const char* fil_path_to_mysql_datadir;
-extern Folder folder_mysql_datadir;
/** Initial size of a single-table tablespace in pages */
#define FIL_IBD_FILE_INITIAL_SIZE 4
@@ -452,23 +347,6 @@ extern fil_addr_t fil_addr_null;
used to encrypt the page + 32-bit checksum
or 64 bits of zero if no encryption
*/
-/** If page type is FIL_PAGE_COMPRESSED then the 8 bytes starting at
-FIL_PAGE_FILE_FLUSH_LSN are broken down as follows: */
-
-/** Control information version format (u8) */
-static const ulint FIL_PAGE_VERSION = FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION;
-
-/** Compression algorithm (u8) */
-static const ulint FIL_PAGE_ALGORITHM_V1 = FIL_PAGE_VERSION + 1;
-
-/** Original page type (u16) */
-static const ulint FIL_PAGE_ORIGINAL_TYPE_V1 = FIL_PAGE_ALGORITHM_V1 + 1;
-
-/** Original data size in bytes (u16)*/
-static const ulint FIL_PAGE_ORIGINAL_SIZE_V1 = FIL_PAGE_ORIGINAL_TYPE_V1 + 2;
-
-/** Size after compression (u16) */
-static const ulint FIL_PAGE_COMPRESS_SIZE_V1 = FIL_PAGE_ORIGINAL_SIZE_V1 + 2;
/** This overloads FIL_PAGE_FILE_FLUSH_LSN for RTREE Split Sequence Number */
#define FIL_RTREE_SPLIT_SEQ_NUM FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION
@@ -518,11 +396,12 @@ static const ulint FIL_PAGE_COMPRESS_SIZE_V1 = FIL_PAGE_ORIGINAL_SIZE_V1 + 2;
#define FIL_PAGE_TYPE_UNKNOWN 13 /*!< In old tablespaces, garbage
in FIL_PAGE_TYPE is replaced with this
value when flushing pages. */
-#define FIL_PAGE_COMPRESSED 14 /*!< Compressed page */
-#define FIL_PAGE_ENCRYPTED 15 /*!< Encrypted page */
-#define FIL_PAGE_COMPRESSED_AND_ENCRYPTED 16
- /*!< Compressed and Encrypted page */
-#define FIL_PAGE_ENCRYPTED_RTREE 17 /*!< Encrypted R-tree page */
+
+/* File page types introduced in MySQL 5.7, not supported in MariaDB */
+//#define FIL_PAGE_COMPRESSED 14
+//#define FIL_PAGE_ENCRYPTED 15
+//#define FIL_PAGE_COMPRESSED_AND_ENCRYPTED 16
+//#define FIL_PAGE_ENCRYPTED_RTREE 17
/** Used by i_s.cc to index into the text description. */
#define FIL_PAGE_TYPE_LAST FIL_PAGE_TYPE_UNKNOWN
@@ -759,13 +638,6 @@ fil_space_get_flags(
/*================*/
ulint id); /*!< in: space id */
-/** Check if table is mark for truncate.
-@param[in] id space id
-@return true if tablespace is marked for truncate. */
-bool
-fil_space_is_being_truncated(
- ulint id);
-
/** Open each fil_node_t of a named fil_space_t if not already open.
@param[in] name Tablespace name
@return true if all file nodes are opened. */
@@ -1085,14 +957,15 @@ fil_make_filepath(
ib_extention suffix,
bool strip_name);
-/** Creates a new General or Single-Table tablespace
+/** Create a tablespace file.
@param[in] space_id Tablespace ID
@param[in] name Tablespace name in dbname/tablename format.
-For general tablespaces, the 'dbname/' part may be missing.
@param[in] path Path and filename of the datafile to create.
@param[in] flags Tablespace flags
@param[in] size Initial size of the tablespace file in pages,
must be >= FIL_IBD_FILE_INITIAL_SIZE
+@param[in] mode MariaDB encryption mode
+@param[in] key_id MariaDB encryption key_id
@return DB_SUCCESS or error code */
dberr_t
fil_ibd_create(
@@ -1101,10 +974,18 @@ fil_ibd_create(
const char* path,
ulint flags,
ulint size,
- fil_encryption_t mode, /*!< in: encryption mode */
- ulint key_id) /*!< in: encryption key_id */
+ fil_encryption_t mode,
+ ulint key_id)
MY_ATTRIBUTE((warn_unused_result));
+/** Try to adjust FSP_SPACE_FLAGS if they differ from the expectations.
+(Typically when upgrading from MariaDB 10.1.0..10.1.20.)
+@param[in] space_id tablespace ID
+@param[in] flags desired tablespace flags */
+UNIV_INTERN
+void
+fsp_flags_try_adjust(ulint space_id, ulint flags);
+
/********************************************************************//**
Tries to open a single-table tablespace and optionally checks the space id is
right in it. If does not succeed, prints an error message to the .err log. This
@@ -1129,7 +1010,7 @@ statement to update the dictionary tables if they are incorrect.
@param[in] fix_dict true if the dictionary is available to be fixed
@param[in] purpose FIL_TYPE_TABLESPACE or FIL_TYPE_TEMPORARY
@param[in] id tablespace ID
-@param[in] flags tablespace flags
+@param[in] flags expected FSP_SPACE_FLAGS
@param[in] space_name tablespace name of the datafile
If file-per-table, it is the table name in the databasename/tablename format
@param[in] path_in expected filepath, usually read from dictionary
@@ -1205,7 +1086,8 @@ fil_space_for_table_exists_in_mem(
when find table space mismatch */
mem_heap_t* heap, /*!< in: heap memory */
table_id_t table_id, /*!< in: table id */
- dict_table_t* table); /*!< in: table or NULL */
+ dict_table_t* table, /*!< in: table or NULL */
+ ulint table_flags); /*!< in: table flags */
/** Try to extend a tablespace if it is smaller than the specified size.
@param[in,out] space tablespace
@@ -1255,11 +1137,6 @@ fil_space_get_n_reserved_extents(
aligned
@param[in] message message for aio handler if non-sync aio
used, else ignored
-@param[in,out] write_size Actual write size initialized
- after fist successfull trim
- operation for this page and if
- nitialized we do not trim again if
- Actual page
@return DB_SUCCESS, DB_TABLESPACE_DELETED or DB_TABLESPACE_TRUNCATED
if we are trying to do i/o on a tablespace which does not exist */
@@ -1272,8 +1149,7 @@ fil_io(
ulint byte_offset,
ulint len,
void* buf,
- void* message,
- ulint* write_size);
+ void* message);
/**********************************************************************//**
Waits for an aio operation to complete. This function is used to write the
handler for completed requests. The aio array of pending requests is divided
@@ -1403,14 +1279,6 @@ fil_space_inc_redo_skipped_count(
void
fil_space_dec_redo_skipped_count(
ulint id);
-
-/*******************************************************************//**
-Check whether a single-table tablespace is redo skipped.
-@return true if redo skipped */
-bool
-fil_space_is_redo_skipped(
-/*======================*/
- ulint id); /*!< in: space id */
#endif
/********************************************************************//**
@@ -1469,10 +1337,6 @@ struct PageCallback {
@retval the space flags of the tablespace being iterated over */
virtual ulint get_space_flags() const UNIV_NOTHROW = 0;
- /** Set the tablespace table size.
- @param[in] page a page belonging to the tablespace */
- void set_page_size(const buf_frame_t* page) UNIV_NOTHROW;
-
/** The compressed page size
@return the compressed page size */
const page_size_t& get_page_size() const
@@ -1636,43 +1500,6 @@ fil_names_dirty_and_write(
fil_space_t* space,
mtr_t* mtr);
-/** Set the compression type for the tablespace of a table
-@param[in] table Table that should be compressesed
-@param[in] algorithm Text representation of the algorithm
-@return DB_SUCCESS or error code */
-dberr_t
-fil_set_compression(
- dict_table_t* table,
- const char* algorithm)
- MY_ATTRIBUTE((warn_unused_result));
-
-/** Get the compression type for the tablespace
-@param[in] space_id Space ID to check
-@return the compression algorithm */
-Compression::Type
-fil_get_compression(
- ulint space_id)
- MY_ATTRIBUTE((warn_unused_result));
-
-/** Set the encryption type for the tablespace
-@param[in] space Space ID of tablespace for which to set
-@param[in] algorithm Encryption algorithm
-@param[in] key Encryption key
-@param[in] iv Encryption iv
-@return DB_SUCCESS or error code */
-dberr_t
-fil_set_encryption(
- ulint space_id,
- Encryption::Type algorithm,
- byte* key,
- byte* iv)
- MY_ATTRIBUTE((warn_unused_result));
-
-/**
-@return true if the re-encrypt success */
-bool
-fil_encryption_rotate();
-
/** Write MLOG_FILE_NAME records if a persistent tablespace was modified
for the first time since the latest fil_names_clear().
@param[in,out] space tablespace
@@ -1738,10 +1565,6 @@ fil_names_clear(
lsn_t lsn,
bool do_write);
-/** Note that the file system where the file resides doesn't support PUNCH HOLE
-@param[in,out] node Node to set */
-void fil_no_punch_hole(fil_node_t* node);
-
#ifdef UNIV_ENABLE_UNIT_TEST_MAKE_FILEPATH
void test_make_filepath();
#endif /* UNIV_ENABLE_UNIT_TEST_MAKE_FILEPATH */
@@ -1749,15 +1572,16 @@ void test_make_filepath();
/*******************************************************************//**
Returns the block size of the file space
+@param[in] space_id space id
+@param[in] offset page offset
+@param[in] len page len
@return block size */
UNIV_INTERN
ulint
fil_space_get_block_size(
-/*=====================*/
- ulint id, /*!< in: space id */
- ulint offset, /*!< in: page offset */
- ulint len); /*!< in: page len */
-
+ ulint id,
+ os_offset_t offset,
+ ulint len);
/*******************************************************************//**
Increments the count of pending operation, if space is not being deleted.
@return TRUE if being deleted, and operation should be skipped */
diff --git a/storage/innobase/include/fil0fil.ic b/storage/innobase/include/fil0fil.ic
index 8f8a4194c0d..01fa1093e5e 100644
--- a/storage/innobase/include/fil0fil.ic
+++ b/storage/innobase/include/fil0fil.ic
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 2015, MariaDB Corporation.
+Copyright (c) 2015, 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
@@ -58,49 +58,41 @@ fil_get_page_type_name(
{
switch(page_type) {
case FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED:
- return (const char*)"PAGE_COMPRESSED_ENRYPTED";
+ return "PAGE_COMPRESSED_ENRYPTED";
case FIL_PAGE_PAGE_COMPRESSED:
- return (const char*)"PAGE_COMPRESSED";
+ return "PAGE_COMPRESSED";
case FIL_PAGE_INDEX:
- return (const char*)"INDEX";
+ return "INDEX";
case FIL_PAGE_RTREE:
- return (const char*)"RTREE";
+ return "RTREE";
case FIL_PAGE_UNDO_LOG:
- return (const char*)"UNDO LOG";
+ return "UNDO LOG";
case FIL_PAGE_INODE:
- return (const char*)"INODE";
+ return "INODE";
case FIL_PAGE_IBUF_FREE_LIST:
- return (const char*)"IBUF_FREE_LIST";
+ return "IBUF_FREE_LIST";
case FIL_PAGE_TYPE_ALLOCATED:
- return (const char*)"ALLOCATED";
+ return "ALLOCATED";
case FIL_PAGE_IBUF_BITMAP:
- return (const char*)"IBUF_BITMAP";
+ return "IBUF_BITMAP";
case FIL_PAGE_TYPE_SYS:
- return (const char*)"SYS";
+ return "SYS";
case FIL_PAGE_TYPE_TRX_SYS:
- return (const char*)"TRX_SYS";
+ return "TRX_SYS";
case FIL_PAGE_TYPE_FSP_HDR:
- return (const char*)"FSP_HDR";
+ return "FSP_HDR";
case FIL_PAGE_TYPE_XDES:
- return (const char*)"XDES";
+ return "XDES";
case FIL_PAGE_TYPE_BLOB:
- return (const char*)"BLOB";
+ return "BLOB";
case FIL_PAGE_TYPE_ZBLOB:
- return (const char*)"ZBLOB";
+ return "ZBLOB";
case FIL_PAGE_TYPE_ZBLOB2:
- return (const char*)"ZBLOB2";
- case FIL_PAGE_COMPRESSED:
- return (const char*)"ORACLE PAGE COMPRESSED";
- case FIL_PAGE_ENCRYPTED:
- return (const char*)"ORACLE PAGE ENCRYPTED";
- case FIL_PAGE_COMPRESSED_AND_ENCRYPTED:
- return (const char*)"ORACLE PAGE COMPRESSED AND ENCRYPTED";
- case FIL_PAGE_ENCRYPTED_RTREE:
- return (const char*)"ORACLE RTREE ENCRYPTED";
+ return "ZBLOB2";
case FIL_PAGE_TYPE_UNKNOWN:
- return (const char*)"OLD UNKOWN PAGE TYPE";
+ return "OLD UNKOWN PAGE TYPE";
default:
- return (const char*)"PAGE TYPE CORRUPTED";
+ return "PAGE TYPE CORRUPTED";
}
}
@@ -145,52 +137,22 @@ fil_page_type_validate(
page_type == FIL_PAGE_TYPE_BLOB ||
page_type == FIL_PAGE_TYPE_ZBLOB ||
page_type == FIL_PAGE_TYPE_ZBLOB2 ||
- page_type == FIL_PAGE_COMPRESSED ||
- page_type == FIL_PAGE_TYPE_UNKNOWN ||
- page_type == FIL_PAGE_ENCRYPTED ||
- page_type == FIL_PAGE_COMPRESSED_AND_ENCRYPTED ||
- page_type == FIL_PAGE_ENCRYPTED_RTREE))) {
-
- uint key_version = mach_read_from_4(page + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION);
- bool page_compressed = (page_type == FIL_PAGE_PAGE_COMPRESSED);
- bool page_compressed_encrypted = (page_type == FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED);
+ page_type == FIL_PAGE_TYPE_UNKNOWN))) {
+
ulint space = mach_read_from_4(page + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID);
ulint offset = mach_read_from_4(page + FIL_PAGE_OFFSET);
- ib_uint64_t lsn = mach_read_from_8(page + FIL_PAGE_LSN);
- ulint compressed_len = mach_read_from_2(page + FIL_PAGE_DATA);
fil_system_enter();
fil_space_t* rspace = fil_space_get_by_id(space);
fil_system_exit();
/* Dump out the page info */
- fprintf(stderr, "InnoDB: Space %lu offset %lu name %s page_type %lu page_type_name %s\n"
- "InnoDB: key_version %u page_compressed %d page_compressed_encrypted %d lsn %llu compressed_len %lu\n",
- space, offset, rspace->name, page_type, fil_get_page_type_name(page_type),
- key_version, page_compressed, page_compressed_encrypted, (ulonglong)lsn, compressed_len);
- fflush(stderr);
-
- ut_ad(page_type == FIL_PAGE_PAGE_COMPRESSED ||
- page_type == FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED ||
- page_type == FIL_PAGE_INDEX ||
- page_type == FIL_PAGE_RTREE ||
- page_type == FIL_PAGE_UNDO_LOG ||
- page_type == FIL_PAGE_INODE ||
- page_type == FIL_PAGE_IBUF_FREE_LIST ||
- page_type == FIL_PAGE_TYPE_ALLOCATED ||
- page_type == FIL_PAGE_IBUF_BITMAP ||
- page_type == FIL_PAGE_TYPE_SYS ||
- page_type == FIL_PAGE_TYPE_TRX_SYS ||
- page_type == FIL_PAGE_TYPE_FSP_HDR ||
- page_type == FIL_PAGE_TYPE_XDES ||
- page_type == FIL_PAGE_TYPE_BLOB ||
- page_type == FIL_PAGE_TYPE_ZBLOB ||
- page_type == FIL_PAGE_TYPE_ZBLOB2 ||
- page_type == FIL_PAGE_COMPRESSED ||
- page_type == FIL_PAGE_TYPE_UNKNOWN ||
- page_type == FIL_PAGE_ENCRYPTED ||
- page_type == FIL_PAGE_COMPRESSED_AND_ENCRYPTED ||
- page_type == FIL_PAGE_ENCRYPTED_RTREE);
-
+ ib::fatal() << "Page " << space << ":" << offset
+ << " name " << (rspace ? rspace->name : "???")
+ << " page_type " << page_type
+ << " key_version "
+ << mach_read_from_4(page + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION)
+ << " lsn " << mach_read_from_8(page + FIL_PAGE_LSN)
+ << " compressed_len " << mach_read_from_2(page + FIL_PAGE_DATA);
return false;
}
diff --git a/storage/innobase/include/fil0pagecompress.h b/storage/innobase/include/fil0pagecompress.h
index e65d3491155..0bf6aa75f19 100644
--- a/storage/innobase/include/fil0pagecompress.h
+++ b/storage/innobase/include/fil0pagecompress.h
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (C) 2013, 2016 MariaDB Corporation. All Rights Reserved.
+Copyright (C) 2013, 2017 MariaDB Corporation. 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
@@ -49,15 +49,6 @@ fil_space_is_page_compressed(
/*=========================*/
ulint id); /*!< in: space id */
/*******************************************************************//**
-Returns the page compression flag of the space, or false if the space
-is not compressed. The tablespace must be cached in the memory cache.
-@return true if page compressed, false if not or space not found */
-UNIV_INTERN
-bool
-fil_space_get_page_compressed(
-/*=========================*/
- fil_space_t* space); /*!< in: space id */
-/*******************************************************************//**
Returns the atomic writes flag of the space, or false if the space
is not using atomic writes. The tablespace must be cached in the memory cache.
@return atomic write table option value */
diff --git a/storage/innobase/include/fsp0file.h b/storage/innobase/include/fsp0file.h
index 82d086bcf7a..1c4ac8152c9 100644
--- a/storage/innobase/include/fsp0file.h
+++ b/storage/innobase/include/fsp0file.h
@@ -67,8 +67,6 @@ public:
m_first_page(),
m_last_os_error(),
m_file_info(),
- m_encryption_key(NULL),
- m_encryption_iv(NULL),
m_crypt_info()
{
/* No op */
@@ -92,8 +90,6 @@ public:
m_first_page(),
m_last_os_error(),
m_file_info(),
- m_encryption_key(NULL),
- m_encryption_iv(NULL),
m_crypt_info()
{
ut_ad(m_name != NULL);
@@ -115,8 +111,6 @@ public:
m_first_page(),
m_last_os_error(),
m_file_info(),
- m_encryption_key(NULL),
- m_encryption_iv(NULL),
m_crypt_info()
{
m_name = mem_strdup(file.m_name);
@@ -175,8 +169,6 @@ public:
it should be reread if needed */
m_first_page_buf = NULL;
m_first_page = NULL;
- m_encryption_key = NULL;
- m_encryption_iv = NULL;
/* Do not copy crypt info it is read from first page */
m_crypt_info = NULL;
@@ -228,9 +220,8 @@ public:
void set_filepath(const char* filepath);
/** Allocate and set the datafile or tablespace name in m_name.
- If a name is provided, use it; else if the datafile is file-per-table,
- extract a file-per-table tablespace name from m_filepath; else it is a
- general tablespace, so just call it that for now. The value of m_name
+ If a name is provided, use it; else extract a file-per-table
+ tablespace name from m_filepath. The value of m_name
will be freed in the destructor.
@param[in] name Tablespace Name if known, NULL if not */
void set_name(const char* name);
@@ -240,13 +231,9 @@ public:
successfully opened in order for this function to validate it.
@param[in] space_id The expected tablespace ID.
@param[in] flags The expected tablespace flags.
- @param[in] for_import is it for importing
@retval DB_SUCCESS if tablespace is valid, DB_ERROR if not.
m_is_valid is also set true on success, else false. */
- dberr_t validate_to_dd(
- ulint space_id,
- ulint flags,
- bool for_import)
+ dberr_t validate_to_dd(ulint space_id, ulint flags)
MY_ATTRIBUTE((warn_unused_result));
/** Validates this datafile for the purpose of recovery.
@@ -265,13 +252,10 @@ public:
so the Space ID found here must not already be open.
m_is_valid is set true on success, else false.
@param[out] flush_lsn contents of FIL_PAGE_FILE_FLUSH_LSN
- @param[in] for_import if it is for importing
- (only valid for the first file of the system tablespace)
@retval DB_SUCCESS on if the datafile is valid
@retval DB_CORRUPTION if the datafile is not readable
@retval DB_TABLESPACE_EXISTS if there is a duplicate space_id */
- dberr_t validate_first_page(lsn_t* flush_lsn,
- bool for_import)
+ dberr_t validate_first_page(lsn_t* flush_lsn)
MY_ATTRIBUTE((warn_unused_result));
/** Get Datafile::m_name.
@@ -423,12 +407,10 @@ private:
else DB_ERROR. */
dberr_t find_space_id();
- /** Finds a given page of the given space id from the double write
- buffer and copies it to the corresponding .ibd file.
- @param[in] page_no Page number to restore
- @return DB_SUCCESS if page was restored, else DB_ERROR */
- dberr_t restore_from_doublewrite(
- ulint restore_page_no);
+ /** Restore the first page of the tablespace from
+ the double write buffer.
+ @return whether the operation failed */
+ bool restore_from_doublewrite();
/** Points into m_filepath to the file name with extension */
char* m_filename;
@@ -484,12 +466,6 @@ public:
struct stat m_file_info;
#endif /* WIN32 */
- /** Encryption key read from first page */
- byte* m_encryption_key;
-
- /** Encryption iv read from first page */
- byte* m_encryption_iv;
-
/** Encryption information */
fil_space_crypt_t* m_crypt_info;
};
@@ -573,13 +549,10 @@ public:
the path ".".
@param[in] name tablespace name
@param[in] filepath remote filepath of tablespace datafile
- @param[in] is_shared true for general tablespace,
- false for file-per-table
@return DB_SUCCESS or error code */
static dberr_t create_link_file(
const char* name,
- const char* filepath,
- bool is_shared = false);
+ const char* filepath);
/** Delete an InnoDB Symbolic Link (ISL) file by name.
@param[in] name tablespace name */
@@ -589,8 +562,6 @@ public:
It is always created under the datadir of MySQL.
For file-per-table tablespaces, the isl file is expected to be
in a 'database' directory and called 'tablename.isl'.
- For general tablespaces, there will be no 'database' directory.
- The 'basename.isl' will be in the datadir.
The caller must free the memory returned if it is not null.
@param[in] link_filepath filepath of the ISL file
@return Filepath of the IBD file read from the ISL file */
diff --git a/storage/innobase/include/fsp0fsp.h b/storage/innobase/include/fsp0fsp.h
index 6ddcec78a01..fa8d5b76960 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, 2016, MariaDB Corporation. All Rights Reserved.
+Copyright (c) 2013, 2017, MariaDB Corporation. 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
@@ -43,17 +43,55 @@ Created 12/18/1995 Heikki Tuuri
#endif /* !UNIV_INNOCHECKSUM */
#include "fsp0types.h"
-#define FSP_FLAGS_POS_DATA_DIR_ORACLE (FSP_FLAGS_POS_ATOMIC_BLOBS \
- + FSP_FLAGS_WIDTH_ATOMIC_BLOBS \
- + FSP_FLAGS_WIDTH_PAGE_SSIZE)
-/** Bit mask of the DATA_DIR field */
-#define FSP_FLAGS_MASK_DATA_DIR_ORACLE \
- ((~(~0U << FSP_FLAGS_WIDTH_DATA_DIR)) \
- << FSP_FLAGS_POS_DATA_DIR_ORACLE)
+/** @return the PAGE_SSIZE flags for the current innodb_page_size */
+#define FSP_FLAGS_PAGE_SSIZE() \
+ ((UNIV_PAGE_SIZE == UNIV_PAGE_SIZE_ORIG) ? \
+ 0 : (UNIV_PAGE_SIZE_SHIFT - UNIV_ZIP_SIZE_SHIFT_MIN + 1) \
+ << FSP_FLAGS_POS_PAGE_SSIZE)
+
+/* @defgroup Compatibility macros for MariaDB 10.1.0 through 10.1.20;
+see the table in fsp0types.h @{ */
+/** Zero relative shift position of the PAGE_COMPRESSION field */
+#define FSP_FLAGS_POS_PAGE_COMPRESSION_MARIADB101 \
+ (FSP_FLAGS_POS_ATOMIC_BLOBS \
+ + FSP_FLAGS_WIDTH_ATOMIC_BLOBS)
+/** Zero relative shift position of the PAGE_COMPRESSION_LEVEL field */
+#define FSP_FLAGS_POS_PAGE_COMPRESSION_LEVEL_MARIADB101 \
+ (FSP_FLAGS_POS_PAGE_COMPRESSION_MARIADB101 + 1)
+/** Zero relative shift position of the ATOMIC_WRITES field */
+#define FSP_FLAGS_POS_ATOMIC_WRITES_MARIADB101 \
+ (FSP_FLAGS_POS_PAGE_COMPRESSION_LEVEL_MARIADB101 + 4)
+/** Zero relative shift position of the PAGE_SSIZE field */
+#define FSP_FLAGS_POS_PAGE_SSIZE_MARIADB101 \
+ (FSP_FLAGS_POS_ATOMIC_WRITES_MARIADB101 + 2)
+
+/** Bit mask of the PAGE_COMPRESSION field */
+#define FSP_FLAGS_MASK_PAGE_COMPRESSION_MARIADB101 \
+ (1U << FSP_FLAGS_POS_PAGE_COMPRESSION_MARIADB101)
+/** Bit mask of the PAGE_COMPRESSION_LEVEL field */
+#define FSP_FLAGS_MASK_PAGE_COMPRESSION_LEVEL_MARIADB101 \
+ (15U << FSP_FLAGS_POS_PAGE_COMPRESSION_LEVEL_MARIADB101)
+/** Bit mask of the ATOMIC_WRITES field */
+#define FSP_FLAGS_MASK_ATOMIC_WRITES_MARIADB101 \
+ (3U << FSP_FLAGS_POS_ATOMIC_WRITES_MARIADB101)
+/** Bit mask of the PAGE_SSIZE field */
+#define FSP_FLAGS_MASK_PAGE_SSIZE_MARIADB101 \
+ (15U << FSP_FLAGS_POS_PAGE_SSIZE_MARIADB101)
+
+/** Return the value of the PAGE_COMPRESSION field */
+#define FSP_FLAGS_GET_PAGE_COMPRESSION_MARIADB101(flags) \
+ ((flags & FSP_FLAGS_MASK_PAGE_COMPRESSION_MARIADB101) \
+ >> FSP_FLAGS_POS_PAGE_COMPRESSION_MARIADB101)
+/** Return the value of the PAGE_COMPRESSION_LEVEL field */
+#define FSP_FLAGS_GET_PAGE_COMPRESSION_LEVEL_MARIADB101(flags) \
+ ((flags & FSP_FLAGS_MASK_PAGE_COMPRESSION_LEVEL_MARIADB101) \
+ >> FSP_FLAGS_POS_PAGE_COMPRESSION_LEVEL_MARIADB101)
+/** Return the value of the PAGE_SSIZE field */
+#define FSP_FLAGS_GET_PAGE_SSIZE_MARIADB101(flags) \
+ ((flags & FSP_FLAGS_MASK_PAGE_SSIZE_MARIADB101) \
+ >> FSP_FLAGS_POS_PAGE_SSIZE_MARIADB101)
-#define FSP_FLAGS_HAS_DATA_DIR_ORACLE(flags) \
- ((flags & FSP_FLAGS_MASK_DATA_DIR_ORACLE) \
- >> FSP_FLAGS_POS_DATA_DIR_ORACLE)
+/* @} */
/* @defgroup Tablespace Header Constants (moved from fsp0fsp.c) @{ */
@@ -274,7 +312,7 @@ fsp_header_get_tablespace_size(void);
/*================================*/
/** Calculate the number of pages to extend a datafile.
-We extend single-table and general tablespaces first one extent at a time,
+We extend single-table tablespaces first one extent at a time,
but 4 at a time for bigger tablespaces. It is not enough to extend always
by one extent, because we need to add at least one extent to FSP_FREE.
A single extent descriptor page will track many extents. And the extent
@@ -329,38 +367,6 @@ fsp_header_get_flags(const page_t* page)
return(fsp_header_get_field(page, FSP_SPACE_FLAGS));
}
-/** Reads the page size from the first page of a tablespace.
-@param[in] page first page of a tablespace
-@return page size */
-page_size_t
-fsp_header_get_page_size(
- const page_t* page);
-
-/** Decoding the encryption info
-from the first page of a tablespace.
-@param[in/out] key key
-@param[in/out] iv iv
-@param[in] encryption_info encrytion info.
-@return true if success */
-bool
-fsp_header_decode_encryption_info(
- byte* key,
- byte* iv,
- byte* encryption_info);
-
-/** Reads the encryption key from the first page of a tablespace.
-@param[in] fsp_flags tablespace flags
-@param[in/out] key tablespace key
-@param[in/out] iv tablespace iv
-@param[in] page first page of a tablespace
-@return true if success */
-bool
-fsp_header_get_encryption_key(
- ulint fsp_flags,
- byte* key,
- byte* iv,
- page_t* page);
-
/** Get the byte offset of encryption information in page 0.
@param[in] ps page size
@return byte offset relative to FSP_HEADER_OFFSET */
@@ -392,17 +398,6 @@ fsp_header_init_fields(
ulint flags); /*!< in: tablespace flags (FSP_SPACE_FLAGS):
0, or table->flags if newer than COMPACT */
-/** Rotate the encryption info in the space header.
-@param[in] space tablespace
-@param[in] encrypt_info buffer for re-encrypt key.
-@param[in,out] mtr mini-transaction
-@return true if success. */
-bool
-fsp_header_rotate_encryption(
- fil_space_t* space,
- byte* encrypt_info,
- mtr_t* mtr);
-
/** Initializes the space header of a new created space and creates also the
insert buffer tree root if space == 0.
@param[in] space_id space id
@@ -672,60 +667,135 @@ fseg_print(
mtr_t* mtr); /*!< in/out: mini-transaction */
#endif /* UNIV_BTR_PRINT */
-/** Determine if the tablespace is compressed from tablespace flags.
-@param[in] flags Tablespace flags
-@return true if compressed, false if not compressed */
+/** Convert FSP_SPACE_FLAGS from the buggy MariaDB 10.1.0..10.1.20 format.
+@param[in] flags the contents of FSP_SPACE_FLAGS
+@return the flags corrected from the buggy MariaDB 10.1 format
+@retval ULINT_UNDEFINED if the flags are not in the buggy 10.1 format */
+MY_ATTRIBUTE((warn_unused_result, const))
UNIV_INLINE
-bool
-fsp_flags_is_compressed(
- ulint flags);
+ulint
+fsp_flags_convert_from_101(ulint flags)
+{
+ DBUG_EXECUTE_IF("fsp_flags_is_valid_failure",
+ return(ULINT_UNDEFINED););
+ if (flags == 0) {
+ return(flags);
+ }
+
+ if (flags >> 18) {
+ /* The most significant FSP_SPACE_FLAGS bit that was ever set
+ by MariaDB 10.1.0 to 10.1.20 was bit 17 (misplaced DATA_DIR flag).
+ The flags must be less than 1<<18 in order to be valid. */
+ return(ULINT_UNDEFINED);
+ }
+
+ if ((flags & (FSP_FLAGS_MASK_POST_ANTELOPE | FSP_FLAGS_MASK_ATOMIC_BLOBS))
+ == FSP_FLAGS_MASK_ATOMIC_BLOBS) {
+ /* If the "atomic blobs" flag (indicating
+ ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED) flag
+ is set, then the "post Antelope" (ROW_FORMAT!=REDUNDANT) flag
+ must also be set. */
+ return(ULINT_UNDEFINED);
+ }
+
+ /* Bits 6..10 denote compression in MariaDB 10.1.0 to 10.1.20.
+ They must be either 0b00000 or 0b00011 through 0b10011.
+ In correct versions, these bits would be
+ 0bd0sss where d is the DATA_DIR flag (garbage bit) and
+ sss is the PAGE_SSIZE (3, 4, 6, or 7).
+
+ NOTE: MariaDB 10.1.0 to 10.1.20 can misinterpret
+ uncompressed data files with innodb_page_size=4k or 64k as
+ compressed innodb_page_size=16k files. Below is an exhaustive
+ state space analysis.
+
+ -0by1zzz: impossible (the bit 4 must be clean; see above)
+ -0b101xx: DATA_DIR, innodb_page_size>4k: invalid (COMPRESSION_LEVEL>9)
+ +0bx0011: innodb_page_size=4k:
+ !!! Misinterpreted as COMPRESSION_LEVEL=9 or 1, COMPRESSION=1.
+ -0bx0010: impossible, because sss must be 0b011 or 0b1xx
+ -0bx0001: impossible, because sss must be 0b011 or 0b1xx
+ -0b10000: DATA_DIR, innodb_page_size=16:
+ invalid (COMPRESSION_LEVEL=8 but COMPRESSION=0)
+ +0b00111: no DATA_DIR, innodb_page_size=64k:
+ !!! Misinterpreted as COMPRESSION_LEVEL=3, COMPRESSION=1.
+ -0b00101: impossible, because sss must be 0 for 16k, not 0b101
+ -0b001x0: no DATA_DIR, innodb_page_size=32k or 8k:
+ invalid (COMPRESSION_LEVEL=3 but COMPRESSION=0)
+ +0b00000: innodb_page_size=16k (looks like COMPRESSION=0)
+ ??? Could actually be compressed; see PAGE_SSIZE below */
+ const ulint level = FSP_FLAGS_GET_PAGE_COMPRESSION_LEVEL_MARIADB101(
+ flags);
+ if (FSP_FLAGS_GET_PAGE_COMPRESSION_MARIADB101(flags) != (level != 0)
+ || level > 9) {
+ /* The compression flags are not in the buggy MariaDB
+ 10.1 format. */
+ return(ULINT_UNDEFINED);
+ }
+ if (!(~flags & FSP_FLAGS_MASK_ATOMIC_WRITES_MARIADB101)) {
+ /* The ATOMIC_WRITES flags cannot be 0b11.
+ (The bits 11..12 should actually never be 0b11,
+ because in MySQL they would be SHARED|TEMPORARY.) */
+ return(ULINT_UNDEFINED);
+ }
+
+ /* Bits 13..16 are the wrong position for PAGE_SSIZE, and they
+ should contain one of the values 3,4,6,7, that is, be of the form
+ 0b0011 or 0b01xx (except 0b0110).
+ In correct versions, these bits should be 0bc0se
+ where c is the MariaDB COMPRESSED flag
+ and e is the MySQL 5.7 ENCRYPTION flag
+ and s is the MySQL 8.0 SDI flag. MariaDB can only support s=0, e=0.
+
+ Compressed innodb_page_size=16k tables with correct FSP_SPACE_FLAGS
+ will be properly rejected by older MariaDB 10.1.x because they
+ would read as PAGE_SSIZE>=8 which is not valid. */
+
+ const ulint ssize = FSP_FLAGS_GET_PAGE_SSIZE_MARIADB101(flags);
+ if (ssize == 1 || ssize == 2 || ssize == 5 || ssize & 8) {
+ /* the page_size is not between 4k and 64k;
+ 16k should be encoded as 0, not 5 */
+ return(ULINT_UNDEFINED);
+ }
+ const ulint zssize = FSP_FLAGS_GET_ZIP_SSIZE(flags);
+ if (zssize == 0) {
+ /* not ROW_FORMAT=COMPRESSED */
+ } else if (zssize > (ssize ? ssize : 5)) {
+ /* invalid KEY_BLOCK_SIZE */
+ return(ULINT_UNDEFINED);
+ } else if (~flags & (FSP_FLAGS_MASK_POST_ANTELOPE
+ | FSP_FLAGS_MASK_ATOMIC_BLOBS)) {
+ /* both these flags should be set for
+ ROW_FORMAT=COMPRESSED */
+ return(ULINT_UNDEFINED);
+ }
+
+ flags = ((flags & 0x3f) | ssize << FSP_FLAGS_POS_PAGE_SSIZE
+ | FSP_FLAGS_GET_PAGE_COMPRESSION_MARIADB101(flags)
+ << FSP_FLAGS_POS_PAGE_COMPRESSION);
+ ut_ad(fsp_flags_is_valid(flags));
+ return(flags);
+}
-/** Determine if two tablespaces are equivalent or compatible.
-@param[in] flags1 First tablespace flags
-@param[in] flags2 Second tablespace flags
-@return true the flags are compatible, false if not */
+/** Compare tablespace flags.
+@param[in] expected expected flags from dict_tf_to_fsp_flags()
+@param[in] actual flags read from FSP_SPACE_FLAGS
+@return whether the flags match */
+MY_ATTRIBUTE((warn_unused_result))
UNIV_INLINE
bool
-fsp_flags_are_equal(
- ulint flags1,
- ulint flags2);
-
-/** Initialize an FSP flags integer.
-@param[in] page_size page sizes in bytes and compression flag.
-@param[in] atomic_blobs Used by Dynammic and Compressed.
-@param[in] has_data_dir This tablespace is in a remote location.
-@param[in] is_shared This tablespace can be shared by many tables.
-@param[in] is_temporary This tablespace is temporary.
-@param[in] is_encrypted This tablespace is encrypted.
-@return tablespace flags after initialization */
-UNIV_INLINE
-ulint
-fsp_flags_init(
- const page_size_t& page_size,
- bool atomic_blobs,
- bool has_data_dir,
- bool is_shared,
- bool is_temporary,
- bool page_compression,
- ulint page_compression_level,
- ulint not_used,
- bool is_encrypted = false);
-
-/** Convert a 32 bit integer tablespace flags to the 32 bit table flags.
-This can only be done for a tablespace that was built as a file-per-table
-tablespace. Note that the fsp_flags cannot show the difference between a
-Compact and Redundant table, so an extra Compact boolean must be supplied.
- Low order bit
- | REDUNDANT | COMPACT | COMPRESSED | DYNAMIC
-fil_space_t::flags | 0 | 0 | 1 | 1
-dict_table_t::flags | 0 | 1 | 1 | 1
-@param[in] fsp_flags fil_space_t::flags
-@param[in] compact true if not Redundant row format
-@return tablespace flags (fil_space_t::flags) */
-ulint
-fsp_flags_to_dict_tf(
- ulint fsp_flags,
- bool compact);
+fsp_flags_match(ulint expected, ulint actual)
+{
+ expected &= ~FSP_FLAGS_MEM_MASK;
+ ut_ad(fsp_flags_is_valid(expected));
+
+ if (actual == expected) {
+ return(true);
+ }
+
+ actual = fsp_flags_convert_from_101(actual);
+ return(actual == expected);
+}
/** Calculates the descriptor index within a descriptor page.
@param[in] page_size page size
@@ -737,27 +807,6 @@ xdes_calc_descriptor_index(
const page_size_t& page_size,
ulint offset);
-/** Gets pointer to a the extent descriptor of a page.
-The page where the extent descriptor resides is x-locked. If the page offset
-is equal to the free limit of the space, adds new extents from above the free
-limit to the space free list, if not free limit == space size. This adding
-is necessary to make the descriptor defined, as they are uninitialized
-above the free limit.
-@param[in] space_id space id
-@param[in] offset page offset; if equal to the free limit, we
-try to add new extents to the space free list
-@param[in] page_size page size
-@param[in,out] mtr mini-transaction
-@return pointer to the extent descriptor, NULL if the page does not
-exist in the space or if the offset exceeds the free limit */
-xdes_t*
-xdes_get_descriptor(
- ulint space_id,
- ulint offset,
- const page_size_t& page_size,
- mtr_t* mtr)
-MY_ATTRIBUTE((warn_unused_result));
-
/**********************************************************************//**
Gets a descriptor bit of a page.
@return TRUE if free */
diff --git a/storage/innobase/include/fsp0fsp.ic b/storage/innobase/include/fsp0fsp.ic
index 31317969bf0..6317a67a089 100644
--- a/storage/innobase/include/fsp0fsp.ic
+++ b/storage/innobase/include/fsp0fsp.ic
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2013, 2016, MariaDB Corporation.
+Copyright (c) 2013, 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
@@ -40,218 +40,6 @@ fsp_descr_page(
== FSP_XDES_OFFSET);
}
-/** Determine if the tablespace is compressed from tablespace flags.
-@param[in] flags Tablespace flags
-@return true if compressed, false if not compressed */
-UNIV_INLINE
-bool
-fsp_flags_is_compressed(
- ulint flags)
-{
- return(FSP_FLAGS_GET_ZIP_SSIZE(flags) != 0);
-}
-
-#define ACTUAL_SSIZE(ssize) (0 == ssize ? UNIV_PAGE_SSIZE_ORIG : ssize)
-
-/** Determine if two tablespaces are equivalent or compatible.
-@param[in] flags1 First tablespace flags
-@param[in] flags2 Second tablespace flags
-@return true the flags are compatible, false if not */
-UNIV_INLINE
-bool
-fsp_flags_are_equal(
- ulint flags1,
- ulint flags2)
-{
- /* If either one of these flags is ULINT_UNDEFINED,
- then they are not equal */
- if (flags1 == ULINT_UNDEFINED || flags2 == ULINT_UNDEFINED) {
- return(false);
- }
-
- if (!fsp_is_shared_tablespace(flags1) || !fsp_is_shared_tablespace(flags2)) {
- /* At least one of these is a single-table tablespaces so all
- flags must match. */
- return(flags1 == flags2);
- }
-
- /* Both are shared tablespaces which can contain all formats.
- But they must have the same logical and physical page size.
- Once InnoDB can support multiple page sizes together,
- the logical page size will not matter. */
- ulint zip_ssize1 = ACTUAL_SSIZE(FSP_FLAGS_GET_ZIP_SSIZE(flags1));
- ulint zip_ssize2 = ACTUAL_SSIZE(FSP_FLAGS_GET_ZIP_SSIZE(flags2));
- ulint page_ssize1 = ACTUAL_SSIZE(FSP_FLAGS_GET_PAGE_SSIZE(flags1));
- ulint page_ssize2 = ACTUAL_SSIZE(FSP_FLAGS_GET_PAGE_SSIZE(flags2));
-
- return(zip_ssize1 == zip_ssize2 && page_ssize1 == page_ssize2);
-}
-
-/** Convert a page size, which is a power of 2, to an ssize, which is
-the number of bit shifts from 512 to make that page size.
-@param[in] page_size compressed page size in bytes
-@return an ssize created from the page size provided. */
-UNIV_INLINE
-ulint
-page_size_to_ssize(
- ulint page_size)
-{
- ulint ssize;
-
- for (ssize = UNIV_ZIP_SIZE_SHIFT_MIN;
- ((ulint) 1 << ssize) < page_size;
- ssize++) {};
-
- return(ssize - UNIV_ZIP_SIZE_SHIFT_MIN + 1);
-}
-
-/** Add the compressed page size to the tablespace flags.
-@param[in] flags Tablespace flags
-@param[in] page_size page sizes in bytes and compression flag.
-@return tablespace flags after zip size is added */
-UNIV_INLINE
-ulint
-fsp_flags_set_zip_size(
- ulint flags,
- const page_size_t& page_size)
-{
- if (!page_size.is_compressed()) {
- return(flags);
- }
-
- /* Zip size should be a power of 2 between UNIV_ZIP_SIZE_MIN
- and UNIV_ZIP_SIZE_MAX */
- ut_ad(page_size.physical() >= UNIV_ZIP_SIZE_MIN);
- ut_ad(page_size.physical() <= UNIV_ZIP_SIZE_MAX);
- ut_ad(ut_is_2pow(page_size.physical()));
-
- ulint ssize = page_size_to_ssize(page_size.physical());
-
- ut_ad(ssize > 0);
- ut_ad(ssize <= UNIV_PAGE_SSIZE_MAX);
-
- flags |= (ssize << FSP_FLAGS_POS_ZIP_SSIZE);
-
- ut_ad(fsp_flags_is_valid(flags));
-
- return(flags);
-}
-
-/** Add the page size to the tablespace flags.
-@param[in] flags Tablespace flags
-@param[in] page_size page sizes in bytes and compression flag.
-@return tablespace flags after page size is added */
-UNIV_INLINE
-ulint
-fsp_flags_set_page_size(
- ulint flags,
- const page_size_t& page_size)
-{
- /* Page size should be a power of two between UNIV_PAGE_SIZE_MIN
- and UNIV_PAGE_SIZE */
- ut_ad(page_size.logical() >= UNIV_PAGE_SIZE_MIN);
- ut_ad(page_size.logical() <= UNIV_PAGE_SIZE_MAX);
- ut_ad(ut_is_2pow(page_size.logical()));
-
- /* Remove this assert once we add support for different
- page size per tablespace. Currently all tablespaces must
- have a page size that is equal to innodb-page-size */
- ut_ad(page_size.logical() == UNIV_PAGE_SIZE);
-
- if (page_size.logical() == UNIV_PAGE_SIZE_ORIG) {
- ut_ad(0 == FSP_FLAGS_GET_PAGE_SSIZE(flags));
-
- } else {
- ulint ssize = page_size_to_ssize(page_size.logical());
-
- ut_ad(ssize);
- ut_ad(ssize <= UNIV_PAGE_SSIZE_MAX);
-
- flags |= (ssize << FSP_FLAGS_POS_PAGE_SSIZE);
- }
-
- ut_ad(fsp_flags_is_valid(flags));
-
- return(flags);
-}
-
-/** Initialize an FSP flags integer.
-@param[in] page_size page sizes in bytes and compression flag.
-@param[in] atomic_blobs Used by Dynammic and Compressed.
-@param[in] has_data_dir This tablespace is in a remote location.
-@param[in] is_shared This tablespace can be shared by many tables.
-@param[in] is_temporary This tablespace is temporary.
-@param[in] is_encrypted This tablespace is encrypted.
-@param[in] page_compressed Table uses page compression
-@param[in] page_compression_level Page compression level
-@param[in] not_used For future
-@@return tablespace flags after initialization */
-UNIV_INLINE
-ulint
-fsp_flags_init(
- const page_size_t& page_size,
- bool atomic_blobs,
- bool has_data_dir,
- bool is_shared,
- bool is_temporary,
- bool page_compression,
- ulint page_compression_level,
- ulint not_used,
- bool is_encrypted)
-{
- ut_ad(page_size.physical() <= page_size.logical());
- ut_ad(!page_size.is_compressed() || atomic_blobs);
-
- /* Page size should be a power of two between UNIV_PAGE_SIZE_MIN
- and UNIV_PAGE_SIZE, but zip_size may be 0 if not compressed. */
- ulint flags = fsp_flags_set_page_size(0, page_size);
-
- if (atomic_blobs) {
- flags |= FSP_FLAGS_MASK_POST_ANTELOPE
- | FSP_FLAGS_MASK_ATOMIC_BLOBS;
- }
-
- /* If the zip_size is explicit and different from the default,
- compressed row format is implied. */
- flags = fsp_flags_set_zip_size(flags, page_size);
-
- if (has_data_dir) {
- flags |= FSP_FLAGS_MASK_DATA_DIR;
- }
-
- /* Shared tablespaces can hold all row formats, so we only mark the
- POST_ANTELOPE and ATOMIC_BLOB bits if it is compressed. */
- if (is_shared) {
- ut_ad(!has_data_dir);
- flags |= FSP_FLAGS_MASK_SHARED;
- }
-
- if (is_temporary) {
- ut_ad(!has_data_dir);
- flags |= FSP_FLAGS_MASK_TEMPORARY;
- }
-
- if (is_encrypted) {
- flags |= FSP_FLAGS_MASK_ENCRYPTION;
- }
-
- /* In addition, tablespace flags also contain if the page
- compression is used for this table. */
- if (page_compression) {
- flags |= FSP_FLAGS_SET_PAGE_COMPRESSION(flags, page_compression);
- }
-
- /* In addition, tablespace flags also contain page compression level
- if page compression is used for this table. */
- if (page_compression && page_compression_level) {
- flags |= FSP_FLAGS_SET_PAGE_COMPRESSION_LEVEL(flags, page_compression_level);
- }
-
- ut_ad(fsp_flags_is_valid(flags));
-
- return(flags);
-}
-
/** Calculates the descriptor index within a descriptor page.
@param[in] page_size page size
@param[in] offset page offset
diff --git a/storage/innobase/include/fsp0pagecompress.h b/storage/innobase/include/fsp0pagecompress.h
index 9038aa0fdef..b45a4b87890 100644
--- a/storage/innobase/include/fsp0pagecompress.h
+++ b/storage/innobase/include/fsp0pagecompress.h
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (C) 2013, 2015, MariaDB Corporation. All Rights Reserved.
+Copyright (C) 2013, 2017, MariaDB Corporation. 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
@@ -48,15 +48,6 @@ fsp_header_get_compression_level(
const page_t* page); /*!< in: first page of a tablespace */
/********************************************************************//**
-Determine if the tablespace is page compressed from dict_table_t::flags.
-@return TRUE if page compressed, FALSE if not compressed */
-UNIV_INLINE
-bool
-fsp_flags_is_page_compressed(
-/*=========================*/
- ulint flags); /*!< in: tablespace flags */
-
-/********************************************************************//**
Extract the page compression level from tablespace flags.
A tablespace has only one physical page compression level
whether that page is compressed or not.
diff --git a/storage/innobase/include/fsp0pagecompress.ic b/storage/innobase/include/fsp0pagecompress.ic
index 0915fae4b92..bb11371d712 100644
--- a/storage/innobase/include/fsp0pagecompress.ic
+++ b/storage/innobase/include/fsp0pagecompress.ic
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (C) 2013, 2015, MariaDB Corporation. All Rights Reserved.
+Copyright (C) 2013, 2017, MariaDB Corporation. 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
@@ -26,18 +26,6 @@ Created 11/12/2013 Jan Lindström jan.lindstrom@mariadb.com
***********************************************************************/
/********************************************************************//**
-Determine if the tablespace is page compressed from dict_table_t::flags.
-@return TRUE if page compressed, FALSE if not page compressed */
-UNIV_INLINE
-bool
-fsp_flags_is_page_compressed(
-/*=========================*/
- ulint flags) /*!< in: tablespace flags */
-{
- return(FSP_FLAGS_GET_PAGE_COMPRESSION(flags));
-}
-
-/********************************************************************//**
Determine the tablespace is page compression level from dict_table_t::flags.
@return page compression level or 0 if not compressed*/
UNIV_INLINE
@@ -119,16 +107,10 @@ fil_space_is_page_compressed(
/*=========================*/
ulint id) /*!< in: space id */
{
- ulint flags;
-
- flags = fil_space_get_flags(id);
-
- if (flags && flags != ULINT_UNDEFINED) {
-
- return(fsp_flags_is_page_compressed(flags));
- }
+ ulint flags = fil_space_get_flags(id);
- return(0);
+ return(flags != ULINT_UNDEFINED
+ && FSP_FLAGS_HAS_PAGE_COMPRESSION(flags));
}
#endif /* UNIV_INNOCHECKSUM */
diff --git a/storage/innobase/include/fsp0space.h b/storage/innobase/include/fsp0space.h
index 31a1a4abc75..6ecca6211ed 100644
--- a/storage/innobase/include/fsp0space.h
+++ b/storage/innobase/include/fsp0space.h
@@ -1,6 +1,7 @@
/*****************************************************************************
Copyright (c) 2013, 2016, 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
@@ -18,7 +19,7 @@ this program; if not, write to the Free Software Foundation, Inc.,
/**************************************************//**
@file include/fsp0space.h
-General shared tablespace implementation.
+Shared tablespace interface
Created 2013-7-26 by Kevin Lewis
*******************************************************/
@@ -61,10 +62,6 @@ public:
shutdown();
ut_ad(m_files.empty());
ut_ad(m_space_id == ULINT_UNDEFINED);
- if (m_name != NULL) {
- ut_free(m_name);
- m_name = NULL;
- }
if (m_path != NULL) {
ut_free(m_path);
m_path = NULL;
@@ -75,21 +72,8 @@ public:
Tablespace(const Tablespace&);
Tablespace& operator=(const Tablespace&);
- /** Set tablespace name
- @param[in] name tablespace name */
- void set_name(const char* name)
- {
- ut_ad(m_name == NULL);
- m_name = mem_strdup(name);
- ut_ad(m_name != NULL);
- }
-
- /** Get tablespace name
- @return tablespace name */
- const char* name() const
- {
- return(m_name);
- }
+ void set_name(const char* name) { m_name = name; }
+ const char* name() const { return m_name; }
/** Set tablespace path and filename members.
@param[in] path where tablespace file(s) resides
@@ -236,7 +220,7 @@ private:
/* DATA MEMBERS */
/** Name of the tablespace. */
- char* m_name;
+ const char* m_name;
/** Tablespace ID */
ulint m_space_id;
diff --git a/storage/innobase/include/fsp0types.h b/storage/innobase/include/fsp0types.h
index c264fe1b595..429af4210b7 100644
--- a/storage/innobase/include/fsp0types.h
+++ b/storage/innobase/include/fsp0types.h
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2014, 2016, MariaDB Corporation.
+Copyright (c) 2014, 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
@@ -187,18 +187,6 @@ every XDES_DESCRIBED_PER_PAGE pages in every tablespace. */
/*--------------------------------------*/
/* @} */
-/** Validate the tablespace flags.
-These flags are stored in the tablespace header at offset FSP_SPACE_FLAGS.
-They should be 0 for ROW_FORMAT=COMPACT and ROW_FORMAT=REDUNDANT.
-The newer row formats, COMPRESSED and DYNAMIC, use a file format > Antelope
-so they should have a file format number plus the DICT_TF_COMPACT bit set.
-@param[in] flags Tablespace flags
-@return true if valid, false if not */
-bool
-fsp_flags_is_valid(
- ulint flags)
- MY_ATTRIBUTE((warn_unused_result, const));
-
/** Check if tablespace is system temporary.
@param[in] space_id verify is checksum is enabled for given space.
@return true if tablespace is system temporary. */
@@ -216,15 +204,6 @@ bool
fsp_is_checksum_disabled(
ulint space_id);
-/** Check if tablespace is file-per-table.
-@param[in] space_id Tablespace ID
-@param[in] fsp_flags Tablespace Flags
-@return true if tablespace is file-per-table. */
-bool
-fsp_is_file_per_table(
- ulint space_id,
- ulint fsp_flags);
-
#ifdef UNIV_DEBUG
/** Skip some of the sanity checks that are time consuming even in debug mode
and can affect frequent verification runs that are done to ensure stability of
@@ -249,43 +228,68 @@ to the two Barracuda row formats COMPRESSED and DYNAMIC. */
#define FSP_FLAGS_WIDTH_ATOMIC_BLOBS 1
/** Number of flag bits used to indicate the tablespace page size */
#define FSP_FLAGS_WIDTH_PAGE_SSIZE 4
-/** Width of the DATA_DIR flag. This flag indicates that the tablespace
-is found in a remote location, not the default data directory. */
-#define FSP_FLAGS_WIDTH_DATA_DIR 1
-/** Width of the SHARED flag. This flag indicates that the tablespace
-was created with CREATE TABLESPACE and can be shared by multiple tables. */
-#define FSP_FLAGS_WIDTH_SHARED 1
-/** Width of the TEMPORARY flag. This flag indicates that the tablespace
-is a temporary tablespace and everything in it is temporary, meaning that
-it is for a single client and should be deleted upon startup if it exists. */
-#define FSP_FLAGS_WIDTH_TEMPORARY 1
-/** Width of the encryption flag. This flag indicates that the tablespace
-is a tablespace with encryption. */
-#define FSP_FLAGS_WIDTH_ENCRYPTION 1
-
-/** Number of flag bits used to indicate the page compression and compression level */
-#define FSP_FLAGS_WIDTH_PAGE_COMPRESSION 1
-#define FSP_FLAGS_WIDTH_PAGE_COMPRESSION_LEVEL 4
-
-/** Number of flag bits used to indicate atomic writes for this tablespace */
-#define FSP_FLAGS_WIDTH_ATOMIC_WRITES 2
-
-/** Width of all the currently known tablespace flags */
+/** Number of reserved bits */
+#define FSP_FLAGS_WIDTH_RESERVED 6
+/** Number of flag bits used to indicate the page compression */
+#define FSP_FLAGS_WIDTH_PAGE_COMPRESSION 1
+
+/** Width of all the currently known persistent tablespace flags */
#define FSP_FLAGS_WIDTH (FSP_FLAGS_WIDTH_POST_ANTELOPE \
+ FSP_FLAGS_WIDTH_ZIP_SSIZE \
+ FSP_FLAGS_WIDTH_ATOMIC_BLOBS \
+ FSP_FLAGS_WIDTH_PAGE_SSIZE \
- + FSP_FLAGS_WIDTH_DATA_DIR \
- + FSP_FLAGS_WIDTH_SHARED \
- + FSP_FLAGS_WIDTH_TEMPORARY \
- + FSP_FLAGS_WIDTH_ENCRYPTION \
- + FSP_FLAGS_WIDTH_PAGE_COMPRESSION \
- + FSP_FLAGS_WIDTH_PAGE_COMPRESSION_LEVEL \
- + FSP_FLAGS_WIDTH_ATOMIC_WRITES )
-
-/** A mask of all the known/used bits in tablespace flags */
+ + FSP_FLAGS_WIDTH_RESERVED \
+ + FSP_FLAGS_WIDTH_PAGE_COMPRESSION)
+
+/** A mask of all the known/used bits in FSP_SPACE_FLAGS */
#define FSP_FLAGS_MASK (~(~0U << FSP_FLAGS_WIDTH))
+/* FSP_SPACE_FLAGS position and name in MySQL 5.6/MariaDB 10.0 or older
+and MariaDB 10.1.20 or older MariaDB 10.1 and in MariaDB 10.1.21
+or newer.
+MySQL 5.6 MariaDB 10.1.x MariaDB 10.1.21
+====================================================================
+Below flags in same offset
+====================================================================
+0: POST_ANTELOPE 0:POST_ANTELOPE 0: POST_ANTELOPE
+1..4: ZIP_SSIZE(0..5) 1..4:ZIP_SSIZE(0..5) 1..4: ZIP_SSIZE(0..5)
+(NOTE: bit 4 is always 0)
+5: ATOMIC_BLOBS 5:ATOMIC_BLOBS 5: ATOMIC_BLOBS
+=====================================================================
+Below note the order difference:
+=====================================================================
+6..9: PAGE_SSIZE(3..7) 6: COMPRESSION 6..9: PAGE_SSIZE(3..7)
+10: DATA_DIR 7..10: COMP_LEVEL(0..9) 10: RESERVED (5.6 DATA_DIR)
+=====================================================================
+The flags below were in incorrect position in MariaDB 10.1,
+or have been introduced in MySQL 5.7 or 8.0:
+=====================================================================
+11: UNUSED 11..12:ATOMIC_WRITES 11: RESERVED (5.7 SHARED)
+ 12: RESERVED (5.7 TEMPORARY)
+ 13..15:PAGE_SSIZE(3..7) 13: RESERVED (5.7 ENCRYPTION)
+ 14: RESERVED (8.0 SDI)
+ 15: RESERVED
+ 16: PAGE_SSIZE_msb(0) 16: COMPRESSION
+ 17: DATA_DIR 17: UNUSED
+ 18: UNUSED
+=====================================================================
+The flags below only exist in fil_space_t::flags, not in FSP_SPACE_FLAGS:
+=====================================================================
+ 25: DATA_DIR
+ 26..27: ATOMIC_WRITES
+ 28..31: COMPRESSION_LEVEL
+*/
+
+/** A mask of the memory-only flags in fil_space_t::flags */
+#define FSP_FLAGS_MEM_MASK (~0U << FSP_FLAGS_MEM_DATA_DIR)
+
+/** Zero relative shift position of the DATA_DIR flag */
+#define FSP_FLAGS_MEM_DATA_DIR 25
+/** Zero relative shift position of the ATOMIC_WRITES field */
+#define FSP_FLAGS_MEM_ATOMIC_WRITES 26
+/** Zero relative shift position of the COMPRESSION_LEVEL field */
+#define FSP_FLAGS_MEM_COMPRESSION_LEVEL 28
+
/** Zero relative shift position of the POST_ANTELOPE field */
#define FSP_FLAGS_POS_POST_ANTELOPE 0
/** Zero relative shift position of the ZIP_SSIZE field */
@@ -294,34 +298,16 @@ is a tablespace with encryption. */
/** Zero relative shift position of the ATOMIC_BLOBS field */
#define FSP_FLAGS_POS_ATOMIC_BLOBS (FSP_FLAGS_POS_ZIP_SSIZE \
+ FSP_FLAGS_WIDTH_ZIP_SSIZE)
-/** Zero relative shift position of the PAGE_SSIZE field */
+/** Zero relative shift position of the start of the PAGE_SSIZE bits */
#define FSP_FLAGS_POS_PAGE_SSIZE (FSP_FLAGS_POS_ATOMIC_BLOBS \
- + FSP_FLAGS_WIDTH_ATOMIC_BLOBS)
-/** Zero relative shift position of the start of the DATA_DIR bit */
-#define FSP_FLAGS_POS_DATA_DIR (FSP_FLAGS_POS_PAGE_SSIZE \
+ + FSP_FLAGS_WIDTH_ATOMIC_BLOBS)
+/** Zero relative shift position of the start of the RESERVED bits
+these are only used in MySQL 5.7 and used for compatibility. */
+#define FSP_FLAGS_POS_RESERVED (FSP_FLAGS_POS_PAGE_SSIZE \
+ FSP_FLAGS_WIDTH_PAGE_SSIZE)
-/** Zero relative shift position of the start of the SHARED bit */
-#define FSP_FLAGS_POS_SHARED (FSP_FLAGS_POS_DATA_DIR \
- + FSP_FLAGS_WIDTH_DATA_DIR)
-/** Zero relative shift position of the start of the TEMPORARY bit */
-#define FSP_FLAGS_POS_TEMPORARY (FSP_FLAGS_POS_SHARED \
- + FSP_FLAGS_WIDTH_SHARED)
-/** Zero relative shift position of the start of the ENCRYPTION bit */
-#define FSP_FLAGS_POS_ENCRYPTION (FSP_FLAGS_POS_TEMPORARY \
- + FSP_FLAGS_WIDTH_TEMPORARY)
/** Zero relative shift position of the PAGE_COMPRESSION field */
-#define FSP_FLAGS_POS_PAGE_COMPRESSION (FSP_FLAGS_POS_ENCRYPTION \
- + FSP_FLAGS_WIDTH_ENCRYPTION)
-/** Zero relative shift position of the PAGE_COMPRESSION_LEVEL field */
-#define FSP_FLAGS_POS_PAGE_COMPRESSION_LEVEL (FSP_FLAGS_POS_PAGE_COMPRESSION \
- + FSP_FLAGS_WIDTH_PAGE_COMPRESSION)
-/** Zero relative shift position of the ATOMIC_WRITES field */
-#define FSP_FLAGS_POS_ATOMIC_WRITES (FSP_FLAGS_POS_PAGE_COMPRESSION_LEVEL \
- + FSP_FLAGS_WIDTH_PAGE_COMPRESSION_LEVEL)
-/** Zero relative shift position of the start of the UNUSED bits */
-#define FSP_FLAGS_POS_UNUSED (FSP_FLAGS_POS_ATOMIC_WRITES \
- + FSP_FLAGS_WIDTH_ATOMIC_WRITES)
-
+#define FSP_FLAGS_POS_PAGE_COMPRESSION (FSP_FLAGS_POS_RESERVED \
+ + FSP_FLAGS_WIDTH_RESERVED)
/** Bit mask of the POST_ANTELOPE field */
#define FSP_FLAGS_MASK_POST_ANTELOPE \
@@ -339,34 +325,22 @@ is a tablespace with encryption. */
#define FSP_FLAGS_MASK_PAGE_SSIZE \
((~(~0U << FSP_FLAGS_WIDTH_PAGE_SSIZE)) \
<< FSP_FLAGS_POS_PAGE_SSIZE)
-/** Bit mask of the DATA_DIR field */
-#define FSP_FLAGS_MASK_DATA_DIR \
- ((~(~0U << FSP_FLAGS_WIDTH_DATA_DIR)) \
- << FSP_FLAGS_POS_DATA_DIR)
-/** Bit mask of the SHARED field */
-#define FSP_FLAGS_MASK_SHARED \
- ((~(~0U << FSP_FLAGS_WIDTH_SHARED)) \
- << FSP_FLAGS_POS_SHARED)
-/** Bit mask of the TEMPORARY field */
-#define FSP_FLAGS_MASK_TEMPORARY \
- ((~(~0U << FSP_FLAGS_WIDTH_TEMPORARY)) \
- << FSP_FLAGS_POS_TEMPORARY)
-/** Bit mask of the ENCRYPTION field */
-#define FSP_FLAGS_MASK_ENCRYPTION \
- ((~(~0U << FSP_FLAGS_WIDTH_ENCRYPTION)) \
- << FSP_FLAGS_POS_ENCRYPTION)
+/** Bit mask of the RESERVED1 field */
+#define FSP_FLAGS_MASK_RESERVED \
+ ((~(~0U << FSP_FLAGS_WIDTH_RESERVED)) \
+ << FSP_FLAGS_POS_RESERVED)
/** Bit mask of the PAGE_COMPRESSION field */
-#define FSP_FLAGS_MASK_PAGE_COMPRESSION \
+#define FSP_FLAGS_MASK_PAGE_COMPRESSION \
((~(~0U << FSP_FLAGS_WIDTH_PAGE_COMPRESSION)) \
<< FSP_FLAGS_POS_PAGE_COMPRESSION)
-/** Bit mask of the PAGE_COMPRESSION_LEVEL field */
-#define FSP_FLAGS_MASK_PAGE_COMPRESSION_LEVEL \
- ((~(~0U << FSP_FLAGS_WIDTH_PAGE_COMPRESSION_LEVEL)) \
- << FSP_FLAGS_POS_PAGE_COMPRESSION_LEVEL)
-/** Bit mask of the ATOMIC_WRITES field */
-#define FSP_FLAGS_MASK_ATOMIC_WRITES \
- ((~(~0U << FSP_FLAGS_WIDTH_ATOMIC_WRITES)) \
- << FSP_FLAGS_POS_ATOMIC_WRITES)
+
+/** Bit mask of the in-memory ATOMIC_WRITES field */
+#define FSP_FLAGS_MASK_MEM_ATOMIC_WRITES \
+ (3U << FSP_FLAGS_MEM_ATOMIC_WRITES)
+
+/** Bit mask of the in-memory COMPRESSION_LEVEL field */
+#define FSP_FLAGS_MASK_MEM_COMPRESSION_LEVEL \
+ (15U << FSP_FLAGS_MEM_COMPRESSION_LEVEL)
/** Return the value of the POST_ANTELOPE field */
#define FSP_FLAGS_GET_POST_ANTELOPE(flags) \
@@ -384,53 +358,88 @@ is a tablespace with encryption. */
#define FSP_FLAGS_GET_PAGE_SSIZE(flags) \
((flags & FSP_FLAGS_MASK_PAGE_SSIZE) \
>> FSP_FLAGS_POS_PAGE_SSIZE)
-/** Return the value of the DATA_DIR field */
-#define FSP_FLAGS_HAS_DATA_DIR(flags) \
- ((flags & FSP_FLAGS_MASK_DATA_DIR) \
- >> FSP_FLAGS_POS_DATA_DIR)
-/** Return the contents of the SHARED field */
-#define FSP_FLAGS_GET_SHARED(flags) \
- ((flags & FSP_FLAGS_MASK_SHARED) \
- >> FSP_FLAGS_POS_SHARED)
-/** Return the contents of the TEMPORARY field */
-#define FSP_FLAGS_GET_TEMPORARY(flags) \
- ((flags & FSP_FLAGS_MASK_TEMPORARY) \
- >> FSP_FLAGS_POS_TEMPORARY)
-/** Return the contents of the ENCRYPTION field */
-#define FSP_FLAGS_GET_ENCRYPTION(flags) \
- ((flags & FSP_FLAGS_MASK_ENCRYPTION) \
- >> FSP_FLAGS_POS_ENCRYPTION)
+/** @return the RESERVED flags */
+#define FSP_FLAGS_GET_RESERVED(flags) \
+ ((flags & FSP_FLAGS_MASK_RESERVED) \
+ >> FSP_FLAGS_POS_RESERVED)
+/** @return the PAGE_COMPRESSION flag */
+#define FSP_FLAGS_HAS_PAGE_COMPRESSION(flags) \
+ ((flags & FSP_FLAGS_MASK_PAGE_COMPRESSION) \
+ >> FSP_FLAGS_POS_PAGE_COMPRESSION)
+
/** Return the contents of the UNUSED bits */
#define FSP_FLAGS_GET_UNUSED(flags) \
(flags >> FSP_FLAGS_POS_UNUSED)
-/** Return the value of the PAGE_COMPRESSION field */
-#define FSP_FLAGS_GET_PAGE_COMPRESSION(flags) \
- ((flags & FSP_FLAGS_MASK_PAGE_COMPRESSION) \
- >> FSP_FLAGS_POS_PAGE_COMPRESSION)
-/** Return the value of the PAGE_COMPRESSION_LEVEL field */
+
+/** @return the value of the DATA_DIR field */
+#define FSP_FLAGS_HAS_DATA_DIR(flags) \
+ (flags & 1U << FSP_FLAGS_MEM_DATA_DIR)
+/** @return the COMPRESSION_LEVEL field */
#define FSP_FLAGS_GET_PAGE_COMPRESSION_LEVEL(flags) \
- ((flags & FSP_FLAGS_MASK_PAGE_COMPRESSION_LEVEL) \
- >> FSP_FLAGS_POS_PAGE_COMPRESSION_LEVEL)
-/** Return the value of the ATOMIC_WRITES field */
+ ((flags & FSP_FLAGS_MASK_MEM_COMPRESSION_LEVEL) \
+ >> FSP_FLAGS_MEM_COMPRESSION_LEVEL)
+/** @return the ATOMIC_WRITES field */
#define FSP_FLAGS_GET_ATOMIC_WRITES(flags) \
- ((flags & FSP_FLAGS_MASK_ATOMIC_WRITES) \
- >> FSP_FLAGS_POS_ATOMIC_WRITES)
-/** Use an alias in the code for FSP_FLAGS_GET_SHARED() */
-#define fsp_is_shared_tablespace FSP_FLAGS_GET_SHARED
-/* @} */
+ ((flags & FSP_FLAGS_MASK_MEM_ATOMIC_WRITES) \
+ >> FSP_FLAGS_MEM_ATOMIC_WRITES)
-/** Set a PAGE_COMPRESSION into the correct bits in a given
-tablespace flags. */
-#define FSP_FLAGS_SET_PAGE_COMPRESSION(flags, compression) \
- (flags | (compression << FSP_FLAGS_POS_PAGE_COMPRESSION))
+/* @} */
-/** Set a PAGE_COMPRESSION_LEVEL into the correct bits in a given
-tablespace flags. */
-#define FSP_FLAGS_SET_PAGE_COMPRESSION_LEVEL(flags, level) \
- (flags | (level << FSP_FLAGS_POS_PAGE_COMPRESSION_LEVEL))
+/** Validate the tablespace flags, which are stored in the
+tablespace header at offset FSP_SPACE_FLAGS.
+@param[in] flags the contents of FSP_SPACE_FLAGS
+@return whether the flags are correct (not in the buggy 10.1) format */
+MY_ATTRIBUTE((warn_unused_result, const))
+UNIV_INLINE
+bool
+fsp_flags_is_valid(ulint flags)
+{
+ DBUG_EXECUTE_IF("fsp_flags_is_valid_failure",
+ return(false););
+ if (flags == 0) {
+ return(true);
+ }
+ if (flags & ~FSP_FLAGS_MASK) {
+ return(false);
+ }
+ if ((flags & (FSP_FLAGS_MASK_POST_ANTELOPE | FSP_FLAGS_MASK_ATOMIC_BLOBS))
+ == FSP_FLAGS_MASK_ATOMIC_BLOBS) {
+ /* If the "atomic blobs" flag (indicating
+ ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED) flag
+ is set, then the "post Antelope" (ROW_FORMAT!=REDUNDANT) flag
+ must also be set. */
+ return(false);
+ }
+ /* Bits 10..14 should be 0b0000d where d is the DATA_DIR flag
+ of MySQL 5.6 and MariaDB 10.0, which we ignore.
+ In the buggy FSP_SPACE_FLAGS written by MariaDB 10.1.0 to 10.1.20,
+ bits 10..14 would be nonzero 0bsssaa where sss is
+ nonzero PAGE_SSIZE (3, 4, 6, or 7)
+ and aa is ATOMIC_WRITES (not 0b11). */
+ if (FSP_FLAGS_GET_RESERVED(flags) & ~1) {
+ return(false);
+ }
+
+ const ulint ssize = FSP_FLAGS_GET_PAGE_SSIZE(flags);
+ if (ssize == 1 || ssize == 2 || ssize == 5 || ssize & 8) {
+ /* the page_size is not between 4k and 64k;
+ 16k should be encoded as 0, not 5 */
+ return(false);
+ }
+ const ulint zssize = FSP_FLAGS_GET_ZIP_SSIZE(flags);
+ if (zssize == 0) {
+ /* not ROW_FORMAT=COMPRESSED */
+ } else if (zssize > (ssize ? ssize : 5)) {
+ /* invalid KEY_BLOCK_SIZE */
+ return(false);
+ } else if (~flags & (FSP_FLAGS_MASK_POST_ANTELOPE
+ | FSP_FLAGS_MASK_ATOMIC_BLOBS)) {
+ /* both these flags should be set for
+ ROW_FORMAT=COMPRESSED */
+ return(false);
+ }
+
+ return(true);
+}
-/** Set a ATOMIC_WRITES into the correct bits in a given
-tablespace flags. */
-#define FSP_FLAGS_SET_ATOMIC_WRITES(flags, atomics) \
- (flags | (atomics << FSP_FLAGS_POS_ATOMIC_WRITES))
#endif /* fsp0types_h */
diff --git a/storage/innobase/include/ha_prototypes.h b/storage/innobase/include/ha_prototypes.h
index c10644be832..866853e6059 100644
--- a/storage/innobase/include/ha_prototypes.h
+++ b/storage/innobase/include/ha_prototypes.h
@@ -41,8 +41,6 @@ struct fts_string_t;
// JAN: TODO missing features:
#undef MYSQL_57_SELECT_COUNT_OPTIMIZATION
-#undef MYSQL_COMPRESSION
-#undef MYSQL_ENCRYPTION
#undef MYSQL_FT_INIT_EXT
#undef MYSQL_INNODB_API_CB
#undef MYSQL_INNODB_PARTITIONING
@@ -51,7 +49,6 @@ struct fts_string_t;
#undef MYSQL_REPLACE_TRX_IN_THD
#undef MYSQL_SPATIAL_INDEX
#undef MYSQL_STORE_FTS_DOC_ID
-#undef MYSQL_TABLESPACES
/*********************************************************************//**
Wrapper around MySQL's copy_and_convert function.
diff --git a/storage/innobase/include/lock0lock.h b/storage/innobase/include/lock0lock.h
index f6bbd571907..16ef863f6a7 100644
--- a/storage/innobase/include/lock0lock.h
+++ b/storage/innobase/include/lock0lock.h
@@ -892,8 +892,7 @@ lock_trx_handle_wait(
/*=================*/
trx_t* trx, /*!< in/out: trx lock state */
bool lock_mutex_taken,
- bool trx_mutex_taken)
- MY_ATTRIBUTE((nonnull(1), warn_unused_result));
+ bool trx_mutex_taken);
/*********************************************************************//**
Get the number of locks on a table.
@return number of locks */
diff --git a/storage/innobase/include/log0recv.h b/storage/innobase/include/log0recv.h
index a9d98b08d85..acffa1b562b 100644
--- a/storage/innobase/include/log0recv.h
+++ b/storage/innobase/include/log0recv.h
@@ -173,7 +173,7 @@ struct recv_addr_t{
struct recv_dblwr_t {
/** Add a page frame to the doublewrite recovery buffer. */
- void add(const byte* page) {
+ void add(byte* page) {
pages.push_back(page);
}
@@ -184,22 +184,12 @@ struct recv_dblwr_t {
@retval NULL if no page was found */
const byte* find_page(ulint space_id, ulint page_no);
- typedef std::list<const byte*, ut_allocator<const byte*> > list;
+ typedef std::list<byte*, ut_allocator<byte*> > list;
/** Recovered doublewrite buffer page frames */
list pages;
};
-/* Recovery encryption information */
-typedef struct recv_encryption {
- ulint space_id; /*!< the page number */
- byte* key; /*!< encryption key */
- byte* iv; /*!< encryption iv */
-} recv_encryption_t;
-
-typedef std::vector<recv_encryption_t, ut_allocator<recv_encryption_t> >
- encryption_list_t;
-
/** Recovery system data structure */
struct recv_sys_t{
ib_mutex_t mutex; /*!< mutex protecting the fields apply_log_recs,
@@ -266,9 +256,6 @@ struct recv_sys_t{
addresses in the hash table */
recv_dblwr_t dblwr;
-
- encryption_list_t* /*!< Encryption information list */
- encryption_list;
};
/** The recovery system */
diff --git a/storage/innobase/include/mtr0mtr.h b/storage/innobase/include/mtr0mtr.h
index 3526436f042..e761aaf7ec1 100644
--- a/storage/innobase/include/mtr0mtr.h
+++ b/storage/innobase/include/mtr0mtr.h
@@ -2,7 +2,7 @@
Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2012, Facebook Inc.
-Copyright (c) 2013, 2016, MariaDB Corporation
+Copyright (c) 2013, 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
@@ -487,9 +487,9 @@ struct mtr_t {
@param type type of object
@return true if contains */
static bool memo_contains(
- mtr_buf_t* memo,
- const void* object,
- ulint type)
+ const mtr_buf_t* memo,
+ const void* object,
+ ulint type)
MY_ATTRIBUTE((warn_unused_result));
/** Check if memo contains the given item.
diff --git a/storage/innobase/include/mtr0types.h b/storage/innobase/include/mtr0types.h
index 69a68830af1..95879a43872 100644
--- a/storage/innobase/include/mtr0types.h
+++ b/storage/innobase/include/mtr0types.h
@@ -1,6 +1,7 @@
/*****************************************************************************
Copyright (c) 1995, 2015, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2017, MariaDB Corporation
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -257,10 +258,10 @@ The record consists of a MLOG_CHECKPOINT byte followed by
mach_write_to_8(checkpoint_lsn). */
#define SIZE_OF_MLOG_CHECKPOINT 9
+#ifndef UNIV_INNOCHECKSUM
/** Types for the mlock objects to store in the mtr memo; NOTE that the
first 3 values must be RW_S_LATCH, RW_X_LATCH, RW_NO_LATCH */
enum mtr_memo_type_t {
-#ifndef UNIV_INNOCHECKSUM
MTR_MEMO_PAGE_S_FIX = RW_S_LATCH,
MTR_MEMO_PAGE_X_FIX = RW_X_LATCH,
@@ -268,18 +269,18 @@ enum mtr_memo_type_t {
MTR_MEMO_PAGE_SX_FIX = RW_SX_LATCH,
MTR_MEMO_BUF_FIX = RW_NO_LATCH,
-#endif /* !UNIV_CHECKSUM */
#ifdef UNIV_DEBUG
- MTR_MEMO_MODIFY = 32,
+ MTR_MEMO_MODIFY = 16,
#endif /* UNIV_DEBUG */
- MTR_MEMO_S_LOCK = 64,
+ MTR_MEMO_S_LOCK = RW_S_LATCH << 5,
- MTR_MEMO_X_LOCK = 128,
+ MTR_MEMO_X_LOCK = RW_X_LATCH << 5,
- MTR_MEMO_SX_LOCK = 256
+ MTR_MEMO_SX_LOCK = RW_SX_LATCH << 5
};
+#endif /* !UNIV_CHECKSUM */
#ifdef UNIV_DEBUG
# define MTR_MAGIC_N 54551
diff --git a/storage/innobase/include/os0api.h b/storage/innobase/include/os0api.h
new file mode 100644
index 00000000000..63f213b5457
--- /dev/null
+++ b/storage/innobase/include/os0api.h
@@ -0,0 +1,75 @@
+/***********************************************************************
+
+Copyright (c) 2017, MariaDB Corporation.
+
+This program is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; version 2 of the License.
+
+This program is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+this program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
+
+***********************************************************************/
+
+/**************************************************//**
+@file os0api.h
+The interface to the helper functions.
+These functions are used on os0file.h where
+including full full header is not feasible and
+implemented on buf0buf.cc and fil0fil.cc.
+*******************************************************/
+
+#ifndef OS_API_H
+#define OS_API_H 1
+
+/** Page control block */
+class buf_page_t;
+
+/** File Node */
+struct fil_node_t;
+
+/**
+Should we punch hole to deallocate unused portion of the page.
+@param[in] bpage Page control block
+@return true if punch hole should be used, false if not */
+bool
+buf_page_should_punch_hole(
+ const buf_page_t* bpage)
+ MY_ATTRIBUTE((warn_unused_result));
+
+/**
+Calculate the length of trim (punch_hole) operation.
+@param[in] bpage Page control block
+@param[in] write_length Write length
+@return length of the trim or zero. */
+ulint
+buf_page_get_trim_length(
+ const buf_page_t* bpage,
+ ulint write_length)
+ MY_ATTRIBUTE((warn_unused_result));
+
+/**
+Get should we punch hole to tablespace.
+@param[in] space Tablespace
+@return true, if punch hole should be tried, false if not. */
+bool
+fil_node_should_punch_hole(
+ const fil_node_t* node)
+ MY_ATTRIBUTE((warn_unused_result));
+
+/**
+Set punch hole to tablespace to given value.
+@param[in] space Tablespace
+@param[in] val value to be set. */
+void
+fil_space_set_punch_hole(
+ fil_node_t* node,
+ bool val);
+
+#endif /* OS_API_H */
diff --git a/storage/innobase/include/os0file.h b/storage/innobase/include/os0file.h
index f65d5f8dc1b..4e980c42f85 100644
--- a/storage/innobase/include/os0file.h
+++ b/storage/innobase/include/os0file.h
@@ -2,7 +2,7 @@
Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2009, Percona Inc.
-Copyright (c) 2013, 2016, MariaDB Corporation.
+Copyright (c) 2013, 2017, MariaDB Corporation.
Portions of this file contain modifications contributed and copyrighted
by Percona Inc.. Those modifications are
@@ -36,7 +36,8 @@ Created 10/21/1995 Heikki Tuuri
#ifndef os0file_h
#define os0file_h
-#include "univ.i"
+#include "page0size.h"
+#include "os0api.h"
#ifndef _WIN32
#include <dirent.h>
@@ -46,8 +47,10 @@ Created 10/21/1995 Heikki Tuuri
/** File node of a tablespace or the log data space */
struct fil_node_t;
+struct fil_space_t;
extern bool os_has_said_disk_full;
+extern my_bool srv_use_trim;
/** Number of pending read operations */
extern ulint os_n_pending_reads;
@@ -77,7 +80,7 @@ the OS actually supports it: Win 95 does not, NT does. */
# define UNIV_NON_BUFFERED_IO
/** File handle */
-# define os_file_t HANDLE
+typedef HANDLE os_file_t;
/** Convert a C file descriptor to a native file handle
@param fd file descriptor
@@ -169,333 +172,6 @@ static const ulint OS_FILE_OPERATION_NOT_SUPPORTED = 125;
static const ulint OS_FILE_ERROR_MAX = 200;
/* @} */
-/** Compression algorithm. */
-struct Compression {
-
- /** Algorithm types supported */
- enum Type {
- /* Note: During recovery we don't have the compression type
- because the .frm file has not been read yet. Therefore
- we write the recovered pages out without compression. */
-
- /** No compression */
- NONE = 0,
-
- /** Use ZLib */
- ZLIB = 1,
-
- /** Use LZ4 faster variant, usually lower compression. */
- LZ4 = 2
- };
-
- /** Compressed page meta-data */
- struct meta_t {
-
- /** Version number */
- uint8_t m_version;
-
- /** Algorithm type */
- Type m_algorithm;
-
- /** Original page type */
- uint16_t m_original_type;
-
- /** Original page size, before compression */
- uint16_t m_original_size;
-
- /** Size after compression */
- uint16_t m_compressed_size;
- };
-
- /** Default constructor */
- Compression() : m_type(NONE) { };
-
- /** Specific constructor
- @param[in] type Algorithm type */
- explicit Compression(Type type)
- :
- m_type(type)
- {
-#ifdef UNIV_DEBUG
- switch (m_type) {
- case NONE:
- case ZLIB:
- case LZ4:
-
- default:
- ut_error;
- }
-#endif /* UNIV_DEBUG */
- }
-
- /** Check the page header type field.
- @param[in] page Page contents
- @return true if it is a compressed page */
- static bool is_compressed_page(const byte* page)
- MY_ATTRIBUTE((warn_unused_result));
-
- /** Check wether the compression algorithm is supported.
- @param[in] algorithm Compression algorithm to check
- @param[out] type The type that algorithm maps to
- @return DB_SUCCESS or error code */
- static dberr_t check(const char* algorithm, Compression* type)
- MY_ATTRIBUTE((warn_unused_result));
-
- /** Validate the algorithm string.
- @param[in] algorithm Compression algorithm to check
- @return DB_SUCCESS or error code */
- static dberr_t validate(const char* algorithm)
- MY_ATTRIBUTE((warn_unused_result));
-
- /** Convert to a "string".
- @param[in] type The compression type
- @return the string representation */
- static const char* to_string(Type type)
- MY_ATTRIBUTE((warn_unused_result));
-
- /** Convert the meta data to a std::string.
- @param[in] meta Page Meta data
- @return the string representation */
- static std::string to_string(const meta_t& meta)
- MY_ATTRIBUTE((warn_unused_result));
-
- /** Deserizlise the page header compression meta-data
- @param[in] header Pointer to the page header
- @param[out] control Deserialised data */
- static void deserialize_header(
- const byte* page,
- meta_t* control);
-
- /** Check if the string is "empty" or "none".
- @param[in] algorithm Compression algorithm to check
- @return true if no algorithm requested */
- static bool is_none(const char* algorithm)
- MY_ATTRIBUTE((warn_unused_result));
-
- /** Decompress the page data contents. Page type must be
- FIL_PAGE_COMPRESSED, if not then the source contents are
- left unchanged and DB_SUCCESS is returned.
- @param[in] dblwr_recover true of double write recovery
- in progress
- @param[in,out] src Data read from disk, decompressed
- data will be copied to this page
- @param[in,out] dst Scratch area to use for decompression
- @param[in] dst_len Size of the scratch area in bytes
- @return DB_SUCCESS or error code */
- static dberr_t deserialize(
- bool dblwr_recover,
- byte* src,
- byte* dst,
- ulint dst_len)
- MY_ATTRIBUTE((warn_unused_result));
-
- /** Compression type */
- Type m_type;
-};
-
-/** Encryption key length */
-static const ulint ENCRYPTION_KEY_LEN = 32;
-
-/** Encryption magic bytes size */
-static const ulint ENCRYPTION_MAGIC_SIZE = 3;
-
-/** Encryption magic bytes for 5.7.11, it's for checking the encryption information
-version. */
-static const char ENCRYPTION_KEY_MAGIC_V1[] = "lCA";
-
-/** Encryption magic bytes for 5.7.12+, it's for checking the encryption information
-version. */
-static const char ENCRYPTION_KEY_MAGIC_V2[] = "lCB";
-
-/** Encryption master key prifix */
-static const char ENCRYPTION_MASTER_KEY_PRIFIX[] = "INNODBKey";
-
-/** Encryption master key prifix size */
-static const ulint ENCRYPTION_MASTER_KEY_PRIFIX_LEN = 9;
-
-/** Encryption master key prifix size */
-static const ulint ENCRYPTION_MASTER_KEY_NAME_MAX_LEN = 100;
-
-/** UUID of server instance, it's needed for composing master key name */
-static const ulint ENCRYPTION_SERVER_UUID_LEN = 36;
-
-/** Encryption information total size for 5.7.11: magic number + master_key_id +
-key + iv + checksum */
-static const ulint ENCRYPTION_INFO_SIZE_V1 = (ENCRYPTION_MAGIC_SIZE \
- + (ENCRYPTION_KEY_LEN * 2) \
- + 2 * sizeof(ulint));
-
-/** Encryption information total size: magic number + master_key_id +
-key + iv + server_uuid + checksum */
-static const ulint ENCRYPTION_INFO_SIZE_V2 = (ENCRYPTION_MAGIC_SIZE \
- + (ENCRYPTION_KEY_LEN * 2) \
- + ENCRYPTION_SERVER_UUID_LEN \
- + 2 * sizeof(ulint));
-
-class IORequest;
-
-/** Encryption algorithm. */
-struct Encryption {
-
- /** Algorithm types supported */
- enum Type {
-
- /** No encryption */
- NONE = 0,
-
- /** Use AES */
- AES = 1,
- };
-
- /** Encryption information format version */
- enum Version {
-
- /** Version in 5.7.11 */
- ENCRYPTION_VERSION_1 = 0,
-
- /** Version in > 5.7.11 */
- ENCRYPTION_VERSION_2 = 1,
- };
-
- /** Default constructor */
- Encryption() : m_type(NONE) { };
-
- /** Specific constructor
- @param[in] type Algorithm type */
- explicit Encryption(Type type)
- :
- m_type(type)
- {
-#ifdef UNIV_DEBUG
- switch (m_type) {
- case NONE:
- case AES:
-
- default:
- ut_error;
- }
-#endif /* UNIV_DEBUG */
- }
-
- /** Copy constructor */
- Encryption(const Encryption& other)
- :
- m_type(other.m_type),
- m_key(other.m_key),
- m_klen(other.m_klen),
- m_iv(other.m_iv)
- { };
-
- /** Check if page is encrypted page or not
- @param[in] page page which need to check
- @return true if it is a encrypted page */
- static bool is_encrypted_page(const byte* page)
- MY_ATTRIBUTE((warn_unused_result));
-
- /** Check the encryption option and set it
- @param[in] option encryption option
- @param[in/out] encryption The encryption type
- @return DB_SUCCESS or DB_UNSUPPORTED */
- dberr_t set_algorithm(const char* option, Encryption* type)
- MY_ATTRIBUTE((warn_unused_result));
-
- /** Validate the algorithm string.
- @param[in] algorithm Encryption algorithm to check
- @return DB_SUCCESS or error code */
- static dberr_t validate(const char* algorithm)
- MY_ATTRIBUTE((warn_unused_result));
-
- /** Convert to a "string".
- @param[in] type The encryption type
- @return the string representation */
- static const char* to_string(Type type)
- MY_ATTRIBUTE((warn_unused_result));
-
- /** Check if the string is "empty" or "none".
- @param[in] algorithm Encryption algorithm to check
- @return true if no algorithm requested */
- static bool is_none(const char* algorithm)
- MY_ATTRIBUTE((warn_unused_result));
-
- /** Generate random encryption value for key and iv.
- @param[in,out] value Encryption value */
- static void random_value(byte* value);
-
- /** Create new master key for key rotation.
- @param[in,out] master_key master key */
- static void create_master_key(byte** master_key);
-
- /** Get master key by key id.
- @param[in] master_key_id master key id
- @param[in] srv_uuid uuid of server instance
- @param[in,out] master_key master key */
- static void get_master_key(ulint master_key_id,
- char* srv_uuid,
- byte** master_key);
-
- /** Get current master key and key id.
- @param[in,out] master_key_id master key id
- @param[in,out] master_key master key
- @param[in,out] version encryption information version */
- static void get_master_key(ulint* master_key_id,
- byte** master_key,
- Encryption::Version* version);
-
- /** Encrypt the page data contents. Page type can't be
- FIL_PAGE_ENCRYPTED, FIL_PAGE_COMPRESSED_AND_ENCRYPTED,
- FIL_PAGE_ENCRYPTED_RTREE.
- @param[in] type IORequest
- @param[in,out] src page data which need to encrypt
- @param[in] src_len Size of the source in bytes
- @param[in,out] dst destination area
- @param[in,out] dst_len Size of the destination in bytes
- @return buffer data, dst_len will have the length of the data */
- byte* encrypt(
- const IORequest& type,
- byte* src,
- ulint src_len,
- byte* dst,
- ulint* dst_len)
- MY_ATTRIBUTE((warn_unused_result));
-
- /** Decrypt the page data contents. Page type must be
- FIL_PAGE_ENCRYPTED, FIL_PAGE_COMPRESSED_AND_ENCRYPTED,
- FIL_PAGE_ENCRYPTED_RTREE, if not then the source contents are
- left unchanged and DB_SUCCESS is returned.
- @param[in] type IORequest
- @param[in,out] src Data read from disk, decrypt
- data will be copied to this page
- @param[in] src_len source data length
- @param[in,out] dst Scratch area to use for decrypt
- @param[in] dst_len Size of the scratch area in bytes
- @return DB_SUCCESS or error code */
- dberr_t decrypt(
- const IORequest& type,
- byte* src,
- ulint src_len,
- byte* dst,
- ulint dst_len)
- MY_ATTRIBUTE((warn_unused_result));
-
- /** Encrypt type */
- Type m_type;
-
- /** Encrypt key */
- byte* m_key;
-
- /** Encrypt key length*/
- ulint m_klen;
-
- /** Encrypt initial vector */
- byte* m_iv;
-
- /** Current master key id */
- static ulint master_key_id;
-
- /** Current uuid of server instance */
- static char uuid[ENCRYPTION_SERVER_UUID_LEN + 1];
-};
-
/** Types for AIO operations @{ */
/** No transformations during read/write, write as is. */
@@ -504,6 +180,8 @@ struct Encryption {
#define IORequestLogRead IORequest(IORequest::LOG | IORequest::READ)
#define IORequestLogWrite IORequest(IORequest::LOG | IORequest::WRITE)
+
+
/**
The IO Context that is passed down to the low level IO code */
class IORequest {
@@ -539,24 +217,16 @@ public:
/** Ignore failed reads of non-existent pages */
IGNORE_MISSING = 128,
- /** Use punch hole if available, only makes sense if
- compression algorithm != NONE. Ignored if not set */
+ /** Use punch hole if available*/
PUNCH_HOLE = 256,
-
- /** Force raw read, do not try to compress/decompress.
- This can be used to force a read and write without any
- compression e.g., for redo log, merge sort temporary files
- and the truncate redo log. */
- NO_COMPRESSION = 512
-
};
/** Default constructor */
IORequest()
:
- m_block_size(UNIV_SECTOR_SIZE),
- m_type(READ),
- m_compression()
+ m_bpage(NULL),
+ m_fil_node(NULL),
+ m_type(READ)
{
/* No op */
}
@@ -566,15 +236,30 @@ public:
ORed from the above enum */
explicit IORequest(ulint type)
:
- m_block_size(UNIV_SECTOR_SIZE),
- m_type(static_cast<uint16_t>(type)),
- m_compression()
+ m_bpage(NULL),
+ m_fil_node(NULL),
+ m_type(static_cast<uint16_t>(type))
{
- if (is_log()) {
- disable_compression();
+ if (!is_punch_hole_supported() || !srv_use_trim) {
+ clear_punch_hole();
}
+ }
- if (!is_punch_hole_supported()) {
+ /**
+ @param[in] type Request type, can be a value that is
+ ORed from the above enum
+ @param[in] bpage Page to be written */
+ IORequest(ulint type, buf_page_t* bpage)
+ :
+ m_bpage(bpage),
+ m_fil_node(NULL),
+ m_type(static_cast<uint16_t>(type))
+ {
+ if (bpage && buf_page_should_punch_hole(bpage)) {
+ set_punch_hole();
+ }
+
+ if (!is_punch_hole_supported() || !srv_use_trim) {
clear_punch_hole();
}
}
@@ -617,6 +302,12 @@ public:
return((m_type & DO_NOT_WAKE) == 0);
}
+ /** Clear the punch hole flag */
+ void clear_punch_hole()
+ {
+ m_type &= ~PUNCH_HOLE;
+ }
+
/** @return true if partial read warning disabled */
bool is_partial_io_warning_disabled() const
MY_ATTRIBUTE((warn_unused_result))
@@ -649,15 +340,13 @@ public:
bool validate() const
MY_ATTRIBUTE((warn_unused_result))
{
- ut_a(is_read() ^ is_write());
-
- return(!is_read() || !punch_hole());
+ return(is_read() ^ is_write());
}
/** Set the punch hole flag */
void set_punch_hole()
{
- if (is_punch_hole_supported()) {
+ if (is_punch_hole_supported() && srv_use_trim) {
m_type |= PUNCH_HOLE;
}
}
@@ -668,32 +357,16 @@ public:
m_type &= ~DO_NOT_WAKE;
}
- /** Clear the punch hole flag */
- void clear_punch_hole()
- {
- m_type &= ~PUNCH_HOLE;
- }
-
- /** @return the block size to use for IO */
- ulint block_size() const
- MY_ATTRIBUTE((warn_unused_result))
- {
- return(m_block_size);
- }
-
- /** Set the block size for IO
- @param[in] block_size Block size to set */
- void block_size(ulint block_size)
- {
- m_block_size = static_cast<uint32_t>(block_size);
- }
-
- /** Clear all compression related flags */
- void clear_compressed()
+ /** Set the pointer to file node for IO
+ @param[in] node File node */
+ void set_fil_node(fil_node_t* node)
{
- clear_punch_hole();
+ if (!srv_use_trim ||
+ (node && !fil_node_should_punch_hole(node))) {
+ clear_punch_hole();
+ }
- m_compression.m_type = Compression::NONE;
+ m_fil_node = node;
}
/** Compare two requests
@@ -703,95 +376,6 @@ public:
return(m_type == rhs.m_type);
}
- /** Set compression algorithm
- @param[in] compression The compression algorithm to use */
- void compression_algorithm(Compression::Type type)
- {
- if (type == Compression::NONE) {
- return;
- }
-
- set_punch_hole();
-
- m_compression.m_type = type;
- }
-
- /** Get the compression algorithm.
- @return the compression algorithm */
- Compression compression_algorithm() const
- MY_ATTRIBUTE((warn_unused_result))
- {
- return(m_compression);
- }
-
- /** @return true if the page should be compressed */
- bool is_compressed() const
- MY_ATTRIBUTE((warn_unused_result))
- {
- return(compression_algorithm().m_type != Compression::NONE);
- }
-
- /** @return true if the page read should not be transformed. */
- bool is_compression_enabled() const
- MY_ATTRIBUTE((warn_unused_result))
- {
- return((m_type & NO_COMPRESSION) == 0);
- }
-
- /** Disable transformations. */
- void disable_compression()
- {
- m_type |= NO_COMPRESSION;
- }
-
- /** Set encryption algorithm
- @param[in] type The encryption algorithm to use */
- void encryption_algorithm(Encryption::Type type)
- {
- if (type == Encryption::NONE) {
- return;
- }
-
- m_encryption.m_type = type;
- }
-
- /** Set encryption key and iv
- @param[in] key The encryption key to use
- @param[in] key_len length of the encryption key
- @param[in] iv The encryption iv to use */
- void encryption_key(byte* key,
- ulint key_len,
- byte* iv)
- {
- m_encryption.m_key = key;
- m_encryption.m_klen = key_len;
- m_encryption.m_iv = iv;
- }
-
- /** Get the encryption algorithm.
- @return the encryption algorithm */
- Encryption encryption_algorithm() const
- MY_ATTRIBUTE((warn_unused_result))
- {
- return(m_encryption);
- }
-
- /** @return true if the page should be encrypted. */
- bool is_encrypted() const
- MY_ATTRIBUTE((warn_unused_result))
- {
- return(m_encryption.m_type != Encryption::NONE);
- }
-
- /** Clear all encryption related flags */
- void clear_encrypted()
- {
- m_encryption.m_key = NULL;
- m_encryption.m_klen = 0;
- m_encryption.m_iv = NULL;
- m_encryption.m_type = Encryption::NONE;
- }
-
/** Note that the IO is for double write recovery. */
void dblwr_recover()
{
@@ -823,18 +407,44 @@ public:
#endif /* HAVE_FALLOC_PUNCH_HOLE_AND_KEEP_SIZE || _WIN32 */
}
+ ulint get_trim_length(ulint write_length) const
+ {
+ return (m_bpage ?
+ buf_page_get_trim_length(m_bpage, write_length)
+ : 0);
+ }
+
+ bool should_punch_hole() const {
+ return (m_fil_node ?
+ fil_node_should_punch_hole(m_fil_node)
+ : false);
+ }
+
+ void space_no_punch_hole() const {
+ if (m_fil_node) {
+ fil_space_set_punch_hole(m_fil_node, false);
+ }
+ }
+
+ /** Punch a hole in the file if it was a write
+ @param[in] fh Open file handle
+ @param[in] len Compressed buffer length for write
+ @return DB_SUCCESS or error code */
+
+ dberr_t punch_hole(
+ os_file_t fh,
+ os_offset_t offset,
+ os_offset_t len);
+
private:
- /* File system best block size */
- uint32_t m_block_size;
+ /** Page to be written on write operation. */
+ buf_page_t* m_bpage;
+
+ /** File node */
+ fil_node_t* m_fil_node;
/** Request type bit flags */
uint16_t m_type;
-
- /** Compression algorithm */
- Compression m_compression;
-
- /** Encryption algorithm */
- Encryption m_encryption;
};
/* @} */
@@ -1197,10 +807,10 @@ The wrapper functions have the prefix of "innodb_". */
# define os_file_close(file) \
pfs_os_file_close_func(file, __FILE__, __LINE__)
-# define os_aio(type, mode, name, file, buf, offset, \
- n, read_only, message1, message2, wsize) \
- pfs_os_aio_func(type, mode, name, file, buf, offset, \
- n, read_only, message1, message2, wsize, \
+# define os_aio(type, mode, name, file, buf, offset, \
+ n, read_only, message1, message2) \
+ pfs_os_aio_func(type, mode, name, file, buf, offset, \
+ n, read_only, message1, message2, \
__FILE__, __LINE__)
# define os_file_read(type, file, buf, offset, n) \
@@ -1212,7 +822,7 @@ The wrapper functions have the prefix of "innodb_". */
# define os_file_write(type, name, file, buf, offset, n) \
pfs_os_file_write_func(type, name, file, buf, offset, \
- n, __FILE__, __LINE__)
+ n,__FILE__, __LINE__)
# define os_file_flush(file) \
pfs_os_file_flush_func(file, __FILE__, __LINE__)
@@ -1417,7 +1027,6 @@ pfs_os_aio_func(
bool read_only,
fil_node_t* m1,
void* m2,
- ulint* wsize,
const char* src_file,
ulint src_line);
@@ -1542,9 +1151,9 @@ to original un-instrumented file I/O APIs */
# define os_file_close(file) os_file_close_func(file)
# define os_aio(type, mode, name, file, buf, offset, \
- n, read_only, message1, message2, wsize) \
+ n, read_only, message1, message2) \
os_aio_func(type, mode, name, file, buf, offset, \
- n, read_only, message1, message2, wsize)
+ n, read_only, message1, message2)
# define os_file_read(type, file, buf, offset, n) \
os_file_read_func(type, file, buf, offset, n)
@@ -1552,7 +1161,7 @@ to original un-instrumented file I/O APIs */
# define os_file_read_no_error_handling(type, file, buf, offset, n, o) \
os_file_read_no_error_handling_func(type, file, buf, offset, n, o)
-# define os_file_write(type, name, file, buf, offset, n) \
+# define os_file_write(type, name, file, buf, offset, n) \
os_file_write_func(type, name, file, buf, offset, n)
# define os_file_flush(file) os_file_flush_func(file)
@@ -1815,8 +1424,7 @@ os_aio_func(
ulint n,
bool read_only,
fil_node_t* m1,
- void* m2,
- ulint* wsize);
+ void* m2);
/** Wakes up all async i/o threads so that they know to exit themselves in
shutdown. */
@@ -1913,37 +1521,11 @@ int
innobase_mysql_tmpfile(
const char* path);
-/** If it is a compressed page return the compressed page data + footer size
-@param[in] buf Buffer to check, must include header + 10 bytes
-@return ULINT_UNDEFINED if the page is not a compressed page or length
- of the compressed data (including footer) if it is a compressed page */
-ulint
-os_file_compressed_page_size(const byte* buf);
-
-/** If it is a compressed page return the original page data + footer size
-@param[in] buf Buffer to check, must include header + 10 bytes
-@return ULINT_UNDEFINED if the page is not a compressed page or length
- of the original data + footer if it is a compressed page */
-ulint
-os_file_original_page_size(const byte* buf);
-
/** Set the file create umask
@param[in] umask The umask to use for file creation. */
void
os_file_set_umask(ulint umask);
-/** Free storage space associated with a section of the file.
-@param[in] fh Open file handle
-@param[in] off Starting offset (SEEK_SET)
-@param[in] len Size of the hole
-@return DB_SUCCESS or error code */
-dberr_t
-os_file_punch_hole(
- os_file_t fh,
- os_offset_t off,
- os_offset_t len)
- MY_ATTRIBUTE((warn_unused_result));
-
/** Check if the file system supports sparse files.
Warning: On POSIX systems we try and punch a hole from offset 0 to
@@ -1961,21 +1543,29 @@ os_is_sparse_file_supported(
os_file_t fh)
MY_ATTRIBUTE((warn_unused_result));
-/** Decompress the page data contents. Page type must be FIL_PAGE_COMPRESSED, if
-not then the source contents are left unchanged and DB_SUCCESS is returned.
-@param[in] dblwr_recover true of double write recovery in progress
-@param[in,out] src Data read from disk, decompressed data will be
- copied to this page
-@param[in,out] dst Scratch area to use for decompression
-@param[in] dst_len Size of the scratch area in bytes
+/** Free storage space associated with a section of the file.
+@param[in] fh Open file handle
+@param[in] off Starting offset (SEEK_SET)
+@param[in] len Size of the hole
@return DB_SUCCESS or error code */
+dberr_t
+os_file_punch_hole(
+ IORequest& type,
+ os_file_t fh,
+ os_offset_t off,
+ os_offset_t len)
+ MY_ATTRIBUTE((warn_unused_result));
+/** Free storage space associated with a section of the file.
+@param[in] fh Open file handle
+@param[in] off Starting offset (SEEK_SET)
+@param[in] len Size of the hole
+@return DB_SUCCESS or error code */
dberr_t
-os_file_decompress_page(
- bool dblwr_recover,
- byte* src,
- byte* dst,
- ulint dst_len)
+os_file_punch_hole(
+ os_file_t fh,
+ os_offset_t off,
+ os_offset_t len)
MY_ATTRIBUTE((warn_unused_result));
/** Normalizes a directory path for the current OS:
@@ -2005,6 +1595,16 @@ is_absolute_path(
return(false);
}
+/***********************************************************************//**
+Try to get number of bytes per sector from file system.
+@return file block size */
+UNIV_INTERN
+ulint
+os_file_get_block_size(
+/*===================*/
+ os_file_t file, /*!< in: handle to a file */
+ const char* name); /*!< in: file name */
+
#ifndef UNIV_NONINL
#include "os0file.ic"
#endif /* UNIV_NONINL */
diff --git a/storage/innobase/include/os0file.ic b/storage/innobase/include/os0file.ic
index 74d0b2c83a8..5c7c4d45ca6 100644
--- a/storage/innobase/include/os0file.ic
+++ b/storage/innobase/include/os0file.ic
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 2010, 2015, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2013, 2016, MariaDB Corporation.
+Copyright (c) 2013, 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
@@ -219,11 +219,6 @@ an asynchronous i/o operation.
@param[in,out] m2 message for the AIO handler (can be used to
identify a completed AIO operation); ignored
if mode is OS_AIO_SYNC
-@param[in,out] write_size Actual write size initialized
- after fist successfull trim
- operation for this page and if
- initialized we do not trim again if
- actual page size
@param[in] src_file file name where func invoked
@param[in] src_line line where the func invoked
@return DB_SUCCESS if request was queued successfully, FALSE if fail */
@@ -240,7 +235,6 @@ pfs_os_aio_func(
bool read_only,
fil_node_t* m1,
void* m2,
- ulint* write_size,
const char* src_file,
ulint src_line)
{
@@ -256,7 +250,7 @@ pfs_os_aio_func(
src_file, src_line);
dberr_t result = os_aio_func(
- type, mode, name, file, buf, offset, n, read_only, m1, m2, write_size);
+ type, mode, name, file, buf, offset, n, read_only, m1, m2);
register_pfs_file_io_end(locker, n);
diff --git a/storage/innobase/include/page0page.ic b/storage/innobase/include/page0page.ic
index 97f9d5a578f..a70ca3da8d8 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, MariaDB Corporation.
+Copyright (c) 2016, 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
@@ -147,8 +147,9 @@ page_set_ssn_id(
{
page_t* page = buf_block_get_frame(block);
- ut_ad(!mtr || mtr_memo_contains(mtr, block, MTR_MEMO_PAGE_SX_FIX)
- || mtr_memo_contains(mtr, block, MTR_MEMO_PAGE_X_FIX));
+ ut_ad(!mtr || mtr_memo_contains_flagged(mtr, block,
+ MTR_MEMO_PAGE_SX_FIX
+ | MTR_MEMO_PAGE_X_FIX));
if (page_zip) {
mach_write_to_8(page + FIL_RTREE_SPLIT_SEQ_NUM, ssn_id);
diff --git a/storage/innobase/include/page0size.h b/storage/innobase/include/page0size.h
index ab917e1ff05..ca173db9b6d 100644
--- a/storage/innobase/include/page0size.h
+++ b/storage/innobase/include/page0size.h
@@ -1,6 +1,7 @@
/*****************************************************************************
Copyright (c) 2013, 2015, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2017, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -139,9 +140,7 @@ public:
@param[in] src page size object whose values to fetch */
inline void copy_from(const page_size_t& src)
{
- m_physical = src.physical();
- m_logical = src.logical();
- m_is_compressed = src.is_compressed();
+ *this = src;
}
/** Check if a given page_size_t object is equal to the current one.
@@ -156,9 +155,6 @@ public:
private:
- /* Disable implicit copying. */
- void operator=(const page_size_t&);
-
/* For non compressed tablespaces, physical page size is equal to
the logical page size and the data is stored in buf_page_t::frame
(and is also always equal to univ_page_size (--innodb-page-size=)).
diff --git a/storage/innobase/include/que0que.h b/storage/innobase/include/que0que.h
index 3e90e0b25e3..574b7e6acee 100644
--- a/storage/innobase/include/que0que.h
+++ b/storage/innobase/include/que0que.h
@@ -1,6 +1,7 @@
/*****************************************************************************
Copyright (c) 1996, 2015, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2017, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -315,18 +316,6 @@ que_fork_scheduler_round_robin(
que_fork_t* fork, /*!< in: a query fork */
que_thr_t* thr); /*!< in: current pos */
-/*********************************************************************//**
-Initialise the query sub-system. */
-void
-que_init(void);
-/*==========*/
-
-/*********************************************************************//**
-Close the query sub-system. */
-void
-que_close(void);
-/*===========*/
-
/** Query thread states */
enum que_thr_state_t {
QUE_THR_RUNNING,
diff --git a/storage/innobase/include/row0merge.h b/storage/innobase/include/row0merge.h
index 8cb9eb7976e..9e71ee42bb0 100644
--- a/storage/innobase/include/row0merge.h
+++ b/storage/innobase/include/row0merge.h
@@ -431,8 +431,8 @@ row_merge_sort(
row_merge_block_t* block,
int* tmpfd,
const bool update_progress,
- const float pct_progress,
- const float pct_cost,
+ const double pct_progress,
+ const double pct_cost,
fil_space_crypt_t* crypt_data,
row_merge_block_t* crypt_block,
ulint space,
diff --git a/storage/innobase/include/row0mysql.h b/storage/innobase/include/row0mysql.h
index f010e717103..4c272d96a39 100644
--- a/storage/innobase/include/row0mysql.h
+++ b/storage/innobase/include/row0mysql.h
@@ -373,9 +373,6 @@ row_create_table_for_mysql(
dict_table_t* table, /*!< in, own: table definition
(will be freed, or on DB_SUCCESS
added to the data dictionary cache) */
- const char* compression,
- /*!< in: compression algorithm to use,
- can be NULL */
trx_t* trx, /*!< in/out: transaction */
bool commit, /*!< in: if true, commit the transaction */
fil_encryption_t mode, /*!< in: encryption mode */
@@ -484,11 +481,6 @@ row_drop_table_for_mysql(
bool nonatomic = true);
/*!< in: whether it is permitted
to release and reacquire dict_operation_lock */
-/*********************************************************************//**
-Drop all temporary tables during crash recovery. */
-void
-row_mysql_drop_temp_tables(void);
-/*============================*/
/*********************************************************************//**
Discards the tablespace of a table which stored in an .ibd file. Discarding
diff --git a/storage/innobase/include/row0row.ic b/storage/innobase/include/row0row.ic
index 9243fae839a..8a32bb3ffd2 100644
--- a/storage/innobase/include/row0row.ic
+++ b/storage/innobase/include/row0row.ic
@@ -201,13 +201,13 @@ row_parse_int(
case DATA_FLOAT:
ut_a(len == sizeof(float));
- value = mach_float_read(data);
+ value = static_cast<ib_uint64_t>(mach_float_read(data));
break;
case DATA_DOUBLE:
ut_a(len == sizeof(double));
- value = mach_double_read(data);
+ value = static_cast<ib_uint64_t>(mach_double_read(data));
break;
default:
diff --git a/storage/innobase/include/srv0mon.h b/storage/innobase/include/srv0mon.h
index e4e1394c2d3..5c19e735806 100644
--- a/storage/innobase/include/srv0mon.h
+++ b/storage/innobase/include/srv0mon.h
@@ -343,16 +343,8 @@ enum monitor_id_t {
MONITOR_PAD_DECREMENTS,
/* New monitor variables for page compression */
MONITOR_OVLD_PAGE_COMPRESS_SAVED,
- MONITOR_OVLD_PAGE_COMPRESS_TRIM_SECT512,
- MONITOR_OVLD_PAGE_COMPRESS_TRIM_SECT1024,
- MONITOR_OVLD_PAGE_COMPRESS_TRIM_SECT2048,
- MONITOR_OVLD_PAGE_COMPRESS_TRIM_SECT4096,
- MONITOR_OVLD_PAGE_COMPRESS_TRIM_SECT8192,
- MONITOR_OVLD_PAGE_COMPRESS_TRIM_SECT16384,
- MONITOR_OVLD_PAGE_COMPRESS_TRIM_SECT32768,
MONITOR_OVLD_PAGES_PAGE_COMPRESSED,
MONITOR_OVLD_PAGE_COMPRESSED_TRIM_OP,
- MONITOR_OVLD_PAGE_COMPRESSED_TRIM_OP_SAVED,
MONITOR_OVLD_PAGES_PAGE_DECOMPRESSED,
MONITOR_OVLD_PAGES_PAGE_COMPRESSION_ERROR,
diff --git a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0srv.h
index 1e05c2c6e4a..fee6ceaca4c 100644
--- a/storage/innobase/include/srv0srv.h
+++ b/storage/innobase/include/srv0srv.h
@@ -114,20 +114,6 @@ struct srv_stats_t {
/** Number of bytes saved by page compression */
ulint_ctr_64_t page_compression_saved;
- /** Number of 512Byte TRIM by page compression */
- ulint_ctr_64_t page_compression_trim_sect512;
- /** Number of 1K TRIM by page compression */
- ulint_ctr_64_t page_compression_trim_sect1024;
- /** Number of 2K TRIM by page compression */
- ulint_ctr_64_t page_compression_trim_sect2048;
- /** Number of 4K TRIM by page compression */
- ulint_ctr_64_t page_compression_trim_sect4096;
- /** Number of 8K TRIM by page compression */
- ulint_ctr_64_t page_compression_trim_sect8192;
- /** Number of 16K TRIM by page compression */
- ulint_ctr_64_t page_compression_trim_sect16384;
- /** Number of 32K TRIM by page compression */
- ulint_ctr_64_t page_compression_trim_sect32768;
/* Number of index pages written */
ulint_ctr_64_t index_pages_written;
/* Number of non index pages written */
@@ -136,8 +122,6 @@ struct srv_stats_t {
ulint_ctr_64_t pages_page_compressed;
/* Number of TRIM operations induced by page compression */
ulint_ctr_64_t page_compressed_trim_op;
- /* Number of TRIM operations saved by using actual write size knowledge */
- ulint_ctr_64_t page_compressed_trim_op_saved;
/* Number of pages decompressed with page compression */
ulint_ctr_64_t pages_page_decompressed;
/* Number of page compression errors */
@@ -466,9 +450,6 @@ extern double srv_adaptive_flushing_lwm;
extern ulong srv_flushing_avg_loops;
extern ulong srv_force_recovery;
-#ifndef DBUG_OFF
-extern ulong srv_force_recovery_crash;
-#endif /* !DBUG_OFF */
extern ulint srv_fast_shutdown; /*!< If this is 1, do not do a
purge and index buffer merge.
@@ -731,11 +712,6 @@ enum srv_stats_method_name_enum {
typedef enum srv_stats_method_name_enum srv_stats_method_name_t;
-#ifdef UNIV_DEBUG
-/** Force all user tables to use page compression. */
-extern ulong srv_debug_compress;
-#endif /* UNIV_DEBUG */
-
/** Types of threads existing in the system. */
enum srv_thread_type {
SRV_NONE, /*!< None */
@@ -753,22 +729,11 @@ void
srv_boot(void);
/*==========*/
/*********************************************************************//**
-Initializes the server. */
-void
-srv_init(void);
-/*==========*/
-/*********************************************************************//**
Frees the data structures created in srv_init(). */
void
srv_free(void);
/*==========*/
/*********************************************************************//**
-Initializes the synchronization primitives, memory system, and the thread
-local storage. */
-void
-srv_general_init(void);
-/*==================*/
-/*********************************************************************//**
Sets the info describing an i/o thread current state. */
void
srv_set_io_thread_op_info(
@@ -1064,20 +1029,6 @@ struct export_var_t{
int64_t innodb_page_compression_saved;/*!< Number of bytes saved
by page compression */
- int64_t innodb_page_compression_trim_sect512;/*!< Number of 512b TRIM
- by page compression */
- int64_t innodb_page_compression_trim_sect1024;/*!< Number of 1K TRIM
- by page compression */
- int64_t innodb_page_compression_trim_sect2048;/*!< Number of 2K TRIM
- by page compression */
- int64_t innodb_page_compression_trim_sect4096;/*!< Number of 4K byte TRIM
- by page compression */
- int64_t innodb_page_compression_trim_sect8192;/*!< Number of 8K TRIM
- by page compression */
- int64_t innodb_page_compression_trim_sect16384;/*!< Number of 16K TRIM
- by page compression */
- int64_t innodb_page_compression_trim_sect32768;/*!< Number of 32K TRIM
- by page compression */
int64_t innodb_index_pages_written; /*!< Number of index pages
written */
int64_t innodb_non_index_pages_written; /*!< Number of non index pages
@@ -1086,8 +1037,6 @@ struct export_var_t{
compressed by page compression */
int64_t innodb_page_compressed_trim_op;/*!< Number of TRIM operations
induced by page compression */
- int64_t innodb_page_compressed_trim_op_saved;/*!< Number of TRIM operations
- saved by page compression */
int64_t innodb_pages_page_decompressed;/*!< Number of pages
decompressed by page
compression */
diff --git a/storage/innobase/include/srv0start.h b/storage/innobase/include/srv0start.h
index 31085838807..8de9e3457fc 100644
--- a/storage/innobase/include/srv0start.h
+++ b/storage/innobase/include/srv0start.h
@@ -34,19 +34,6 @@ Created 10/10/1995 Heikki Tuuri
// Forward declaration
struct dict_table_t;
-#ifdef DBUG_OFF
-# define RECOVERY_CRASH(x) do {} while(0)
-#else
-# define RECOVERY_CRASH(x) do { \
- if (srv_force_recovery_crash == x) { \
- fprintf(stderr, "innodb_force_recovery_crash=%lu\n", \
- srv_force_recovery_crash); \
- fflush(stderr); \
- abort(); \
- } \
-} while (0)
-#endif /* DBUG_OFF */
-
/** If buffer pool is less than the size,
only one buffer pool instance is used. */
#define BUF_POOL_SIZE_THRESHOLD (1024 * 1024 * 1024)
@@ -80,11 +67,9 @@ are not found and the user wants.
dberr_t
innobase_start_or_create_for_mysql(void);
/*====================================*/
-/****************************************************************//**
-Shuts down the Innobase database.
-@return DB_SUCCESS or error code */
-dberr_t
-innobase_shutdown_for_mysql(void);
+/** Shut down InnoDB. */
+void
+innodb_shutdown();
/****************************************************************//**
Shuts down background threads that can generate undo pages. */
diff --git a/storage/innobase/include/sync0sync.h b/storage/innobase/include/sync0sync.h
index 7fddada10f8..7157b07e9d0 100644
--- a/storage/innobase/include/sync0sync.h
+++ b/storage/innobase/include/sync0sync.h
@@ -136,7 +136,6 @@ 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;
-extern mysql_pfs_key_t master_key_id_mutex_key;
#endif /* UNIV_PFS_RWLOCK */
/** Prints info of the sync system.
diff --git a/storage/innobase/include/sync0types.h b/storage/innobase/include/sync0types.h
index bd49e034384..68b6a44dc25 100644
--- a/storage/innobase/include/sync0types.h
+++ b/storage/innobase/include/sync0types.h
@@ -384,7 +384,6 @@ enum latch_id_t {
LATCH_ID_HASH_TABLE_RW_LOCK,
LATCH_ID_BUF_CHUNK_MAP_LATCH,
LATCH_ID_SYNC_DEBUG_MUTEX,
- LATCH_ID_MASTER_KEY_ID_MUTEX,
LATCH_ID_SCRUB_STAT_MUTEX,
LATCH_ID_DEFRAGMENT_MUTEX,
LATCH_ID_BTR_DEFRAGMENT_MUTEX,
diff --git a/storage/innobase/include/univ.i b/storage/innobase/include/univ.i
index 35ea9fd51be..908fb60e956 100644
--- a/storage/innobase/include/univ.i
+++ b/storage/innobase/include/univ.i
@@ -366,6 +366,12 @@ typedef enum innodb_file_formats_enum innodb_file_formats_t;
#define IF_SNAPPY(A,B) B
#endif
+#if defined (HAVE_FALLOC_PUNCH_HOLE_AND_KEEP_SIZE) || defined(_WIN32)
+#define IF_PUNCH_HOLE(A,B) A
+#else
+#define IF_PUNCH_HOLE(A,B) B
+#endif
+
/** The universal page size of the database */
#define UNIV_PAGE_SIZE ((ulint) srv_page_size)
diff --git a/storage/innobase/include/ut0mutex.h b/storage/innobase/include/ut0mutex.h
index 197a34e6122..354fd9e0a7a 100644
--- a/storage/innobase/include/ut0mutex.h
+++ b/storage/innobase/include/ut0mutex.h
@@ -1,6 +1,7 @@
/*****************************************************************************
Copyright (c) 2012, 2015, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2017, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -30,7 +31,6 @@ Created 2012-03-24 Sunny Bains.
extern uint srv_spin_wait_delay;
extern ulong srv_n_spin_wait_rounds;
-extern ulong srv_force_recovery_crash;
#include "sync0policy.h"
#include "ib0mutex.h"
diff --git a/storage/innobase/include/ut0new.h b/storage/innobase/include/ut0new.h
index 6f3c06cf978..5a9022e8a77 100644
--- a/storage/innobase/include/ut0new.h
+++ b/storage/innobase/include/ut0new.h
@@ -1,6 +1,7 @@
/*****************************************************************************
Copyright (c) 2014, 2015, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2017, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -389,25 +390,21 @@ public:
}
/** Free a memory allocated by allocate() and trace the deallocation.
- @param[in,out] ptr pointer to memory to free
- @param[in] n_elements number of elements allocated (unused) */
- void
- deallocate(
- pointer ptr,
- size_type n_elements = 0)
+ @param[in,out] ptr pointer to memory to free */
+ void deallocate(pointer ptr, size_type)
{
+#ifdef UNIV_PFS_MEMORY
if (ptr == NULL) {
return;
}
-#ifdef UNIV_PFS_MEMORY
ut_new_pfx_t* pfx = reinterpret_cast<ut_new_pfx_t*>(ptr) - 1;
deallocate_trace(pfx);
free(pfx);
#else
- // free(ptr);
+ free(ptr);
#endif /* UNIV_PFS_MEMORY */
}
diff --git a/storage/innobase/include/ut0timer.ic b/storage/innobase/include/ut0timer.ic
index 027e89c6279..46dcd0cb718 100644
--- a/storage/innobase/include/ut0timer.ic
+++ b/storage/innobase/include/ut0timer.ic
@@ -106,7 +106,7 @@ ut_microseconds_to_timer(
/*=====================*/
ulonglong when) /*!< in: time where to calculate */
{
- double ret = when;
+ double ret = (double)when;
ret *= (double)(ut_timer.frequency);
ret /= 1000000.0;
return (ulonglong)ret;
diff --git a/storage/innobase/innodb.cmake b/storage/innobase/innodb.cmake
index 15b0f7c9c9a..9cc6e434f38 100644
--- a/storage/innobase/innodb.cmake
+++ b/storage/innobase/innodb.cmake
@@ -1,4 +1,5 @@
# Copyright (c) 2006, 2016, 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
@@ -135,24 +136,6 @@ IF(HAVE_NANOSLEEP)
ADD_DEFINITIONS(-DHAVE_NANOSLEEP=1)
ENDIF()
-IF(NOT MSVC)
- CHECK_C_SOURCE_RUNS(
- "
- #define _GNU_SOURCE
- #include <fcntl.h>
- #include <linux/falloc.h>
- int main()
- {
- /* Ignore the return value for now. Check if the flags exist.
- The return value is checked at runtime. */
- fallocate(0, FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE, 0, 0);
-
- return(0);
- }"
- HAVE_FALLOC_PUNCH_HOLE_AND_KEEP_SIZE
- )
-ENDIF()
-
IF(HAVE_FALLOC_PUNCH_HOLE_AND_KEEP_SIZE)
ADD_DEFINITIONS(-DHAVE_FALLOC_PUNCH_HOLE_AND_KEEP_SIZE=1)
ENDIF()
diff --git a/storage/innobase/lock/lock0lock.cc b/storage/innobase/lock/lock0lock.cc
index 379d00b00d7..3916bf9961f 100644
--- a/storage/innobase/lock/lock0lock.cc
+++ b/storage/innobase/lock/lock0lock.cc
@@ -7770,6 +7770,9 @@ lock_trx_handle_wait(
trx_mutex_exit(trx);
}
+ ut_ad(err == DB_SUCCESS || err == DB_LOCK_WAIT
+ || err == DB_DEADLOCK);
+
return(err);
}
diff --git a/storage/innobase/log/log0crypt.cc b/storage/innobase/log/log0crypt.cc
index 3a4447d2b85..b0a89be8de2 100644
--- a/storage/innobase/log/log0crypt.cc
+++ b/storage/innobase/log/log0crypt.cc
@@ -142,14 +142,13 @@ log_crypt_print_checkpoint_keys(
ib_uint64_t checkpoint_no = log_block_get_checkpoint_no(log_block);
if (crypt_info.size()) {
- fprintf(stderr, "InnoDB: redo log checkpoint: %lu [ chk key ]: ", (ulong) checkpoint_no);
+ ib::info() << "Redo log checkpoint encryption: " << checkpoint_no << " [ chk key ]: ";
for (size_t i = 0; i < crypt_info.size(); i++) {
struct crypt_info_t* it = &crypt_info[i];
- fprintf(stderr, "[ %lu %u ] ",
- (ulong) it->checkpoint_no,
- it->key_version);
+ ib::info() << "[" << it->checkpoint_no
+ << "," << it->key_version
+ << "]";
}
- fprintf(stderr, "\n");
}
}
@@ -498,7 +497,7 @@ log_crypt_write_checkpoint_buf(
buf += 2;
for (size_t i = 0; i < crypt_info.size(); i++) {
struct crypt_info_t* it = &crypt_info[i];
- mach_write_to_4(buf + 0, it->checkpoint_no);
+ mach_write_to_4(buf + 0, static_cast<ulint>(it->checkpoint_no));
mach_write_to_4(buf + 4, it->key_version);
memcpy(buf + 8, it->crypt_msg, MY_AES_BLOCK_SIZE);
memcpy(buf + 24, it->crypt_nonce, MY_AES_BLOCK_SIZE);
diff --git a/storage/innobase/log/log0log.cc b/storage/innobase/log/log0log.cc
index cf7825bd542..3c92e9572df 100644
--- a/storage/innobase/log/log0log.cc
+++ b/storage/innobase/log/log0log.cc
@@ -1019,7 +1019,7 @@ log_group_file_header_flush(
page_id_t(group->space_id, page_no),
univ_page_size,
(ulint) (dest_offset % univ_page_size.physical()),
- OS_FILE_LOG_BLOCK_SIZE, buf, group, NULL);
+ OS_FILE_LOG_BLOCK_SIZE, buf, group);
srv_stats.os_log_pending_writes.dec();
}
@@ -1144,7 +1144,7 @@ loop:
page_id_t(group->space_id, page_no),
univ_page_size,
(ulint) (next_offset % UNIV_PAGE_SIZE), write_len, buf,
- group, NULL);
+ group);
srv_stats.os_log_pending_writes.dec();
@@ -1664,7 +1664,7 @@ log_group_checkpoint(
(log_sys->next_checkpoint_no & 1)
? LOG_CHECKPOINT_2 : LOG_CHECKPOINT_1,
OS_FILE_LOG_BLOCK_SIZE,
- buf, (byte*) group + 1, NULL);
+ buf, (byte*) group + 1);
ut_ad(((ulint) group & 0x1UL) == 0);
}
@@ -1686,7 +1686,7 @@ log_group_header_read(
fil_io(IORequestLogRead, true,
page_id_t(group->space_id, header / univ_page_size.physical()),
univ_page_size, header % univ_page_size.physical(),
- OS_FILE_LOG_BLOCK_SIZE, log_sys->checkpoint_buf, NULL, NULL);
+ OS_FILE_LOG_BLOCK_SIZE, log_sys->checkpoint_buf, NULL);
}
/** Write checkpoint info to the log header and invoke log_mutex_exit().
@@ -2038,7 +2038,7 @@ loop:
page_id_t(group->space_id, page_no),
univ_page_size,
(ulint) (source_offset % univ_page_size.physical()),
- len, buf, NULL, NULL);
+ len, buf, NULL);
#ifdef DEBUG_CRYPT
fprintf(stderr, "BEFORE DECRYPT: block: %lu checkpoint: %lu %.8lx %.8lx offset %lu\n",
@@ -2097,7 +2097,6 @@ logs_empty_and_mark_files_at_shutdown(void)
{
lsn_t lsn;
ulint count = 0;
- ulint total_trx;
ulint pending_io;
ib::info() << "Starting shutdown...";
@@ -2120,7 +2119,11 @@ loop:
os_event_set(srv_monitor_event);
os_event_set(srv_buf_dump_event);
os_event_set(lock_sys->timeout_event);
- os_event_set(dict_stats_event);
+ if (dict_stats_event) {
+ os_event_set(dict_stats_event);
+ } else {
+ ut_ad(!srv_dict_stats_thread_active);
+ }
}
os_thread_sleep(100000);
@@ -2131,9 +2134,8 @@ loop:
shutdown, because the InnoDB layer may have committed or
prepared transactions and we don't want to lose them. */
- total_trx = trx_sys_any_active_transactions();
-
- if (total_trx > 0) {
+ if (ulint total_trx = srv_was_started
+ ? trx_sys_any_active_transactions() : 0) {
if (srv_print_verbose_log && count > 600) {
ib::info() << "Waiting for " << total_trx << " active"
@@ -2253,8 +2255,8 @@ wait_suspend_loop:
goto loop;
}
- if (srv_fast_shutdown == 2) {
- if (!srv_read_only_mode) {
+ if (srv_fast_shutdown == 2 || !srv_was_started) {
+ if (!srv_read_only_mode && srv_was_started) {
ib::info() << "MySQL has requested a very fast"
" shutdown without flushing the InnoDB buffer"
" pool to data files. At the next mysqld"
@@ -2318,8 +2320,7 @@ wait_suspend_loop:
srv_shutdown_state = SRV_SHUTDOWN_LAST_PHASE;
/* Make some checks that the server really is quiet */
- srv_thread_type type = srv_get_active_thread_type();
- ut_a(type == SRV_NONE);
+ ut_a(srv_get_active_thread_type() == SRV_NONE);
bool freed = buf_all_freed();
ut_a(freed);
@@ -2327,9 +2328,8 @@ wait_suspend_loop:
ut_a(lsn == log_sys->lsn);
if (lsn < srv_start_lsn) {
- ib::error() << "Log sequence number at shutdown " << lsn
- << " is lower than at startup " << srv_start_lsn
- << "!";
+ ib::error() << "Shutdown LSN=" << lsn
+ << " is less than start LSN=" << srv_start_lsn;
}
srv_shutdown_lsn = lsn;
@@ -2339,15 +2339,14 @@ wait_suspend_loop:
if (err != DB_SUCCESS) {
ib::error() << "Writing flushed lsn " << lsn
- << " failed at shutdown error " << err;
+ << " failed; error=" << err;
}
}
fil_close_all_files();
/* Make some checks that the server really is quiet */
- type = srv_get_active_thread_type();
- ut_a(type == SRV_NONE);
+ ut_a(srv_get_active_thread_type() == SRV_NONE);
freed = buf_all_freed();
ut_a(freed);
@@ -2596,7 +2595,7 @@ DECLARE_THREAD(log_scrub_thread)(void*)
/* log scrubbing interval in µs. */
ulonglong interval = 1000*1000*512/innodb_scrub_log_speed;
- os_event_wait_time(log_scrub_event, interval);
+ os_event_wait_time(log_scrub_event, static_cast<ulint>(interval));
log_scrub();
diff --git a/storage/innobase/log/log0recv.cc b/storage/innobase/log/log0recv.cc
index 1ecebe098bd..78566d060cb 100644
--- a/storage/innobase/log/log0recv.cc
+++ b/storage/innobase/log/log0recv.cc
@@ -2,7 +2,7 @@
Copyright (c) 1997, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2012, Facebook Inc.
-Copyright (c) 2013, 2016, MariaDB Corporation. All Rights Reserved.
+Copyright (c) 2013, 2017, MariaDB Corporation. 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
@@ -224,42 +224,6 @@ fil_name_process(
case FIL_LOAD_OK:
ut_ad(space != NULL);
-#ifdef MYSQL_ENCRYPTION
- /* For encrypted tablespace, set key and iv. */
- if (FSP_FLAGS_GET_ENCRYPTION(space->flags)
- && recv_sys->encryption_list != NULL) {
- dberr_t err;
- encryption_list_t::iterator it;
-
- for (it = recv_sys->encryption_list->begin();
- it != recv_sys->encryption_list->end();
- it++) {
- if (it->space_id == space->id) {
- err = fil_set_encryption(
- space->id,
- Encryption::AES,
- it->key,
- it->iv);
- if (err != DB_SUCCESS) {
- ib::error()
- << "Can't set"
- " encryption"
- " information"
- " for"
- " tablespace"
- << space->name
- << "!";
- }
- ut_free(it->key);
- ut_free(it->iv);
- it->key = NULL;
- it->iv = NULL;
- it->space_id = 0;
- }
- }
- }
-#endif /* MYSQL_ENCRYPTION */
-
if (f.space == NULL || f.space == space) {
f.name = fname.name;
f.space = space;
@@ -491,6 +455,8 @@ recv_sys_close(void)
/*================*/
{
if (recv_sys != NULL) {
+ recv_sys->dblwr.pages.clear();
+
if (recv_sys->addr_hash != NULL) {
hash_table_free(recv_sys->addr_hash);
}
@@ -682,7 +648,6 @@ recv_sys_init(
/* Call the constructor for recv_sys_t::dblwr member */
new (&recv_sys->dblwr) recv_dblwr_t();
- recv_sys->encryption_list = NULL;
mutex_exit(&(recv_sys->mutex));
}
@@ -732,28 +697,6 @@ recv_sys_debug_free(void)
os_event_set(recv_sys->flush_start);
}
- if (recv_sys->encryption_list != NULL) {
- encryption_list_t::iterator it;
-
- for (it = recv_sys->encryption_list->begin();
- it != recv_sys->encryption_list->end();
- it++) {
- if (it->key != NULL) {
- ut_free(it->key);
- it->key = NULL;
- }
- if (it->iv != NULL) {
- ut_free(it->iv);
- it->iv = NULL;
- }
- }
-
- recv_sys->encryption_list->swap(*recv_sys->encryption_list);
-
- UT_DELETE(recv_sys->encryption_list);
- recv_sys->encryption_list = NULL;
- }
-
mutex_exit(&(recv_sys->mutex));
}
@@ -928,7 +871,7 @@ recv_log_format_0_recover(lsn_t lsn)
univ_page_size,
(ulint) ((source_offset & ~(OS_FILE_LOG_BLOCK_SIZE - 1))
% univ_page_size.physical()),
- OS_FILE_LOG_BLOCK_SIZE, buf, NULL, NULL);
+ OS_FILE_LOG_BLOCK_SIZE, buf, NULL);
if (log_block_calc_checksum_format_0(buf)
!= log_block_get_checksum(buf)) {
@@ -1101,116 +1044,6 @@ log_block_checksum_is_ok(
== log_block_calc_checksum(block));
}
-#ifdef MYSQL_ENCRYPTION
-
-/** Parse or process a write encryption info record.
-@param[in] ptr redo log record
-@param[in] end end of the redo log buffer
-@param[in] space_id the tablespace ID
-@return log record end, NULL if not a complete record */
-static
-byte*
-fil_write_encryption_parse(
- byte* ptr,
- const byte* end,
- ulint space_id)
-{
- fil_space_t* space;
- ulint offset;
- ulint len;
- byte* key = NULL;
- byte* iv = NULL;
- bool is_new = false;
-
- space = fil_space_get(space_id);
- if (space == NULL) {
- encryption_list_t::iterator it;
-
- if (recv_sys->encryption_list == NULL) {
- recv_sys->encryption_list =
- UT_NEW_NOKEY(encryption_list_t());
- }
-
- for (it = recv_sys->encryption_list->begin();
- it != recv_sys->encryption_list->end();
- it++) {
- if (it->space_id == space_id) {
- key = it->key;
- iv = it->iv;
- }
- }
-
- if (key == NULL) {
- key = static_cast<byte*>(ut_malloc_nokey(
- ENCRYPTION_KEY_LEN));
- iv = static_cast<byte*>(ut_malloc_nokey(
- ENCRYPTION_KEY_LEN));
- is_new = true;
- }
- } else {
- key = space->encryption_key;
- iv = space->encryption_iv;
- }
-
- offset = mach_read_from_2(ptr);
- ptr += 2;
- len = mach_read_from_2(ptr);
-
- ptr += 2;
- if (end < ptr + len) {
- return(NULL);
- }
-
- if (offset >= UNIV_PAGE_SIZE
- || len + offset > UNIV_PAGE_SIZE
- || (len != ENCRYPTION_INFO_SIZE_V1
- && len != ENCRYPTION_INFO_SIZE_V2)) {
- recv_sys->found_corrupt_log = TRUE;
- return(NULL);
- }
-
-#ifdef UNIV_ENCRYPT_DEBUG
- if (space) {
- fprintf(stderr, "Got %lu from redo log:", space->id);
- }
-#endif
-
- if (!fsp_header_decode_encryption_info(key,
- iv,
- ptr)) {
- recv_sys->found_corrupt_log = TRUE;
- ib::warn() << "Encryption information"
- << " in the redo log of space "
- << space_id << " is invalid";
- }
-
- ut_ad(len == ENCRYPTION_INFO_SIZE_V1
- || len == ENCRYPTION_INFO_SIZE_V2);
-
- ptr += len;
-
- if (space == NULL) {
- if (is_new) {
- recv_encryption_t info;
-
- /* Add key and iv to list */
- info.space_id = space_id;
- info.key = key;
- info.iv = iv;
-
- recv_sys->encryption_list->push_back(info);
- }
- } else {
- ut_ad(FSP_FLAGS_GET_ENCRYPTION(space->flags));
-
- space->encryption_type = Encryption::AES;
- space->encryption_klen = ENCRYPTION_KEY_LEN;
- }
-
- return(ptr);
-}
-#endif /* MYSQL_ENCRYPTION */
-
/** Try to parse a single log record body and also applies it if
specified.
@param[in] type redo log entry type
@@ -1257,20 +1090,6 @@ recv_parse_or_apply_log_rec_body(
return(ptr + 8);
case MLOG_TRUNCATE:
return(truncate_t::parse_redo_entry(ptr, end_ptr, space_id));
- case MLOG_WRITE_STRING:
- /* For encrypted tablespace, we need to get the
- encryption key information before the page 0 is recovered.
- Otherwise, redo will not find the key to decrypt
- the data pages. */
-#ifdef MYSQL_ENCRYPTION
- if (page_no == 0 && !is_system_tablespace(space_id)
- && !apply) {
- return(fil_write_encryption_parse(ptr,
- end_ptr,
- space_id));
- }
-#endif
- break;
default:
break;
@@ -3031,10 +2850,9 @@ recv_scan_log_recs(
recv_init_crash_recovery();
} else {
-
- ib::warn() << "Recovery skipped,"
- " --innodb-read-only set!";
-
+ ib::warn() << "innodb_read_only"
+ " prevents crash recovery";
+ recv_needed_recovery = true;
return(true);
}
}
@@ -3446,6 +3264,11 @@ recv_recovery_from_checkpoint_start(
ut_ad(recv_sys->n_addrs == 0);
ut_ad(!recv_sys->found_corrupt_fs);
+ if (srv_read_only_mode && recv_needed_recovery) {
+ log_mutex_exit();
+ return(DB_READ_ONLY);
+ }
+
if (recv_sys->found_corrupt_log && !srv_force_recovery) {
log_mutex_exit();
ib::error() << "Found corrupted log when looking checkpoint lsn: "
@@ -3718,8 +3541,6 @@ recv_recovery_rollback_active(void)
/* Drop partially created indexes. */
row_merge_drop_temp_indexes();
- /* Drop temporary tables. */
- row_mysql_drop_temp_tables();
/* Drop any auxiliary tables that were not dropped when the
parent table was dropped. This can happen if the parent table
diff --git a/storage/innobase/mtr/mtr0mtr.cc b/storage/innobase/mtr/mtr0mtr.cc
index 736933bdaed..418cd7042c6 100644
--- a/storage/innobase/mtr/mtr0mtr.cc
+++ b/storage/innobase/mtr/mtr0mtr.cc
@@ -1,6 +1,7 @@
/*****************************************************************************
Copyright (c) 1995, 2016, 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
@@ -120,6 +121,8 @@ struct FindPage
FindPage(const void* ptr, ulint flags)
: m_ptr(ptr), m_flags(flags), m_slot(NULL)
{
+ /* There must be some flags to look for. */
+ ut_ad(flags);
/* We can only look for page-related flags. */
ut_ad(!(flags & ~(MTR_MEMO_PAGE_S_FIX
| MTR_MEMO_PAGE_X_FIX
@@ -148,6 +151,11 @@ struct FindPage
return(true);
}
+ ut_ad(!(m_flags & (MTR_MEMO_PAGE_S_FIX
+ | MTR_MEMO_PAGE_SX_FIX
+ | MTR_MEMO_PAGE_X_FIX))
+ || rw_lock_own_flagged(&block->lock, m_flags));
+
m_slot = slot;
return(false);
}
@@ -1009,14 +1017,30 @@ mtr_t::release_free_extents(ulint n_reserved)
@return true if contains */
bool
mtr_t::memo_contains(
- mtr_buf_t* memo,
- const void* object,
- ulint type)
+ const mtr_buf_t* memo,
+ const void* object,
+ ulint type)
{
Find find(object, type);
Iterate<Find> iterator(find);
- return(!memo->for_each_block_in_reverse(iterator));
+ if (memo->for_each_block_in_reverse(iterator)) {
+ return(false);
+ }
+
+ switch (type) {
+ case MTR_MEMO_X_LOCK:
+ ut_ad(rw_lock_own((rw_lock_t*) object, RW_LOCK_X));
+ break;
+ case MTR_MEMO_SX_LOCK:
+ ut_ad(rw_lock_own((rw_lock_t*) object, RW_LOCK_SX));
+ break;
+ case MTR_MEMO_S_LOCK:
+ ut_ad(rw_lock_own((rw_lock_t*) object, RW_LOCK_S));
+ break;
+ }
+
+ return(true);
}
/** Debug check for flags */
@@ -1026,20 +1050,56 @@ struct FlaggedCheck {
m_ptr(ptr),
m_flags(flags)
{
- // Do nothing
+ /* There must be some flags to look for. */
+ ut_ad(flags);
+ /* Look for rw-lock-related and page-related flags. */
+ ut_ad(!(flags & ~(MTR_MEMO_PAGE_S_FIX
+ | MTR_MEMO_PAGE_X_FIX
+ | MTR_MEMO_PAGE_SX_FIX
+ | MTR_MEMO_BUF_FIX
+ | MTR_MEMO_MODIFY
+ | MTR_MEMO_X_LOCK
+ | MTR_MEMO_SX_LOCK
+ | MTR_MEMO_S_LOCK)));
+ /* Either some rw-lock-related or page-related flags
+ must be specified, but not both at the same time. */
+ ut_ad(!(flags & (MTR_MEMO_PAGE_S_FIX
+ | MTR_MEMO_PAGE_X_FIX
+ | MTR_MEMO_PAGE_SX_FIX
+ | MTR_MEMO_BUF_FIX
+ | MTR_MEMO_MODIFY))
+ == !!(flags & (MTR_MEMO_X_LOCK
+ | MTR_MEMO_SX_LOCK
+ | MTR_MEMO_S_LOCK)));
}
+ /** Visit a memo entry.
+ @param[in] slot memo entry to visit
+ @retval false if m_ptr was found
+ @retval true if the iteration should continue */
bool operator()(const mtr_memo_slot_t* slot) const
{
- if (m_ptr == slot->object && (m_flags & slot->type)) {
- return(false);
+ if (m_ptr != slot->object || !(m_flags & slot->type)) {
+ return(true);
}
- return(true);
+ if (ulint flags = m_flags & (MTR_MEMO_PAGE_S_FIX
+ | MTR_MEMO_PAGE_SX_FIX
+ | MTR_MEMO_PAGE_X_FIX)) {
+ rw_lock_t* lock = &static_cast<buf_block_t*>(
+ const_cast<void*>(m_ptr))->lock;
+ ut_ad(rw_lock_own_flagged(lock, flags));
+ } else {
+ rw_lock_t* lock = static_cast<rw_lock_t*>(
+ const_cast<void*>(m_ptr));
+ ut_ad(rw_lock_own_flagged(lock, m_flags >> 5));
+ }
+
+ return(false);
}
- const void* m_ptr;
- ulint m_flags;
+ const void*const m_ptr;
+ const ulint m_flags;
};
/** Check if memo contains the given item.
diff --git a/storage/innobase/mysql-test/storage_engine/tbl_opt_key_block_size.opt b/storage/innobase/mysql-test/storage_engine/tbl_opt_key_block_size.opt
deleted file mode 100644
index 7cd737b2b87..00000000000
--- a/storage/innobase/mysql-test/storage_engine/tbl_opt_key_block_size.opt
+++ /dev/null
@@ -1,3 +0,0 @@
---innodb-file-per-table=1
---innodb-file-format=Barracuda
-
diff --git a/storage/innobase/mysql-test/storage_engine/tbl_opt_row_format.opt b/storage/innobase/mysql-test/storage_engine/tbl_opt_row_format.opt
deleted file mode 100644
index 7cd737b2b87..00000000000
--- a/storage/innobase/mysql-test/storage_engine/tbl_opt_row_format.opt
+++ /dev/null
@@ -1,3 +0,0 @@
---innodb-file-per-table=1
---innodb-file-format=Barracuda
-
diff --git a/storage/innobase/os/os0file.cc b/storage/innobase/os/os0file.cc
index 58cc1ff8d3e..488a9ff88dc 100644
--- a/storage/innobase/os/os0file.cc
+++ b/storage/innobase/os/os0file.cc
@@ -2,7 +2,7 @@
Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2009, Percona Inc.
-Copyright (c) 2013, 2016, MariaDB Corporation.
+Copyright (c) 2013, 2017, MariaDB Corporation.
Portions of this file contain modifications contributed and copyrighted
by Percona Inc.. Those modifications are
@@ -44,6 +44,11 @@ Created 10/21/1995 Heikki Tuuri
#include "os0file.ic"
#endif
+#ifdef UNIV_LINUX
+#include <sys/types.h>
+#include <sys/stat.h>
+#endif
+
#include "srv0srv.h"
#include "srv0start.h"
#include "fil0fil.h"
@@ -68,17 +73,18 @@ Created 10/21/1995 Heikki Tuuri
# include <linux/falloc.h>
#endif /* HAVE_FALLOC_PUNCH_HOLE_AND_KEEP_SIZE */
-#ifdef HAVE_LZ4
-#include <lz4.h>
-#endif
-
-#include <zlib.h>
-
#ifdef UNIV_DEBUG
/** Set when InnoDB has invoked exit(). */
bool innodb_calling_exit;
#endif /* UNIV_DEBUG */
+#if defined(UNIV_LINUX) && defined(HAVE_SYS_IOCTL_H)
+# include <sys/ioctl.h>
+# ifndef DFS_IOCTL_ATOMIC_WRITE_SET
+# define DFS_IOCTL_ATOMIC_WRITE_SET _IOW(0x95, 2, uint)
+# endif
+#endif
+
#if defined(UNIV_LINUX) && defined(HAVE_SYS_STATVFS_H)
#include <sys/statvfs.h>
#endif
@@ -87,17 +93,8 @@ bool innodb_calling_exit;
#include <linux/falloc.h>
#endif
-#ifdef HAVE_FALLOC_PUNCH_HOLE_AND_KEEP_SIZE
-# include <fcntl.h>
-# include <linux/falloc.h>
-#endif /* HAVE_FALLOC_PUNCH_HOLE_AND_KEEP_SIZE */
-
-#ifdef HAVE_LZO
-#include "lzo/lzo1x.h"
-#endif
-
-#ifdef HAVE_SNAPPY
-#include "snappy-c.h"
+#ifdef _WIN32
+#include <winioctl.h>
#endif
/** Insert buffer segment id */
@@ -109,30 +106,6 @@ static const ulint IO_LOG_SEGMENT = 1;
/** Number of retries for partial I/O's */
static const ulint NUM_RETRIES_ON_PARTIAL_IO = 10;
-/** Blocks for doing IO, used in the transparent compression
-and encryption code. */
-struct Block {
- /** Default constructor */
- Block() : m_ptr(), m_in_use() { }
-
- byte* m_ptr;
-
- byte pad[CACHE_LINE_SIZE - sizeof(ulint)];
- int32 m_in_use;
-};
-
-/** For storing the allocated blocks */
-typedef std::vector<Block> Blocks;
-
-/** Block collection */
-static Blocks* block_cache;
-
-/** Number of blocks to allocate for sync read/writes */
-static const size_t MAX_BLOCKS = 128;
-
-/** Block buffer size */
-#define BUFFER_BLOCK_SIZE ((ulint)(UNIV_PAGE_SIZE * 1.3))
-
/* This specifies the file permissions InnoDB uses when it creates files in
Unix; the value of os_innodb_umask is initialized in ha_innodb.cc to
my_umask */
@@ -250,8 +223,6 @@ struct Slot {
/** buffer used in i/o */
byte* buf;
- ulint is_log; /*!< 1 if OS_FILE_LOG or 0 */
- ulint page_size; /*!< UNIV_PAGE_SIZE or zip_size */
/** Buffer pointer used for actual IO. We advance this
when partial IO is required and not buf */
@@ -320,19 +291,6 @@ struct Slot {
/** Length of the block before it was compressed */
uint32 original_len;
- /** Buffer block for compressed pages or encrypted pages */
- Block* buf_block;
-
- /** Unaligned buffer for compressed pages */
- byte* compressed_ptr;
-
- /** Compressed data page, aligned and derived from compressed_ptr */
- byte* compressed_page;
-
- /** true, if we shouldn't punch a hole after writing the page */
- bool skip_punch_hole;
-
- ulint* write_size;
};
/** The asynchronous i/o array structure */
@@ -374,8 +332,7 @@ public:
const char* name,
void* buf,
os_offset_t offset,
- ulint len,
- ulint* write_size)
+ ulint len)
MY_ATTRIBUTE((warn_unused_result));
/** @return number of reserved slots */
@@ -783,26 +740,6 @@ os_file_handle_error_no_exit(
const char* operation,
bool silent);
-/** Decompress after a read and punch a hole in the file if it was a write
-@param[in] type IO context
-@param[in] fh Open file handle
-@param[in,out] buf Buffer to transform
-@param[in,out] scratch Scratch area for read decompression
-@param[in] src_len Length of the buffer before compression
-@param[in] len Compressed buffer length for write and size
- of buf len for read
-@return DB_SUCCESS or error code */
-static
-dberr_t
-os_file_io_complete(
- const IORequest&type,
- os_file_t fh,
- byte* buf,
- byte* scratch,
- ulint src_len,
- ulint offset,
- ulint len);
-
/** Does simulated AIO. This function should be called by an i/o-handler
thread.
@@ -825,6 +762,142 @@ os_aio_simulated_handler(
void** m2,
IORequest* type);
+#ifdef _WIN32
+static HANDLE win_get_syncio_event();
+#endif
+
+#ifdef _WIN32
+/**
+ Wrapper around Windows DeviceIoControl() function.
+
+ Works synchronously, also in case for handle opened
+ for async access (i.e with FILE_FLAG_OVERLAPPED).
+
+ Accepts the same parameters as DeviceIoControl(),except
+ last parameter (OVERLAPPED).
+*/
+static
+BOOL
+os_win32_device_io_control(
+ HANDLE handle,
+ DWORD code,
+ LPVOID inbuf,
+ DWORD inbuf_size,
+ LPVOID outbuf,
+ DWORD outbuf_size,
+ LPDWORD bytes_returned
+)
+{
+ OVERLAPPED overlapped = { 0 };
+ overlapped.hEvent = win_get_syncio_event();
+ BOOL result = DeviceIoControl(handle, code, inbuf, inbuf_size, outbuf,
+ outbuf_size, bytes_returned, &overlapped);
+
+ if (!result && (GetLastError() == ERROR_IO_PENDING)) {
+ /* Wait for async io to complete */
+ result = GetOverlappedResult(handle, &overlapped, bytes_returned, TRUE);
+ }
+
+ return result;
+}
+
+#endif
+
+/***********************************************************************//**
+Try to get number of bytes per sector from file system.
+@return file block size */
+UNIV_INTERN
+ulint
+os_file_get_block_size(
+/*===================*/
+ os_file_t file, /*!< in: handle to a file */
+ const char* name) /*!< in: file name */
+{
+ ulint fblock_size = 512;
+
+#if defined(UNIV_LINUX)
+ struct stat local_stat;
+ int err;
+
+ err = fstat((int)file, &local_stat);
+
+ if (err != 0) {
+ os_file_handle_error_no_exit(name, "fstat()", FALSE);
+ } else {
+ fblock_size = local_stat.st_blksize;
+ }
+#endif /* UNIV_LINUX */
+#ifdef _WIN32
+
+ fblock_size = 0;
+
+ // Open volume for this file, find out it "physical bytes per sector"
+
+ HANDLE volume_handle = INVALID_HANDLE_VALUE;
+ char volume[MAX_PATH + 4]="\\\\.\\"; // Special prefix required for volume names.
+ if (!GetVolumePathName(name , volume + 4, MAX_PATH)) {
+ os_file_handle_error_no_exit(name,
+ "GetVolumePathName()", FALSE);
+ goto end;
+ }
+
+ size_t len = strlen(volume);
+ if (volume[len - 1] == '\\') {
+ // Trim trailing backslash from volume name.
+ volume[len - 1] = 0;
+ }
+
+ volume_handle = CreateFile(volume, FILE_READ_ATTRIBUTES,
+ FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
+ 0, OPEN_EXISTING, 0, 0);
+
+ if (volume_handle == INVALID_HANDLE_VALUE) {
+ os_file_handle_error_no_exit(volume,
+ "CreateFile()", FALSE);
+ goto end;
+ }
+
+ DWORD tmp;
+ STORAGE_ACCESS_ALIGNMENT_DESCRIPTOR disk_alignment;
+
+ STORAGE_PROPERTY_QUERY storage_query;
+ memset(&storage_query, 0, sizeof(storage_query));
+ storage_query.PropertyId = StorageAccessAlignmentProperty;
+ storage_query.QueryType = PropertyStandardQuery;
+
+ BOOL result = os_win32_device_io_control(volume_handle,
+ IOCTL_STORAGE_QUERY_PROPERTY,
+ &storage_query,
+ sizeof(storage_query),
+ &disk_alignment,
+ sizeof(disk_alignment),
+ &tmp);
+
+ CloseHandle(volume_handle);
+
+ if (!result) {
+ os_file_handle_error_no_exit(volume,
+ "DeviceIoControl(IOCTL_STORAGE_QUERY_PROPERTY)", FALSE);
+ goto end;
+ }
+
+ fblock_size = disk_alignment.BytesPerPhysicalSector;
+
+end:
+#endif /* _WIN32 */
+
+ /* Currently we support file block size up to 4Kb */
+ if (fblock_size > 4096 || fblock_size < 512) {
+ if (fblock_size < 512) {
+ fblock_size = 512;
+ } else {
+ fblock_size = 4096;
+ }
+ }
+
+ return fblock_size;
+}
+
#ifdef WIN_ASYNC_IO
/** This function is only used in Windows asynchronous i/o.
Waits for an aio operation to complete. This function is used to wait the
@@ -859,166 +932,12 @@ os_aio_windows_handler(
IORequest* type);
#endif /* WIN_ASYNC_IO */
-#ifdef MYSQL_COMPRESSION
-/** Allocate a page for sync IO
-@return pointer to page */
-static
-Block*
-os_alloc_block()
-{
- size_t pos;
- Blocks& blocks = *block_cache;
- size_t i = static_cast<size_t>(my_timer_cycles());
- const size_t size = blocks.size();
- ulint retry = 0;
- Block* block;
-
- DBUG_EXECUTE_IF("os_block_cache_busy", retry = MAX_BLOCKS * 3;);
-
- for (;;) {
-
- /* After go through the block cache for 3 times,
- allocate a new temporary block. */
- if (retry == MAX_BLOCKS * 3) {
- byte* ptr;
-
- ptr = static_cast<byte*>(
- ut_malloc_nokey(sizeof(*block)
- + BUFFER_BLOCK_SIZE));
-
- block = new (ptr) Block();
- block->m_ptr = static_cast<byte*>(
- ptr + sizeof(*block));
- block->m_in_use = 1;
-
- break;
- }
-
- pos = i++ % size;
-
- if (my_atomic_fas32_explicit(&blocks[pos].m_in_use, 1,
- MY_MEMORY_ORDER_ACQUIRE) == 0) {
- block = &blocks[pos];
- break;
- }
-
- os_thread_yield();
-
- ++retry;
- }
-
- ut_a(block->m_in_use != 0);
-
- return(block);
-}
-
-/** Free a page after sync IO
-@param[in,own] block The block to free/release */
-static
-void
-os_free_block(Block* block)
-{
- ut_ad(block->m_in_use == 1);
-
- my_atomic_store32_explicit(&block->m_in_use, 0, MY_MEMORY_ORDER_RELEASE);
-
- /* When this block is not in the block cache, and it's
- a temporary block, we need to free it directly. */
- if (std::less<Block*>()(block, &block_cache->front())
- || std::greater<Block*>()(block, &block_cache->back())) {
- ut_free(block);
- }
-}
-#endif /* MYSQL_COMPRESSION */
-
/** Generic AIO Handler methods. Currently handles IO post processing. */
class AIOHandler {
public:
/** Do any post processing after a read/write
@return DB_SUCCESS or error code. */
static dberr_t post_io_processing(Slot* slot);
-
- /** Decompress after a read and punch a hole in the file if
- it was a write */
- static dberr_t io_complete(const Slot* slot)
- {
- ut_a(slot->offset > 0);
- ut_a(slot->type.is_read() || !slot->skip_punch_hole);
-
- return(os_file_io_complete(
- slot->type, slot->file, slot->buf,
- slot->compressed_page, slot->original_len,
- static_cast<ulint>(slot->offset),
- slot->len));
- }
-
-private:
- /** Check whether the page was encrypted.
- @param[in] slot The slot that contains the IO request
- @return true if it was an encyrpted page */
- static bool is_encrypted_page(const Slot* slot)
- {
-#ifdef MYSQL_ENCRYPTION
- return(Encryption::is_encrypted_page(slot->buf));
-#else
- return (false);
-#endif
- }
-
- /** Check whether the page was compressed.
- @param[in] slot The slot that contains the IO request
- @return true if it was a compressed page */
- static bool is_compressed_page(const Slot* slot)
- {
- const byte* src = slot->buf;
-
- ulint page_type = mach_read_from_2(src + FIL_PAGE_TYPE);
-
- return(page_type == FIL_PAGE_COMPRESSED);
- }
-
- /** Get the compressed page size.
- @param[in] slot The slot that contains the IO request
- @return number of bytes to read for a successful decompress */
- static ulint compressed_page_size(const Slot* slot)
- {
- ut_ad(slot->type.is_read());
- ut_ad(is_compressed_page(slot));
-
- ulint size;
- const byte* src = slot->buf;
-
- size = mach_read_from_2(src + FIL_PAGE_COMPRESS_SIZE_V1);
-
- return(size + FIL_PAGE_DATA);
- }
-
- /** Check if the page contents can be decompressed.
- @param[in] slot The slot that contains the IO request
- @return true if the data read has all the compressed data */
- static bool can_decompress(const Slot* slot)
- {
- ut_ad(slot->type.is_read());
- ut_ad(is_compressed_page(slot));
-
- ulint version;
- const byte* src = slot->buf;
-
- version = mach_read_from_1(src + FIL_PAGE_VERSION);
-
- ut_a(version == 1);
-
- /* Includes the page header size too */
- ulint size = compressed_page_size(slot);
-
- return(size <= (slot->ptr - slot->buf) + (ulint) slot->n_bytes);
- }
-
- /** Check if we need to read some more data.
- @param[in] slot The slot that contains the IO request
- @param[in] n_bytes Total bytes read so far
- @return DB_SUCCESS or error code */
- static dberr_t check_read(Slot* slot, ulint n_bytes);
};
/** Helper class for doing synchronous file IO. Currently, the objective
@@ -1084,171 +1003,17 @@ private:
os_offset_t m_offset;
};
-/** If it is a compressed page return the compressed page data + footer size
-@param[in] buf Buffer to check, must include header + 10 bytes
-@return ULINT_UNDEFINED if the page is not a compressed page or length
- of the compressed data (including footer) if it is a compressed page */
-ulint
-os_file_compressed_page_size(const byte* buf)
-{
- ulint type = mach_read_from_2(buf + FIL_PAGE_TYPE);
-
- if (type == FIL_PAGE_COMPRESSED) {
- ulint version = mach_read_from_1(buf + FIL_PAGE_VERSION);
- ut_a(version == 1);
- return(mach_read_from_2(buf + FIL_PAGE_COMPRESS_SIZE_V1));
- }
-
- return(ULINT_UNDEFINED);
-}
-
-/** If it is a compressed page return the original page data + footer size
-@param[in] buf Buffer to check, must include header + 10 bytes
-@return ULINT_UNDEFINED if the page is not a compressed page or length
- of the original data + footer if it is a compressed page */
-ulint
-os_file_original_page_size(const byte* buf)
-{
- ulint type = mach_read_from_2(buf + FIL_PAGE_TYPE);
-
- if (type == FIL_PAGE_COMPRESSED) {
-
- ulint version = mach_read_from_1(buf + FIL_PAGE_VERSION);
- ut_a(version == 1);
-
- return(mach_read_from_2(buf + FIL_PAGE_ORIGINAL_SIZE_V1));
- }
-
- return(ULINT_UNDEFINED);
-}
-
-/** Check if we need to read some more data.
-@param[in] slot The slot that contains the IO request
-@param[in] n_bytes Total bytes read so far
-@return DB_SUCCESS or error code */
-dberr_t
-AIOHandler::check_read(Slot* slot, ulint n_bytes)
-{
- dberr_t err=DB_SUCCESS;
-
- ut_ad(slot->type.is_read());
- ut_ad(slot->original_len > slot->len);
-
- if (is_compressed_page(slot)) {
-
- if (can_decompress(slot)) {
-
- ut_a(slot->offset > 0);
-
- slot->len = slot->original_len;
-#ifdef _WIN32
- slot->n_bytes = static_cast<DWORD>(n_bytes);
-#else
- slot->n_bytes = static_cast<ulint>(n_bytes);
-#endif /* _WIN32 */
-
- err = io_complete(slot);
- ut_a(err == DB_SUCCESS);
-
- } else {
- /* Read the next block in */
- ut_ad(compressed_page_size(slot) >= n_bytes);
-
- err = DB_FAIL;
- }
- } else if (is_encrypted_page(slot)) {
- ut_a(slot->offset > 0);
-
- slot->len = slot->original_len;
-#ifdef _WIN32
- slot->n_bytes = static_cast<DWORD>(n_bytes);
-#else
- slot->n_bytes = static_cast<ulint>(n_bytes);
-#endif /* _WIN32 */
-
- err = io_complete(slot);
- ut_a(err == DB_SUCCESS);
-
- } else {
- err = DB_FAIL;
- }
-
-#ifdef MYSQL_COMPRESSION
- if (slot->buf_block != NULL) {
- os_free_block(slot->buf_block);
- slot->buf_block = NULL;
- }
-#endif
- return(err);
-}
-
/** Do any post processing after a read/write
@return DB_SUCCESS or error code. */
dberr_t
AIOHandler::post_io_processing(Slot* slot)
{
- dberr_t err=DB_SUCCESS;
-
ut_ad(slot->is_reserved);
/* Total bytes read so far */
ulint n_bytes = (slot->ptr - slot->buf) + slot->n_bytes;
- /* Compressed writes can be smaller than the original length.
- Therefore they can be processed without further IO. */
- if (n_bytes == slot->original_len
- || (slot->type.is_write()
- && slot->type.is_compressed()
- && slot->len == static_cast<ulint>(slot->n_bytes))) {
-
-#ifdef MYSQL_COMPRESSION
- if (!slot->type.is_log()
- && (is_compressed_page(slot)
- || is_encrypted_page(slot))) {
-
- ut_a(slot->offset > 0);
-
- if (slot->type.is_read()) {
- slot->len = slot->original_len;
- }
-
- /* The punch hole has been done on collect() */
-
- if (slot->type.is_read()) {
- err = io_complete(slot);
- } else {
- err = DB_SUCCESS;
- }
-
- ut_ad(err == DB_SUCCESS
- || err == DB_UNSUPPORTED
- || err == DB_CORRUPTION
- || err == DB_IO_DECOMPRESS_FAIL);
- } else {
-
- err = DB_SUCCESS;
- }
-
- if (slot->buf_block != NULL) {
- os_free_block(slot->buf_block);
- slot->buf_block = NULL;
- }
-#endif /* MYSQL_COMPRESSION */
- } else if ((ulint) slot->n_bytes == (ulint) slot->len) {
-
- /* It *must* be a partial read. */
- ut_ad(slot->len < slot->original_len);
-
- /* Has to be a read request, if it is less than
- the original length. */
- ut_ad(slot->type.is_read());
- err = check_read(slot, n_bytes);
-
- } else {
- err = DB_FAIL;
- }
-
- return(err);
+ return(n_bytes == slot->original_len ? DB_SUCCESS : DB_FAIL);
}
/** Count the number of free slots
@@ -1284,155 +1049,6 @@ AIO::pending_io_count() const
return(reserved);
}
-#ifdef MYSQL_COMPRESSION
-/** Compress a data page
-#param[in] block_size File system block size
-@param[in] src Source contents to compress
-@param[in] src_len Length in bytes of the source
-@param[out] dst Compressed page contents
-@param[out] dst_len Length in bytes of dst contents
-@return buffer data, dst_len will have the length of the data */
-static
-byte*
-os_file_compress_page(
- Compression compression,
- ulint block_size,
- byte* src,
- ulint src_len,
- byte* dst,
- ulint* dst_len)
-{
- ulint len = 0;
- ulint compression_level = page_zip_level;
- ulint page_type = mach_read_from_2(src + FIL_PAGE_TYPE);
-
- /* The page size must be a multiple of the OS punch hole size. */
- ut_ad(!(src_len % block_size));
-
- /* Shouldn't compress an already compressed page. */
- ut_ad(page_type != FIL_PAGE_COMPRESSED);
-
- /* The page must be at least twice as large as the file system
- block size if we are to save any space. Ignore R-Tree pages for now,
- they repurpose the same 8 bytes in the page header. No point in
- compressing if the file system block size >= our page size. */
-
- if (page_type == FIL_PAGE_RTREE
- || block_size == ULINT_UNDEFINED
- || compression.m_type == Compression::NONE
- || src_len < block_size * 2) {
-
- *dst_len = src_len;
-
- return(src);
- }
-
- /* Leave the header alone when compressing. */
- ut_ad(block_size >= FIL_PAGE_DATA * 2);
-
- ut_ad(src_len > FIL_PAGE_DATA + block_size);
-
- /* Must compress to <= N-1 FS blocks. */
- ulint out_len = src_len - (FIL_PAGE_DATA + block_size);
-
- /* This is the original data page size - the page header. */
- ulint content_len = src_len - FIL_PAGE_DATA;
-
- ut_ad(out_len >= block_size - FIL_PAGE_DATA);
- ut_ad(out_len <= src_len - (block_size + FIL_PAGE_DATA));
-
- /* Only compress the data + trailer, leave the header alone */
-
- switch (compression.m_type) {
- case Compression::NONE:
- ut_error;
-
- case Compression::ZLIB: {
-
- uLongf zlen = static_cast<uLongf>(out_len);
-
- if (compress2(
- dst + FIL_PAGE_DATA,
- &zlen,
- src + FIL_PAGE_DATA,
- static_cast<uLong>(content_len),
- static_cast<int>(compression_level)) != Z_OK) {
-
- *dst_len = src_len;
-
- return(src);
- }
-
- len = static_cast<ulint>(zlen);
-
- break;
- }
-
-#ifdef HAVE_LZ4
- case Compression::LZ4:
-
- len = LZ4_compress_limitedOutput(
- reinterpret_cast<char*>(src) + FIL_PAGE_DATA,
- reinterpret_cast<char*>(dst) + FIL_PAGE_DATA,
- static_cast<int>(content_len),
- static_cast<int>(out_len));
-
- ut_a(len <= src_len - FIL_PAGE_DATA);
-
- if (len == 0 || len >= out_len) {
-
- *dst_len = src_len;
-
- return(src);
- }
-
- break;
-#endif
-
- default:
- *dst_len = src_len;
- return(src);
- }
-
- ut_a(len <= out_len);
-
- ut_ad(memcmp(src + FIL_PAGE_LSN + 4,
- src + src_len - FIL_PAGE_END_LSN_OLD_CHKSUM + 4, 4)
- == 0);
-
- /* Copy the header as is. */
- memmove(dst, src, FIL_PAGE_DATA);
-
- /* Add compression control information. Required for decompressing. */
- mach_write_to_2(dst + FIL_PAGE_TYPE, FIL_PAGE_COMPRESSED);
-
- mach_write_to_1(dst + FIL_PAGE_VERSION, 1);
-
- mach_write_to_1(dst + FIL_PAGE_ALGORITHM_V1, compression.m_type);
-
- mach_write_to_2(dst + FIL_PAGE_ORIGINAL_TYPE_V1, page_type);
-
- mach_write_to_2(dst + FIL_PAGE_ORIGINAL_SIZE_V1, content_len);
-
- mach_write_to_2(dst + FIL_PAGE_COMPRESS_SIZE_V1, len);
-
- /* Round to the next full block size */
-
- len += FIL_PAGE_DATA;
-
- *dst_len = ut_calc_align(len, block_size);
-
- ut_ad(*dst_len >= len && *dst_len <= out_len + FIL_PAGE_DATA);
-
- /* Clear out the unused portion of the page. */
- if (len % block_size) {
- memset(dst + len, 0x0, block_size - (len % block_size));
- }
-
- return(dst);
-}
-#endif /* MYSQL_COMPRESSION */
-
#ifdef UNIV_DEBUG
/** Validates the consistency the aio system some of the time.
@return true if ok or the check was skipped */
@@ -1652,87 +1268,6 @@ os_file_read_string(
}
}
-/** Decompress after a read and punch a hole in the file if it was a write
-@param[in] type IO context
-@param[in] fh Open file handle
-@param[in,out] buf Buffer to transform
-@param[in,out] scratch Scratch area for read decompression
-@param[in] src_len Length of the buffer before compression
-@param[in] len Used buffer length for write and output
- buf len for read
-@return DB_SUCCESS or error code */
-static
-dberr_t
-os_file_io_complete(
- const IORequest&type,
- os_file_t fh,
- byte* buf,
- byte* scratch,
- ulint src_len,
- ulint offset,
- ulint len)
-{
-#ifdef MYSQL_ENCRYPTION
- /* We never compress/decompress the first page */
- ut_a(offset > 0);
- ut_ad(type.validate());
-
- if (!type.is_compression_enabled()) {
-
- return(DB_SUCCESS);
-
- } else if (type.is_read()) {
- dberr_t ret = DB_SUCCESS;
- Encryption encryption(type.encryption_algorithm());
-
- ut_ad(!type.is_log());
-
- ret = encryption.decrypt(type, buf, src_len, scratch, len);
- if (ret == DB_SUCCESS) {
- return(os_file_decompress_page(
- type.is_dblwr_recover(),
- buf, scratch, len));
- } else {
- return(ret);
- }
-
- } else if (type.punch_hole()) {
-
- ut_ad(len <= src_len);
- ut_ad(!type.is_log());
- ut_ad(type.is_write());
- ut_ad(type.is_compressed());
-
- /* Nothing to do. */
- if (len == src_len) {
- return(DB_SUCCESS);
- }
-
-#ifdef UNIV_DEBUG
- const ulint block_size = type.block_size();
-#endif /* UNIV_DEBUG */
-
- /* We don't support multiple page sizes in the server
- at the moment. */
- ut_ad(src_len == srv_page_size);
-
- /* Must be a multiple of the compression unit size. */
- ut_ad((len % block_size) == 0);
- ut_ad((offset % block_size) == 0);
-
- ut_ad(len + block_size <= src_len);
-
- offset += len;
-
- return(os_file_punch_hole(fh, offset, src_len - len));
- }
-
- ut_ad(!type.is_log());
-#endif /* MYSQL_ENCRYPTION */
-
- return(DB_SUCCESS);
-}
-
/** This function returns a new path name after replacing the basename
in an old path with a new basename. The old_path is a full path
name including the extension. The tablename is in the normal
@@ -2028,132 +1563,6 @@ os_file_create_subdirs_if_needed(
return(success ? DB_SUCCESS : DB_ERROR);
}
-#ifdef MYSQL_COMPRESSION
-/** Allocate the buffer for IO on a transparently compressed table.
-@param[in] type IO flags
-@param[out] buf buffer to read or write
-@param[in,out] n number of bytes to read/write, starting from
- offset
-@return pointer to allocated page, compressed data is written to the offset
- that is aligned on UNIV_SECTOR_SIZE of Block.m_ptr */
-static
-Block*
-os_file_compress_page(
- IORequest& type,
- void*& buf,
- ulint* n)
-{
- ut_ad(!type.is_log());
- ut_ad(type.is_write());
- ut_ad(type.is_compressed());
-
- ulint n_alloc = *n * 2;
-
- ut_a(n_alloc <= UNIV_PAGE_SIZE_MAX * 2);
-#ifdef HAVE_LZ4
- ut_a(type.compression_algorithm().m_type != Compression::LZ4
- || static_cast<ulint>(LZ4_COMPRESSBOUND(*n)) < n_alloc);
-#endif
-
- Block* ptr = reinterpret_cast<Block*>(ut_malloc_nokey(n_alloc));
-
- if (ptr == NULL) {
- return(NULL);
- }
-
- ulint old_compressed_len;
- ulint compressed_len = *n;
-
- old_compressed_len = mach_read_from_2(
- reinterpret_cast<byte*>(buf)
- + FIL_PAGE_COMPRESS_SIZE_V1);
-
- if (old_compressed_len > 0) {
- old_compressed_len = ut_calc_align(
- old_compressed_len + FIL_PAGE_DATA,
- type.block_size());
- }
-
- byte* compressed_page;
-
- compressed_page = static_cast<byte*>(
- ut_align(block->m_ptr, UNIV_SECTOR_SIZE));
-
- byte* buf_ptr;
-
- buf_ptr = os_file_compress_page(
- type.compression_algorithm(),
- type.block_size(),
- reinterpret_cast<byte*>(buf),
- *n,
- compressed_page,
- &compressed_len);
-
- if (buf_ptr != buf) {
- /* Set new compressed size to uncompressed page. */
- memcpy(reinterpret_cast<byte*>(buf) + FIL_PAGE_COMPRESS_SIZE_V1,
- buf_ptr + FIL_PAGE_COMPRESS_SIZE_V1, 2);
-
- buf = buf_ptr;
- *n = compressed_len;
-
- if (compressed_len >= old_compressed_len) {
-
- ut_ad(old_compressed_len <= UNIV_PAGE_SIZE);
-
- type.clear_punch_hole();
- }
- }
-
- return(block);
-}
-#endif /* MYSQL_COMPRESSION */
-
-#ifdef MYSQL_ENCRYPTION
-/** Encrypt a page content when write it to disk.
-@param[in] type IO flags
-@param[out] buf buffer to read or write
-@param[in,out] n number of bytes to read/write, starting from
- offset
-@return pointer to the encrypted page */
-static
-Block*
-os_file_encrypt_page(
- const IORequest& type,
- void*& buf,
- ulint* n)
-{
-
- byte* encrypted_page;
- ulint encrypted_len = *n;
- byte* buf_ptr;
- Encryption encryption(type.encryption_algorithm());
-
- ut_ad(!type.is_log());
- ut_ad(type.is_write());
- ut_ad(type.is_encrypted());
-
- Block* block = os_alloc_block();
-
- encrypted_page = static_cast<byte*>(
- ut_align(block->m_ptr, UNIV_SECTOR_SIZE));
-
- buf_ptr = encryption.encrypt(type,
- reinterpret_cast<byte*>(buf), *n,
- encrypted_page, &encrypted_len);
-
- bool encrypted = buf_ptr != buf;
-
- if (encrypted) {
-
- buf = buf_ptr;
- *n = encrypted_len;
- }
-
- return(block);
-}
-#endif /* MYSQL_ENCRYPTION */
-
#ifndef _WIN32
/** Do the read/write
@@ -2173,7 +1582,6 @@ SyncFileIO::execute(const IORequest& request)
return(n_bytes);
}
-
/** Free storage space associated with a section of the file.
@param[in] fh Open file handle
@param[in] off Starting offset (SEEK_SET)
@@ -2196,14 +1604,12 @@ os_file_punch_hole_posix(
return(DB_SUCCESS);
}
- ut_a(ret == -1);
-
if (errno == ENOTSUP) {
return(DB_IO_NO_PUNCH_HOLE);
}
ib::warn()
- << "fallocate(" << fh
+ << "fallocate("
<<", FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE, "
<< off << ", " << len << ") returned errno: "
<< errno;
@@ -2509,17 +1915,17 @@ LinuxAIOHandler::collect()
/* We have not overstepped to next segment. */
ut_a(slot->pos < end_pos);
- /* We never compress/decompress the first page */
-
+ /* Deallocate unused blocks from file system.
+ This is newer done to page 0 or to log files.*/
if (slot->offset > 0
- && !slot->skip_punch_hole
- && slot->type.is_compression_enabled()
&& !slot->type.is_log()
&& slot->type.is_write()
- && slot->type.is_compressed()
&& slot->type.punch_hole()) {
- slot->err = AIOHandler::io_complete(slot);
+ slot->err = slot->type.punch_hole(
+ slot->file,
+ slot->offset,
+ static_cast<os_offset_t>(slot->len));
} else {
slot->err = DB_SUCCESS;
}
@@ -2688,16 +2094,7 @@ os_aio_linux_handler(
void** m2,
IORequest* request)
{
- LinuxAIOHandler handler(global_segment);
-
- dberr_t err = handler.poll(m1, m2, request);
-
- if (err == DB_IO_NO_PUNCH_HOLE) {
- fil_no_punch_hole(*m1);
- err = DB_SUCCESS;
- }
-
- return(err);
+ return LinuxAIOHandler(global_segment).poll(m1, m2, request);
}
/** Dispatch an AIO request to the kernel.
@@ -3393,43 +2790,15 @@ os_file_readdir_next_file(
int ret;
struct stat statinfo;
-#ifdef HAVE_READDIR_R
- char dirent_buf[sizeof(struct dirent)
- + _POSIX_PATH_MAX + 100];
- /* In /mysys/my_lib.c, _POSIX_PATH_MAX + 1 is used as
- the max file name len; but in most standards, the
- length is NAME_MAX; we add 100 to be even safer */
-#endif /* HAVE_READDIR_R */
-
next_file:
-#ifdef HAVE_READDIR_R
- ret = readdir_r(dir, (struct dirent*) dirent_buf, &ent);
-
- if (ret != 0) {
-
- ib::error()
- << "Cannot read directory " << dirname
- << " error: " << ret;
-
- return(-1);
- }
-
- if (ent == NULL) {
- /* End of directory */
-
- return(1);
- }
-
- ut_a(strlen(ent->d_name) < _POSIX_PATH_MAX + 100 - 1);
-#else
ent = readdir(dir);
if (ent == NULL) {
return(1);
}
-#endif /* HAVE_READDIR_R */
+
ut_a(strlen(ent->d_name) < OS_FILE_MAX_PATH);
if (strcmp(ent->d_name, ".") == 0 || strcmp(ent->d_name, "..") == 0) {
@@ -4173,10 +3542,21 @@ os_is_sparse_file_supported_win32(const char* filename)
DWORD flags;
- GetVolumeInformation(
+ result = GetVolumeInformation(
volname, NULL, MAX_PATH, NULL, NULL,
&flags, NULL, MAX_PATH);
+
+ if (!result) {
+ ib::error()
+ << "os_is_sparse_file_supported: "
+ << "Failed to get the volume info for: "
+ << volname
+ << "- OS error number " << GetLastError();
+
+ return(false);
+ }
+
return(flags & FILE_SUPPORTS_SPARSE_FILES) ? true : false;
}
@@ -4202,12 +3582,11 @@ os_file_punch_hole_win32(
/* If lpOverlapped is NULL, lpBytesReturned cannot be NULL,
therefore we pass a dummy parameter. */
DWORD temp;
-
- BOOL result = DeviceIoControl(
+ BOOL success = os_win32_device_io_control(
fh, FSCTL_SET_ZERO_DATA, &punch, sizeof(punch),
- NULL, 0, &temp, NULL);
+ NULL, 0, &temp);
- return(!result ? DB_IO_NO_PUNCH_HOLE : DB_SUCCESS);
+ return(success ? DB_SUCCESS: DB_IO_NO_PUNCH_HOLE);
}
/** Check the existence and type of the given file.
@@ -4518,9 +3897,9 @@ os_file_create_simple_func(
/* This is a best effort use case, if it fails then
we will find out when we try and punch the hole. */
- DeviceIoControl(
+ os_win32_device_io_control(
file, FSCTL_SET_SPARSE, NULL, 0, NULL, 0,
- &temp, NULL);
+ &temp);
}
} while (retry);
@@ -4877,9 +4256,9 @@ os_file_create_func(
/* This is a best effort use case, if it fails then
we will find out when we try and punch the hole. */
- DeviceIoControl(
+ os_win32_device_io_control(
file, FSCTL_SET_SPARSE, NULL, 0, NULL, 0,
- &temp, NULL);
+ &temp);
}
} while (retry);
@@ -5316,28 +4695,6 @@ os_file_get_status_win32(
}
stat_info->block_size = bytesPerSector * sectorsPerCluster;
-
- /* On Windows the block size is not used as the allocation
- unit for sparse files. The underlying infra-structure for
- sparse files is based on NTFS compression. The punch hole
- is done on a "compression unit". This compression unit
- is based on the cluster size. You cannot punch a hole if
- the cluster size >= 8K. For smaller sizes the table is
- as follows:
-
- Cluster Size Compression Unit
- 512 Bytes 8 KB
- 1 KB 16 KB
- 2 KB 32 KB
- 4 KB 64 KB
-
- Default NTFS cluster size is 4K, compression unit size of 64K.
- Therefore unless the user has created the file system with
- a smaller cluster size and used larger page sizes there is
- little benefit from compression out of the box. */
-
- stat_info->block_size = (stat_info->block_size <= 4096)
- ? stat_info->block_size * 16 : ULINT_UNDEFINED;
} else {
stat_info->type = OS_FILE_TYPE_UNKNOWN;
}
@@ -5434,30 +4791,6 @@ AIO::simulated_put_read_threads_to_sleep()
#endif /* !_WIN32*/
-#ifdef MYSQL_COMPRESSION
-/** Validate the type, offset and number of bytes to read *
-@param[in] type IO flags
-@param[in] offset Offset from start of the file
-@param[in] n Number of bytes to read from offset */
-static
-void
-os_file_check_args(const IORequest& type, os_offset_t offset, ulint n)
-{
- ut_ad(type.validate());
-
- ut_ad(n > 0);
-
- /* If off_t is > 4 bytes in size, then we assume we can pass a
- 64-bit address */
- off_t offs = static_cast<off_t>(offset);
-
- if (sizeof(off_t) <= 4 && offset != (os_offset_t) offs) {
-
- ib::error() << "file write at offset > 4 GB.";
- }
-}
-#endif /* MYSQL_COMPRESSION */
-
/** Does a syncronous read or write depending upon the type specified
In case of partial reads/writes the function tries
NUM_RETRIES_ON_PARTIAL_IO times to read/write the complete data.
@@ -5480,44 +4813,8 @@ os_file_io(
{
ulint original_n = n;
IORequest type = in_type;
- byte* compressed_page=NULL;
ssize_t bytes_returned = 0;
-#ifdef MYSQL_COMPRESSION
- Block* block=NULL;
- if (type.is_compressed()) {
-
- /* We don't compress the first page of any file. */
- ut_ad(offset > 0);
-
- block = os_file_compress_page(type, buf, &n);
-
- compressed_page = static_cast<byte*>(
- ut_align(block->m_ptr, UNIV_SECTOR_SIZE));
-
- } else {
- block = NULL;
- compressed_page = NULL;
- }
-#endif /* MYSQL_COMPRESSION */
-
-#ifdef MYSQL_ENCRYPTION
- /* We do encryption after compression, since if we do encryption
- before compression, the encrypted data will cause compression fail
- or low compression rate. */
- if (type.is_encrypted() && type.is_write()) {
- /* We don't encrypt the first page of any file. */
- Block* compressed_block = block;
- ut_ad(offset > 0);
-
- block = os_file_encrypt_page(type, buf, &n);
-
- if (compressed_block != NULL) {
- os_free_block(compressed_block);
- }
- }
-#endif /* MYSQL_ENCRYPTION */
-
SyncFileIO sync_file_io(file, buf, n, offset);
for (ulint i = 0; i < NUM_RETRIES_ON_PARTIAL_IO; ++i) {
@@ -5534,23 +4831,16 @@ os_file_io(
bytes_returned += n_bytes;
if (offset > 0
- && (type.is_compressed() || type.is_read())) {
-
- *err = os_file_io_complete(
- type, file,
- reinterpret_cast<byte*>(buf),
- compressed_page, original_n,
- static_cast<ulint>(offset), n);
+ && !type.is_log()
+ && type.is_write()
+ && type.punch_hole()) {
+ *err = type.punch_hole(file,
+ offset,
+ static_cast<os_offset_t>(n));
} else {
-
*err = DB_SUCCESS;
}
-#ifdef MYSQL_COMPRESSION
- if (block != NULL) {
- os_free_block(block);
- }
-#endif
return(original_n);
}
@@ -5578,12 +4868,6 @@ os_file_io(
sync_file_io.advance(n_bytes);
}
-#ifdef MYSQL_COMPRESSION
- if (block != NULL) {
- os_free_block(block);
- }
-#endif
-
*err = DB_IO_ERROR;
if (!type.is_partial_io_warning_disabled()) {
@@ -5621,7 +4905,8 @@ os_file_pwrite(
(void) my_atomic_addlint(&os_n_pending_writes, 1);
MONITOR_ATOMIC_INC(MONITOR_OS_PENDING_WRITES);
- ssize_t n_bytes = os_file_io(type, file, (void*) buf, n, offset, err);
+ ssize_t n_bytes = os_file_io(type, file, const_cast<byte*>(buf),
+ n, offset, err);
(void) my_atomic_addlint(&os_n_pending_writes, -1);
MONITOR_ATOMIC_DEC(MONITOR_OS_PENDING_WRITES);
@@ -5642,16 +4927,17 @@ os_file_write_page(
IORequest& type,
const char* name,
os_file_t file,
- const byte* buf,
+ const void* buf,
os_offset_t offset,
ulint n)
{
dberr_t err;
+ ut_ad(type.is_write());
ut_ad(type.validate());
ut_ad(n > 0);
-
- ssize_t n_bytes = os_file_pwrite(type, file, buf, n, offset, &err);
+
+ ssize_t n_bytes = os_file_pwrite(type, file, (byte*)buf, n, offset, &err);
if ((ulint) n_bytes != n && !os_has_said_disk_full) {
@@ -5754,23 +5040,7 @@ os_file_read_page(
return(err);
} else if ((ulint) n_bytes == n) {
-
-#ifdef MYSQL_COMPRESSION
- /** The read will succeed but decompress can fail
- for various reasons. */
-
- if (type.is_compression_enabled()
- && !Compression::is_compressed_page(
- static_cast<byte*>(buf))) {
-
- return(DB_SUCCESS);
-
- } else {
- return(err);
- }
-#else
return(DB_SUCCESS);
-#endif /* MYSQL_COMPRESSION */
}
ib::error() << "Tried to read " << n
@@ -6171,12 +5441,6 @@ os_file_write_func(
ut_ad(type.validate());
ut_ad(type.is_write());
- /* We never compress the first page.
- Note: This assumes we always do block IO. */
- if (offset == 0) {
- type.clear_compressed();
- }
-
const byte* ptr = reinterpret_cast<const byte*>(buf);
return(os_file_write_page(type, name, file, ptr, offset, n));
@@ -6211,6 +5475,28 @@ os_file_punch_hole(
os_offset_t off,
os_offset_t len)
{
+ dberr_t err;
+
+#ifdef _WIN32
+ err = os_file_punch_hole_win32(fh, off, len);
+#else
+ err = os_file_punch_hole_posix(fh, off, len);
+#endif /* _WIN32 */
+
+ return (err);
+}
+
+/** Free storage space associated with a section of the file.
+@param[in] fh Open file handle
+@param[in] off Starting offset (SEEK_SET)
+@param[in] len Size of the hole
+@return DB_SUCCESS or error code */
+dberr_t
+IORequest::punch_hole(
+ os_file_t fh,
+ os_offset_t off,
+ os_offset_t len)
+{
/* In this debugging mode, we act as if punch hole is supported,
and then skip any calls to actually punch a hole here.
In this way, Transparent Page Compression is still being tested. */
@@ -6218,11 +5504,34 @@ os_file_punch_hole(
return(DB_SUCCESS);
);
-#ifdef _WIN32
- return(os_file_punch_hole_win32(fh, off, len));
-#else
- return(os_file_punch_hole_posix(fh, off, len));
-#endif /* _WIN32 */
+ os_offset_t trim_len = static_cast<os_offset_t>(get_trim_length(len));
+
+ if (trim_len == 0) {
+ return(DB_SUCCESS);
+ }
+
+ off += len;
+
+ /* Check does file system support punching holes for this
+ tablespace. */
+ if (!should_punch_hole() || !srv_use_trim) {
+ return DB_IO_NO_PUNCH_HOLE;
+ }
+
+ dberr_t err = os_file_punch_hole(fh, off, trim_len);
+
+ if (err == DB_SUCCESS) {
+ srv_stats.page_compressed_trim_op.inc();
+ } else {
+ /* If punch hole is not supported,
+ set space so that it is not used. */
+ if (err == DB_IO_NO_PUNCH_HOLE) {
+ space_no_punch_hole();
+ err = DB_SUCCESS;
+ }
+ }
+
+ return (err);
}
/** Check if the file system supports sparse files.
@@ -6253,7 +5562,7 @@ os_is_sparse_file_supported(const char* path, os_file_t fh)
/* We don't know the FS block size, use the sector size. The FS
will do the magic. */
- err = os_file_punch_hole(fh, 0, UNIV_PAGE_SIZE);
+ err = os_file_punch_hole_posix(fh, 0, UNIV_PAGE_SIZE);
return(err == DB_SUCCESS);
#endif /* _WIN32 */
@@ -6413,16 +5722,6 @@ AIO::init_slots()
memset(&slot.control, 0x0, sizeof(slot.control));
#endif /* WIN_ASYNC_IO */
-
- slot.compressed_ptr = reinterpret_cast<byte*>(
- ut_zalloc_nokey(UNIV_PAGE_SIZE_MAX * 2));
-
- if (slot.compressed_ptr == NULL) {
- return(DB_OUT_OF_MEMORY);
- }
-
- slot.compressed_page = static_cast<byte *>(
- ut_align(slot.compressed_ptr, UNIV_PAGE_SIZE));
}
return(DB_SUCCESS);
@@ -6549,16 +5848,6 @@ AIO::~AIO()
}
#endif /* LINUX_NATIVE_AIO */
- for (ulint i = 0; i < m_slots.size(); ++i) {
- Slot& slot = m_slots[i];
-
- if (slot.compressed_ptr != NULL) {
- ut_free(slot.compressed_ptr);
- slot.compressed_ptr = NULL;
- slot.compressed_page = NULL;
- }
- }
-
m_slots.clear();
}
@@ -6720,27 +6009,6 @@ os_aio_init(
/* Maximum number of pending aio operations allowed per segment */
ulint limit = 8 * OS_AIO_N_PENDING_IOS_PER_THREAD;
-
- ut_a(block_cache == NULL);
-
- block_cache = UT_NEW_NOKEY(Blocks(MAX_BLOCKS));
-
- for (Blocks::iterator it = block_cache->begin();
- it != block_cache->end();
- ++it) {
-
- ut_a(it->m_in_use == 0);
- ut_a(it->m_ptr == NULL);
-
- /* Allocate double of max page size memory, since
- compress could generate more bytes than orgininal
- data. */
- it->m_ptr = static_cast<byte*>(
- ut_malloc_nokey(BUFFER_BLOCK_SIZE));
-
- ut_a(it->m_ptr != NULL);
- }
-
return(AIO::start(limit, n_readers, n_writers, n_slots_sync));
}
@@ -6757,18 +6025,6 @@ os_aio_free()
ut_free(os_aio_segment_wait_events);
os_aio_segment_wait_events = 0;
os_aio_n_segments = 0;
-
- for (Blocks::iterator it = block_cache->begin();
- it != block_cache->end();
- ++it) {
-
- ut_a(it->m_in_use == 0);
- ut_free(it->m_ptr);
- }
-
- UT_DELETE(block_cache);
-
- block_cache = NULL;
}
/** Wakes up all async i/o threads so that they know to exit themselves in
@@ -6875,12 +6131,7 @@ AIO::reserve_slot(
const char* name,
void* buf,
os_offset_t offset,
- ulint len,
- ulint* write_size)/*!< in/out: Actual write size initialized
- after fist successfull trim
- operation for this page and if
- initialized we do not trim again if
- actual page size does not decrease. */
+ ulint len)
{
#ifdef WIN_ASYNC_IO
ut_a((len & 0xFFFFFFFFUL) == len);
@@ -6970,83 +6221,10 @@ AIO::reserve_slot(
slot->ptr = slot->buf;
slot->offset = offset;
slot->err = DB_SUCCESS;
- slot->write_size = write_size;
- slot->is_log = type.is_log();
slot->original_len = static_cast<uint32>(len);
slot->io_already_done = false;
- slot->buf_block = NULL;
slot->buf = static_cast<byte*>(buf);
-#ifdef MYSQL_COMPRESSION
- if (srv_use_native_aio
- && offset > 0
- && type.is_write()
- && type.is_compressed()) {
- ulint compressed_len = len;
-
- ut_ad(!type.is_log());
-
- release();
-
- void* src_buf = slot->buf;
-
- slot->buf_block = os_file_compress_page(
- type,
- src_buf,
- &compressed_len);
-
- slot->buf = static_cast<byte*>(src_buf);
- slot->ptr = slot->buf;
-#ifdef _WIN32
- slot->len = static_cast<DWORD>(compressed_len);
-#else
- slot->len = static_cast<ulint>(compressed_len);
-#endif /* _WIN32 */
- slot->skip_punch_hole = type.punch_hole();
-
- acquire();
- }
-#endif /* MYSQL_COMPRESSION */
-
-#ifdef MYSQL_ENCRYPTION
- /* We do encryption after compression, since if we do encryption
- before compression, the encrypted data will cause compression fail
- or low compression rate. */
- if (srv_use_native_aio
- && offset > 0
- && type.is_write()
- && type.is_encrypted()) {
- ulint encrypted_len = slot->len;
- Block* encrypted_block;
-
- ut_ad(!type.is_log());
-
- release();
-
- void* src_buf = slot->buf;
- encrypted_block = os_file_encrypt_page(
- type,
- src_buf,
- &encrypted_len);
-
- if (slot->buf_block != NULL) {
- os_free_block(slot->buf_block);
- }
-
- slot->buf_block = encrypted_block;
- slot->buf = static_cast<byte*>(src_buf);
- slot->ptr = slot->buf;
-
-#ifdef _WIN32
- slot->len = static_cast<DWORD>(encrypted_len);
-#else
- slot->len = static_cast<ulint>(encrypted_len);
-#endif /* _WIN32 */
-
- acquire();
- }
-#endif /* MYSQL_ENCRYPTION */
-
#ifdef WIN_ASYNC_IO
{
OVERLAPPED* control;
@@ -7395,6 +6573,7 @@ Requests an asynchronous i/o operation.
@param[in,out] m2 message for the AIO handler (can be used to
identify a completed AIO operation); ignored
if mode is OS_AIO_SYNC
+
@return DB_SUCCESS or error code */
dberr_t
os_aio_func(
@@ -7407,12 +6586,7 @@ os_aio_func(
ulint n,
bool read_only,
fil_node_t* m1,
- void* m2,
- ulint* write_size)/*!< in/out: Actual write size initialized
- after fist successfull trim
- operation for this page and if
- initialized we do not trim again if
- actual page size does not decrease. */
+ void* m2)
{
#ifdef WIN_ASYNC_IO
BOOL ret = TRUE;
@@ -7448,7 +6622,7 @@ try_again:
Slot* slot;
- slot = array->reserve_slot(type, m1, m2, file, name, buf, offset, n, write_size);
+ slot = array->reserve_slot(type, m1, m2, file, name, buf, offset, n);
if (type.is_read()) {
@@ -7713,13 +6887,6 @@ public:
}
}
- /** Do the decompression of the pages read in */
- void io_complete()
- {
- // Note: For non-compressed tables. Not required
- // for correctness.
- }
-
/** Mark the i/os done in slots */
void done()
{
@@ -7773,7 +6940,7 @@ private:
slot->offset,
slot->len);
- ut_a(err == DB_SUCCESS || err == DB_IO_NO_PUNCH_HOLE);
+ ut_a(err == DB_SUCCESS);
}
/** @return true if the slots are adjacent and can be merged */
@@ -8064,8 +7231,6 @@ os_aio_simulated_handler(
srv_set_io_thread_op_info(global_segment, "file i/o done");
- handler.io_complete();
-
array->acquire();
handler.done();
@@ -8403,920 +7568,9 @@ os_file_set_umask(ulint umask)
}
#else
-
#include "univ.i"
-#include "db0err.h"
-#include "mach0data.h"
-#include "fil0fil.h"
-#include "os0file.h"
-
-#ifdef HAVE_LZ4
-#include <lz4.h>
-#endif
-
-#include <zlib.h>
-#ifndef UNIV_INNOCHECKSUM
-#include <my_aes.h>
-#include <my_rnd.h>
-#include <mysqld.h>
-#include <mysql/service_mysql_keyring.h>
-#endif
-
-typedef byte Block;
-
-#ifdef MYSQL_COMPRESSION
-/** Allocate a page for sync IO
-@return pointer to page */
-static
-Block*
-os_alloc_block()
-{
- return(reinterpret_cast<byte*>(malloc(UNIV_PAGE_SIZE_MAX * 2)));
-}
-
-/** Free a page after sync IO
-@param[in,own] block The block to free/release */
-static
-void
-os_free_block(Block* block)
-{
- ut_free(block);
-}
-#endif
-#endif /* !UNIV_INNOCHECKSUM */
-
-#ifdef MYSQL_COMPRESSION
-
-/**
-@param[in] type The compression type
-@return the string representation */
-const char*
-Compression::to_string(Type type)
-{
- switch(type) {
- case NONE:
- return("None");
- case ZLIB:
- return("Zlib");
- case LZ4:
- return("LZ4");
- }
-
- ut_ad(0);
-
- return("<UNKNOWN>");
-}
-
-/**
-@param[in] meta Page Meta data
-@return the string representation */
-std::string Compression::to_string(const Compression::meta_t& meta)
-{
- std::ostringstream stream;
-
- stream << "version: " << int(meta.m_version) << " "
- << "algorithm: " << meta.m_algorithm << " "
- << "(" << to_string(meta.m_algorithm) << ") "
- << "orginal_type: " << meta.m_original_type << " "
- << "original_size: " << meta.m_original_size << " "
- << "compressed_size: " << meta.m_compressed_size;
-
- return(stream.str());
-}
-
-/** @return true if it is a compressed page */
-bool
-Compression::is_compressed_page(const byte* page)
-{
- return(mach_read_from_2(page + FIL_PAGE_TYPE) == FIL_PAGE_COMPRESSED);
-}
-
-/** Deserizlise the page header compression meta-data
-@param[in] page Pointer to the page header
-@param[out] control Deserialised data */
-void
-Compression::deserialize_header(
- const byte* page,
- Compression::meta_t* control)
-{
- ut_ad(is_compressed_page(page));
-
- control->m_version = static_cast<uint8_t>(
- mach_read_from_1(page + FIL_PAGE_VERSION));
-
- control->m_original_type = static_cast<uint16_t>(
- mach_read_from_2(page + FIL_PAGE_ORIGINAL_TYPE_V1));
-
- control->m_compressed_size = static_cast<uint16_t>(
- mach_read_from_2(page + FIL_PAGE_COMPRESS_SIZE_V1));
-
- control->m_original_size = static_cast<uint16_t>(
- mach_read_from_2(page + FIL_PAGE_ORIGINAL_SIZE_V1));
-
- control->m_algorithm = static_cast<Type>(
- mach_read_from_1(page + FIL_PAGE_ALGORITHM_V1));
-}
-
-/** Decompress the page data contents. Page type must be FIL_PAGE_COMPRESSED, if
-not then the source contents are left unchanged and DB_SUCCESS is returned.
-@param[in] dblwr_recover true of double write recovery in progress
-@param[in,out] src Data read from disk, decompressed data will be
- copied to this page
-@param[in,out] dst Scratch area to use for decompression
-@param[in] dst_len Size of the scratch area in bytes
-@return DB_SUCCESS or error code */
-dberr_t
-Compression::deserialize(
- bool dblwr_recover,
- byte* src,
- byte* dst,
- ulint dst_len)
-{
- if (!is_compressed_page(src)) {
- /* There is nothing we can do. */
- return(DB_SUCCESS);
- }
-
- meta_t header;
-
- deserialize_header(src, &header);
-
- byte* ptr = src + FIL_PAGE_DATA;
-
- ut_ad(header.m_version == 1);
-
- if (header.m_version != 1
- || header.m_original_size < UNIV_PAGE_SIZE_MIN - (FIL_PAGE_DATA + 8)
- || header.m_original_size > UNIV_PAGE_SIZE_MAX - FIL_PAGE_DATA
- || dst_len < header.m_original_size + FIL_PAGE_DATA) {
-
- /* The last check could potentially return DB_OVERFLOW,
- the caller should be able to retry with a larger buffer. */
-
- return(DB_CORRUPTION);
- }
-
- Block* block;
-
- /* The caller doesn't know what to expect */
- if (dst == NULL) {
-
- block = os_alloc_block();
-
-#ifdef UNIV_INNOCHECKSUM
- dst = block;
-#else
- dst = block->m_ptr;
-#endif /* UNIV_INNOCHECKSUM */
-
- } else {
- block = NULL;
- }
-
- int ret;
- Compression compression;
- ulint len = header.m_original_size;
-
- compression.m_type = static_cast<Compression::Type>(header.m_algorithm);
-
- switch(compression.m_type) {
- case Compression::ZLIB: {
-
- uLongf zlen = header.m_original_size;
-
- if (uncompress(dst, &zlen, ptr, header.m_compressed_size)
- != Z_OK) {
-
- if (block != NULL) {
- os_free_block(block);
- }
-
- return(DB_IO_DECOMPRESS_FAIL);
- }
-
- len = static_cast<ulint>(zlen);
-
- break;
- }
-#ifdef HAVE_LZ4
- case Compression::LZ4: {
- int ret;
-
- if (dblwr_recover) {
-
- ret = LZ4_decompress_safe(
- reinterpret_cast<char*>(ptr),
- reinterpret_cast<char*>(dst),
- header.m_compressed_size,
- header.m_original_size);
-
- } else {
-
- /* This can potentially read beyond the input
- buffer if the data is malformed. According to
- the LZ4 documentation it is a little faster
- than the above function. When recovering from
- the double write buffer we can afford to us the
- slower function above. */
-
- ret = LZ4_decompress_fast(
- reinterpret_cast<char*>(ptr),
- reinterpret_cast<char*>(dst),
- header.m_original_size);
- }
-
- if (ret < 0) {
-
- if (block != NULL) {
- os_free_block(block);
- }
-
- return(DB_IO_DECOMPRESS_FAIL);
- }
-
- break;
- }
-#endif
- default:
-#if !defined(UNIV_INNOCHECKSUM)
- ib::error()
- << "Compression algorithm support missing: "
- << Compression::to_string(compression.m_type);
-#else
- fprintf(stderr, "Compression algorithm support missing: %s\n",
- Compression::to_string(compression.m_type));
#endif /* !UNIV_INNOCHECKSUM */
- if (block != NULL) {
- os_free_block(block);
- }
-
- return(DB_UNSUPPORTED);
- }
- /* Leave the header alone */
- memmove(src + FIL_PAGE_DATA, dst, len);
-
- mach_write_to_2(src + FIL_PAGE_TYPE, header.m_original_type);
-
- ut_ad(dblwr_recover
- || memcmp(src + FIL_PAGE_LSN + 4,
- src + (header.m_original_size + FIL_PAGE_DATA)
- - FIL_PAGE_END_LSN_OLD_CHKSUM + 4, 4) == 0);
-
- if (block != NULL) {
- os_free_block(block);
- }
-
- return(DB_SUCCESS);
-}
-
-/** Decompress the page data contents. Page type must be FIL_PAGE_COMPRESSED, if
-not then the source contents are left unchanged and DB_SUCCESS is returned.
-@param[in] dblwr_recover true of double write recovery in progress
-@param[in,out] src Data read from disk, decompressed data will be
- copied to this page
-@param[in,out] dst Scratch area to use for decompression
-@param[in] dst_len Size of the scratch area in bytes
-@return DB_SUCCESS or error code */
-dberr_t
-os_file_decompress_page(
- bool dblwr_recover,
- byte* src,
- byte* dst,
- ulint dst_len)
-{
- return(Compression::deserialize(dblwr_recover, src, dst, dst_len));
-}
-#endif /* MYSQL_COMPRESSION */
-
-#ifdef MYSQL_ENCRYPTION
-
-/**
-@param[in] type The encryption type
-@return the string representation */
-const char*
-Encryption::to_string(Type type)
-{
- switch(type) {
- case NONE:
- return("N");
- case AES:
- return("Y");
- }
-
- ut_ad(0);
-
- return("<UNKNOWN>");
-}
-
-/** Generate random encryption value for key and iv.
-@param[in,out] value Encryption value */
-void Encryption::random_value(byte* value)
-{
- ut_ad(value != NULL);
-
- my_rand_buffer(value, ENCRYPTION_KEY_LEN);
-}
-
-/** Create new master key for key rotation.
-@param[in,out] master_key master key */
-void
-Encryption::create_master_key(byte** master_key)
-{
-#ifndef UNIV_INNOCHECKSUM
- char* key_type = NULL;
- size_t key_len;
- char key_name[ENCRYPTION_MASTER_KEY_NAME_MAX_LEN];
- int ret;
-
- /* If uuid does not match with current server uuid,
- set uuid as current server uuid. */
- if (strcmp(uuid, server_uuid) != 0) {
- memcpy(uuid, server_uuid, ENCRYPTION_SERVER_UUID_LEN);
- }
- memset(key_name, 0, ENCRYPTION_MASTER_KEY_NAME_MAX_LEN);
-
- /* Generate new master key */
- ut_snprintf(key_name, ENCRYPTION_MASTER_KEY_NAME_MAX_LEN,
- "%s-%s-%lu", ENCRYPTION_MASTER_KEY_PRIFIX,
- uuid, master_key_id + 1);
-
- /* We call key ring API to generate master key here. */
- ret = my_key_generate(key_name, "AES",
- NULL, ENCRYPTION_KEY_LEN);
-
- /* We call key ring API to get master key here. */
- ret = my_key_fetch(key_name, &key_type, NULL,
- reinterpret_cast<void**>(master_key),
- &key_len);
-
- if (ret || *master_key == NULL) {
- ib::error() << "Encryption can't find master key, please check"
- " the keyring plugin is loaded.";
- *master_key = NULL;
- } else {
- master_key_id++;
- }
-
- if (key_type) {
- my_free(key_type);
- }
-#endif
-}
-
-/** Get master key by key id.
-@param[in] master_key_id master key id
-@param[in] srv_uuid uuid of server instance
-@param[in,out] master_key master key */
-void
-Encryption::get_master_key(ulint master_key_id,
- char* srv_uuid,
- byte** master_key)
-{
-#ifndef UNIV_INNOCHECKSUM
- char* key_type = NULL;
- size_t key_len;
- char key_name[ENCRYPTION_MASTER_KEY_NAME_MAX_LEN];
- int ret;
-
- memset(key_name, 0, ENCRYPTION_MASTER_KEY_NAME_MAX_LEN);
-
- if (srv_uuid != NULL) {
- ut_snprintf(key_name, ENCRYPTION_MASTER_KEY_NAME_MAX_LEN,
- "%s-%s-%lu", ENCRYPTION_MASTER_KEY_PRIFIX,
- srv_uuid, master_key_id);
- } else {
- /* For compitable with 5.7.11, we need to get master key with
- server id. */
- memset(key_name, 0, ENCRYPTION_MASTER_KEY_NAME_MAX_LEN);
- ut_snprintf(key_name, ENCRYPTION_MASTER_KEY_NAME_MAX_LEN,
- "%s-%lu-%lu", ENCRYPTION_MASTER_KEY_PRIFIX,
- server_id, master_key_id);
- }
-
- /* We call key ring API to get master key here. */
- ret = my_key_fetch(key_name, &key_type, NULL,
- reinterpret_cast<void**>(master_key), &key_len);
-
- if (key_type) {
- my_free(key_type);
- }
-
- if (ret) {
- *master_key = NULL;
- ib::error() << "Encryption can't find master key, please check"
- " the keyring plugin is loaded.";
- }
-
-#ifdef UNIV_ENCRYPT_DEBUG
- if (!ret && *master_key) {
- fprintf(stderr, "Fetched master key:%lu ", master_key_id);
- ut_print_buf(stderr, *master_key, key_len);
- fprintf(stderr, "\n");
- }
-#endif /* DEBUG_TDE */
-
-#endif
-}
-
-/** Current master key id */
-ulint Encryption::master_key_id = 0;
-
-/** Current uuid of server instance */
-char Encryption::uuid[ENCRYPTION_SERVER_UUID_LEN + 1] = {0};
-
-/** Get current master key and master key id
-@param[in,out] master_key_id master key id
-@param[in,out] master_key master key
-@param[in,out] version encryption information version */
-void
-Encryption::get_master_key(ulint* master_key_id,
- byte** master_key,
- Encryption::Version* version)
-{
-#ifndef UNIV_INNOCHECKSUM
- char* key_type = NULL;
- size_t key_len;
- char key_name[ENCRYPTION_MASTER_KEY_NAME_MAX_LEN];
- int ret;
-
- memset(key_name, 0, ENCRYPTION_KEY_LEN);
- *version = Encryption::ENCRYPTION_VERSION_2;
-
- if (Encryption::master_key_id == 0) {
- /* If m_master_key is 0, means there's no encrypted
- tablespace, we need to generate the first master key,
- and store it to key ring. */
- memset(uuid, 0, ENCRYPTION_SERVER_UUID_LEN + 1);
- memcpy(uuid, server_uuid, ENCRYPTION_SERVER_UUID_LEN);
-
- /* Prepare the server uuid. */
- ut_snprintf(key_name, ENCRYPTION_MASTER_KEY_NAME_MAX_LEN,
- "%s-%s-1", ENCRYPTION_MASTER_KEY_PRIFIX,
- uuid);
-
- /* We call key ring API to generate master key here. */
- ret = my_key_generate(key_name, "AES",
- NULL, ENCRYPTION_KEY_LEN);
-
- /* We call key ring API to get master key here. */
- ret = my_key_fetch(key_name, &key_type, NULL,
- reinterpret_cast<void**>(master_key),
- &key_len);
-
- if (!ret && *master_key != NULL) {
- Encryption::master_key_id++;
- *master_key_id = Encryption::master_key_id;
- }
-#ifdef UNIV_ENCRYPT_DEBUG
- if (!ret && *master_key) {
- fprintf(stderr, "Generated new master key:");
- ut_print_buf(stderr, *master_key, key_len);
- fprintf(stderr, "\n");
- }
-#endif
- } else {
- *master_key_id = Encryption::master_key_id;
-
- ut_snprintf(key_name, ENCRYPTION_MASTER_KEY_NAME_MAX_LEN,
- "%s-%s-%lu", ENCRYPTION_MASTER_KEY_PRIFIX,
- uuid, *master_key_id);
-
- /* We call key ring API to get master key here. */
- ret = my_key_fetch(key_name, &key_type, NULL,
- reinterpret_cast<void**>(master_key),
- &key_len);
-
- /* For compitable with 5.7.11, we need to try to get master key with
- server id when get master key with server uuid failure. */
- if (ret || *master_key == NULL) {
- if (key_type) {
- my_free(key_type);
- }
-
- memset(key_name, 0,
- ENCRYPTION_MASTER_KEY_NAME_MAX_LEN);
- ut_snprintf(key_name, ENCRYPTION_MASTER_KEY_NAME_MAX_LEN,
- "%s-%lu-%lu", ENCRYPTION_MASTER_KEY_PRIFIX,
- server_id, *master_key_id);
-
- ret = my_key_fetch(key_name, &key_type, NULL,
- reinterpret_cast<void**>(master_key),
- &key_len);
- *version = Encryption::ENCRYPTION_VERSION_1;
- }
-#ifdef UNIV_ENCRYPT_DEBUG
- if (!ret && *master_key) {
- fprintf(stderr, "Fetched master key:%lu ",
- *master_key_id);
- ut_print_buf(stderr, *master_key, key_len);
- fprintf(stderr, "\n");
- }
-#endif
- }
-
- if (ret) {
- *master_key = NULL;
- ib::error() << "Encryption can't find master key, please check"
- " the keyring plugin is loaded.";
- }
-
- if (key_type) {
- my_free(key_type);
- }
-#endif
-}
-
-/** Check if page is encrypted page or not
-@param[in] page page which need to check
-@return true if it is a encrypted page */
-bool
-Encryption::is_encrypted_page(const byte* page)
-{
- ulint page_type = mach_read_from_2(page + FIL_PAGE_TYPE);
-
- return(page_type == FIL_PAGE_ENCRYPTED
- || page_type == FIL_PAGE_COMPRESSED_AND_ENCRYPTED
- || page_type == FIL_PAGE_ENCRYPTED_RTREE);
-}
-
-/** Encrypt the page data contents. Page type can't be
-FIL_PAGE_ENCRYPTED, FIL_PAGE_COMPRESSED_AND_ENCRYPTED,
-FIL_PAGE_ENCRYPTED_RTREE.
-@param[in] type IORequest
-@param[in,out] src page data which need to encrypt
-@param[in] src_len Size of the source in bytes
-@param[in,out] dst destination area
-@param[in,out] dst_len Size of the destination in bytes
-@return buffer data, dst_len will have the length of the data */
-byte*
-Encryption::encrypt(
- const IORequest& type,
- byte* src,
- ulint src_len,
- byte* dst,
- ulint* dst_len)
-{
- ulint len = 0;
- ulint page_type = mach_read_from_2(src + FIL_PAGE_TYPE);
- ulint data_len;
- ulint main_len;
- ulint remain_len;
- byte remain_buf[MY_AES_BLOCK_SIZE * 2];
-
-#ifdef UNIV_ENCRYPT_DEBUG
- ulint space_id =
- mach_read_from_4(src + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID);
- ulint page_no = mach_read_from_4(src + FIL_PAGE_OFFSET);
-
- fprintf(stderr, "Encrypting page:%lu.%lu len:%lu\n",
- space_id, page_no, src_len);
-#endif
-
- /* Shouldn't encrypte an already encrypted page. */
- ut_ad(page_type != FIL_PAGE_ENCRYPTED
- && page_type != FIL_PAGE_COMPRESSED_AND_ENCRYPTED
- && page_type != FIL_PAGE_ENCRYPTED_RTREE);
-
- ut_ad(m_type != Encryption::NONE);
-
- /* This is data size which need to encrypt. */
- data_len = src_len - FIL_PAGE_DATA;
- main_len = (data_len / MY_AES_BLOCK_SIZE) * MY_AES_BLOCK_SIZE;
- remain_len = data_len - main_len;
-
- /* Only encrypt the data + trailer, leave the header alone */
-
- switch (m_type) {
- case Encryption::NONE:
- ut_error;
-
- case Encryption::AES: {
- lint elen;
-
- ut_ad(m_klen == ENCRYPTION_KEY_LEN);
-
- elen = my_aes_encrypt(
- src + FIL_PAGE_DATA,
- static_cast<uint32>(main_len),
- dst + FIL_PAGE_DATA,
- reinterpret_cast<unsigned char*>(m_key),
- static_cast<uint32>(m_klen),
- my_aes_256_cbc,
- reinterpret_cast<unsigned char*>(m_iv),
- false);
-
- if (elen == MY_AES_BAD_DATA) {
- ulint page_no =mach_read_from_4(
- src + FIL_PAGE_OFFSET);
- ulint space_id = mach_read_from_4(
- src + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID);
- *dst_len = src_len;
-#ifndef UNIV_INNOCHECKSUM
- ib::warn()
- << " Can't encrypt data of page,"
- << " page no:" << page_no
- << " space id:" << space_id;
-#else
- fprintf(stderr, " Can't encrypt data of page,"
- " page no:" ULINTPF
- " space id:" ULINTPF,
- page_no, space_id);
-#endif /* !UNIV_INNOCHECKSUM */
- return(src);
- }
-
- len = static_cast<ulint>(elen);
- ut_ad(len == main_len);
-
- /* Copy remain bytes and page tailer. */
- memcpy(dst + FIL_PAGE_DATA + len,
- src + FIL_PAGE_DATA + len,
- src_len - FIL_PAGE_DATA - len);
-
- /* Encrypt the remain bytes. */
- if (remain_len != 0) {
- remain_len = MY_AES_BLOCK_SIZE * 2;
-
- elen = my_aes_encrypt(
- dst + FIL_PAGE_DATA + data_len - remain_len,
- static_cast<uint32>(remain_len),
- remain_buf,
- reinterpret_cast<unsigned char*>(m_key),
- static_cast<uint32>(m_klen),
- my_aes_256_cbc,
- reinterpret_cast<unsigned char*>(m_iv),
- false);
-
- if (elen == MY_AES_BAD_DATA) {
- ulint page_no =mach_read_from_4(
- src + FIL_PAGE_OFFSET);
- ulint space_id = mach_read_from_4(
- src + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID);
-#ifndef UNIV_INNOCHECKSUM
- ib::warn()
- << " Can't encrypt data of page,"
- << " page no:" << page_no
- << " space id:" << space_id;
-#else
- fprintf(stderr, " Can't encrypt data of page,"
- " page no:" ULINTPF
- " space id:" ULINTPF,
- page_no, space_id);
-#endif /* !UNIV_INNOCHECKSUM */
- *dst_len = src_len;
- return(src);
- }
-
- memcpy(dst + FIL_PAGE_DATA + data_len - remain_len,
- remain_buf, remain_len);
- }
-
-
- break;
- }
-
- default:
- ut_error;
- }
-
- /* Copy the header as is. */
- memmove(dst, src, FIL_PAGE_DATA);
- ut_ad(memcmp(src, dst, FIL_PAGE_DATA) == 0);
-
- /* Add encryption control information. Required for decrypting. */
- if (page_type == FIL_PAGE_COMPRESSED) {
- /* If the page is compressed, we don't need to save the
- original type, since it is done in compression already. */
- mach_write_to_2(dst + FIL_PAGE_TYPE,
- FIL_PAGE_COMPRESSED_AND_ENCRYPTED);
- ut_ad(memcmp(src+FIL_PAGE_TYPE+2,
- dst+FIL_PAGE_TYPE+2,
- FIL_PAGE_DATA-FIL_PAGE_TYPE-2) == 0);
- } else if (page_type == FIL_PAGE_RTREE) {
- /* If the page is R-tree page, we need to save original
- type. */
- mach_write_to_2(dst + FIL_PAGE_TYPE, FIL_PAGE_ENCRYPTED_RTREE);
- } else{
- mach_write_to_2(dst + FIL_PAGE_TYPE, FIL_PAGE_ENCRYPTED);
- mach_write_to_2(dst + FIL_PAGE_ORIGINAL_TYPE_V1, page_type);
- }
-
-#ifdef UNIV_ENCRYPT_DEBUG
-#ifndef UNIV_INNOCHECKSUM
-#if 0
- byte* check_buf = static_cast<byte*>(ut_malloc_nokey(src_len));
- byte* buf2 = static_cast<byte*>(ut_malloc_nokey(src_len));
-
- memcpy(check_buf, dst, src_len);
-
- dberr_t err = decrypt(type, check_buf, src_len, buf2, src_len);
- if (err != DB_SUCCESS || memcmp(src + FIL_PAGE_DATA,
- check_buf + FIL_PAGE_DATA,
- src_len - FIL_PAGE_DATA) != 0) {
- ut_print_buf(stderr, src, src_len);
- ut_print_buf(stderr, check_buf, src_len);
- ut_ad(0);
- }
- ut_free(buf2);
- ut_free(check_buf);
-#endif
- fprintf(stderr, "Encrypted page:%lu.%lu\n", space_id, page_no);
-#endif
-#endif
- *dst_len = src_len;
-
-
- return(dst);
-}
-
-/** Decrypt the page data contents. Page type must be FIL_PAGE_ENCRYPTED,
-if not then the source contents are left unchanged and DB_SUCCESS is returned.
-@param[in] type IORequest
-@param[in,out] src Data read from disk, decrypted data will be
- copied to this page
-@param[in] src_len source data length
-@param[in,out] dst Scratch area to use for decryption
-@param[in] dst_len Size of the scratch area in bytes
-@return DB_SUCCESS or error code */
-dberr_t
-Encryption::decrypt(
- const IORequest& type,
- byte* src,
- ulint src_len,
- byte* dst,
- ulint dst_len)
-{
- ulint data_len;
- ulint main_len;
- ulint remain_len;
- ulint original_type;
- ulint page_type;
- byte remain_buf[MY_AES_BLOCK_SIZE * 2];
- Block* block;
-
- /* Do nothing if it's not an encrypted table. */
- if (!is_encrypted_page(src)) {
- return(DB_SUCCESS);
- }
-
- /* For compressed page, we need to get the compressed size
- for decryption */
- page_type = mach_read_from_2(src + FIL_PAGE_TYPE);
- if (page_type == FIL_PAGE_COMPRESSED_AND_ENCRYPTED) {
- src_len = static_cast<uint16_t>(
- mach_read_from_2(src + FIL_PAGE_COMPRESS_SIZE_V1))
- + FIL_PAGE_DATA;
-#ifndef UNIV_INNOCHECKSUM
- src_len = ut_calc_align(src_len, type.block_size());
-#endif
- }
-#ifdef UNIV_ENCRYPT_DEBUG
- ulint space_id =
- mach_read_from_4(src + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID);
- ulint page_no = mach_read_from_4(src + FIL_PAGE_OFFSET);
-
- fprintf(stderr, "Decrypting page:%lu.%lu len:%lu\n",
- space_id, page_no, src_len);
-#endif
-
- original_type = static_cast<uint16_t>(
- mach_read_from_2(src + FIL_PAGE_ORIGINAL_TYPE_V1));
-
- byte* ptr = src + FIL_PAGE_DATA;
-
- /* The caller doesn't know what to expect */
- if (dst == NULL) {
-
- block = os_alloc_block();
-#ifdef UNIV_INNOCHECKSUM
- dst = block;
-#else
- dst = block->m_ptr;
-#endif /* UNIV_INNOCHECKSUM */
-
- } else {
- block = NULL;
- }
-
- data_len = src_len - FIL_PAGE_DATA;
- main_len = (data_len / MY_AES_BLOCK_SIZE) * MY_AES_BLOCK_SIZE;
- remain_len = data_len - main_len;
-
- switch(m_type) {
- case Encryption::AES: {
- lint elen;
-
- /* First decrypt the last 2 blocks data of data, since
- data is no block aligned. */
- if (remain_len != 0) {
- ut_ad(m_klen == ENCRYPTION_KEY_LEN);
-
- remain_len = MY_AES_BLOCK_SIZE * 2;
-
- /* Copy the last 2 blocks. */
- memcpy(remain_buf,
- ptr + data_len - remain_len,
- remain_len);
-
- elen = my_aes_decrypt(
- remain_buf,
- static_cast<uint32>(remain_len),
- dst + data_len - remain_len,
- reinterpret_cast<unsigned char*>(m_key),
- static_cast<uint32>(m_klen),
- my_aes_256_cbc,
- reinterpret_cast<unsigned char*>(m_iv),
- false);
- if (elen == MY_AES_BAD_DATA) {
- if (block != NULL) {
- os_free_block(block);
- }
-
- return(DB_IO_DECRYPT_FAIL);
- }
-
- /* Copy the other data bytes to temp area. */
- memcpy(dst, ptr, data_len - remain_len);
- } else {
- ut_ad(data_len == main_len);
-
- /* Copy the data bytes to temp area. */
- memcpy(dst, ptr, data_len);
- }
-
- /* Then decrypt the main data */
- elen = my_aes_decrypt(
- dst,
- static_cast<uint32>(main_len),
- ptr,
- reinterpret_cast<unsigned char*>(m_key),
- static_cast<uint32>(m_klen),
- my_aes_256_cbc,
- reinterpret_cast<unsigned char*>(m_iv),
- false);
- if (elen == MY_AES_BAD_DATA) {
-
- if (block != NULL) {
- os_free_block(block);
- }
-
- return(DB_IO_DECRYPT_FAIL);
- }
-
- ut_ad(static_cast<ulint>(elen) == main_len);
-
- /* Copy the remain bytes. */
- memcpy(ptr + main_len, dst + main_len, data_len - main_len);
-
- break;
- }
-
- default:
-#if !defined(UNIV_INNOCHECKSUM)
- ib::error()
- << "Encryption algorithm support missing: "
- << Encryption::to_string(m_type);
-#else
- fprintf(stderr, "Encryption algorithm support missing: %s\n",
- Encryption::to_string(m_type));
-#endif /* !UNIV_INNOCHECKSUM */
-
- if (block != NULL) {
- os_free_block(block);
- }
-
- return(DB_UNSUPPORTED);
- }
-
- /* Restore the original page type. If it's a compressed and
- encrypted page, just reset it as compressed page type, since
- we will do uncompress later. */
-
- if (page_type == FIL_PAGE_ENCRYPTED) {
- mach_write_to_2(src + FIL_PAGE_TYPE, original_type);
- mach_write_to_2(src + FIL_PAGE_ORIGINAL_TYPE_V1, 0);
- } else if (page_type == FIL_PAGE_ENCRYPTED_RTREE) {
- mach_write_to_2(src + FIL_PAGE_TYPE, FIL_PAGE_RTREE);
- } else {
- ut_ad(page_type == FIL_PAGE_COMPRESSED_AND_ENCRYPTED);
- mach_write_to_2(src + FIL_PAGE_TYPE, FIL_PAGE_COMPRESSED);
- }
-
- if (block != NULL) {
- os_free_block(block);
- }
-
-#ifdef UNIV_ENCRYPT_DEBUG
- fprintf(stderr, "Decrypted page:%lu.%lu\n", space_id, page_no);
-#endif
-
- DBUG_EXECUTE_IF("ib_crash_during_decrypt_page", DBUG_SUICIDE(););
-
- return(DB_SUCCESS);
-}
-#endif /* MYSQL_ENCRYPTION */
-
/** Normalizes a directory path for the current OS:
On Windows, we convert '/' to '\', else we convert '\' to '/'.
@param[in,out] str A null-terminated directory and file path */
diff --git a/storage/innobase/page/page0page.cc b/storage/innobase/page/page0page.cc
index 704ed55f2b3..e2d2dd40fd8 100644
--- a/storage/innobase/page/page0page.cc
+++ b/storage/innobase/page/page0page.cc
@@ -550,6 +550,7 @@ page_create_empty(
}
if (page_zip) {
+ ut_ad(!dict_table_is_temporary(index->table));
page_create_zip(block, index,
page_header_get_field(page, PAGE_LEVEL),
max_trx_id, NULL, mtr);
diff --git a/storage/innobase/page/page0zip.cc b/storage/innobase/page/page0zip.cc
index c47a1905b4b..d49cecdb968 100644
--- a/storage/innobase/page/page0zip.cc
+++ b/storage/innobase/page/page0zip.cc
@@ -1388,9 +1388,8 @@ page_zip_compress(
#ifdef UNIV_DEBUG
ib::error()
- << "InnoDB: Simulating a compression failure"
- << " for table "
- << (index->table->name.m_name)
+ << "Simulating a compression failure"
+ << " for table " << index->table->name
<< " index "
<< index->name()
<< " page "
@@ -4688,6 +4687,7 @@ page_zip_reorganize(
ut_ad(mtr_memo_contains(mtr, block, MTR_MEMO_PAGE_X_FIX));
ut_ad(page_is_comp(page));
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));
@@ -4719,7 +4719,6 @@ page_zip_reorganize(
temp_page + (PAGE_HEADER + PAGE_MAX_TRX_ID), 8);
/* PAGE_MAX_TRX_ID must be set on secondary index leaf pages. */
ut_ad(dict_index_is_clust(index) || !page_is_leaf(temp_page)
- || dict_table_is_temporary(index->table)
|| page_get_max_trx_id(page) != 0);
/* PAGE_MAX_TRX_ID must be zero on non-leaf pages other than
clustered index root pages. */
@@ -4764,6 +4763,7 @@ page_zip_copy_recs(
ut_ad(mtr_memo_contains_page(mtr, page, MTR_MEMO_PAGE_X_FIX));
ut_ad(mtr_memo_contains_page(mtr, src, MTR_MEMO_PAGE_X_FIX));
ut_ad(!dict_index_is_ibuf(index));
+ ut_ad(!dict_table_is_temporary(index->table));
#ifdef UNIV_ZIP_DEBUG
/* The B-tree operations that call this function may set
FIL_PAGE_PREV or PAGE_LEVEL, causing a temporary min_rec_flag
@@ -4807,8 +4807,7 @@ page_zip_copy_recs(
} else {
/* The PAGE_MAX_TRX_ID must be nonzero on leaf pages
of secondary indexes, and 0 on others. */
- ut_ad(dict_table_is_temporary(index->table)
- || !page_is_leaf(src) == !page_get_max_trx_id(src));
+ ut_ad(!page_is_leaf(src) == !page_get_max_trx_id(src));
}
/* Copy all fields of src_zip to page_zip, except the pointer
diff --git a/storage/innobase/que/que0que.cc b/storage/innobase/que/que0que.cc
index 8d3e8cfa115..9fd12686f57 100644
--- a/storage/innobase/que/que0que.cc
+++ b/storage/innobase/que/que0que.cc
@@ -1,6 +1,7 @@
/*****************************************************************************
Copyright (c) 1996, 2016, 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
@@ -1248,21 +1249,3 @@ que_eval_sql(
DBUG_RETURN(trx->error_state);
}
-
-/*********************************************************************//**
-Initialise the query sub-system. */
-void
-que_init(void)
-/*==========*/
-{
- /* No op */
-}
-
-/*********************************************************************//**
-Close the query sub-system. */
-void
-que_close(void)
-/*===========*/
-{
- /* No op */
-}
diff --git a/storage/innobase/row/row0import.cc b/storage/innobase/row/row0import.cc
index 1054e4db1ef..a6f4b221302 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, 2016, MariaDB Corporation.
+Copyright (c) 2015, 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
@@ -124,8 +124,7 @@ struct row_import {
m_col_names(),
m_n_indexes(),
m_indexes(),
- m_missing(true),
- m_cfp_missing(true) { }
+ m_missing(true) {}
~row_import() UNIV_NOTHROW;
@@ -220,9 +219,6 @@ struct row_import {
bool m_missing; /*!< true if a .cfg file was
found and was readable */
-
- bool m_cfp_missing; /*!< true if a .cfp file was
- found and was readable */
};
/** Use the page cursor to iterate over records in a block. */
@@ -365,8 +361,7 @@ public:
m_space(ULINT_UNDEFINED),
m_xdes(),
m_xdes_page_no(ULINT_UNDEFINED),
- m_space_flags(ULINT_UNDEFINED),
- m_table_flags(ULINT_UNDEFINED) UNIV_NOTHROW { }
+ m_space_flags(ULINT_UNDEFINED) UNIV_NOTHROW { }
/** Free any extent descriptor instance */
virtual ~AbstractCallback()
@@ -388,6 +383,12 @@ public:
return(get_page_size().is_compressed());
}
+ /** @return the tablespace flags */
+ ulint get_space_flags() const
+ {
+ return(m_space_flags);
+ }
+
protected:
/** Get the data page depending on the table type, compressed or not.
@param block block read from disk
@@ -527,10 +528,6 @@ protected:
/** Flags value read from the header page */
ulint m_space_flags;
-
- /** Derived from m_space_flags and row format type, the row format
- type is determined from the page header. */
- ulint m_table_flags;
};
/** Determine the page size to use for traversing the tablespace
@@ -545,13 +542,19 @@ AbstractCallback::init(
const page_t* page = block->frame;
m_space_flags = fsp_header_get_flags(page);
+ if (!fsp_flags_is_valid(m_space_flags)) {
+ ulint cflags = fsp_flags_convert_from_101(m_space_flags);
+ if (cflags == ULINT_UNDEFINED) {
+ ib::error() << "Invalid FSP_SPACE_FLAGS="
+ << ib::hex(m_space_flags);
+ return(DB_CORRUPTION);
+ }
+ m_space_flags = cflags;
+ }
- /* Since we don't know whether it is a compressed table
- or not, the data is always read into the block->frame. */
-
- set_page_size(block->frame);
-
- /* Set the page size used to traverse the tablespace. */
+ /* Clear the DATA_DIR flag, which is basically garbage. */
+ m_space_flags &= ~(1U << FSP_FLAGS_POS_RESERVED);
+ m_page_size.copy_from(page_size_t(m_space_flags));
if (!is_compressed_table() && !m_page_size.equals_to(univ_page_size)) {
@@ -618,52 +621,6 @@ struct FetchIndexRootPages : public AbstractCallback {
return(m_space);
}
- /**
- @retval the space flags of the tablespace being iterated over */
- virtual ulint get_space_flags() const UNIV_NOTHROW
- {
- return(m_space_flags);
- }
-
- /** Check if the .ibd file row format is the same as the table's.
- @param ibd_table_flags determined from space and page.
- @return DB_SUCCESS or error code. */
- dberr_t check_row_format(ulint ibd_table_flags) UNIV_NOTHROW
- {
- dberr_t err;
- rec_format_t ibd_rec_format;
- rec_format_t table_rec_format;
-
- if (!dict_tf_is_valid(ibd_table_flags)) {
-
- ib_errf(m_trx->mysql_thd, IB_LOG_LEVEL_ERROR,
- ER_TABLE_SCHEMA_MISMATCH,
- ".ibd file has invalid table flags: %lx",
- ibd_table_flags);
-
- return(DB_CORRUPTION);
- }
-
- ibd_rec_format = dict_tf_get_rec_format(ibd_table_flags);
- table_rec_format = dict_tf_get_rec_format(m_table->flags);
-
- if (table_rec_format != ibd_rec_format) {
-
- ib_errf(m_trx->mysql_thd, IB_LOG_LEVEL_ERROR,
- ER_TABLE_SCHEMA_MISMATCH,
- "Table has %s row format, .ibd"
- " file has %s row format.",
- dict_tf_to_row_format_string(m_table->flags),
- dict_tf_to_row_format_string(ibd_table_flags));
-
- err = DB_CORRUPTION;
- } else {
- err = DB_SUCCESS;
- }
-
- return(err);
- }
-
/** Called for each block as it is read from the file.
@param offset physical offset in the file
@param block block to convert, it is not from the buffer pool.
@@ -724,12 +681,17 @@ FetchIndexRootPages::operator() (
m_indexes.push_back(Index(id, block->page.id.page_no()));
if (m_indexes.size() == 1) {
-
- m_table_flags = fsp_flags_to_dict_tf(
- m_space_flags,
- page_is_comp(page) ? true : false);
-
- err = check_row_format(m_table_flags);
+ /* Check that the tablespace flags match the table flags. */
+ ulint expected = dict_tf_to_fsp_flags(m_table->flags);
+ if (!fsp_flags_match(expected, m_space_flags)) {
+ ib_errf(m_trx->mysql_thd, IB_LOG_LEVEL_ERROR,
+ ER_TABLE_SCHEMA_MISMATCH,
+ "Expected FSP_SPACE_FLAGS=0x%x, .ibd "
+ "file contains 0x%x.",
+ unsigned(expected),
+ unsigned(m_space_flags));
+ return(DB_CORRUPTION);
+ }
}
}
@@ -853,13 +815,6 @@ public:
return(m_cfg->m_table->space);
}
- /**
- @retval the space flags of the tablespace being iterated over */
- virtual ulint get_space_flags() const UNIV_NOTHROW
- {
- return(m_space_flags);
- }
-
/** Called for each block as it is read from the file.
@param offset physical offset in the file
@param block block to convert, it is not from the buffer pool.
@@ -1914,19 +1869,14 @@ PageConverter::update_header(
ib::warn() << "Space id check in the header failed: ignored";
}
- ulint space_flags = fsp_header_get_flags(get_frame(block));
-
- if (!fsp_flags_is_valid(space_flags)) {
-
- ib::error() << "Unsupported tablespace format "
- << space_flags;
-
- return(DB_UNSUPPORTED);
- }
-
mach_write_to_8(
get_frame(block) + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION,
m_current_lsn);
+
+ /* Write back the adjusted flags. */
+ mach_write_to_4(FSP_HEADER_OFFSET + FSP_SPACE_FLAGS
+ + get_frame(block), m_space_flags);
+
/* Write space_id to the tablespace header, page 0. */
mach_write_to_4(
get_frame(block) + FSP_HEADER_OFFSET + FSP_SPACE_ID,
@@ -2182,9 +2132,6 @@ row_import_cleanup(
trx_commit_for_mysql(trx);
- prebuilt->table->encryption_key = NULL;
- prebuilt->table->encryption_iv = NULL;
-
row_mysql_unlock_data_dictionary(trx);
trx_free_for_mysql(trx);
@@ -3168,170 +3115,6 @@ row_import_read_cfg(
return(err);
}
-#ifdef MYSQL_ENCRYPTION
-/** Read the contents of the <tablespace>.cfp file.
-@param[in] table table
-@param[in] file file to read from
-@param[in] thd session
-@param[in] cfp contents of the .cfp file
-@return DB_SUCCESS or error code. */
-static
-dberr_t
-row_import_read_encryption_data(
- dict_table_t* table,
- FILE* file,
- THD* thd,
- row_import& import)
-{
- byte row[sizeof(ib_uint32_t)];
- ulint key_size;
- byte transfer_key[ENCRYPTION_KEY_LEN];
- byte encryption_key[ENCRYPTION_KEY_LEN];
- byte encryption_iv[ENCRYPTION_KEY_LEN];
- lint elen;
-
- if (fread(&row, 1, sizeof(row), file) != sizeof(row)) {
- ib_senderrf(
- thd, IB_LOG_LEVEL_ERROR, ER_IO_READ_ERROR,
- errno, strerror(errno),
- "while reading encrypton key size.");
-
- return(DB_IO_ERROR);
- }
-
- key_size = mach_read_from_4(row);
- if (key_size != ENCRYPTION_KEY_LEN) {
- ib_senderrf(
- thd, IB_LOG_LEVEL_ERROR, ER_IO_READ_ERROR,
- errno, strerror(errno),
- "while parsing encryption key size.");
-
- return(DB_IO_ERROR);
- }
-
- /* Read the transfer key. */
- if (fread(transfer_key, 1, ENCRYPTION_KEY_LEN, file)
- != ENCRYPTION_KEY_LEN) {
- ib_senderrf(
- thd, IB_LOG_LEVEL_WARN, ER_IO_WRITE_ERROR,
- errno, strerror(errno),
- "while reading tranfer key.");
-
- return(DB_IO_ERROR);
- }
-
- /* Read the encrypted key. */
- if (fread(encryption_key, 1, ENCRYPTION_KEY_LEN, file)
- != ENCRYPTION_KEY_LEN) {
- ib_senderrf(
- thd, IB_LOG_LEVEL_WARN, ER_IO_WRITE_ERROR,
- errno, strerror(errno),
- "while reading encryption key.");
-
- return(DB_IO_ERROR);
- }
-
- /* Read the encrypted iv. */
- if (fread(encryption_iv, 1, ENCRYPTION_KEY_LEN, file)
- != ENCRYPTION_KEY_LEN) {
- ib_senderrf(
- thd, IB_LOG_LEVEL_WARN, ER_IO_WRITE_ERROR,
- errno, strerror(errno),
- "while reading encryption iv.");
-
- return(DB_IO_ERROR);
- }
-
- table->encryption_key =
- static_cast<byte*>(mem_heap_alloc(table->heap,
- ENCRYPTION_KEY_LEN));
-
- table->encryption_iv =
- static_cast<byte*>(mem_heap_alloc(table->heap,
- ENCRYPTION_KEY_LEN));
- /* Decrypt tablespace key and iv. */
- elen = my_aes_decrypt(
- encryption_key,
- ENCRYPTION_KEY_LEN,
- table->encryption_key,
- transfer_key,
- ENCRYPTION_KEY_LEN,
- my_aes_256_ecb, NULL, false);
-
- if (elen == MY_AES_BAD_DATA) {
- ib_senderrf(
- thd, IB_LOG_LEVEL_ERROR, ER_IO_READ_ERROR,
- errno, strerror(errno),
- "while decrypt encryption key.");
-
- return(DB_IO_ERROR);
- }
-
- elen = my_aes_decrypt(
- encryption_iv,
- ENCRYPTION_KEY_LEN,
- table->encryption_iv,
- transfer_key,
- ENCRYPTION_KEY_LEN,
- my_aes_256_ecb, NULL, false);
-
- if (elen == MY_AES_BAD_DATA) {
- ib_senderrf(
- thd, IB_LOG_LEVEL_ERROR, ER_IO_READ_ERROR,
- errno, strerror(errno),
- "while decrypt encryption iv.");
-
- return(DB_IO_ERROR);
- }
-
- return(DB_SUCCESS);
-}
-
-/** Read the contents of the <tablename>.cfp file.
-@param[in] table table
-@param[in] thd session
-@param[in] cfp contents of the .cfp file
-@return DB_SUCCESS or error code. */
-static
-dberr_t
-row_import_read_cfp(
- dict_table_t* table,
- THD* thd,
- row_import& import)
-{
- dberr_t err;
- char name[OS_FILE_MAX_PATH];
-
- /* Clear table encryption information. */
- table->encryption_key = NULL;
- table->encryption_iv = NULL;
-
- srv_get_encryption_data_filename(table, name, sizeof(name));
-
- FILE* file = fopen(name, "rb");
-
- if (file == NULL) {
- import.m_cfp_missing = true;
-
- /* If there's no cfp file, we assume it's not an
- encrpyted table. return directly. */
-
- import.m_cfp_missing = true;
-
- err = DB_SUCCESS;
- } else {
-
- import.m_cfp_missing = false;
-
- err = row_import_read_encryption_data(table, file,
- thd, import);
- fclose(file);
- }
-
- return(err);
-}
-#endif /* MYSQL_ENCRYPTION */
-
/*****************************************************************//**
Update the <space, root page> of a table's indexes from the values
in the data dictionary.
@@ -3699,42 +3482,7 @@ row_import_for_mysql(
rw_lock_s_unlock_gen(dict_operation_lock, 0);
}
- /* Try to read encryption information. */
- if (err == DB_SUCCESS) {
-#ifdef MYSQL_ENCRYPTION
- err = row_import_read_cfp(table, trx->mysql_thd, cfg);
-
- /* If table is not set to encrypted, but the fsp flag
- is not, then return error. */
- if (!dict_table_is_encrypted(table)
- && space_flags != 0
- && FSP_FLAGS_GET_ENCRYPTION(space_flags)) {
-
- ib_errf(trx->mysql_thd, IB_LOG_LEVEL_ERROR,
- ER_TABLE_SCHEMA_MISMATCH,
- "Table is not marked as encrypted, but"
- " the tablespace is marked as encrypted");
-
- err = DB_ERROR;
- return(row_import_error(prebuilt, trx, err));
- }
-
- /* If table is set to encrypted, but can't find
- cfp file, then return error. */
- if (cfg.m_cfp_missing== true
- && ((space_flags != 0
- && FSP_FLAGS_GET_ENCRYPTION(space_flags))
- || dict_table_is_encrypted(table))) {
- ib_errf(trx->mysql_thd, IB_LOG_LEVEL_ERROR,
- ER_TABLE_SCHEMA_MISMATCH,
- "Table is in an encrypted tablespace, but"
- " can't find the encryption meta-data file"
- " in importing");
- err = DB_ERROR;
- return(row_import_error(prebuilt, trx, err));
- }
-#endif /* MYSQL_ENCRYPTION */
- } else {
+ if (err != DB_SUCCESS) {
return(row_import_error(prebuilt, trx, err));
}
@@ -3757,22 +3505,6 @@ row_import_for_mysql(
DBUG_EXECUTE_IF("ib_import_reset_space_and_lsn_failure",
err = DB_TOO_MANY_CONCURRENT_TRXS;);
-#ifdef MYSQL_ENCRYPTION
- if (err == DB_IO_NO_ENCRYPT_TABLESPACE) {
- char table_name[MAX_FULL_NAME_LEN + 1];
-
- innobase_format_name(
- table_name, sizeof(table_name),
- table->name.m_name);
-
- ib_errf(trx->mysql_thd, IB_LOG_LEVEL_ERROR,
- ER_TABLE_SCHEMA_MISMATCH,
- "Encryption attribute is no matched");
-
- return(row_import_cleanup(prebuilt, trx, err));
- }
-#endif /* MYSQL_ENCRYPTION */
-
if (err != DB_SUCCESS) {
char table_name[MAX_FULL_NAME_LEN + 1];
@@ -3826,13 +3558,7 @@ row_import_for_mysql(
we will not be writing any redo log for it before we have invoked
fil_space_set_imported() to declare it a persistent tablespace. */
- ulint fsp_flags = dict_tf_to_fsp_flags(table->flags, false);
-
-#ifdef MYSQL_ENCRYPTION
- if (table->encryption_key != NULL) {
- fsp_flags |= FSP_FLAGS_MASK_ENCRYPTION;
- }
-#endif /* MYSQL_ENCRYPTION */
+ ulint fsp_flags = dict_tf_to_fsp_flags(table->flags);
err = fil_ibd_open(
true, true, FIL_TYPE_IMPORT, table->space,
@@ -3853,17 +3579,6 @@ row_import_for_mysql(
return(row_import_cleanup(prebuilt, trx, err));
}
-#ifdef MYSQL_ENCRYPTION
- /* For encrypted table, set encryption information. */
- if (dict_table_is_encrypted(table)) {
-
- err = fil_set_encryption(table->space,
- Encryption::AES,
- table->encryption_key,
- table->encryption_iv);
- }
-#endif /* MYSQL_ENCRYPTION */
-
row_mysql_unlock_data_dictionary(trx);
ut_free(filepath);
@@ -3961,37 +3676,6 @@ row_import_for_mysql(
ib::info() << "Phase IV - Flush complete";
fil_space_set_imported(prebuilt->table->space);
-#ifdef MYSQL_ENCRYPTION
- if (dict_table_is_encrypted(table)) {
- fil_space_t* space;
- mtr_t mtr;
- byte encrypt_info[ENCRYPTION_INFO_SIZE_V2];
-
- mtr_start(&mtr);
-
- mtr.set_named_space(table->space);
- space = mtr_x_lock_space(table->space, &mtr);
-
- memset(encrypt_info, 0, ENCRYPTION_INFO_SIZE_V2);
-
- if (!fsp_header_rotate_encryption(space,
- encrypt_info,
- &mtr)) {
- mtr_commit(&mtr);
- ib_senderrf(trx->mysql_thd, IB_LOG_LEVEL_ERROR,
- ER_FILE_NOT_FOUND,
- filepath, err, ut_strerr(err));
-
- ut_free(filepath);
- row_mysql_unlock_data_dictionary(trx);
-
- return(row_import_cleanup(prebuilt, trx, err));
- }
-
- mtr_commit(&mtr);
- }
-#endif /* MYSQL_ENCRYPTION */
-
/* The dictionary latches will be released in in row_import_cleanup()
after the transaction commit, for both success and error. */
diff --git a/storage/innobase/row/row0log.cc b/storage/innobase/row/row0log.cc
index 9de1277e712..d43fb333cdc 100644
--- a/storage/innobase/row/row0log.cc
+++ b/storage/innobase/row/row0log.cc
@@ -526,7 +526,7 @@ err_exit:
my_atomic_addlint(&onlineddl_rowlog_rows, 1);
/* 10000 means 100.00%, 4525 means 45.25% */
- onlineddl_rowlog_pct_used = (log->tail.total * 10000) / srv_online_max_size;
+ onlineddl_rowlog_pct_used = static_cast<ulint>((log->tail.total * 10000) / srv_online_max_size);
}
#ifdef UNIV_DEBUG
diff --git a/storage/innobase/row/row0merge.cc b/storage/innobase/row/row0merge.cc
index a5cd0064ddd..57dd8f75e8e 100644
--- a/storage/innobase/row/row0merge.cc
+++ b/storage/innobase/row/row0merge.cc
@@ -378,9 +378,9 @@ row_merge_insert_index_tuples(
const row_merge_buf_t* row_buf,
BtrBulk* btr_bulk,
const ib_uint64_t table_total_rows, /*!< in: total rows of old table */
- const float pct_progress, /*!< in: total progress
+ const double pct_progress, /*!< in: total progress
percent until now */
- const float pct_cost, /*!< in: current progress percent
+ const double pct_cost, /*!< in: current progress percent
*/
fil_space_crypt_t* crypt_data,/*!< in: table crypt data */
row_merge_block_t* crypt_block, /*!< in: crypt buf or NULL */
@@ -1182,9 +1182,6 @@ row_merge_read(
IORequest request;
- /* Merge sort pages are never compressed. */
- request.disable_compression();
-
dberr_t err = os_file_read_no_error_handling(
request,
OS_FILE_FROM_FD(fd), buf, ofs, srv_sort_buf_size, NULL);
@@ -1239,8 +1236,6 @@ row_merge_write(
mach_write_to_4((byte *)out_buf, 0);
}
- request.disable_compression();
-
dberr_t err = os_file_write(
request,
"(merge)", OS_FILE_FROM_FD(fd), out_buf, ofs, buf_len);
@@ -1825,7 +1820,7 @@ row_merge_read_clustered_index(
bool skip_pk_sort,
int* tmpfd,
ut_stage_alter_t* stage,
- float pct_cost,
+ double pct_cost,
fil_space_crypt_t* crypt_data,
row_merge_block_t* crypt_block,
struct TABLE* eval_table)
@@ -1860,7 +1855,7 @@ row_merge_read_clustered_index(
mtuple_t prev_mtuple;
mem_heap_t* conv_heap = NULL;
FlushObserver* observer = trx->flush_observer;
- float curr_progress = 0.0;
+ double curr_progress = 0.0;
ib_uint64_t read_rows = 0;
ib_uint64_t table_total_rows = 0;
@@ -3273,10 +3268,10 @@ row_merge_sort(
const bool update_progress,
/*!< in: update progress
status variable or not */
- const float pct_progress,
+ const double pct_progress,
/*!< in: total progress percent
until now */
- const float pct_cost, /*!< in: current progress percent */
+ const double pct_cost, /*!< in: current progress percent */
fil_space_crypt_t* crypt_data,/*!< in: table crypt data */
row_merge_block_t* crypt_block, /*!< in: crypt buf or NULL */
ulint space, /*!< in: space id */
@@ -3288,7 +3283,7 @@ row_merge_sort(
dberr_t error = DB_SUCCESS;
ulint merge_count = 0;
ulint total_merge_sort_count;
- float curr_progress = 0;
+ double curr_progress = 0;
DBUG_ENTER("row_merge_sort");
@@ -3301,7 +3296,7 @@ row_merge_sort(
/* Find the number N which 2^N is greater or equal than num_runs */
/* N is merge sort running count */
- total_merge_sort_count = (ulint) ceil(my_log2f(num_runs));
+ total_merge_sort_count = (ulint) ceil(my_log2f((float)num_runs));
if(total_merge_sort_count <= 0) {
total_merge_sort_count=1;
}
@@ -3487,9 +3482,9 @@ row_merge_insert_index_tuples(
const row_merge_buf_t* row_buf,
BtrBulk* btr_bulk,
const ib_uint64_t table_total_rows, /*!< in: total rows of old table */
- const float pct_progress, /*!< in: total progress
+ const double pct_progress, /*!< in: total progress
percent until now */
- const float pct_cost, /*!< in: current progress percent
+ const double pct_cost, /*!< in: current progress percent
*/
fil_space_crypt_t* crypt_data,/*!< in: table crypt data */
row_merge_block_t* crypt_block, /*!< in: crypt buf or NULL */
@@ -3506,7 +3501,7 @@ row_merge_insert_index_tuples(
ulint n_rows = 0;
dtuple_t* dtuple;
ib_uint64_t inserted_rows = 0;
- float curr_progress = 0;
+ double curr_progress = 0;
dict_index_t* old_index = NULL;
const mrec_t* mrec = NULL;
ulint n_ext = 0;
@@ -4666,11 +4661,11 @@ row_merge_build_indexes(
bool fts_psort_initiated = false;
fil_space_crypt_t * crypt_data = NULL;
- float total_static_cost = 0;
- float total_dynamic_cost = 0;
+ double total_static_cost = 0;
+ double total_dynamic_cost = 0;
uint total_index_blocks = 0;
- float pct_cost=0;
- float pct_progress=0;
+ double pct_cost=0;
+ double pct_progress=0;
DBUG_ENTER("row_merge_build_indexes");
diff --git a/storage/innobase/row/row0mysql.cc b/storage/innobase/row/row0mysql.cc
index 269291bd517..fbf49d8d3a0 100644
--- a/storage/innobase/row/row0mysql.cc
+++ b/storage/innobase/row/row0mysql.cc
@@ -1,6 +1,7 @@
/*****************************************************************************
Copyright (c) 2000, 2016, 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
@@ -102,8 +103,6 @@ static ib_mutex_t row_drop_list_mutex;
/** Flag: has row_mysql_drop_list been initialized? */
static ibool row_mysql_drop_list_inited = FALSE;
-extern ib_mutex_t master_key_id_mutex;
-
/** Magic table names for invoking various monitor threads */
/* @{ */
static const char S_innodb_monitor[] = "innodb_monitor";
@@ -2422,9 +2421,6 @@ row_create_table_for_mysql(
dict_table_t* table, /*!< in, own: table definition
(will be freed, or on DB_SUCCESS
added to the data dictionary cache) */
- const char* compression,
- /*!< in: compression algorithm to use,
- can be NULL */
trx_t* trx, /*!< in/out: transaction */
bool commit, /*!< in: if true, commit the transaction */
fil_encryption_t mode, /*!< in: encryption mode */
@@ -2512,46 +2508,11 @@ err_exit:
/* We must delete the link file. */
RemoteDatafile::delete_link_file(table->name.m_name);
-
- } else if (compression != NULL && compression[0] != '\0') {
-#ifdef MYSQL_COMPRESSION
- ut_ad(!dict_table_in_shared_tablespace(table));
-
- ut_ad(Compression::validate(compression) == DB_SUCCESS);
-
- err = fil_set_compression(table, compression);
-
- switch (err) {
- case DB_SUCCESS:
- break;
- case DB_NOT_FOUND:
- case DB_UNSUPPORTED:
- case DB_IO_NO_PUNCH_HOLE_FS:
- /* Return these errors */
- break;
- case DB_IO_NO_PUNCH_HOLE_TABLESPACE:
- /* Page Compression will not be used. */
- err = DB_SUCCESS;
- break;
- default:
- ut_error;
- }
-
- /* We can check for file system punch hole support
- only after creating the tablespace. On Windows
- we can query that information but not on Linux. */
- ut_ad(err == DB_SUCCESS
- || err == DB_IO_NO_PUNCH_HOLE_FS);
-#endif /* MYSQL_COMPRESSION */
-
- /* In non-strict mode we ignore dodgy compression
- settings. */
}
}
switch (err) {
case DB_SUCCESS:
- case DB_IO_NO_PUNCH_HOLE_FS:
break;
case DB_OUT_OF_FILE_SPACE:
trx->error_state = DB_SUCCESS;
@@ -3275,33 +3236,6 @@ row_discard_tablespace(
return(err);
}
- /* For encrypted table, before we discard the tablespace,
- we need save the encryption information into table, otherwise,
- this information will be lost in fil_discard_tablespace along
- with fil_space_free(). */
- if (dict_table_is_encrypted(table)) {
- ut_ad(table->encryption_key == NULL
- && table->encryption_iv == NULL);
-
- table->encryption_key =
- static_cast<byte*>(mem_heap_alloc(table->heap,
- ENCRYPTION_KEY_LEN));
-
- table->encryption_iv =
- static_cast<byte*>(mem_heap_alloc(table->heap,
- ENCRYPTION_KEY_LEN));
-
- fil_space_t* space = fil_space_get(table->space);
- ut_ad(FSP_FLAGS_GET_ENCRYPTION(space->flags));
-
- memcpy(table->encryption_key,
- space->encryption_key,
- ENCRYPTION_KEY_LEN);
- memcpy(table->encryption_iv,
- space->encryption_iv,
- ENCRYPTION_KEY_LEN);
- }
-
/* Discard the physical file that is used for the tablespace. */
err = fil_discard_tablespace(table->space);
@@ -3502,8 +3436,8 @@ void
fil_wait_crypt_bg_threads(
dict_table_t* table)
{
- uint start = time(0);
- uint last = start;
+ time_t start = time(0);
+ time_t last = start;
if (table->space != 0) {
fil_space_crypt_mark_space_closing(table->space, table->crypt_data);
}
@@ -3512,7 +3446,8 @@ fil_wait_crypt_bg_threads(
dict_mutex_exit_for_mysql();
os_thread_sleep(20000);
dict_mutex_enter_for_mysql();
- uint now = time(0);
+ time_t now = time(0);
+
if (now >= last + 30) {
ib::warn()
<< "Waited " << now - start
@@ -3613,9 +3548,7 @@ This deletes the fil_space_t if found and the file on disk.
@param[in] space_id Tablespace ID
@param[in] tablename Table name, same as the tablespace name
@param[in] filepath File path of tablespace to delete
-@param[in] is_temp Is this a temporary table/tablespace
-@param[in] is_encrypted Is this an encrypted table/tablespace
-@param[in] trx Transaction handle
+@param[in] table_flags table flags
@return error code or DB_SUCCESS */
UNIV_INLINE
dberr_t
@@ -3623,28 +3556,20 @@ row_drop_single_table_tablespace(
ulint space_id,
const char* tablename,
const char* filepath,
- bool is_temp,
- bool is_encrypted,
- trx_t* trx)
+ ulint table_flags)
{
dberr_t err = DB_SUCCESS;
- /* This might be a temporary single-table tablespace if the table
- is compressed and temporary. If so, don't spam the log when we
- delete one of these or if we can't find the tablespace. */
- bool print_msg = !is_temp && !is_encrypted;
-
/* If the tablespace is not in the cache, just delete the file. */
if (!fil_space_for_table_exists_in_mem(
- space_id, tablename, print_msg, false, NULL, 0, NULL)) {
+ space_id, tablename, true, false, NULL, 0, NULL,
+ table_flags)) {
/* Force a delete of any discarded or temporary files. */
fil_delete_file(filepath);
- if (print_msg) {
- ib::info() << "Removed datafile " << filepath
- << " for table " << tablename;
- }
+ ib::info() << "Removed datafile " << filepath
+ << " for table " << tablename;
} else if (fil_delete_tablespace(space_id, BUF_REMOVE_FLUSH_NO_WRITE)
!= DB_SUCCESS) {
@@ -4111,35 +4036,22 @@ row_drop_table_for_mysql(
/* remove the index object associated. */
dict_drop_index_tree_in_mem(index, *page_no++);
}
- err = DB_SUCCESS;
+ err = row_drop_table_from_cache(tablename, table, trx);
+ goto funct_exit;
}
switch (err) {
ulint space_id;
- bool is_temp;
- bool is_encrypted;
bool ibd_file_missing;
bool is_discarded;
- bool shared_tablespace;
+ ulint table_flags;
case DB_SUCCESS:
space_id = table->space;
ibd_file_missing = table->ibd_file_missing;
is_discarded = dict_table_is_discarded(table);
- is_temp = dict_table_is_temporary(table);
- is_encrypted = dict_table_is_encrypted(table);
- shared_tablespace = DICT_TF_HAS_SHARED_SPACE(table->flags);
-
- /* If there is a temp path then the temp flag is set.
- However, during recovery, we might have a temp flag but
- not know the temp path */
- ut_a(table->dir_path_of_temp_table == NULL || is_temp);
-
- /* We do not allow temporary tables with a remote path. */
- ut_a(!(is_temp && DICT_TF_HAS_DATA_DIR(table->flags)));
-
- /* Make sure the data_dir_path is set if needed. */
- dict_get_and_save_data_dir_path(table, true);
+ table_flags = table->flags;
+ ut_ad(!dict_table_is_temporary(table));
err = row_drop_ancillary_fts_tables(table, trx);
if (err != DB_SUCCESS) {
@@ -4149,15 +4061,12 @@ row_drop_table_for_mysql(
/* Determine the tablespace filename before we 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);
filepath = fil_make_filepath(
table->data_dir_path,
table->name.m_name, IBD, true);
- } else if (table->dir_path_of_temp_table) {
- filepath = fil_make_filepath(
- table->dir_path_of_temp_table,
- NULL, IBD, false);
- } else if (!shared_tablespace) {
+ } else {
filepath = fil_make_filepath(
NULL, table->name.m_name, IBD, false);
}
@@ -4169,35 +4078,15 @@ row_drop_table_for_mysql(
}
/* Do not attempt to drop known-to-be-missing tablespaces,
- nor system or shared general tablespaces. */
- if (is_discarded || ibd_file_missing || shared_tablespace
+ nor the system tablespace. */
+ if (is_discarded || ibd_file_missing
|| is_system_tablespace(space_id)) {
- /* For encrypted table, if ibd file can not be decrypt,
- we also set ibd_file_missing. We still need to try to
- remove the ibd file for this. */
- if (is_discarded || !is_encrypted
- || !ibd_file_missing) {
- break;
- }
- }
-
-#ifdef MYSQL_ENCRYPTION
- if (is_encrypted) {
- /* Require the mutex to block key rotation. */
- mutex_enter(&master_key_id_mutex);
+ break;
}
-#endif /* MYSQL_ENCRYPTION */
/* We can now drop the single-table tablespace. */
err = row_drop_single_table_tablespace(
- space_id, tablename, filepath,
- is_temp, is_encrypted, trx);
-
-#ifdef MYSQL_ENCRYPTION
- if (is_encrypted) {
- mutex_exit(&master_key_id_mutex);
- }
-#endif /* MYSQL_ENCRYPTION */
+ space_id, tablename, filepath, table_flags);
break;
case DB_OUT_OF_FILE_SPACE:
@@ -4279,99 +4168,6 @@ funct_exit:
DBUG_RETURN(err);
}
-/*********************************************************************//**
-Drop all temporary tables during crash recovery. */
-void
-row_mysql_drop_temp_tables(void)
-/*============================*/
-{
- trx_t* trx;
- btr_pcur_t pcur;
- mtr_t mtr;
- mem_heap_t* heap;
-
- trx = trx_allocate_for_background();
- trx->op_info = "dropping temporary tables";
- row_mysql_lock_data_dictionary(trx);
-
- heap = mem_heap_create(200);
-
- mtr_start(&mtr);
-
- btr_pcur_open_at_index_side(
- true,
- dict_table_get_first_index(dict_sys->sys_tables),
- BTR_SEARCH_LEAF, &pcur, true, 0, &mtr);
-
- for (;;) {
- const rec_t* rec;
- const byte* field;
- ulint len;
- const char* table_name;
- dict_table_t* table;
-
- btr_pcur_move_to_next_user_rec(&pcur, &mtr);
-
- if (!btr_pcur_is_on_user_rec(&pcur)) {
- break;
- }
-
- /* The high order bit of N_COLS is set unless
- ROW_FORMAT=REDUNDANT. */
- rec = btr_pcur_get_rec(&pcur);
- field = rec_get_nth_field_old(
- rec, DICT_FLD__SYS_TABLES__NAME, &len);
- field = rec_get_nth_field_old(
- rec, DICT_FLD__SYS_TABLES__N_COLS, &len);
- if (len != 4
- || !(mach_read_from_4(field) & DICT_N_COLS_COMPACT)) {
- continue;
- }
-
- /* Older versions of InnoDB, which only supported tables
- in ROW_FORMAT=REDUNDANT could write garbage to
- SYS_TABLES.MIX_LEN, where we now store the is_temp flag.
- Above, we assumed is_temp=0 if ROW_FORMAT=REDUNDANT. */
- field = rec_get_nth_field_old(
- rec, DICT_FLD__SYS_TABLES__MIX_LEN, &len);
- if (len != 4
- || !(mach_read_from_4(field) & DICT_TF2_TEMPORARY)) {
- continue;
- }
-
- /* This is a temporary table. */
- field = rec_get_nth_field_old(
- rec, DICT_FLD__SYS_TABLES__NAME, &len);
- if (len == UNIV_SQL_NULL || len == 0) {
- /* Corrupted SYS_TABLES.NAME */
- continue;
- }
-
- table_name = mem_heap_strdupl(heap, (const char*) field, len);
-
- btr_pcur_store_position(&pcur, &mtr);
- btr_pcur_commit_specify_mtr(&pcur, &mtr);
-
- table = dict_load_table(table_name, true,
- DICT_ERR_IGNORE_NONE);
-
- if (table) {
- row_drop_table_for_mysql(table_name, trx, FALSE, FALSE);
- trx_commit_for_mysql(trx);
- }
-
- mtr_start(&mtr);
- btr_pcur_restore_position(BTR_SEARCH_LEAF,
- &pcur, &mtr);
- }
-
- btr_pcur_close(&pcur);
- mtr_commit(&mtr);
- mem_heap_free(heap);
- row_mysql_unlock_data_dictionary(trx);
- trx_free_for_background(trx);
-}
-
/*******************************************************************//**
Drop all foreign keys in a database, see Bug#18942.
Called at the end of row_drop_database_for_mysql().
@@ -5438,7 +5234,8 @@ row_mysql_close(void)
{
ut_a(UT_LIST_GET_LEN(row_mysql_drop_list) == 0);
- mutex_free(&row_drop_list_mutex);
-
- row_mysql_drop_list_inited = FALSE;
+ if (row_mysql_drop_list_inited) {
+ mutex_free(&row_drop_list_mutex);
+ row_mysql_drop_list_inited = FALSE;
+ }
}
diff --git a/storage/innobase/row/row0quiesce.cc b/storage/innobase/row/row0quiesce.cc
index 08d119768a9..d26d81c9239 100644
--- a/storage/innobase/row/row0quiesce.cc
+++ b/storage/innobase/row/row0quiesce.cc
@@ -480,210 +480,6 @@ row_quiesce_write_cfg(
return(err);
}
-#ifdef MYSQL_ENCRYPTION
-
-/** Write the transfer key to CFP file.
-@param[in] table write the data for this table
-@param[in] file file to write to
-@param[in] thd session
-@return DB_SUCCESS or error code. */
-static MY_ATTRIBUTE((nonnull, warn_unused_result))
-dberr_t
-row_quiesce_write_transfer_key(
- const dict_table_t* table,
- FILE* file,
- THD* thd)
-{
- byte key_size[sizeof(ib_uint32_t)];
- byte row[ENCRYPTION_KEY_LEN * 3];
- byte* ptr = row;
- byte* transfer_key = ptr;
- lint elen;
-
- ut_ad(table->encryption_key != NULL
- && table->encryption_iv != NULL);
-
- /* Write the encryption key size. */
- mach_write_to_4(key_size, ENCRYPTION_KEY_LEN);
-
- if (fwrite(&key_size, 1, sizeof(key_size), file)
- != sizeof(key_size)) {
- ib_senderrf(
- thd, IB_LOG_LEVEL_WARN, ER_IO_WRITE_ERROR,
- errno, strerror(errno),
- "while writing key size.");
-
- return(DB_IO_ERROR);
- }
-
- /* Generate and write the transfer key. */
- Encryption::random_value(transfer_key);
- if (fwrite(transfer_key, 1, ENCRYPTION_KEY_LEN, file)
- != ENCRYPTION_KEY_LEN) {
- ib_senderrf(
- thd, IB_LOG_LEVEL_WARN, ER_IO_WRITE_ERROR,
- errno, strerror(errno),
- "while writing transfer key.");
-
- return(DB_IO_ERROR);
- }
-
- ptr += ENCRYPTION_KEY_LEN;
-
- /* Encrypt tablespace key. */
- elen = my_aes_encrypt(
- reinterpret_cast<unsigned char*>(table->encryption_key),
- ENCRYPTION_KEY_LEN,
- ptr,
- reinterpret_cast<unsigned char*>(transfer_key),
- ENCRYPTION_KEY_LEN,
- my_aes_256_ecb,
- NULL, false);
-
- if (elen == MY_AES_BAD_DATA) {
- ib_senderrf(
- thd, IB_LOG_LEVEL_WARN, ER_IO_WRITE_ERROR,
- errno, strerror(errno),
- "while encrypt tablespace key.");
- return(DB_ERROR);
- }
-
- /* Write encrypted tablespace key */
- if (fwrite(ptr, 1, ENCRYPTION_KEY_LEN, file)
- != ENCRYPTION_KEY_LEN) {
- ib_senderrf(
- thd, IB_LOG_LEVEL_WARN, ER_IO_WRITE_ERROR,
- errno, strerror(errno),
- "while writing encrypted tablespace key.");
-
- return(DB_IO_ERROR);
- }
- ptr += ENCRYPTION_KEY_LEN;
-
- /* Encrypt tablespace iv. */
- elen = my_aes_encrypt(
- reinterpret_cast<unsigned char*>(table->encryption_iv),
- ENCRYPTION_KEY_LEN,
- ptr,
- reinterpret_cast<unsigned char*>(transfer_key),
- ENCRYPTION_KEY_LEN,
- my_aes_256_ecb,
- NULL, false);
-
- if (elen == MY_AES_BAD_DATA) {
- ib_senderrf(
- thd, IB_LOG_LEVEL_WARN, ER_IO_WRITE_ERROR,
- errno, strerror(errno),
- "while encrypt tablespace iv.");
- return(DB_ERROR);
- }
-
- /* Write encrypted tablespace iv */
- if (fwrite(ptr, 1, ENCRYPTION_KEY_LEN, file)
- != ENCRYPTION_KEY_LEN) {
- ib_senderrf(
- thd, IB_LOG_LEVEL_WARN, ER_IO_WRITE_ERROR,
- errno, strerror(errno),
- "while writing encrypted tablespace iv.");
-
- return(DB_IO_ERROR);
- }
-
- return(DB_SUCCESS);
-}
-
-/** Write the encryption data after quiesce.
-@param[in] table write the data for this table
-@param[in] thd session
-@return DB_SUCCESS or error code */
-static MY_ATTRIBUTE((nonnull, warn_unused_result))
-dberr_t
-row_quiesce_write_cfp(
- dict_table_t* table,
- THD* thd)
-{
- dberr_t err;
- char name[OS_FILE_MAX_PATH];
-
- /* If table is not encrypted, return. */
- if (!dict_table_is_encrypted(table)) {
- return(DB_SUCCESS);
- }
-
- /* Get the encryption key and iv from space */
- /* For encrypted table, before we discard the tablespace,
- we need save the encryption information into table, otherwise,
- this information will be lost in fil_discard_tablespace along
- with fil_space_free(). */
- if (table->encryption_key == NULL) {
- table->encryption_key =
- static_cast<byte*>(mem_heap_alloc(table->heap,
- ENCRYPTION_KEY_LEN));
-
- table->encryption_iv =
- static_cast<byte*>(mem_heap_alloc(table->heap,
- ENCRYPTION_KEY_LEN));
-
- fil_space_t* space = fil_space_get(table->space);
- ut_ad(space != NULL && FSP_FLAGS_GET_ENCRYPTION(space->flags));
-
- memcpy(table->encryption_key,
- space->encryption_key,
- ENCRYPTION_KEY_LEN);
- memcpy(table->encryption_iv,
- space->encryption_iv,
- ENCRYPTION_KEY_LEN);
- }
-
- srv_get_encryption_data_filename(table, name, sizeof(name));
-
- ib::info() << "Writing table encryption data to '" << name << "'";
-
- FILE* file = fopen(name, "w+b");
-
- if (file == NULL) {
- ib_errf(thd, IB_LOG_LEVEL_WARN, ER_CANT_CREATE_FILE,
- name, errno, strerror(errno));
-
- err = DB_IO_ERROR;
- } else {
- err = row_quiesce_write_transfer_key(table, file, thd);
-
- if (fflush(file) != 0) {
-
- char msg[BUFSIZ];
-
- ut_snprintf(msg, sizeof(msg), "%s flush() failed",
- name);
-
- ib_senderrf(
- thd, IB_LOG_LEVEL_WARN, ER_IO_WRITE_ERROR,
- errno, strerror(errno), msg);
-
- err = DB_IO_ERROR;
- }
-
- if (fclose(file) != 0) {
- char msg[BUFSIZ];
-
- ut_snprintf(msg, sizeof(msg), "%s flose() failed",
- name);
-
- ib_senderrf(
- thd, IB_LOG_LEVEL_WARN, ER_IO_WRITE_ERROR,
- errno, strerror(errno), msg);
- err = DB_IO_ERROR;
- }
- }
-
- /* Clean the encryption information */
- table->encryption_key = NULL;
- table->encryption_iv = NULL;
-
- return(err);
-}
-#endif /* MYSQL_ENCRYPTION */
-
/*********************************************************************//**
Check whether a table has an FTS index defined on it.
@return true if an FTS index exists on the table */
@@ -744,24 +540,9 @@ row_quiesce_table_start(
}
if (!trx_is_interrupted(trx)) {
- extern ib_mutex_t master_key_id_mutex;
-
-#ifdef MYSQL_ENCRYPTION
- if (dict_table_is_encrypted(table)) {
- /* Require the mutex to block key rotation. */
- mutex_enter(&master_key_id_mutex);
- }
-#endif /* MYSQL_ENCRYPTION */
-
buf_LRU_flush_or_remove_pages(
table->space, BUF_REMOVE_FLUSH_WRITE, trx);
-#ifdef MYSQL_ENCRYPTION
- if (dict_table_is_encrypted(table)) {
- mutex_exit(&master_key_id_mutex);
- }
-#endif /* MYSQL_ENCRYPTION */
-
if (trx_is_interrupted(trx)) {
ib::warn() << "Quiesce aborted!";
@@ -771,12 +552,6 @@ row_quiesce_table_start(
ib::warn() << "There was an error writing to the"
" meta data file";
-#ifdef MYSQL_ENCRYPTION
- } else if (row_quiesce_write_cfp(table, trx->mysql_thd)
- != DB_SUCCESS) {
- ib::warn() << "There was an error writing to the"
- " encryption info file";
-#endif /* MYSQL_ENCRYPTION */
} else {
ib::info() << "Table " << table->name
<< " flushed to disk";
@@ -829,19 +604,6 @@ row_quiesce_table_complete(
ib::info() << "Deleting the meta-data file '" << cfg_name << "'";
- if (dict_table_is_encrypted(table)) {
- char cfp_name[OS_FILE_MAX_PATH];
-
- srv_get_encryption_data_filename(table,
- cfp_name,
- sizeof(cfp_name));
-
- os_file_delete_if_exists(innodb_data_file_key, cfp_name, NULL);
-
- ib::info() << "Deleting the meta-data file '"
- << cfp_name << "'";
- }
-
if (trx_purge_state() != PURGE_STATE_DISABLED) {
trx_purge_run();
}
@@ -887,15 +649,6 @@ row_quiesce_set_state(
ER_TABLE_IN_SYSTEM_TABLESPACE, table_name);
return(DB_UNSUPPORTED);
-
- } else if (DICT_TF_HAS_SHARED_SPACE(table->flags)) {
- std::ostringstream err_msg;
- err_msg << "FLUSH TABLES FOR EXPORT on table " << table->name
- << " in a general tablespace.";
- ib_senderrf(trx->mysql_thd, IB_LOG_LEVEL_WARN,
- ER_NOT_SUPPORTED_YET, err_msg.str().c_str());
-
- return(DB_UNSUPPORTED);
} else if (row_quiesce_table_has_fts_index(table)) {
ib_senderrf(trx->mysql_thd, IB_LOG_LEVEL_WARN,
diff --git a/storage/innobase/row/row0sel.cc b/storage/innobase/row/row0sel.cc
index 967d0ac98cd..d8ab01cd16e 100644
--- a/storage/innobase/row/row0sel.cc
+++ b/storage/innobase/row/row0sel.cc
@@ -5273,7 +5273,7 @@ locks_ok:
This optimization can avoid many IOs for certain schemas.
*/
ibool row_contains_all_values = TRUE;
- int i;
+ uint i;
for (i = 0; i < prebuilt->n_template; i++) {
/* Condition (1) from above: is the field in the
index (prefix or not)? */
diff --git a/storage/innobase/row/row0trunc.cc b/storage/innobase/row/row0trunc.cc
index 1c118dabc61..1dea23bc657 100644
--- a/storage/innobase/row/row0trunc.cc
+++ b/storage/innobase/row/row0trunc.cc
@@ -1,6 +1,7 @@
/*****************************************************************************
Copyright (c) 2013, 2016, 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
@@ -395,8 +396,6 @@ public:
IORequest request(IORequest::WRITE);
- request.disable_compression();
-
io_err = os_file_write(
request, m_log_file_name, handle, log_buf, 0, sz);
@@ -488,8 +487,6 @@ public:
IORequest request(IORequest::WRITE);
- request.disable_compression();
-
err = os_file_write(
request,
m_log_file_name, handle, buffer, 0, sizeof(buffer));
@@ -671,8 +668,6 @@ TruncateLogParser::parse(
IORequest request(IORequest::READ);
- request.disable_compression();
-
/* Align the memory for file i/o if we might have O_DIRECT set*/
byte* log_buf = static_cast<byte*>(ut_align(buf, UNIV_PAGE_SIZE));
@@ -909,7 +904,7 @@ TruncateLogger::operator()(mtr_t* mtr, btr_pcur_t* pcur)
/* For compressed tables we need to store extra meta-data
required during btr_create(). */
- if (fsp_flags_is_compressed(m_flags)) {
+ if (FSP_FLAGS_GET_ZIP_SSIZE(m_flags)) {
const dict_index_t* dict_index = find(index.m_id);
@@ -1315,7 +1310,6 @@ row_truncate_fts(
fts_table.name = table->name;
fts_table.flags2 = table->flags2;
fts_table.flags = table->flags;
- fts_table.tablespace = table->tablespace;
fts_table.space = table->space;
/* table->data_dir_path is used for FTS AUX table
@@ -1326,20 +1320,6 @@ row_truncate_fts(
ut_ad(table->data_dir_path != NULL);
}
- /* table->tablespace() may not be always populated or
- if table->tablespace() uses "innodb_general" name,
- fetch the real name. */
- if (DICT_TF_HAS_SHARED_SPACE(table->flags)
- && (table->tablespace() == NULL
- || dict_table_has_temp_general_tablespace_name(
- table->tablespace()))) {
- dict_get_and_save_space_name(table, true);
- ut_ad(table->tablespace() != NULL);
- ut_ad(!dict_table_has_temp_general_tablespace_name(
- table->tablespace()));
- }
-
- fts_table.tablespace = table->tablespace();
fts_table.data_dir_path = table->data_dir_path;
dberr_t err;
@@ -1610,8 +1590,6 @@ row_truncate_prepare(dict_table_t* table, ulint* flags)
dict_get_and_save_data_dir_path(table, true);
- dict_get_and_save_space_name(table, true);
-
if (*flags != ULINT_UNDEFINED) {
dberr_t err = fil_prepare_for_truncate(table->space);
@@ -2015,9 +1993,9 @@ row_truncate_table_for_mysql(
return(row_truncate_complete(
table, trx, fsp_flags, logger, err));
}
-
} else {
/* For temporary tables we don't have entries in SYSTEM TABLES*/
+ ut_ad(fsp_is_system_temporary(table->space));
for (dict_index_t* index = UT_LIST_GET_FIRST(table->indexes);
index != NULL;
index = UT_LIST_GET_NEXT(indexes, index)) {
@@ -2040,10 +2018,7 @@ row_truncate_table_for_mysql(
}
}
- if (is_file_per_table
- && !dict_table_is_temporary(table)
- && fsp_flags != ULINT_UNDEFINED) {
-
+ if (is_file_per_table && fsp_flags != ULINT_UNDEFINED) {
fil_reinit_space_header(
table->space,
table->indexes.count + FIL_IBD_FILE_INITIAL_SIZE + 1);
@@ -2218,75 +2193,51 @@ truncate_t::fixup_tables_in_non_system_tablespace()
done and erased from this list. */
ut_a((*it)->m_space_id != TRX_SYS_SPACE);
- /* Step-1: Drop tablespace (only for single-tablespace),
- drop indexes and re-create indexes. */
-
- if (fsp_is_file_per_table((*it)->m_space_id,
- (*it)->m_tablespace_flags)) {
- /* The table is file_per_table */
-
- ib::info() << "Completing truncate for table with "
- "id (" << (*it)->m_old_table_id << ") "
- "residing in file-per-table tablespace with "
- "id (" << (*it)->m_space_id << ")";
-
- if (!fil_space_get((*it)->m_space_id)) {
+ /* Drop tablespace, drop indexes and re-create indexes. */
- /* Create the database directory for name,
- if it does not exist yet */
- fil_create_directory_for_tablename(
- (*it)->m_tablename);
+ ib::info() << "Completing truncate for table with "
+ "id (" << (*it)->m_old_table_id << ") "
+ "residing in file-per-table tablespace with "
+ "id (" << (*it)->m_space_id << ")";
- err = fil_ibd_create(
- (*it)->m_space_id,
- (*it)->m_tablename,
- (*it)->m_dir_path,
- (*it)->m_tablespace_flags,
- FIL_IBD_FILE_INITIAL_SIZE,
- (*it)->m_encryption,
- (*it)->m_key_id);
+ if (!fil_space_get((*it)->m_space_id)) {
- if (err != DB_SUCCESS) {
- /* If checkpoint is not yet done
- and table is dropped and then we might
- still have REDO entries for this table
- which are INVALID. Ignore them. */
- ib::warn() << "Failed to create"
- " tablespace for "
- << (*it)->m_space_id
- << " space-id";
- err = DB_ERROR;
- break;
- }
- }
+ /* Create the database directory for name,
+ if it does not exist yet */
+ fil_create_directory_for_tablename(
+ (*it)->m_tablename);
- ut_ad(fil_space_get((*it)->m_space_id));
-
- err = fil_recreate_tablespace(
+ err = fil_ibd_create(
(*it)->m_space_id,
- (*it)->m_format_flags,
- (*it)->m_tablespace_flags,
(*it)->m_tablename,
- **it, log_get_lsn());
-
- } else {
- /* Table is in a shared tablespace */
+ (*it)->m_dir_path,
+ (*it)->m_tablespace_flags,
+ FIL_IBD_FILE_INITIAL_SIZE,
+ (*it)->m_encryption,
+ (*it)->m_key_id);
- ib::info() << "Completing truncate for table with "
- "id (" << (*it)->m_old_table_id << ") "
- "residing in shared tablespace with "
- "id (" << (*it)->m_space_id << ")";
+ if (err != DB_SUCCESS) {
+ /* If checkpoint is not yet done
+ and table is dropped and then we might
+ still have REDO entries for this table
+ which are INVALID. Ignore them. */
+ ib::warn() << "Failed to create"
+ " tablespace for "
+ << (*it)->m_space_id
+ << " space-id";
+ err = DB_ERROR;
+ break;
+ }
+ }
- /* Temp-tables in temp-tablespace are never restored.*/
- ut_ad((*it)->m_space_id != SRV_TMP_SPACE_ID);
+ ut_ad(fil_space_get((*it)->m_space_id));
- err = fil_recreate_table(
- (*it)->m_space_id,
- (*it)->m_format_flags,
- (*it)->m_tablespace_flags,
- (*it)->m_tablename,
- **it);
- }
+ err = fil_recreate_tablespace(
+ (*it)->m_space_id,
+ (*it)->m_format_flags,
+ (*it)->m_tablespace_flags,
+ (*it)->m_tablename,
+ **it, log_get_lsn());
/* Step-2: Update the SYS_XXXX tables to reflect new
table-id and root_page_no. */
@@ -2630,7 +2581,7 @@ truncate_t::parse(
ut_ad(!m_indexes.empty());
- if (fsp_flags_is_compressed(m_tablespace_flags)) {
+ if (FSP_FLAGS_GET_ZIP_SSIZE(m_tablespace_flags)) {
/* Parse the number of index fields from TRUNCATE log record */
for (ulint i = 0; i < m_indexes.size(); ++i) {
@@ -2929,12 +2880,12 @@ truncate_t::create_indexes(
++it) {
btr_create_t btr_redo_create_info(
- fsp_flags_is_compressed(flags)
+ FSP_FLAGS_GET_ZIP_SSIZE(flags)
? &it->m_fields[0] : NULL);
btr_redo_create_info.format_flags = format_flags;
- if (fsp_flags_is_compressed(flags)) {
+ if (FSP_FLAGS_GET_ZIP_SSIZE(flags)) {
btr_redo_create_info.n_fields = it->m_n_fields;
/* Skip the NUL appended field */
@@ -3069,7 +3020,7 @@ truncate_t::write(
}
/* If tablespace compressed then field info of each index. */
- if (fsp_flags_is_compressed(flags)) {
+ if (FSP_FLAGS_GET_ZIP_SSIZE(flags)) {
for (ulint i = 0; i < m_indexes.size(); ++i) {
diff --git a/storage/innobase/row/row0vers.cc b/storage/innobase/row/row0vers.cc
index f21b1ebbb85..69e7a889de9 100644
--- a/storage/innobase/row/row0vers.cc
+++ b/storage/innobase/row/row0vers.cc
@@ -1,6 +1,7 @@
/*****************************************************************************
Copyright (c) 1997, 2016, 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
@@ -876,8 +877,8 @@ row_vers_old_has_index_entry(
mem_heap_t* v_heap = NULL;
const dtuple_t* cur_vrow = NULL;
- ut_ad(mtr_memo_contains_page(mtr, rec, MTR_MEMO_PAGE_X_FIX)
- || mtr_memo_contains_page(mtr, rec, MTR_MEMO_PAGE_S_FIX));
+ ut_ad(mtr_memo_contains_page_flagged(mtr, rec, MTR_MEMO_PAGE_X_FIX
+ | MTR_MEMO_PAGE_S_FIX));
ut_ad(!rw_lock_own(&(purge_sys->latch), RW_LOCK_S));
clust_index = dict_table_get_first_index(index->table);
@@ -1134,8 +1135,8 @@ row_vers_build_for_consistent_read(
dberr_t err;
ut_ad(dict_index_is_clust(index));
- ut_ad(mtr_memo_contains_page(mtr, rec, MTR_MEMO_PAGE_X_FIX)
- || mtr_memo_contains_page(mtr, rec, MTR_MEMO_PAGE_S_FIX));
+ ut_ad(mtr_memo_contains_page_flagged(mtr, rec, MTR_MEMO_PAGE_X_FIX
+ | MTR_MEMO_PAGE_S_FIX));
ut_ad(!rw_lock_own(&(purge_sys->latch), RW_LOCK_S));
ut_ad(rec_offs_validate(rec, index, *offsets));
@@ -1246,8 +1247,8 @@ row_vers_build_for_semi_consistent_read(
trx_id_t rec_trx_id = 0;
ut_ad(dict_index_is_clust(index));
- ut_ad(mtr_memo_contains_page(mtr, rec, MTR_MEMO_PAGE_X_FIX)
- || mtr_memo_contains_page(mtr, rec, MTR_MEMO_PAGE_S_FIX));
+ ut_ad(mtr_memo_contains_page_flagged(mtr, rec, MTR_MEMO_PAGE_X_FIX
+ | MTR_MEMO_PAGE_S_FIX));
ut_ad(!rw_lock_own(&(purge_sys->latch), RW_LOCK_S));
ut_ad(rec_offs_validate(rec, index, *offsets));
diff --git a/storage/innobase/srv/srv0mon.cc b/storage/innobase/srv/srv0mon.cc
index 00b7bd14c98..b2722c2a9bf 100644
--- a/storage/innobase/srv/srv0mon.cc
+++ b/storage/innobase/srv/srv0mon.cc
@@ -989,41 +989,6 @@ static monitor_info_t innodb_counter_info[] =
MONITOR_NONE,
MONITOR_DEFAULT_START, MONITOR_OVLD_PAGE_COMPRESS_SAVED},
- {"compress_trim_sect512", "compression",
- "Number of sect-512 TRIMed by page compression",
- MONITOR_NONE,
- MONITOR_DEFAULT_START, MONITOR_OVLD_PAGE_COMPRESS_TRIM_SECT512},
-
- {"compress_trim_sect1024", "compression",
- "Number of sect-1024 TRIMed by page compression",
- MONITOR_NONE,
- MONITOR_DEFAULT_START, MONITOR_OVLD_PAGE_COMPRESS_TRIM_SECT1024},
-
- {"compress_trim_sect2048", "compression",
- "Number of sect-2048 TRIMed by page compression",
- MONITOR_NONE,
- MONITOR_DEFAULT_START, MONITOR_OVLD_PAGE_COMPRESS_TRIM_SECT2048},
-
- {"compress_trim_sect4096", "compression",
- "Number of sect-4K TRIMed by page compression",
- MONITOR_NONE,
- MONITOR_DEFAULT_START, MONITOR_OVLD_PAGE_COMPRESS_TRIM_SECT4096},
-
- {"compress_trim_sect8192", "compression",
- "Number of sect-8K TRIMed by page compression",
- MONITOR_NONE,
- MONITOR_DEFAULT_START, MONITOR_OVLD_PAGE_COMPRESS_TRIM_SECT8192},
-
- {"compress_trim_sect16384", "compression",
- "Number of sect-16K TRIMed by page compression",
- MONITOR_NONE,
- MONITOR_DEFAULT_START, MONITOR_OVLD_PAGE_COMPRESS_TRIM_SECT16384},
-
- {"compress_trim_sect32768", "compression",
- "Number of sect-32K TRIMed by page compression",
- MONITOR_NONE,
- MONITOR_DEFAULT_START, MONITOR_OVLD_PAGE_COMPRESS_TRIM_SECT32768},
-
{"compress_pages_page_compressed", "compression",
"Number of pages compressed by page compression",
MONITOR_NONE,
@@ -1034,11 +999,6 @@ static monitor_info_t innodb_counter_info[] =
MONITOR_NONE,
MONITOR_DEFAULT_START, MONITOR_OVLD_PAGE_COMPRESSED_TRIM_OP},
- {"compress_page_compressed_trim_op_saved", "compression",
- "Number of TRIM operation saved by page compression",
- MONITOR_NONE,
- MONITOR_DEFAULT_START, MONITOR_OVLD_PAGE_COMPRESSED_TRIM_OP_SAVED},
-
{"compress_pages_page_decompressed", "compression",
"Number of pages decompressed by page compression",
MONITOR_NONE,
@@ -2073,36 +2033,12 @@ srv_mon_process_existing_counter(
case MONITOR_OVLD_PAGE_COMPRESS_SAVED:
value = srv_stats.page_compression_saved;
break;
- case MONITOR_OVLD_PAGE_COMPRESS_TRIM_SECT512:
- value = srv_stats.page_compression_trim_sect512;
- break;
- case MONITOR_OVLD_PAGE_COMPRESS_TRIM_SECT1024:
- value = srv_stats.page_compression_trim_sect1024;
- break;
- case MONITOR_OVLD_PAGE_COMPRESS_TRIM_SECT2048:
- value = srv_stats.page_compression_trim_sect2048;
- break;
- case MONITOR_OVLD_PAGE_COMPRESS_TRIM_SECT4096:
- value = srv_stats.page_compression_trim_sect4096;
- break;
- case MONITOR_OVLD_PAGE_COMPRESS_TRIM_SECT8192:
- value = srv_stats.page_compression_trim_sect8192;
- break;
- case MONITOR_OVLD_PAGE_COMPRESS_TRIM_SECT16384:
- value = srv_stats.page_compression_trim_sect16384;
- break;
- case MONITOR_OVLD_PAGE_COMPRESS_TRIM_SECT32768:
- value = srv_stats.page_compression_trim_sect32768;
- break;
case MONITOR_OVLD_PAGES_PAGE_COMPRESSED:
value = srv_stats.pages_page_compressed;
break;
case MONITOR_OVLD_PAGE_COMPRESSED_TRIM_OP:
value = srv_stats.page_compressed_trim_op;
break;
- case MONITOR_OVLD_PAGE_COMPRESSED_TRIM_OP_SAVED:
- value = srv_stats.page_compressed_trim_op_saved;
- break;
case MONITOR_OVLD_PAGES_PAGE_DECOMPRESSED:
value = srv_stats.pages_page_decompressed;
break;
diff --git a/storage/innobase/srv/srv0srv.cc b/storage/innobase/srv/srv0srv.cc
index 002477bc4e0..0fd5ff7afaf 100644
--- a/storage/innobase/srv/srv0srv.cc
+++ b/storage/innobase/srv/srv0srv.cc
@@ -184,7 +184,7 @@ my_bool srv_use_native_aio = TRUE;
my_bool srv_numa_interleave = FALSE;
/* If this flag is TRUE, then we will use fallocate(PUCH_HOLE)
to the pages */
-UNIV_INTERN my_bool srv_use_trim = FALSE;
+UNIV_INTERN my_bool srv_use_trim;
/* If this flag is TRUE, then we disable doublewrite buffer */
UNIV_INTERN my_bool srv_use_atomic_writes = FALSE;
/* If this flag IS TRUE, then we use this algorithm for page compressing the pages */
@@ -195,8 +195,6 @@ UNIV_INTERN long srv_mtflush_threads = MTFLUSH_DEFAULT_WORKER;
UNIV_INTERN my_bool srv_use_mtflush = FALSE;
#ifdef UNIV_DEBUG
-/** Force all user tables to use page compression. */
-ulong srv_debug_compress;
/** Used by SET GLOBAL innodb_master_thread_disabled_debug = X. */
my_bool srv_master_thread_disabled_debug;
/** Event used to inform that master thread is disabled. */
@@ -361,11 +359,6 @@ starting from SRV_FORCE_IGNORE_CORRUPT, so that data can be recovered
by SELECT or mysqldump. When this is nonzero, we do not allow any user
modifications to the data. */
ulong srv_force_recovery;
-#ifndef DBUG_OFF
-/** Inject a crash at different steps of the recovery process.
-This is for testing and debugging only. */
-ulong srv_force_recovery_crash;
-#endif /* !DBUG_OFF */
/** Print all user-level transactions deadlocks to mysqld stderr */
@@ -1014,11 +1007,10 @@ srv_free_slot(
srv_sys_mutex_exit();
}
-/*********************************************************************//**
-Initializes the server. */
+/** Initialize the server. */
+static
void
-srv_init(void)
-/*==========*/
+srv_init()
{
ulint n_sys_threads = 0;
ulint srv_sys_sz = sizeof(*srv_sys);
@@ -1104,6 +1096,10 @@ void
srv_free(void)
/*==========*/
{
+ if (!srv_sys) {
+ return;
+ }
+
mutex_free(&srv_innodb_monitor_mutex);
mutex_free(&page_zip_stat_per_index_mutex);
@@ -1138,22 +1134,6 @@ srv_free(void)
}
/*********************************************************************//**
-Initializes the synchronization primitives, memory system, and the thread
-local storage. */
-void
-srv_general_init(void)
-/*==================*/
-{
- sync_check_init();
- /* Reset the system variables in the recovery module. */
- recv_sys_var_init();
- os_thread_init();
- trx_pool_init();
- que_init();
- row_mysql_init();
-}
-
-/*********************************************************************//**
Normalizes init parameter values to use units we use inside InnoDB. */
static
void
@@ -1182,10 +1162,12 @@ srv_boot(void)
srv_normalize_init_values();
- /* Initialize synchronization primitives, memory management, and thread
- local storage */
-
- srv_general_init();
+ sync_check_init();
+ os_thread_init();
+ /* Reset the system variables in the recovery module. */
+ recv_sys_var_init();
+ trx_pool_init();
+ row_mysql_init();
/* Initialize this module */
@@ -1619,13 +1601,10 @@ srv_export_innodb_status(void)
export_vars.innodb_available_undo_logs = srv_available_undo_logs;
export_vars.innodb_page_compression_saved = srv_stats.page_compression_saved;
- export_vars.innodb_page_compression_trim_sect512 = srv_stats.page_compression_trim_sect512;
- export_vars.innodb_page_compression_trim_sect4096 = srv_stats.page_compression_trim_sect4096;
export_vars.innodb_index_pages_written = srv_stats.index_pages_written;
export_vars.innodb_non_index_pages_written = srv_stats.non_index_pages_written;
export_vars.innodb_pages_page_compressed = srv_stats.pages_page_compressed;
export_vars.innodb_page_compressed_trim_op = srv_stats.page_compressed_trim_op;
- export_vars.innodb_page_compressed_trim_op_saved = srv_stats.page_compressed_trim_op_saved;
export_vars.innodb_pages_page_decompressed = srv_stats.pages_page_decompressed;
export_vars.innodb_pages_page_compression_error = srv_stats.pages_page_compression_error;
export_vars.innodb_pages_decrypted = srv_stats.pages_decrypted;
@@ -2023,13 +2002,19 @@ srv_get_active_thread_type(void)
srv_sys_mutex_exit();
- /* Check only on shutdown. */
- if (ret == SRV_NONE
- && srv_shutdown_state != SRV_SHUTDOWN_NONE
- && trx_purge_state() != PURGE_STATE_DISABLED
- && trx_purge_state() != PURGE_STATE_EXIT) {
-
- ret = SRV_PURGE;
+ if (ret == SRV_NONE && srv_shutdown_state != SRV_SHUTDOWN_NONE
+ && purge_sys != NULL) {
+ /* Check only on shutdown. */
+ switch (trx_purge_state()) {
+ case PURGE_STATE_RUN:
+ case PURGE_STATE_STOP:
+ ret = SRV_PURGE;
+ break;
+ case PURGE_STATE_INIT:
+ case PURGE_STATE_DISABLED:
+ case PURGE_STATE_EXIT:
+ break;
+ }
}
return(ret);
@@ -2725,7 +2710,6 @@ DECLARE_THREAD(srv_worker_thread)(
ut_a(!purge_sys->running);
ut_a(purge_sys->state == PURGE_STATE_EXIT);
- ut_a(srv_shutdown_state > SRV_SHUTDOWN_NONE || thd_kill_level(thd));
rw_lock_x_unlock(&purge_sys->latch);
@@ -3159,11 +3143,6 @@ srv_was_tablespace_truncated(const fil_space_t* space)
return(false);
}
- bool has_shared_space = FSP_FLAGS_GET_SHARED(space->flags);
-
- if (is_system_tablespace(space->id) || has_shared_space) {
- return(false);
- }
-
- return(truncate_t::was_tablespace_truncated(space->id));
+ return (!is_system_tablespace(space->id)
+ && truncate_t::was_tablespace_truncated(space->id));
}
diff --git a/storage/innobase/srv/srv0start.cc b/storage/innobase/srv/srv0start.cc
index 56576c2f29e..1d17bff4782 100644
--- a/storage/innobase/srv/srv0start.cc
+++ b/storage/innobase/srv/srv0start.cc
@@ -418,12 +418,12 @@ create_log_files(
file should be recoverable. The buffer
pool was clean, and we can simply create
all log files from the scratch. */
- RECOVERY_CRASH(6);
+ DBUG_EXECUTE_IF("innodb_log_abort_6", return(DB_ERROR););
}
ut_ad(!buf_pool_check_no_pending_io());
- RECOVERY_CRASH(7);
+ DBUG_EXECUTE_IF("innodb_log_abort_7", return(DB_ERROR););
for (unsigned i = 0; i < srv_n_log_files; i++) {
sprintf(logfilename + dirnamelen,
@@ -436,19 +436,15 @@ create_log_files(
}
}
- RECOVERY_CRASH(8);
+ DBUG_EXECUTE_IF("innodb_log_abort_8", return(DB_ERROR););
/* We did not create the first log file initially as
ib_logfile0, so that crash recovery cannot find it until it
has been completed and renamed. */
sprintf(logfilename + dirnamelen, "ib_logfile%u", INIT_LOG_FILE0);
- /* Disable the doublewrite buffer for log files, not required */
-
fil_space_t* log_space = fil_space_create(
- "innodb_redo_log", SRV_LOG_SPACE_FIRST_ID,
- fsp_flags_set_page_size(0, univ_page_size),
- FIL_TYPE_LOG,
+ "innodb_redo_log", SRV_LOG_SPACE_FIRST_ID, 0, FIL_TYPE_LOG,
NULL, /* No encryption yet */
true /* this is create */);
ut_a(fil_validate());
@@ -492,10 +488,16 @@ create_log_files(
return(DB_SUCCESS);
}
-/*********************************************************************//**
-Renames the first log file. */
+/** Rename the first redo log file.
+@param[in,out] logfilename buffer for the log file name
+@param[in] dirnamelen length of the directory path
+@param[in] lsn FIL_PAGE_FILE_FLUSH_LSN value
+@param[in,out] logfile0 name of the first log file
+@return error code
+@retval DB_SUCCESS on successful operation */
+MY_ATTRIBUTE((warn_unused_result, nonnull))
static
-void
+dberr_t
create_log_files_rename(
/*====================*/
char* logfilename, /*!< in/out: buffer for log file name */
@@ -506,6 +508,9 @@ create_log_files_rename(
/* If innodb_flush_method=O_DSYNC,
we need to explicitly flush the log buffers. */
fil_flush(SRV_LOG_SPACE_FIRST_ID);
+
+ DBUG_EXECUTE_IF("innodb_log_abort_9", return(DB_ERROR););
+
/* Close the log files, so that we can rename
the first one. */
fil_close_log_files(false);
@@ -514,26 +519,26 @@ create_log_files_rename(
checkpoint has been created. */
sprintf(logfilename + dirnamelen, "ib_logfile%u", 0);
- RECOVERY_CRASH(9);
-
ib::info() << "Renaming log file " << logfile0 << " to "
<< logfilename;
log_mutex_enter();
ut_ad(strlen(logfile0) == 2 + strlen(logfilename));
- bool success = os_file_rename(
- innodb_log_file_key, logfile0, logfilename);
- ut_a(success);
-
- RECOVERY_CRASH(10);
+ dberr_t err = os_file_rename(
+ innodb_log_file_key, logfile0, logfilename)
+ ? DB_SUCCESS : DB_ERROR;
/* Replace the first file with ib_logfile0. */
strcpy(logfile0, logfilename);
log_mutex_exit();
+ DBUG_EXECUTE_IF("innodb_log_abort_10", err = DB_ERROR;);
+
fil_open_log_and_system_tablespace_files();
ib::warn() << "New log files created, LSN=" << lsn;
+
+ return(err);
}
/*********************************************************************//**
@@ -645,7 +650,6 @@ srv_undo_tablespace_open(
{
os_file_t fh;
bool ret;
- ulint flags;
dberr_t err = DB_ERROR;
char undo_name[sizeof "innodb_undo000"];
@@ -690,11 +694,9 @@ srv_undo_tablespace_open(
fil_set_max_space_id_if_bigger(space_id);
- /* Set the compressed page size to 0 (non-compressed) */
- flags = fsp_flags_init(
- univ_page_size, false, false, false, false, false, 0, 0);
space = fil_space_create(
- undo_name, space_id, flags, FIL_TYPE_TABLESPACE, NULL, true);
+ undo_name, space_id, FSP_FLAGS_PAGE_SSIZE(),
+ FIL_TYPE_TABLESPACE, NULL, true);
ut_a(fil_validate());
ut_a(space);
@@ -1124,8 +1126,6 @@ srv_open_tmp_tablespace(bool create_new_db)
srv_tmp_space.set_space_id(SRV_TMP_SPACE_ID);
- RECOVERY_CRASH(100);
-
dberr_t err = srv_tmp_space.check_file_spec(
&create_new_temp_space, 12 * 1024 * 1024);
@@ -1281,7 +1281,6 @@ srv_shutdown_all_bg_threads()
os_thread_sleep(100000);
if (!active) {
- srv_start_state = SRV_START_STATE_NONE;
return;
}
}
@@ -1306,6 +1305,7 @@ srv_shutdown_all_bg_threads()
@param[in] line Line number
@param[in] err Reason for aborting InnoDB startup
@return DB_SUCCESS or error code. */
+MY_ATTRIBUTE((warn_unused_result, nonnull))
static
dberr_t
srv_init_abort_low(
@@ -1353,7 +1353,7 @@ srv_prepare_to_delete_redo_log_files(
/* Clean the buffer pool. */
buf_flush_sync_all_buf_pools();
- RECOVERY_CRASH(1);
+ DBUG_EXECUTE_IF("innodb_log_abort_1", return(0););
log_mutex_enter();
@@ -1418,9 +1418,7 @@ innobase_start_or_create_for_mysql(void)
{
bool create_new_db = false;
lsn_t flushed_lsn;
- ulint sum_of_data_file_sizes;
- ulint tablespace_size_in_header;
- dberr_t err;
+ dberr_t err = DB_SUCCESS;
ulint srv_n_log_files_found = srv_n_log_files;
mtr_t mtr;
purge_pq_t* purge_queue;
@@ -1454,21 +1452,7 @@ innobase_start_or_create_for_mysql(void)
}
#endif /* HAVE_LZO1X */
-#ifdef UNIV_LINUX
-# ifdef HAVE_FALLOC_PUNCH_HOLE_AND_KEEP_SIZE
- ib::info() << "PUNCH HOLE support available";
-# else
- ib::info() << "PUNCH HOLE support not available";
-# endif /* HAVE_FALLOC_PUNCH_HOLE_AND_KEEP_SIZE */
-#endif /* UNIV_LINUX */
-
- if (sizeof(ulint) != sizeof(void*)) {
- ib::error() << "Size of InnoDB's ulint is " << sizeof(ulint)
- << ", but size of void* is " << sizeof(void*)
- << ". The sizes should be the same so that on"
- " a 64-bit platforms you can allocate more than 4 GB"
- " of memory.";
- }
+ compile_time_assert(sizeof(ulint) == sizeof(void*));
#ifdef UNIV_DEBUG
ib::info() << "!!!!!!!! UNIV_DEBUG switched on !!!!!!!!!";
@@ -1581,7 +1565,7 @@ innobase_start_or_create_for_mysql(void)
ib::error() << "Unrecognized value "
<< srv_file_flush_method_str
<< " for innodb_flush_method";
- return(srv_init_abort(DB_ERROR));
+ err = DB_ERROR;
}
/* Note that the call srv_boot() also changes the values of
@@ -1676,6 +1660,10 @@ innobase_start_or_create_for_mysql(void)
srv_boot();
+ if (err != DB_SUCCESS) {
+ return(srv_init_abort(err));
+ }
+
ib::info() << ut_crc32_implementation;
if (!srv_read_only_mode) {
@@ -1974,14 +1962,17 @@ innobase_start_or_create_for_mysql(void)
logfilename, dirnamelen,
flushed_lsn, logfile0);
+ if (err == DB_SUCCESS) {
+ err = create_log_files_rename(
+ logfilename,
+ dirnamelen,
+ flushed_lsn, logfile0);
+ }
+
if (err != DB_SUCCESS) {
return(srv_init_abort(err));
}
- create_log_files_rename(
- logfilename, dirnamelen,
- flushed_lsn, logfile0);
-
/* Suppress the message about
crash recovery. */
flushed_lsn = log_get_lsn();
@@ -2043,8 +2034,7 @@ innobase_start_or_create_for_mysql(void)
/* Disable the doublewrite buffer for log files. */
fil_space_t* log_space = fil_space_create(
"innodb_redo_log",
- SRV_LOG_SPACE_FIRST_ID,
- fsp_flags_set_page_size(0, univ_page_size),
+ SRV_LOG_SPACE_FIRST_ID, 0,
FIL_TYPE_LOG,
NULL /* no encryption yet */,
true /* create */);
@@ -2105,8 +2095,6 @@ files_checked:
trx_sys_create();
if (create_new_db) {
- dberr_t err = DB_SUCCESS;
-
ut_a(!srv_read_only_mode);
mtr_start(&mtr);
@@ -2144,13 +2132,15 @@ files_checked:
err = fil_write_flushed_lsn(flushed_lsn);
+ if (err == DB_SUCCESS) {
+ err = create_log_files_rename(
+ logfilename, dirnamelen,
+ flushed_lsn, logfile0);
+ }
+
if (err != DB_SUCCESS) {
return(srv_init_abort(err));
}
-
- create_log_files_rename(
- logfilename, dirnamelen, flushed_lsn, logfile0);
-
} else {
/* Check if we support the max format that is stamped
@@ -2198,10 +2188,13 @@ files_checked:
if (err == DB_SUCCESS) {
/* Initialize the change buffer. */
err = dict_boot();
- } else {
+ }
+
+ if (err != DB_SUCCESS) {
return(srv_init_abort(err));
}
+ /* This must precede recv_apply_hashed_log_recs(TRUE). */
purge_queue = trx_sys_init_at_db_start();
if (srv_force_recovery < SRV_FORCE_NO_LOG_REDO) {
@@ -2209,12 +2202,11 @@ files_checked:
respective file pages, for the last batch of
recv_group_scan_log_recs(). */
- dberr_t err = recv_apply_hashed_log_recs(TRUE);
+ err = recv_apply_hashed_log_recs(TRUE);
DBUG_PRINT("ib_log", ("apply completed"));
if (err != DB_SUCCESS) {
- ib::warn() << "recv_apply_hashed_log_recs "
- << " failed with error " << err;
+ return(srv_init_abort(err));
}
if (recv_needed_recovery) {
@@ -2233,6 +2225,65 @@ files_checked:
" InnoDB database from a backup!";
}
+ if (!srv_read_only_mode) {
+ const ulint flags = FSP_FLAGS_PAGE_SSIZE();
+ for (ulint id = 0; id <= srv_undo_tablespaces; id++) {
+ if (fil_space_get(id)) {
+ fsp_flags_try_adjust(id, flags);
+ }
+ }
+
+ if (sum_of_new_sizes > 0) {
+ /* New data file(s) were added */
+ mtr.start();
+ fsp_header_inc_size(0, sum_of_new_sizes, &mtr);
+ mtr.commit();
+ /* Immediately write the log record about
+ increased tablespace size to disk, so that it
+ is durable even if mysqld would crash
+ quickly */
+ log_buffer_flush_to_disk();
+ }
+ }
+
+ const ulint tablespace_size_in_header
+ = fsp_header_get_tablespace_size();
+ const ulint sum_of_data_file_sizes
+ = srv_sys_space.get_sum_of_sizes();
+ /* Compare the system tablespace file size to what is
+ stored in FSP_SIZE. In open_or_create_data_files()
+ we already checked that the file sizes match the
+ innodb_data_file_path specification. */
+ if (srv_read_only_mode
+ || sum_of_data_file_sizes == tablespace_size_in_header) {
+ /* Do not complain about the size. */
+ } else if (!srv_sys_space.can_auto_extend_last_file()
+ || sum_of_data_file_sizes
+ < tablespace_size_in_header) {
+ ib::error() << "Tablespace size stored in header is "
+ << tablespace_size_in_header
+ << " pages, but the sum of data file sizes is "
+ << sum_of_data_file_sizes << " pages";
+
+ if (srv_force_recovery == 0
+ && sum_of_data_file_sizes
+ < tablespace_size_in_header) {
+ ib::error() <<
+ "Cannot start InnoDB. The tail of"
+ " the system tablespace is"
+ " missing. Have you edited"
+ " innodb_data_file_path in my.cnf"
+ " in an inappropriate way, removing"
+ " data files from there?"
+ " You can set innodb_force_recovery=1"
+ " in my.cnf to force"
+ " a startup if you are trying to"
+ " recover a badly corrupt database.";
+
+ return(srv_init_abort(DB_ERROR));
+ }
+ }
+
/* The purge system needs to create the purge view and
therefore requires that the trx_sys is inited. */
@@ -2289,17 +2340,6 @@ files_checked:
dict_check_tablespaces_and_store_max_id(validate);
}
-#ifdef MYSQL_ENCRYPTION
- /* Rotate the encryption key for recovery. It's because
- server could crash in middle of key rotation. Some tablespace
- didn't complete key rotation. Here, we will resume the
- rotation. */
- if (!srv_read_only_mode
- && srv_force_recovery < SRV_FORCE_NO_LOG_REDO) {
- fil_encryption_rotate();
- }
-#endif /* MYSQL_ENCRYPTION */
-
/* Fix-up truncate of table if server crashed while truncate
was active. */
err = truncate_t::fixup_tables_in_non_system_tablespace();
@@ -2312,8 +2352,6 @@ files_checked:
&& !recv_sys->found_corrupt_log
&& (srv_log_file_size_requested != srv_log_file_size
|| srv_n_log_files_found != srv_n_log_files)) {
- dberr_t err = DB_SUCCESS;
-
/* Prepare to replace the redo log files. */
if (srv_read_only_mode) {
@@ -2325,28 +2363,32 @@ files_checked:
/* Prepare to delete the old redo log files */
flushed_lsn = srv_prepare_to_delete_redo_log_files(i);
+ DBUG_EXECUTE_IF("innodb_log_abort_1",
+ return(srv_init_abort(DB_ERROR)););
/* Prohibit redo log writes from any other
threads until creating a log checkpoint at the
end of create_log_files(). */
ut_d(recv_no_log_write = true);
ut_ad(!buf_pool_check_no_pending_io());
- RECOVERY_CRASH(3);
+ DBUG_EXECUTE_IF("innodb_log_abort_3",
+ return(srv_init_abort(DB_ERROR)););
/* Stamp the LSN to the data files. */
err = fil_write_flushed_lsn(flushed_lsn);
+ DBUG_EXECUTE_IF("innodb_log_abort_4", err = DB_ERROR;);
+
if (err != DB_SUCCESS) {
return(srv_init_abort(err));
}
- RECOVERY_CRASH(4);
-
/* Close and free the redo log files, so that
we can replace them. */
fil_close_log_files(true);
- RECOVERY_CRASH(5);
+ DBUG_EXECUTE_IF("innodb_log_abort_5",
+ return(srv_init_abort(DB_ERROR)););
/* Free the old log file space. */
log_group_close_all();
@@ -2360,13 +2402,15 @@ files_checked:
logfilename, dirnamelen, flushed_lsn,
logfile0);
+ if (err == DB_SUCCESS) {
+ err = create_log_files_rename(
+ logfilename, dirnamelen, flushed_lsn,
+ logfile0);
+ }
+
if (err != DB_SUCCESS) {
return(srv_init_abort(err));
}
-
- create_log_files_rename(
- logfilename, dirnamelen, flushed_lsn,
- logfile0);
}
recv_recovery_rollback_active();
@@ -2379,20 +2423,8 @@ files_checked:
trx_sys_file_format_tag_init();
}
- if (!create_new_db && sum_of_new_sizes > 0) {
- /* New data file(s) were added */
- mtr_start(&mtr);
-
- fsp_header_inc_size(0, sum_of_new_sizes, &mtr);
-
- mtr_commit(&mtr);
-
- /* Immediately write the log record about increased tablespace
- size to disk, so that it is durable even if mysqld would crash
- quickly */
-
- log_buffer_flush_to_disk();
- }
+ ut_ad(err == DB_SUCCESS);
+ ut_a(sum_of_new_sizes != ULINT_UNDEFINED);
/* Open temp-tablespace and keep it open until shutdown. */
@@ -2401,6 +2433,7 @@ files_checked:
if (err != DB_SUCCESS) {
return(srv_init_abort(err));
}
+
/* Create the doublewrite buffer to a new tablespace */
if (buf_dblwr == NULL && !buf_dblwr_create()) {
return(srv_init_abort(DB_ERROR));
@@ -2548,68 +2581,6 @@ files_checked:
}
}
- sum_of_data_file_sizes = srv_sys_space.get_sum_of_sizes();
- ut_a(sum_of_new_sizes != ULINT_UNDEFINED);
-
- tablespace_size_in_header = fsp_header_get_tablespace_size();
-
- if (!srv_read_only_mode
- && !srv_sys_space.can_auto_extend_last_file()
- && sum_of_data_file_sizes != tablespace_size_in_header) {
-
- ib::error() << "Tablespace size stored in header is "
- << tablespace_size_in_header << " pages, but the sum"
- " of data file sizes is " << sum_of_data_file_sizes
- << " pages";
-
- if (srv_force_recovery == 0
- && sum_of_data_file_sizes < tablespace_size_in_header) {
- /* This is a fatal error, the tail of a tablespace is
- missing */
-
- ib::error()
- << "Cannot start InnoDB."
- " The tail of the system tablespace is"
- " missing. Have you edited"
- " innodb_data_file_path in my.cnf in an"
- " inappropriate way, removing"
- " ibdata files from there?"
- " You can set innodb_force_recovery=1"
- " in my.cnf to force"
- " a startup if you are trying"
- " to recover a badly corrupt database.";
-
- return(srv_init_abort(DB_ERROR));
- }
- }
-
- if (!srv_read_only_mode
- && srv_sys_space.can_auto_extend_last_file()
- && sum_of_data_file_sizes < tablespace_size_in_header) {
-
- ib::error() << "Tablespace size stored in header is "
- << tablespace_size_in_header << " pages, but the sum"
- " of data file sizes is only "
- << sum_of_data_file_sizes << " pages";
-
- if (srv_force_recovery == 0) {
-
- ib::error()
- << "Cannot start InnoDB. The tail of"
- " the system tablespace is"
- " missing. Have you edited"
- " innodb_data_file_path in my.cnf in an"
- " InnoDB: inappropriate way, removing"
- " ibdata files from there?"
- " You can set innodb_force_recovery=1"
- " in my.cnf to force"
- " InnoDB: a startup if you are trying to"
- " recover a badly corrupt database.";
-
- return(srv_init_abort(DB_ERROR));
- }
- }
-
if (srv_print_verbose_log) {
ib::info() << INNODB_VERSION_STR
<< " started; log sequence number "
@@ -2621,23 +2592,6 @@ files_checked:
<< srv_force_recovery << " !!!";
}
- if (!srv_read_only_mode) {
- /* Create thread(s) that handles key rotation. This is
- needed already here as log_preflush_pool_modified_pages
- will flush dirty pages and that might need e.g.
- fil_crypt_threads_event. */
- fil_system_enter();
- fil_crypt_threads_init();
- fil_system_exit();
-
- /*
- Create a checkpoint before logging anything new, so that
- the current encryption key in use is definitely logged
- before any log blocks encrypted with that key.
- */
- log_make_checkpoint_at(LSN_MAX, TRUE);
- }
-
if (srv_force_recovery == 0) {
/* In the insert buffer we may have even bigger tablespace
id's, because we may have dropped those tablespaces, but
@@ -2673,6 +2627,21 @@ files_checked:
}
#endif /* WITH_WSREP */
+ /* Create thread(s) that handles key rotation. This is
+ needed already here as log_preflush_pool_modified_pages
+ will flush dirty pages and that might need e.g.
+ fil_crypt_threads_event. */
+ fil_system_enter();
+ fil_crypt_threads_init();
+ fil_system_exit();
+
+ /*
+ Create a checkpoint before logging anything new, so that
+ the current encryption key in use is definitely logged
+ before any log blocks encrypted with that key.
+ */
+ log_make_checkpoint_at(LSN_MAX, TRUE);
+
/* Create the dict stats gathering thread */
dict_stats_thread_handle = os_thread_create(
dict_stats_thread, NULL, NULL);
@@ -2682,6 +2651,12 @@ files_checked:
/* Create the thread that will optimize the FTS sub-system. */
fts_optimize_init();
+ /* Init data for datafile scrub threads */
+ btr_scrub_init();
+
+ /* Initialize online defragmentation. */
+ btr_defragment_init();
+
srv_start_state_set(SRV_START_STATE_STAT);
}
@@ -2689,12 +2664,6 @@ files_checked:
srv_buf_resize_thread_active = true;
os_thread_create(buf_resize_thread, NULL, NULL);
- /* Init data for datafile scrub threads */
- btr_scrub_init();
-
- /* Initialize online defragmentation. */
- btr_defragment_init();
-
srv_was_started = TRUE;
return(DB_SUCCESS);
}
@@ -2735,27 +2704,18 @@ void
srv_shutdown_bg_undo_sources(void)
/*===========================*/
{
- fts_optimize_shutdown();
- dict_stats_shutdown();
+ if (srv_start_state_is_set(SRV_START_STATE_STAT)) {
+ ut_ad(!srv_read_only_mode);
+ fts_optimize_shutdown();
+ dict_stats_shutdown();
+ }
}
-/****************************************************************//**
-Shuts down the InnoDB database.
-@return DB_SUCCESS or error code */
-dberr_t
-innobase_shutdown_for_mysql(void)
-/*=============================*/
+/** Shut down InnoDB. */
+void
+innodb_shutdown()
{
- if (!srv_was_started) {
- if (srv_is_being_started) {
- ib::warn() << "Shutting down an improperly started,"
- " or created database!";
- }
-
- return(DB_SUCCESS);
- }
-
- if (!srv_read_only_mode && srv_fast_shutdown) {
+ if (srv_fast_shutdown) {
srv_shutdown_bg_undo_sources();
}
@@ -2794,23 +2754,51 @@ innobase_shutdown_for_mysql(void)
srv_misc_tmpfile = 0;
}
- if (!srv_read_only_mode) {
+ ut_ad(dict_stats_event || !srv_was_started || srv_read_only_mode);
+ ut_ad(dict_sys || !srv_was_started);
+ ut_ad(trx_sys || !srv_was_started);
+ ut_ad(buf_dblwr || !srv_was_started);
+ ut_ad(lock_sys || !srv_was_started);
+ ut_ad(btr_search_sys || !srv_was_started);
+ ut_ad(ibuf || !srv_was_started);
+ ut_ad(log_sys || !srv_was_started);
+
+ if (dict_stats_event) {
dict_stats_thread_deinit();
- fil_crypt_threads_cleanup();
}
- /* Cleanup data for datafile scrubbing */
- btr_scrub_cleanup();
+ if (srv_start_state_is_set(SRV_START_STATE_STAT)) {
+ ut_ad(!srv_read_only_mode);
+ /* srv_shutdown_bg_undo_sources() already invoked
+ fts_optimize_shutdown(); dict_stats_shutdown(); */
+
+ fil_crypt_threads_cleanup();
+ btr_scrub_cleanup();
+ /* FIXME: call btr_defragment_shutdown(); */
+ }
/* This must be disabled before closing the buffer pool
and closing the data dictionary. */
- btr_search_disable(true);
- ibuf_close();
- log_shutdown();
- trx_sys_file_format_close();
- trx_sys_close();
- lock_sys_close();
+ if (dict_sys) {
+ btr_search_disable(true);
+ }
+ if (ibuf) {
+ ibuf_close();
+ }
+ if (log_sys) {
+ log_shutdown();
+ }
+ if (trx_sys) {
+ trx_sys_file_format_close();
+ trx_sys_close();
+ }
+ if (buf_dblwr) {
+ buf_dblwr_free();
+ }
+ if (lock_sys) {
+ lock_sys_close();
+ }
trx_pool_close();
@@ -2822,13 +2810,17 @@ innobase_shutdown_for_mysql(void)
mutex_free(&srv_misc_tmpfile_mutex);
}
- dict_close();
- btr_search_sys_free();
+ if (dict_sys) {
+ dict_close();
+ }
+
+ if (btr_search_sys) {
+ btr_search_sys_free();
+ }
/* 3. Free all InnoDB's own mutexes and the os_fast_mutexes inside
them */
os_aio_free();
- que_close();
row_mysql_close();
srv_free();
fil_close();
@@ -2849,15 +2841,14 @@ innobase_shutdown_for_mysql(void)
fclose(dict_foreign_err_file);
}
- if (srv_print_verbose_log) {
+ if (srv_was_started && srv_print_verbose_log) {
ib::info() << "Shutdown completed; log sequence number "
<< srv_shutdown_lsn;
}
+ srv_start_state = SRV_START_STATE_NONE;
srv_was_started = FALSE;
srv_start_has_been_called = FALSE;
-
- return(DB_SUCCESS);
}
/********************************************************************
@@ -2970,36 +2961,3 @@ srv_get_meta_data_filename(
ut_free(path);
}
-/** Get the encryption-data filename from the table name for a
-single-table tablespace.
-@param[in] table table object
-@param[out] filename filename
-@param[in] max_len filename max length */
-void
-srv_get_encryption_data_filename(
- dict_table_t* table,
- char* filename,
- ulint max_len)
-{
- ulint len;
- char* path;
- /* Make sure the data_dir_path is set. */
- dict_get_and_save_data_dir_path(table, false);
-
- if (DICT_TF_HAS_DATA_DIR(table->flags)) {
- ut_a(table->data_dir_path);
-
- path = fil_make_filepath(
- table->data_dir_path, table->name.m_name, CFP, true);
- } else {
- path = fil_make_filepath(NULL, table->name.m_name, CFP, false);
- }
-
- ut_a(path);
- len = ut_strlen(path);
- ut_a(max_len >= len);
-
- strcpy(filename, path);
-
- ut_free(path);
-}
diff --git a/storage/innobase/sync/sync0arr.cc b/storage/innobase/sync/sync0arr.cc
index f01149f8a8d..c9423a04fba 100644
--- a/storage/innobase/sync/sync0arr.cc
+++ b/storage/innobase/sync/sync0arr.cc
@@ -1340,7 +1340,7 @@ sync_arr_fill_sys_semphore_waits_table(
*/
OK(field_store_string(fields[SYS_SEMAPHORE_WAITS_FILE], innobase_basename(cell->file)));
OK(field_store_ulint(fields[SYS_SEMAPHORE_WAITS_LINE], cell->line));
- OK(field_store_ulint(fields[SYS_SEMAPHORE_WAITS_WAIT_TIME], (longlong)difftime(time(NULL), cell->reservation_time)));
+ OK(field_store_ulint(fields[SYS_SEMAPHORE_WAITS_WAIT_TIME], (ulint)difftime(time(NULL), cell->reservation_time)));
if (type == SYNC_MUTEX) {
mutex = static_cast<WaitMutex*>(cell->latch.mutex);
diff --git a/storage/innobase/sync/sync0debug.cc b/storage/innobase/sync/sync0debug.cc
index c9b37cbbb09..1d9e8933185 100644
--- a/storage/innobase/sync/sync0debug.cc
+++ b/storage/innobase/sync/sync0debug.cc
@@ -1544,8 +1544,6 @@ sync_latch_meta_init()
LATCH_ADD(SYNC_DEBUG_MUTEX, SYNC_NO_ORDER_CHECK, PFS_NOT_INSTRUMENTED);
- LATCH_ADD(MASTER_KEY_ID_MUTEX, SYNC_NO_ORDER_CHECK, master_key_id_mutex_key);
-
/* JAN: TODO: Add PFS instrumentation */
LATCH_ADD(SCRUB_STAT_MUTEX, SYNC_NO_ORDER_CHECK, PFS_NOT_INSTRUMENTED);
LATCH_ADD(DEFRAGMENT_MUTEX, SYNC_NO_ORDER_CHECK, PFS_NOT_INSTRUMENTED);
diff --git a/storage/innobase/sync/sync0rw.cc b/storage/innobase/sync/sync0rw.cc
index 5f617ae22f5..5cb90ce5b8d 100644
--- a/storage/innobase/sync/sync0rw.cc
+++ b/storage/innobase/sync/sync0rw.cc
@@ -498,7 +498,7 @@ rw_lock_x_lock_wait_func(
rw_lock_stats.rw_x_spin_round_count.add(n_spins);
if (count_os_wait > 0) {
- lock->count_os_wait += count_os_wait;
+ lock->count_os_wait += static_cast<uint32_t>(count_os_wait);
rw_lock_stats.rw_x_os_wait_count.add(count_os_wait);
}
diff --git a/storage/innobase/sync/sync0sync.cc b/storage/innobase/sync/sync0sync.cc
index 9aba075caa6..099a56c5457 100644
--- a/storage/innobase/sync/sync0sync.cc
+++ b/storage/innobase/sync/sync0sync.cc
@@ -98,7 +98,6 @@ mysql_pfs_key_t sync_array_mutex_key;
mysql_pfs_key_t thread_mutex_key;
mysql_pfs_key_t zip_pad_mutex_key;
mysql_pfs_key_t row_drop_list_mutex_key;
-mysql_pfs_key_t master_key_id_mutex_key;
#endif /* UNIV_PFS_MUTEX */
#ifdef UNIV_PFS_RWLOCK
mysql_pfs_key_t btr_search_latch_key;
diff --git a/storage/innobase/trx/trx0purge.cc b/storage/innobase/trx/trx0purge.cc
index acde762a0b7..0763e0fa057 100644
--- a/storage/innobase/trx/trx0purge.cc
+++ b/storage/innobase/trx/trx0purge.cc
@@ -703,8 +703,6 @@ namespace undo {
IORequest request(IORequest::WRITE);
- request.disable_compression();
-
err = os_file_write(
request, log_file_name, handle, log_buf, 0, sz);
@@ -768,8 +766,6 @@ namespace undo {
IORequest request(IORequest::WRITE);
- request.disable_compression();
-
err = os_file_write(
request, log_file_name, handle, log_buf, 0, sz);
@@ -837,8 +833,6 @@ namespace undo {
IORequest request(IORequest::READ);
- request.disable_compression();
-
dberr_t err;
err = os_file_read(request, handle, log_buf, 0, sz);
diff --git a/storage/innobase/trx/trx0rec.cc b/storage/innobase/trx/trx0rec.cc
index 25807e7f825..3cea123cc1b 100644
--- a/storage/innobase/trx/trx0rec.cc
+++ b/storage/innobase/trx/trx0rec.cc
@@ -1,6 +1,7 @@
/*****************************************************************************
Copyright (c) 1996, 2016, 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
@@ -2234,9 +2235,9 @@ trx_undo_prev_version_build(
byte* buf;
ut_ad(!rw_lock_own(&purge_sys->latch, RW_LOCK_S));
- ut_ad(mtr_memo_contains_page(index_mtr, index_rec, MTR_MEMO_PAGE_S_FIX)
- || mtr_memo_contains_page(index_mtr, index_rec,
- MTR_MEMO_PAGE_X_FIX));
+ ut_ad(mtr_memo_contains_page_flagged(index_mtr, index_rec,
+ MTR_MEMO_PAGE_S_FIX
+ | MTR_MEMO_PAGE_X_FIX));
ut_ad(rec_offs_validate(rec, index, offsets));
ut_a(dict_index_is_clust(index));
diff --git a/storage/innobase/trx/trx0sys.cc b/storage/innobase/trx/trx0sys.cc
index 724139461d3..bb29fb167b2 100644
--- a/storage/innobase/trx/trx0sys.cc
+++ b/storage/innobase/trx/trx0sys.cc
@@ -1086,13 +1086,14 @@ trx_sys_close(void)
" shutdown: " << size << " read views open";
}
- sess_close(trx_dummy_sess);
- trx_dummy_sess = NULL;
-
- trx_purge_sys_close();
+ if (trx_dummy_sess) {
+ sess_close(trx_dummy_sess);
+ trx_dummy_sess = NULL;
+ }
- /* Free the double write data structures. */
- buf_dblwr_free();
+ if (purge_sys) {
+ trx_purge_sys_close();
+ }
/* Only prepared transactions may be left in the system. Free them. */
ut_a(UT_LIST_GET_LEN(trx_sys->rw_trx_list) == trx_sys->n_prepared_trx);
diff --git a/storage/innobase/ut/ut0ut.cc b/storage/innobase/ut/ut0ut.cc
index 8dc6fb0bbe6..f597147d50f 100644
--- a/storage/innobase/ut/ut0ut.cc
+++ b/storage/innobase/ut/ut0ut.cc
@@ -749,33 +749,20 @@ ut_strerr(
return("Table is corrupted");
case DB_FTS_TOO_MANY_WORDS_IN_PHRASE:
return("Too many words in a FTS phrase or proximity search");
- case DB_IO_DECOMPRESS_FAIL:
- return("Page decompress failed after reading from disk");
case DB_DECRYPTION_FAILED:
return("Table is encrypted but decrypt failed.");
- case DB_IO_NO_PUNCH_HOLE:
- return("No punch hole support");
- case DB_IO_NO_PUNCH_HOLE_FS:
- return("Punch hole not supported by the file system");
- case DB_IO_NO_PUNCH_HOLE_TABLESPACE:
- return("Punch hole not supported by the tablespace");
- case DB_IO_NO_ENCRYPT_TABLESPACE:
- return("Page encryption not supported by the tablespace");
- case DB_IO_DECRYPT_FAIL:
- return("Page decryption failed after reading from disk");
case DB_IO_PARTIAL_FAILED:
return("Partial IO failed");
case DB_FORCED_ABORT:
return("Transaction aborted by another higher priority "
"transaction");
- case DB_WRONG_FILE_NAME:
- return("Invalid Filename");
-
case DB_COMPUTE_VALUE_FAILED:
return("Compute generated column failed");
case DB_NO_FK_ON_S_BASE_COL:
return("Cannot add foreign key on the base column "
"of stored column");
+ case DB_IO_NO_PUNCH_HOLE:
+ return ("File system does not support punch hole (trim) operation.");
/* do not add default: in order to produce a warning if new code
is added to the enum but not added here */
diff --git a/storage/xtradb/buf/buf0dblwr.cc b/storage/xtradb/buf/buf0dblwr.cc
index 7f6b6caee9d..68bb83e4903 100644
--- a/storage/xtradb/buf/buf0dblwr.cc
+++ b/storage/xtradb/buf/buf0dblwr.cc
@@ -455,8 +455,11 @@ buf_dblwr_init_or_load_pages(
os_file_write(path, file, page,
source_page_no * UNIV_PAGE_SIZE,
UNIV_PAGE_SIZE);
- } else if (load_corrupt_pages) {
-
+ } else if (load_corrupt_pages
+ && !buf_page_is_zeroes(page, FIL_PAGE_DATA)) {
+ /* Each valid page header must contain some
+ nonzero bytes, such as FIL_PAGE_OFFSET
+ or FIL_PAGE_LSN. */
recv_dblwr.add(page);
}
@@ -492,8 +495,6 @@ buf_dblwr_process()
for (std::list<byte*>::iterator i = recv_dblwr.pages.begin();
i != recv_dblwr.pages.end(); ++i, ++page_no_dblwr ) {
- bool is_compressed = false;
-
page = *i;
page_no = mach_read_from_4(page + FIL_PAGE_OFFSET);
space_id = mach_read_from_4(page + FIL_PAGE_SPACE_ID);
@@ -501,138 +502,119 @@ buf_dblwr_process()
if (!fil_tablespace_exists_in_mem(space_id)) {
/* Maybe we have dropped the single-table tablespace
and this page once belonged to it: do nothing */
+ continue;
+ }
- } else if (!fil_check_adress_in_tablespace(space_id,
- page_no)) {
+ if (!fil_check_adress_in_tablespace(space_id, page_no)) {
ib_logf(IB_LOG_LEVEL_WARN,
- "A page in the doublewrite buffer is not "
- "within space bounds; space id %lu "
- "page number %lu, page %lu in "
- "doublewrite buf.",
- (ulong) space_id, (ulong) page_no,
- page_no_dblwr);
+ "A copy of page " ULINTPF ":" ULINTPF
+ " in the doublewrite buffer slot " ULINTPF
+ " is not within space bounds",
+ space_id, page_no, page_no_dblwr);
+ continue;
+ }
+
+ ulint zip_size = fil_space_get_zip_size(space_id);
+ ut_ad(!buf_page_is_zeroes(page, zip_size));
+
+ /* Read in the actual page from the file */
+ fil_io(OS_FILE_READ,
+ true,
+ space_id,
+ zip_size,
+ page_no,
+ 0,
+ zip_size ? zip_size : UNIV_PAGE_SIZE,
+ read_buf,
+ NULL,
+ 0);
+
+ const bool is_all_zero = buf_page_is_zeroes(
+ read_buf, zip_size);
+
+ if (is_all_zero) {
+ /* 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 {
- ulint zip_size = fil_space_get_zip_size(space_id);
-
- /* Read in the actual page from the file */
- fil_io(OS_FILE_READ,
- true,
- space_id,
- zip_size,
- page_no,
- 0,
- zip_size ? zip_size : UNIV_PAGE_SIZE,
- read_buf,
- NULL,
- 0);
-
- /* Is page compressed ? */
- is_compressed = fil_page_is_compressed_encrypted(read_buf) |
- fil_page_is_compressed(read_buf);
-
- /* If page was compressed, decompress it before we
- check checksum. */
- if (is_compressed) {
- fil_decompress_page(NULL, read_buf, UNIV_PAGE_SIZE, NULL, true);
+ if (fil_page_is_compressed_encrypted(read_buf) ||
+ fil_page_is_compressed(read_buf)) {
+ /* Decompress the page before
+ validating the checksum. */
+ fil_decompress_page(
+ NULL, read_buf, UNIV_PAGE_SIZE,
+ NULL, true);
}
- if (fil_space_verify_crypt_checksum(read_buf, zip_size)) {
- /* page is encrypted and checksum is OK */
- } else if (buf_page_is_corrupted(true, read_buf, zip_size)) {
-
- fprintf(stderr,
- "InnoDB: Database page"
- " corruption or a failed\n"
- "InnoDB: file read of"
- " space %lu page %lu.\n"
- "InnoDB: Trying to recover it from"
- " the doublewrite buffer.\n",
- (ulong) space_id, (ulong) page_no);
-
- /* Is page compressed ? */
- is_compressed = fil_page_is_compressed_encrypted(page) |
- fil_page_is_compressed(page);
-
- /* If page was compressed, decompress it before we
- check checksum. */
- if (is_compressed) {
- fil_decompress_page(NULL, page, UNIV_PAGE_SIZE, NULL, true);
- }
+ if (fil_space_verify_crypt_checksum(
+ read_buf, zip_size)
+ || !buf_page_is_corrupted(
+ true, read_buf, zip_size)) {
+ /* The page is good; there is no need
+ to consult the doublewrite buffer. */
+ continue;
+ }
- if (fil_space_verify_crypt_checksum(page, zip_size)) {
- /* the doublewrite buffer page is encrypted and OK */
- } else if (buf_page_is_corrupted(true,
- page,
- zip_size)) {
- fprintf(stderr,
- "InnoDB: Dump of the page:\n");
- buf_page_print(
- read_buf, zip_size,
- BUF_PAGE_PRINT_NO_CRASH);
- fprintf(stderr,
- "InnoDB: Dump of"
- " corresponding page"
- " in doublewrite buffer:\n");
- buf_page_print(
- page, zip_size,
- BUF_PAGE_PRINT_NO_CRASH);
-
- fprintf(stderr,
- "InnoDB: Also the page in the"
- " doublewrite buffer"
- " is corrupt.\n"
- "InnoDB: Cannot continue"
- " operation.\n"
- "InnoDB: You can try to"
- " recover the database"
- " with the my.cnf\n"
- "InnoDB: option:\n"
- "InnoDB:"
- " innodb_force_recovery=6\n");
- ut_error;
- }
+ /* We intentionally skip this message for
+ is_all_zero pages. */
+ ib_logf(IB_LOG_LEVEL_INFO,
+ "Trying to recover page " ULINTPF ":" ULINTPF
+ " from the doublewrite buffer.",
+ space_id, page_no);
+ }
- /* Write the good page from the
- doublewrite buffer to the intended
- position */
-
- fil_io(OS_FILE_WRITE,
- true,
- space_id,
- zip_size,
- page_no,
- 0,
- zip_size ? zip_size : UNIV_PAGE_SIZE,
- page,
- NULL,
- 0);
-
- ib_logf(IB_LOG_LEVEL_INFO,
- "Recovered the page from"
- " the doublewrite buffer.");
-
- } else if (buf_page_is_zeroes(read_buf, zip_size)) {
-
- if (!buf_page_is_zeroes(page, zip_size)
- && !buf_page_is_corrupted(true, page,
- zip_size)) {
-
- /* Database page contained only
- zeroes, while a valid copy is
- available in dblwr buffer. */
-
- fil_io(OS_FILE_WRITE,
- true,
- space_id,
- zip_size,
- page_no, 0,
- zip_size ? zip_size : UNIV_PAGE_SIZE,
- page,
- NULL,
- 0);
- }
+ /* Next, validate the doublewrite page. */
+ if (fil_page_is_compressed_encrypted(page) ||
+ fil_page_is_compressed(page)) {
+ /* Decompress the page before
+ validating the checksum. */
+ fil_decompress_page(
+ NULL, page, UNIV_PAGE_SIZE, NULL, true);
+ }
+
+ if (!fil_space_verify_crypt_checksum(page, zip_size)
+ && buf_page_is_corrupted(true, page, zip_size)) {
+ if (!is_all_zero) {
+ ib_logf(IB_LOG_LEVEL_WARN,
+ "A doublewrite copy of page "
+ ULINTPF ":" ULINTPF " is corrupted.",
+ space_id, page_no);
}
+ /* 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;
}
+
+ if (page_no == 0) {
+ /* Check the FSP_SPACE_FLAGS. */
+ ulint flags = fsp_header_get_flags(page);
+ if (!fsp_flags_is_valid(flags)
+ && fsp_flags_convert_from_101(flags)
+ == ULINT_UNDEFINED) {
+ ib_logf(IB_LOG_LEVEL_WARN,
+ "Ignoring a doublewrite copy of page "
+ ULINTPF ":0 due to invalid flags 0x%x",
+ space_id, int(flags));
+ continue;
+ }
+ /* The flags on the page should be converted later. */
+ }
+
+ /* Write the good page from the doublewrite buffer to
+ the intended position. */
+
+ fil_io(OS_FILE_WRITE, true, space_id, zip_size, page_no, 0,
+ zip_size ? zip_size : UNIV_PAGE_SIZE,
+ page, NULL, 0);
+
+ ib_logf(IB_LOG_LEVEL_INFO,
+ "Recovered page " ULINTPF ":" ULINTPF " from"
+ " the doublewrite buffer.",
+ space_id, page_no);
}
ut_free(unaligned_read_buf);
diff --git a/storage/xtradb/dict/dict0load.cc b/storage/xtradb/dict/dict0load.cc
index 13c4ac467e3..b843891f16c 100644
--- a/storage/xtradb/dict/dict0load.cc
+++ b/storage/xtradb/dict/dict0load.cc
@@ -1052,8 +1052,6 @@ loop:
btr_pcur_store_position(&pcur, &mtr);
- mtr_commit(&mtr);
-
/* For tables created with old versions of InnoDB,
SYS_TABLES.MIX_LEN may contain garbage. Such tables
would always be in ROW_FORMAT=REDUNDANT. Pretend that
@@ -1087,16 +1085,19 @@ loop:
if (space_id == 0) {
/* The system tablespace always exists. */
ut_ad(!discarded);
- goto next_tablespace;
+ mem_free(name);
+ goto loop;
}
+ mtr_commit(&mtr);
+
switch (dict_check) {
case DICT_CHECK_ALL_LOADED:
/* All tablespaces should have been found in
fil_load_single_table_tablespaces(). */
if (fil_space_for_table_exists_in_mem(
- space_id, name, TRUE, !(is_temp || discarded),
- false, NULL, 0)
+ space_id, name, !(is_temp || discarded),
+ false, NULL, 0, flags)
&& !(is_temp || discarded)) {
/* If user changes the path of .ibd files in
*.isl files before doing crash recovery ,
@@ -1128,8 +1129,8 @@ loop:
/* Some tablespaces may have been opened in
trx_resurrect_table_locks(). */
if (fil_space_for_table_exists_in_mem(
- space_id, name, FALSE, FALSE,
- false, NULL, 0)) {
+ space_id, name, false,
+ false, NULL, 0, flags)) {
break;
}
/* fall through */
@@ -1191,7 +1192,6 @@ loop:
max_space_id = space_id;
}
-next_tablespace:
mem_free(name);
mtr_start(&mtr);
@@ -2383,8 +2383,8 @@ err_exit:
table->ibd_file_missing = TRUE;
} else if (!fil_space_for_table_exists_in_mem(
- table->space, name, FALSE, FALSE, true, heap,
- table->id)) {
+ table->space, name, false, true, heap,
+ table->id, table->flags)) {
if (DICT_TF2_FLAG_IS_SET(table, DICT_TF2_TEMPORARY)) {
/* Do not bother to retry opening temporary tables. */
diff --git a/storage/xtradb/fil/fil0fil.cc b/storage/xtradb/fil/fil0fil.cc
index 133960ae8b4..f4301d47028 100644
--- a/storage/xtradb/fil/fil0fil.cc
+++ b/storage/xtradb/fil/fil0fil.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2013, 2016, MariaDB Corporation. All Rights Reserved.
+Copyright (c) 2013, 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
@@ -601,10 +601,7 @@ fil_node_open_file(
ibool success;
byte* buf2;
byte* page;
- ulint space_id;
- ulint flags=0;
ulint page_size;
- ulint atomic_writes=0;
ut_ad(mutex_own(&(system->mutex)));
ut_a(node->n_pending == 0);
@@ -626,8 +623,6 @@ fil_node_open_file(
/* The following call prints an error message */
os_file_get_last_error(true);
- ut_print_timestamp(stderr);
-
ib_logf(IB_LOG_LEVEL_WARN, "InnoDB: Error: cannot "
"open %s\n. InnoDB: Have you deleted .ibd "
"files under a running mysqld server?\n",
@@ -653,17 +648,13 @@ fil_node_open_file(
ut_a(fil_is_user_tablespace_id(space->id));
if (size_bytes < FIL_IBD_FILE_INITIAL_SIZE * UNIV_PAGE_SIZE) {
- fprintf(stderr,
- "InnoDB: Error: the size of single-table"
- " tablespace file %s\n"
- "InnoDB: is only " UINT64PF ","
- " should be at least %lu!\n",
- node->name,
- size_bytes,
- (ulong) (FIL_IBD_FILE_INITIAL_SIZE
- * UNIV_PAGE_SIZE));
-
- ut_a(0);
+ ib_logf(IB_LOG_LEVEL_ERROR,
+ "The size of the file %s is only " UINT64PF
+ " bytes, should be at least " ULINTPF,
+ node->name, size_bytes,
+ FIL_IBD_FILE_INITIAL_SIZE * UNIV_PAGE_SIZE);
+ os_file_close(node->handle);
+ return(false);
}
/* Read the first page of the tablespace */
@@ -676,77 +667,34 @@ fil_node_open_file(
success = os_file_read(node->handle, page, 0, UNIV_PAGE_SIZE);
srv_stats.page0_read.add(1);
- space_id = fsp_header_get_space_id(page);
- flags = fsp_header_get_flags(page);
-
- page_size = fsp_flags_get_page_size(flags);
- atomic_writes = fsp_flags_get_atomic_writes(flags);
+ const ulint space_id = fsp_header_get_space_id(page);
+ ulint flags = fsp_header_get_flags(page);
ut_free(buf2);
-
- /* Close the file now that we have read the space id from it */
-
os_file_close(node->handle);
- if (UNIV_UNLIKELY(space_id != space->id)) {
- fprintf(stderr,
- "InnoDB: Error: tablespace id is %lu"
- " in the data dictionary\n"
- "InnoDB: but in file %s it is %lu!\n",
- space->id, node->name, space_id);
-
- ut_error;
- }
-
- if (UNIV_UNLIKELY(space_id == ULINT_UNDEFINED
- || space_id == 0)) {
- fprintf(stderr,
- "InnoDB: Error: tablespace id %lu"
- " in file %s is not sensible\n",
- (ulong) space_id, node->name);
-
- ut_error;
- }
-
- if (UNIV_UNLIKELY(fsp_flags_get_page_size(space->flags)
- != page_size)) {
- fprintf(stderr,
- "InnoDB: Error: tablespace file %s"
- " has page size 0x%lx\n"
- "InnoDB: but the data dictionary"
- " expects page size 0x%lx!\n",
- node->name, flags,
- fsp_flags_get_page_size(space->flags));
+ if (!fsp_flags_is_valid(flags)) {
+ ulint cflags = fsp_flags_convert_from_101(flags);
+ if (cflags == ULINT_UNDEFINED) {
+ ib_logf(IB_LOG_LEVEL_ERROR,
+ "Expected tablespace flags 0x%x"
+ " but found 0x%x in the file %s",
+ int(space->flags), int(flags),
+ node->name);
+ return(false);
+ }
- ut_error;
+ flags = cflags;
}
- if (UNIV_UNLIKELY(space->flags != flags)) {
- ulint sflags = (space->flags & ~FSP_FLAGS_MASK_DATA_DIR);
- ulint fflags = (flags & ~FSP_FLAGS_MASK_DATA_DIR_ORACLE);
-
- /* DATA_DIR option is on different place on MariaDB
- compared to MySQL. If this is the difference. Fix
- it. */
-
- if (sflags == fflags) {
- fprintf(stderr,
- "InnoDB: Warning: Table flags 0x%lx"
- " in the data dictionary but in file %s are 0x%lx!\n"
- " Temporally corrected because DATA_DIR option to 0x%lx.\n",
- space->flags, node->name, flags, space->flags);
-
- flags = space->flags;
- }
+ page_size = fsp_flags_get_page_size(flags);
- if (!dict_tf_verify_flags(space->flags, flags)) {
- fprintf(stderr,
- "InnoDB: Error: table flags are 0x%lx"
- " in the data dictionary\n"
- "InnoDB: but the flags in file %s are 0x%lx!\n",
- space->flags, node->name, flags);
- ut_error;
- }
+ if (UNIV_UNLIKELY(space_id != space->id)) {
+ ib_logf(IB_LOG_LEVEL_ERROR,
+ "tablespace id is " ULINTPF " in the data dictionary"
+ " but in file %s it is " ULINTPF "!\n",
+ space->id, node->name, space_id);
+ return(false);
}
if (size_bytes >= (1024*1024)) {
@@ -768,7 +716,7 @@ add_size:
space->size += node->size;
}
- atomic_writes = fsp_flags_get_atomic_writes(space->flags);
+ ulint atomic_writes = fsp_flags_get_atomic_writes(space->flags);
/* printf("Opening file %s\n", node->name); */
@@ -1572,7 +1520,6 @@ fil_space_create(
fil_system->tablespace_version++;
space->tablespace_version = fil_system->tablespace_version;
- space->mark = FALSE;
if (purpose == FIL_TABLESPACE && !recv_recovery_on
&& id > fil_system->max_assigned_id) {
@@ -2324,27 +2271,21 @@ fil_write_flushed_lsn_to_data_files(
return(DB_SUCCESS);
}
-/*******************************************************************//**
-Checks the consistency of the first data page of a tablespace
+/** Check the consistency of the first data page of a tablespace
at database startup.
+@param[in] page page frame
+@param[in] space_id tablespace identifier
+@param[in] flags tablespace flags
@retval NULL on success, or if innodb_force_recovery is set
@return pointer to an error message string */
static MY_ATTRIBUTE((warn_unused_result))
const char*
-fil_check_first_page(
-/*=================*/
- const page_t* page) /*!< in: data page */
+fil_check_first_page(const page_t* page, ulint space_id, ulint flags)
{
- ulint space_id;
- ulint flags;
-
if (srv_force_recovery >= SRV_FORCE_IGNORE_CORRUPT) {
return(NULL);
}
- space_id = mach_read_from_4(FSP_HEADER_OFFSET + FSP_SPACE_ID + page);
- flags = mach_read_from_4(FSP_HEADER_OFFSET + FSP_SPACE_FLAGS + page);
-
if (UNIV_PAGE_SIZE != fsp_flags_get_page_size(flags)) {
fprintf(stderr,
"InnoDB: Error: Current page size %lu != "
@@ -2393,7 +2334,7 @@ fil_read_first_page(
ibool one_read_already, /*!< in: TRUE if min and max
parameters below already
contain sensible data */
- ulint* flags, /*!< out: tablespace flags */
+ ulint* flags, /*!< out: FSP_SPACE_FLAGS */
ulint* space_id, /*!< out: tablespace ID */
lsn_t* min_flushed_lsn, /*!< out: min of flushed
lsn values in data files */
@@ -2423,12 +2364,22 @@ fil_read_first_page(
*flags and *space_id as they were read from the first file and
do not validate the first page. */
if (!one_read_already) {
- *flags = fsp_header_get_flags(page);
*space_id = fsp_header_get_space_id(page);
- }
+ *flags = fsp_header_get_flags(page);
- if (!one_read_already) {
- check_msg = fil_check_first_page(page);
+ if (!fsp_flags_is_valid(*flags)) {
+ ulint cflags = fsp_flags_convert_from_101(*flags);
+ if (cflags == ULINT_UNDEFINED) {
+ ib_logf(IB_LOG_LEVEL_ERROR,
+ "Invalid flags 0x%x in tablespace %u",
+ unsigned(*flags), unsigned(*space_id));
+ return "invalid tablespace flags";
+ } else {
+ *flags = cflags;
+ }
+ }
+
+ check_msg = fil_check_first_page(page, *space_id, *flags);
}
flushed_lsn = mach_read_from_8(page +
@@ -2612,6 +2563,7 @@ fil_op_write_log(
ulint len;
log_ptr = mlog_open(mtr, 11 + 2 + 1);
+ ut_ad(fsp_flags_is_valid(flags));
if (!log_ptr) {
/* Logging in mtr is switched off during crash recovery:
@@ -3823,7 +3775,7 @@ fil_create_new_single_table_tablespace(
ibool success;
/* TRUE if a table is created with CREATE TEMPORARY TABLE */
bool is_temp = !!(flags2 & DICT_TF2_TEMPORARY);
- bool has_data_dir = FSP_FLAGS_HAS_DATA_DIR(flags);
+ bool has_data_dir = FSP_FLAGS_HAS_DATA_DIR(flags) != 0;
ulint atomic_writes = FSP_FLAGS_GET_ATOMIC_WRITES(flags);
fil_space_crypt_t *crypt_data = NULL;
@@ -3831,7 +3783,7 @@ fil_create_new_single_table_tablespace(
ut_ad(!srv_read_only_mode);
ut_a(space_id < SRV_LOG_SPACE_FIRST_ID);
ut_a(size >= FIL_IBD_FILE_INITIAL_SIZE);
- ut_a(fsp_flags_is_valid(flags));
+ ut_a(fsp_flags_is_valid(flags & ~FSP_FLAGS_MEM_MASK));
if (is_temp) {
/* Temporary table filepath */
@@ -3924,12 +3876,9 @@ fil_create_new_single_table_tablespace(
memset(page, '\0', UNIV_PAGE_SIZE);
- /* Add the UNIV_PAGE_SIZE to the table flags and write them to the
- tablespace header. */
- flags = fsp_flags_set_page_size(flags, UNIV_PAGE_SIZE);
+ flags |= FSP_FLAGS_PAGE_SSIZE();
fsp_header_init_fields(page, space_id, flags);
mach_write_to_4(page + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID, space_id);
- ut_ad(fsp_flags_is_valid(flags));
if (!(fsp_flags_is_compressed(flags))) {
buf_flush_init_for_writing(page, NULL, 0);
@@ -4008,7 +3957,8 @@ fil_create_new_single_table_tablespace(
fil_op_write_log(flags
? MLOG_FILE_CREATE2
: MLOG_FILE_CREATE,
- space_id, mlog_file_flag, flags,
+ space_id, mlog_file_flag,
+ flags & ~FSP_FLAGS_MEM_MASK,
tablename, NULL, &mtr);
mtr_commit(&mtr);
@@ -4072,6 +4022,39 @@ fil_report_bad_tablespace(
(ulong) expected_id, (ulong) expected_flags);
}
+/** Try to adjust FSP_SPACE_FLAGS if they differ from the expectations.
+(Typically when upgrading from MariaDB 10.1.0..10.1.20.)
+@param[in] space_id tablespace ID
+@param[in] flags desired tablespace flags */
+UNIV_INTERN
+void
+fsp_flags_try_adjust(ulint space_id, ulint flags)
+{
+ ut_ad(!srv_read_only_mode);
+ ut_ad(fsp_flags_is_valid(flags));
+
+ mtr_t mtr;
+ mtr_start(&mtr);
+ if (buf_block_t* b = buf_page_get(
+ space_id, fsp_flags_get_zip_size(flags), 0, RW_X_LATCH,
+ &mtr)) {
+ ulint f = fsp_header_get_flags(b->frame);
+ /* Suppress the message if only the DATA_DIR flag to differs. */
+ if ((f ^ flags) & ~(1U << FSP_FLAGS_POS_RESERVED)) {
+ ib_logf(IB_LOG_LEVEL_WARN,
+ "adjusting FSP_SPACE_FLAGS of tablespace "
+ ULINTPF " from 0x%x to 0x%x",
+ space_id, int(f), int(flags));
+ }
+ if (f != flags) {
+ mlog_write_ulint(FSP_HEADER_OFFSET
+ + FSP_SPACE_FLAGS + b->frame,
+ flags, MLOG_4BYTES, &mtr);
+ }
+ }
+ mtr_commit(&mtr);
+}
+
/********************************************************************//**
Tries to open a single-table tablespace and optionally checks that the
space id in it is correct. If this does not succeed, print an error message
@@ -4101,7 +4084,7 @@ fil_open_single_table_tablespace(
bool validate, /*!< in: Do we validate tablespace? */
bool fix_dict, /*!< in: Can we fix the dictionary? */
ulint id, /*!< in: space id */
- ulint flags, /*!< in: tablespace flags */
+ ulint flags, /*!< in: expected FSP_SPACE_FLAGS */
const char* tablename, /*!< in: table name in the
databasename/tablename format */
const char* path_in, /*!< in: tablespace filepath */
@@ -4126,20 +4109,13 @@ fil_open_single_table_tablespace(
/* Table flags can be ULINT_UNDEFINED if
dict_tf_to_fsp_flags_failure is set. */
- if (flags != ULINT_UNDEFINED) {
- if (!fsp_flags_is_valid(flags)) {
- return(DB_CORRUPTION);
- }
- } else {
+ if (flags == ULINT_UNDEFINED) {
return(DB_CORRUPTION);
}
+ ut_ad(fsp_flags_is_valid(flags & ~FSP_FLAGS_MEM_MASK));
atomic_writes = fsp_flags_get_atomic_writes(flags);
- /* If the tablespace was relocated, we do not
- compare the DATA_DIR flag */
- ulint mod_flags = flags & ~FSP_FLAGS_MASK_DATA_DIR;
-
memset(&def, 0, sizeof(def));
memset(&dict, 0, sizeof(dict));
memset(&remote, 0, sizeof(remote));
@@ -4217,31 +4193,17 @@ fil_open_single_table_tablespace(
def.check_msg = fil_read_first_page(
def.file, FALSE, &def.flags, &def.id,
&def.lsn, &def.lsn, &def.crypt_data);
- def.valid = !def.check_msg;
if (table) {
table->crypt_data = def.crypt_data;
table->page_0_read = true;
}
- /* Validate this single-table-tablespace with SYS_TABLES,
- but do not compare the DATA_DIR flag, in case the
- tablespace was relocated. */
-
- ulint newf = def.flags;
- if (newf != mod_flags) {
- if (FSP_FLAGS_HAS_DATA_DIR(newf)) {
- newf = (newf & ~FSP_FLAGS_MASK_DATA_DIR);
- } else if(FSP_FLAGS_HAS_DATA_DIR_ORACLE(newf)) {
- newf = (newf & ~FSP_FLAGS_MASK_DATA_DIR_ORACLE);
- }
- }
-
- if (def.valid && def.id == id
- && newf == mod_flags) {
+ def.valid = !def.check_msg && def.id == id
+ && fsp_flags_match(flags, def.flags);
+ if (def.valid) {
valid_tablespaces_found++;
} else {
- def.valid = false;
/* Do not use this tablespace. */
fil_report_bad_tablespace(
def.filepath, def.check_msg, def.id,
@@ -4254,30 +4216,18 @@ fil_open_single_table_tablespace(
remote.check_msg = fil_read_first_page(
remote.file, FALSE, &remote.flags, &remote.id,
&remote.lsn, &remote.lsn, &remote.crypt_data);
- remote.valid = !remote.check_msg;
if (table) {
table->crypt_data = remote.crypt_data;
table->page_0_read = true;
}
- /* Validate this single-table-tablespace with SYS_TABLES,
- but do not compare the DATA_DIR flag, in case the
- tablespace was relocated. */
- ulint newf = remote.flags;
- if (newf != mod_flags) {
- if (FSP_FLAGS_HAS_DATA_DIR(newf)) {
- newf = (newf & ~FSP_FLAGS_MASK_DATA_DIR);
- } else if(FSP_FLAGS_HAS_DATA_DIR_ORACLE(newf)) {
- newf = (newf & ~FSP_FLAGS_MASK_DATA_DIR_ORACLE);
- }
- }
-
- if (remote.valid && remote.id == id
- && newf == mod_flags) {
+ /* Validate this single-table-tablespace with SYS_TABLES. */
+ remote.valid = !remote.check_msg && remote.id == id
+ && fsp_flags_match(flags, remote.flags);
+ if (remote.valid) {
valid_tablespaces_found++;
} else {
- remote.valid = false;
/* Do not use this linked tablespace. */
fil_report_bad_tablespace(
remote.filepath, remote.check_msg, remote.id,
@@ -4291,30 +4241,19 @@ fil_open_single_table_tablespace(
dict.check_msg = fil_read_first_page(
dict.file, FALSE, &dict.flags, &dict.id,
&dict.lsn, &dict.lsn, &dict.crypt_data);
- dict.valid = !dict.check_msg;
if (table) {
table->crypt_data = dict.crypt_data;
table->page_0_read = true;
}
- /* Validate this single-table-tablespace with SYS_TABLES,
- but do not compare the DATA_DIR flag, in case the
- tablespace was relocated. */
- ulint newf = dict.flags;
- if (newf != mod_flags) {
- if (FSP_FLAGS_HAS_DATA_DIR(newf)) {
- newf = (newf & ~FSP_FLAGS_MASK_DATA_DIR);
- } else if(FSP_FLAGS_HAS_DATA_DIR_ORACLE(newf)) {
- newf = (newf & ~FSP_FLAGS_MASK_DATA_DIR_ORACLE);
- }
- }
+ /* Validate this single-table-tablespace with SYS_TABLES. */
+ dict.valid = !dict.check_msg && dict.id == id
+ && fsp_flags_match(flags, dict.flags);
- if (dict.valid && dict.id == id
- && newf == mod_flags) {
+ if (dict.valid) {
valid_tablespaces_found++;
} else {
- dict.valid = false;
/* Do not use this tablespace. */
fil_report_bad_tablespace(
dict.filepath, dict.check_msg, dict.id,
@@ -4512,6 +4451,10 @@ cleanup_and_exit:
mem_free(def.filepath);
+ if (err == DB_SUCCESS && !srv_read_only_mode) {
+ fsp_flags_try_adjust(id, flags & ~FSP_FLAGS_MEM_MASK);
+ }
+
return(err);
}
#endif /* !UNIV_HOTBACKUP */
@@ -4693,7 +4636,23 @@ fil_user_tablespace_restore_page(
goto out;
}
- flags = mach_read_from_4(FSP_HEADER_OFFSET + FSP_SPACE_FLAGS + page);
+ flags = mach_read_from_4(FSP_HEADER_OFFSET + FSP_SPACE_FLAGS + page);
+
+ if (!fsp_flags_is_valid(flags)) {
+ ulint cflags = fsp_flags_convert_from_101(flags);
+ if (cflags == ULINT_UNDEFINED) {
+ ib_logf(IB_LOG_LEVEL_WARN,
+ "Ignoring a doublewrite copy of page "
+ ULINTPF ":" ULINTPF
+ " due to invalid flags 0x%x",
+ fsp->id, page_no, int(flags));
+ err = false;
+ goto out;
+ }
+ flags = cflags;
+ /* The flags on the page should be converted later. */
+ }
+
zip_size = fsp_flags_get_zip_size(flags);
page_size = fsp_flags_get_page_size(flags);
@@ -5071,6 +5030,16 @@ will_not_choose:
}
mutex_exit(&fil_system->mutex);
#endif /* UNIV_HOTBACKUP */
+ /* Adjust the memory-based flags that would normally be set by
+ dict_tf_to_fsp_flags(). In recovery, we have no data dictionary. */
+ if (FSP_FLAGS_HAS_PAGE_COMPRESSION(fsp->flags)) {
+ fsp->flags |= page_zip_level
+ << FSP_FLAGS_MEM_COMPRESSION_LEVEL;
+ }
+ remote.flags |= 1U << FSP_FLAGS_MEM_DATA_DIR;
+ /* We will leave atomic_writes at ATOMIC_WRITES_DEFAULT.
+ That will be adjusted in fil_space_for_table_exists_in_mem(). */
+
ibool file_space_create_success = fil_space_create(
tablename, fsp->id, fsp->flags, FIL_TABLESPACE,
fsp->crypt_data, false);
@@ -5380,13 +5349,12 @@ fil_report_missing_tablespace(
name, space_id);
}
-/*******************************************************************//**
-Returns TRUE if a matching tablespace exists in the InnoDB tablespace memory
+/** Check if a matching tablespace exists in the InnoDB tablespace memory
cache. Note that if we have not done a crash recovery at the database startup,
there may be many tablespaces which are not yet in the memory cache.
-@return TRUE if a matching tablespace exists in the memory cache */
+@return whether a matching tablespace exists in the memory cache */
UNIV_INTERN
-ibool
+bool
fil_space_for_table_exists_in_mem(
/*==============================*/
ulint id, /*!< in: space id */
@@ -5394,13 +5362,7 @@ fil_space_for_table_exists_in_mem(
fil_space_create(). Either the
standard 'dbname/tablename' format
or table->dir_path_of_temp_table */
- ibool mark_space, /*!< in: in crash recovery, at database
- startup we mark all spaces which have
- an associated table in the InnoDB
- data dictionary, so that
- we can print a warning about orphaned
- tablespaces */
- ibool print_error_if_does_not_exist,
+ bool print_error_if_does_not_exist,
/*!< in: print detailed error
information to the .err log if a
matching tablespace is not found from
@@ -5408,12 +5370,13 @@ fil_space_for_table_exists_in_mem(
bool adjust_space, /*!< in: whether to adjust space id
when find table space mismatch */
mem_heap_t* heap, /*!< in: heap memory */
- table_id_t table_id) /*!< in: table id */
+ table_id_t table_id, /*!< in: table id */
+ ulint table_flags) /*!< in: table flags */
{
fil_space_t* fnamespace;
fil_space_t* space;
- ut_ad(fil_system);
+ const ulint expected_flags = dict_tf_to_fsp_flags(table_flags);
mutex_enter(&fil_system->mutex);
@@ -5425,42 +5388,31 @@ fil_space_for_table_exists_in_mem(
directory path from the datadir to the file */
fnamespace = fil_space_get_by_name(name);
- if (space && space == fnamespace) {
- /* Found */
-
- if (mark_space) {
- space->mark = TRUE;
- }
-
- mutex_exit(&fil_system->mutex);
-
- return(TRUE);
- }
-
- /* Info from "fnamespace" comes from the ibd file itself, it can
- be different from data obtained from System tables since it is
- not transactional. If adjust_space is set, and the mismatching
- space are between a user table and its temp table, we shall
- adjust the ibd file name according to system table info */
- if (adjust_space
- && space != NULL
- && row_is_mysql_tmp_table_name(space->name)
- && !row_is_mysql_tmp_table_name(name)) {
+ bool valid = space && !((space->flags ^ expected_flags)
+ & ~FSP_FLAGS_MEM_MASK);
+ if (!space) {
+ } else if (!valid || space == fnamespace) {
+ /* Found with the same file name, or got a flag mismatch. */
+ goto func_exit;
+ } else if (adjust_space
+ && row_is_mysql_tmp_table_name(space->name)
+ && !row_is_mysql_tmp_table_name(name)) {
+ /* Info from fnamespace comes from the ibd file
+ itself, it can be different from data obtained from
+ System tables since renaming files is not
+ transactional. We shall adjust the ibd file name
+ according to system table info. */
mutex_exit(&fil_system->mutex);
DBUG_EXECUTE_IF("ib_crash_before_adjust_fil_space",
DBUG_SUICIDE(););
- if (fnamespace) {
- char* tmp_name;
+ char* tmp_name = dict_mem_create_temporary_tablename(
+ heap, name, table_id);
- tmp_name = dict_mem_create_temporary_tablename(
- heap, name, table_id);
-
- fil_rename_tablespace(fnamespace->name, fnamespace->id,
- tmp_name, NULL);
- }
+ fil_rename_tablespace(fnamespace->name, fnamespace->id,
+ tmp_name, NULL);
DBUG_EXECUTE_IF("ib_crash_after_adjust_one_fil_space",
DBUG_SUICIDE(););
@@ -5473,16 +5425,12 @@ fil_space_for_table_exists_in_mem(
mutex_enter(&fil_system->mutex);
fnamespace = fil_space_get_by_name(name);
ut_ad(space == fnamespace);
- mutex_exit(&fil_system->mutex);
-
- return(TRUE);
+ goto func_exit;
}
if (!print_error_if_does_not_exist) {
-
- mutex_exit(&fil_system->mutex);
-
- return(FALSE);
+ valid = false;
+ goto func_exit;
}
if (space == NULL) {
@@ -5509,10 +5457,8 @@ error_exit:
fputs("InnoDB: Please refer to\n"
"InnoDB: " REFMAN "innodb-troubleshooting-datadict.html\n"
"InnoDB: for how to resolve the issue.\n", stderr);
-
- mutex_exit(&fil_system->mutex);
-
- return(FALSE);
+ valid = false;
+ goto func_exit;
}
if (0 != strcmp(space->name, name)) {
@@ -5539,9 +5485,19 @@ error_exit:
goto error_exit;
}
+func_exit:
+ if (valid) {
+ /* Adjust the flags that are in FSP_FLAGS_MEM_MASK.
+ FSP_SPACE_FLAGS will not be written back here. */
+ space->flags = expected_flags;
+ }
mutex_exit(&fil_system->mutex);
- return(FALSE);
+ if (valid && !srv_read_only_mode) {
+ fsp_flags_try_adjust(id, expected_flags & ~FSP_FLAGS_MEM_MASK);
+ }
+
+ return(valid);
}
/*******************************************************************//**
@@ -7444,9 +7400,8 @@ fil_space_get_crypt_data(
byte *page = static_cast<byte*>(ut_align(buf, UNIV_PAGE_SIZE));
fil_read(true, space_id, 0, 0, 0, UNIV_PAGE_SIZE, page,
NULL, NULL);
- ulint flags = fsp_header_get_flags(page);
ulint offset = fsp_header_get_crypt_offset(
- fsp_flags_get_zip_size(flags), NULL);
+ fsp_header_get_zip_size(page), NULL);
space->crypt_data = fil_space_read_crypt_data(space_id, page, offset);
ut_free(buf);
diff --git a/storage/xtradb/fsp/fsp0fsp.cc b/storage/xtradb/fsp/fsp0fsp.cc
index 4acfd134c1f..c32fddaabbe 100644
--- a/storage/xtradb/fsp/fsp0fsp.cc
+++ b/storage/xtradb/fsp/fsp0fsp.cc
@@ -663,6 +663,7 @@ fsp_header_init_fields(
ulint space_id, /*!< in: space id */
ulint flags) /*!< in: tablespace flags (FSP_SPACE_FLAGS) */
{
+ flags &= ~FSP_FLAGS_MEM_MASK;
ut_a(fsp_flags_is_valid(flags));
mach_write_to_4(FSP_HEADER_OFFSET + FSP_SPACE_ID + page,
@@ -713,7 +714,7 @@ fsp_header_init(
mlog_write_ulint(header + FSP_SIZE, size, MLOG_4BYTES, mtr);
mlog_write_ulint(header + FSP_FREE_LIMIT, 0, MLOG_4BYTES, mtr);
- mlog_write_ulint(header + FSP_SPACE_FLAGS, flags,
+ mlog_write_ulint(header + FSP_SPACE_FLAGS, flags & ~FSP_FLAGS_MEM_MASK,
MLOG_4BYTES, mtr);
mlog_write_ulint(header + FSP_FRAG_N_USED, 0, MLOG_4BYTES, mtr);
diff --git a/storage/xtradb/include/dict0dict.ic b/storage/xtradb/include/dict0dict.ic
index d9d40b809d1..2b63ddea51d 100644
--- a/storage/xtradb/include/dict0dict.ic
+++ b/storage/xtradb/include/dict0dict.ic
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2013, 2016, MariaDB
+Copyright (c) 2013, 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
@@ -918,10 +918,13 @@ dict_tf_to_fsp_flags(
ulint table_flags) /*!< in: dict_table_t::flags */
{
ulint fsp_flags;
- ulint page_compression = DICT_TF_GET_PAGE_COMPRESSION(table_flags);
- ulint page_compression_level = DICT_TF_GET_PAGE_COMPRESSION_LEVEL(table_flags);
+ ulint page_compression_level = DICT_TF_GET_PAGE_COMPRESSION_LEVEL(
+ table_flags);
ulint atomic_writes = DICT_TF_GET_ATOMIC_WRITES(table_flags);
+ ut_ad((DICT_TF_GET_PAGE_COMPRESSION(table_flags) == 0)
+ == (page_compression_level == 0));
+
DBUG_EXECUTE_IF("dict_tf_to_fsp_flags_failure",
return(ULINT_UNDEFINED););
@@ -929,30 +932,23 @@ dict_tf_to_fsp_flags(
fsp_flags = DICT_TF_HAS_ATOMIC_BLOBS(table_flags) ? 1 : 0;
/* ZIP_SSIZE and ATOMIC_BLOBS are at the same position. */
- fsp_flags |= table_flags & DICT_TF_MASK_ZIP_SSIZE;
- fsp_flags |= table_flags & DICT_TF_MASK_ATOMIC_BLOBS;
-
- /* In addition, tablespace flags also contain the page size. */
- fsp_flags |= fsp_flags_set_page_size(fsp_flags, UNIV_PAGE_SIZE);
+ fsp_flags |= table_flags
+ & (DICT_TF_MASK_ZIP_SSIZE | DICT_TF_MASK_ATOMIC_BLOBS);
- /* The DATA_DIR flag is in a different position in fsp_flag */
- fsp_flags |= DICT_TF_HAS_DATA_DIR(table_flags)
- ? FSP_FLAGS_MASK_DATA_DIR : 0;
+ fsp_flags |= FSP_FLAGS_PAGE_SSIZE();
- /* In addition, tablespace flags also contain if the page
- compression is used for this table. */
- fsp_flags |= FSP_FLAGS_SET_PAGE_COMPRESSION(fsp_flags, page_compression);
+ if (page_compression_level) {
+ fsp_flags |= FSP_FLAGS_MASK_PAGE_COMPRESSION;
+ }
- /* In addition, tablespace flags also contain page compression level
- if page compression is used for this table. */
- fsp_flags |= FSP_FLAGS_SET_PAGE_COMPRESSION_LEVEL(fsp_flags, page_compression_level);
+ ut_a(fsp_flags_is_valid(fsp_flags));
- /* In addition, tablespace flags also contain flag if atomic writes
- is used for this table */
- fsp_flags |= FSP_FLAGS_SET_ATOMIC_WRITES(fsp_flags, atomic_writes);
+ if (DICT_TF_HAS_DATA_DIR(table_flags)) {
+ fsp_flags |= 1U << FSP_FLAGS_MEM_DATA_DIR;
+ }
- ut_a(fsp_flags_is_valid(fsp_flags));
- ut_a(dict_tf_verify_flags(table_flags, fsp_flags));
+ fsp_flags |= atomic_writes << FSP_FLAGS_MEM_ATOMIC_WRITES;
+ fsp_flags |= page_compression_level << FSP_FLAGS_MEM_COMPRESSION_LEVEL;
return(fsp_flags);
}
diff --git a/storage/xtradb/include/dict0pagecompress.h b/storage/xtradb/include/dict0pagecompress.h
index 19a2a6c52f3..6503c86ffa2 100644
--- a/storage/xtradb/include/dict0pagecompress.h
+++ b/storage/xtradb/include/dict0pagecompress.h
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (C) 2013 SkySQL Ab. All Rights Reserved.
+Copyright (C) 2013, 2017, MariaDB Corporation. 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
@@ -57,17 +57,6 @@ dict_table_page_compression_level(
__attribute__((const));
/********************************************************************//**
-Verify that dictionary flags match tablespace flags
-@return true if flags match, false if not */
-UNIV_INLINE
-ibool
-dict_tf_verify_flags(
-/*=================*/
- ulint table_flags, /*!< in: dict_table_t::flags */
- ulint fsp_flags) /*!< in: fil_space_t::flags */
- __attribute__((const));
-
-/********************************************************************//**
Extract the atomic writes flag from table flags.
@return true if atomic writes are used, false if not used */
UNIV_INLINE
diff --git a/storage/xtradb/include/dict0pagecompress.ic b/storage/xtradb/include/dict0pagecompress.ic
index 811976434a8..13c2b46c51c 100644
--- a/storage/xtradb/include/dict0pagecompress.ic
+++ b/storage/xtradb/include/dict0pagecompress.ic
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (C) 2013 SkySQL Ab. All Rights Reserved.
+Copyright (C) 2013, 2017, MariaDB Corporation. 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
@@ -25,92 +25,6 @@ Created 11/12/2013 Jan Lindström jan.lindstrom@skysql.com
***********************************************************************/
/********************************************************************//**
-Verify that dictionary flags match tablespace flags
-@return true if flags match, false if not */
-UNIV_INLINE
-ibool
-dict_tf_verify_flags(
-/*=================*/
- ulint table_flags, /*!< in: dict_table_t::flags */
- ulint fsp_flags) /*!< in: fil_space_t::flags */
-{
- ulint table_unused = DICT_TF_GET_UNUSED(table_flags);
- ulint compact = DICT_TF_GET_COMPACT(table_flags);
- ulint ssize = DICT_TF_GET_ZIP_SSIZE(table_flags);
- ulint atomic_blobs = DICT_TF_HAS_ATOMIC_BLOBS(table_flags);
- ulint data_dir = DICT_TF_HAS_DATA_DIR(table_flags);
- ulint page_compression = DICT_TF_GET_PAGE_COMPRESSION(table_flags);
- ulint page_compression_level = DICT_TF_GET_PAGE_COMPRESSION_LEVEL(table_flags);
- ulint atomic_writes = DICT_TF_GET_ATOMIC_WRITES(table_flags);
- ulint post_antelope = FSP_FLAGS_GET_POST_ANTELOPE(fsp_flags);
- ulint zip_ssize = FSP_FLAGS_GET_ZIP_SSIZE(fsp_flags);
- ulint fsp_atomic_blobs = FSP_FLAGS_HAS_ATOMIC_BLOBS(fsp_flags);
- ulint page_ssize = FSP_FLAGS_GET_PAGE_SSIZE(fsp_flags);
- ulint fsp_unused = FSP_FLAGS_GET_UNUSED(fsp_flags);
- ulint fsp_page_compression = FSP_FLAGS_GET_PAGE_COMPRESSION(fsp_flags);
- ulint fsp_page_compression_level = FSP_FLAGS_GET_PAGE_COMPRESSION_LEVEL(fsp_flags);
- ulint fsp_atomic_writes = FSP_FLAGS_GET_ATOMIC_WRITES(fsp_flags);
-
- DBUG_EXECUTE_IF("dict_tf_verify_flags_failure",
- return(ULINT_UNDEFINED););
-
- ut_a(!table_unused);
- ut_a(!fsp_unused);
- ut_a(page_ssize == 0 || page_ssize != 0); /* silence compiler */
- ut_a(compact == 0 || compact == 1); /* silence compiler */
- ut_a(data_dir == 0 || data_dir == 1); /* silence compiler */
- ut_a(post_antelope == 0 || post_antelope == 1); /* silence compiler */
-
- if (ssize != zip_ssize) {
- fprintf(stderr,
- "InnoDB: Error: table flags has zip_ssize %ld"
- " in the data dictionary\n"
- "InnoDB: but the flags in file has zip_ssize %ld\n",
- ssize, zip_ssize);
- return (FALSE);
- }
- if (atomic_blobs != fsp_atomic_blobs) {
- fprintf(stderr,
- "InnoDB: Error: table flags has atomic_blobs %ld"
- " in the data dictionary\n"
- "InnoDB: but the flags in file has atomic_blobs %ld\n",
- atomic_blobs, fsp_atomic_blobs);
-
- return (FALSE);
- }
- if (page_compression != fsp_page_compression) {
- fprintf(stderr,
- "InnoDB: Error: table flags has page_compression %ld"
- " in the data dictionary\n"
- "InnoDB: but the flags in file ahas page_compression %ld\n",
- page_compression, fsp_page_compression);
-
- return (FALSE);
- }
- if (page_compression_level != fsp_page_compression_level) {
- fprintf(stderr,
- "InnoDB: Error: table flags has page_compression_level %ld"
- " in the data dictionary\n"
- "InnoDB: but the flags in file has page_compression_level %ld\n",
- page_compression_level, fsp_page_compression_level);
-
- return (FALSE);
- }
-
- if (atomic_writes != fsp_atomic_writes) {
- fprintf(stderr,
- "InnoDB: Error: table flags has atomic writes %ld"
- " in the data dictionary\n"
- "InnoDB: but the flags in file has atomic_writes %ld\n",
- atomic_writes, fsp_atomic_writes);
-
- return (FALSE);
- }
-
- return(TRUE);
-}
-
-/********************************************************************//**
Extract the page compression level from dict_table_t::flags.
These flags are in memory, so assert that they are valid.
@return page compression level, or 0 if not compressed */
diff --git a/storage/xtradb/include/fil0fil.h b/storage/xtradb/include/fil0fil.h
index 38cc09bced3..41e38794ea9 100644
--- a/storage/xtradb/include/fil0fil.h
+++ b/storage/xtradb/include/fil0fil.h
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2013, 2016, MariaDB Corporation.
+Copyright (c) 2013, 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
@@ -45,7 +45,6 @@ Created 10/25/1995 Heikki Tuuri
// Forward declaration
struct trx_t;
-struct fil_space_t;
typedef std::list<const char*> space_name_list_t;
@@ -264,10 +263,6 @@ struct fil_space_t {
an insert buffer merge request for a
page because it actually was for the
previous incarnation of the space */
- ibool mark; /*!< this is set to TRUE at database startup if
- the space corresponds to a table in the InnoDB
- data dictionary; so we can print a warning of
- orphaned tablespaces */
ibool stop_ios;/*!< TRUE if we want to rename the
.ibd file of tablespace and want to
stop temporarily posting of new i/o
@@ -296,7 +291,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 */
- ulint flags; /*!< tablespace flags; see
+ ulint flags; /*!< FSP_SPACE_FLAGS and FSP_FLAGS_MEM_ flags;
+ see fsp0fsp.h,
fsp_flags_is_valid(),
fsp_flags_get_zip_size() */
ulint n_reserved_extents;
@@ -449,6 +445,7 @@ fil_node_create(
ibool is_raw) /*!< in: TRUE if a raw device or
a raw disk partition */
MY_ATTRIBUTE((nonnull, warn_unused_result));
+
#ifdef UNIV_LOG_ARCHIVE
/****************************************************************//**
Drops files from the start of a file space, so that its size is cut by
@@ -620,7 +617,7 @@ fil_read_first_page(
ibool one_read_already, /*!< in: TRUE if min and max
parameters below already
contain sensible data */
- ulint* flags, /*!< out: tablespace flags */
+ ulint* flags, /*!< out: FSP_SPACE_FLAGS */
ulint* space_id, /*!< out: tablespace ID */
lsn_t* min_flushed_lsn, /*!< out: min of flushed
lsn values in data files */
@@ -832,6 +829,14 @@ fil_create_new_single_table_tablespace(
ulint key_id) /*!< in: encryption key_id */
__attribute__((nonnull, warn_unused_result));
#ifndef UNIV_HOTBACKUP
+/** Try to adjust FSP_SPACE_FLAGS if they differ from the expectations.
+(Typically when upgrading from MariaDB 10.1.0..10.1.20.)
+@param[in] space_id tablespace ID
+@param[in] flags desired tablespace flags */
+UNIV_INTERN
+void
+fsp_flags_try_adjust(ulint space_id, ulint flags);
+
/********************************************************************//**
Tries to open a single-table tablespace and optionally checks the space id is
right in it. If does not succeed, prints an error message to the .err log. This
@@ -860,7 +865,7 @@ fil_open_single_table_tablespace(
bool validate, /*!< in: Do we validate tablespace? */
bool fix_dict, /*!< in: Can we fix the dictionary? */
ulint id, /*!< in: space id */
- ulint flags, /*!< in: tablespace flags */
+ ulint flags, /*!< in: expected FSP_SPACE_FLAGS */
const char* tablename, /*!< in: table name in the
databasename/tablename format */
const char* filepath, /*!< in: tablespace filepath */
@@ -901,25 +906,18 @@ fil_tablespace_exists_in_mem(
/*=========================*/
ulint id); /*!< in: space id */
#ifndef UNIV_HOTBACKUP
-/*******************************************************************//**
-Returns TRUE if a matching tablespace exists in the InnoDB tablespace memory
+/** Check if a matching tablespace exists in the InnoDB tablespace memory
cache. Note that if we have not done a crash recovery at the database startup,
there may be many tablespaces which are not yet in the memory cache.
-@return TRUE if a matching tablespace exists in the memory cache */
+@return whether a matching tablespace exists in the memory cache */
UNIV_INTERN
-ibool
+bool
fil_space_for_table_exists_in_mem(
/*==============================*/
ulint id, /*!< in: space id */
const char* name, /*!< in: table name in the standard
'databasename/tablename' format */
- ibool mark_space, /*!< in: in crash recovery, at database
- startup we mark all spaces which have
- an associated table in the InnoDB
- data dictionary, so that
- we can print a warning about orphaned
- tablespaces */
- ibool print_error_if_does_not_exist,
+ bool print_error_if_does_not_exist,
/*!< in: print detailed error
information to the .err log if a
matching tablespace is not found from
@@ -927,7 +925,8 @@ fil_space_for_table_exists_in_mem(
bool adjust_space, /*!< in: whether to adjust space id
when find table space mismatch */
mem_heap_t* heap, /*!< in: heap memory */
- table_id_t table_id); /*!< in: table id */
+ table_id_t table_id, /*!< in: table id */
+ ulint table_flags); /*!< in: table flags */
#else /* !UNIV_HOTBACKUP */
/********************************************************************//**
Extends all tablespaces to the size stored in the space header. During the
diff --git a/storage/xtradb/include/fil0pagecompress.h b/storage/xtradb/include/fil0pagecompress.h
index 10db59fb218..1fe5cb66bf6 100644
--- a/storage/xtradb/include/fil0pagecompress.h
+++ b/storage/xtradb/include/fil0pagecompress.h
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (C) 2013, 2016 MariaDB Corporation. All Rights Reserved.
+Copyright (C) 2013, 2017 MariaDB Corporation. 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
@@ -44,20 +44,11 @@ Returns the page compression flag of the space, or false if the space
is not compressed. The tablespace must be cached in the memory cache.
@return true if page compressed, false if not or space not found */
UNIV_INLINE
-ibool
+bool
fil_space_is_page_compressed(
/*=========================*/
ulint id); /*!< in: space id */
/*******************************************************************//**
-Returns the page compression flag of the space, or false if the space
-is not compressed. The tablespace must be cached in the memory cache.
-@return true if page compressed, false if not or space not found */
-UNIV_INTERN
-ibool
-fil_space_get_page_compressed(
-/*=========================*/
- fil_space_t* space); /*!< in: space id */
-/*******************************************************************//**
Returns the atomic writes flag of the space, or false if the space
is not using atomic writes. The tablespace must be cached in the memory cache.
@return atomic write table option value */
diff --git a/storage/xtradb/include/fsp0fsp.h b/storage/xtradb/include/fsp0fsp.h
index 551a8c9ef97..93f98eb0b0b 100644
--- a/storage/xtradb/include/fsp0fsp.h
+++ b/storage/xtradb/include/fsp0fsp.h
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2013, 2016, MariaDB Corporation. All Rights Reserved.
+Copyright (c) 2013, 2017, MariaDB Corporation. 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
@@ -51,28 +51,67 @@ to the two Barracuda row formats COMPRESSED and DYNAMIC. */
#define FSP_FLAGS_WIDTH_ATOMIC_BLOBS 1
/** Number of flag bits used to indicate the tablespace page size */
#define FSP_FLAGS_WIDTH_PAGE_SSIZE 4
-/** Width of the DATA_DIR flag. This flag indicates that the tablespace
-is found in a remote location, not the default data directory. */
-#define FSP_FLAGS_WIDTH_DATA_DIR 1
-/** Number of flag bits used to indicate the page compression and compression level */
-#define FSP_FLAGS_WIDTH_PAGE_COMPRESSION 1
-#define FSP_FLAGS_WIDTH_PAGE_COMPRESSION_LEVEL 4
+/** Number of reserved bits */
+#define FSP_FLAGS_WIDTH_RESERVED 6
+/** Number of flag bits used to indicate the page compression */
+#define FSP_FLAGS_WIDTH_PAGE_COMPRESSION 1
-/** Number of flag bits used to indicate atomic writes for this tablespace */
-#define FSP_FLAGS_WIDTH_ATOMIC_WRITES 2
-
-/** Width of all the currently known tablespace flags */
+/** Width of all the currently known persistent tablespace flags */
#define FSP_FLAGS_WIDTH (FSP_FLAGS_WIDTH_POST_ANTELOPE \
+ FSP_FLAGS_WIDTH_ZIP_SSIZE \
+ FSP_FLAGS_WIDTH_ATOMIC_BLOBS \
+ FSP_FLAGS_WIDTH_PAGE_SSIZE \
- + FSP_FLAGS_WIDTH_DATA_DIR \
- + FSP_FLAGS_WIDTH_PAGE_COMPRESSION \
- + FSP_FLAGS_WIDTH_PAGE_COMPRESSION_LEVEL \
- + FSP_FLAGS_WIDTH_ATOMIC_WRITES )
-
-/** A mask of all the known/used bits in tablespace flags */
-#define FSP_FLAGS_MASK (~(~0 << FSP_FLAGS_WIDTH))
+ + FSP_FLAGS_WIDTH_RESERVED \
+ + FSP_FLAGS_WIDTH_PAGE_COMPRESSION)
+
+/** A mask of all the known/used bits in FSP_SPACE_FLAGS */
+#define FSP_FLAGS_MASK (~(~0U << FSP_FLAGS_WIDTH))
+
+/* FSP_SPACE_FLAGS position and name in MySQL 5.6/MariaDB 10.0 or older
+and MariaDB 10.1.20 or older MariaDB 10.1 and in MariaDB 10.1.21
+or newer.
+MySQL 5.6 MariaDB 10.1.x MariaDB 10.1.21
+====================================================================
+Below flags in same offset
+====================================================================
+0: POST_ANTELOPE 0:POST_ANTELOPE 0: POST_ANTELOPE
+1..4: ZIP_SSIZE(0..5) 1..4:ZIP_SSIZE(0..5) 1..4: ZIP_SSIZE(0..5)
+(NOTE: bit 4 is always 0)
+5: ATOMIC_BLOBS 5:ATOMIC_BLOBS 5: ATOMIC_BLOBS
+=====================================================================
+Below note the order difference:
+=====================================================================
+6..9: PAGE_SSIZE(3..7) 6: COMPRESSION 6..9: PAGE_SSIZE(3..7)
+10: DATA_DIR 7..10: COMP_LEVEL(0..9) 10: RESERVED (5.6 DATA_DIR)
+=====================================================================
+The flags below were in incorrect position in MariaDB 10.1,
+or have been introduced in MySQL 5.7 or 8.0:
+=====================================================================
+11: UNUSED 11..12:ATOMIC_WRITES 11: RESERVED (5.7 SHARED)
+ 12: RESERVED (5.7 TEMPORARY)
+ 13..15:PAGE_SSIZE(3..7) 13: RESERVED (5.7 ENCRYPTION)
+ 14: RESERVED (8.0 SDI)
+ 15: RESERVED
+ 16: PAGE_SSIZE_msb(0) 16: COMPRESSION
+ 17: DATA_DIR 17: UNUSED
+ 18: UNUSED
+=====================================================================
+The flags below only exist in fil_space_t::flags, not in FSP_SPACE_FLAGS:
+=====================================================================
+ 25: DATA_DIR
+ 26..27: ATOMIC_WRITES
+ 28..31: COMPRESSION_LEVEL
+*/
+
+/** A mask of the memory-only flags in fil_space_t::flags */
+#define FSP_FLAGS_MEM_MASK (~0U << FSP_FLAGS_MEM_DATA_DIR)
+
+/** Zero relative shift position of the DATA_DIR flag */
+#define FSP_FLAGS_MEM_DATA_DIR 25
+/** Zero relative shift position of the ATOMIC_WRITES field */
+#define FSP_FLAGS_MEM_ATOMIC_WRITES 26
+/** Zero relative shift position of the COMPRESSION_LEVEL field */
+#define FSP_FLAGS_MEM_COMPRESSION_LEVEL 28
/** Zero relative shift position of the POST_ANTELOPE field */
#define FSP_FLAGS_POS_POST_ANTELOPE 0
@@ -82,29 +121,16 @@ is found in a remote location, not the default data directory. */
/** Zero relative shift position of the ATOMIC_BLOBS field */
#define FSP_FLAGS_POS_ATOMIC_BLOBS (FSP_FLAGS_POS_ZIP_SSIZE \
+ FSP_FLAGS_WIDTH_ZIP_SSIZE)
-/** Note that these need to be before the page size to be compatible with
-dictionary */
-/** Zero relative shift position of the PAGE_COMPRESSION field */
-#define FSP_FLAGS_POS_PAGE_COMPRESSION (FSP_FLAGS_POS_ATOMIC_BLOBS \
- + FSP_FLAGS_WIDTH_ATOMIC_BLOBS)
-/** Zero relative shift position of the PAGE_COMPRESSION_LEVEL field */
-#define FSP_FLAGS_POS_PAGE_COMPRESSION_LEVEL (FSP_FLAGS_POS_PAGE_COMPRESSION \
- + FSP_FLAGS_WIDTH_PAGE_COMPRESSION)
-/** Zero relative shift position of the ATOMIC_WRITES field */
-#define FSP_FLAGS_POS_ATOMIC_WRITES (FSP_FLAGS_POS_PAGE_COMPRESSION_LEVEL \
- + FSP_FLAGS_WIDTH_PAGE_COMPRESSION_LEVEL)
-/** Zero relative shift position of the PAGE_SSIZE field */
-#define FSP_FLAGS_POS_PAGE_SSIZE (FSP_FLAGS_POS_ATOMIC_WRITES \
- + FSP_FLAGS_WIDTH_ATOMIC_WRITES)
-/** Zero relative shift position of the start of the DATA DIR bits */
-#define FSP_FLAGS_POS_DATA_DIR (FSP_FLAGS_POS_PAGE_SSIZE \
- + FSP_FLAGS_WIDTH_PAGE_SSIZE)
-#define FSP_FLAGS_POS_DATA_DIR_ORACLE (FSP_FLAGS_POS_ATOMIC_BLOBS \
- + FSP_FLAGS_WIDTH_ATOMIC_BLOBS \
+/** Zero relative shift position of the start of the PAGE_SSIZE bits */
+#define FSP_FLAGS_POS_PAGE_SSIZE (FSP_FLAGS_POS_ATOMIC_BLOBS \
+ + FSP_FLAGS_WIDTH_ATOMIC_BLOBS)
+/** Zero relative shift position of the start of the RESERVED bits
+these are only used in MySQL 5.7 and used for compatibility. */
+#define FSP_FLAGS_POS_RESERVED (FSP_FLAGS_POS_PAGE_SSIZE \
+ FSP_FLAGS_WIDTH_PAGE_SSIZE)
-/** Zero relative shift position of the start of the UNUSED bits */
-#define FSP_FLAGS_POS_UNUSED (FSP_FLAGS_POS_DATA_DIR\
- + FSP_FLAGS_WIDTH_DATA_DIR)
+/** Zero relative shift position of the PAGE_COMPRESSION field */
+#define FSP_FLAGS_POS_PAGE_COMPRESSION (FSP_FLAGS_POS_RESERVED \
+ + FSP_FLAGS_WIDTH_RESERVED)
/** Bit mask of the POST_ANTELOPE field */
#define FSP_FLAGS_MASK_POST_ANTELOPE \
@@ -122,26 +148,23 @@ dictionary */
#define FSP_FLAGS_MASK_PAGE_SSIZE \
((~(~0U << FSP_FLAGS_WIDTH_PAGE_SSIZE)) \
<< FSP_FLAGS_POS_PAGE_SSIZE)
-/** Bit mask of the DATA_DIR field */
-#define FSP_FLAGS_MASK_DATA_DIR \
- ((~(~0U << FSP_FLAGS_WIDTH_DATA_DIR)) \
- << FSP_FLAGS_POS_DATA_DIR)
-/** Bit mask of the DATA_DIR field */
-#define FSP_FLAGS_MASK_DATA_DIR_ORACLE \
- ((~(~0U << FSP_FLAGS_WIDTH_DATA_DIR)) \
- << FSP_FLAGS_POS_DATA_DIR_ORACLE)
+/** Bit mask of the RESERVED1 field */
+#define FSP_FLAGS_MASK_RESERVED \
+ ((~(~0U << FSP_FLAGS_WIDTH_RESERVED)) \
+ << FSP_FLAGS_POS_RESERVED)
/** Bit mask of the PAGE_COMPRESSION field */
-#define FSP_FLAGS_MASK_PAGE_COMPRESSION \
+#define FSP_FLAGS_MASK_PAGE_COMPRESSION \
((~(~0U << FSP_FLAGS_WIDTH_PAGE_COMPRESSION)) \
<< FSP_FLAGS_POS_PAGE_COMPRESSION)
-/** Bit mask of the PAGE_COMPRESSION_LEVEL field */
-#define FSP_FLAGS_MASK_PAGE_COMPRESSION_LEVEL \
- ((~(~0U << FSP_FLAGS_WIDTH_PAGE_COMPRESSION_LEVEL)) \
- << FSP_FLAGS_POS_PAGE_COMPRESSION_LEVEL)
-/** Bit mask of the ATOMIC_WRITES field */
-#define FSP_FLAGS_MASK_ATOMIC_WRITES \
- ((~(~0U << FSP_FLAGS_WIDTH_ATOMIC_WRITES)) \
- << FSP_FLAGS_POS_ATOMIC_WRITES)
+
+/** Bit mask of the in-memory ATOMIC_WRITES field */
+#define FSP_FLAGS_MASK_MEM_ATOMIC_WRITES \
+ (3U << FSP_FLAGS_MEM_ATOMIC_WRITES)
+
+/** Bit mask of the in-memory COMPRESSION_LEVEL field */
+#define FSP_FLAGS_MASK_MEM_COMPRESSION_LEVEL \
+ (15U << FSP_FLAGS_MEM_COMPRESSION_LEVEL)
+
/** Return the value of the POST_ANTELOPE field */
#define FSP_FLAGS_GET_POST_ANTELOPE(flags) \
((flags & FSP_FLAGS_MASK_POST_ANTELOPE) \
@@ -158,48 +181,78 @@ dictionary */
#define FSP_FLAGS_GET_PAGE_SSIZE(flags) \
((flags & FSP_FLAGS_MASK_PAGE_SSIZE) \
>> FSP_FLAGS_POS_PAGE_SSIZE)
-/** Return the value of the DATA_DIR field */
-#define FSP_FLAGS_HAS_DATA_DIR(flags) \
- ((flags & FSP_FLAGS_MASK_DATA_DIR) \
- >> FSP_FLAGS_POS_DATA_DIR)
-#define FSP_FLAGS_HAS_DATA_DIR_ORACLE(flags) \
- ((flags & FSP_FLAGS_MASK_DATA_DIR_ORACLE) \
- >> FSP_FLAGS_POS_DATA_DIR_ORACLE)
+/** @return the RESERVED flags */
+#define FSP_FLAGS_GET_RESERVED(flags) \
+ ((flags & FSP_FLAGS_MASK_RESERVED) \
+ >> FSP_FLAGS_POS_RESERVED)
+/** @return the PAGE_COMPRESSION flag */
+#define FSP_FLAGS_HAS_PAGE_COMPRESSION(flags) \
+ ((flags & FSP_FLAGS_MASK_PAGE_COMPRESSION) \
+ >> FSP_FLAGS_POS_PAGE_COMPRESSION)
+
/** Return the contents of the UNUSED bits */
#define FSP_FLAGS_GET_UNUSED(flags) \
(flags >> FSP_FLAGS_POS_UNUSED)
+
+/** @return the PAGE_SSIZE flags for the current innodb_page_size */
+#define FSP_FLAGS_PAGE_SSIZE() \
+ ((UNIV_PAGE_SIZE == UNIV_PAGE_SIZE_ORIG) ? \
+ 0 : (UNIV_PAGE_SIZE_SHIFT - UNIV_ZIP_SIZE_SHIFT_MIN + 1) \
+ << FSP_FLAGS_POS_PAGE_SSIZE)
+
+/** @return the value of the DATA_DIR field */
+#define FSP_FLAGS_HAS_DATA_DIR(flags) \
+ (flags & 1U << FSP_FLAGS_MEM_DATA_DIR)
+/** @return the COMPRESSION_LEVEL field */
+#define FSP_FLAGS_GET_PAGE_COMPRESSION_LEVEL(flags) \
+ ((flags & FSP_FLAGS_MASK_MEM_COMPRESSION_LEVEL) \
+ >> FSP_FLAGS_MEM_COMPRESSION_LEVEL)
+/** @return the ATOMIC_WRITES field */
+#define FSP_FLAGS_GET_ATOMIC_WRITES(flags) \
+ ((flags & FSP_FLAGS_MASK_MEM_ATOMIC_WRITES) \
+ >> FSP_FLAGS_MEM_ATOMIC_WRITES)
+
+/* Compatibility macros for MariaDB 10.1.20 or older 10.1 see
+table above. */
+/** Zero relative shift position of the PAGE_COMPRESSION field */
+#define FSP_FLAGS_POS_PAGE_COMPRESSION_MARIADB101 \
+ (FSP_FLAGS_POS_ATOMIC_BLOBS \
+ + FSP_FLAGS_WIDTH_ATOMIC_BLOBS)
+/** Zero relative shift position of the PAGE_COMPRESSION_LEVEL field */
+#define FSP_FLAGS_POS_PAGE_COMPRESSION_LEVEL_MARIADB101 \
+ (FSP_FLAGS_POS_PAGE_COMPRESSION_MARIADB101 + 1)
+/** Zero relative shift position of the ATOMIC_WRITES field */
+#define FSP_FLAGS_POS_ATOMIC_WRITES_MARIADB101 \
+ (FSP_FLAGS_POS_PAGE_COMPRESSION_LEVEL_MARIADB101 + 4)
+/** Zero relative shift position of the PAGE_SSIZE field */
+#define FSP_FLAGS_POS_PAGE_SSIZE_MARIADB101 \
+ (FSP_FLAGS_POS_ATOMIC_WRITES_MARIADB101 + 2)
+
+/** Bit mask of the PAGE_COMPRESSION field */
+#define FSP_FLAGS_MASK_PAGE_COMPRESSION_MARIADB101 \
+ (1U << FSP_FLAGS_POS_PAGE_COMPRESSION_MARIADB101)
+/** Bit mask of the PAGE_COMPRESSION_LEVEL field */
+#define FSP_FLAGS_MASK_PAGE_COMPRESSION_LEVEL_MARIADB101 \
+ (15U << FSP_FLAGS_POS_PAGE_COMPRESSION_LEVEL_MARIADB101)
+/** Bit mask of the ATOMIC_WRITES field */
+#define FSP_FLAGS_MASK_ATOMIC_WRITES_MARIADB101 \
+ (3U << FSP_FLAGS_POS_ATOMIC_WRITES_MARIADB101)
+/** Bit mask of the PAGE_SSIZE field */
+#define FSP_FLAGS_MASK_PAGE_SSIZE_MARIADB101 \
+ (15U << FSP_FLAGS_POS_PAGE_SSIZE_MARIADB101)
+
/** Return the value of the PAGE_COMPRESSION field */
-#define FSP_FLAGS_GET_PAGE_COMPRESSION(flags) \
- ((flags & FSP_FLAGS_MASK_PAGE_COMPRESSION) \
- >> FSP_FLAGS_POS_PAGE_COMPRESSION)
+#define FSP_FLAGS_GET_PAGE_COMPRESSION_MARIADB101(flags) \
+ ((flags & FSP_FLAGS_MASK_PAGE_COMPRESSION_MARIADB101) \
+ >> FSP_FLAGS_POS_PAGE_COMPRESSION_MARIADB101)
/** Return the value of the PAGE_COMPRESSION_LEVEL field */
-#define FSP_FLAGS_GET_PAGE_COMPRESSION_LEVEL(flags) \
- ((flags & FSP_FLAGS_MASK_PAGE_COMPRESSION_LEVEL) \
- >> FSP_FLAGS_POS_PAGE_COMPRESSION_LEVEL)
-/** Return the value of the ATOMIC_WRITES field */
-#define FSP_FLAGS_GET_ATOMIC_WRITES(flags) \
- ((flags & FSP_FLAGS_MASK_ATOMIC_WRITES) \
- >> FSP_FLAGS_POS_ATOMIC_WRITES)
-
-/** Set a PAGE_SSIZE into the correct bits in a given
-tablespace flags. */
-#define FSP_FLAGS_SET_PAGE_SSIZE(flags, ssize) \
- (flags | (ssize << FSP_FLAGS_POS_PAGE_SSIZE))
-
-/** Set a PAGE_COMPRESSION into the correct bits in a given
-tablespace flags. */
-#define FSP_FLAGS_SET_PAGE_COMPRESSION(flags, compression) \
- (flags | (compression << FSP_FLAGS_POS_PAGE_COMPRESSION))
-
-/** Set a PAGE_COMPRESSION_LEVEL into the correct bits in a given
-tablespace flags. */
-#define FSP_FLAGS_SET_PAGE_COMPRESSION_LEVEL(flags, level) \
- (flags | (level << FSP_FLAGS_POS_PAGE_COMPRESSION_LEVEL))
-
-/** Set a ATOMIC_WRITES into the correct bits in a given
-tablespace flags. */
-#define FSP_FLAGS_SET_ATOMIC_WRITES(flags, atomics) \
- (flags | (atomics << FSP_FLAGS_POS_ATOMIC_WRITES))
+#define FSP_FLAGS_GET_PAGE_COMPRESSION_LEVEL_MARIADB101(flags) \
+ ((flags & FSP_FLAGS_MASK_PAGE_COMPRESSION_LEVEL_MARIADB101) \
+ >> FSP_FLAGS_POS_PAGE_COMPRESSION_LEVEL_MARIADB101)
+/** Return the value of the PAGE_SSIZE field */
+#define FSP_FLAGS_GET_PAGE_SSIZE_MARIADB101(flags) \
+ ((flags & FSP_FLAGS_MASK_PAGE_SSIZE_MARIADB101) \
+ >> FSP_FLAGS_POS_PAGE_SSIZE_MARIADB101)
/* @} */
@@ -733,19 +786,193 @@ fseg_print(
mtr_t* mtr); /*!< in/out: mini-transaction */
#endif /* UNIV_BTR_PRINT */
-/********************************************************************//**
-Validate and return the tablespace flags, which are stored in the
-tablespace header at offset FSP_SPACE_FLAGS. They should be 0 for
-ROW_FORMAT=COMPACT and ROW_FORMAT=REDUNDANT. The newer row formats,
-COMPRESSED and DYNAMIC, use a file format > Antelope so they should
-have a file format number plus the DICT_TF_COMPACT bit set.
-@return true if check ok */
+/** Validate the tablespace flags, which are stored in the
+tablespace header at offset FSP_SPACE_FLAGS.
+@param[in] flags the contents of FSP_SPACE_FLAGS
+@return whether the flags are correct (not in the buggy 10.1) format */
+MY_ATTRIBUTE((warn_unused_result, const))
UNIV_INLINE
bool
-fsp_flags_is_valid(
-/*===============*/
- ulint flags) /*!< in: tablespace flags */
- MY_ATTRIBUTE((warn_unused_result, const));
+fsp_flags_is_valid(ulint flags)
+{
+ DBUG_EXECUTE_IF("fsp_flags_is_valid_failure",
+ return(false););
+ if (flags == 0) {
+ return(true);
+ }
+ if (flags & ~FSP_FLAGS_MASK) {
+ return(false);
+ }
+ if ((flags & (FSP_FLAGS_MASK_POST_ANTELOPE | FSP_FLAGS_MASK_ATOMIC_BLOBS))
+ == FSP_FLAGS_MASK_ATOMIC_BLOBS) {
+ /* If the "atomic blobs" flag (indicating
+ ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED) flag
+ is set, then the "post Antelope" (ROW_FORMAT!=REDUNDANT) flag
+ must also be set. */
+ return(false);
+ }
+ /* Bits 10..14 should be 0b0000d where d is the DATA_DIR flag
+ of MySQL 5.6 and MariaDB 10.0, which we ignore.
+ In the buggy FSP_SPACE_FLAGS written by MariaDB 10.1.0 to 10.1.20,
+ bits 10..14 would be nonzero 0bsssaa where sss is
+ nonzero PAGE_SSIZE (3, 4, 6, or 7)
+ and aa is ATOMIC_WRITES (not 0b11). */
+ if (FSP_FLAGS_GET_RESERVED(flags) & ~1) {
+ return(false);
+ }
+
+ const ulint ssize = FSP_FLAGS_GET_PAGE_SSIZE(flags);
+ if (ssize == 1 || ssize == 2 || ssize == 5 || ssize & 8) {
+ /* the page_size is not between 4k and 64k;
+ 16k should be encoded as 0, not 5 */
+ return(false);
+ }
+ const ulint zssize = FSP_FLAGS_GET_ZIP_SSIZE(flags);
+ if (zssize == 0) {
+ /* not ROW_FORMAT=COMPRESSED */
+ } else if (zssize > (ssize ? ssize : 5)) {
+ /* invalid KEY_BLOCK_SIZE */
+ return(false);
+ } else if (~flags & (FSP_FLAGS_MASK_POST_ANTELOPE
+ | FSP_FLAGS_MASK_ATOMIC_BLOBS)) {
+ /* both these flags should be set for
+ ROW_FORMAT=COMPRESSED */
+ return(false);
+ }
+
+ return(true);
+}
+
+/** Convert FSP_SPACE_FLAGS from the buggy MariaDB 10.1.0..10.1.20 format.
+@param[in] flags the contents of FSP_SPACE_FLAGS
+@return the flags corrected from the buggy MariaDB 10.1 format
+@retval ULINT_UNDEFINED if the flags are not in the buggy 10.1 format */
+MY_ATTRIBUTE((warn_unused_result, const))
+UNIV_INLINE
+ulint
+fsp_flags_convert_from_101(ulint flags)
+{
+ DBUG_EXECUTE_IF("fsp_flags_is_valid_failure",
+ return(ULINT_UNDEFINED););
+ if (flags == 0) {
+ return(flags);
+ }
+
+ if (flags >> 18) {
+ /* The most significant FSP_SPACE_FLAGS bit that was ever set
+ by MariaDB 10.1.0 to 10.1.20 was bit 17 (misplaced DATA_DIR flag).
+ The flags must be less than 1<<18 in order to be valid. */
+ return(ULINT_UNDEFINED);
+ }
+
+ if ((flags & (FSP_FLAGS_MASK_POST_ANTELOPE | FSP_FLAGS_MASK_ATOMIC_BLOBS))
+ == FSP_FLAGS_MASK_ATOMIC_BLOBS) {
+ /* If the "atomic blobs" flag (indicating
+ ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED) flag
+ is set, then the "post Antelope" (ROW_FORMAT!=REDUNDANT) flag
+ must also be set. */
+ return(ULINT_UNDEFINED);
+ }
+
+ /* Bits 6..10 denote compression in MariaDB 10.1.0 to 10.1.20.
+ They must be either 0b00000 or 0b00011 through 0b10011.
+ In correct versions, these bits would be
+ 0bd0sss where d is the DATA_DIR flag (garbage bit) and
+ sss is the PAGE_SSIZE (3, 4, 6, or 7).
+
+ NOTE: MariaDB 10.1.0 to 10.1.20 can misinterpret
+ uncompressed data files with innodb_page_size=4k or 64k as
+ compressed innodb_page_size=16k files. Below is an exhaustive
+ state space analysis.
+
+ -0by1zzz: impossible (the bit 4 must be clean; see above)
+ -0b101xx: DATA_DIR, innodb_page_size>4k: invalid (COMPRESSION_LEVEL>9)
+ +0bx0011: innodb_page_size=4k:
+ !!! Misinterpreted as COMPRESSION_LEVEL=9 or 1, COMPRESSION=1.
+ -0bx0010: impossible, because sss must be 0b011 or 0b1xx
+ -0bx0001: impossible, because sss must be 0b011 or 0b1xx
+ -0b10000: DATA_DIR, innodb_page_size=16:
+ invalid (COMPRESSION_LEVEL=8 but COMPRESSION=0)
+ +0b00111: no DATA_DIR, innodb_page_size=64k:
+ !!! Misinterpreted as COMPRESSION_LEVEL=3, COMPRESSION=1.
+ -0b00101: impossible, because sss must be 0 for 16k, not 0b101
+ -0b001x0: no DATA_DIR, innodb_page_size=32k or 8k:
+ invalid (COMPRESSION_LEVEL=3 but COMPRESSION=0)
+ +0b00000: innodb_page_size=16k (looks like COMPRESSION=0)
+ ??? Could actually be compressed; see PAGE_SSIZE below */
+ const ulint level = FSP_FLAGS_GET_PAGE_COMPRESSION_LEVEL_MARIADB101(
+ flags);
+ if (FSP_FLAGS_GET_PAGE_COMPRESSION_MARIADB101(flags) != (level != 0)
+ || level > 9) {
+ /* The compression flags are not in the buggy MariaDB
+ 10.1 format. */
+ return(ULINT_UNDEFINED);
+ }
+ if (!(~flags & FSP_FLAGS_MASK_ATOMIC_WRITES_MARIADB101)) {
+ /* The ATOMIC_WRITES flags cannot be 0b11.
+ (The bits 11..12 should actually never be 0b11,
+ because in MySQL they would be SHARED|TEMPORARY.) */
+ return(ULINT_UNDEFINED);
+ }
+
+ /* Bits 13..16 are the wrong position for PAGE_SSIZE, and they
+ should contain one of the values 3,4,6,7, that is, be of the form
+ 0b0011 or 0b01xx (except 0b0110).
+ In correct versions, these bits should be 0bc0se
+ where c is the MariaDB COMPRESSED flag
+ and e is the MySQL 5.7 ENCRYPTION flag
+ and s is the MySQL 8.0 SDI flag. MariaDB can only support s=0, e=0.
+
+ Compressed innodb_page_size=16k tables with correct FSP_SPACE_FLAGS
+ will be properly rejected by older MariaDB 10.1.x because they
+ would read as PAGE_SSIZE>=8 which is not valid. */
+
+ const ulint ssize = FSP_FLAGS_GET_PAGE_SSIZE_MARIADB101(flags);
+ if (ssize == 1 || ssize == 2 || ssize == 5 || ssize & 8) {
+ /* the page_size is not between 4k and 64k;
+ 16k should be encoded as 0, not 5 */
+ return(ULINT_UNDEFINED);
+ }
+ const ulint zssize = FSP_FLAGS_GET_ZIP_SSIZE(flags);
+ if (zssize == 0) {
+ /* not ROW_FORMAT=COMPRESSED */
+ } else if (zssize > (ssize ? ssize : 5)) {
+ /* invalid KEY_BLOCK_SIZE */
+ return(ULINT_UNDEFINED);
+ } else if (~flags & (FSP_FLAGS_MASK_POST_ANTELOPE
+ | FSP_FLAGS_MASK_ATOMIC_BLOBS)) {
+ /* both these flags should be set for
+ ROW_FORMAT=COMPRESSED */
+ return(ULINT_UNDEFINED);
+ }
+
+ flags = ((flags & 0x3f) | ssize << FSP_FLAGS_POS_PAGE_SSIZE
+ | FSP_FLAGS_GET_PAGE_COMPRESSION_MARIADB101(flags)
+ << FSP_FLAGS_POS_PAGE_COMPRESSION);
+ ut_ad(fsp_flags_is_valid(flags));
+ return(flags);
+}
+
+/** Compare tablespace flags.
+@param[in] expected expected flags from dict_tf_to_fsp_flags()
+@param[in] actual flags read from FSP_SPACE_FLAGS
+@return whether the flags match */
+MY_ATTRIBUTE((warn_unused_result))
+UNIV_INLINE
+bool
+fsp_flags_match(ulint expected, ulint actual)
+{
+ expected &= ~FSP_FLAGS_MEM_MASK;
+ ut_ad(fsp_flags_is_valid(expected));
+
+ if (actual == expected) {
+ return(true);
+ }
+
+ actual = fsp_flags_convert_from_101(actual);
+ return(actual == expected);
+}
+
/********************************************************************//**
Determine if the tablespace is compressed from dict_table_t::flags.
@return TRUE if compressed, FALSE if not compressed */
diff --git a/storage/xtradb/include/fsp0fsp.ic b/storage/xtradb/include/fsp0fsp.ic
index ddcb87b0e57..ee4cb1f32c7 100644
--- a/storage/xtradb/include/fsp0fsp.ic
+++ b/storage/xtradb/include/fsp0fsp.ic
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1995, 2012, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2013, SkySQL Ab. All Rights Reserved.
+Copyright (c) 2013, 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
@@ -47,107 +47,6 @@ fsp_descr_page(
}
/********************************************************************//**
-Validate and return the tablespace flags, which are stored in the
-tablespace header at offset FSP_SPACE_FLAGS. They should be 0 for
-ROW_FORMAT=COMPACT and ROW_FORMAT=REDUNDANT. The newer row formats,
-COMPRESSED and DYNAMIC, use a file format > Antelope so they should
-have a file format number plus the DICT_TF_COMPACT bit set.
-@return true if check ok */
-UNIV_INLINE
-bool
-fsp_flags_is_valid(
-/*===============*/
- ulint flags) /*!< in: tablespace flags */
-{
- ulint post_antelope = FSP_FLAGS_GET_POST_ANTELOPE(flags);
- ulint zip_ssize = FSP_FLAGS_GET_ZIP_SSIZE(flags);
- ulint atomic_blobs = FSP_FLAGS_HAS_ATOMIC_BLOBS(flags);
- ulint page_ssize = FSP_FLAGS_GET_PAGE_SSIZE(flags);
- ulint unused = FSP_FLAGS_GET_UNUSED(flags);
- ulint page_compression = FSP_FLAGS_GET_PAGE_COMPRESSION(flags);
- ulint page_compression_level = FSP_FLAGS_GET_PAGE_COMPRESSION_LEVEL(flags);
- ulint atomic_writes = FSP_FLAGS_GET_ATOMIC_WRITES(flags);
-
- DBUG_EXECUTE_IF("fsp_flags_is_valid_failure", return(false););
-
- /* fsp_flags is zero unless atomic_blobs is set. */
- /* Make sure there are no bits that we do not know about. */
- if (unused != 0 || flags == 1) {
- fprintf(stderr, "InnoDB: Error: Tablespace flags %lu corrupted unused %lu\n",
- flags, unused);
- return(false);
- } else if (post_antelope) {
- /* The Antelope row formats REDUNDANT and COMPACT did
- not use tablespace flags, so this flag and the entire
- 4-byte field is zero for Antelope row formats. */
-
- if (!atomic_blobs) {
- fprintf(stderr, "InnoDB: Error: Tablespace flags %lu corrupted atomic_blobs %lu\n",
- flags, atomic_blobs);
- return(false);
- }
- }
-
- if (!atomic_blobs) {
- /* Barracuda row formats COMPRESSED and DYNAMIC build on
- the page structure introduced for the COMPACT row format
- by allowing long fields to be broken into prefix and
- externally stored parts. */
-
- if (post_antelope || zip_ssize != 0) {
- fprintf(stderr, "InnoDB: Error: Tablespace flags %lu corrupted zip_ssize %lu atomic_blobs %lu\n",
- flags, zip_ssize, atomic_blobs);
- return(false);
- }
-
- } else if (!post_antelope || zip_ssize > PAGE_ZIP_SSIZE_MAX) {
- fprintf(stderr, "InnoDB: Error: Tablespace flags %lu corrupted zip_ssize %lu max %d\n",
- flags, zip_ssize, PAGE_ZIP_SSIZE_MAX);
- return(false);
- } else if (page_ssize > UNIV_PAGE_SSIZE_MAX) {
-
- /* The page size field can be used for any row type, or it may
- be zero for an original 16k page size.
- Validate the page shift size is within allowed range. */
-
- fprintf(stderr, "InnoDB: Error: Tablespace flags %lu corrupted page_ssize %lu max %lu\n",
- flags, page_ssize, UNIV_PAGE_SSIZE_MAX);
- return(false);
-
- } else if (UNIV_PAGE_SIZE != UNIV_PAGE_SIZE_ORIG && !page_ssize) {
- fprintf(stderr, "InnoDB: Error: Tablespace flags %lu corrupted page_ssize %lu max %lu:%d\n",
- flags, page_ssize, UNIV_PAGE_SIZE, UNIV_PAGE_SIZE_ORIG);
- return(false);
- }
-
-#if UNIV_FORMAT_MAX != UNIV_FORMAT_B
-# error "UNIV_FORMAT_MAX != UNIV_FORMAT_B, Add more validations."
-#endif
-
- /* Page compression level requires page compression and atomic blobs
- to be set */
- if (page_compression_level || page_compression) {
- if (!page_compression || !atomic_blobs) {
- fprintf(stderr, "InnoDB: Error: Tablespace flags %lu corrupted page_compression %lu\n"
- "InnoDB: Error: page_compression_level %lu atomic_blobs %lu\n",
- flags, page_compression, page_compression_level, atomic_blobs);
- return(false);
- }
- }
-
- if (atomic_writes > ATOMIC_WRITES_OFF) {
- fprintf(stderr, "InnoDB: Error: Tablespace flags %lu corrupted atomic_writes %lu\n",
- flags, atomic_writes);
- return (false);
- }
-
- /* The DATA_DIR field can be used for any row type so there is
- nothing here to validate. */
-
- return(true);
-}
-
-/********************************************************************//**
Determine if the tablespace is compressed from dict_table_t::flags.
@return TRUE if compressed, FALSE if not compressed */
UNIV_INLINE
@@ -191,10 +90,10 @@ UNIV_INLINE
ulint
fsp_flags_get_page_size(
/*====================*/
- ulint flags) /*!< in: tablespace flags */
+ ulint flags) /*!< in: tablespace flags */
{
- ulint page_size = 0;
- ulint ssize = FSP_FLAGS_GET_PAGE_SSIZE(flags);
+ ulint page_size = 0;
+ ulint ssize = FSP_FLAGS_GET_PAGE_SSIZE(flags);
/* Convert from a 'log2 minus 9' to a page size in bytes. */
if (UNIV_UNLIKELY(ssize)) {
@@ -211,50 +110,6 @@ fsp_flags_get_page_size(
}
#ifndef UNIV_INNOCHECKSUM
-
-/********************************************************************//**
-Add the page size to the tablespace flags.
-@return tablespace flags after page size is added */
-UNIV_INLINE
-ulint
-fsp_flags_set_page_size(
-/*====================*/
- ulint flags, /*!< in: tablespace flags */
- ulint page_size) /*!< in: page size in bytes */
-{
- ulint ssize = 0;
- ulint shift;
-
- /* Page size should be > UNIV_PAGE_SIZE_MIN */
- ut_ad(page_size >= UNIV_PAGE_SIZE_MIN);
- ut_ad(page_size <= UNIV_PAGE_SIZE_MAX);
-
- if (page_size == UNIV_PAGE_SIZE_ORIG) {
- ut_ad(0 == FSP_FLAGS_GET_PAGE_SSIZE(flags));
- return(flags);
- }
-
- for (shift = UNIV_PAGE_SIZE_SHIFT_MAX;
- shift >= UNIV_PAGE_SIZE_SHIFT_MIN;
- shift--) {
- ulint mask = (1 << shift);
- if (page_size & mask) {
- ut_ad(!(page_size & ~mask));
- ssize = shift - UNIV_ZIP_SIZE_SHIFT_MIN + 1;
- break;
- }
- }
-
- ut_ad(ssize);
- ut_ad(ssize <= UNIV_PAGE_SSIZE_MAX);
-
- flags = FSP_FLAGS_SET_PAGE_SSIZE(flags, ssize);
-
- ut_ad(fsp_flags_is_valid(flags));
-
- return(flags);
-}
-
/********************************************************************//**
Calculates the descriptor index within a descriptor page.
@return descriptor index */
diff --git a/storage/xtradb/include/fsp0pagecompress.h b/storage/xtradb/include/fsp0pagecompress.h
index 5f943ee2b83..c623d11c326 100644
--- a/storage/xtradb/include/fsp0pagecompress.h
+++ b/storage/xtradb/include/fsp0pagecompress.h
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (C) 2013, 2015, MariaDB Corporation. All Rights Reserved.
+Copyright (C) 2013, 2017, MariaDB Corporation. 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
@@ -48,15 +48,6 @@ fsp_header_get_compression_level(
const page_t* page); /*!< in: first page of a tablespace */
/********************************************************************//**
-Determine if the tablespace is page compressed from dict_table_t::flags.
-@return TRUE if page compressed, FALSE if not compressed */
-UNIV_INLINE
-ibool
-fsp_flags_is_page_compressed(
-/*=========================*/
- ulint flags); /*!< in: tablespace flags */
-
-/********************************************************************//**
Extract the page compression level from tablespace flags.
A tablespace has only one physical page compression level
whether that page is compressed or not.
diff --git a/storage/xtradb/include/fsp0pagecompress.ic b/storage/xtradb/include/fsp0pagecompress.ic
index e879aa2c16e..48163277feb 100644
--- a/storage/xtradb/include/fsp0pagecompress.ic
+++ b/storage/xtradb/include/fsp0pagecompress.ic
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (C) 2013, 2015, MariaDB Corporation. All Rights Reserved.
+Copyright (C) 2013, 2017, MariaDB Corporation. 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
@@ -26,18 +26,6 @@ Created 11/12/2013 Jan Lindström jan.lindstrom@mariadb.com
***********************************************************************/
/********************************************************************//**
-Determine if the tablespace is page compressed from dict_table_t::flags.
-@return TRUE if page compressed, FALSE if not page compressed */
-UNIV_INLINE
-ibool
-fsp_flags_is_page_compressed(
-/*=========================*/
- ulint flags) /*!< in: tablespace flags */
-{
- return(FSP_FLAGS_GET_PAGE_COMPRESSION(flags));
-}
-
-/********************************************************************//**
Determine the tablespace is page compression level from dict_table_t::flags.
@return page compression level or 0 if not compressed*/
UNIV_INLINE
@@ -125,21 +113,15 @@ Extract the page compression from space.
@return true if space is page compressed, false if space is not found
or space is not page compressed. */
UNIV_INLINE
-ibool
+bool
fil_space_is_page_compressed(
/*=========================*/
ulint id) /*!< in: space id */
{
- ulint flags;
-
- flags = fil_space_get_flags(id);
-
- if (flags && flags != ULINT_UNDEFINED) {
-
- return(fsp_flags_is_page_compressed(flags));
- }
+ ulint flags = fil_space_get_flags(id);
- return(0);
+ return(flags != ULINT_UNDEFINED
+ && FSP_FLAGS_HAS_PAGE_COMPRESSION(flags));
}
#endif /* UNIV_INNOCHECKSUM */
diff --git a/storage/xtradb/row/row0import.cc b/storage/xtradb/row/row0import.cc
index d45ce907304..6170eb66195 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) 2016, MariaDB Corporation.
+Copyright (c) 2015, 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
@@ -371,8 +371,7 @@ public:
m_space(ULINT_UNDEFINED),
m_xdes(),
m_xdes_page_no(ULINT_UNDEFINED),
- m_space_flags(ULINT_UNDEFINED),
- m_table_flags(ULINT_UNDEFINED) UNIV_NOTHROW { }
+ m_space_flags(ULINT_UNDEFINED) UNIV_NOTHROW { }
/**
Free any extent descriptor instance */
@@ -535,10 +534,6 @@ protected:
/** Flags value read from the header page */
ulint m_space_flags;
-
- /** Derived from m_space_flags and row format type, the row format
- type is determined from the page header. */
- ulint m_table_flags;
};
/** Determine the page size to use for traversing the tablespace
@@ -553,6 +548,19 @@ AbstractCallback::init(
const page_t* page = block->frame;
m_space_flags = fsp_header_get_flags(page);
+ if (!fsp_flags_is_valid(m_space_flags)) {
+ ulint cflags = fsp_flags_convert_from_101(m_space_flags);
+ if (cflags == ULINT_UNDEFINED) {
+ ib_logf(IB_LOG_LEVEL_ERROR,
+ "Invalid FSP_SPACE_FLAGS=0x%x",
+ int(m_space_flags));
+ return(DB_CORRUPTION);
+ }
+ m_space_flags = cflags;
+ }
+
+ /* Clear the DATA_DIR flag, which is basically garbage. */
+ m_space_flags &= ~(1U << FSP_FLAGS_POS_RESERVED);
/* Since we don't know whether it is a compressed table
or not, the data is always read into the block->frame. */
@@ -641,46 +649,6 @@ struct FetchIndexRootPages : public AbstractCallback {
}
/**
- Check if the .ibd file row format is the same as the table's.
- @param ibd_table_flags - determined from space and page.
- @return DB_SUCCESS or error code. */
- dberr_t check_row_format(ulint ibd_table_flags) UNIV_NOTHROW
- {
- dberr_t err;
- rec_format_t ibd_rec_format;
- rec_format_t table_rec_format;
-
- if (!dict_tf_is_valid(ibd_table_flags)) {
-
- ib_errf(m_trx->mysql_thd, IB_LOG_LEVEL_ERROR,
- ER_TABLE_SCHEMA_MISMATCH,
- ".ibd file has invlad table flags: %lx",
- ibd_table_flags);
-
- return(DB_CORRUPTION);
- }
-
- ibd_rec_format = dict_tf_get_rec_format(ibd_table_flags);
- table_rec_format = dict_tf_get_rec_format(m_table->flags);
-
- if (table_rec_format != ibd_rec_format) {
-
- ib_errf(m_trx->mysql_thd, IB_LOG_LEVEL_ERROR,
- ER_TABLE_SCHEMA_MISMATCH,
- "Table has %s row format, .ibd "
- "file has %s row format.",
- dict_tf_to_row_format_string(m_table->flags),
- dict_tf_to_row_format_string(ibd_table_flags));
-
- err = DB_CORRUPTION;
- } else {
- err = DB_SUCCESS;
- }
-
- return(err);
- }
-
- /**
Called for each block as it is read from the file.
@param offset - physical offset in the file
@param block - block to convert, it is not from the buffer pool.
@@ -743,12 +711,17 @@ FetchIndexRootPages::operator() (
m_indexes.push_back(Index(id, page_no));
if (m_indexes.size() == 1) {
-
- m_table_flags = dict_sys_tables_type_to_tf(
- m_space_flags,
- page_is_comp(page) ? DICT_N_COLS_COMPACT : 0);
-
- err = check_row_format(m_table_flags);
+ /* Check that the tablespace flags match the table flags. */
+ ulint expected = dict_tf_to_fsp_flags(m_table->flags);
+ if (!fsp_flags_match(expected, m_space_flags)) {
+ ib_errf(m_trx->mysql_thd, IB_LOG_LEVEL_ERROR,
+ ER_TABLE_SCHEMA_MISMATCH,
+ "Expected FSP_SPACE_FLAGS=0x%x, .ibd "
+ "file contains 0x%x.",
+ unsigned(expected),
+ unsigned(m_space_flags));
+ return(DB_CORRUPTION);
+ }
}
}
@@ -1968,21 +1941,14 @@ PageConverter::update_header(
"- ignored");
}
- ulint space_flags = fsp_header_get_flags(get_frame(block));
-
- if (!fsp_flags_is_valid(space_flags)) {
-
- ib_logf(IB_LOG_LEVEL_ERROR,
- "Unsupported tablespace format %lu",
- (ulong) space_flags);
-
- return(DB_UNSUPPORTED);
- }
-
mach_write_to_8(
get_frame(block) + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION,
m_current_lsn);
+ /* Write back the adjusted flags. */
+ mach_write_to_4(FSP_HEADER_OFFSET + FSP_SPACE_FLAGS
+ + get_frame(block), m_space_flags);
+
/* Write space_id to the tablespace header, page 0. */
mach_write_to_4(
get_frame(block) + FSP_HEADER_OFFSET + FSP_SPACE_ID,
diff --git a/storage/xtradb/row/row0mysql.cc b/storage/xtradb/row/row0mysql.cc
index aff7b758249..c81b10b93f1 100644
--- a/storage/xtradb/row/row0mysql.cc
+++ b/storage/xtradb/row/row0mysql.cc
@@ -4362,6 +4362,7 @@ row_drop_table_for_mysql(
switch (err) {
ibool is_temp;
+ ulint table_flags;
case DB_SUCCESS:
/* Clone the name, in case it has been allocated
@@ -4370,6 +4371,7 @@ row_drop_table_for_mysql(
space_id = table->space;
ibd_file_missing = table->ibd_file_missing;
+ table_flags = table->flags;
is_temp = DICT_TF2_FLAG_IS_SET(table, DICT_TF2_TEMPORARY);
/* If there is a temp path then the temp flag is set.
@@ -4385,9 +4387,9 @@ row_drop_table_for_mysql(
}
/* We do not allow temporary tables with a remote path. */
- ut_a(!(is_temp && DICT_TF_HAS_DATA_DIR(table->flags)));
+ ut_a(!(is_temp && DICT_TF_HAS_DATA_DIR(table_flags)));
- if (space_id && DICT_TF_HAS_DATA_DIR(table->flags)) {
+ if (space_id && DICT_TF_HAS_DATA_DIR(table_flags)) {
dict_get_and_save_data_dir_path(table, true);
ut_a(table->data_dir_path);
@@ -4453,8 +4455,9 @@ row_drop_table_for_mysql(
if (err == DB_SUCCESS && space_id > TRX_SYS_SPACE) {
if (!is_temp
&& !fil_space_for_table_exists_in_mem(
- space_id, tablename, FALSE,
- print_msg, false, NULL, 0)) {
+ space_id, tablename,
+ print_msg, false, NULL, 0,
+ table_flags)) {
/* This might happen if we are dropping a
discarded tablespace */
err = DB_SUCCESS;
diff --git a/storage/xtradb/srv/srv0start.cc b/storage/xtradb/srv/srv0start.cc
index bb07aea7720..70aec8767ad 100644
--- a/storage/xtradb/srv/srv0start.cc
+++ b/storage/xtradb/srv/srv0start.cc
@@ -703,8 +703,7 @@ create_log_files(
sprintf(logfilename + dirnamelen, "ib_logfile%u", INIT_LOG_FILE0);
fil_space_create(
- logfilename, SRV_LOG_SPACE_FIRST_ID,
- fsp_flags_set_page_size(0, UNIV_PAGE_SIZE),
+ logfilename, SRV_LOG_SPACE_FIRST_ID, 0,
FIL_LOG,
NULL /* no encryption yet */,
true /* this is create */);
@@ -1193,7 +1192,7 @@ check_first_page:
crypt_data = fil_space_create_crypt_data(FIL_SPACE_ENCRYPTION_DEFAULT, FIL_DEFAULT_ENCRYPTION_KEY);
}
- flags = fsp_flags_set_page_size(0, UNIV_PAGE_SIZE);
+ flags = FSP_FLAGS_PAGE_SSIZE();
fil_space_create(name, 0, flags, FIL_TABLESPACE,
crypt_data, (*create_new_db) == true);
@@ -1341,7 +1340,7 @@ srv_undo_tablespace_open(
fil_set_max_space_id_if_bigger(space);
/* Set the compressed page size to 0 (non-compressed) */
- flags = fsp_flags_set_page_size(0, UNIV_PAGE_SIZE);
+ flags = FSP_FLAGS_PAGE_SSIZE();
fil_space_create(name, space, flags, FIL_TABLESPACE,
NULL /* no encryption */,
true /* create */);
@@ -2343,9 +2342,7 @@ innobase_start_or_create_for_mysql(void)
sprintf(logfilename + dirnamelen, "ib_logfile%u", 0);
fil_space_create(logfilename,
- SRV_LOG_SPACE_FIRST_ID,
- fsp_flags_set_page_size(0, UNIV_PAGE_SIZE),
- FIL_LOG,
+ SRV_LOG_SPACE_FIRST_ID, 0, FIL_LOG,
NULL /* no encryption yet */,
true /* create */);
@@ -2740,6 +2737,13 @@ files_checked:
}
if (!srv_read_only_mode) {
+ const ulint flags = FSP_FLAGS_PAGE_SSIZE();
+ for (ulint id = 0; id <= srv_undo_tablespaces; id++) {
+ if (fil_space_get(id)) {
+ fsp_flags_try_adjust(id, flags);
+ }
+ }
+
/* Create the thread which watches the timeouts
for lock waits */
thread_handles[2 + SRV_MAX_N_IO_THREADS] = os_thread_create(
diff --git a/strings/json_lib.c b/strings/json_lib.c
index 47a3e37fa4c..18bdce2613f 100644
--- a/strings/json_lib.c
+++ b/strings/json_lib.c
@@ -1,4 +1,5 @@
#include <my_global.h>
+#include <string.h>
#include <m_ctype.h>
@@ -126,9 +127,9 @@ static int syntax_error(json_engine_t *j)
static int mark_object(json_engine_t *j)
{
j->state= JST_OBJ_START;
- if ((++j->stack_p) - j->stack < JSON_DEPTH_LIMIT)
+ if (++j->stack_p < JSON_DEPTH_LIMIT)
{
- *j->stack_p= JST_OBJ_CONT;
+ j->stack[j->stack_p]= JST_OBJ_CONT;
return 0;
}
j->s.error= JE_DEPTH;
@@ -142,9 +143,9 @@ static int read_obj(json_engine_t *j)
j->state= JST_OBJ_START;
j->value_type= JSON_VALUE_OBJECT;
j->value= j->value_begin;
- if ((++j->stack_p) - j->stack < JSON_DEPTH_LIMIT)
+ if (++j->stack_p < JSON_DEPTH_LIMIT)
{
- *j->stack_p= JST_OBJ_CONT;
+ j->stack[j->stack_p]= JST_OBJ_CONT;
return 0;
}
j->s.error= JE_DEPTH;
@@ -156,9 +157,9 @@ static int read_obj(json_engine_t *j)
static int mark_array(json_engine_t *j)
{
j->state= JST_ARRAY_START;
- if ((++j->stack_p) - j->stack < JSON_DEPTH_LIMIT)
+ if (++j->stack_p < JSON_DEPTH_LIMIT)
{
- *j->stack_p= JST_ARRAY_CONT;
+ j->stack[j->stack_p]= JST_ARRAY_CONT;
j->value= j->value_begin;
return 0;
}
@@ -172,9 +173,9 @@ static int read_array(json_engine_t *j)
j->state= JST_ARRAY_START;
j->value_type= JSON_VALUE_ARRAY;
j->value= j->value_begin;
- if ((++j->stack_p) - j->stack < JSON_DEPTH_LIMIT)
+ if (++j->stack_p < JSON_DEPTH_LIMIT)
{
- *j->stack_p= JST_ARRAY_CONT;
+ j->stack[j->stack_p]= JST_ARRAY_CONT;
return 0;
}
j->s.error= JE_DEPTH;
@@ -376,7 +377,7 @@ static int skip_str_constant(json_engine_t *j)
return j->s.error= json_eos(&j->s) ? JE_EOS : JE_BAD_CHR;
}
- j->state= *j->stack_p;
+ j->state= j->stack[j->stack_p];
return 0;
}
@@ -397,7 +398,7 @@ static int read_strn(json_engine_t *j)
if (skip_str_constant(j))
return 1;
- j->state= *j->stack_p;
+ j->state= j->stack[j->stack_p];
j->value_len= (j->s.c_str - j->value) - 1;
return 0;
}
@@ -469,7 +470,7 @@ static int json_num_states[NS_NUM_STATES][N_NUM_CLASSES]=
/*GO*/ { NS_GO1, JE_SYN, NS_Z, NS_INT, JE_SYN, JE_SYN, JE_SYN, JE_BAD_CHR },
/*GO1*/ { JE_SYN, JE_SYN, NS_Z1, NS_INT, JE_SYN, JE_SYN, JE_SYN, JE_BAD_CHR },
/*ZERO*/ { JE_SYN, JE_SYN, JE_SYN, JE_SYN, NS_FRAC, JE_SYN, NS_OK, JE_BAD_CHR },
-/*ZE1*/ { JE_SYN, JE_SYN, JE_SYN, JE_SYN, NS_FRAC, JE_SYN, JE_SYN, JE_BAD_CHR },
+/*ZE1*/ { JE_SYN, JE_SYN, JE_SYN, JE_SYN, NS_FRAC, JE_SYN, NS_OK, JE_BAD_CHR },
/*INT*/ { JE_SYN, JE_SYN, NS_INT, NS_INT, NS_FRAC, NS_EX, NS_OK, JE_BAD_CHR },
/*FRAC*/ { JE_SYN, JE_SYN, NS_FRAC, NS_FRAC,JE_SYN, NS_EX, NS_OK, JE_BAD_CHR },
/*EX*/ { NS_EX1, NS_EX1, NS_EX1, NS_EX1, JE_SYN, JE_SYN, JE_SYN, JE_BAD_CHR },
@@ -517,7 +518,7 @@ static int skip_num_constant(json_engine_t *j)
break;
}
- j->state= *j->stack_p;
+ j->state= j->stack[j->stack_p];
return 0;
}
@@ -570,7 +571,7 @@ static int v_false(json_engine_t *j)
{
if (skip_string_verbatim(&j->s, "alse"))
return 1;
- j->state= *j->stack_p;
+ j->state= j->stack[j->stack_p];
return json_scan_next(j);
}
@@ -580,7 +581,7 @@ static int v_null(json_engine_t *j)
{
if (skip_string_verbatim(&j->s, "ull"))
return 1;
- j->state= *j->stack_p;
+ j->state= j->stack[j->stack_p];
return json_scan_next(j);
}
@@ -590,7 +591,7 @@ static int v_true(json_engine_t *j)
{
if (skip_string_verbatim(&j->s, "rue"))
return 1;
- j->state= *j->stack_p;
+ j->state= j->stack[j->stack_p];
return json_scan_next(j);
}
@@ -600,7 +601,7 @@ static int read_false(json_engine_t *j)
{
j->value_type= JSON_VALUE_FALSE;
j->value= j->value_begin;
- j->state= *j->stack_p;
+ j->state= j->stack[j->stack_p];
j->value_len= 5;
return skip_string_verbatim(&j->s, "alse");
}
@@ -611,7 +612,7 @@ static int read_null(json_engine_t *j)
{
j->value_type= JSON_VALUE_NULL;
j->value= j->value_begin;
- j->state= *j->stack_p;
+ j->state= j->stack[j->stack_p];
j->value_len= 4;
return skip_string_verbatim(&j->s, "ull");
}
@@ -622,7 +623,7 @@ static int read_true(json_engine_t *j)
{
j->value_type= JSON_VALUE_TRUE;
j->value= j->value_begin;
- j->state= *j->stack_p;
+ j->state= j->stack[j->stack_p];
j->value_len= 4;
return skip_string_verbatim(&j->s, "rue");
}
@@ -791,7 +792,7 @@ int json_scan_start(json_engine_t *je,
{
json_string_setup(&je->s, i_cs, str, end);
je->stack[0]= JST_DONE;
- je->stack_p= je->stack;
+ je->stack_p= 0;
je->state= JST_VALUE;
return 0;
}
@@ -839,7 +840,7 @@ static int skip_key(json_engine_t *j)
run our 'state machine' accordingly.
*/
static int struct_end_eos(json_engine_t *j)
-{ return json_actions[*j->stack_p][C_EOS](j); }
+{ return json_actions[j->stack[j->stack_p]][C_EOS](j); }
/*
@@ -849,7 +850,7 @@ static int struct_end_eos(json_engine_t *j)
run our 'state machine' accordingly.
*/
static int struct_end_cb(json_engine_t *j)
-{ return json_actions[*j->stack_p][C_RCURB](j); }
+{ return json_actions[j->stack[j->stack_p]][C_RCURB](j); }
/*
@@ -859,7 +860,7 @@ static int struct_end_cb(json_engine_t *j)
run our 'state machine' accordingly.
*/
static int struct_end_qb(json_engine_t *j)
-{ return json_actions[*j->stack_p][C_RSQRB](j); }
+{ return json_actions[j->stack[j->stack_p]][C_RSQRB](j); }
/*
@@ -869,7 +870,7 @@ static int struct_end_qb(json_engine_t *j)
run our 'state machine' accordingly.
*/
static int struct_end_cm(json_engine_t *j)
-{ return json_actions[*j->stack_p][C_COMMA](j); }
+{ return json_actions[j->stack[j->stack_p]][C_COMMA](j); }
int json_read_keyname_chr(json_engine_t *j)
@@ -1107,8 +1108,6 @@ int json_path_setup(json_path_t *p,
continue;
case PS_KWD:
case PS_AWD:
- if (p->last_step->type & JSON_PATH_DOUBLE_WILD)
- return p->s.error= JE_SYN;
p->last_step->type|= JSON_PATH_WILD;
p->types_used|= JSON_PATH_WILD;
continue;
@@ -1158,7 +1157,7 @@ int json_path_setup(json_path_t *p,
}
-int json_skip_to_level(json_engine_t *j, json_level_t level)
+int json_skip_to_level(json_engine_t *j, int level)
{
do {
if (j->stack_p < level)
@@ -1188,6 +1187,8 @@ int json_skip_key(json_engine_t *j)
}
+#define SKIPPED_STEP_MARK ((uint) ~0)
+
/*
Current step of the patch matches the JSON construction.
Now we should either stop the search or go to the next
@@ -1196,24 +1197,48 @@ int json_skip_key(json_engine_t *j)
static int handle_match(json_engine_t *je, json_path_t *p,
json_path_step_t **p_cur_step, uint *array_counters)
{
+ json_path_step_t *next_step= *p_cur_step + 1;
+
DBUG_ASSERT(*p_cur_step < p->last_step);
if (json_read_value(je))
return 1;
if (json_value_scalar(je))
+ {
+ while (next_step->type == JSON_PATH_ARRAY && next_step->n_item == 0)
+ {
+ if (++next_step > p->last_step)
+ {
+ je->s.c_str= je->value_begin;
+ return 1;
+ }
+ }
return 0;
+ }
+
+ if (next_step->type == JSON_PATH_ARRAY && next_step->n_item == 0 &&
+ je->value_type & JSON_VALUE_OBJECT)
+ {
+ do
+ {
+ array_counters[next_step - p->steps]= SKIPPED_STEP_MARK;
+ if (++next_step > p->last_step)
+ {
+ je->s.c_str= je->value_begin;
+ return 1;
+ }
+ } while (next_step->type == JSON_PATH_ARRAY && next_step->n_item == 0);
+ }
- (*p_cur_step)++;
- array_counters[*p_cur_step - p->steps]= 0;
+
+ array_counters[next_step - p->steps]= 0;
if ((int) je->value_type !=
- (int) ((*p_cur_step)->type & JSON_PATH_KEY_OR_ARRAY))
- {
- (*p_cur_step)--;
+ (int) (next_step->type & JSON_PATH_KEY_OR_ARRAY))
return json_skip_level(je);
- }
+ *p_cur_step= next_step;
return 0;
}
@@ -1231,10 +1256,7 @@ int json_key_matches(json_engine_t *je, json_string_t *k)
return 0;
}
- if (json_read_string_const_chr(k))
- return 1;
-
- return 0;
+ return json_read_string_const_chr(k);
}
@@ -1281,6 +1303,11 @@ int json_find_path(json_engine_t *je,
json_skip_array_item(je);
break;
case JST_OBJ_END:
+ do
+ {
+ (*p_cur_step)--;
+ } while (array_counters[(*p_cur_step) - p->steps] == SKIPPED_STEP_MARK);
+ break;
case JST_ARRAY_END:
(*p_cur_step)--;
break;
@@ -1598,3 +1625,118 @@ int json_escape(CHARSET_INFO *str_cs,
return json - json_start;
}
+
+
+int json_get_path_start(json_engine_t *je, CHARSET_INFO *i_cs,
+ const uchar *str, const uchar *end,
+ json_path_t *p)
+{
+ json_scan_start(je, i_cs, str, end);
+ p->last_step= p->steps - 1;
+ return 0;
+}
+
+
+int json_get_path_next(json_engine_t *je, json_path_t *p)
+{
+ if (p->last_step < p->steps)
+ {
+ if (json_read_value(je))
+ return 1;
+
+ p->last_step= p->steps;
+ p->steps[0].type= JSON_PATH_ARRAY_WILD;
+ p->steps[0].n_item= 0;
+ return 0;
+ }
+ else
+ {
+ if (json_value_scalar(je))
+ {
+ if (p->last_step->type & JSON_PATH_ARRAY)
+ p->last_step->n_item++;
+ }
+ else
+ {
+ p->last_step++;
+ p->last_step->type= (enum json_path_step_types) je->value_type;
+ p->last_step->n_item= 0;
+ }
+
+ if (json_scan_next(je))
+ return 1;
+ }
+
+ do
+ {
+ switch (je->state)
+ {
+ case JST_KEY:
+ p->last_step->key= je->s.c_str;
+ while (json_read_keyname_chr(je) == 0)
+ p->last_step->key_end= je->s.c_str;
+ if (je->s.error)
+ return 1;
+ /* Now we have je.state == JST_VALUE, so let's handle it. */
+
+ case JST_VALUE:
+ if (json_read_value(je))
+ return 1;
+ return 0;
+ case JST_OBJ_END:
+ case JST_ARRAY_END:
+ p->last_step--;
+ if (p->last_step->type & JSON_PATH_ARRAY)
+ p->last_step->n_item++;
+ break;
+ default:
+ break;
+ }
+ } while (json_scan_next(je) == 0);
+
+ return 1;
+}
+
+
+int json_path_compare(const json_path_t *a, const json_path_t *b)
+{
+ const json_path_step_t *sa= a->steps + 1;
+ const json_path_step_t *sb= b->steps + 1;
+
+ if (a->last_step - sa > b->last_step - sb)
+ return -2;
+
+ while (sa <= a->last_step)
+ {
+ if (sb > b->last_step)
+ return -2;
+
+ if (!((sa->type & sb->type) & JSON_PATH_KEY_OR_ARRAY))
+ goto step_failed;
+
+ if (sa->type & JSON_PATH_ARRAY)
+ {
+ if (!(sa->type & JSON_PATH_WILD) && sa->n_item != sb->n_item)
+ goto step_failed;
+ }
+ else /* JSON_PATH_KEY */
+ {
+ if (!(sa->type & JSON_PATH_WILD) &&
+ (sa->key_end - sa->key != sb->key_end - sb->key ||
+ memcmp(sa->key, sb->key, sa->key_end - sa->key) != 0))
+ goto step_failed;
+ }
+ sb++;
+ sa++;
+ continue;
+
+step_failed:
+ if (!(sa->type & JSON_PATH_DOUBLE_WILD))
+ return -1;
+ sb++;
+ }
+
+ return sb <= b->last_step;
+}
+
+