summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2017-03-30 12:48:42 +0200
committerSergei Golubchik <serg@mariadb.org>2017-03-30 12:48:42 +0200
commitda4d71d10d23c1ac2d10b72baee14991ccb7a146 (patch)
tree7cdf3a8c8e72ca7c1c8105427c04123f025bd870
parent9ec85009985d644ce7ae797bc3572d0ad0f69bb0 (diff)
parenta00517ac9707ffd51c092f5af5d198c5ee789bb4 (diff)
downloadmariadb-git-da4d71d10d23c1ac2d10b72baee14991ccb7a146.tar.gz
Merge branch '10.1' into 10.2
-rwxr-xr-xBUILD/compile-bintar2
-rw-r--r--BUILD/compile-pentium64-wsrep4
-rw-r--r--BUILD/util.sh2
-rw-r--r--CMakeLists.txt6
-rw-r--r--COPYING.LESSER516
-rw-r--r--COPYING.thirdparty2
-rw-r--r--CREDITS22
-rw-r--r--client/mysql.cc2
-rw-r--r--client/mysql_plugin.c2
-rw-r--r--client/mysql_upgrade.c92
-rw-r--r--client/mysqladmin.cc98
-rw-r--r--client/mysqlbinlog.cc4
-rw-r--r--client/mysqldump.c5
-rw-r--r--client/mysqltest.cc19
-rw-r--r--client/sql_string.cc.dontuse2
-rw-r--r--cmake/build_configurations/mysql_release.cmake3
-rw-r--r--cmake/mysql_add_executable.cmake8
-rw-r--r--cmake/plugin.cmake7
-rw-r--r--cmake/systemd.cmake2
-rw-r--r--cmake/win_compatibility.manifest22
-rw-r--r--config.h.cmake1
-rw-r--r--dbug/dbug.c2
-rw-r--r--debian/additions/innotop/changelog.innotop84
-rw-r--r--debian/additions/innotop/innotop1914
-rw-r--r--debian/additions/innotop/innotop.1490
-rwxr-xr-xdebian/additions/mysqlreport4
-rw-r--r--debian/mariadb-server-10.2.mysql-server.logrotate3
-rw-r--r--extra/charset2html.c2
-rw-r--r--extra/innochecksum.cc32
-rw-r--r--extra/replace.c2
-rw-r--r--extra/yassl/src/ssl.cpp1
-rw-r--r--include/base64.h62
-rw-r--r--include/m_string.h2
-rw-r--r--include/maria.h2
-rw-r--r--include/my_decimal_limits.h2
-rw-r--r--include/my_default.h2
-rw-r--r--include/my_global.h7
-rw-r--r--include/my_rnd.h2
-rw-r--r--include/my_sys.h13
-rw-r--r--include/my_valgrind.h2
-rw-r--r--include/myisamchk.h2
-rw-r--r--include/mysql.h4
-rw-r--r--include/mysql/auth_dialog_client.h2
-rw-r--r--include/mysql/plugin.h8
-rw-r--r--include/mysql/plugin_audit.h.pp432
-rw-r--r--include/mysql/plugin_auth.h7
-rw-r--r--include/mysql/plugin_auth.h.pp433
-rw-r--r--include/mysql/plugin_encryption.h.pp432
-rw-r--r--include/mysql/plugin_ftparser.h.pp432
-rw-r--r--include/mysql/plugin_password_validation.h.pp432
-rw-r--r--include/mysql/psi/mysql_file.h25
-rw-r--r--include/mysql/psi/psi.h2
-rw-r--r--include/mysql/service_base64.h82
-rw-r--r--include/mysql/service_logger.h2
-rw-r--r--include/mysql/service_progress_report.h2
-rw-r--r--include/mysql/service_sha2.h130
-rw-r--r--include/mysql/service_thd_rnd.h62
-rw-r--r--include/mysql/services.h23
-rw-r--r--include/mysql_async.h2
-rw-r--r--include/service_versions.h24
-rw-r--r--include/sha1.h25
-rw-r--r--include/sha2.h72
-rw-r--r--include/waiting_threads.h2
-rw-r--r--include/wqueue.h2
-rw-r--r--include/wsrep.h2
-rw-r--r--libmysqld/CMakeLists.txt2
-rw-r--r--libmysqld/libmysql.c18
-rw-r--r--libservices/CMakeLists.txt24
-rw-r--r--libservices/HOWTO4
-rw-r--r--libservices/base64_service.c18
-rw-r--r--libservices/logger_service.c2
-rw-r--r--libservices/my_sha2_service.c18
-rw-r--r--libservices/progress_report_service.c2
-rw-r--r--libservices/thd_rnd_service.c17
-rw-r--r--libservices/wsrep_service.c2
-rw-r--r--man/CMakeLists.txt6
-rw-r--r--man/galera_new_cluster.116
-rw-r--r--man/galera_recovery.116
-rw-r--r--man/mariadb-service-convert.120
-rw-r--r--man/mysqladmin.112
-rw-r--r--man/mysqld_safe_helper.116
-rw-r--r--man/tokuftdump.1237
-rw-r--r--man/wsrep_sst_common.116
-rw-r--r--man/wsrep_sst_mysqldump.116
-rw-r--r--man/wsrep_sst_rsync.116
-rw-r--r--man/wsrep_sst_xtrabackup-v2.116
-rw-r--r--man/wsrep_sst_xtrabackup.116
-rw-r--r--mysql-test/include/check-testcase.test4
-rw-r--r--mysql-test/include/gap_lock_error_all.inc27
-rw-r--r--mysql-test/include/gap_lock_error_cleanup.inc1
-rw-r--r--mysql-test/include/gap_lock_error_init.inc24
-rw-r--r--mysql-test/include/gap_lock_error_select.inc89
-rw-r--r--mysql-test/include/gap_lock_error_update.inc91
-rw-r--r--mysql-test/include/mtr_warnings.sql1
-rw-r--r--mysql-test/lib/My/CoreDump.pm14
-rwxr-xr-xmysql-test/lib/generate-ssl-certs.sh2
-rwxr-xr-xmysql-test/mysql-test-run.pl18
-rw-r--r--mysql-test/r/alter_table.result25
-rw-r--r--mysql-test/r/contributors.result14
-rw-r--r--mysql-test/r/ctype_upgrade.result26
-rw-r--r--mysql-test/r/derived.result23
-rw-r--r--mysql-test/r/derived_cond_pushdown.result2
-rw-r--r--mysql-test/r/derived_view.result5
-rw-r--r--mysql-test/r/drop_bad_db_type.result21
-rw-r--r--mysql-test/r/gis.result4
-rw-r--r--mysql-test/r/grant.result77
-rw-r--r--mysql-test/r/handlersocket.result2
-rw-r--r--mysql-test/r/join.result3
-rw-r--r--mysql-test/r/join_nested.result95
-rw-r--r--mysql-test/r/join_nested_jcl6.result95
-rw-r--r--mysql-test/r/log_tables.result6
-rw-r--r--mysql-test/r/log_tables_upgrade.result13
-rw-r--r--mysql-test/r/mysql_upgrade-6984.result13
-rw-r--r--mysql-test/r/mysql_upgrade.result130
-rw-r--r--mysql-test/r/mysql_upgrade_no_innodb.result13
-rw-r--r--mysql-test/r/mysql_upgrade_noengine.result297
-rw-r--r--mysql-test/r/mysql_upgrade_ssl.result13
-rw-r--r--mysql-test/r/mysql_upgrade_view.result39
-rw-r--r--mysql-test/r/mysqlbinlog_row_compressed.result22
-rw-r--r--mysql-test/r/mysqlbinlog_row_minimal.result22
-rw-r--r--mysql-test/r/mysqlbinlog_stmt_compressed.result38
-rw-r--r--mysql-test/r/mysqldump.result1
-rw-r--r--mysql-test/r/partition_column.result2
-rw-r--r--mysql-test/r/partition_innodb.result91
-rw-r--r--mysql-test/r/partition_myisam.result16
-rw-r--r--mysql-test/r/plugin.result6
-rw-r--r--mysql-test/r/ps.result83
-rw-r--r--mysql-test/r/range_vs_index_merge.result46
-rw-r--r--mysql-test/r/range_vs_index_merge_innodb.result48
-rw-r--r--mysql-test/r/repair_symlink-5543.result11
-rw-r--r--mysql-test/r/select.result2
-rw-r--r--mysql-test/r/select_jcl6.result2
-rw-r--r--mysql-test/r/select_pkeycache.result2
-rw-r--r--mysql-test/r/sp.result38
-rw-r--r--mysql-test/r/stat_tables_par.result12
-rw-r--r--mysql-test/r/stat_tables_par_innodb.result12
-rw-r--r--mysql-test/r/subselect4.result47
-rw-r--r--mysql-test/r/subselect_innodb.result15
-rw-r--r--mysql-test/r/symlink-aria-11902.result43
-rw-r--r--mysql-test/r/symlink-myisam-11902.result42
-rw-r--r--mysql-test/r/table_elim.result5
-rw-r--r--mysql-test/r/trigger_no_defaults-11698.result20
-rw-r--r--mysql-test/r/type_newdecimal.result41
-rw-r--r--mysql-test/r/type_num.result29
-rw-r--r--mysql-test/r/update_innodb.result26
-rw-r--r--mysql-test/r/view.result83
-rw-r--r--mysql-test/suite/encryption/r/debug_key_management.result16
-rw-r--r--mysql-test/suite/encryption/r/encrypt_and_grep.result35
-rw-r--r--mysql-test/suite/encryption/r/innodb-bad-key-change.result11
-rw-r--r--mysql-test/suite/encryption/r/innodb-bad-key-change2.result9
-rw-r--r--mysql-test/suite/encryption/r/innodb-bad-key-change4.result8
-rw-r--r--mysql-test/suite/encryption/r/innodb-bad-key-change5.result8
-rw-r--r--mysql-test/suite/encryption/r/innodb-bad-key-shutdown.result16
-rw-r--r--mysql-test/suite/encryption/r/innodb-encryption-disable.result9
-rw-r--r--mysql-test/suite/encryption/r/innodb-key-rotation-disable.result66
-rw-r--r--mysql-test/suite/encryption/r/innodb-missing-key.result4
-rw-r--r--mysql-test/suite/encryption/r/innodb-spatial-index.result2
-rw-r--r--mysql-test/suite/encryption/r/innodb_encryption.result1
-rw-r--r--mysql-test/suite/encryption/r/innodb_onlinealter_encryption.result41
-rw-r--r--mysql-test/suite/encryption/t/debug_key_management.test5
-rw-r--r--mysql-test/suite/encryption/t/encrypt_and_grep.opt3
-rw-r--r--mysql-test/suite/encryption/t/encrypt_and_grep.test29
-rw-r--r--mysql-test/suite/encryption/t/innodb-bad-key-change.test11
-rw-r--r--mysql-test/suite/encryption/t/innodb-bad-key-change2.test30
-rw-r--r--mysql-test/suite/encryption/t/innodb-bad-key-change4.test48
-rw-r--r--mysql-test/suite/encryption/t/innodb-bad-key-change5.test47
-rw-r--r--mysql-test/suite/encryption/t/innodb-bad-key-shutdown.test54
-rw-r--r--mysql-test/suite/encryption/t/innodb-encryption-disable.test48
-rw-r--r--mysql-test/suite/encryption/t/innodb-key-rotation-disable.opt5
-rw-r--r--mysql-test/suite/encryption/t/innodb-key-rotation-disable.test102
-rw-r--r--mysql-test/suite/encryption/t/innodb-missing-key.test7
-rw-r--r--mysql-test/suite/encryption/t/innodb_onlinealter_encryption.test103
-rw-r--r--mysql-test/suite/federated/federated_bug_35333.test1
-rw-r--r--mysql-test/suite/funcs_1/r/is_columns.result3
-rw-r--r--mysql-test/suite/funcs_1/r/is_columns_mysql.result28
-rw-r--r--mysql-test/suite/funcs_1/r/is_columns_mysql_embedded.result15
-rw-r--r--mysql-test/suite/funcs_1/r/is_statistics.result3
-rw-r--r--mysql-test/suite/funcs_1/t/is_columns_mysql.test1
-rw-r--r--mysql-test/suite/innodb/disabled.def2
-rw-r--r--mysql-test/suite/innodb/include/ibd_convert.pl1
-rw-r--r--mysql-test/suite/innodb/r/alter_key_block_size-11757.result50
-rw-r--r--mysql-test/suite/innodb/r/innodb-32k-crash.result1
-rw-r--r--mysql-test/suite/innodb/r/innodb-blob.result18
-rw-r--r--mysql-test/suite/innodb/r/innodb-get-fk.result4
-rw-r--r--mysql-test/suite/innodb/r/innodb-wl5522-debug.result9
-rw-r--r--mysql-test/suite/innodb/r/innodb_bug14676111.result2
-rw-r--r--mysql-test/suite/innodb/r/innodb_bug53756.result14
-rw-r--r--mysql-test/suite/innodb/r/innodb_skip_innodb_is_tables.result4
-rw-r--r--mysql-test/suite/innodb/t/alter_key_block_size-11757.test25
-rw-r--r--mysql-test/suite/innodb/t/innodb-32k-crash.test1
-rw-r--r--mysql-test/suite/innodb/t/innodb-64k-crash.test1
-rw-r--r--mysql-test/suite/innodb/t/innodb-blob.test28
-rw-r--r--mysql-test/suite/innodb/t/innodb-get-fk.test8
-rw-r--r--mysql-test/suite/innodb/t/innodb-wl5522-debug.test3
-rw-r--r--mysql-test/suite/innodb/t/innodb_bug14147491.test4
-rw-r--r--mysql-test/suite/innodb/t/innodb_bug14676111.test3
-rw-r--r--mysql-test/suite/innodb/t/innodb_bug53756.test61
-rw-r--r--mysql-test/suite/innodb_fts/r/innodb_fts_stopword_charset.result3
-rw-r--r--mysql-test/suite/innodb_fts/t/innodb_fts_stopword_charset.test15
-rw-r--r--mysql-test/suite/parts/r/partition_bigint_innodb.result121
-rw-r--r--mysql-test/suite/parts/r/partition_bigint_myisam.result121
-rw-r--r--mysql-test/suite/parts/r/partition_double_innodb.result82
-rw-r--r--mysql-test/suite/parts/r/partition_double_myisam.result82
-rw-r--r--[-rwxr-xr-x]mysql-test/suite/parts/r/partition_exch_innodb.result0
-rw-r--r--[-rwxr-xr-x]mysql-test/suite/parts/r/partition_exch_myisam.result0
-rw-r--r--[-rwxr-xr-x]mysql-test/suite/parts/r/partition_exch_myisam_innodb.result0
-rw-r--r--[-rwxr-xr-x]mysql-test/suite/parts/r/partition_exch_qa.result0
-rw-r--r--[-rwxr-xr-x]mysql-test/suite/parts/r/partition_exch_qa_11.result0
-rw-r--r--[-rwxr-xr-x]mysql-test/suite/parts/r/partition_exch_qa_14.result0
-rw-r--r--[-rwxr-xr-x]mysql-test/suite/parts/r/partition_exch_qa_3.result0
-rw-r--r--[-rwxr-xr-x]mysql-test/suite/parts/r/partition_exch_qa_4_innodb.result0
-rw-r--r--[-rwxr-xr-x]mysql-test/suite/parts/r/partition_exch_qa_4_myisam.result0
-rw-r--r--mysql-test/suite/parts/r/partition_float_innodb.result82
-rw-r--r--mysql-test/suite/parts/r/partition_float_myisam.result82
-rw-r--r--mysql-test/suite/parts/r/partition_int_innodb.result448
-rw-r--r--mysql-test/suite/parts/r/partition_int_myisam.result448
-rw-r--r--mysql-test/suite/parts/r/partition_mediumint_innodb.result109
-rw-r--r--mysql-test/suite/parts/r/partition_mediumint_myisam.result109
-rw-r--r--mysql-test/suite/parts/r/partition_smallint_innodb.result109
-rw-r--r--mysql-test/suite/parts/r/partition_smallint_myisam.result109
-rw-r--r--mysql-test/suite/parts/r/partition_tinyint_innodb.result109
-rw-r--r--mysql-test/suite/parts/r/partition_tinyint_myisam.result109
-rw-r--r--mysql-test/suite/parts/t/partition_bigint_innodb.test46
-rw-r--r--mysql-test/suite/parts/t/partition_bigint_myisam.test46
-rw-r--r--mysql-test/suite/parts/t/partition_double_innodb.test46
-rw-r--r--mysql-test/suite/parts/t/partition_double_myisam.test46
-rw-r--r--mysql-test/suite/parts/t/partition_float_innodb.test7
-rw-r--r--mysql-test/suite/parts/t/partition_float_myisam.test7
-rw-r--r--mysql-test/suite/parts/t/partition_int_innodb.test10
-rw-r--r--mysql-test/suite/parts/t/partition_int_myisam.test10
-rw-r--r--mysql-test/suite/parts/t/partition_mediumint_innodb.test46
-rw-r--r--mysql-test/suite/parts/t/partition_mediumint_myisam.test46
-rw-r--r--mysql-test/suite/parts/t/partition_smallint_innodb.test46
-rw-r--r--mysql-test/suite/parts/t/partition_smallint_myisam.test46
-rw-r--r--mysql-test/suite/parts/t/partition_tinyint_innodb.test46
-rw-r--r--mysql-test/suite/parts/t/partition_tinyint_myisam.test46
-rw-r--r--mysql-test/suite/perfschema/include/pfs_no_running_event_scheduler.inc10
-rw-r--r--mysql-test/suite/perfschema/include/pfs_running_event_scheduler.inc10
-rw-r--r--mysql-test/suite/perfschema/include/table_io_result_helper.inc3
-rw-r--r--mysql-test/suite/perfschema/include/upgrade_check.inc11
-rw-r--r--mysql-test/suite/perfschema/r/csv_table_io.result11
-rw-r--r--mysql-test/suite/perfschema/r/innodb_table_io.result11
-rw-r--r--mysql-test/suite/perfschema/r/memory_table_io.result11
-rw-r--r--mysql-test/suite/perfschema/r/merge_table_io.result11
-rw-r--r--mysql-test/suite/perfschema/r/multi_table_io.result11
-rw-r--r--mysql-test/suite/perfschema/r/myisam_table_io.result11
-rw-r--r--mysql-test/suite/perfschema/r/part_table_io.result11
-rw-r--r--mysql-test/suite/perfschema/r/pfs_upgrade_event.result1
-rw-r--r--mysql-test/suite/perfschema/r/pfs_upgrade_func.result1
-rw-r--r--mysql-test/suite/perfschema/r/pfs_upgrade_proc.result1
-rw-r--r--mysql-test/suite/perfschema/r/pfs_upgrade_table.result1
-rw-r--r--mysql-test/suite/perfschema/r/pfs_upgrade_view.result1
-rw-r--r--mysql-test/suite/perfschema/r/privilege_table_io.result11
-rw-r--r--mysql-test/suite/perfschema/r/rollback_table_io.result11
-rw-r--r--mysql-test/suite/perfschema/r/temp_table_io.result11
-rw-r--r--mysql-test/suite/perfschema/r/trigger_table_io.result11
-rw-r--r--mysql-test/suite/perfschema/r/view_table_io.result11
-rw-r--r--mysql-test/suite/perfschema/t/pfs_upgrade_event.test12
-rw-r--r--mysql-test/suite/perfschema/t/pfs_upgrade_func.test12
-rw-r--r--mysql-test/suite/perfschema/t/pfs_upgrade_proc.test12
-rw-r--r--mysql-test/suite/perfschema/t/pfs_upgrade_table.test14
-rw-r--r--mysql-test/suite/perfschema/t/pfs_upgrade_view.test14
-rw-r--r--mysql-test/suite/perfschema/t/table_name.test1
-rw-r--r--mysql-test/suite/perfschema/t/threads_mysql.test18
-rw-r--r--mysql-test/suite/plugins/r/auth_ed25519.result54
-rw-r--r--mysql-test/suite/plugins/r/cracklib_password_check.result2
-rw-r--r--mysql-test/suite/plugins/r/show_all_plugins.result4
-rw-r--r--mysql-test/suite/plugins/r/simple_password_check.result2
-rw-r--r--mysql-test/suite/plugins/t/auth_ed25519.test44
-rw-r--r--mysql-test/suite/rpl/r/rpl_heartbeat_basic.result5
-rw-r--r--mysql-test/suite/rpl/r/rpl_mdev6386.result4
-rw-r--r--mysql-test/suite/rpl/t/rpl_heartbeat_basic.test46
-rw-r--r--mysql-test/suite/rpl/t/rpl_mdev6386.test3
-rw-r--r--mysql-test/suite/rpl/t/rpl_mysql_upgrade.test3
-rw-r--r--mysql-test/suite/sys_vars/r/innodb_stats_include_delete_marked_basic.result25
-rw-r--r--mysql-test/suite/sys_vars/r/sysvars_innodb,32bit,xtradb.rdiff-disabled17
-rw-r--r--mysql-test/suite/sys_vars/r/sysvars_innodb,xtradb.rdiff-disabled4
-rw-r--r--mysql-test/suite/sys_vars/r/sysvars_innodb.result2
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_stats_include_delete_marked_basic.test58
-rw-r--r--mysql-test/suite/sys_vars/t/max_digest_length_basic.test2
-rw-r--r--mysql-test/suite/sys_vars/t/pfs_digests_size_basic.test2
-rw-r--r--mysql-test/suite/sys_vars/t/pfs_max_digest_length_basic.test2
-rw-r--r--mysql-test/suite/sys_vars/t/secure_file_priv.test3
-rw-r--r--mysql-test/suite/vcol/r/vcol_select_myisam.result109
-rw-r--r--mysql-test/suite/vcol/t/vcol_select_myisam.test33
-rw-r--r--mysql-test/t/alter_table.test11
-rw-r--r--mysql-test/t/ctype_upgrade.test1
-rw-r--r--mysql-test/t/derived.test23
-rw-r--r--mysql-test/t/drop_bad_db_type.test6
-rw-r--r--mysql-test/t/gis.test4
-rw-r--r--mysql-test/t/grant.test85
-rw-r--r--mysql-test/t/join_nested.test71
-rw-r--r--mysql-test/t/log_tables_upgrade.test1
-rw-r--r--[-rwxr-xr-x]mysql-test/t/long_tmpdir-master.sh1
-rw-r--r--[-rwxr-xr-x]mysql-test/t/lowercase_mixed_tmpdir-master.sh1
-rw-r--r--[-rwxr-xr-x]mysql-test/t/lowercase_mixed_tmpdir_innodb-master.sh0
-rw-r--r--mysql-test/t/mysql_upgrade_noengine.test57
-rw-r--r--mysql-test/t/mysql_upgrade_ssl.test3
-rw-r--r--mysql-test/t/mysql_upgrade_view.test1
-rw-r--r--mysql-test/t/mysqldump.test9
-rw-r--r--mysql-test/t/partition_column.test2
-rw-r--r--mysql-test/t/partition_innodb.test98
-rw-r--r--mysql-test/t/partition_myisam.test22
-rw-r--r--mysql-test/t/plugin_auth.test2
-rw-r--r--mysql-test/t/ps.test37
-rw-r--r--mysql-test/t/range_vs_index_merge.test41
-rw-r--r--mysql-test/t/repair_symlink-5543.test6
-rw-r--r--mysql-test/t/sp.test40
-rw-r--r--mysql-test/t/stat_tables_par.test2
-rw-r--r--mysql-test/t/subselect4.test35
-rw-r--r--mysql-test/t/subselect_innodb.test21
-rw-r--r--mysql-test/t/symlink-aria-11902.test6
-rw-r--r--mysql-test/t/symlink-myisam-11902.test60
-rw-r--r--mysql-test/t/table_elim.test4
-rw-r--r--mysql-test/t/trigger_no_defaults-11698.test17
-rw-r--r--mysql-test/t/type_newdecimal.test29
-rw-r--r--mysql-test/t/update_innodb.test26
-rw-r--r--mysql-test/t/view.test60
-rw-r--r--mysql-test/unstable-tests269
-rw-r--r--mysql-test/valgrind.supp19
-rw-r--r--mysys/CMakeLists.txt2
-rw-r--r--mysys/array.c2
-rw-r--r--mysys/base64.c1
-rw-r--r--mysys/file_logger.c2
-rw-r--r--mysys/hash.c16
-rw-r--r--mysys/lf_alloc-pin.c4
-rw-r--r--mysys/lf_hash.c8
-rw-r--r--mysys/ma_dyncol.c8
-rw-r--r--mysys/mf_fn_ext.c2
-rw-r--r--mysys/mf_format.c7
-rw-r--r--mysys/mf_iocache.c13
-rw-r--r--mysys/mf_keycache.c6
-rw-r--r--mysys/my_access.c2
-rw-r--r--mysys/my_alloc.c2
-rw-r--r--mysys/my_chmod.c2
-rw-r--r--mysys/my_compare.c4
-rw-r--r--mysys/my_compress.c2
-rw-r--r--mysys/my_context.c3
-rw-r--r--mysys/my_create.c20
-rw-r--r--mysys/my_default.c6
-rw-r--r--mysys/my_delete.c11
-rw-r--r--mysys/my_div.c2
-rw-r--r--mysys/my_dlerror.c31
-rw-r--r--mysys/my_fopen.c18
-rw-r--r--mysys/my_getwd.c2
-rw-r--r--mysys/my_init.c6
-rw-r--r--mysys/my_lib.c2
-rw-r--r--mysys/my_open.c41
-rw-r--r--mysys/my_port.c4
-rw-r--r--mysys/my_pread.c4
-rw-r--r--mysys/my_redel.c4
-rw-r--r--mysys/my_rnd.c2
-rw-r--r--mysys/my_safehash.c2
-rw-r--r--mysys/my_safehash.h2
-rw-r--r--mysys/my_symlink.c94
-rw-r--r--mysys/my_symlink2.c49
-rw-r--r--mysys/my_sync.c2
-rw-r--r--mysys/my_thr_init.c15
-rw-r--r--mysys/my_uuid.c2
-rw-r--r--mysys/my_windac.c2
-rw-r--r--mysys/my_winerr.c2
-rw-r--r--mysys/mysys_priv.h28
-rw-r--r--mysys/queues.c2
-rw-r--r--mysys/test_thr_mutex.c2
-rw-r--r--mysys/thr_lock.c10
-rw-r--r--mysys/tree.c4
-rw-r--r--mysys/typelib.c2
-rw-r--r--mysys/waiting_threads.c4
-rw-r--r--mysys/wqueue.c4
-rw-r--r--mysys_ssl/CMakeLists.txt26
-rw-r--r--mysys_ssl/my_rnd.cc103
-rw-r--r--mysys_ssl/my_sha.ic188
-rw-r--r--mysys_ssl/my_sha1.cc136
-rw-r--r--mysys_ssl/my_sha2.cc68
-rw-r--r--mysys_ssl/my_sha224.cc18
-rw-r--r--mysys_ssl/my_sha256.cc18
-rw-r--r--mysys_ssl/my_sha384.cc18
-rw-r--r--mysys_ssl/my_sha512.cc18
-rw-r--r--pcre/AUTHORS6
-rw-r--r--pcre/CMakeLists.txt1
-rw-r--r--pcre/ChangeLog47
-rw-r--r--pcre/LICENCE6
-rw-r--r--pcre/NEWS6
-rw-r--r--pcre/configure.ac10
-rw-r--r--pcre/doc/html/pcrecompat.html2
-rw-r--r--pcre/doc/html/pcrepattern.html37
-rw-r--r--pcre/doc/pcre.txt2109
-rw-r--r--pcre/doc/pcrecompat.32
-rw-r--r--pcre/doc/pcrepattern.337
-rw-r--r--pcre/pcre_compile.c80
-rw-r--r--pcre/pcre_jit_compile.c4
-rw-r--r--pcre/pcre_jit_test.c1
-rw-r--r--pcre/pcregrep.c6
-rw-r--r--pcre/pcretest.c20
-rw-r--r--pcre/testdata/testinput16
-rw-r--r--pcre/testdata/testinput1626
-rw-r--r--pcre/testdata/testinput1917
-rw-r--r--pcre/testdata/testinput26
-rw-r--r--pcre/testdata/testinput66
-rw-r--r--pcre/testdata/testinput79
-rw-r--r--pcre/testdata/testinput84
-rw-r--r--pcre/testdata/testoutput18
-rw-r--r--pcre/testdata/testoutput1652
-rw-r--r--pcre/testdata/testoutput1926
-rw-r--r--pcre/testdata/testoutput237
-rw-r--r--pcre/testdata/testoutput68
-rw-r--r--pcre/testdata/testoutput726
-rw-r--r--pcre/testdata/testoutput810
-rw-r--r--plugin/auth_ed25519/CMakeLists.txt32
-rw-r--r--plugin/auth_ed25519/README27
-rw-r--r--plugin/auth_ed25519/client_ed25519.c68
-rw-r--r--plugin/auth_ed25519/common.h23
-rw-r--r--plugin/auth_ed25519/crypto_hash_sha512.h2
-rw-r--r--plugin/auth_ed25519/crypto_int32.h5
-rw-r--r--plugin/auth_ed25519/crypto_int64.h5
-rw-r--r--plugin/auth_ed25519/crypto_sign.h13
-rw-r--r--plugin/auth_ed25519/crypto_uint32.h5
-rw-r--r--plugin/auth_ed25519/crypto_uint64.h5
-rw-r--r--plugin/auth_ed25519/crypto_verify.h1
-rw-r--r--plugin/auth_ed25519/crypto_verify_32.h2
-rw-r--r--plugin/auth_ed25519/ed25519-t.c55
-rw-r--r--plugin/auth_ed25519/ref10/api.h3
-rw-r--r--plugin/auth_ed25519/ref10/base.h1344
-rw-r--r--plugin/auth_ed25519/ref10/base2.h40
-rw-r--r--plugin/auth_ed25519/ref10/d.h1
-rw-r--r--plugin/auth_ed25519/ref10/d2.h1
-rw-r--r--plugin/auth_ed25519/ref10/fe.h56
-rw-r--r--plugin/auth_ed25519/ref10/fe_0.c19
-rw-r--r--plugin/auth_ed25519/ref10/fe_1.c19
-rw-r--r--plugin/auth_ed25519/ref10/fe_add.c57
-rw-r--r--plugin/auth_ed25519/ref10/fe_cmov.c63
-rw-r--r--plugin/auth_ed25519/ref10/fe_copy.c29
-rw-r--r--plugin/auth_ed25519/ref10/fe_frombytes.c73
-rw-r--r--plugin/auth_ed25519/ref10/fe_invert.c14
-rw-r--r--plugin/auth_ed25519/ref10/fe_isnegative.c16
-rw-r--r--plugin/auth_ed25519/ref10/fe_isnonzero.c19
-rw-r--r--plugin/auth_ed25519/ref10/fe_mul.c253
-rw-r--r--plugin/auth_ed25519/ref10/fe_neg.c45
-rw-r--r--plugin/auth_ed25519/ref10/fe_pow22523.c13
-rw-r--r--plugin/auth_ed25519/ref10/fe_sq.c149
-rw-r--r--plugin/auth_ed25519/ref10/fe_sq2.c160
-rw-r--r--plugin/auth_ed25519/ref10/fe_sub.c57
-rw-r--r--plugin/auth_ed25519/ref10/fe_tobytes.c119
-rw-r--r--plugin/auth_ed25519/ref10/ge.h95
-rw-r--r--plugin/auth_ed25519/ref10/ge_add.c11
-rw-r--r--plugin/auth_ed25519/ref10/ge_add.h97
-rw-r--r--plugin/auth_ed25519/ref10/ge_double_scalarmult.c96
-rw-r--r--plugin/auth_ed25519/ref10/ge_frombytes.c50
-rw-r--r--plugin/auth_ed25519/ref10/ge_madd.c11
-rw-r--r--plugin/auth_ed25519/ref10/ge_madd.h88
-rw-r--r--plugin/auth_ed25519/ref10/ge_msub.c11
-rw-r--r--plugin/auth_ed25519/ref10/ge_msub.h88
-rw-r--r--plugin/auth_ed25519/ref10/ge_p1p1_to_p2.c12
-rw-r--r--plugin/auth_ed25519/ref10/ge_p1p1_to_p3.c13
-rw-r--r--plugin/auth_ed25519/ref10/ge_p2_0.c8
-rw-r--r--plugin/auth_ed25519/ref10/ge_p2_dbl.c11
-rw-r--r--plugin/auth_ed25519/ref10/ge_p2_dbl.h73
-rw-r--r--plugin/auth_ed25519/ref10/ge_p3_0.c9
-rw-r--r--plugin/auth_ed25519/ref10/ge_p3_dbl.c12
-rw-r--r--plugin/auth_ed25519/ref10/ge_p3_to_cached.c17
-rw-r--r--plugin/auth_ed25519/ref10/ge_p3_to_p2.c12
-rw-r--r--plugin/auth_ed25519/ref10/ge_p3_tobytes.c14
-rw-r--r--plugin/auth_ed25519/ref10/ge_precomp_0.c8
-rw-r--r--plugin/auth_ed25519/ref10/ge_scalarmult_base.c105
-rw-r--r--plugin/auth_ed25519/ref10/ge_sub.c11
-rw-r--r--plugin/auth_ed25519/ref10/ge_sub.h97
-rw-r--r--plugin/auth_ed25519/ref10/ge_tobytes.c14
-rw-r--r--plugin/auth_ed25519/ref10/keypair.c23
-rw-r--r--plugin/auth_ed25519/ref10/open.c36
-rw-r--r--plugin/auth_ed25519/ref10/pow22523.h160
-rw-r--r--plugin/auth_ed25519/ref10/pow225521.h160
-rw-r--r--plugin/auth_ed25519/ref10/sc.h15
-rw-r--r--plugin/auth_ed25519/ref10/sc_muladd.c368
-rw-r--r--plugin/auth_ed25519/ref10/sc_reduce.c275
-rw-r--r--plugin/auth_ed25519/ref10/sign.c39
-rw-r--r--plugin/auth_ed25519/ref10/sqrtm1.h1
-rw-r--r--plugin/auth_ed25519/ref10/verify.c40
-rw-r--r--plugin/auth_ed25519/server_ed25519.c146
-rw-r--r--plugin/auth_examples/clear_password_client.c2
-rw-r--r--plugin/auth_gssapi/README.md2
-rw-r--r--plugin/auth_pam/auth_pam.c2
-rw-r--r--plugin/auth_pam/mapper/pam_user_map.c2
-rw-r--r--plugin/aws_key_management/CMakeLists.txt2
-rw-r--r--plugin/aws_key_management/aws_key_management_plugin.cc1
-rw-r--r--plugin/feedback/feedback.cc2
-rw-r--r--plugin/feedback/feedback.h2
-rw-r--r--plugin/feedback/sender_thread.cc2
-rw-r--r--plugin/feedback/url_base.cc2
-rw-r--r--plugin/feedback/url_http.cc2
-rw-r--r--plugin/feedback/utils.cc9
-rw-r--r--plugin/metadata_lock_info/metadata_lock_info.cc2
-rw-r--r--plugin/query_response_time/plugin.cc2
-rw-r--r--plugin/server_audit/CMakeLists.txt2
-rw-r--r--plugin/server_audit/plugin_audit_v4.h2
-rw-r--r--plugin/server_audit/server_audit.c38
-rw-r--r--plugin/sql_errlog/sql_errlog.c2
-rw-r--r--plugin/win_auth_client/handshake_client.cc2
-rw-r--r--plugin/wsrep_info/mysql-test/wsrep_info/suite.pm1
-rw-r--r--plugin/wsrep_info/plugin.cc2
-rw-r--r--scripts/CMakeLists.txt49
-rw-r--r--scripts/wsrep_sst_common (renamed from scripts/wsrep_sst_common.sh)0
-rw-r--r--sql-common/client.c13
-rw-r--r--sql/CMakeLists.txt2
-rw-r--r--sql/bounded_queue.h2
-rw-r--r--sql/contributors.h14
-rw-r--r--sql/create_options.cc2
-rw-r--r--sql/create_options.h2
-rw-r--r--sql/datadict.cc50
-rw-r--r--sql/datadict.h5
-rw-r--r--sql/event_scheduler.cc32
-rw-r--r--sql/filesort_utils.cc2
-rw-r--r--sql/gcalc_slicescan.cc2
-rw-r--r--sql/gcalc_slicescan.h2
-rw-r--r--sql/gcalc_tools.cc2
-rw-r--r--sql/gcalc_tools.h2
-rw-r--r--sql/group_by_handler.cc2
-rw-r--r--sql/group_by_handler.h2
-rw-r--r--sql/ha_partition.cc1
-rw-r--r--sql/handler.cc22
-rw-r--r--sql/item.h5
-rw-r--r--sql/item_cmpfunc.cc28
-rw-r--r--sql/item_cmpfunc.h7
-rw-r--r--sql/item_func.cc8
-rw-r--r--sql/item_strfunc.cc87
-rw-r--r--sql/item_subselect.cc9
-rw-r--r--sql/item_subselect.h9
-rw-r--r--sql/log.cc42
-rw-r--r--sql/log_event.cc18
-rw-r--r--sql/log_event_old.cc4
-rw-r--r--sql/log_slow.h2
-rw-r--r--sql/mdl.cc3
-rw-r--r--sql/multi_range_read.cc2
-rw-r--r--sql/multi_range_read.h2
-rw-r--r--sql/my_apc.cc2
-rw-r--r--sql/my_apc.h2
-rw-r--r--sql/my_json_writer.cc2
-rw-r--r--sql/my_json_writer.h2
-rw-r--r--sql/mysql_install_db.cc6
-rw-r--r--sql/mysql_upgrade_service.cc2
-rw-r--r--sql/mysqld.cc122
-rw-r--r--sql/mysqld.h6
-rw-r--r--sql/nt_servc.cc2
-rw-r--r--sql/nt_servc.h2
-rw-r--r--sql/opt_index_cond_pushdown.cc2
-rw-r--r--sql/opt_range.cc14
-rw-r--r--sql/opt_range_mrr.cc2
-rw-r--r--sql/opt_subselect.cc2
-rw-r--r--sql/opt_subselect.h2
-rw-r--r--sql/opt_table_elimination.cc2
-rw-r--r--sql/partition_info.cc2
-rw-r--r--sql/password.c66
-rw-r--r--sql/plistsort.c2
-rw-r--r--sql/rpl_mi.cc442
-rw-r--r--sql/rpl_mi.h19
-rw-r--r--sql/rpl_parallel.cc125
-rw-r--r--sql/rpl_parallel.h1
-rw-r--r--sql/rpl_rli.cc15
-rw-r--r--sql/rpl_rli.h2
-rw-r--r--sql/sha2.cc68
-rw-r--r--sql/share/errmsg-utf8.txt2
-rw-r--r--sql/slave.cc160
-rw-r--r--sql/slave.h3
-rw-r--r--sql/sql_acl.cc91
-rw-r--r--sql/sql_alter.h35
-rw-r--r--sql/sql_analyze_stmt.cc2
-rw-r--r--sql/sql_analyze_stmt.h2
-rw-r--r--sql/sql_base.cc2
-rw-r--r--sql/sql_binlog.cc1
-rw-r--r--sql/sql_class.cc42
-rw-r--r--sql/sql_connect.cc6
-rw-r--r--sql/sql_db.cc9
-rw-r--r--sql/sql_derived.cc3
-rw-r--r--sql/sql_explain.cc2
-rw-r--r--sql/sql_explain.h2
-rw-r--r--sql/sql_expression_cache.cc2
-rw-r--r--sql/sql_expression_cache.h2
-rw-r--r--sql/sql_insert.cc13
-rw-r--r--sql/sql_join_cache.cc2
-rw-r--r--sql/sql_join_cache.h2
-rw-r--r--sql/sql_lifo_buffer.h2
-rw-r--r--sql/sql_parse.cc132
-rw-r--r--sql/sql_parse.h3
-rw-r--r--sql/sql_plugin.cc29
-rw-r--r--sql/sql_plugin_services.ic66
-rw-r--r--sql/sql_prepare.cc2
-rw-r--r--sql/sql_reload.cc56
-rw-r--r--sql/sql_repl.cc74
-rw-r--r--sql/sql_select.cc98
-rw-r--r--sql/sql_show.cc52
-rw-r--r--sql/sql_statistics.cc2
-rw-r--r--sql/sql_table.cc3
-rw-r--r--sql/sql_udf.cc9
-rw-r--r--sql/sql_yacc.yy4
-rw-r--r--sql/sys_vars.cc127
-rw-r--r--sql/table.cc2
-rw-r--r--sql/threadpool.h2
-rw-r--r--sql/threadpool_common.cc2
-rw-r--r--sql/threadpool_generic.cc2
-rw-r--r--sql/threadpool_win.cc2
-rw-r--r--sql/winservice.c2
-rw-r--r--sql/winservice.h2
-rw-r--r--sql/wsrep_applier.h2
-rw-r--r--sql/wsrep_check_opts.cc2
-rw-r--r--sql/wsrep_hton.cc2
-rw-r--r--sql/wsrep_mysqld.cc2
-rw-r--r--sql/wsrep_mysqld.h2
-rw-r--r--sql/wsrep_notify.cc2
-rw-r--r--sql/wsrep_priv.h2
-rw-r--r--sql/wsrep_sst.cc2
-rw-r--r--sql/wsrep_utils.cc2
-rw-r--r--sql/wsrep_var.cc2
-rw-r--r--sql/wsrep_xid.cc2
-rw-r--r--storage/cassandra/ha_cassandra.cc2
-rw-r--r--storage/cassandra/ha_cassandra.h2
-rw-r--r--storage/connect/CMakeLists.txt10
-rw-r--r--storage/connect/array.cpp108
-rw-r--r--storage/connect/array.h6
-rw-r--r--storage/connect/colblk.cpp16
-rw-r--r--storage/connect/connect.cc79
-rw-r--r--storage/connect/connect.h2
-rw-r--r--storage/connect/domdoc.cpp11
-rw-r--r--storage/connect/domdoc.h1
-rw-r--r--storage/connect/filamap.cpp12
-rw-r--r--storage/connect/filamdbf.cpp27
-rw-r--r--storage/connect/filamgz.cpp12
-rw-r--r--storage/connect/filamgz.h12
-rw-r--r--storage/connect/filamzip.cpp561
-rw-r--r--storage/connect/filamzip.h164
-rw-r--r--storage/connect/ha_connect.cc347
-rw-r--r--storage/connect/ha_connect.h2
-rw-r--r--storage/connect/inihandl.c2
-rw-r--r--storage/connect/ioapi.c21
-rw-r--r--storage/connect/jdbconn.cpp24
-rw-r--r--storage/connect/json.cpp80
-rw-r--r--storage/connect/jsonudf.cpp109
-rw-r--r--storage/connect/mycat.cc17
-rw-r--r--storage/connect/mycat.h2
-rw-r--r--storage/connect/myconn.cpp20
-rw-r--r--storage/connect/mysql-test/connect/r/xml_zip.result98
-rw-r--r--storage/connect/mysql-test/connect/r/zip.result240
-rw-r--r--storage/connect/mysql-test/connect/std_data/bios.json273
-rw-r--r--storage/connect/mysql-test/connect/std_data/xsample2.xml47
-rw-r--r--storage/connect/mysql-test/connect/t/have_zip.inc19
-rw-r--r--storage/connect/mysql-test/connect/t/xml_zip.test41
-rw-r--r--storage/connect/mysql-test/connect/t/zip.test136
-rw-r--r--storage/connect/odbconn.cpp14
-rw-r--r--storage/connect/plgdbsem.h26
-rw-r--r--storage/connect/plgdbutl.cpp14
-rw-r--r--storage/connect/plgxml.cpp4
-rw-r--r--storage/connect/plgxml.h2
-rw-r--r--storage/connect/plugutil.c3
-rw-r--r--storage/connect/reldef.cpp6
-rw-r--r--storage/connect/reldef.h18
-rw-r--r--storage/connect/tabdos.cpp40
-rw-r--r--storage/connect/tabdos.h8
-rw-r--r--storage/connect/tabext.cpp640
-rw-r--r--storage/connect/tabext.h200
-rw-r--r--storage/connect/tabfix.cpp4
-rw-r--r--storage/connect/tabfix.h2
-rw-r--r--storage/connect/tabfmt.cpp75
-rw-r--r--storage/connect/tabfmt.h5
-rw-r--r--storage/connect/tabjdbc.cpp555
-rw-r--r--storage/connect/tabjdbc.h129
-rw-r--r--storage/connect/tabjson.cpp31
-rw-r--r--storage/connect/tabjson.h4
-rw-r--r--storage/connect/table.cpp249
-rw-r--r--storage/connect/tabmac.cpp2
-rw-r--r--storage/connect/tabmac.h2
-rw-r--r--storage/connect/tabmul.cpp30
-rw-r--r--storage/connect/tabmul.h18
-rw-r--r--storage/connect/tabmysql.cpp183
-rw-r--r--storage/connect/tabmysql.h75
-rw-r--r--storage/connect/taboccur.cpp9
-rw-r--r--storage/connect/tabodbc.cpp321
-rw-r--r--storage/connect/tabodbc.h133
-rw-r--r--storage/connect/tabpivot.cpp7
-rw-r--r--storage/connect/tabpivot.h2
-rw-r--r--storage/connect/tabsys.cpp8
-rw-r--r--storage/connect/tabsys.h4
-rw-r--r--storage/connect/tabtbl.cpp23
-rw-r--r--storage/connect/tabutil.cpp23
-rw-r--r--storage/connect/tabutil.h8
-rw-r--r--storage/connect/tabvct.cpp6
-rw-r--r--storage/connect/tabvct.h2
-rw-r--r--storage/connect/tabvir.cpp2
-rw-r--r--storage/connect/tabwmi.cpp21
-rw-r--r--storage/connect/tabxcl.cpp8
-rw-r--r--storage/connect/tabxcl.h2
-rw-r--r--storage/connect/tabxml.cpp13
-rw-r--r--storage/connect/tabxml.h2
-rw-r--r--storage/connect/tabzip.cpp16
-rw-r--r--storage/connect/tabzip.h2
-rw-r--r--storage/connect/user_connect.cc2
-rw-r--r--storage/connect/user_connect.h2
-rw-r--r--storage/connect/value.h2
-rwxr-xr-xstorage/connect/xindex.cpp8
-rw-r--r--storage/connect/xindex.h4
-rw-r--r--storage/connect/xobject.h3
-rw-r--r--storage/connect/xtable.h211
-rw-r--r--storage/connect/zip.c14
-rw-r--r--storage/innobase/btr/btr0cur.cc7
-rw-r--r--storage/innobase/btr/btr0scrub.cc41
-rw-r--r--storage/innobase/buf/buf0buf.cc513
-rw-r--r--storage/innobase/buf/buf0dblwr.cc17
-rw-r--r--storage/innobase/buf/buf0dump.cc2
-rw-r--r--storage/innobase/buf/buf0flu.cc12
-rw-r--r--storage/innobase/dict/dict0crea.cc2
-rw-r--r--storage/innobase/dict/dict0dict.cc1
-rw-r--r--storage/innobase/dict/dict0stats_bg.cc4
-rw-r--r--storage/innobase/fil/fil0crypt.cc1469
-rw-r--r--storage/innobase/fil/fil0fil.cc763
-rw-r--r--storage/innobase/fil/fil0pagecompress.cc11
-rw-r--r--storage/innobase/fsp/fsp0file.cc12
-rw-r--r--storage/innobase/fsp/fsp0fsp.cc29
-rw-r--r--storage/innobase/fsp/fsp0sysspace.cc2
-rw-r--r--storage/innobase/fts/fts0fts.cc4
-rw-r--r--storage/innobase/handler/ha_innodb.cc93
-rw-r--r--storage/innobase/handler/ha_innodb.h9
-rw-r--r--storage/innobase/handler/handler0alter.cc6
-rw-r--r--storage/innobase/handler/i_s.cc112
-rw-r--r--storage/innobase/ibuf/ibuf0ibuf.cc23
-rw-r--r--storage/innobase/include/buf0buf.h139
-rw-r--r--storage/innobase/include/buf0flu.h2
-rw-r--r--storage/innobase/include/dict0dict.ic7
-rw-r--r--storage/innobase/include/fil0crypt.h505
-rw-r--r--storage/innobase/include/fil0crypt.ic48
-rw-r--r--storage/innobase/include/fil0fil.h139
-rw-r--r--storage/innobase/include/fsp0types.h7
-rw-r--r--storage/innobase/include/ha_prototypes.h7
-rw-r--r--storage/innobase/include/mach0data.ic30
-rw-r--r--storage/innobase/include/os0file.h2
-rw-r--r--storage/innobase/include/page0page.ic1
-rw-r--r--storage/innobase/include/srv0srv.h6
-rw-r--r--storage/innobase/include/trx0trx.h4
-rw-r--r--storage/innobase/include/ut0ut.h4
-rw-r--r--storage/innobase/lock/lock0lock.cc4
-rw-r--r--storage/innobase/log/log0recv.cc9
-rw-r--r--storage/innobase/os/os0file.cc28
-rw-r--r--storage/innobase/page/page0page.cc2
-rw-r--r--storage/innobase/pars/pars0pars.cc2
-rw-r--r--storage/innobase/row/row0ftsort.cc9
-rw-r--r--storage/innobase/row/row0import.cc10
-rw-r--r--storage/innobase/row/row0merge.cc40
-rw-r--r--storage/innobase/row/row0mysql.cc16
-rw-r--r--storage/innobase/row/row0trunc.cc4
-rw-r--r--storage/innobase/row/row0upd.cc4
-rw-r--r--storage/innobase/srv/srv0srv.cc10
-rw-r--r--storage/innobase/srv/srv0start.cc10
-rw-r--r--storage/innobase/trx/trx0trx.cc3
-rw-r--r--storage/innobase/trx/trx0undo.cc2
-rw-r--r--storage/maria/ft_maria.c2
-rw-r--r--storage/maria/ha_maria.cc236
-rw-r--r--storage/maria/ha_maria.h2
-rw-r--r--storage/maria/lockman.c2
-rw-r--r--storage/maria/lockman.h2
-rw-r--r--storage/maria/ma_bitmap.c2
-rw-r--r--storage/maria/ma_blockrec.c2
-rw-r--r--storage/maria/ma_blockrec.h2
-rw-r--r--storage/maria/ma_cache.c2
-rw-r--r--storage/maria/ma_changed.c2
-rw-r--r--storage/maria/ma_check.c8
-rw-r--r--storage/maria/ma_check_standalone.h2
-rw-r--r--storage/maria/ma_checkpoint.c2
-rw-r--r--storage/maria/ma_checkpoint.h2
-rw-r--r--storage/maria/ma_checksum.c2
-rw-r--r--storage/maria/ma_close.c2
-rw-r--r--storage/maria/ma_commit.c2
-rw-r--r--storage/maria/ma_commit.h2
-rw-r--r--storage/maria/ma_control_file.c2
-rw-r--r--storage/maria/ma_control_file.h2
-rw-r--r--storage/maria/ma_create.c59
-rw-r--r--storage/maria/ma_dbug.c2
-rw-r--r--storage/maria/ma_delete.c2
-rw-r--r--storage/maria/ma_delete_all.c2
-rw-r--r--storage/maria/ma_delete_table.c19
-rw-r--r--storage/maria/ma_dynrec.c2
-rw-r--r--storage/maria/ma_extra.c2
-rw-r--r--storage/maria/ma_ft_boolean_search.c2
-rw-r--r--storage/maria/ma_ft_eval.c2
-rw-r--r--storage/maria/ma_ft_eval.h2
-rw-r--r--storage/maria/ma_ft_nlq_search.c2
-rw-r--r--storage/maria/ma_ft_parser.c2
-rw-r--r--storage/maria/ma_ft_stem.c2
-rw-r--r--storage/maria/ma_ft_test1.c2
-rw-r--r--storage/maria/ma_ft_test1.h2
-rw-r--r--storage/maria/ma_ft_update.c2
-rw-r--r--storage/maria/ma_ftdefs.h2
-rw-r--r--storage/maria/ma_fulltext.h2
-rw-r--r--storage/maria/ma_info.c2
-rw-r--r--storage/maria/ma_init.c2
-rw-r--r--storage/maria/ma_key.c2
-rw-r--r--storage/maria/ma_key_recover.c2
-rw-r--r--storage/maria/ma_key_recover.h2
-rw-r--r--storage/maria/ma_keycache.c2
-rw-r--r--storage/maria/ma_locking.c2
-rw-r--r--storage/maria/ma_loghandler.c2
-rw-r--r--storage/maria/ma_loghandler.h2
-rw-r--r--storage/maria/ma_loghandler_lsn.h2
-rw-r--r--storage/maria/ma_norec.c2
-rw-r--r--storage/maria/ma_open.c73
-rw-r--r--storage/maria/ma_packrec.c2
-rw-r--r--storage/maria/ma_page.c2
-rw-r--r--storage/maria/ma_pagecache.c30
-rw-r--r--storage/maria/ma_pagecache.h2
-rw-r--r--storage/maria/ma_pagecaches.c2
-rw-r--r--storage/maria/ma_pagecrc.c2
-rw-r--r--storage/maria/ma_panic.c2
-rw-r--r--storage/maria/ma_preload.c2
-rw-r--r--storage/maria/ma_range.c2
-rw-r--r--storage/maria/ma_recovery.c2
-rw-r--r--storage/maria/ma_recovery.h2
-rw-r--r--storage/maria/ma_recovery_util.c2
-rw-r--r--storage/maria/ma_recovery_util.h2
-rw-r--r--storage/maria/ma_rename.c2
-rw-r--r--storage/maria/ma_rfirst.c2
-rw-r--r--storage/maria/ma_rkey.c2
-rw-r--r--storage/maria/ma_rlast.c2
-rw-r--r--storage/maria/ma_rnext.c2
-rw-r--r--storage/maria/ma_rnext_same.c2
-rw-r--r--storage/maria/ma_rprev.c2
-rw-r--r--storage/maria/ma_rrnd.c2
-rw-r--r--storage/maria/ma_rsame.c2
-rw-r--r--storage/maria/ma_rsamepos.c2
-rw-r--r--storage/maria/ma_rt_index.c2
-rw-r--r--storage/maria/ma_rt_index.h2
-rw-r--r--storage/maria/ma_rt_key.c2
-rw-r--r--storage/maria/ma_rt_key.h2
-rw-r--r--storage/maria/ma_rt_mbr.c2
-rw-r--r--storage/maria/ma_rt_mbr.h2
-rw-r--r--storage/maria/ma_rt_split.c2
-rw-r--r--storage/maria/ma_rt_test.c2
-rw-r--r--storage/maria/ma_scan.c2
-rw-r--r--storage/maria/ma_search.c2
-rw-r--r--storage/maria/ma_servicethread.c2
-rw-r--r--storage/maria/ma_servicethread.h2
-rw-r--r--storage/maria/ma_sort.c2
-rw-r--r--storage/maria/ma_sp_defs.h2
-rw-r--r--storage/maria/ma_sp_key.c2
-rw-r--r--storage/maria/ma_sp_test.c2
-rw-r--r--storage/maria/ma_state.c2
-rw-r--r--storage/maria/ma_state.h2
-rw-r--r--storage/maria/ma_static.c8
-rw-r--r--storage/maria/ma_statrec.c2
-rw-r--r--storage/maria/ma_test1.c2
-rw-r--r--storage/maria/ma_test2.c2
-rw-r--r--storage/maria/ma_test3.c2
-rw-r--r--storage/maria/ma_unique.c2
-rw-r--r--storage/maria/ma_update.c2
-rw-r--r--storage/maria/ma_write.c2
-rw-r--r--storage/maria/maria_chk.c4
-rw-r--r--storage/maria/maria_def.h7
-rw-r--r--storage/maria/maria_dump_log.c2
-rw-r--r--storage/maria/maria_ftdump.c2
-rw-r--r--storage/maria/maria_pack.c2
-rw-r--r--storage/maria/maria_read_log.c2
-rw-r--r--storage/maria/tablockman.c2
-rw-r--r--storage/maria/tablockman.h2
-rw-r--r--storage/maria/trnman.c2
-rw-r--r--storage/maria/trnman.h2
-rw-r--r--storage/maria/trnman_public.h2
-rw-r--r--storage/maria/unittest/lockman-t.c2
-rw-r--r--storage/maria/unittest/lockman1-t.c2
-rw-r--r--storage/maria/unittest/lockman2-t.c2
-rw-r--r--storage/maria/unittest/ma_control_file-t.c2
-rw-r--r--storage/maria/unittest/ma_loghandler_examples.c2
-rw-r--r--storage/maria/unittest/ma_maria_log_cleanup.c2
-rw-r--r--storage/maria/unittest/ma_pagecache_consist.c2
-rw-r--r--storage/maria/unittest/ma_pagecache_rwconsist.c2
-rw-r--r--storage/maria/unittest/ma_pagecache_rwconsist2.c2
-rw-r--r--storage/maria/unittest/ma_pagecache_single.c2
-rw-r--r--storage/maria/unittest/ma_test_loghandler-t.c2
-rw-r--r--storage/maria/unittest/ma_test_loghandler_first_lsn-t.c2
-rw-r--r--storage/maria/unittest/ma_test_loghandler_max_lsn-t.c2
-rw-r--r--storage/maria/unittest/ma_test_loghandler_multigroup-t.c2
-rw-r--r--storage/maria/unittest/ma_test_loghandler_multithread-t.c2
-rw-r--r--storage/maria/unittest/ma_test_loghandler_noflush-t.c2
-rw-r--r--storage/maria/unittest/ma_test_loghandler_nologs-t.c2
-rw-r--r--storage/maria/unittest/ma_test_loghandler_pagecache-t.c2
-rw-r--r--storage/maria/unittest/ma_test_loghandler_purge-t.c2
-rw-r--r--storage/maria/unittest/sequence_storage.c2
-rw-r--r--storage/maria/unittest/sequence_storage.h2
-rw-r--r--storage/maria/unittest/test_file.c2
-rw-r--r--storage/maria/unittest/test_file.h2
-rw-r--r--storage/maria/unittest/trnman-t.c2
-rw-r--r--storage/mroonga/CMakeLists.txt2
-rw-r--r--storage/mroonga/config.sh.in2
-rw-r--r--storage/mroonga/mysql-test/mroonga/include/mroonga/check_freebsd.inc2
-rw-r--r--storage/mroonga/mysql-test/mroonga/include/mroonga/check_ha_mroonga_so.inc2
-rw-r--r--storage/mroonga/mysql-test/mroonga/include/mroonga/check_libgroonga_embedded.inc2
-rw-r--r--storage/mroonga/mysql-test/mroonga/include/mroonga/check_libgroonga_support_lz4.inc2
-rw-r--r--storage/mroonga/mysql-test/mroonga/include/mroonga/check_libgroonga_support_zlib.inc2
-rw-r--r--storage/mroonga/mysql-test/mroonga/include/mroonga/check_mariadb.inc2
-rw-r--r--storage/mroonga/mysql-test/mroonga/include/mroonga/check_osx.inc2
-rw-r--r--storage/mroonga/mysql-test/mroonga/include/mroonga/check_version.inc2
-rw-r--r--storage/mroonga/mysql-test/mroonga/include/mroonga/check_windows.inc2
-rw-r--r--storage/mroonga/mysql-test/mroonga/include/mroonga/have_32bit.inc2
-rw-r--r--storage/mroonga/mysql-test/mroonga/include/mroonga/have_64bit.inc2
-rw-r--r--storage/mroonga/mysql-test/mroonga/include/mroonga/have_fractional_seconds.inc2
-rw-r--r--storage/mroonga/mysql-test/mroonga/include/mroonga/have_freebsd.inc2
-rw-r--r--storage/mroonga/mysql-test/mroonga/include/mroonga/have_groonga_plugin_register.inc2
-rw-r--r--storage/mroonga/mysql-test/mroonga/include/mroonga/have_mariadb.inc2
-rw-r--r--storage/mroonga/mysql-test/mroonga/include/mroonga/have_mroonga.inc2
-rw-r--r--storage/mroonga/mysql-test/mroonga/include/mroonga/have_mroonga_deinit.inc2
-rw-r--r--storage/mroonga/mysql-test/mroonga/include/mroonga/have_mroonga_helper.inc2
-rw-r--r--storage/mroonga/mysql-test/mroonga/include/mroonga/have_mysql.inc2
-rw-r--r--storage/mroonga/mysql-test/mroonga/include/mroonga/have_version_100.inc2
-rw-r--r--storage/mroonga/mysql-test/mroonga/include/mroonga/have_version_100_or_later.inc2
-rw-r--r--storage/mroonga/mysql-test/mroonga/include/mroonga/have_version_55.inc2
-rw-r--r--storage/mroonga/mysql-test/mroonga/include/mroonga/have_version_56.inc2
-rw-r--r--storage/mroonga/mysql-test/mroonga/include/mroonga/have_version_56_or_later.inc2
-rw-r--r--storage/mroonga/mysql-test/mroonga/include/mroonga/have_version_57.inc2
-rw-r--r--storage/mroonga/mysql-test/mroonga/include/mroonga/load_mroonga_functions.inc2
-rw-r--r--storage/mroonga/mysql-test/mroonga/include/mroonga/skip_freebsd.inc2
-rw-r--r--storage/mroonga/mysql-test/mroonga/include/mroonga/skip_mariadb_100_or_later.inc2
-rw-r--r--storage/mroonga/mysql-test/mroonga/include/mroonga/skip_mariadb_55.inc2
-rw-r--r--storage/mroonga/mysql-test/mroonga/include/mroonga/skip_mysql_55.inc2
-rw-r--r--storage/mroonga/mysql-test/mroonga/include/mroonga/skip_mysql_57.inc2
-rw-r--r--storage/mroonga/mysql-test/mroonga/include/mroonga/skip_osx.inc2
-rw-r--r--storage/mroonga/mysql-test/mroonga/include/mroonga/support_libgroonga_lz4.inc2
-rw-r--r--storage/mroonga/mysql-test/mroonga/include/mroonga/support_libgroonga_zlib.inc2
-rw-r--r--storage/mroonga/mysql-test/mroonga/include/mroonga/unload_mroonga_functions.inc2
-rw-r--r--storage/mroonga/mysql-test/mroonga/include/mroonga/unsupport_libgroonga_lz4.inc2
-rw-r--r--storage/mroonga/mysql-test/mroonga/include/mroonga/unsupport_libgroonga_zlib.inc2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_after.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_first.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_flags_comment.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_flags_parameter.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_groonga_type_comment.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_groonga_type_parameter.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_multiple.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_plain.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_type_comment.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_index_token_filters_one_token_filter.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_index_unique_duplicated.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_index_unique_multiple_column_duplicated.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_key_multiple_column_with_data.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_primary_key.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_column_comment_not_for_mroonga.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_column_have_index.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_column_rename_after.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_column_rename_first.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_column_rename_multiple.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_column_rename_no_order.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_engine.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_token_filter.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_create_fulltext.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_fulltext_table.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_fulltext_ujis.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_fulltext_utf8.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_multiple_column.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_normal.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_primary.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_truncate.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_updating.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/alter_table_drop_column_multiple.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/alter_table_drop_column_one.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/alter_table_drop_key_multiple_column_with_data.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/alter_table_drop_primary_key.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/alter_table_enable_keys_fulltext.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/alter_table_enable_keys_fulltext_table.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/alter_table_enable_keys_fulltext_ujis.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/alter_table_enable_keys_fulltext_utf8.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/alter_table_enable_keys_multiple_column.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/alter_table_enable_keys_normal.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/alter_table_enable_keys_primary.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/alter_table_engine_decimal.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/alter_table_fulltext_add_no_primary_key.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/alter_table_fulltext_add_normal.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/alter_table_fulltext_add_table.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/alter_table_fulltext_drop_table.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/alter_table_modify_column_after.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/alter_table_modify_column_first.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/alter_table_modify_column_no_order.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/alter_table_recreate_anonymous_index_at_once.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/alter_table_rename_table.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/alter_table_spatial.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/auto_increment_TODO_SPLIT_ME.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/auto_increment_table_param.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/auto_increment_text.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/binlog_TODO_SPLIT_ME.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/collation_utf8_general_ci_french.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/collation_utf8_unicode_520_ci_french.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/collation_utf8_unicode_520_ci_japanese.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/collation_utf8_unicode_ci_french.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/collation_utf8_unicode_ci_japanese.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/column_comment_index_not_for_mroonga.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/column_comment_normal_not_for_mroonga.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/column_date_with_index.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/column_date_without_index.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/column_date_zero_date.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_32bit_2038.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_32bit_before_unix_epoch.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_32bit_max.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_32bit_out_of_range.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_64bit_2038.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_64bit_before_unix_epoch.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_64bit_max.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_64bit_version_55_out_of_range.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_64bit_version_56_or_later_out_of_range.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_fractional_seconds_with_index.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_fractional_seconds_without_index.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_freebsd_before_unix_epoch.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_null.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_with_index.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_without_index.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_zero_date.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_zero_date_strict.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/column_decimal_fractional_seconds_with_index.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/column_decimal_fractional_seconds_without_index.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/column_decimal_with_index.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/column_decimal_without_index.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/column_enum_less_with_index.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/column_enum_many_with_index.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/column_groonga__id__id.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/column_groonga__id_invalid_id.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_index_fulltext_other_table.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_index_fulltext_vector_other_table.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_index_int_other_table.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_scalar_reference.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_scalar_support_lz4.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_scalar_support_zlib.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_scalar_unsupport_lz4.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_scalar_unsupport_zlib.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_scalar_with_not_for_mroonga_comment.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_vector_order_by_with_function.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_vector_reference.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/column_int_with_index_zero_value.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/column_set_16_with_index.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/column_set_24_with_index.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/column_set_32_with_index.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/column_set_64_with_index.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/column_set_8_with_index.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/column_signed_bigint_with_index.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/column_signed_int_with_index.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/column_signed_mediumint_with_index.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/column_signed_smallint_with_index.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/column_signed_tinyint_with_index.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/column_time_fractional_seconds_with_index.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/column_time_with_index.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/column_timestamp_fractional_seconds_with_index.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/column_timestamp_with_index.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/column_tinyint_without_index.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/column_unsigned_bigint_with_index.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/column_unsigned_bigint_without_index.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/column_unsigned_int_with_index.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/column_unsigned_mediumint_with_index.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/column_unsigned_smallint_with_index.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/column_unsigned_tinyint_with_index.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/column_year_with_index.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/column_year_without_index.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/create_database_name_slash.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/create_table_TODO_SPLIT_ME.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/create_table_comment_normal.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/create_table_default_tokenizer.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/create_table_field_flags_comment.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/create_table_field_flags_parameter.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/create_table_field_groonga_type_comment.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/create_table_field_groonga_type_nonexistent.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/create_table_field_groonga_type_parameter.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/create_table_field_type_comment.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/create_table_field_type_nonexistent.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_flags_comment.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_flags_none.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_flags_parameter.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_index_flags_none.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_index_flags_with_position_and_with_weight.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_normalizer_comment.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_normalizer_no_utf8_charset_with_utf8_normalizer.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_normalizer_none.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_normalizer_parameter.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_parser_comment.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_parser_default.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_parser_off.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_token_filters_multiple_token_filters.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_token_filters_one_token_filter.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_token_filters_parameter.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_tokenizer_comment.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_tokenizer_default.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_tokenizer_off.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_tokenizer_parameter.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/create_table_table_normalizer_default.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/create_table_table_normalizer_hash.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/create_table_table_token_filters_multiple_token_filters.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/create_table_table_token_filters_one_token_filter.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/create_table_table_token_filters_stop_word.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/delete_fulltext_column.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/delete_index_btree_many_records.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/delete_index_hash_id_no_unique.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/delete_index_hash_id_unique.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/delete_normal_column.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/delete_unsigned_bigint.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/drop_database_TODO_SPLIT_ME.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/drop_table_TODO_SPLIT_ME.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/flush_logs.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/foreign_key_create.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_empty_query.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_escape.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_leading_not.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_all.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_minus_no_operator.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_minus_with_or.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_minus_with_plus.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_or_no_operator.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_or_with_minus.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_or_with_plus.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_plus_no_operator.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_plus_with_astarisk.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_plus_with_minus.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_plus_with_or.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_weight_full_spec.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_weight_no_weight.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_weight_omit_section.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_weight_ten_or_more_sections.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_weight_three_or_more_sections.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_syntax_error_error.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_syntax_error_error_and_log.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_syntax_error_ignore.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_syntax_error_ignore_and_log.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/fulltext_charset_ascii.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/fulltext_charset_cp932.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/fulltext_charset_eucjpms.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/fulltext_charset_japanese.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/fulltext_charset_utf8mb4.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/fulltext_empty_query.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/fulltext_found_rows.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/fulltext_groonga_varchar_vector.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/fulltext_index_recreate.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/fulltext_insert_select.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/fulltext_insert_values.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/fulltext_multiple_column_index_delete.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/fulltext_multiple_column_index_insert.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/fulltext_multiple_column_index_recreate.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/fulltext_multiple_column_index_update.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/fulltext_multiple_index.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/fulltext_no_primary_key.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/fulltext_not_match_against.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/fulltext_or.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_boolean_mode_different_against.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_boolean_mode_different_match.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_boolean_mode_no_where.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_boolean_mode_same_match_against.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_natural_language_mode_asc.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_natural_language_mode_desc.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_natural_language_mode_different_against.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_natural_language_mode_different_match.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_natural_language_mode_no_where.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_natural_language_mode_same_match_against.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/fulltext_two_inner_join.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/fulltext_version_100_no_such_key.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/fulltext_version_55_no_such_key.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/fulltext_version_56_no_such_key.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/function_command_select.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/function_escape_error_query_is_missing.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/function_escape_error_query_is_not_string.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/function_escape_error_target_characters_is_not_string.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/function_escape_success_all.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/function_escape_success_custom.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/function_escape_success_nested.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/function_last_insert_grn_id.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/function_last_insert_id_reference.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/function_last_insert_id_set.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_ascii.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_cp932.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_eucjpms.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_invalid_nonexistent_charset.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_invalid_unsupported_charset.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_japanese.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/geometry_bulk_insert_null.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/geometry_bulk_insert_null_57.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/geometry_contains.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/index_btree_equal_datetime.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/index_btree_equal_time.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/index_btree_equal_timestamp.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/index_btree_normal_column_insert.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/index_hash_id_normal.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/index_hash_id_primary.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/index_hash_id_unique.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/index_hash_normal_column_insert.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_delete.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_nullable_smallint.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_nullable_unsigned_bigint.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_nullable_unsigned_int.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_nullable_unsigned_smallint.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_nullable_varchar.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_primary_delete.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_primary_select_int.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_primary_update.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_range_not_used_in_order_by_greater_than.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_range_not_used_in_order_by_greater_than_or_equal.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_range_not_used_in_order_by_less_than.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_range_not_used_in_order_by_less_than_or_equal.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_recreate.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_replace.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_select_double.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_select_float.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_select_int.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_select_string.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_select_varchar.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_date_32bit_equal.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_date_64bit_equal.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_date_index_read.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_date_order_32bit_asc.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_date_order_32bit_desc.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_date_order_64bit_asc.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_date_order_64bit_desc.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_date_reinsert.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_datetime_index_read.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_datetime_insert_delete_insert_invalid_value.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_datetime_order_asc.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_datetime_order_desc.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_datetime_reinsert.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_decimal.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_time_index_read.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_time_order_asc.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_time_order_desc.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_time_reinsert.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_timestamp_index_read.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_timestamp_order_asc.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_timestamp_order_desc.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_timestamp_reinsert.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_varchar.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_year_32bit_equal.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_year_64bit_equal.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_year_index_read.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_year_order_32bit_asc.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_year_order_32bit_desc.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_year_order_64bit_asc.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_year_order_64bit_desc.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_year_reinsert.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_update_int.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_update_string.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/index_primary_char_exact_length.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/index_primary_char_null_character.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/index_primary_char_short.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/index_primary_date.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/index_primary_datetime_with_fractional_seconds.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/index_primary_datetime_without_fractional_seconds.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/index_primary_decimal_with_fractional_seconds.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/index_primary_decimal_without_fractional_seconds.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/index_primary_time_with_fractional_seconds.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/index_primary_time_without_fractional_seconds.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/index_primary_timestamp_with_fractional_seconds.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/index_primary_timestamp_without_fractional_seconds.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/index_primary_varchar_null_character.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/index_primary_year.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/index_range_normal_greater_than_asc.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/index_range_normal_greater_than_desc.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/index_range_normal_greater_than_or_equal_asc.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/index_range_normal_greater_than_or_equal_desc.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/index_range_normal_less_than_asc.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/index_range_normal_less_than_desc.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/index_range_normal_less_than_or_equal_asc.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/index_range_normal_less_than_or_equal_desc.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/index_range_primary_greater_than_asc.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/index_range_primary_greater_than_desc.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/index_range_primary_greater_than_or_equal_asc.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/index_range_primary_greater_than_or_equal_desc.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/index_range_primary_less_than_asc.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/index_range_primary_less_than_desc.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/index_range_primary_less_than_or_equal_asc.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/index_range_primary_less_than_or_equal_desc.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_bigint.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_bigint_unsigned.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_double.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_float.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_int.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_int_unsigned.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_mediumint.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_mediumint_unsigned.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_smallint.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_smallint_unsigned.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_tinyint.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_tinyint_unsigned.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_varchar.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_varchar_collation.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/index_read_normal_int.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/index_read_normal_varchar.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/index_read_primary_int.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/index_read_primary_varchar.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/index_unique_delete_by_primary_key.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/index_unique_insert_after_error.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/index_unique_search_after_duplicated.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/index_unique_varchar.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/index_update_multiple_column.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/index_update_single_column.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/information_schema_plugins.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/information_schema_tables_auto_increment_none.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/information_schema_tables_auto_increment_use.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/information_schema_tables_data_length.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/insert_TODO_SPLIT_ME.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/insert_delayed.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/insert_on_duplicate_key_update_no_primary_key_and_unique_key_twice.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/insert_on_duplicate_key_update_primary_key.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/insert_on_duplicate_key_update_unique_key.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/like_unicode_ci.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/lock_tables_read.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_TODO_SPLIT_ME.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_after_insert_multithread.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_after_insert_single_thread.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_disabled.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_index_view.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_not_optimized_disabled.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_not_optimized_no_limit.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_datetime_between.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_datetime_between_over.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_datetime_equal.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_datetime_greater_than.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_datetime_greater_than_or_equal.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_datetime_less_than.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_datetime_less_than_or_equal.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_duplicated_order_by_columns.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_have_primary_key.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_int_between.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_int_between_over.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_int_equal.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_int_greater_than.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_int_greater_than_or_equal.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_int_less_than.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_int_less_than_or_equal.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_no_primary_key.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_no_where_clause.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_order_by_asc.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_order_by_desc.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_order_by_id.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_order_by_match_against.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_select_match_against.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_time_between.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_time_between_over.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_time_equal.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_time_greater_than.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_time_greater_than_or_equal.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_time_less_than.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_time_less_than_or_equal.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_varchar_equal_with_index.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_varchar_equal_without_index.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_year_between.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_year_between_over.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_year_equal.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_year_greater_than.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_year_greater_than_or_equal.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_year_less_than.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_year_less_than_or_equal.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/partition_insert.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/partition_update.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/repair_table_no_index_file.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/replace_geometry.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/replace_select_varchar.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/replace_text.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/replace_varchar.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/replace_vector.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/replace_without_key.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/select_all.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/select_empty_key_where_equal.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/select_empty_key_where_not_equal.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/select_group_by_with_index.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/select_group_by_without_index.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/select_pkey.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/select_secondary_key.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/show_create_table_TODO_SPLIT_ME.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/sub_query_fulltext.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/temporary_table.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/truncate.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/update_fulltext.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/update_id_hash_index.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/update_id_unique_hash_index.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/update_int.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/update_last_insert_grn_id.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/update_virtual_column.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/variable_boolean_mode_syntax_flags_allow_column.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/variable_boolean_mode_syntax_flags_allow_leading_not.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/variable_boolean_mode_syntax_flags_allow_update.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/variable_boolean_mode_syntax_flags_syntax_query.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/variable_boolean_mode_syntax_flags_syntax_script.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/variable_database_path_prefix.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/variable_default_parser_new_value.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/variable_default_parser_same_value.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/variable_dry_write_delete.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/variable_dry_write_insert.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/variable_dry_write_update.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/variable_lock_timeout_disable.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/variable_lock_timeout_invalid.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/variable_lock_timeout_no_retry.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/variable_lock_timeout_valid.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/variable_log_file_new_value.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/variable_log_file_nonexistent_path.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/variable_log_file_same_value.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/variable_log_level_TODO_SPLIT_ME.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/variable_match_escalation_threshold_global.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/variable_match_escalation_threshold_session.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/variable_max_n_records_for_estimate_global.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/variable_max_n_records_for_estimate_session.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/variable_vector_column_delimiter.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/variable_version.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_add_column.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_change_column_comment.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_change_engine.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_comment_change_engine.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_disable_keys_create_fulltext.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_disable_keys_fulltext.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_disable_keys_multiple_column.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_disable_keys_normal.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_disable_keys_primary.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_disable_keys_updating.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_drop_column.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_enable_keys_fulltext.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_enable_keys_lock_tables.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_enable_keys_multiple_column.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_enable_keys_normal.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_enable_keys_primary.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_fulltext.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_rename_table.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_spatial.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/t/auto_increment_text.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/t/binlog_TODO_SPLIT_ME.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/t/column_comment_index_not_for_mroonga.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/t/column_normal_comment.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/t/count_star_with_index.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_TODO_SPLIT_ME.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_comment_combined.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_flags_comment.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_flags_none.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_flags_parameter.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_index_flags_none.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_index_flags_with_position_and_with_weight.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_normalizer_comment.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_normalizer_parameter.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_parser_comment.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_token_filters_index_multiple_token_filters.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_token_filters_index_one_token_filter.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_token_filters_index_parameter.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_tokenizer_comment.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_tokenizer_parameter.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/t/delete_TODO_SPLIT_ME.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/t/delete_all.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_leading_not.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_multiple_match_against.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_minus_no_operator.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_minus_with_or.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_minus_with_plus.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_or_no_operator.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_or_with_minus.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_or_with_plus.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_plus_no_operator.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_plus_with_minus.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_plus_with_or.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_weight_full_spec.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_weight_no_weight.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_weight_omit_section.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_charset_ascii.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_charset_cp932.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_charset_eucjpms.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_charset_japanese.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_index_recreate.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_insert_select.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_insert_values.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_many_records.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_matched_and_not_matched_have_where_matched_order.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_matched_and_not_matched_have_where_no_order.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_matched_and_not_matched_no_where_both_order.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_multiple_column_index_delete.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_multiple_column_index_insert.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_multiple_column_index_recreate.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_multiple_column_index_update.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_multiple_index.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_myisam.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_not_match_against.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_order_TODO_SPLIT_ME.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_order_transaction.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/t/function_last_insert_id_reference.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/t/function_last_insert_id_set.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/t/geometry_contains.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/t/geometry_delete.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/t/geometry_update.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/t/index_force_index_not_used.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/t/insert_TODO_SPLIT_ME.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/t/insert_bulk.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/t/insert_on_duplicate_key_update_multiple_column_primary_key_myisam.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/t/insert_on_duplicate_key_update_multiple_column_unique_index_myisam.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/t/multi_range_read_disk_sweep.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/t/optimization_order_limit_TODO_SPLIT_ME.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/t/optimization_order_limit_no_direction.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/t/optimization_order_limit_no_where_clause.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/t/optimization_order_limit_order_by_primary_key.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/t/performance_schema.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/t/repair_table_no_files.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/t/repair_table_no_index_file.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/t/temporary_table.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/t/transaction_query_cache.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/t/transaction_rollback_delete_delete.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/t/transaction_rollback_delete_update.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/t/truncate.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/t/update_fulltext.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/t/update_int.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/t/variable_dry_write_delete.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/t/variable_dry_write_insert.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/t/variable_dry_write_update.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/t/variable_match_escalation_threshold_global.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/t/variable_match_escalation_threshold_session.test2
-rwxr-xr-xstorage/mroonga/test/run-sql-test.sh2
-rw-r--r--storage/mroonga/test/unit/test_mrn_path_mapper.cpp2
-rwxr-xr-xstorage/mroonga/tools/travis/before_script.sh2
-rwxr-xr-xstorage/mroonga/tools/travis/install.sh2
-rwxr-xr-xstorage/mroonga/tools/travis/script.sh2
-rw-r--r--storage/mroonga/vendor/groonga/lib/CMakeLists.txt12
-rw-r--r--storage/myisam/ft_myisam.c2
-rw-r--r--storage/myisam/ha_myisam.cc304
-rw-r--r--storage/myisam/ha_myisam.h2
-rw-r--r--storage/myisam/mi_check.c17
-rw-r--r--storage/myisam/mi_create.c53
-rw-r--r--storage/myisam/mi_delete_table.c37
-rw-r--r--storage/myisam/mi_open.c71
-rw-r--r--storage/myisam/mi_static.c8
-rw-r--r--storage/myisam/myisamchk.c2
-rw-r--r--storage/myisam/myisamdef.h3
-rw-r--r--storage/oqgraph/graphcore-config.h2
-rw-r--r--storage/oqgraph/graphcore-graph.cc2
-rw-r--r--storage/oqgraph/graphcore-graph.h2
-rw-r--r--storage/oqgraph/graphcore-types.h2
-rw-r--r--storage/oqgraph/graphcore.cc2
-rw-r--r--storage/oqgraph/graphcore.h2
-rw-r--r--storage/oqgraph/ha_oqgraph.cc2
-rw-r--r--storage/oqgraph/ha_oqgraph.h2
-rwxr-xr-xstorage/oqgraph/mysql-test/oqgraph/generate_backing_table_tests_suite.sh3
-rwxr-xr-xstorage/oqgraph/mysql-test/oqgraph/maintainer-general-record.sh1
-rw-r--r--storage/oqgraph/mysql-test/oqgraph/regression_mdev6282.result2
-rw-r--r--storage/oqgraph/mysql-test/oqgraph/regression_mdev6282.test2
-rw-r--r--storage/oqgraph/mysql-test/oqgraph/regression_mdev6345.result2
-rw-r--r--storage/oqgraph/mysql-test/oqgraph/regression_mdev6345.test2
-rw-r--r--storage/oqgraph/oqgraph_judy.cc2
-rw-r--r--storage/oqgraph/oqgraph_judy.h2
-rw-r--r--storage/oqgraph/oqgraph_probes.d2
-rw-r--r--storage/oqgraph/oqgraph_shim.cc2
-rw-r--r--storage/oqgraph/oqgraph_shim.h2
-rw-r--r--storage/oqgraph/oqgraph_thunk.cc2
-rw-r--r--storage/oqgraph/oqgraph_thunk.h2
-rw-r--r--storage/spider/ha_spider.cc2
-rw-r--r--storage/spider/ha_spider.h2
-rw-r--r--storage/spider/hs_client/hs_compat.h2
-rw-r--r--storage/spider/spd_conn.cc2
-rw-r--r--storage/spider/spd_conn.h2
-rw-r--r--storage/spider/spd_copy_tables.cc2
-rw-r--r--storage/spider/spd_copy_tables.h2
-rw-r--r--storage/spider/spd_db_conn.cc2
-rw-r--r--storage/spider/spd_db_conn.h2
-rw-r--r--storage/spider/spd_db_handlersocket.cc2
-rw-r--r--storage/spider/spd_db_handlersocket.h2
-rw-r--r--storage/spider/spd_db_include.h2
-rw-r--r--storage/spider/spd_db_mysql.cc2
-rw-r--r--storage/spider/spd_db_mysql.h2
-rw-r--r--storage/spider/spd_db_oracle.cc2
-rw-r--r--storage/spider/spd_db_oracle.h2
-rw-r--r--storage/spider/spd_direct_sql.cc2
-rw-r--r--storage/spider/spd_direct_sql.h2
-rw-r--r--storage/spider/spd_err.h2
-rw-r--r--storage/spider/spd_i_s.cc2
-rw-r--r--storage/spider/spd_include.h2
-rw-r--r--storage/spider/spd_malloc.cc2
-rw-r--r--storage/spider/spd_malloc.h2
-rw-r--r--storage/spider/spd_param.cc2
-rw-r--r--storage/spider/spd_param.h2
-rw-r--r--storage/spider/spd_ping_table.cc2
-rw-r--r--storage/spider/spd_ping_table.h2
-rw-r--r--storage/spider/spd_sys_table.cc2
-rw-r--r--storage/spider/spd_sys_table.h2
-rw-r--r--storage/spider/spd_table.cc2
-rw-r--r--storage/spider/spd_table.h2
-rw-r--r--storage/spider/spd_trx.cc2
-rw-r--r--storage/spider/spd_trx.h2
-rw-r--r--storage/spider/spd_udf.cc2
-rw-r--r--storage/spider/spd_udf.h2
-rw-r--r--storage/tokudb/CMakeLists.txt2
-rw-r--r--storage/tokudb/PerconaFT/cmake_modules/TokuSetupCompiler.cmake6
-rw-r--r--storage/tokudb/PerconaFT/ft/ft-ops.cc23
-rw-r--r--storage/tokudb/PerconaFT/ft/ft-ops.h5
-rw-r--r--storage/tokudb/PerconaFT/ft/logger/recover.cc3
-rw-r--r--storage/tokudb/PerconaFT/ft/node.cc18
-rw-r--r--storage/tokudb/PerconaFT/ft/node.h54
-rw-r--r--storage/tokudb/PerconaFT/ft/serialize/ft_node-serialize.cc3
-rw-r--r--storage/tokudb/PerconaFT/ft/txn/roll.cc3
-rw-r--r--storage/tokudb/PerconaFT/third_party/snappy-1.1.2/aclocal.m42
-rw-r--r--storage/tokudb/PerconaFT/util/dmt.h5
-rw-r--r--storage/tokudb/PerconaFT/util/omt.h2
-rw-r--r--storage/tokudb/ha_tokudb.cc81
-rw-r--r--storage/tokudb/ha_tokudb.h2
-rw-r--r--storage/tokudb/mysql-test/tokudb/r/dir_per_db_rename_to_nonexisting_schema.result46
-rw-r--r--storage/tokudb/mysql-test/tokudb/r/gap_lock_error.result469
-rw-r--r--storage/tokudb/mysql-test/tokudb/r/locks-select-update-3.result1
-rw-r--r--storage/tokudb/mysql-test/tokudb/r/percona_kill_idle_trx_tokudb.result43
-rw-r--r--storage/tokudb/mysql-test/tokudb/t/dir_per_db_rename_to_nonexisting_schema.test64
-rw-r--r--storage/tokudb/mysql-test/tokudb/t/gap_lock_error.test5
-rw-r--r--storage/tokudb/mysql-test/tokudb/t/locks-select-update-3.test1
-rw-r--r--storage/tokudb/mysql-test/tokudb/t/percona_kill_idle_trx_tokudb.test5
-rw-r--r--storage/tokudb/mysql-test/tokudb_backup/t/suite.opt2
-rw-r--r--storage/xtradb/btr/btr0btr.cc2
-rw-r--r--storage/xtradb/btr/btr0cur.cc116
-rw-r--r--storage/xtradb/btr/btr0scrub.cc48
-rw-r--r--storage/xtradb/buf/buf0buddy.cc1
-rw-r--r--storage/xtradb/buf/buf0buf.cc713
-rw-r--r--storage/xtradb/buf/buf0dblwr.cc17
-rw-r--r--storage/xtradb/buf/buf0dump.cc15
-rw-r--r--storage/xtradb/buf/buf0flu.cc4
-rw-r--r--storage/xtradb/buf/buf0lru.cc142
-rw-r--r--storage/xtradb/buf/buf0mtflu.cc9
-rw-r--r--storage/xtradb/dict/dict0dict.cc1
-rw-r--r--storage/xtradb/dict/dict0stats.cc13
-rw-r--r--storage/xtradb/dict/dict0stats_bg.cc5
-rw-r--r--storage/xtradb/dyn/dyn0dyn.cc1
-rw-r--r--storage/xtradb/fil/fil0crypt.cc1323
-rw-r--r--storage/xtradb/fil/fil0fil.cc689
-rw-r--r--storage/xtradb/fil/fil0pagecompress.cc2
-rw-r--r--storage/xtradb/fsp/fsp0fsp.cc53
-rw-r--r--storage/xtradb/fts/fts0fts.cc2
-rw-r--r--storage/xtradb/fts/fts0opt.cc7
-rw-r--r--storage/xtradb/handler/ha_innodb.cc186
-rw-r--r--storage/xtradb/handler/ha_innodb.h11
-rw-r--r--storage/xtradb/handler/handler0alter.cc85
-rw-r--r--storage/xtradb/handler/i_s.cc129
-rw-r--r--storage/xtradb/ibuf/ibuf0ibuf.cc49
-rw-r--r--storage/xtradb/include/btr0cur.h18
-rw-r--r--storage/xtradb/include/btr0sea.h7
-rw-r--r--storage/xtradb/include/btr0sea.ic4
-rw-r--r--storage/xtradb/include/buf0buddy.ic2
-rw-r--r--storage/xtradb/include/buf0buf.h95
-rw-r--r--storage/xtradb/include/buf0dblwr.h7
-rw-r--r--storage/xtradb/include/dict0dict.h19
-rw-r--r--storage/xtradb/include/dict0dict.ic7
-rw-r--r--storage/xtradb/include/dict0stats_bg.h4
-rw-r--r--storage/xtradb/include/dyn0dyn.h18
-rw-r--r--storage/xtradb/include/dyn0dyn.ic10
-rw-r--r--storage/xtradb/include/fil0crypt.h480
-rw-r--r--storage/xtradb/include/fil0crypt.ic32
-rw-r--r--storage/xtradb/include/fil0fil.h140
-rw-r--r--storage/xtradb/include/fil0fil.ic37
-rw-r--r--storage/xtradb/include/fsp0fsp.h11
-rw-r--r--storage/xtradb/include/fsp0types.h1
-rw-r--r--storage/xtradb/include/fts0types.h4
-rw-r--r--storage/xtradb/include/ha_prototypes.h7
-rw-r--r--storage/xtradb/include/lock0lock.h16
-rw-r--r--storage/xtradb/include/log0log.h22
-rw-r--r--storage/xtradb/include/log0online.h20
-rw-r--r--storage/xtradb/include/log0recv.h35
-rw-r--r--storage/xtradb/include/mach0data.h16
-rw-r--r--storage/xtradb/include/mach0data.ic13
-rw-r--r--storage/xtradb/include/mtr0mtr.h5
-rw-r--r--storage/xtradb/include/os0file.h34
-rw-r--r--storage/xtradb/include/os0thread.h8
-rw-r--r--storage/xtradb/include/page0page.h20
-rw-r--r--storage/xtradb/include/page0page.ic1
-rw-r--r--storage/xtradb/include/page0zip.h7
-rw-r--r--storage/xtradb/include/rem0rec.h3
-rw-r--r--storage/xtradb/include/row0upd.h5
-rw-r--r--storage/xtradb/include/srv0srv.h50
-rw-r--r--storage/xtradb/include/trx0purge.h6
-rw-r--r--storage/xtradb/include/trx0trx.h4
-rw-r--r--storage/xtradb/include/univ.i4
-rw-r--r--storage/xtradb/include/ut0ut.h4
-rw-r--r--storage/xtradb/include/ut0wqueue.h5
-rw-r--r--storage/xtradb/lock/lock0lock.cc55
-rw-r--r--storage/xtradb/log/log0crypt.cc8
-rw-r--r--storage/xtradb/log/log0log.cc46
-rw-r--r--storage/xtradb/log/log0online.cc177
-rw-r--r--storage/xtradb/log/log0recv.cc221
-rw-r--r--storage/xtradb/mach/mach0data.cc44
-rw-r--r--storage/xtradb/mtr/mtr0mtr.cc1
-rw-r--r--storage/xtradb/os/os0file.cc286
-rw-r--r--storage/xtradb/os/os0thread.cc28
-rw-r--r--storage/xtradb/page/page0page.cc2
-rw-r--r--storage/xtradb/page/page0zip.cc2
-rw-r--r--storage/xtradb/pars/pars0pars.cc2
-rw-r--r--storage/xtradb/rem/rem0rec.cc2
-rw-r--r--storage/xtradb/row/row0ftsort.cc11
-rw-r--r--storage/xtradb/row/row0import.cc12
-rw-r--r--storage/xtradb/row/row0merge.cc34
-rw-r--r--storage/xtradb/row/row0mysql.cc61
-rw-r--r--storage/xtradb/row/row0purge.cc2
-rw-r--r--storage/xtradb/row/row0upd.cc4
-rw-r--r--storage/xtradb/srv/srv0conc.cc9
-rw-r--r--storage/xtradb/srv/srv0srv.cc322
-rw-r--r--storage/xtradb/srv/srv0start.cc165
-rw-r--r--storage/xtradb/sync/sync0sync.cc3
-rw-r--r--storage/xtradb/trx/trx0purge.cc20
-rw-r--r--storage/xtradb/trx/trx0roll.cc20
-rw-r--r--storage/xtradb/trx/trx0sys.cc70
-rw-r--r--storage/xtradb/trx/trx0trx.cc9
-rw-r--r--storage/xtradb/trx/trx0undo.cc29
-rw-r--r--strings/strings_def.h2
-rw-r--r--strings/strmov.c1
-rw-r--r--strings/strmov_overlapp.c2
-rw-r--r--support-files/CMakeLists.txt2
-rw-r--r--support-files/MacOSX/ReadMe.txt4
-rw-r--r--support-files/compiler_warnings.supp2
-rw-r--r--support-files/mariadb.service.in12
-rw-r--r--support-files/mariadb@.service.in24
-rw-r--r--support-files/my-innodb-heavy-4G.cnf.sh4
-rw-r--r--support-files/mysql-log-rotate.sh3
-rw-r--r--support-files/mysql-multi.server.sh2
-rw-r--r--support-files/rpm/server-postin.sh38
-rw-r--r--tests/mysql_client_test.c50
-rw-r--r--unittest/mysys/base64-t.c1
-rw-r--r--unittest/mysys/waiting_threads-t.c2
-rw-r--r--unittest/sql/mf_iocache-t.cc2
-rw-r--r--unittest/sql/my_apc-t.cc2
-rw-r--r--win/packaging/COPYING.rtf4
-rw-r--r--win/packaging/ca/CustomAction.cpp2
-rw-r--r--wsrep/wsrep_dummy.c2
-rw-r--r--wsrep/wsrep_gtid.c2
-rw-r--r--wsrep/wsrep_loader.c2
-rw-r--r--wsrep/wsrep_uuid.c2
1708 files changed, 29498 insertions, 15585 deletions
diff --git a/BUILD/compile-bintar b/BUILD/compile-bintar
index 8434bf57a52..94d1371f69d 100755
--- a/BUILD/compile-bintar
+++ b/BUILD/compile-bintar
@@ -14,7 +14,7 @@
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA.
# This script's purpose is to build the binary tarball packages for MariaDB
diff --git a/BUILD/compile-pentium64-wsrep b/BUILD/compile-pentium64-wsrep
index 0bccb34e753..53c0e897eec 100644
--- a/BUILD/compile-pentium64-wsrep
+++ b/BUILD/compile-pentium64-wsrep
@@ -14,8 +14,8 @@
#
# You should have received a copy of the GNU Library General Public
# License along with this library; if not, write to the Free
-# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
-# MA 02111-1307, USA
+# Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+# MA 02111-1301, USA
path=`dirname $0`
. "$path/SETUP.sh"
diff --git a/BUILD/util.sh b/BUILD/util.sh
index c8559184013..010b3d86e06 100644
--- a/BUILD/util.sh
+++ b/BUILD/util.sh
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA.
# Setting cpu options.
get_cpuopt () {
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 59dc149410f..b7c696bc086 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -318,6 +318,9 @@ SET(CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE ON)
# Common defines and includes
ADD_DEFINITIONS(-DHAVE_CONFIG_H)
+IF(_FILE_OFFSET_BITS)
+ ADD_DEFINITIONS(-D_FILE_OFFSET_BITS=${_FILE_OFFSET_BITS})
+ENDIF()
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}/include)
# Add bundled or system zlib.
@@ -448,8 +451,9 @@ ADD_CUSTOM_TARGET(INFO_BIN ALL
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
)
-INSTALL_DOCUMENTATION(README.md CREDITS COPYING COPYING.LESSER COPYING.thirdparty
+INSTALL_DOCUMENTATION(README.md CREDITS COPYING COPYING.thirdparty
EXCEPTIONS-CLIENT COMPONENT Readme)
+
# MDEV-6526 these files are not installed anymore
#INSTALL_DOCUMENTATION(${CMAKE_BINARY_DIR}/Docs/INFO_SRC
# ${CMAKE_BINARY_DIR}/Docs/INFO_BIN)
diff --git a/COPYING.LESSER b/COPYING.LESSER
deleted file mode 100644
index c2c87d69256..00000000000
--- a/COPYING.LESSER
+++ /dev/null
@@ -1,516 +0,0 @@
-
- GNU LESSER GENERAL PUBLIC LICENSE
- Version 2.1, February 1999
-
- Copyright (C) 1991, 1999 Free Software Foundation, Inc.
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
-[This is the first released version of the Lesser GPL. It also counts
- as the successor of the GNU Library Public License, version 2, hence
- the version number 2.1.]
-
- Preamble
-
- The licenses for most software are designed to take away your
-freedom to share and change it. By contrast, the GNU General Public
-Licenses are intended to guarantee your freedom to share and change
-free software--to make sure the software is free for all its users.
-
- This license, the Lesser General Public License, applies to some
-specially designated software packages--typically libraries--of the
-Free Software Foundation and other authors who decide to use it. You
-can use it too, but we suggest you first think carefully about whether
-this license or the ordinary General Public License is the better
-strategy to use in any particular case, based on the explanations
-below.
-
- When we speak of free software, we are referring to freedom of use,
-not price. Our General Public Licenses are designed to make sure that
-you have the freedom to distribute copies of free software (and charge
-for this service if you wish); that you receive source code or can get
-it if you want it; that you can change the software and use pieces of
-it in new free programs; and that you are informed that you can do
-these things.
-
- To protect your rights, we need to make restrictions that forbid
-distributors to deny you these rights or to ask you to surrender these
-rights. These restrictions translate to certain responsibilities for
-you if you distribute copies of the library or if you modify it.
-
- For example, if you distribute copies of the library, whether gratis
-or for a fee, you must give the recipients all the rights that we gave
-you. You must make sure that they, too, receive or can get the source
-code. If you link other code with the library, you must provide
-complete object files to the recipients, so that they can relink them
-with the library after making changes to the library and recompiling
-it. And you must show them these terms so they know their rights.
-
- We protect your rights with a two-step method: (1) we copyright the
-library, and (2) we offer you this license, which gives you legal
-permission to copy, distribute and/or modify the library.
-
- To protect each distributor, we want to make it very clear that
-there is no warranty for the free library. Also, if the library is
-modified by someone else and passed on, the recipients should know
-that what they have is not the original version, so that the original
-author's reputation will not be affected by problems that might be
-introduced by others.
-^L
- Finally, software patents pose a constant threat to the existence of
-any free program. We wish to make sure that a company cannot
-effectively restrict the users of a free program by obtaining a
-restrictive license from a patent holder. Therefore, we insist that
-any patent license obtained for a version of the library must be
-consistent with the full freedom of use specified in this license.
-
- Most GNU software, including some libraries, is covered by the
-ordinary GNU General Public License. This license, the GNU Lesser
-General Public License, applies to certain designated libraries, and
-is quite different from the ordinary General Public License. We use
-this license for certain libraries in order to permit linking those
-libraries into non-free programs.
-
- When a program is linked with a library, whether statically or using
-a shared library, the combination of the two is legally speaking a
-combined work, a derivative of the original library. The ordinary
-General Public License therefore permits such linking only if the
-entire combination fits its criteria of freedom. The Lesser General
-Public License permits more lax criteria for linking other code with
-the library.
-
- We call this license the "Lesser" General Public License because it
-does Less to protect the user's freedom than the ordinary General
-Public License. It also provides other free software developers Less
-of an advantage over competing non-free programs. These disadvantages
-are the reason we use the ordinary General Public License for many
-libraries. However, the Lesser license provides advantages in certain
-special circumstances.
-
- For example, on rare occasions, there may be a special need to
-encourage the widest possible use of a certain library, so that it
-becomes
-a de-facto standard. To achieve this, non-free programs must be
-allowed to use the library. A more frequent case is that a free
-library does the same job as widely used non-free libraries. In this
-case, there is little to gain by limiting the free library to free
-software only, so we use the Lesser General Public License.
-
- In other cases, permission to use a particular library in non-free
-programs enables a greater number of people to use a large body of
-free software. For example, permission to use the GNU C Library in
-non-free programs enables many more people to use the whole GNU
-operating system, as well as its variant, the GNU/Linux operating
-system.
-
- Although the Lesser General Public License is Less protective of the
-users' freedom, it does ensure that the user of a program that is
-linked with the Library has the freedom and the wherewithal to run
-that program using a modified version of the Library.
-
- The precise terms and conditions for copying, distribution and
-modification follow. Pay close attention to the difference between a
-"work based on the library" and a "work that uses the library". The
-former contains code derived from the library, whereas the latter must
-be combined with the library in order to run.
-^L
- GNU LESSER GENERAL PUBLIC LICENSE
- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
- 0. This License Agreement applies to any software library or other
-program which contains a notice placed by the copyright holder or
-other authorized party saying it may be distributed under the terms of
-this Lesser General Public License (also called "this License").
-Each licensee is addressed as "you".
-
- A "library" means a collection of software functions and/or data
-prepared so as to be conveniently linked with application programs
-(which use some of those functions and data) to form executables.
-
- The "Library", below, refers to any such software library or work
-which has been distributed under these terms. A "work based on the
-Library" means either the Library or any derivative work under
-copyright law: that is to say, a work containing the Library or a
-portion of it, either verbatim or with modifications and/or translated
-straightforwardly into another language. (Hereinafter, translation is
-included without limitation in the term "modification".)
-
- "Source code" for a work means the preferred form of the work for
-making modifications to it. For a library, complete source code means
-all the source code for all modules it contains, plus any associated
-interface definition files, plus the scripts used to control
-compilation
-and installation of the library.
-
- Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope. The act of
-running a program using the Library is not restricted, and output from
-such a program is covered only if its contents constitute a work based
-on the Library (independent of the use of the Library in a tool for
-writing it). Whether that is true depends on what the Library does
-and what the program that uses the Library does.
-
- 1. You may copy and distribute verbatim copies of the Library's
-complete source code as you receive it, in any medium, provided that
-you conspicuously and appropriately publish on each copy an
-appropriate copyright notice and disclaimer of warranty; keep intact
-all the notices that refer to this License and to the absence of any
-warranty; and distribute a copy of this License along with the
-Library.
-
- You may charge a fee for the physical act of transferring a copy,
-and you may at your option offer warranty protection in exchange for a
-fee.
-
- 2. You may modify your copy or copies of the Library or any portion
-of it, thus forming a work based on the Library, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
- a) The modified work must itself be a software library.
-
- b) You must cause the files modified to carry prominent notices
- stating that you changed the files and the date of any change.
-
- c) You must cause the whole of the work to be licensed at no
- charge to all third parties under the terms of this License.
-
- d) If a facility in the modified Library refers to a function or a
- table of data to be supplied by an application program that uses
- the facility, other than as an argument passed when the facility
- is invoked, then you must make a good faith effort to ensure that,
- in the event an application does not supply such function or
- table, the facility still operates, and performs whatever part of
- its purpose remains meaningful.
-
- (For example, a function in a library to compute square roots has
- a purpose that is entirely well-defined independent of the
- application. Therefore, Subsection 2d requires that any
- application-supplied function or table used by this function must
- be optional: if the application does not supply it, the square
- root function must still compute square roots.)
-
-These requirements apply to the modified work as a whole. If
-identifiable sections of that work are not derived from the Library,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works. But when you
-distribute the same sections as part of a whole which is a work based
-on the Library, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote
-it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Library.
-
-In addition, mere aggregation of another work not based on the Library
-with the Library (or with a work based on the Library) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-
- 3. You may opt to apply the terms of the ordinary GNU General Public
-License instead of this License to a given copy of the Library. To do
-this, you must alter all the notices that refer to this License, so
-that they refer to the ordinary GNU General Public License, version 2,
-instead of to this License. (If a newer version than version 2 of the
-ordinary GNU General Public License has appeared, then you can specify
-that version instead if you wish.) Do not make any other change in
-these notices.
-^L
- Once this change is made in a given copy, it is irreversible for
-that copy, so the ordinary GNU General Public License applies to all
-subsequent copies and derivative works made from that copy.
-
- This option is useful when you wish to copy part of the code of
-the Library into a program that is not a library.
-
- 4. You may copy and distribute the Library (or a portion or
-derivative of it, under Section 2) in object code or executable form
-under the terms of Sections 1 and 2 above provided that you accompany
-it with the complete corresponding machine-readable source code, which
-must be distributed under the terms of Sections 1 and 2 above on a
-medium customarily used for software interchange.
-
- If distribution of object code is made by offering access to copy
-from a designated place, then offering equivalent access to copy the
-source code from the same place satisfies the requirement to
-distribute the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
- 5. A program that contains no derivative of any portion of the
-Library, but is designed to work with the Library by being compiled or
-linked with it, is called a "work that uses the Library". Such a
-work, in isolation, is not a derivative work of the Library, and
-therefore falls outside the scope of this License.
-
- However, linking a "work that uses the Library" with the Library
-creates an executable that is a derivative of the Library (because it
-contains portions of the Library), rather than a "work that uses the
-library". The executable is therefore covered by this License.
-Section 6 states terms for distribution of such executables.
-
- When a "work that uses the Library" uses material from a header file
-that is part of the Library, the object code for the work may be a
-derivative work of the Library even though the source code is not.
-Whether this is true is especially significant if the work can be
-linked without the Library, or if the work is itself a library. The
-threshold for this to be true is not precisely defined by law.
-
- If such an object file uses only numerical parameters, data
-structure layouts and accessors, and small macros and small inline
-functions (ten lines or less in length), then the use of the object
-file is unrestricted, regardless of whether it is legally a derivative
-work. (Executables containing this object code plus portions of the
-Library will still fall under Section 6.)
-
- Otherwise, if the work is a derivative of the Library, you may
-distribute the object code for the work under the terms of Section 6.
-Any executables containing that work also fall under Section 6,
-whether or not they are linked directly with the Library itself.
-^L
- 6. As an exception to the Sections above, you may also combine or
-link a "work that uses the Library" with the Library to produce a
-work containing portions of the Library, and distribute that work
-under terms of your choice, provided that the terms permit
-modification of the work for the customer's own use and reverse
-engineering for debugging such modifications.
-
- You must give prominent notice with each copy of the work that the
-Library is used in it and that the Library and its use are covered by
-this License. You must supply a copy of this License. If the work
-during execution displays copyright notices, you must include the
-copyright notice for the Library among them, as well as a reference
-directing the user to the copy of this License. Also, you must do one
-of these things:
-
- a) Accompany the work with the complete corresponding
- machine-readable source code for the Library including whatever
- changes were used in the work (which must be distributed under
- Sections 1 and 2 above); and, if the work is an executable linked
- with the Library, with the complete machine-readable "work that
- uses the Library", as object code and/or source code, so that the
- user can modify the Library and then relink to produce a modified
- executable containing the modified Library. (It is understood
- that the user who changes the contents of definitions files in the
- Library will not necessarily be able to recompile the application
- to use the modified definitions.)
-
- b) Use a suitable shared library mechanism for linking with the
- Library. A suitable mechanism is one that (1) uses at run time a
- copy of the library already present on the user's computer system,
- rather than copying library functions into the executable, and (2)
- will operate properly with a modified version of the library, if
- the user installs one, as long as the modified version is
- interface-compatible with the version that the work was made with.
-
- c) Accompany the work with a written offer, valid for at
- least three years, to give the same user the materials
- specified in Subsection 6a, above, for a charge no more
- than the cost of performing this distribution.
-
- d) If distribution of the work is made by offering access to copy
- from a designated place, offer equivalent access to copy the above
- specified materials from the same place.
-
- e) Verify that the user has already received a copy of these
- materials or that you have already sent this user a copy.
-
- For an executable, the required form of the "work that uses the
-Library" must include any data and utility programs needed for
-reproducing the executable from it. However, as a special exception,
-the materials to be distributed need not include anything that is
-normally distributed (in either source or binary form) with the major
-components (compiler, kernel, and so on) of the operating system on
-which the executable runs, unless that component itself accompanies
-the executable.
-
- It may happen that this requirement contradicts the license
-restrictions of other proprietary libraries that do not normally
-accompany the operating system. Such a contradiction means you cannot
-use both them and the Library together in an executable that you
-distribute.
-^L
- 7. You may place library facilities that are a work based on the
-Library side-by-side in a single library together with other library
-facilities not covered by this License, and distribute such a combined
-library, provided that the separate distribution of the work based on
-the Library and of the other library facilities is otherwise
-permitted, and provided that you do these two things:
-
- a) Accompany the combined library with a copy of the same work
- based on the Library, uncombined with any other library
- facilities. This must be distributed under the terms of the
- Sections above.
-
- b) Give prominent notice with the combined library of the fact
- that part of it is a work based on the Library, and explaining
- where to find the accompanying uncombined form of the same work.
-
- 8. You may not copy, modify, sublicense, link with, or distribute
-the Library except as expressly provided under this License. Any
-attempt otherwise to copy, modify, sublicense, link with, or
-distribute the Library is void, and will automatically terminate your
-rights under this License. However, parties who have received copies,
-or rights, from you under this License will not have their licenses
-terminated so long as such parties remain in full compliance.
-
- 9. You are not required to accept this License, since you have not
-signed it. However, nothing else grants you permission to modify or
-distribute the Library or its derivative works. These actions are
-prohibited by law if you do not accept this License. Therefore, by
-modifying or distributing the Library (or any work based on the
-Library), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Library or works based on it.
-
- 10. Each time you redistribute the Library (or any work based on the
-Library), the recipient automatically receives a license from the
-original licensor to copy, distribute, link with or modify the Library
-subject to these terms and conditions. You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties with
-this License.
-^L
- 11. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Library at all. For example, if a patent
-license would not permit royalty-free redistribution of the Library by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Library.
-
-If any portion of this section is held invalid or unenforceable under
-any particular circumstance, the balance of the section is intended to
-apply, and the section as a whole is intended to apply in other
-circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system which is
-implemented by public license practices. Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
- 12. If the distribution and/or use of the Library is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Library under this License
-may add an explicit geographical distribution limitation excluding those
-countries, so that distribution is permitted only in or among
-countries not thus excluded. In such case, this License incorporates
-the limitation as if written in the body of this License.
-
- 13. The Free Software Foundation may publish revised and/or new
-versions of the Lesser General Public License from time to time.
-Such new versions will be similar in spirit to the present version,
-but may differ in detail to address new problems or concerns.
-
-Each version is given a distinguishing version number. If the Library
-specifies a version number of this License which applies to it and
-"any later version", you have the option of following the terms and
-conditions either of that version or of any later version published by
-the Free Software Foundation. If the Library does not specify a
-license version number, you may choose any version ever published by
-the Free Software Foundation.
-^L
- 14. If you wish to incorporate parts of the Library into other free
-programs whose distribution conditions are incompatible with these,
-write to the author to ask for permission. For software which is
-copyrighted by the Free Software Foundation, write to the Free
-Software Foundation; we sometimes make exceptions for this. Our
-decision will be guided by the two goals of preserving the free status
-of all derivatives of our free software and of promoting the sharing
-and reuse of software generally.
-
- NO WARRANTY
-
- 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
-WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
-EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
-OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
-KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
-LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
-THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
-
- 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
-WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
-AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
-FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
-CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
-LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
-RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
-FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
-SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
-DAMAGES.
-
- END OF TERMS AND CONDITIONS
-^L
- How to Apply These Terms to Your New Libraries
-
- If you develop a new library, and you want it to be of the greatest
-possible use to the public, we recommend making it free software that
-everyone can redistribute and change. You can do so by permitting
-redistribution under these terms (or, alternatively, under the terms
-of the ordinary General Public License).
-
- To apply these terms, attach the following notices to the library.
-It is safest to attach them to the start of each source file to most
-effectively convey the exclusion of warranty; and each file should
-have at least the "copyright" line and a pointer to where the full
-notice is found.
-
-
- <one line to give the library's name and a brief idea of what it
-does.>
- Copyright (C) <year> <name of author>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- MA 02110-1301, USA
-
-Also add information on how to contact you by electronic and paper
-mail.
-
-You should also get your employer (if you work as a programmer) or
-your
-school, if any, to sign a "copyright disclaimer" for the library, if
-necessary. Here is a sample; alter the names:
-
- Yoyodyne, Inc., hereby disclaims all copyright interest in the
- library `Frob' (a library for tweaking knobs) written by James
-Random Hacker.
-
- <signature of Ty Coon>, 1 April 1990
- Ty Coon, President of Vice
-
-That's all there is to it!
-
-
diff --git a/COPYING.thirdparty b/COPYING.thirdparty
index 4ce4017fb67..7edd61f21f9 100644
--- a/COPYING.thirdparty
+++ b/COPYING.thirdparty
@@ -1187,7 +1187,7 @@ Use of any of this software is governed by the terms of the license below:
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
/*
* Copyright (c) 1997, 1999 Kungliga Tekniska H366gskolan
diff --git a/CREDITS b/CREDITS
index 35ab4d48a8f..d352232ad2e 100644
--- a/CREDITS
+++ b/CREDITS
@@ -3,16 +3,18 @@ organization registered in the USA.
The current main sponsors of the MariaDB Foundation are:
-Booking.com http://www.booking.com (2013 - 2016)
-Development Bank of Singapore http://dbs.com (2016)
-MariaDB Corporation https://www.mariadb.com (2013 - 2016)
-Visma http://visma.com (2015 - 2016)
-Acronis http://acronis.com (2016)
-Nexedi https://www.nexedi.com (2016)
-Automattic https://automattic.com (2014 - 2016)
-Tencent Game DBA http://tencentdba.com/about (2016)
-Verkkokauppa.com https://www.verkkokauppa.com (2015 - 2016)
-Virtuozzo https://virtuozzo.com (2016)
+Alibaba Cloud https://intl.aliyun.com (2017)
+Booking.com https://www.booking.com (2013 - 2017)
+Development Bank of Singapore https://dbs.com (2016 - 2017)
+MariaDB Corporation https://www.mariadb.com (2013 - 2017)
+Visma https://visma.com (2015 - 2017)
+Acronis http://acronis.com (2016 - 2017)
+Nexedi https://www.nexedi.com (2016 - 2017)
+Automattic https://automattic.com (2014 - 2017)
+Tencent Game DBA http://tencentdba.com/about (2016 - 2017)
+Tencent TDSQL http://tdsql.org/ (2016 - 2017)
+Verkkokauppa.com https://www.verkkokauppa.com (2015 - 2017)
+Virtuozzo https://virtuozzo.com (2016 - 2017)
For a full list of sponsors, see
https://mariadb.org/about/supporters/
diff --git a/client/mysql.cc b/client/mysql.cc
index bcc86af8941..69924010a15 100644
--- a/client/mysql.cc
+++ b/client/mysql.cc
@@ -13,7 +13,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
/* mysql command tool
* Commands compatible with mSQL by David J. Hughes
diff --git a/client/mysql_plugin.c b/client/mysql_plugin.c
index 72fa9485c6c..9cf4cd957fd 100644
--- a/client/mysql_plugin.c
+++ b/client/mysql_plugin.c
@@ -1003,7 +1003,7 @@ found:
static int find_plugin(char *tp_path)
{
- /* Check for existance of plugin */
+ /* Check for existence of plugin */
fn_format(tp_path, plugin_data.so_name, opt_plugin_dir, "", MYF(0));
if (!file_exists(tp_path))
{
diff --git a/client/mysql_upgrade.c b/client/mysql_upgrade.c
index e400087a2e8..ee63fda2e39 100644
--- a/client/mysql_upgrade.c
+++ b/client/mysql_upgrade.c
@@ -37,7 +37,7 @@
#endif
static int phase = 0;
-static int phases_total = 6;
+static const int phases_total = 7;
static char mysql_path[FN_REFLEN];
static char mysqlcheck_path[FN_REFLEN];
@@ -69,6 +69,8 @@ static char **defaults_argv;
static my_bool not_used; /* Can't use GET_BOOL without a value pointer */
+char upgrade_from_version[sizeof("10.20.456-MariaDB")+1];
+
static my_bool opt_write_binlog;
#define OPT_SILENT OPT_MAX_CLIENT_OPTION
@@ -545,7 +547,7 @@ static int run_query(const char *query, DYNAMIC_STRING *ds_res,
But mysql_upgrade is tightly bound to a specific server version
anyway - it was mysql_fix_privilege_tables_sql script embedded
into its binary - so even if it won't assume anything about server
- wsrep-ness, it won't be any less server-dependend.
+ wsrep-ness, it won't be any less server-dependent.
*/
const uchar sql_log_bin[]= "SET SQL_LOG_BIN=0, WSREP_ON=OFF;";
#else
@@ -675,7 +677,6 @@ static int upgrade_already_done(void)
{
FILE *in;
char upgrade_info_file[FN_REFLEN]= {0};
- char buf[sizeof(MYSQL_SERVER_VERSION)+1];
if (get_upgrade_info_file_name(upgrade_info_file))
return 0; /* Could not get filename => not sure */
@@ -683,15 +684,15 @@ static int upgrade_already_done(void)
if (!(in= my_fopen(upgrade_info_file, O_RDONLY, MYF(0))))
return 0; /* Could not open file => not sure */
- bzero(buf, sizeof(buf));
- if (!fgets(buf, sizeof(buf), in))
+ bzero(upgrade_from_version, sizeof(upgrade_from_version));
+ if (!fgets(upgrade_from_version, sizeof(upgrade_from_version), in))
{
/* Ignore, will be detected by strncmp() below */
}
my_fclose(in, MYF(0));
- return (strncmp(buf, MYSQL_SERVER_VERSION,
+ return (strncmp(upgrade_from_version, MYSQL_SERVER_VERSION,
sizeof(MYSQL_SERVER_VERSION)-1)==0);
}
@@ -756,9 +757,8 @@ static void print_conn_args(const char *tool_name)
verbose("Running '%s with default connection arguments", tool_name);
}
-
/*
- Check and upgrade(if neccessary) all tables
+ Check and upgrade(if necessary) all tables
in the server using "mysqlcheck --check-upgrade .."
*/
@@ -925,6 +925,80 @@ static void print_line(char* line)
fputc('\n', stderr);
}
+static my_bool from_before_10_1()
+{
+ my_bool ret= TRUE;
+ DYNAMIC_STRING ds_events_struct;
+
+ if (upgrade_from_version[0])
+ {
+ return upgrade_from_version[1] == '.' ||
+ strncmp(upgrade_from_version, "10.1.", 5) < 0;
+ }
+
+ if (init_dynamic_string(&ds_events_struct, NULL, 2048, 2048))
+ die("Out of memory");
+
+ if (run_query("show create table mysql.user", &ds_events_struct, FALSE) ||
+ strstr(ds_events_struct.str, "default_role") != NULL)
+ ret= FALSE;
+ else
+ verbose("Upgrading from a version before MariaDB-10.1");
+
+ dynstr_free(&ds_events_struct);
+ return ret;
+}
+
+
+/*
+ Check for entries with "Unknown storage engine" in I_S.TABLES,
+ try to load plugins for these tables if available (MDEV-11942)
+*/
+static int install_used_engines(void)
+{
+ char buf[512];
+ DYNAMIC_STRING ds_result;
+ const char *query = "SELECT DISTINCT LOWER(engine) FROM information_schema.tables"
+ " WHERE table_comment LIKE 'Unknown storage engine%'";
+
+ if (opt_systables_only || !from_before_10_1())
+ {
+ verbose("Phase %d/%d: Installing used storage engines... Skipped", ++phase, phases_total);
+ return 0;
+ }
+ verbose("Phase %d/%d: Installing used storage engines", ++phase, phases_total);
+
+ if (init_dynamic_string(&ds_result, "", 512, 512))
+ die("Out of memory");
+
+ verbose("Checking for tables with unknown storage engine");
+
+ run_query(query, &ds_result, TRUE);
+
+ if (ds_result.length)
+ {
+ char *line= ds_result.str, *next=get_line(line);
+ do
+ {
+ if (next[-1] == '\n')
+ next[-1]=0;
+
+ verbose("installing plugin for '%s' storage engine", line);
+
+ // we simply assume soname=ha_enginename
+ strxnmov(buf, sizeof(buf)-1, "install soname 'ha_", line, "'", NULL);
+
+
+ if (run_query(buf, NULL, TRUE))
+ fprintf(stderr, "... can't %s\n", buf);
+ line=next;
+ next=get_line(line);
+ } while (*line);
+ }
+ dynstr_free(&ds_result);
+ return 0;
+}
+
/*
Update all system tables in MySQL Server to current
@@ -1132,6 +1206,7 @@ int main(int argc, char **argv)
Run "mysqlcheck" and "mysql_fix_privilege_tables.sql"
*/
if (run_mysqlcheck_upgrade(TRUE) ||
+ install_used_engines() ||
run_mysqlcheck_views() ||
run_sql_fix_privilege_tables() ||
run_mysqlcheck_fixnames() ||
@@ -1154,4 +1229,3 @@ end:
my_end(my_end_arg);
exit(0);
}
-
diff --git a/client/mysqladmin.cc b/client/mysqladmin.cc
index e670079c99e..7491458c161 100644
--- a/client/mysqladmin.cc
+++ b/client/mysqladmin.cc
@@ -39,8 +39,8 @@ char ex_var_names[MAX_MYSQL_VAR][FN_REFLEN];
ulonglong last_values[MAX_MYSQL_VAR];
static int interval=0;
static my_bool option_force=0,interrupted=0,new_line=0,
- opt_compress=0, opt_relative=0, opt_verbose=0, opt_vertical=0,
- tty_password= 0, opt_nobeep;
+ opt_compress= 0, opt_local= 0, opt_relative= 0, opt_verbose= 0,
+ opt_vertical= 0, tty_password= 0, opt_nobeep;
static my_bool debug_info_flag= 0, debug_check_flag= 0;
static uint tcp_port = 0, option_wait = 0, option_silent=0, nr_iterations;
static uint opt_count_iterations= 0, my_end_arg;
@@ -103,9 +103,12 @@ enum commands {
ADMIN_PING, ADMIN_EXTENDED_STATUS, ADMIN_FLUSH_STATUS,
ADMIN_FLUSH_PRIVILEGES, ADMIN_START_SLAVE, ADMIN_STOP_SLAVE,
ADMIN_START_ALL_SLAVES, ADMIN_STOP_ALL_SLAVES,
- ADMIN_FLUSH_THREADS, ADMIN_OLD_PASSWORD, ADMIN_FLUSH_SLOW_LOG,
+ ADMIN_FLUSH_THREADS, ADMIN_OLD_PASSWORD, ADMIN_FLUSH_BINARY_LOG,
+ ADMIN_FLUSH_ENGINE_LOG, ADMIN_FLUSH_ERROR_LOG, ADMIN_FLUSH_GENERAL_LOG,
+ ADMIN_FLUSH_RELAY_LOG, ADMIN_FLUSH_SLOW_LOG,
ADMIN_FLUSH_TABLE_STATISTICS, ADMIN_FLUSH_INDEX_STATISTICS,
ADMIN_FLUSH_USER_STATISTICS, ADMIN_FLUSH_CLIENT_STATISTICS,
+ ADMIN_FLUSH_USER_RESOURCES,
ADMIN_FLUSH_ALL_STATUS, ADMIN_FLUSH_ALL_STATISTICS
};
static const char *command_names[]= {
@@ -117,9 +120,10 @@ static const char *command_names[]= {
"ping", "extended-status", "flush-status",
"flush-privileges", "start-slave", "stop-slave",
"start-all-slaves", "stop-all-slaves",
- "flush-threads", "old-password", "flush-slow-log",
+ "flush-threads", "old-password", "flush-binary-log", "flush-engine-log",
+ "flush-error-log", "flush-general-log", "flush-relay-log", "flush-slow-log",
"flush-table-statistics", "flush-index-statistics",
- "flush-user-statistics", "flush-client-statistics",
+ "flush-user-statistics", "flush-client-statistics", "flush-user-resources",
"flush-all-status", "flush-all-statistics",
NullS
};
@@ -161,6 +165,9 @@ static struct my_option my_long_options[] =
NO_ARG, 0, 0, 0, 0, 0, 0},
{"host", 'h', "Connect to host.", &host, &host, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ {"local", 'l', "Local command, don't write to binlog.",
+ &opt_local, &opt_local, 0, GET_BOOL, NO_ARG, 0, 0, 0,
+ 0, 0, 0},
{"no-beep", 'b', "Turn off beep on error.", &opt_nobeep,
&opt_nobeep, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"password", 'p',
@@ -619,6 +626,18 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
*/
struct my_rnd_struct rand_st;
+ char buff[FN_REFLEN + 20];
+
+ if (opt_local)
+ {
+ sprintf(buff, "set local sql_log_bin=0");
+ if (mysql_query(mysql, buff))
+ {
+ my_printf_error(0, "SET LOCAL SQL_LOG_BIN=0 failed; error: '%-.200s'",
+ error_flags, mysql_error(mysql));
+ return -1;
+ }
+ }
for (; argc > 0 ; argv++,argc--)
{
@@ -626,7 +645,6 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
switch ((command= find_type(argv[0],&command_typelib,FIND_TYPE_BASIC))) {
case ADMIN_CREATE:
{
- char buff[FN_REFLEN+20];
if (argc < 2)
{
my_printf_error(0, "Too few arguments to create", error_flags);
@@ -901,6 +919,56 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
}
break;
}
+ case ADMIN_FLUSH_BINARY_LOG:
+ {
+ if (mysql_query(mysql, "flush binary logs"))
+ {
+ my_printf_error(0, "flush failed; error: '%s'", error_flags,
+ mysql_error(mysql));
+ return -1;
+ }
+ break;
+ }
+ case ADMIN_FLUSH_ENGINE_LOG:
+ {
+ if (mysql_query(mysql,"flush engine logs"))
+ {
+ my_printf_error(0, "flush failed; error: '%s'", error_flags,
+ mysql_error(mysql));
+ return -1;
+ }
+ break;
+ }
+ case ADMIN_FLUSH_ERROR_LOG:
+ {
+ if (mysql_query(mysql, "flush error logs"))
+ {
+ my_printf_error(0, "flush failed; error: '%s'", error_flags,
+ mysql_error(mysql));
+ return -1;
+ }
+ break;
+ }
+ case ADMIN_FLUSH_GENERAL_LOG:
+ {
+ if (mysql_query(mysql, "flush general logs"))
+ {
+ my_printf_error(0, "flush failed; error: '%s'", error_flags,
+ mysql_error(mysql));
+ return -1;
+ }
+ break;
+ }
+ case ADMIN_FLUSH_RELAY_LOG:
+ {
+ if (mysql_query(mysql, "flush relay logs"))
+ {
+ my_printf_error(0, "flush failed; error: '%s'", error_flags,
+ mysql_error(mysql));
+ return -1;
+ }
+ break;
+ }
case ADMIN_FLUSH_SLOW_LOG:
{
if (mysql_query(mysql,"flush slow logs"))
@@ -971,6 +1039,16 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
}
break;
}
+ case ADMIN_FLUSH_USER_RESOURCES:
+ {
+ if (mysql_query(mysql, "flush user_resources"))
+ {
+ my_printf_error(0, "flush failed; error: '%s'", error_flags,
+ mysql_error(mysql));
+ return -1;
+ }
+ break;
+ }
case ADMIN_FLUSH_CLIENT_STATISTICS:
{
if (mysql_query(mysql,"flush client_statistics"))
@@ -1299,12 +1377,18 @@ static void usage(void)
flush-index-statistics Flush index statistics\n\
flush-logs Flush all logs\n\
flush-privileges Reload grant tables (same as reload)\n\
+ flush-binary-log Flush binary log\n\
+ flush-engine-log Flush engine log(s)\n\
+ flush-error-log Flush error log\n\
+ flush-general-log Flush general log\n\
+ flush-relay-log Flush relay log\n\
flush-slow-log Flush slow query log\n\
- flush-status Clear status variables\n\
+ flush-status Clear status variables\n\
flush-table-statistics Clear table statistics\n\
flush-tables Flush all tables\n\
flush-threads Flush the thread cache\n\
flush-user-statistics Flush user statistics\n\
+ flush-user-resources Flush user resources\n\
kill id,id,... Kill mysql threads");
#if MYSQL_VERSION_ID >= 32200
puts("\
diff --git a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc
index e2b121c27a7..92534501fb1 100644
--- a/client/mysqlbinlog.cc
+++ b/client/mysqlbinlog.cc
@@ -118,7 +118,7 @@ static const char* sock= 0;
static char *opt_plugindir= 0, *opt_default_auth= 0;
#ifdef HAVE_SMEM
-static char *shared_memory_base_name= 0;
+static const char *shared_memory_base_name= 0;
#endif
static char* user = 0;
static char* pass = 0;
@@ -2770,7 +2770,7 @@ static Exit_status dump_local_log_entries(PRINT_EVENT_INFO *print_event_info,
/* read from stdin */
/*
Windows opens stdin in text mode by default. Certain characters
- such as CTRL-Z are interpeted as events and the read() method
+ such as CTRL-Z are interpreted as events and the read() method
will stop. CTRL-Z is the EOF marker in Windows. to get past this
you have to open stdin in binary mode. Setmode() is used to set
stdin in binary mode. Errors on setting this mode result in
diff --git a/client/mysqldump.c b/client/mysqldump.c
index a02dbdf3845..281a7a6c7f2 100644
--- a/client/mysqldump.c
+++ b/client/mysqldump.c
@@ -700,8 +700,9 @@ static void write_header(FILE *sql_file, char *db_name)
"-- MySQL dump %s Distrib %s, for %s (%s)\n--\n",
DUMP_VERSION, MYSQL_SERVER_VERSION, SYSTEM_TYPE,
MACHINE_TYPE);
- print_comment(sql_file, 0, "-- Host: %s Database: %s\n",
- fix_for_comment(current_host ? current_host : "localhost"),
+ print_comment(sql_file, 0, "-- Host: %s ",
+ fix_for_comment(current_host ? current_host : "localhost"));
+ print_comment(sql_file, 0, "Database: %s\n",
fix_for_comment(db_name ? db_name : ""));
print_comment(sql_file, 0,
"-- ------------------------------------------------------\n"
diff --git a/client/mysqltest.cc b/client/mysqltest.cc
index 1e540bc9e46..d930369e303 100644
--- a/client/mysqltest.cc
+++ b/client/mysqltest.cc
@@ -2489,7 +2489,7 @@ VAR *var_obtain(const char *name, int len)
/*
- - if variable starts with a $ it is regarded as a local test varable
+ - if variable starts with a $ it is regarded as a local test variable
- if not it is treated as a environment variable, and the corresponding
environment variable will be updated
*/
@@ -3322,7 +3322,7 @@ static int replace(DYNAMIC_STRING *ds_str,
NOTE
Although mysqltest is executed from cygwin shell, the command will be
executed in "cmd.exe". Thus commands like "rm" etc can NOT be used, use
- mysqltest commmand(s) like "remove_file" for that
+ mysqltest command(s) like "remove_file" for that
*/
void do_exec(struct st_command *command)
@@ -3336,6 +3336,8 @@ void do_exec(struct st_command *command)
DBUG_ENTER("do_exec");
DBUG_PRINT("enter", ("cmd: '%s'", cmd));
+ var_set_int("$sys_errno",0);
+
/* Skip leading space */
while (*cmd && my_isspace(charset_info, *cmd))
cmd++;
@@ -3452,6 +3454,7 @@ void do_exec(struct st_command *command)
report_or_die("command \"%s\" failed with wrong error: %d",
command->first_argument, status);
}
+ var_set_int("$sys_errno",status);
}
else if (command->expected_errors.err[0].type == ERR_ERRNO &&
command->expected_errors.err[0].code.errnum != 0)
@@ -7908,7 +7911,7 @@ void handle_error(struct st_command *command,
{
/*
The query after a "--require" failed. This is fine as long the server
- returned a valid reponse. Don't allow 2013 or 2006 to trigger an
+ returned a valid response. Don't allow 2013 or 2006 to trigger an
abort_not_supported_test
*/
if (err_errno == CR_SERVER_LOST ||
@@ -8997,7 +9000,7 @@ int main(int argc, char **argv)
var_set_string("MYSQLTEST_FILE", cur_file->file_name);
init_re();
- /* Cursor protcol implies ps protocol */
+ /* Cursor protocol implies ps protocol */
if (cursor_protocol)
ps_protocol= 1;
@@ -9095,7 +9098,7 @@ int main(int argc, char **argv)
abort_on_error);
/*
- some commmands need to be executed or at least parsed unconditionally,
+ some commands need to be executed or at least parsed unconditionally,
because they change the grammar.
*/
ok_to_do= cur_block->ok || command->type == Q_DELIMITER
@@ -9525,7 +9528,7 @@ int main(int argc, char **argv)
die("Test ended with parsing disabled");
/*
- The whole test has been executed _sucessfully_.
+ The whole test has been executed _successfully_.
Time to compare result or save it to record file.
The entire output from test is in the log file
*/
@@ -9571,7 +9574,7 @@ int main(int argc, char **argv)
verbose_msg("Test has succeeded!");
timer_output();
- /* Yes, if we got this far the test has suceeded! Sakila smiles */
+ /* Yes, if we got this far the test has succeeded! Sakila smiles */
cleanup_and_exit(0);
return 0; /* Keep compiler happy too */
}
@@ -10064,7 +10067,7 @@ void free_replace_regex()
buf_len_p - result buffer length. Will change if the buffer is reallocated
pattern - regexp pattern to match
replace - replacement expression
- string - the string to perform substituions in
+ string - the string to perform substitutions in
icase - flag, if set to 1 the match is case insensitive
*/
int reg_replace(char** buf_p, int* buf_len_p, char *pattern,
diff --git a/client/sql_string.cc.dontuse b/client/sql_string.cc.dontuse
index 9679197b207..65b14e36cd1 100644
--- a/client/sql_string.cc.dontuse
+++ b/client/sql_string.cc.dontuse
@@ -267,7 +267,7 @@ bool String::set_or_copy_aligned(const char *str,uint32 arg_length,
return copy_aligned(str, arg_length, offset, cs);
}
- /* Copy with charset convertion */
+ /* Copy with charset conversion */
bool String::copy(const char *str, uint32 arg_length,
CHARSET_INFO *from_cs, CHARSET_INFO *to_cs, uint *errors)
diff --git a/cmake/build_configurations/mysql_release.cmake b/cmake/build_configurations/mysql_release.cmake
index 983969e62e8..726a151a5b1 100644
--- a/cmake/build_configurations/mysql_release.cmake
+++ b/cmake/build_configurations/mysql_release.cmake
@@ -86,10 +86,13 @@ IF(FEATURE_SET)
ENDIF()
OPTION(ENABLED_LOCAL_INFILE "" ON)
+SET(WITH_INNODB_SNAPPY OFF CACHE STRING "")
IF(WIN32)
ELSEIF(RPM)
SET(WITH_SSL system CACHE STRING "")
SET(WITH_ZLIB system CACHE STRING "")
+ SET(CHECKMODULE /usr/bin/checkmodule CACHE STRING "")
+ SET(SEMODULE_PACKAGE /usr/bin/semodule_package CACHE STRING "")
ELSEIF(DEB)
SET(WITH_SSL system CACHE STRING "")
SET(WITH_ZLIB system CACHE STRING "")
diff --git a/cmake/mysql_add_executable.cmake b/cmake/mysql_add_executable.cmake
index c8027eeea51..de4d49a7cd1 100644
--- a/cmake/mysql_add_executable.cmake
+++ b/cmake/mysql_add_executable.cmake
@@ -39,6 +39,14 @@ FUNCTION (MYSQL_ADD_EXECUTABLE)
SET(sources ${ARG_UNPARSED_ARGUMENTS})
ADD_VERSION_INFO(${target} EXECUTABLE sources)
+
+ IF(MSVC)
+ # Add compatibility manifest, to fix GetVersionEx on Windows 8.1 and later
+ IF (CMAKE_VERSION VERSION_GREATER 3.3)
+ SET(sources ${sources} ${PROJECT_SOURCE_DIR}/cmake/win_compatibility.manifest)
+ ENDIF()
+ ENDIF()
+
IF (ARG_WIN32)
SET(WIN32 WIN32)
ELSE()
diff --git a/cmake/plugin.cmake b/cmake/plugin.cmake
index 7e9adfd1218..edbd2065f82 100644
--- a/cmake/plugin.cmake
+++ b/cmake/plugin.cmake
@@ -186,8 +186,11 @@ MACRO(MYSQL_ADD_PLUGIN)
ADD_LIBRARY(${target} MODULE ${SOURCES})
DTRACE_INSTRUMENT(${target})
- SET_TARGET_PROPERTIES (${target} PROPERTIES PREFIX ""
- COMPILE_DEFINITIONS "MYSQL_DYNAMIC_PLUGIN")
+ SET_TARGET_PROPERTIES (${target} PROPERTIES PREFIX "")
+ IF (NOT ARG_CLIENT)
+ SET_TARGET_PROPERTIES (${target} PROPERTIES
+ COMPILE_DEFINITIONS "MYSQL_DYNAMIC_PLUGIN")
+ ENDIF()
TARGET_LINK_LIBRARIES (${target} mysqlservices ${ARG_LINK_LIBRARIES})
diff --git a/cmake/systemd.cmake b/cmake/systemd.cmake
index 9b51fb76799..841b52280e2 100644
--- a/cmake/systemd.cmake
+++ b/cmake/systemd.cmake
@@ -18,7 +18,7 @@ INCLUDE(FindPkgConfig)
MACRO(CHECK_SYSTEMD)
IF(UNIX)
- SET(WITH_SYSTEMD "auto" CACHE STRING "Compile with systemd socket activation and notification")
+ SET(WITH_SYSTEMD "auto" CACHE STRING "Enable systemd scripts and notification support")
IF(WITH_SYSTEMD STREQUAL "yes" OR WITH_SYSTEMD STREQUAL "auto")
IF(PKG_CONFIG_FOUND)
IF(WITH_SYSTEMD STREQUAL "yes")
diff --git a/cmake/win_compatibility.manifest b/cmake/win_compatibility.manifest
new file mode 100644
index 00000000000..2e4b27a6dc4
--- /dev/null
+++ b/cmake/win_compatibility.manifest
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<asmv1:assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1" xmlns:asmv1="urn:schemas-microsoft-com:asm.v1" xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
+ <application>
+ <!-- Windows Vista and Windows Server 2008 -->
+ <supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>
+
+ <!-- Windows 7 and Windows Server 2008 R2 -->
+ <supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
+
+ <!-- Windows 8 and Windows Server 2012 -->
+ <supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>
+
+ <!-- Windows 8.1 and Windows Server 2012 R2 -->
+ <supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
+
+ <!-- Windows 10 -->
+ <supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>
+
+ </application>
+ </compatibility>
+</asmv1:assembly>
diff --git a/config.h.cmake b/config.h.cmake
index 00aa03483ee..c0fad4a3efe 100644
--- a/config.h.cmake
+++ b/config.h.cmake
@@ -401,7 +401,6 @@
#cmakedefine _LARGE_FILES 1
#cmakedefine _LARGEFILE_SOURCE 1
#cmakedefine _LARGEFILE64_SOURCE 1
-#cmakedefine _FILE_OFFSET_BITS @_FILE_OFFSET_BITS@
#cmakedefine TIME_WITH_SYS_TIME 1
diff --git a/dbug/dbug.c b/dbug/dbug.c
index f51525897e2..4b96560b907 100644
--- a/dbug/dbug.c
+++ b/dbug/dbug.c
@@ -1882,7 +1882,7 @@ static void DBUGOpenFile(CODE_STATE *cs,
cs->stack->name[len]=0;
}
else
- strmov(cs->stack->name,name);
+ strmov(cs->stack->name,name);
name=cs->stack->name;
if (strcmp(name, "-") == 0)
{
diff --git a/debian/additions/innotop/changelog.innotop b/debian/additions/innotop/changelog.innotop
index ab4c154d6e6..67bc52698e7 100644
--- a/debian/additions/innotop/changelog.innotop
+++ b/debian/additions/innotop/changelog.innotop
@@ -1,10 +1,94 @@
Changelog for innotop:
+2017-01-20: version 1.11.4
+ * add SUM function for ONLY_FULL_GROUP_BY
+
+2017-01-20: version 1.11.3
+
+ * Undisplay handlersocket's threads in hide_inactive
+ * fix runtime error regarding redundant sprintf argument #122
+ * added sort on connection-name in display M, after sql/io running, seconds behind master and channel_name
+ * fixed bug that removed value for cxn and channel_name columns in display M
+ * added sort on replication delay, so that the replication-display will sort on slave_sql_running, timelag (in minutes) and channel_name.
+ * support for MariaDB 10.0 in InnoDB row (issue 93)
+
+2013-07-12: version 1.9.1
+
+ Bugs fixed:
+ * Support of MySQL 5.6 was broken on some pages (issue 82, 83)
+ * Deadlock clearing transactions is now not included in binary log
+ (issue 84)
+ * New spec file with requirements and build requirements for
+ CentOS/RHEL and Fedora
+
+2012-09-07: version 1.9.0
+
+ Changes:
+ * A new Health Dashboard (A) mode is the default mode.
+ * Added a new InnoDB Locked (K) mode.
+ * Added a new 'spark' config variable for sparklines.
+ * Added a new fuzzy_time formatting function.
+ * Added "query distill" summarizing.
+ * Handled more types of errors connecting to the server.
+ * Displayed some data more compactly.
+
+ Bugs fixed:
+ * Double-quotes were used to terminate strings in SQL (issue 57).
+ * T mode didn't show InnoDB transaction times (issue 67).
+ * Killing a query didn't suggest the longest-running one automatically.
+ * Connections weren't closed on exit (issue 64).
+ * Q mode didn't have connections in its header (issue 63).
+ * Connections and server groups were poorly handled (issue 68).
+ * The RPM spec file was buggy (issue 59).
+ * Event filters were defined wrong (issue 54).
+
+2012-02-25: version 1.8.1
+
+ Bugs fixed:
+ * Various parsing errors with MySQL 5.5 (issue 23, 45, 47, 51, 52, 53).
+ * RPM spec file prevented building on CentOS 5.5 using mock (issue 44).
+ * Tests worked only from the test subdirectory (issue 43).
+
+2010-11-06: version 1.8.0
+
+ Changes:
+ * Don't re-fetch SHOW VARIABLES every iteration; it's too slow on many hosts.
+ * Add a filter to remove EVENT threads in SHOW PROCESSLIST (issue 32).
+ * Add a timestamp to output in -n mode, when -t is specified (issue 37).
+ * Add a new U mode, for Percona/MariaDB USER_STATISTICS (issue 39).
+ * Add support for millisecond query time in Percona Server (issue 39).
+ * Display a summary of queries executed in Query List mode (issue 26).
+
+ Bugs fixed:
+ * Made config-file reading more robust (issue 41).
+ * Hostname parsing wasn't standards compliant (issue 30).
+ * MKDEBUG didn't work on some Perl versions (issue 22).
+ * Don't try to get InnoDB status if have_innodb != YES (issue 33).
+ * Status text from the InnoDB plugin wasn't parsed correctly (issue 36).
+ * Transaction ID from InnoDB plugin wasn't subtracted correctly (issue 38).
+ * Switching modes and pressing ? for help caused a crash (issue 40).
+
+2009-09-06: version 1.7.2
+
+ Changes:
+ * add support for --socket
+
+ Bugs fixed:
+ * remove cxn from $meta->{group_by} if there's only one connection displayed
+ * fix for issue 19 - cxn column won't become visible when viewing two
+ connections after having viewed one connection
+ * supress errors resulting from the addition of a 'BACKGROUND THREAD'
+ section in the output of 'show innodb status'
+ * possible fix for issue 22 - Useless use of a constant in void context
+ * small change to set_to_tbl() around hiding the cxn column if there
+ aren't two or more connections
+
2009-03-09: version 1.7.1
Changes:
* Don't display the CXN column if only one connection is active in
the current view
+ * the 'state' column is now visible by default in Query List mode
Bugs fixed:
* fixed bug where trying to aggregate the time column would result
diff --git a/debian/additions/innotop/innotop b/debian/additions/innotop/innotop
index 9179a0d7a81..f65c55cf0cf 100644
--- a/debian/additions/innotop/innotop
+++ b/debian/additions/innotop/innotop
@@ -1,8 +1,9 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# vim: tw=160:nowrap:expandtab:tabstop=3:shiftwidth=3:softtabstop=3
# This program is copyright (c) 2006 Baron Schwartz, baron at xaprb dot com.
+# Maintainers since 2013 : Kenny Gryp - Frédéric Descamps
# Feedback and improvements are gratefully received.
#
# THIS PROGRAM IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
@@ -15,13 +16,13 @@
# systems, you can issue `man perlgpl' or `man perlartistic' to read these
# You should have received a copy of the GNU General Public License along with
-# this program; if not, write to the Free Software Foundation, Inc., 59 Temple
-# Place, Suite 330, Boston, MA 02111-1307 USA
+# this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
+# Street, Fifth Floor, Boston, MA 02111-1301 USA
use strict;
use warnings FATAL => 'all';
-our $VERSION = '1.7.1';
+our $VERSION = '1.11.4';
# Find the home directory; it's different on different OSes.
our $homepath = $ENV{HOME} || $ENV{HOMEPATH} || $ENV{USERPROFILE} || '.';
@@ -41,7 +42,7 @@ $Data::Dumper::Indent = 0;
$Data::Dumper::Quotekeys = 0;
use English qw(-no_match_vars);
-use constant MKDEBUG => $ENV{MKDEBUG};
+use constant MKDEBUG => $ENV{MKDEBUG} || 0;
# Defaults are built-in, but you can add/replace items by passing them as
# hashrefs of {key, desc, copy, dsn}. The desc and dsn items are optional.
@@ -93,7 +94,9 @@ sub new {
},
};
foreach my $opt ( @opts ) {
- MKDEBUG && _d('Adding extra property ' . $opt->{key});
+ if (MKDEBUG) {
+ _d('Adding extra property ' . $opt->{key});
+ }
$self->{opts}->{$opt->{key}} = { desc => $opt->{desc}, copy => $opt->{copy} };
}
return bless $self, $class;
@@ -356,17 +359,18 @@ use Data::Dumper;
$Data::Dumper::Sortkeys = 1;
use English qw(-no_match_vars);
use List::Util qw(max);
+use POSIX qw(strftime);
# Some common patterns
my $d = qr/(\d+)/; # Digit
my $f = qr/(\d+\.\d+)/; # Float
-my $t = qr/(\d+ \d+)/; # Transaction ID
+my $t = qr/((?:\d+ \d+)|(?:[A-Fa-f0-9]+))/; # Transaction ID
my $i = qr/((?:\d{1,3}\.){3}\d+)/; # IP address
my $n = qr/([^`\s]+)/; # MySQL object name
my $w = qr/(\w+)/; # Words
my $fl = qr/([\w\.\/]+) line $d/; # Filename and line number
my $h = qr/((?:0x)?[0-9a-f]*)/; # Hex
-my $s = qr/(\d{6} .\d:\d\d:\d\d)/; # InnoDB timestamp
+my $s = qr/(\d{6} .?\d:\d\d:\d\d)/; # InnoDB timestamp
# If you update this variable, also update the SYNOPSIS in the pod.
my %innodb_section_headers = (
@@ -379,6 +383,7 @@ my %innodb_section_headers = (
"FILE I/O" => "io",
"LATEST DETECTED DEADLOCK" => "dl",
"LATEST FOREIGN KEY ERROR" => "fk",
+ "BACKGROUND THREAD" => "bt",
);
my %parser_for = (
@@ -442,7 +447,7 @@ sub new {
# to parse (hashref; if empty, parse all), and whether to parse full info from
# locks and such (probably shouldn't unless you need to).
sub parse_status_text {
- my ( $self, $fulltext, $debug, $sections, $full ) = @_;
+ my ( $self, $fulltext, $debug, $sections, $full, $mysqlversion ) = @_;
die "I can't parse undef" unless defined $fulltext;
$fulltext =~ s/[\r\n]+/\n/g;
@@ -464,8 +469,16 @@ sub parse_status_text {
# Get the most basic info about the status: beginning and end, and whether
# I got the whole thing (if there has been a big deadlock and there are
# too many locks to print, the output might be truncated)
- my ( $time_text ) = $fulltext =~ m/^$s INNODB MONITOR OUTPUT$/m;
- $innodb_data{'ts'} = [ parse_innodb_timestamp( $time_text ) ];
+
+ my $time_text;
+ if ( ($mysqlversion =~ /^5\.[67]\./) || ($mysqlversion =~ /^10\.[012]\./) ) {
+ ( $time_text ) = $fulltext =~ m/^([0-9-]* [0-9:]*) [0-9a-fx]* INNODB MONITOR OUTPUT/m;
+ $innodb_data{'ts'} = [ parse_innodb_timestamp_56( $time_text ) ];
+ } else {
+ ( $time_text ) = $fulltext =~ m/^$s INNODB MONITOR OUTPUT$/m;
+ $innodb_data{'ts'} = [ parse_innodb_timestamp( $time_text ) ];
+ }
+
$innodb_data{'timestring'} = ts_to_string($innodb_data{'ts'});
( $innodb_data{'last_secs'} ) = $fulltext
=~ m/Per second averages calculated from the last $d seconds/;
@@ -483,22 +496,34 @@ sub parse_status_text {
while ( my ( $start, $name, $text, $end ) = splice(@matches, 0, 4) ) {
$innodb_sections{$name} = [ $text, $end ? 1 : 0 ];
}
- # The Row Operations section is a special case, because instead of ending
- # with the beginning of another section, it ends with the end of the file.
- # So this section is complete if the entire file is complete.
- $innodb_sections{'ROW OPERATIONS'}->[1] ||= $innodb_data{'got_all'};
# Just for sanity's sake, make sure I understand what to do with each
- # section
+ # section.
eval {
foreach my $section ( keys %innodb_sections ) {
my $header = $innodb_section_headers{$section};
- die "Unknown section $section in $fulltext\n"
- unless $header;
- $innodb_data{'sections'}->{ $header }
- ->{'fulltext'} = $innodb_sections{$section}->[0];
- $innodb_data{'sections'}->{ $header }
- ->{'complete'} = $innodb_sections{$section}->[1];
+ if ( !$header && $debug ) {
+ warn "Unknown section $section in $fulltext\n";
+ }
+
+ # The last section in the file is a special case, because instead of
+ # ending with the beginning of another section, it ends with the end of
+ # the file. So this section is complete if the entire file is
+ # complete. In different versions of InnoDB, various sections are
+ # last.
+ if ( $innodb_sections{$section}->[0] =~ s/\n---+\nEND OF INNODB.+\n=+$// ) {
+ $innodb_sections{$section}->[1] ||= $innodb_data{'got_all'};
+ }
+
+ if ( $header && $section ) {
+ $innodb_data{'sections'}->{ $header }
+ ->{'fulltext'} = $innodb_sections{$section}->[0];
+ $innodb_data{'sections'}->{ $header }
+ ->{'complete'} = $innodb_sections{$section}->[1];
+ }
+ else {
+ _debug( $debug, "header = " . ($header || 'undef') . ", section = " . ($section || 'undef')) if $debug;
+ }
}
};
if ( $EVAL_ERROR ) {
@@ -516,7 +541,8 @@ sub parse_status_text {
$innodb_data{'sections'}->{$section},
$innodb_data{'sections'}->{$section}->{'complete'},
$debug,
- $full )
+ $full,
+ $mysqlversion)
or delete $innodb_data{'sections'}->{$section};
}
else {
@@ -533,11 +559,11 @@ sub parse_status_text {
# Parses the status text and returns it flattened out as a single hash.
sub get_status_hash {
- my ( $self, $fulltext, $debug, $sections, $full ) = @_;
+ my ( $self, $fulltext, $debug, $sections, $full, $mysqlversion ) = @_;
# Parse the status text...
my $innodb_status
- = $self->parse_status_text($fulltext, $debug, $sections, $full );
+ = $self->parse_status_text($fulltext, $debug, $sections, $full, $mysqlversion );
# Flatten the hierarchical structure into a single list by grabbing desired
# sections from it.
@@ -598,14 +624,29 @@ sub parse_innodb_timestamp {
return ( $y, $m, $d, $h, $i, $s );
}
+sub parse_innodb_timestamp_56 {
+ my $text = shift;
+ my ( $y, $m, $d, $h, $i, $s )
+ = $text =~ m/^(\d\d\d\d)-(\d\d)-(\d\d) +(\d+):(\d+):(\d+)$/;
+ die("Can't get timestamp from $text\n") unless $y;
+ return ( $y, $m, $d, $h, $i, $s );
+}
+
sub parse_fk_section {
- my ( $section, $complete, $debug, $full ) = @_;
+ my ( $section, $complete, $debug, $full, $mysqlversion ) = @_;
my $fulltext = $section->{'fulltext'};
return 0 unless $fulltext;
- my ( $ts, $type ) = $fulltext =~ m/^$s\s+(\w+)/m;
- $section->{'ts'} = [ parse_innodb_timestamp( $ts ) ];
+ my ( $ts, $type );
+ if ( ($mysqlversion =~ /^5.[67]\./) || ($mysqlversion =~ /^10.[012]\./) ) {
+ ( $ts, $type ) = $fulltext =~ m/^([0-9-]* [0-9:]*)\s[0-9a-fx]*\s+(\w+)/m;
+ $section->{'ts'} = [ parse_innodb_timestamp_56( $ts ) ];
+ } else {
+ ( $ts, $type ) = $fulltext =~ m/^$s\s+(\w+)/m;
+ $section->{'ts'} = [ parse_innodb_timestamp( $ts ) ];
+ }
+
$section->{'timestring'} = ts_to_string($section->{'ts'});
$section->{'type'} = $type;
@@ -629,6 +670,9 @@ sub parse_fk_cant_drop_parent_error {
=~ m{because it is referenced by `(.*)/(.*)`}m;
( $section->{'reason'} ) = $fulltext =~ m/(Cannot .*)/s;
+ if ( !defined $section->{reason} ) {
+ ( $section->{'reason'} ) = $fulltext =~ m/(Trying to add .*)/s;
+ }
$section->{'reason'} =~ s/\n(?:InnoDB: )?/ /gm
if $section->{'reason'};
@@ -699,7 +743,7 @@ sub parse_fk_transaction_error {
# no matching parent record (row_ins_foreign_report_add_err).
@{$section}{ qw(reason child_db child_table) }
- = $fulltext =~ m{^(Foreign key constraint fails for table `(.*)/(.*)`:)$}m;
+ = $fulltext =~ m{^(Foreign key constraint fails for table `(.*?)`?[/.]`?(.*)`:)$}m;
@{$section}{ qw(fk_name col_name parent_db parent_table parent_col) }
= $fulltext
@@ -847,7 +891,7 @@ sub parse_field {
}
sub parse_dl_section {
- my ( $dl, $complete, $debug, $full ) = @_;
+ my ( $dl, $complete, $debug, $full, $mysqlversion ) = @_;
return unless $dl;
my $fulltext = $dl->{'fulltext'};
return 0 unless $fulltext;
@@ -855,7 +899,12 @@ sub parse_dl_section {
my ( $ts ) = $fulltext =~ m/^$s$/m;
return 0 unless $ts;
- $dl->{'ts'} = [ parse_innodb_timestamp( $ts ) ];
+ if ( ($mysqlversion =~ /^5\.[67]\./) || ($mysqlversion =~ /^10\.[012]\./) ) {
+ $dl->{'ts'} = [ parse_innodb_timestamp_56( $ts ) ];
+ }
+ else {
+ $dl->{'ts'} = [ parse_innodb_timestamp( $ts ) ];
+ }
$dl->{'timestring'} = ts_to_string($dl->{'ts'});
$dl->{'txns'} = {};
@@ -923,12 +972,22 @@ sub parse_innodb_record_locks {
sub parse_tx_text {
my ( $txn, $complete, $debug, $full ) = @_;
- my ( $txn_id, $txn_status, $active_secs, $proc_no, $os_thread_id )
+ my ( $txn_id, $txn_status )
+ = $txn
+ =~ m/^(?:---)?TRANSACTION $t, ([^\n0-9,]*[^\s\d])/m;
+ $txn_status =~ s/,$// if $txn_status;
+ my ( $active_secs)
+ = $txn
+ =~ m/^[^\n]*\b$d sec\b/m;
+ my ( $proc_no )
+ = $txn
+ =~ m/process no $d/m;
+ my ( $os_thread_id )
= $txn
- =~ m/^(?:---)?TRANSACTION $t, (\D*?)(?: $d sec)?, (?:process no $d, )?OS thread id $d/m;
+ =~ m/OS thread id $d/m;
my ( $thread_status, $thread_decl_inside )
= $txn
- =~ m/OS thread id \d+(?: ([^,]+?))?(?:, thread declared inside InnoDB $d)?$/m;
+ =~ m/(?:OS thread id \d+|\d sec)(?: ([^,]+?))?(?:, thread declared inside InnoDB $d)?$/m;
# Parsing the line that begins 'MySQL thread id' is complicated. The only
# thing always in the line is the thread and query id. See function
@@ -938,7 +997,7 @@ sub parse_tx_text {
if ( $thread_line ) {
# These parts can always be gotten.
- ( $mysql_thread_id, $query_id ) = $thread_line =~ m/^MySQL thread id $d, query id $d/m;
+ ( $mysql_thread_id, $query_id ) = $thread_line =~ m/^MySQL thread id $d, .*?query id $d/m;
# If it's a master/slave thread, "Has (read|sent) all" may be the thread's
# proc_info. In these cases, there won't be any host/ip/user info
@@ -963,6 +1022,11 @@ sub parse_tx_text {
# It's basically impossible to know which is which.
( $hostname, $user, $query_status ) = $thread_line
=~ m/query id \d+(?: ([A-Za-z]\S+))?(?: $w(?: (.*))?)?$/m;
+ if ( ($hostname || '') eq 'Slave' ) {
+ $hostname = '';
+ $user = 'system user';
+ $query_status = "Slave has $query_status";
+ }
}
else {
$user = 'system user';
@@ -1064,7 +1128,7 @@ sub parse_tx_section {
$section->{'transactions'} = [];
# Handle the individual transactions
- my @transactions = $fulltext =~ m/(---TRANSACTION \d.*?)(?=\n---TRANSACTION|$)/gs;
+ my @transactions = $fulltext =~ m/(---TRANSACTION [0-9A-Fa-f].*?)(?=\n---TRANSACTION|$)/gs;
foreach my $txn ( @transactions ) {
my $stuff = parse_tx_text( $txn, $complete, $debug, $full );
delete $stuff->{'fulltext'} unless $debug;
@@ -1131,7 +1195,7 @@ sub parse_lg_section {
( $section->{ 'last_chkp' } )
= $fulltext =~ m/Last checkpoint at \s*(\d.*)$/m;
@{$section}{ 'pending_log_writes', 'pending_chkp_writes' }
- = $fulltext =~ m/$d pending log writes, $d pending chkp writes/;
+ = $fulltext =~ m/$d pending log (?:writes|flushes), $d pending chkp writes/;
@{$section}{ 'log_ios_done', 'log_ios_s' }
= $fulltext =~ m#$d log i/o's done, $f log i/o's/second#;
@@ -1149,12 +1213,19 @@ sub parse_ib_section {
# the source code shows there will only ever be one). I have to parse both
# cases here, but I assume there will only be one.
@{$section}{ 'size', 'free_list_len', 'seg_size' }
- = $fulltext =~ m/^Ibuf(?: for space 0)?: size $d, free list len $d, seg size $d,$/m;
+ = $fulltext =~ m/^Ibuf(?: for space 0)?: size $d, free list len $d, seg size $d/m;
@{$section}{ 'inserts', 'merged_recs', 'merges' }
= $fulltext =~ m/^$d inserts, $d merged recs, $d merges$/m;
+ if ( ! defined $section->{inserts} ) {
+ @{$section}{ 'inserts' }
+ = $fulltext =~ m/merged operations:\n insert $d,/s;
+ # This isn't really true, but it's not really important either. We already
+ # aren't supporting the 'delete' operations.
+ @{$section}{ 'merged_recs', 'merges' } = (0, 0);
+ }
@{$section}{ 'hash_table_size', 'used_cells', 'bufs_in_node_heap' }
- = $fulltext =~ m/^Hash table size $d, used cells $d, node heap has $d buffer\(s\)$/m;
+ = $fulltext =~ m/^Hash table size $d(?:, used cells $d)?, node heap has $d buffer\(s\)$/m;
@{$section}{ 'hash_searches_s', 'non_hash_searches_s' }
= $fulltext =~ m{^$f hash searches/s, $f non-hash searches/s$}m;
@@ -1215,6 +1286,12 @@ sub parse_sm_section {
= $fulltext =~ m/^Mutex spin waits $d, rounds $d, OS waits $d$/m;
@{$section}{ 'rw_shared_spins', 'rw_shared_os_waits', 'rw_excl_spins', 'rw_excl_os_waits' }
= $fulltext =~ m/^RW-shared spins $d, OS waits $d; RW-excl spins $d, OS waits $d$/m;
+ if ( ! defined $section->{rw_shared_spins} ) {
+ @{$section}{ 'rw_shared_spins', 'rw_shared_os_waits'}
+ = $fulltext =~ m/^RW-shared spins $d, rounds \d+, OS waits $d$/m;
+ @{$section}{ 'rw_excl_spins', 'rw_excl_os_waits' }
+ = $fulltext =~ m/^RW-excl spins $d, rounds \d+, OS waits $d$/m;
+ }
# Look for info on waits.
my @waits = $fulltext =~ m/^(--Thread.*?)^(?=Mutex spin|--Thread)/gms;
@@ -1245,14 +1322,14 @@ sub parse_bp_section {
@{$section}{'page_reads_sec', 'page_creates_sec', 'page_writes_sec'}
= $fulltext =~ m{^$f reads/s, $f creates/s, $f writes/s$}m;
@{$section}{'buf_pool_hits', 'buf_pool_reads'}
- = $fulltext =~ m{Buffer pool hit rate $d / $d$}m;
+ = $fulltext =~ m{Buffer pool hit rate $d / $d}m;
if ($fulltext =~ m/^No buffer pool page gets since the last printout$/m) {
@{$section}{'buf_pool_hits', 'buf_pool_reads'} = (0, 0);
@{$section}{'buf_pool_hit_rate'} = '--';
}
else {
@{$section}{'buf_pool_hit_rate'}
- = $fulltext =~ m{Buffer pool hit rate (\d+ / \d+)$}m;
+ = $fulltext =~ m{Buffer pool hit rate (\d+ / \d+)}m;
}
@{$section}{'reads_pending'} = $fulltext =~ m/^Pending reads $d/m;
@{$section}{'writes_pending_lru', 'writes_pending_flush_list', 'writes_pending_single_page' }
@@ -1292,7 +1369,7 @@ sub parse_io_section {
# Grab the reads/writes/flushes info
@{$section}{ 'pending_normal_aio_reads', 'pending_aio_writes' }
- = $fulltext =~ m/^Pending normal aio reads: $d, aio writes: $d,$/m;
+ = $fulltext =~ m/^Pending normal aio reads: $d(?: [^\]]*\])?, aio writes: $d/m;
@{$section}{ 'pending_ibuf_aio_reads', 'pending_log_ios', 'pending_sync_ios' }
= $fulltext =~ m{^ ibuf aio reads: $d, log i/o's: $d, sync i/o's: $d$}m;
@{$section}{ 'flush_type', 'pending_log_flushes', 'pending_buffer_pool_flushes' }
@@ -1361,8 +1438,8 @@ systems, you can issue `man perlgpl' or `man perlartistic' to read these
licenses.
You should have received a copy of the GNU General Public License along with
-this program; if not, write to the Free Software Foundation, Inc., 59 Temple
-Place, Suite 330, Boston, MA 02111-1307 USA.
+this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
+Street, Fifth Floor, Boston, MA 02111-1301 USA.
LICENSE
# Configuration information and global setup {{{1
@@ -1393,6 +1470,7 @@ my %col_props = (
trans => [],
agg => 'first', # Aggregate function
aggonly => 0, # Whether to show only when tbl_meta->{aggregate} is true
+ agghide => 0, # Whether NOT to show when tbl_meta->{aggregate} is true
);
# Actual DBI connections to MySQL servers.
@@ -1410,13 +1488,17 @@ my @opt_spec = (
{ s => 'delay|d=f', d => 'Delay between updates in seconds', c => 'interval' },
{ s => 'mode|m=s', d => 'Operating mode to start in', c => 'mode' },
{ s => 'inc|i!', d => 'Measure incremental differences', c => 'status_inc' },
+ { s => 'spark=i', d => 'Length of status sparkline (default 10)', c=> 'spark' },
{ s => 'write|w', d => 'Write running configuration into home directory if no config files were loaded' },
{ s => 'skipcentral|s', d => 'Skip reading the central configuration file' },
{ s => 'version', d => 'Output version information and exit' },
{ s => 'user|u=s', d => 'User for login if not current user' },
{ s => 'password|p=s', d => 'Password to use for connection' },
+ { s => 'askpass', d => 'Prompt for a password when connecting to MySQL'},
{ s => 'host|h=s', d => 'Connect to host' },
{ s => 'port|P=i', d => 'Port number to use for connection' },
+ { s => 'socket|S=s', d => 'MySQL socket to use for connection' },
+ { s => 'timestamp|t+', d => 'Print timestamp in -n mode (1: per iter; 2: per line)' },
);
# This is the container for the command-line options' values to be stored in
@@ -1427,7 +1509,7 @@ my %opts = (
# Post-process...
my %opt_seen;
foreach my $spec ( @opt_spec ) {
- my ( $long, $short ) = $spec->{s} =~ m/^(\w+)(?:\|([^!+=]*))?/;
+ my ( $long, $short ) = $spec->{s} =~ m/^(\w+)(?:\|([^!+=:]*))?/;
$spec->{k} = $short || $long;
$spec->{l} = $long;
$spec->{t} = $short;
@@ -1448,6 +1530,11 @@ if ( $opts{c} and ! -f $opts{c} ) {
print $opts{c} . " doesn't exist. Exiting.\n";
exit(1);
}
+
+if ( $opts{'askpass'} ) {
+ $opts{'p'} = noecho_password("Enter password ");
+}
+
if ( $opts{'help'} ) {
print "Usage: innotop <options> <innodb-status-file>\n\n";
my $maxw = max(map { length($_->{l}) + ($_->{n} ? 4 : 0)} @opt_spec);
@@ -1468,6 +1555,14 @@ USAGE
exit(1);
}
+if ( defined($opts{p}) && length($opts{p}) == 0 ) {
+ print "Enter password: ";
+ ReadMode('noecho');
+ $opts{p} = <STDIN>;
+ chomp($opts{p});
+ ReadMode('normal');
+}
+
# Meta-data (table definitions etc) {{{2
# ###########################################################################
@@ -1475,7 +1570,7 @@ USAGE
# Convenience so I can copy/paste these in several places...
# ###########################################################################
my %exprs = (
- Host => q{my $host = host || hostname || ''; ($host) = $host =~ m/^((?:[\d.]+(?=:))|(?:[a-zA-Z]\w+))/; return $host || ''},
+ Host => q{my $host = host || hostname || ''; ($host) = $host =~ m/^((?:[\d.]+(?=:|$))|(?:[a-z0-9-]+))/i; return $host || ''},
Port => q{my ($p) = host =~ m/:(.*)$/; return $p || 0},
OldVersions => q{dulint_to_int(IB_tx_trx_id_counter) - dulint_to_int(IB_tx_purge_done_for)},
MaxTxnTime => q/max(map{ $_->{active_secs} } @{ IB_tx_transactions }) || 0/,
@@ -1483,9 +1578,18 @@ my %exprs = (
DirtyBufs => q{ $cur->{IB_bp_pages_modified} / ($cur->{IB_bp_buf_pool_size} || 1) },
BufPoolFill => q{ $cur->{IB_bp_pages_total} / ($cur->{IB_bp_buf_pool_size} || 1) },
ServerLoad => q{ $cur->{Threads_connected}/(Questions||1)/Uptime_hires },
+ Connection => q{ max_connections || $cur->{Threads_connected} },
+ chcxn_2_cxn => q{ if ( defined($cur->{cxn}) ) { return $cur->{cxn}; } else { my ($cha, $conn) = split ("=",$cur->{chcxn}) ; return $conn; } },
+ chcxn_2_ch => q{ if ( defined($cur->{channel_name}) ) { return $cur->{channel_name}; } else { my ($cha, $conn) = split ("=",$cur->{chcxn}) ; $cha = '' if ($cha = /no_channels/); return $cha || 'failed'; } },
TxnTimeRemain => q{ defined undo_log_entries && defined $pre->{undo_log_entries} && undo_log_entries < $pre->{undo_log_entries} ? undo_log_entries / (($pre->{undo_log_entries} - undo_log_entries)/((active_secs-$pre->{active_secs})||1))||1 : 0},
SlaveCatchupRate => ' defined $cur->{seconds_behind_master} && defined $pre->{seconds_behind_master} && $cur->{seconds_behind_master} < $pre->{seconds_behind_master} ? ($pre->{seconds_behind_master}-$cur->{seconds_behind_master})/($cur->{Uptime_hires}-$pre->{Uptime_hires}) : 0',
QcacheHitRatio => q{(Qcache_hits||0)/(((Com_select||0)+(Qcache_hits||0))||1)},
+ QueryDetail => q{sprintf("%2d/%2d/%2d/%2d",
+ ((Com_select||0)+(Qcache_hits||0))/(Questions||1)*100,
+ ((Com_insert||0)+(Com_replace||0))/(Questions||1)*100,
+ (Com_update||0)/(Questions||1)*100,
+ (Com_delete||0)/(Questions||1)*100,
+)},
);
# ###########################################################################
@@ -1503,12 +1607,21 @@ my %exprs = (
my %columns = (
active_secs => { hdr => 'SecsActive', num => 1, label => 'Seconds transaction has been active', },
- add_pool_alloc => { hdr => 'Add\'l Pool', num => 1, label => 'Additional pool allocated' },
+ add_pool_alloc => { hdr => 'Add\'l Pool', num => 1, label => 'Additonal pool allocated' },
attempted_op => { hdr => 'Action', num => 0, label => 'The action that caused the error' },
awe_mem_alloc => { hdr => 'AWE Memory', num => 1, label => '[Windows] AWE memory allocated' },
binlog_cache_overflow => { hdr => 'Binlog Cache', num => 1, label => 'Transactions too big for binlog cache that went to disk' },
binlog_do_db => { hdr => 'Binlog Do DB', num => 0, label => 'binlog-do-db setting' },
binlog_ignore_db => { hdr => 'Binlog Ignore DB', num => 0, label => 'binlog-ignore-db setting' },
+ blocking_thread => { hdr => 'BThread', num => 1, label => 'Blocking thread' },
+ blocking_query => { hdr => 'Blocking Query', num => 0, label => 'Blocking query' },
+ blocking_rows_modified => { hdr => 'BRowsMod', num => 1, label => 'Blocking number rows modified' },
+ blocking_age => { hdr => 'BAge', num => 1, label => 'Blocking age' },
+ blocking_wait_secs => { hdr => 'BWait', num => 1, label => 'Blocking wait time' },
+ blocking_user => { hdr => 'BUser', num => 0, label => 'Blocking user' },
+ blocking_host => { hdr => 'BHost', num => 0, label => 'Blocking host' },
+ blocking_db => { hdr => 'BDB', num => 0, label => 'Blocking database' },
+ blocking_status => { hdr => 'BStatus', num => 0, label => 'Blocking thread status' },
bps_in => { hdr => 'BpsIn', num => 1, label => 'Bytes per second received by the server', },
bps_out => { hdr => 'BpsOut', num => 1, label => 'Bytes per second sent by the server', },
buf_free => { hdr => 'Free Bufs', num => 1, label => 'Buffers free in the buffer pool' },
@@ -1520,11 +1633,13 @@ my %columns = (
bytes_behind_master => { hdr => 'ByteLag', num => 1, label => 'Bytes the slave lags the master in binlog' },
cell_event_set => { hdr => 'Ending?', num => 1, label => 'Whether the cell event is set' },
cell_waiting => { hdr => 'Waiting?', num => 1, label => 'Whether the cell is waiting' },
+ channel_name => { hdr => 'Channel', num => 0, label => 'The name of the replication channel' },
child_db => { hdr => 'Child DB', num => 0, label => 'The database of the child table' },
child_index => { hdr => 'Child Index', num => 0, label => 'The index in the child table' },
child_table => { hdr => 'Child Table', num => 0, label => 'The child table' },
cmd => { hdr => 'Cmd', num => 0, label => 'Type of command being executed', },
cnt => { hdr => 'Cnt', num => 0, label => 'Count', agg => 'count', aggonly => 1 },
+ connections => { hdr => 'Cxns', num => 1, label => 'Connections' },
connect_retry => { hdr => 'Connect Retry', num => 1, label => 'Slave connect-retry timeout' },
cxn => { hdr => 'CXN', num => 0, label => 'Connection from which the data came', },
db => { hdr => 'DB', num => 0, label => 'Current database', },
@@ -1533,6 +1648,7 @@ my %columns = (
dl_txn_num => { hdr => 'Num', num => 0, label => 'Deadlocked transaction number', },
event_set => { hdr => 'Evt Set?', num => 1, label => '[Win32] if a wait event is set', },
exec_master_log_pos => { hdr => 'Exec Master Log Pos', num => 1, label => 'Exec Master Log Position' },
+ executed_gtid_set => { hdr => 'Executed GTID Set', num => 0, label => 'Executed GTID Set', },
fk_name => { hdr => 'Constraint', num => 0, label => 'The name of the FK constraint' },
free_list_len => { hdr => 'Free List Len', num => 1, label => 'Length of the free list' },
has_read_view => { hdr => 'Rd View', num => 1, label => 'Whether the transaction has a read view' },
@@ -1544,7 +1660,7 @@ my %columns = (
host_and_domain => { hdr => 'Host', num => 0, label => 'Hostname/IP and domain' },
host_and_port => { hdr => 'Host/IP', num => 0, label => 'Hostname or IP address, and port number', },
hostname => { hdr => 'Host', num => 0, label => 'Hostname' },
- index => { hdr => 'Index', num => 0, label => 'The index involved' },
+ index => { hdr => 'Index', num => 0, label => 'The index involved', agghide => 1 },
index_ref => { hdr => 'Index Ref', num => 0, label => 'Index referenced' },
info => { hdr => 'Query', num => 0, label => 'Info or the current query', },
insert_intention => { hdr => 'Ins Intent', num => 1, label => 'Whether the thread was trying to insert' },
@@ -1569,8 +1685,10 @@ my %columns = (
last_total => { hdr => 'Last Total', num => 1, label => 'Last Total' },
last_value => { hdr => 'Last Incr', num => 1, label => 'Last Value' },
load => { hdr => 'Load', num => 1, label => 'Server load' },
+ locked_count => { hdr => 'Lock', num => 1, label => 'Number of locked threads' },
lock_cfile_name => { hdr => 'Crtd File', num => 0, label => 'Filename where lock created' },
lock_cline => { hdr => 'Crtd Line', num => 1, label => 'Line where lock created' },
+ lock_info => { hdr => 'Lock Info', num => 0, label => 'Lock information' },
lock_mem_addr => { hdr => 'Addr', num => 0, label => 'The lock memory address' },
lock_mode => { hdr => 'Mode', num => 0, label => 'The lock mode' },
lock_structs => { hdr => 'LStrcts', num => 1, label => 'Number of lock structs' },
@@ -1581,6 +1699,7 @@ my %columns = (
log_ios_done => { hdr => 'IO Done', num => 1, label => 'Log I/Os done' },
log_ios_s => { hdr => 'IO/Sec', num => 1, label => 'Average log I/Os per sec' },
log_seq_no => { hdr => 'Sequence No.', num => 0, label => 'Log sequence number' },
+ longest_sql => { hdr => 'SQL', num => 0, label => 'Longest-running SQL statement' },
main_thread_id => { hdr => 'Main Thread ID', num => 1, label => 'Main thread ID' },
main_thread_proc_no => { hdr => 'Main Thread Proc', num => 1, label => 'Main thread process number' },
main_thread_state => { hdr => 'Main Thread State', num => 0, label => 'Main thread state' },
@@ -1596,9 +1715,12 @@ my %columns = (
master_ssl_cipher => { hdr => 'Master SSL Cipher', num => 0, label => 'Master SSL Cipher' },
master_ssl_key => { hdr => 'Master SSL Key', num => 0, label => 'Master SSL Key' },
master_user => { hdr => 'Master User', num => 0, label => 'Master username' },
+ master_uuid => { hdr => 'Master UUID', num => 0, label => 'Master UUID', },
max_txn => { hdr => 'MaxTxnTime', num => 1, label => 'MaxTxn' },
+ max_query_time => { hdr => 'MaxSQL', num => 1, label => 'Longest running SQL' },
merged_recs => { hdr => 'Merged Recs', num => 1, label => 'Merged records' },
merges => { hdr => 'Merges', num => 1, label => 'Merges' },
+ miss_rate => { hdr => 'Miss', num => 1, label => 'InnoDB buffer pool miss rate' },
mutex_os_waits => { hdr => 'Waits', num => 1, label => 'Mutex OS Waits' },
mutex_spin_rounds => { hdr => 'Rounds', num => 1, label => 'Mutex Spin Rounds' },
mutex_spin_waits => { hdr => 'Spins', num => 1, label => 'Mutex Spin Waits' },
@@ -1619,6 +1741,7 @@ my %columns = (
num_txns => { hdr => 'Txns', num => 1, label => 'Number of transactions' },
num_updates => { hdr => 'Upd', num => 1, label => 'Number of updates' },
num_updates_sec => { hdr => 'Upd/Sec', num => 1, label => 'Number of updates' },
+ 'open' => { hdr => 'Tbls', num => 1, label => 'Number of open tables' },
os_file_reads => { hdr => 'OS Reads', num => 1, label => 'OS file reads' },
os_file_writes => { hdr => 'OS Writes', num => 1, label => 'OS file writes' },
os_fsyncs => { hdr => 'OS fsyncs', num => 1, label => 'OS fsyncs' },
@@ -1653,6 +1776,7 @@ my %columns = (
port => { hdr => 'Port', num => 1, label => 'Client port number', },
possible_keys => { hdr => 'Poss. Keys', num => 0, label => 'Possible keys' },
proc_no => { hdr => 'Proc', num => 1, label => 'Process number' },
+ q_detail => { hdr => 'Se/In/Up/De%', num => 0, label => 'Detailed Query', },
q_cache_hit => { hdr => 'QCacheHit', num => 1, label => 'Query cache hit ratio', },
qps => { hdr => 'QPS', num => 1, label => 'How many queries/sec', },
queries_in_queue => { hdr => 'Queries Queued', num => 1, label => 'Queries in queue' },
@@ -1676,14 +1800,23 @@ my %columns = (
replicate_wild_ignore_table => { hdr => 'Wild Ignore Table', num => 0, label => 'Replicate-wild-ignore-table setting' },
request_type => { hdr => 'Type', num => 0, label => 'Type of lock the thread waits for' },
reservation_count => { hdr => 'ResCnt', num => 1, label => 'Reservation Count' },
+ retrieved_gtid_set => { hdr => 'Retrieved GTID Set', num => 0, label => 'Retrieved GTID Set', },
row_locks => { hdr => 'RLocks', num => 1, label => 'Number of row locks' },
+ rows_changed => { hdr => 'Changed', num => 1, label => 'Number of rows changed' },
+ rows_changed_x_indexes => { hdr => 'Chg X Idx', num => 1, label => 'Number of rows changed X indexes' },
+ rows_read => { hdr => 'Reads', num => 1, label => 'Number of rows read' },
+ rows_read_from_indexes => { hdr => 'Reads Via Idx', num => 1, label => 'Number of rows read from indexes' },
+ run => { hdr => 'Run', num => 1, label => 'Threads_running' },
rw_excl_os_waits => { hdr => 'RW Waits', num => 1, label => 'R/W Excl. OS Waits' },
rw_excl_spins => { hdr => 'RW Spins', num => 1, label => 'R/W Excl. Spins' },
rw_shared_os_waits => { hdr => 'Sh Waits', num => 1, label => 'R/W Shared OS Waits' },
rw_shared_spins => { hdr => 'Sh Spins', num => 1, label => 'R/W Shared Spins' },
+ spark_qps => { hdr => 'QPS', num => 0, label => 'QPS Sparkline' },
+ spark_run => { hdr => 'Run', num => 0, label => 'Threads_running Sparkline' },
scan_type => { hdr => 'Type', num => 0, label => 'Scan type in chosen' },
seg_size => { hdr => 'Seg. Size', num => 1, label => 'Segment size' },
select_type => { hdr => 'Select Type', num => 0, label => 'Type of select used' },
+ server_uuid => { hdr => 'Server UUID', num => 0, label => 'Server UUID', },
signal_count => { hdr => 'Signals', num => 1, label => 'Signal Count' },
size => { hdr => 'Size', num => 1, label => 'Size of the tablespace' },
skip_counter => { hdr => 'Skip Counter', num => 1, label => 'Skip counter' },
@@ -1691,7 +1824,9 @@ my %columns = (
slave_io_running => { hdr => 'Slave-IO', num => 0, label => 'Whether the slave I/O thread is running' },
slave_io_state => { hdr => 'Slave IO State', num => 0, label => 'Slave I/O thread state' },
slave_open_temp_tables => { hdr => 'Temp', num => 1, label => 'Slave open temp tables' },
+ slave_running => { hdr => 'Repl', num => 0, label => 'Slave running' },
slave_sql_running => { hdr => 'Slave-SQL', num => 0, label => 'Whether the slave SQL thread is running' },
+ sort_time => { hdr => 'SortTimeLag', num => 1, label => 'Time slave lags master sort' },
slow => { hdr => 'Slow', num => 1, label => 'How many slow queries', },
space_id => { hdr => 'Space', num => 1, label => 'Tablespace ID' },
special => { hdr => 'Special', num => 0, label => 'Special/Other info' },
@@ -1718,6 +1853,7 @@ my %columns = (
undo_for => { hdr => 'Undo', num => 0, label => 'Undo for' },
until_condition => { hdr => 'Until Condition', num => 0, label => 'Slave until condition' },
until_log_file => { hdr => 'Until Log File', num => 0, label => 'Slave until log file' },
+ uptime => { hdr => 'Uptime', num => 1, label => 'Uptime' },
until_log_pos => { hdr => 'Until Log Pos', num => 1, label => 'Slave until log position' },
used_cells => { hdr => 'Cells Used', num => 1, label => 'Number of cells used' },
used_bufs => { hdr => 'Used Bufs', num => 1, label => 'Number of buffer pool pages used' },
@@ -1731,6 +1867,14 @@ my %columns = (
waited_at_line => { hdr => 'Line', num => 1, label => 'Line at which thread waits' },
waiters_flag => { hdr => 'Waiters', num => 1, label => 'Waiters Flag' },
waiting => { hdr => 'Waiting', num => 1, label => 'Whether lock is being waited for' },
+ waiting_thread => { hdr => 'WThread', num => 1, label => 'Waiting thread' },
+ waiting_query => { hdr => 'Waiting Query', num => 0, label => 'Waiting query' },
+ waiting_rows_modified => { hdr => 'WRowsMod', num => 1, label => 'Waiting number rows modified' },
+ waiting_age => { hdr => 'WAge', num => 1, label => 'Waiting age' },
+ waiting_wait_secs => { hdr => 'WWait', num => 1, label => 'Waiting wait time' },
+ waiting_user => { hdr => 'WUser', num => 0, label => 'Waiting user' },
+ waiting_host => { hdr => 'WHost', num => 0, label => 'Waiting host' },
+ waiting_db => { hdr => 'WDB', num => 0, label => 'Waiting database' },
when => { hdr => 'When', num => 0, label => 'Time scale' },
writer_lock_mode => { hdr => 'Wrtr Lck Mode', num => 0, label => 'Writer lock mode' },
writer_thread => { hdr => 'Wrtr Thread', num => 1, label => 'Writer thread ID' },
@@ -1763,8 +1907,7 @@ my %filters = ();
my %builtin_filters = (
hide_self => {
text => <<' END',
- return ( !$set->{info} || $set->{info} ne 'SHOW FULL PROCESSLIST' )
- && ( !$set->{query_text} || $set->{query_text} !~ m/INNODB STATUS$/ );
+ return ( ($set->{info} || '') !~ m#/\*innotop\*/# );
END
note => 'Removes the innotop processes from the list',
tbls => [qw(innodb_transactions processlist)],
@@ -1773,18 +1916,33 @@ my %builtin_filters = (
text => <<' END',
return ( !defined($set->{txn_status}) || $set->{txn_status} ne 'not started' )
&& ( !defined($set->{cmd}) || $set->{cmd} !~ m/Sleep|Binlog Dump/ )
+ && ( !defined($set->{state}) || $set->{state} !~ m/^handlersocket/ )
&& ( !defined($set->{info}) || $set->{info} =~ m/\S/ );
END
note => 'Removes processes which are not doing anything',
tbls => [qw(innodb_transactions processlist)],
},
+ hide_connect => {
+ text => <<' END',
+ return ( !defined($set->{cmd}) || $set->{cmd} !~ m/Connect/ );
+ END
+ note => 'Removes the slave processes from the list',
+ tbls => [qw(processlist)],
+ },
hide_slave_io => {
text => <<' END',
- return !$set->{state} || $set->{state} !~ m/^(?:Waiting for master|Has read all relay)/;
+ return !$set->{state} || $set->{state} !~ m/^(?:Waiting for master|read all relay)/;
END
note => 'Removes slave I/O threads from the list',
tbls => [qw(processlist slave_io_status)],
},
+ hide_event => {
+ text => <<' END',
+ return (($set->{state} || '') !~ m/^Daemon/) || (($set->{info} || '') !~ m/\S/);
+ END
+ note => 'Removes idle event threads from the list',
+ tbls => [qw(processlist)],
+ },
table_is_open => {
text => <<' END',
return $set->{num_times_open} + $set->{is_name_locked};
@@ -2038,11 +2196,13 @@ my %agg_funcs = (
my %trans_funcs = (
shorten => \&shorten,
secs_to_time => \&secs_to_time,
+ distill => \&distill,
no_ctrl_char => \&no_ctrl_char,
percent => \&percent,
commify => \&commify,
dulint_to_int => \&dulint_to_int,
set_precision => \&set_precision,
+ fuzzy_time => \&fuzzy_time,
);
# Table definitions {{{3
@@ -2123,6 +2283,7 @@ my %tbl_meta = (
capt => 'Command Summary',
cust => {},
cols => {
+ cxn => { src => 'cxn' },
name => { src => 'name' },
total => { src => 'total' },
value => { src => 'value', agg => 'sum'},
@@ -2131,7 +2292,7 @@ my %tbl_meta = (
last_value => { src => 'last_value', agg => 'sum'},
last_pct => { src => 'last_value/last_total', trans => [qw(percent)] },
},
- visible => [qw(name value pct last_value last_pct)],
+ visible => [qw(cxn name value pct last_value last_pct)],
filters => [qw()],
sort_cols => '-value',
sort_dir => '1',
@@ -2281,6 +2442,49 @@ my %tbl_meta = (
group_by => [],
aggregate => 0,
},
+ index_statistics => {
+ capt => 'Data from INDEX_STATISTICS',
+ cust => {},
+ cols => {
+ cxn => { src => 'cxn', minw => 6, maxw => 10 },
+ db => { src => 'table_schema' },
+ tbl => { src => 'table_name' },
+ index => { src => 'index_name' },
+ rows_read => { src => 'rows_read', agg => 'sum' },
+ },
+ visible => [ qw(cxn db tbl index rows_read) ],
+ filters => [ ],
+ sort_cols => 'rows_read',
+ sort_dir => '-1',
+ innodb => '',
+ colors => [],
+ hide_caption => 1,
+ group_by => [qw(cxn db tbl)],
+ aggregate => 0,
+ },
+ index_table_statistics => {
+ capt => 'Data from {TABLE,INDEX}_STATISTICS',
+ cust => {},
+ cols => {
+ cxn => { src => 'cxn', minw => 6, maxw => 10 },
+ db => { src => 'table_schema' },
+ tbl => { src => 'table_name' },
+ index => { src => 'index_name' },
+ rows_read => { src => 'rows_read' },
+ rows_read_from_indexes => { src => 'rows_read_from_indexes' },
+ rows_changed => { src => 'rows_changed' },
+ rows_changed_x_indexes => { src => 'rows_changed_x_indexes' },
+ },
+ visible => [ qw(cxn db tbl rows_read rows_read_from_indexes rows_changed rows_changed_x_indexes) ],
+ filters => [ ],
+ sort_cols => 'rows_read',
+ sort_dir => '-1',
+ innodb => '',
+ colors => [],
+ hide_caption => 1,
+ group_by => [qw(cxn db tbl)],
+ aggregate => 0,
+ },
insert_buffers => {
capt => 'Insert Buffers',
cust => {},
@@ -2301,6 +2505,43 @@ my %tbl_meta = (
group_by => [],
aggregate => 0,
},
+ innodb_blocked_blocker => {
+ capt => 'InnoDB Blocked/Blocking',
+ cust => {},
+ cols => {
+ cxn => { src => 'cxn' },
+ waiting_thread => { src => 'waiting_thread' },
+ waiting_query => { src => 'waiting_query', trans => [qw(distill)] },
+ waiting_rows_modified => { src => 'waiting_rows_modified' },
+ waiting_age => { src => 'waiting_age', trans => [qw(fuzzy_time)] },
+ waiting_wait_secs => { src => 'waiting_wait_secs', trans => [qw(fuzzy_time)] },
+ waiting_user => { src => 'waiting_user' },
+ waiting_host => { src => 'waiting_host' },
+ waiting_db => { src => 'waiting_db' },
+ blocking_thread => { src => 'blocking_thread' },
+ blocking_query => { src => 'blocking_query', trans => [qw(distill)] },
+ blocking_rows_modified => { src => 'blocking_rows_modified' },
+ blocking_age => { src => 'blocking_age', trans => [qw(fuzzy_time)] },
+ blocking_wait_secs => { src => 'blocking_wait_secs', trans => [qw(fuzzy_time)] },
+ blocking_user => { src => 'blocking_user' },
+ blocking_host => { src => 'blocking_host' },
+ blocking_db => { src => 'blocking_db' },
+ blocking_status => { src => 'blocking_status' },
+ lock_info => { src => 'lock_info' },
+ },
+ visible => [ qw(cxn waiting_thread waiting_query waiting_wait_secs
+ blocking_thread blocking_rows_modified blocking_age blocking_wait_secs
+ blocking_status blocking_query)],
+ filters => [],
+ sort_cols => 'cxn -waiting_wait_secs',
+ sort_dir => '1',
+ innodb => 'tx',
+ colors => [
+ ],
+ group_by => [],
+ aggregate => 0,
+ hide_caption => 1,
+ },
innodb_locks => {
capt => 'InnoDB Locks',
cust => {},
@@ -2429,19 +2670,22 @@ my %tbl_meta = (
capt => 'Master Status',
cust => {},
cols => {
- cxn => { src => 'cxn' },
+ cxn => { src => $exprs{chcxn_2_cxn}, hdr => 'CXN' },
binlog_do_db => { src => 'binlog_do_db' },
binlog_ignore_db => { src => 'binlog_ignore_db' },
master_file => { src => 'file' },
master_pos => { src => 'position' },
binlog_cache_overflow => { src => '(Binlog_cache_disk_use||0)/(Binlog_cache_use||1)', trans => [ qw(percent) ] },
+ executed_gtid_set => { src => '(executed_gtid_set||"N/A")' },
+ server_uuid => { src => '(server_uuid||"N/A")' },
+ channel_name => { src => $exprs{chcxn_2_ch}, hdr => 'Channel'},
},
- visible => [ qw(cxn master_file master_pos binlog_cache_overflow)],
+ visible => [ qw(cxn channel_name master_file master_pos binlog_cache_overflow executed_gtid_set server_uuid)],
filters => [ qw(cxn_is_master) ],
sort_cols => 'cxn',
sort_dir => '1',
innodb => '',
- group_by => [],
+ group_by => [qw(channel_name)],
aggregate => 0,
},
pending_io => {
@@ -2512,7 +2756,7 @@ my %tbl_meta = (
cxn => { src => 'cxn', minw => 6, maxw => 10 },
mysql_thread_id => { src => 'id', minw => 6, maxw => 0 },
user => { src => 'user', minw => 5, maxw => 8 },
- hostname => { src => $exprs{Host}, minw => 13, maxw => 8, },
+ hostname => { src => $exprs{Host}, minw => 7, maxw => 15, },
port => { src => $exprs{Port}, minw => 0, maxw => 0, },
host_and_port => { src => 'host', minw => 0, maxw => 0 },
db => { src => 'db', minw => 6, maxw => 12 },
@@ -2523,7 +2767,7 @@ my %tbl_meta = (
cnt => { src => 'id', minw => 0, maxw => 0 },
},
visible => [ qw(cxn cmd cnt mysql_thread_id state user hostname db time info)],
- filters => [ qw(hide_self hide_inactive hide_slave_io) ],
+ filters => [ qw(hide_self hide_inactive hide_slave_io hide_event hide_connect) ],
sort_cols => '-time cxn hostname mysql_thread_id',
sort_dir => '1',
innodb => '',
@@ -2556,14 +2800,16 @@ my %tbl_meta = (
questions => { src => 'Questions' },
qps => { src => 'Questions/Uptime_hires', dec => 1, trans => [qw(shorten)] },
load => { src => $exprs{ServerLoad}, dec => 1, trans => [qw(shorten)] },
+ connections => { src => $exprs{Connection}, dec => 1, trans => [qw(shorten)] },
slow => { src => 'Slow_queries', dec => 1, trans => [qw(shorten)] },
q_cache_hit => { src => $exprs{QcacheHitRatio}, dec => 1, trans => [qw(percent)] },
key_buffer_hit => { src => '1-(Key_reads/(Key_read_requests||1))', dec => 1, trans => [qw(percent)] },
bps_in => { src => 'Bytes_received/Uptime_hires', dec => 1, trans => [qw(shorten)] },
bps_out => { src => 'Bytes_sent/Uptime_hires', dec => 1, trans => [qw(shorten)] },
when => { src => 'when' },
+ q_detail => { src => $exprs{QueryDetail} },
},
- visible => [ qw(cxn when load qps slow q_cache_hit key_buffer_hit bps_in bps_out)],
+ visible => [ qw(cxn when load connections qps slow q_detail q_cache_hit key_buffer_hit bps_in bps_out)],
filters => [],
sort_cols => 'when cxn',
sort_dir => '1',
@@ -2646,9 +2892,10 @@ my %tbl_meta = (
capt => 'Slave I/O Status',
cust => {},
cols => {
- cxn => { src => 'cxn' },
+ cxn => { src => $exprs{chcxn_2_cxn}, hdr => 'CXN' },
connect_retry => { src => 'connect_retry' },
master_host => { src => 'master_host', hdr => 'Master'},
+ master_uuid => { src => '(master_uuid||"N/A")' },
master_log_file => { src => 'master_log_file', hdr => 'File' },
master_port => { src => 'master_port' },
master_ssl_allowed => { src => 'master_ssl_allowed' },
@@ -2662,27 +2909,29 @@ my %tbl_meta = (
relay_log_size => { src => 'relay_log_space', trans => [qw(shorten)] },
slave_io_running => { src => 'slave_io_running', hdr => 'On?' },
slave_io_state => { src => 'slave_io_state', hdr => 'State' },
+ channel_name => { src => $exprs{chcxn_2_ch}, hdr => 'Channel'},
},
- visible => [ qw(cxn master_host slave_io_running master_log_file relay_log_size read_master_log_pos slave_io_state)],
+ visible => [ qw(cxn channel_name master_host master_uuid slave_io_running master_log_file relay_log_size read_master_log_pos slave_io_state)],
filters => [ qw( cxn_is_slave ) ],
- sort_cols => 'slave_io_running cxn',
+ sort_cols => 'slave_io_running channel_name cxn',
colors => [
{ col => 'slave_io_running', op => 'ne', arg => 'Yes', color => 'black on_red' },
],
sort_dir => '1',
innodb => '',
- group_by => [],
+ group_by => [qw(channel_name)],
aggregate => 0,
},
slave_sql_status => {
capt => 'Slave SQL Status',
cust => {},
cols => {
- cxn => { src => 'cxn' },
+ cxn => { src => $exprs{chcxn_2_cxn}, hdr => 'CXN' },
exec_master_log_pos => { src => 'exec_master_log_pos', hdr => 'Master Pos' },
last_errno => { src => 'last_errno' },
last_error => { src => 'last_error' },
master_host => { src => 'master_host', hdr => 'Master' },
+ master_uuid => { src => '(master_uuid||"N/A")' },
relay_log_file => { src => 'relay_log_file' },
relay_log_pos => { src => 'relay_log_pos' },
relay_log_size => { src => 'relay_log_space', trans => [qw(shorten)] },
@@ -2695,6 +2944,7 @@ my %tbl_meta = (
replicate_wild_ignore_table => { src => 'replicate_wild_ignore_table' },
skip_counter => { src => 'skip_counter' },
slave_sql_running => { src => 'slave_sql_running', hdr => 'On?' },
+ sort_time => { src => 'int(seconds_behind_master/60)' },
until_condition => { src => 'until_condition' },
until_log_file => { src => 'until_log_file' },
until_log_pos => { src => 'until_log_pos' },
@@ -2702,10 +2952,13 @@ my %tbl_meta = (
bytes_behind_master => { src => 'master_log_file && master_log_file eq relay_master_log_file ? read_master_log_pos - exec_master_log_pos : 0', trans => [qw(shorten)] },
slave_catchup_rate => { src => $exprs{SlaveCatchupRate}, trans => [ qw(set_precision) ] },
slave_open_temp_tables => { src => 'Slave_open_temp_tables' },
+ retrieved_gtid_set => { src => '(retrieved_gtid_set||"N/A")' },
+ executed_gtid_set => { src => '(executed_gtid_set||"N/A")' },
+ channel_name => { src => $exprs{chcxn_2_ch}, hdr => 'Channel'},
},
- visible => [ qw(cxn master_host slave_sql_running time_behind_master slave_catchup_rate slave_open_temp_tables relay_log_pos last_error)],
+ visible => [ qw(cxn channel_name master_host master_uuid slave_sql_running time_behind_master slave_catchup_rate slave_open_temp_tables relay_log_pos last_error retrieved_gtid_set executed_gtid_set)],
filters => [ qw( cxn_is_slave ) ],
- sort_cols => 'slave_sql_running cxn',
+ sort_cols => 'slave_sql_running -sort_time channel_name cxn',
sort_dir => '1',
innodb => '',
colors => [
@@ -2714,6 +2967,27 @@ my %tbl_meta = (
{ col => 'time_behind_master', op => '>', arg => 60, color => 'yellow' },
{ col => 'time_behind_master', op => '==', arg => 0, color => 'white' },
],
+ group_by => [qw(channel_name)],
+ aggregate => 0,
+ },
+ table_statistics => {
+ capt => 'Data from TABLE_STATISTICS',
+ cust => {},
+ cols => {
+ cxn => { src => 'cxn', minw => 6, maxw => 10 },
+ db => { src => 'table_schema' },
+ tbl => { src => 'table_name' },
+ rows_read => { src => 'rows_read' },
+ rows_changed => { src => 'rows_changed' },
+ rows_changed_x_indexes => { src => 'rows_changed_x_indexes' },
+ },
+ visible => [ qw(cxn db tbl rows_read rows_changed rows_changed_x_indexes) ],
+ filters => [ ],
+ sort_cols => 'rows_read',
+ sort_dir => '-1',
+ innodb => '',
+ colors => [],
+ hide_caption => 1,
group_by => [],
aggregate => 0,
},
@@ -2789,6 +3063,43 @@ my %tbl_meta = (
group_by => [],
aggregate => 0,
},
+ health_dashboard => {
+ capt => 'Health Dashboard',
+ hide_caption => 1,
+ cust => {},
+ cols => {
+ cxn => { src => 'cxn' },
+ uptime => { src => 'Uptime', trans => [qw(fuzzy_time)] },
+ qps => { src => 'Questions/Uptime_hires', dec => 1, trans => [qw(shorten)] },
+ spark_qps => { src => 'SPARK_qps' },
+ run => { src => 'User_threads_running' },
+ spark_run => { src => 'SPARK_run' },
+ max_query_time => { src => 'Max_query_time', trans => [qw(fuzzy_time)] },
+ connections => { src => 'Threads_connected' },
+ miss_rate => { src => 'Innodb_buffer_pool_reads/Uptime_hires', trans => [qw(set_precision)] },
+ locked_count => { src => 'Locked_count' },
+ 'open' => { src => 'Open_tables' },
+ slave_running => { src => 'Slave_ok . " " . (Slaves || "")' },
+ time_behind_master => { src => 'seconds_behind_master', hdr => 'ReplLag' , trans => [qw(fuzzy_time)] },
+ longest_sql => { src => 'Longest_sql', trans => [qw(distill)] },
+ },
+ visible => [qw(
+ cxn uptime max_query_time time_behind_master qps connections run
+ miss_rate locked_count open slave_running longest_sql
+ )],
+ filters => [],
+ sort_cols => 'cxn',
+ sort_dir => '1',
+ innodb => '',
+ colors => [
+ { col => 'slave_running', op => '=~', arg => 'No', color => 'black on_red' },
+ { col => 'max_query_time', op => '>', arg => 30 * 60, color => 'red' },
+ { col => 'max_query_time', op => '>', arg => 600, color => 'yellow' },
+ { col => 'time_behind_master', op => '>', arg => 3600, color => 'cyan' },
+ ],
+ group_by => [],
+ aggregate => 0,
+ },
);
# Initialize %tbl_meta from %columns and do some checks.
@@ -2849,6 +3160,35 @@ foreach my $table_name ( keys %tbl_meta ) {
# Operating modes {{{3
# ###########################################################################
my %modes = (
+ A => {
+ hdr => 'Dashboard',
+ cust => {},
+ note => 'Shows health/status dashboard',
+ action_for => {
+ k => {
+ action => sub { kill_query('CONNECTION') },
+ label => "Kill a query's connection",
+ },
+ x => {
+ action => sub { kill_query('QUERY') },
+ label => "Kill a query",
+ },
+ r => {
+ action => sub { reverse_sort('health_dashboard'); },
+ label => 'Reverse sort order',
+ },
+ s => {
+ action => sub { choose_sort_cols('health_dashboard'); },
+ label => "Choose sort column",
+ },
+ },
+ display_sub => \&display_A,
+ connections => [],
+ server_group => '',
+ one_connection => 0,
+ tables => [qw(health_dashboard)],
+ visible_tables => [qw(health_dashboard)],
+ },
B => {
hdr => 'InnoDB Buffers',
cust => {},
@@ -2933,6 +3273,23 @@ my %modes = (
tables => [qw(io_threads pending_io file_io_misc log_statistics)],
visible_tables => [qw(io_threads pending_io file_io_misc log_statistics)],
},
+ K => {
+ hdr => 'InnoDB Lock Waits',
+ cust => {},
+ note => 'Shows blocked and blocking transactions',
+ action_for => {
+ k => {
+ action => sub { kill_query('CONNECTION') },
+ label => "Kill a query's connection",
+ },
+ },
+ display_sub => \&display_K,
+ connections => [],
+ server_group => '',
+ one_connection => 0,
+ tables => [qw(innodb_blocked_blocker)],
+ visible_tables => [qw(innodb_blocked_blocker)],
+ },
L => {
hdr => 'Locks',
cust => {},
@@ -3004,6 +3361,35 @@ my %modes = (
tables => [qw(open_tables)],
visible_tables => [qw(open_tables)],
},
+ U => {
+ hdr => 'User Statistics',
+ cust => {},
+ note => 'Displays Percona/MariaDB enhancements such as table statistics',
+ action_for => {
+ i => {
+ action => sub { set_visible_table('index_statistics') },
+ label => 'Switch to INDEX_STATISTICS',
+ },
+ s => {
+ action => sub { $clear_screen_sub->(); send_cmd_to_servers('SET @@global.userstat_running := 1 - @@global.userstat_running', 1, undef, []); },
+ label => "Change the display's sort column",
+ },
+ t => {
+ action => sub { set_visible_table('table_statistics') },
+ label => 'Switch to TABLE_STATISTICS',
+ },
+ x => {
+ action => sub { set_visible_table('index_table_statistics') },
+ label => 'Switch to {INDEX,TABLE}_STATISTICS',
+ },
+ },
+ display_sub => \&display_P,
+ connections => [],
+ server_group => '',
+ one_connection => 0,
+ tables => [qw(table_statistics index_statistics index_table_statistics)],
+ visible_tables => [qw(index_table_statistics)],
+ },
Q => {
hdr => 'Query List',
cust => {},
@@ -3045,6 +3431,10 @@ my %modes = (
action => sub { choose_sort_cols('processlist'); },
label => "Change the display's sort column",
},
+ t => {
+ action => sub { toggle_filter('processlist', 'hide_connect') },
+ label => 'Toggle slave processes',
+ },
x => {
action => sub { kill_query('QUERY') },
label => "Kill a query",
@@ -3239,6 +3629,10 @@ my %action_for = (
label => 'Toggle aggregation',
},
# TODO: can these be auto-generated from %modes?
+ A => {
+ action => sub { switch_mode('A') },
+ label => '',
+ },
B => {
action => sub { switch_mode('B') },
label => '',
@@ -3259,6 +3653,10 @@ my %action_for = (
action => sub { switch_mode('I') },
label => '',
},
+ K => {
+ action => sub { switch_mode('K') },
+ label => '',
+ },
L => {
action => sub { switch_mode('L') },
label => '',
@@ -3287,6 +3685,10 @@ my %action_for = (
action => sub { switch_mode('T') },
label => '',
},
+ U => {
+ action => sub { switch_mode('U') },
+ label => '',
+ },
d => {
action => sub { get_config_interactive('interval') },
label => 'Change refresh interval',
@@ -3554,6 +3956,7 @@ my %tbl_editor_action = (
dec => 0,
agg => 0,
aggonly => 0,
+ agghide => 0,
};
$tbl_meta{$tbl}->{visible} = [ unique(@{$tbl_meta{$tbl}->{visible}}, $col) ];
@@ -3754,6 +4157,8 @@ my $nonfatal_errs = join('|',
'Cannot call SHOW INNODB STATUS',
'Access denied',
'AutoCommit',
+ 'Lost connection to MySQL server',
+ 'Too many connections',
);
if ( !$opts{n} ) {
@@ -3766,8 +4171,10 @@ if ( !$opts{n} ) {
# keyed on clock tick.
my %vars;
my %info_gotten = (); # Which things have been retrieved for the current clock tick.
+my %show_variables; # Stores SHOW VARIABLES for each cxn so we don't re-fetch.
-# Stores info on currently displayed queries: cxn, connection ID, query text.
+# Stores info on currently displayed queries: cxn, connection ID, query text,
+# user, and host.
my @current_queries;
my $lines_printed = 0;
@@ -3935,7 +4342,7 @@ my %config = (
conf => 'ALL',
},
mode => {
- val => "Q",
+ val => "A",
note => "Which mode to start in",
cmdline => 1,
},
@@ -3961,6 +4368,17 @@ my %config = (
note => 'Which set of variables to display in S (Variables & Status) mode',
conf => [ qw(S) ],
},
+ timeformat => {
+ val => '%Y-%m-%dT%H:%M:%S',
+ pat => qr//,
+ note => 'The strftime() timestamp format to write in -n mode',
+ },
+ spark => {
+ val => 10,
+ note => 'How long to make status variable sparklines',
+ conf => 'ALL',
+ pat => $int_regex,
+ },
);
# ###########################################################################
@@ -4076,57 +4494,196 @@ my %pluggable_vars = (
# given DB connection. Returns a $sth.
# ###########################################################################
my %stmt_maker_for = (
+ INDEX_STATISTICS => sub {
+ my ( $dbh ) = @_;
+ # Detect whether there's a Percona Server with INFORMATION_SCHEMA.INDEX_STATISTICS
+ # and if not, just select nothing.
+ my $sth;
+ eval { # This can fail if the table doesn't exist, INFORMATION_SCHEMA doesn't exist, etc.
+ my $cols = $dbh->selectall_arrayref(q{SHOW /*innotop*/ COLUMNS FROM INFORMATION_SCHEMA.INDEX_STATISTICS});
+ if ( @$cols ) {
+ $sth = $dbh->prepare(q{SELECT /*innotop*/ * FROM INFORMATION_SCHEMA.INDEX_STATISTICS});
+ }
+ };
+ $sth ||= $dbh->prepare(q{SELECT /*innotop*/ '' FROM DUAL WHERE 1 = 0});
+ return $sth;
+ },
+ INDEX_TABLE_STATISTICS => sub {
+ my ( $dbh ) = @_;
+ # Detect whether there's a Percona Server with INFORMATION_SCHEMA.INDEX_STATISTICS
+ # and if not, just select nothing.
+ my $sth;
+ eval { # This can fail if the table doesn't exist, INFORMATION_SCHEMA doesn't exist, etc.
+ my $cols = $dbh->selectall_arrayref(q{SHOW /*innotop*/ COLUMNS FROM INFORMATION_SCHEMA.INDEX_STATISTICS});
+ if ( @$cols ) {
+ $sth = $dbh->prepare(q{SELECT /*innotop*/ L.TABLE_SCHEMA, L.TABLE_NAME, }
+ . q{SUM(L.ROWS_READ) AS ROWS_READ, SUM(R.ROWS_READ) AS ROWS_READ_FROM_INDEXES, }
+ . q{SUM(L.ROWS_CHANGED) AS ROWS_CHANGED, }
+ . q{SUM(L.ROWS_CHANGED_X_INDEXES) AS ROWS_CHANGED_X_INDEXES }
+ . q{FROM INFORMATION_SCHEMA.TABLE_STATISTICS AS L LEFT JOIN INFORMATION_SCHEMA.INDEX_STATISTICS AS R }
+ . q{USING(TABLE_SCHEMA, TABLE_NAME) GROUP BY L.TABLE_SCHEMA, L.TABLE_NAME});
+ }
+ };
+ $sth ||= $dbh->prepare(q{SELECT /*innotop*/ '' FROM DUAL WHERE 1 = 0});
+ return $sth;
+ },
+ INNODB_BLOCKED_BLOCKER => sub {
+ my ( $dbh ) = @_;
+ # Detect whether the server supports the I_S tables and if not, just select nothing.
+ my $sth;
+ eval { # This can fail if the table doesn't exist, INFORMATION_SCHEMA doesn't exist, etc.
+ my $cols = $dbh->selectall_arrayref(q{SHOW /*innotop*/ COLUMNS FROM INFORMATION_SCHEMA.INNODB_LOCK_WAITS});
+ if ( @$cols ) {
+ if ($dbh->{mysql_serverinfo} =~ /^5.1/) {
+ $sth = $dbh->prepare(q{
+ SELECT /*innotop*/
+ r.trx_mysql_thread_id AS waiting_thread,
+ r.trx_query AS waiting_query,
+ "n/a" AS waiting_rows_modified,
+ TIMESTAMPDIFF(SECOND, r.trx_started, NOW()) AS waiting_age,
+ TIMESTAMPDIFF(SECOND, r.trx_wait_started, NOW()) AS waiting_wait_secs,
+ rp.user AS waiting_user,
+ rp.host AS waiting_host,
+ rp.db AS waiting_db,
+ b.trx_mysql_thread_id AS blocking_thread,
+ b.trx_query AS blocking_query,
+ "n/a" AS blocking_rows_modified,
+ TIMESTAMPDIFF(SECOND, b.trx_started, NOW()) AS blocking_age,
+ TIMESTAMPDIFF(SECOND, b.trx_wait_started, NOW()) AS blocking_wait_secs,
+ bp.user AS blocking_user,
+ bp.host AS blocking_host,
+ bp.db AS blocking_db,
+ CONCAT(bp.command, IF(bp.command = 'Sleep', CONCAT(' ', bp.time), '')) AS blocking_status,
+ CONCAT(lock_mode, ' ', lock_type, ' ', lock_table, '(', lock_index, ')') AS lock_info
+ FROM INFORMATION_SCHEMA.INNODB_LOCK_WAITS w
+ JOIN INFORMATION_SCHEMA.INNODB_TRX b ON b.trx_id = w.blocking_trx_id
+ JOIN INFORMATION_SCHEMA.INNODB_TRX r ON r.trx_id = w.requesting_trx_id
+ JOIN INFORMATION_SCHEMA.INNODB_LOCKS l ON l.lock_id = w.requested_lock_id
+ LEFT JOIN INFORMATION_SCHEMA.PROCESSLIST bp ON bp.id = b.trx_mysql_thread_id
+ LEFT JOIN INFORMATION_SCHEMA.PROCESSLIST rp ON rp.id = r.trx_mysql_thread_id
+ });
+ } else {
+ $sth = $dbh->prepare(q{
+ SELECT /*innotop*/
+ r.trx_mysql_thread_id AS waiting_thread,
+ r.trx_query AS waiting_query,
+ r.trx_rows_modified AS waiting_rows_modified,
+ TIMESTAMPDIFF(SECOND, r.trx_started, NOW()) AS waiting_age,
+ TIMESTAMPDIFF(SECOND, r.trx_wait_started, NOW()) AS waiting_wait_secs,
+ rp.user AS waiting_user,
+ rp.host AS waiting_host,
+ rp.db AS waiting_db,
+ b.trx_mysql_thread_id AS blocking_thread,
+ b.trx_query AS blocking_query,
+ b.trx_rows_modified AS blocking_rows_modified,
+ TIMESTAMPDIFF(SECOND, b.trx_started, NOW()) AS blocking_age,
+ TIMESTAMPDIFF(SECOND, b.trx_wait_started, NOW()) AS blocking_wait_secs,
+ bp.user AS blocking_user,
+ bp.host AS blocking_host,
+ bp.db AS blocking_db,
+ CONCAT(bp.command, IF(bp.command = 'Sleep', CONCAT(' ', bp.time), '')) AS blocking_status,
+ CONCAT(lock_mode, ' ', lock_type, ' ', lock_table, '(', lock_index, ')') AS lock_info
+ FROM INFORMATION_SCHEMA.INNODB_LOCK_WAITS w
+ JOIN INFORMATION_SCHEMA.INNODB_TRX b ON b.trx_id = w.blocking_trx_id
+ JOIN INFORMATION_SCHEMA.INNODB_TRX r ON r.trx_id = w.requesting_trx_id
+ JOIN INFORMATION_SCHEMA.INNODB_LOCKS l ON l.lock_id = w.requested_lock_id
+ LEFT JOIN INFORMATION_SCHEMA.PROCESSLIST bp ON bp.id = b.trx_mysql_thread_id
+ LEFT JOIN INFORMATION_SCHEMA.PROCESSLIST rp ON rp.id = r.trx_mysql_thread_id
+ });
+ }
+ }
+ };
+ $sth ||= $dbh->prepare(q{SELECT /*innotop*/ '' FROM DUAL WHERE 1 = 0});
+ return $sth;
+ },
INNODB_STATUS => sub {
my ( $dbh ) = @_;
return $dbh->prepare(version_ge( $dbh, '5.0.0' )
- ? 'SHOW ENGINE INNODB STATUS'
- : 'SHOW INNODB STATUS');
+ ? 'SHOW /*innotop*/ ENGINE INNODB STATUS'
+ : 'SHOW /*innotop*/ INNODB STATUS');
},
SHOW_VARIABLES => sub {
my ( $dbh ) = @_;
return $dbh->prepare($config{global}->{val} && version_ge( $dbh, '4.0.3' )
- ? 'SHOW GLOBAL VARIABLES'
- : 'SHOW VARIABLES');
+ ? 'SHOW /*innotop*/ GLOBAL VARIABLES'
+ : 'SHOW /*innotop*/ VARIABLES');
},
SHOW_STATUS => sub {
my ( $dbh ) = @_;
return $dbh->prepare($config{global}->{val} && version_ge( $dbh, '5.0.2' )
- ? 'SHOW GLOBAL STATUS'
- : 'SHOW STATUS');
+ ? 'SHOW /*innotop*/ GLOBAL STATUS'
+ : 'SHOW /*innotop*/ STATUS');
},
KILL_QUERY => sub {
my ( $dbh ) = @_;
return $dbh->prepare(version_ge( $dbh, '5.0.0' )
- ? 'KILL QUERY ?'
- : 'KILL ?');
+ ? 'KILL /*innotop*/ QUERY ?'
+ : 'KILL /*innotop*/ ?');
},
SHOW_MASTER_LOGS => sub {
my ( $dbh ) = @_;
- return $dbh->prepare('SHOW MASTER LOGS');
+ return $dbh->prepare('SHOW /*innotop*/ MASTER LOGS');
},
SHOW_MASTER_STATUS => sub {
my ( $dbh ) = @_;
- return $dbh->prepare('SHOW MASTER STATUS');
+ return $dbh->prepare('SHOW /*innotop*/ MASTER STATUS');
},
SHOW_SLAVE_STATUS => sub {
my ( $dbh ) = @_;
- return $dbh->prepare('SHOW SLAVE STATUS');
+ return $dbh->prepare('SHOW /*innotop*/ SLAVE STATUS');
+ },
+ GET_CHANNELS => sub {
+ my ( $dbh ) = @_;
+ return $dbh->prepare(version_ge( $dbh, '5.7.0' )
+ ? 'select CHANNEL_NAME from performance_schema.replication_applier_status where CHANNEL_NAME regexp "^[a-zA-Z].*";'
+ : 'select "no_channels"');
},
KILL_CONNECTION => sub {
my ( $dbh ) = @_;
return $dbh->prepare(version_ge( $dbh, '5.0.0' )
- ? 'KILL CONNECTION ?'
- : 'KILL ?');
+ ? 'KILL /*innotop*/ CONNECTION ?'
+ : 'KILL /*innotop*/ ?');
},
OPEN_TABLES => sub {
my ( $dbh ) = @_;
return version_ge($dbh, '4.0.0')
- ? $dbh->prepare('SHOW OPEN TABLES')
+ ? $dbh->prepare('SHOW /*innotop*/ OPEN TABLES')
: undef;
},
PROCESSLIST => sub {
my ( $dbh ) = @_;
- return $dbh->prepare('SHOW FULL PROCESSLIST');
+ # In newer versions of the server, use INFORMATION_SCHEMA table if it exists,
+ # and use the TIME_MS column (in Percona Server) if that exists.
+ my $sth;
+ eval { # This can fail if the table doesn't exist, INFORMATION_SCHEMA doesn't exist, etc.
+ my $cols = $dbh->selectall_arrayref(q{SHOW /*innotop*/ COLUMNS FROM INFORMATION_SCHEMA.PROCESSLIST LIKE 'TIME_MS'});
+ if ( @$cols ) { # The TIME_MS colum exists
+ $sth = $dbh->prepare(q{SELECT /*innotop*/ ID, USER, HOST, DB, COMMAND, CASE WHEN TIME_MS/1000 > 365*86400 THEN TIME ELSE TIME_MS/1000 END AS TIME, STATE, INFO FROM INFORMATION_SCHEMA.PROCESSLIST});
+ }
+ };
+ $sth ||= $dbh->prepare('SHOW /*innotop*/ FULL PROCESSLIST');
+ return $sth;
+ },
+ PROCESSLIST_NO_IS => sub {
+ my ( $dbh ) = @_;
+ # We do not use INFORMATION_SCHEMA table because it doesn't show slave
+ # SQL statements. http://bugs.mysql.com/66401
+ my $sth = $dbh->prepare('SHOW /*innotop*/ FULL PROCESSLIST');
+ return $sth;
+ },
+ TABLE_STATISTICS => sub {
+ my ( $dbh ) = @_;
+ # Detect whether there's a Percona Server with INFORMATION_SCHEMA.TABLE_STATISTICS
+ # and if not, just select nothing.
+ my $sth;
+ eval { # This can fail if the table doesn't exist, INFORMATION_SCHEMA doesn't exist, etc.
+ my $cols = $dbh->selectall_arrayref(q{SHOW /*innotop*/ COLUMNS FROM INFORMATION_SCHEMA.TABLE_STATISTICS});
+ if ( @$cols ) {
+ $sth = $dbh->prepare(q{SELECT /*innotop*/ * FROM INFORMATION_SCHEMA.TABLE_STATISTICS});
+ }
+ };
+ $sth ||= $dbh->prepare(q{SELECT /*innotop*/ '' FROM DUAL WHERE 1 = 0});
+ return $sth;
},
);
@@ -4137,137 +4694,144 @@ my %plugins = (
# ###########################################################################
# Run the program {{{1
# ###########################################################################
-
-# This config variable is only useful for MS Windows because its terminal
-# can't tell how tall it is.
-if ( !$windows ) {
- delete $config{max_height};
-}
-
-# Try to lower my priority.
-eval { setpriority(0, 0, getpriority(0, 0) + 10); };
-
-# Print stuff to the screen immediately, don't wait for a newline.
-$OUTPUT_AUTOFLUSH = 1;
-
-# Clear the screen and load the configuration.
-$clear_screen_sub->();
-load_config();
-
-# Override config variables with command-line options
-my %cmdline =
- map { $_->{c} => $opts{$_->{k}} }
- grep { exists $_->{c} && exists $opts{$_->{k}} }
- @opt_spec;
-
-foreach my $name (keys %cmdline) {
- next if not defined $cmdline{$name};
- my $val = $cmdline{$name};
- if ( exists($config{$name}) and (!$config{$name}->{pat} or $val =~ m/$config{$name}->{pat}/ )) {
- $config{$name}->{val} = $val;
+sub main {
+ # This config variable is only useful for MS Windows because its terminal
+ # can't tell how tall it is.
+ if ( !$windows ) {
+ delete $config{max_height};
}
-}
-
-post_process_tbl_meta();
-
-# Make sure no changes are written to config file in non-interactive mode.
-if ( $opts{n} ) {
- $config{readonly}->{val} = 1;
-}
-
-eval {
-
- # Open the file for InnoDB status
- if ( @ARGV ) {
- my $filename = shift @ARGV;
- open $file, "<", $filename
- or die "Cannot open '$filename': $OS_ERROR";
+
+ # Try to lower my priority.
+ eval { setpriority(0, 0, getpriority(0, 0) + 10); };
+
+ # Print stuff to the screen immediately, don't wait for a newline.
+ $OUTPUT_AUTOFLUSH = 1;
+
+ # Clear the screen and load the configuration.
+ $clear_screen_sub->();
+ load_config();
+
+ # Override config variables with command-line options
+ my %cmdline =
+ map { $_->{c} => $opts{$_->{k}} }
+ grep { exists $_->{c} && exists $opts{$_->{k}} }
+ @opt_spec;
+
+ foreach my $name (keys %cmdline) {
+ next if not defined $cmdline{$name};
+ my $val = $cmdline{$name};
+ if ( exists($config{$name}) and (!$config{$name}->{pat} or $val =~ m/$config{$name}->{pat}/ )) {
+ $config{$name}->{val} = $val;
+ }
}
-
- # In certain modes we might have to collect data for two cycles
- # before printing anything out, so we need to bump up the count one.
- if ( $opts{n} && $opts{count} && $config{status_inc}->{val}
- && $config{mode}->{val} =~ m/[S]/ )
- {
- $opts{count}++;
+
+ post_process_tbl_meta();
+
+ # Make sure no changes are written to config file in non-interactive mode.
+ if ( $opts{n} ) {
+ $config{readonly}->{val} = 1;
}
-
- while (++$clock) {
-
- my $mode = $config{mode}->{val} || 'Q';
- if ( !$modes{$mode} ) {
- die "Mode '$mode' doesn't exist; try one of these:\n"
- . join("\n", map { " $_ $modes{$_}->{hdr}" } sort keys %modes)
- . "\n";
- }
-
- if ( !$opts{n} ) {
- @last_term_size = @this_term_size;
- @this_term_size = Term::ReadKey::GetTerminalSize(\*STDOUT);
- if ( $windows ) {
- $this_term_size[0]--;
- $this_term_size[1]
- = min($this_term_size[1], $config{max_height}->{val});
- }
- die("Can't read terminal size") unless @this_term_size;
+
+ eval {
+
+ # Open the file for InnoDB status
+ if ( @ARGV ) {
+ my $filename = shift @ARGV;
+ open $file, "<", $filename
+ or die "Cannot open '$filename': $OS_ERROR";
}
-
- # If there's no connection to a database server, we need to fix that...
- if ( !%connections ) {
- print "You have not defined any database connections.\n\n";
- add_new_dsn();
+
+ # In certain modes we might have to collect data for two cycles
+ # before printing anything out, so we need to bump up the count one.
+ if ( $opts{n} && $opts{count} && $config{status_inc}->{val}
+ && $config{mode}->{val} =~ m/[S]/ )
+ {
+ $opts{count}++;
}
+
+ while (++$clock) {
+
+ my $mode = $config{mode}->{val} || 'Q';
+ if ( !$modes{$mode} ) {
+ die "Mode '$mode' doesn't exist; try one of these:\n"
+ . join("\n", map { " $_ $modes{$_}->{hdr}" } sort keys %modes)
+ . "\n";
+ }
+
+ if ( !$opts{n} ) {
+ @last_term_size = @this_term_size;
+ @this_term_size = Term::ReadKey::GetTerminalSize(\*STDOUT);
+ if ( $windows ) {
+ $this_term_size[0]--;
+ $this_term_size[1]
+ = min($this_term_size[1], $config{max_height}->{val});
+ }
+ die("Can't read terminal size") unless @this_term_size;
+ }
+
+ # If there's no connection to a database server, we need to fix that...
+ if ( !%connections ) {
+ print "You have not defined any database connections.\n\n";
+ add_new_dsn();
+ }
+
+ # See whether there are any connections defined for this mode. If there's only one
+ # connection total, assume the user wants to just use innotop for a single server
+ # and don't ask which server to connect to. Also, if we're monitoring from a file,
+ # we just use the first connection.
+ if ( !get_connections() ) {
+ if ( $file || 1 == scalar keys %connections ) {
+ $modes{$config{mode}->{val}}->{connections} = [ keys %connections ];
+ }
+ else {
+ choose_connections();
+ }
+ }
+
+ # Term::ReadLine might have re-set $OUTPUT_AUTOFLUSH.
+ $OUTPUT_AUTOFLUSH = 1;
+
+ # Prune old data
+ my $sets = $config{num_status_sets}->{val};
+ foreach my $store ( values %vars ) {
+ delete @{$store}{ grep { $_ < $clock - $sets } keys %$store };
+ }
+ %info_gotten = ();
+
+ # Call the subroutine to display this mode.
+ $modes{$mode}->{display_sub}->();
+
+ # It may be time to quit now.
+ if ( $opts{count} && $clock >= $opts{count} ) {
+ finish();
+ }
- # See whether there are any connections defined for this mode. If there's only one
- # connection total, assume the user wants to just use innotop for a single server
- # and don't ask which server to connect to. Also, if we're monitoring from a file,
- # we just use the first connection.
- if ( !get_connections() ) {
- if ( $file || 1 == scalar keys %connections ) {
- $modes{$config{mode}->{val}}->{connections} = [ keys %connections ];
+ # RECON: Try to reconnect failed connections, while the user sees no lag.
+ foreach my $cxn ( grep { $dbhs{$_}->{failed} } keys %dbhs ) {
+ eval { connect_to_db($cxn); }; # Ignore errors entirely here.
+ }
+
+ # Wait for a bit.
+ if ( $opts{n} ) {
+ sleep($config{interval}->{val});
}
else {
- choose_connections();
+ ReadMode('cbreak');
+ $char = ReadKey($config{interval}->{val});
+ ReadMode('normal');
}
+
+ # Handle whatever action the key indicates.
+ do_key_action();
+
}
-
- # Term::ReadLine might have re-set $OUTPUT_AUTOFLUSH.
- $OUTPUT_AUTOFLUSH = 1;
-
- # Prune old data
- my $sets = $config{num_status_sets}->{val};
- foreach my $store ( values %vars ) {
- delete @{$store}{ grep { $_ < $clock - $sets } keys %$store };
- }
- %info_gotten = ();
-
- # Call the subroutine to display this mode.
- $modes{$mode}->{display_sub}->();
-
- # It may be time to quit now.
- if ( $opts{count} && $clock >= $opts{count} ) {
- finish();
- }
-
- # Wait for a bit.
- if ( $opts{n} ) {
- sleep($config{interval}->{val});
- }
- else {
- ReadMode('cbreak');
- $char = ReadKey($config{interval}->{val});
- ReadMode('normal');
- }
-
- # Handle whatever action the key indicates.
- do_key_action();
-
+ };
+ if ( $EVAL_ERROR ) {
+ core_dump( $EVAL_ERROR );
}
-};
-if ( $EVAL_ERROR ) {
- core_dump( $EVAL_ERROR );
+ finish();
}
-finish();
+main() unless caller(); # make me testable!
# Subroutines {{{1
# Mode functions{{{2
@@ -4355,6 +4919,29 @@ sub prompt_noecho {
return $response;
}
+# noecho_password {{{3
+# read password for command line parameters with noecho
+sub noecho_password {
+ my $prompt = shift @_;
+ local $OUTPUT_AUTOFLUSH = 1;
+ my $response;
+ eval {
+ if ( $windows ) {
+ require Win32::Console::ANSI;
+ }
+ require Term::ANSIColor;
+ import Term::ANSIColor qw(colored);
+ $response = prompt_noecho($prompt);
+ print "\n" or die
+ "Cannot print: $OS_ERROR";
+ };
+
+ if ( $EVAL_ERROR ) {
+ die "Cannot read respose; is Term::ReadKey installed? $EVAL_ERROR";
+ }
+ return $response;
+}
+
# do_key_action {{{3
# Depending on whether a key was read, do something. Keys have certain
# actions defined in lookup tables. Each mode may have its own lookup table,
@@ -4364,11 +4951,9 @@ sub do_key_action {
if ( defined $char ) {
my $mode = $config{mode}->{val};
my $action
- = defined($modes{$mode}->{action_for}->{$char})
- ? $modes{$mode}->{action_for}->{$char}->{action}
- : defined($action_for{$char})
- ? $action_for{$char}->{action}
- : sub{};
+ = defined($modes{$mode}->{action_for}->{$char}) ? $modes{$mode}->{action_for}->{$char}->{action}
+ : defined($action_for{$char}) ? $action_for{$char}->{action}
+ : sub{};
$action->();
}
}
@@ -4420,7 +5005,13 @@ sub kill_query {
'Select a thread to kill the ' . $q_or_c,
);
return unless $info;
- return unless pause("Kill $info->{id}?") =~ m/y/i;
+ my $distill = distill($info->{query} || '');
+ $distill = " running '$distill'" if $distill;
+ return unless pause("Kill $info->{id} ("
+ . ($info->{user} || '')
+ . '@'
+ . ($info->{host} || '')
+ . ")$distill ? ") =~ m/y/i;
eval {
do_stmt($info->{cxn}, $q_or_c eq 'QUERY' ? 'KILL_QUERY' : 'KILL_CONNECTION', $info->{id} );
@@ -4491,6 +5082,10 @@ sub deadlock_thread {
eval {
my $dbh = get_new_db_connection($cxn, 1);
+
+ # disable binary logging for this session
+ $dbh->do("set SQL_LOG_BIN=0");
+
my @stmts = (
"set transaction isolation level serializable",
(version_ge($dbh, '4.0.11') ? "start transaction" : 'begin'),
@@ -4591,10 +5186,49 @@ sub start_S_mode {
switch_mode('S');
}
+# display_A {{{3
+sub display_A {
+ my @display_lines;
+ my @cxns = get_connections();
+ get_processlist_stats(@cxns);
+ get_status_info(@cxns);
+ get_master_slave_status(@cxns);
+ my @visible = get_visible_tables();
+ my %wanted = map { $_ => 1 } @visible;
+ my @health_dashboard;
+ my %rows_for = (
+ health_dashboard => \@health_dashboard,
+ );
+
+ foreach my $cxn ( @cxns ) {
+ # Get the status variables
+ my $set = $vars{$cxn}->{$clock};
+ my $pre = $vars{$cxn}->{$clock-1} || $set;
+ my $hash = extract_values($set, $set, $pre, 'health_dashboard');
+ # Make QPS and Miss show now, not overall.
+ if ( exists $vars{$cxn}->{$clock - 1} ) {
+ my $inc = inc(0, $cxn);
+ my $hash2 = extract_values($inc, $set, $pre, 'health_dashboard');
+ map { $hash->{$_} = $hash2->{$_} } qw(qps miss_rate);
+ }
+ push @health_dashboard, $hash;
+ }
+
+ my $first_table = 0;
+ foreach my $tbl ( @visible ) {
+ push @display_lines, '', set_to_tbl($rows_for{$tbl}, $tbl);
+ push @display_lines, get_cxn_errors(@cxns)
+ if ( $config{debug}->{val} || !$first_table++ );
+ }
+
+ draw_screen(\@display_lines);
+}
+
# display_B {{{3
sub display_B {
my @display_lines;
my @cxns = get_connections();
+ get_status_info(@cxns);
get_innodb_status(\@cxns);
my @buffer_pool;
@@ -4705,6 +5339,7 @@ sub display_C {
sub display_D {
my @display_lines;
my @cxns = get_connections();
+ get_status_info(@cxns);
get_innodb_status(\@cxns);
my @deadlock_transactions;
@@ -4769,12 +5404,13 @@ sub display_D {
sub display_F {
my @display_lines;
my ( $cxn ) = get_connections();
+ get_status_info($cxn);
get_innodb_status([$cxn]);
my $innodb_status = $vars{$cxn}->{$clock};
if ( $innodb_status->{IB_fk_timestring} ) {
- push @display_lines, 'Reason: ' . $innodb_status->{IB_fk_reason};
+ push @display_lines, 'Reason: ' . ($innodb_status->{IB_fk_reason} || 'unknown');
# Display FK errors caused by invalid DML.
if ( $innodb_status->{IB_fk_txn} ) {
@@ -4803,6 +5439,7 @@ sub display_F {
sub display_I {
my @display_lines;
my @cxns = get_connections();
+ get_status_info(@cxns);
get_innodb_status(\@cxns);
my @io_threads;
@@ -4859,10 +5496,52 @@ sub display_I {
draw_screen(\@display_lines);
}
+# display_K {{{3
+sub display_K {
+ my @display_lines;
+ my @cxns = get_connections();
+
+ my %rows_for = (
+ innodb_blocked_blocker => [],
+ );
+
+ my @visible = get_visible_tables();
+ my %wanted = map { $_ => 1 } @visible;
+
+ # Get info on locks
+ if ( $wanted{innodb_blocked_blocker} ) {
+ my @rows = get_innodb_blocked_blocker(@cxns);
+ push @{$rows_for{innodb_blocked_blocker}}, map { extract_values($_, $_, $_, 'innodb_blocked_blocker') } @rows;
+ }
+
+ my $first_table = 0;
+ foreach my $tbl ( @visible ) {
+ push @display_lines, '', set_to_tbl($rows_for{$tbl}, $tbl);
+ push @display_lines, get_cxn_errors(@cxns)
+ if ( $config{debug}->{val} || !$first_table++ );
+ }
+
+ # Save queries in global variable for analysis. The rows in %rows_for have been
+ # filtered, etc as a side effect of set_to_tbl(), so they are the same as the rows
+ # that get pushed to the screen.
+ @current_queries = map {
+ my %hash;
+ @hash{ qw(cxn id user host db query time) }
+ = @{$_}{ qw(cxn blocking_thread blocking_user blocking_host blocking_db blocking_query blocking_age) };
+ # time is in fuzzy-time format; convert into something ascii-sortable.
+ $hash{time} = sprintf('%012s', fuzzy_to_secs($hash{time}));
+ $hash{host} =~ s/:.*$// if $hash{host};
+ \%hash;
+ } @{$rows_for{innodb_blocked_blocker}};
+
+ draw_screen(\@display_lines);
+}
+
# display_L {{{3
sub display_L {
my @display_lines;
my @cxns = get_connections();
+ get_status_info(@cxns);
get_innodb_status(\@cxns);
my @innodb_locks;
@@ -4882,8 +5561,8 @@ sub display_L {
my $cur_txns = $set->{IB_tx_transactions};
my $pre_txns = $pre->{IB_tx_transactions} || $cur_txns;
- my %cur_txns = map { $_->{mysql_thread_id} => $_ } @$cur_txns;
- my %pre_txns = map { $_->{mysql_thread_id} => $_ } @$pre_txns;
+ my %cur_txns = map { $_->{mysql_thread_id} => $_ } grep { defined $_->{mysql_thread_id} } @$cur_txns;
+ my %pre_txns = map { $_->{mysql_thread_id} => $_ } grep { defined $_->{mysql_thread_id} } @$pre_txns;
foreach my $txn ( @$cur_txns ) {
foreach my $lock ( @{$txn->{locks}} ) {
my %hash = map { $_ => $txn->{$_} } qw(txn_id mysql_thread_id lock_wait_time active_secs);
@@ -4925,18 +5604,46 @@ sub display_M {
my %wanted = map { $_ => 1 } @visible;
foreach my $cxn ( @cxns ) {
- my $set = $config{status_inc}->{val} ? inc(0, $cxn) : $vars{$cxn}->{$clock};
- my $pre = $vars{$cxn}->{$clock - 1} || $set;
- if ( $wanted{slave_sql_status} ) {
- push @slave_sql_status, extract_values($set, $set, $pre, 'slave_sql_status');
- }
- if ( $wanted{slave_io_status} ) {
- push @slave_io_status, extract_values($set, $set, $pre, 'slave_io_status');
- }
- if ( $wanted{master_status} ) {
- push @master_status, extract_values($set, $set, $pre, 'master_status');
- }
- }
+ my $linecount=0;
+ my $sth = do_stmt($cxn, 'GET_CHANNELS');
+ my ( $channel );
+ $sth->execute();
+ $sth->bind_columns( \$channel );
+ while ( $sth->fetch() ) {
+ $linecount=$linecount+1;
+ if ( length $channel < 1 ) {
+ $channel = 'no_channels';
+ }
+ my $chcxn = $channel . '=' . $cxn;
+ get_slave_status($cxn,$channel);
+ my $set = $config{status_inc}->{val} ? inc(0, $chcxn) : $vars{$chcxn}->{$clock};
+ my $pre = $vars{$chcxn}->{$clock - 1} || $set;
+ if ( $wanted{slave_sql_status} ) {
+ push @slave_sql_status, extract_values($set, $set, $pre, 'slave_sql_status');
+ }
+ if ( $wanted{slave_io_status} ) {
+ push @slave_io_status, extract_values($set, $set, $pre, 'slave_io_status');
+ }
+ }
+ if ( $linecount < 1 ) {
+ $channel = 'no_channels';
+ my $chcxn = $channel . '=' . $cxn;
+ get_slave_status($cxn,$channel);
+ my $set = $config{status_inc}->{val} ? inc(0, $chcxn) : $vars{$chcxn}->{$clock};
+ my $pre = $vars{$chcxn}->{$clock - 1} || $set;
+ if ( $wanted{slave_sql_status} ) {
+ push @slave_sql_status, extract_values($set, $set, $pre, 'slave_sql_status');
+ }
+ if ( $wanted{slave_io_status} ) {
+ push @slave_io_status, extract_values($set, $set, $pre, 'slave_io_status');
+ }
+ }
+ my $set = $config{status_inc}->{val} ? inc(0, $cxn) : $vars{$cxn}->{$clock};
+ my $pre = $vars{$cxn}->{$clock - 1} || $set;
+ if ( $wanted{master_status} ) {
+ push @master_status, extract_values($set, $set, $pre, 'master_status');
+ }
+ }
my $first_table = 0;
foreach my $tbl ( @visible ) {
@@ -4958,6 +5665,49 @@ sub display_O {
draw_screen(\@display_lines);
}
+# display_P {{{3
+sub display_P {
+ my @display_lines;
+
+ my @table_statistics;
+ my @index_statistics;
+ my @index_table_statistics;
+ my %rows_for = (
+ table_statistics => \@table_statistics,
+ index_statistics => \@index_statistics,
+ index_table_statistics => \@index_table_statistics,
+ );
+
+ my @visible = $opts{n} ? 'index_table_statistics' : get_visible_tables();
+ my %wanted = map { $_ => 1 } @visible;
+
+ # Get the data
+ my @cxns = get_connections();
+
+ if ( $wanted{table_statistics} ) {
+ my @rows = get_table_statistics(@cxns);
+ push @table_statistics, map { extract_values($_, $_, $_, 'table_statistics') } @rows;
+ }
+ elsif ( $wanted{index_statistics} ) {
+ my @rows = get_index_statistics(@cxns);
+ push @index_statistics, map { extract_values($_, $_, $_, 'index_statistics') } @rows;
+ }
+ elsif ( $wanted{index_table_statistics} ) {
+ my @rows = get_index_table_statistics(@cxns);
+ push @index_table_statistics, map { extract_values($_, $_, $_, 'index_table_statistics') } @rows;
+ }
+
+ my $first_table = 0;
+ foreach my $tbl ( @visible ) {
+ next unless $wanted{$tbl};
+ push @display_lines, '', set_to_tbl($rows_for{$tbl}, $tbl);
+ push @display_lines, get_cxn_errors(@cxns)
+ if ( $config{debug}->{val} || !$first_table++ );
+ }
+
+ draw_screen(\@display_lines);
+}
+
# display_Q {{{3
sub display_Q {
my @display_lines;
@@ -5015,7 +5765,11 @@ sub display_Q {
# that get pushed to the screen.
@current_queries = map {
my %hash;
- @hash{ qw(cxn id db query secs) } = @{$_}{ qw(cxn mysql_thread_id db info secs) };
+ @hash{ qw(cxn id db query time user host) }
+ = @{$_}{ qw(cxn mysql_thread_id db info time user hostname) };
+ # time is in seconds-to-time format; convert into something
+ # ascii-sortable.
+ $hash{time} = sprintf('%012s', $hash{time} =~ m/^([^.]*)/);
\%hash;
} @{$rows_for{processlist}};
@@ -5026,6 +5780,7 @@ sub display_Q {
sub display_R {
my @display_lines;
my @cxns = get_connections();
+ get_status_info(@cxns);
get_innodb_status(\@cxns);
my @row_operations;
@@ -5098,6 +5853,8 @@ sub display_T {
my @cxns = get_connections();
+ get_status_info(@cxns);
+
# If the header is to be shown, buffer pool data is required.
get_innodb_status( \@cxns, [ $wanted{t_header} ? qw(bp) : () ] );
@@ -5115,8 +5872,8 @@ sub display_T {
if ( $wanted{innodb_transactions} ) {
my $cur_txns = $set->{IB_tx_transactions};
my $pre_txns = $pre->{IB_tx_transactions} || $cur_txns;
- my %cur_txns = map { $_->{mysql_thread_id} => $_ } @$cur_txns;
- my %pre_txns = map { $_->{mysql_thread_id} => $_ } @$pre_txns;
+ my %cur_txns = map { $_->{mysql_thread_id} => $_ } grep { defined $_->{mysql_thread_id} } @$cur_txns;
+ my %pre_txns = map { $_->{mysql_thread_id} => $_ } grep { defined $_->{mysql_thread_id} } @$pre_txns;
foreach my $thd_id ( sort keys %cur_txns ) {
my $cur_txn = $cur_txns{$thd_id};
my $pre_txn = $pre_txns{$thd_id} || $cur_txn;
@@ -5140,7 +5897,8 @@ sub display_T {
# that get pushed to the screen.
@current_queries = map {
my %hash;
- @hash{ qw(cxn id db query secs) } = @{$_}{ qw(cxn mysql_thread_id db query_text active_secs) };
+ @hash{ qw(cxn id db query time user host) }
+ = @{$_}{ qw(cxn mysql_thread_id db query_text active_secs user hostname) };
\%hash;
} @{$rows_for{innodb_transactions}};
@@ -5468,7 +6226,10 @@ sub display_help {
}
# Magic keys
- my @all_magic = map { sprintf('%4s', $action_for{$_}->{key} || $_) . " $keys{$_}" } @magic;
+ my @all_magic = map {
+ my $k = $action_for{$_} ? ($action_for{$_}->{key} || $_) : $_;
+ sprintf('%4s %s', $k, $keys{$_});
+ } @magic;
@col1 = splice(@all_magic, 0, ceil(@all_magic/2));
$max1 = max(map {length($_)} @col1);
push @display_lines, '', 'Other:';
@@ -5781,14 +6542,32 @@ sub set_to_tbl {
my ( $rows, $tbl ) = @_;
my $meta = $tbl_meta{$tbl} or die "No such table $tbl in tbl_meta";
- # don't show cxn if there's only one connection being displayed
- my @visible;
- if (scalar @{$modes{$config{mode}->{val}}->{connections}} == 1) {
+ # don't show / hide cxn if there's only one connection being displayed
+ my (@visible, @group_by);
+ my $num_cxn = scalar get_connections();
+ if ($num_cxn <= 1) {
map { push @visible, $_ if $_ !~ /^cxn$/ } @{$meta->{visible}};
- delete $$rows[0]{cxn} if defined $$rows[0]{cxn};
+ $meta->{visible} = \@visible;
+ map { push @group_by, $_ if $_ !~ /^cxn$/ } @{$meta->{group_by}};
+ $meta->{group_by} = \@group_by;
}
+ # if cxn is not visible and there is now more than one connection,
+ # make cxn visible again. assume it's not in group_by if it's not
+ # visible
else {
- @visible = @{$meta->{visible}};
+ my $has_cxn = 0;
+ foreach my $column (@{$meta->{visible}}) {
+ if ($column eq "cxn") {
+ $has_cxn = 1;
+ last;
+ }
+ }
+ if (not $has_cxn) {
+ map { push @visible, $_ if $_ !~ /^cxn$/ } @{$meta->{visible}};
+ $meta->{visible} = \@visible;
+ map { push @group_by, $_ if $_ !~ /^cxn$/ } @{$meta->{group_by}};
+ $meta->{group_by} = \@group_by;
+ }
}
if ( !$meta->{pivot} ) {
@@ -5943,14 +6722,15 @@ sub set_to_tbl {
# If the table isn't pivoted, just show all columns that are supposed to
# be shown; but eliminate aggonly columns if the table isn't aggregated.
my $aggregated = $meta->{aggregate};
- $fmt_cols = [ grep { $aggregated || !$meta->{cols}->{$_}->{aggonly} } @visible ];
+ $fmt_cols = [ grep { $aggregated || !$meta->{cols}->{$_}->{aggonly} } @{$meta->{visible}} ];
$fmt_meta = { map { $_ => $meta->{cols}->{$_} } @$fmt_cols };
# If the table is aggregated, re-order the group_by columns to the left of
- # the display.
+ # the display, and suppress 'agghide' columns.
if ( $aggregated ) {
my %is_group = map { $_ => 1 } @{$meta->{group_by}};
$fmt_cols = [ @{$meta->{group_by}}, grep { !$is_group{$_} } @$fmt_cols ];
+ $fmt_cols = [ grep { !$meta->{cols}->{$_}->{agghide} } @$fmt_cols ];
}
}
@@ -5991,6 +6771,7 @@ sub commify {
# Trim to desired precision.
sub set_precision {
my ( $num, $precision ) = @_;
+ $num = 0 unless defined $num;
$precision = $config{num_digits}->{val} if !defined $precision;
sprintf("%.${precision}f", $num);
}
@@ -6005,6 +6786,23 @@ sub percent {
. ($config{show_percent}->{val} ? '%' : '');
}
+# sparkify {{{3
+# Find the range (min to max) and divide it up. Each value then gets put into
+# a bucket and represented by one of these characters: _.-=^
+sub sparkify {
+ my @vals = @_;
+ my @chars = qw(_ . - = ^);
+ my $min = min(@vals);
+ my $max = max(@vals);
+ my $range = ($max - $min) / 4;
+ return "_" x scalar(@vals) if !$min || !$max || $max == $min || !$range;
+ my $result = "";
+ foreach my $v ( @vals ) {
+ $result .= $chars[ int(($v - $min) / $range) ];
+ }
+ return $result;
+}
+
# shorten {{{3
sub shorten {
my ( $num, $opts ) = @_;
@@ -6023,12 +6821,9 @@ sub shorten {
$num /= 1_024;
++$n;
}
- return sprintf(
- $num =~ m/\./ || $n || $force
- ? "%.${num_digits}f%s"
- : '%d',
- $num, ($pad,'k','M','G', 'T')[$n]);
-
+ return $num =~ m/\./ || $n || $force
+ ? sprintf("%.${num_digits}f%s", $num, ($pad,'k','M','G','T')[$n])
+ : $num;
}
# Utility functions {{{2
@@ -6214,12 +7009,23 @@ sub draw_screen {
if $prefs->{clear} || !$modes{$config{mode}->{val}}->{no_clear_screen};
if ( $opts{n} || $prefs->{raw} ) {
my $num_lines = 0;
+ my $ts = $opts{t} ? POSIX::strftime($config{timeformat}->{val}, localtime) : '';
+ if ( $opts{t} ) {
+ if ( $opts{t} == 1 ) {
+ print "\n$ts\n\n";
+ $ts = ""; # Prevent it from being written on every line.
+ $num_lines++;
+ }
+ else {
+ $ts .= " ";
+ }
+ }
print join("\n",
map {
$num_lines++;
ref $_
- ? colored($_->[0], $_->[1])
- : $_;
+ ? colored($ts . $_->[0], $_->[1])
+ : $ts . $_;
}
grep { !$opts{n} || $_ } # Suppress empty lines
@$display_lines);
@@ -6240,11 +7046,169 @@ sub draw_screen {
}
}
+# fuzzy_time {{{3
+sub fuzzy_time {
+ my ( $secs ) = @_;
+ return '' unless $secs;
+ return sprintf('%.2f', $secs) if $secs =~ m/^.\./;
+ $secs =~ s/\..*$//;
+ return $secs < 180 ? "${secs}s"
+ : $secs < 3600 ? sprintf("%dm", $secs / 60)
+ : $secs < 3600 * 3 ? sprintf("%dh%dm", $secs / 3600, ($secs % 3600) / 60)
+ : $secs < 86400 ? sprintf("%dh", $secs / 3600)
+ : $secs < 86400* 3 ? sprintf("%dd%dh", $secs / 86400, ($secs % 86400) / 3600)
+ : sprintf("%dd", $secs / 86400);
+}
+
+sub fuzzy_to_secs {
+ my ($t) = @_;
+ return 0 unless $t;
+ my ($num, $suffix) = $t =~ m/(\d+)([a-z])?$/;
+ return $num unless $suffix;
+ return $suffix eq 's' ? $num # Seconds
+ : $suffix eq 'm' ? $num * 60 # Minutes
+ : $suffix eq 'h' ? $num * 3600 # Hours
+ : $num * 86400; # Days
+}
+
+# distill {{{3
+sub distill {
+ my ( $query ) = @_;
+ return "" unless $query;
+ my $orig_query = $query;
+
+ $query =~ m/\A\s*call\s+(\S+)\(/i && return "CALL $1";
+ $query =~ m/\A\s*use\s+/ && return "USE";
+ $query =~ m/\A\s*UNLOCK TABLES/i && return "UNLOCK";
+ $query =~ m/\A\s*xa\s+(\S+)/i && return "XA_$1";
+
+ # Strip out comments
+ my $olc_re = qr/(?:--|#)[^'"\r\n]*(?=[\r\n]|\Z)/; # One-line comments
+ my $mlc_re = qr#/\*[^!].*?\*/#sm; # But not /*!version */
+ my $vlc_re = qr#/\*.*?[0-9+].*?\*/#sm; # For SHOW + /*!version */
+ my $vlc_rf = qr#^(SHOW).*?/\*![0-9+].*?\*/#sm; # Variation for SHOW
+ $query =~ s/$olc_re//go;
+ $query =~ s/$mlc_re//go;
+ if ( $query =~ m/$vlc_rf/i ) { # contains show + version
+ $query =~ s/$vlc_re//go;
+ }
+
+ # Handle SHOW queries
+ if ( $query =~ m/\A\s*SHOW\s+/i ) {
+ $query = uc $query;
+ $query =~ s/\s+(?:GLOBAL|SESSION|FULL|STORAGE|ENGINE)\b/ /g;
+ $query =~ s/\s+COUNT[^)]+\)//g;
+ $query =~ s/\s+(?:FOR|FROM|LIKE|WHERE|LIMIT|IN)\b.+//ms;
+ $query =~ s/\A(SHOW(?:\s+\S+){1,2}).*\Z/$1/s;
+ $query =~ s/\s+/ /g;
+ }
+
+ # Find verbs and tables.
+ my ($verbs, $table);
+
+ # Handle DDL operations (dds)
+ my $tbl_ident = qr/(?:`[^`]+`|\w+)(?:\.(?:`[^`]+`|\w+))?/;
+ my $tbl_regex = qr{
+ \b(?:FROM|JOIN|(?<!KEY\s)UPDATE|INTO(?!\s+TABLE)|INTO\s+TABLE) # Words that precede table names
+ \b\s*
+ \(? # Optional paren around tables
+ ($tbl_ident
+ (?: (?:\s+ (?:AS\s+)? \w+)?, \s*$tbl_ident )*
+ )
+ }xio;
+ my ( $ddl ) = $query =~ m/^\s*((?:CREATE|ALTER|TRUNCATE|DROP|RENAME|CHECK|REPAIR))\b/i;
+ if ( $ddl ) {
+ my ( $obj ) = $query =~ m/$ddl.+(DATABASE|EVENT|FUNCTION|INDEX|LOGFILE GROUP|PROCEDURE|SERVER|TABLE|TABLESPACE|TRIGGER|VIEW)\b/i;
+ if ( $obj ) {
+ $query =~ s/$obj\s*if\s*(?:not\s*)?exists/$obj/i;
+ $verbs = uc($ddl . ($obj ? " $obj" : ''));
+ ($table) = $query =~ m/(?:TABLE|DATABASE)\s+($tbl_ident)(\s+.*)?/i;
+ }
+ }
+ else {
+ my $verbs_pat = qr{^SHOW|^FLUSH|^COMMIT|^ROLLBACK|^BEGIN|SELECT|INSERT
+ |UPDATE|DELETE|REPLACE|^SET|UNION|^START|^LOCK|^LOAD}xi;
+ my @verbs = $query =~ m/\b($verbs_pat)\b/gio;
+ @verbs = do {
+ my $last = '';
+ grep { my $pass = $_ ne $last; $last = $_; $pass } map { uc } @verbs;
+ };
+
+ if ( ($verbs[0] || '') eq 'SELECT' && @verbs > 1 ) {
+ # False-positive verbs after SELECT
+ my $union = grep { $_ eq 'UNION' } @verbs;
+ @verbs = $union ? qw(SELECT UNION) : qw(SELECT);
+ }
+
+ my %seen;
+ $verbs = join(q{ }, grep { !$seen{$_}++ } @verbs);
+ }
+
+ if ( $verbs && $verbs =~ m/^SHOW/ ) {
+ my %alias_for = qw(
+ SCHEMA DATABASE
+ KEYS INDEX
+ INDEXES INDEX
+ );
+ map { $verbs =~ s/$_/$alias_for{$_}/ } keys %alias_for;
+ $query = $verbs;
+ }
+ else {
+ my @tables;
+ $query =~ s/ (?:LOW_PRIORITY|IGNORE|STRAIGHT_JOIN)//ig;
+ if ( $query =~ /^\s*LOCK\s+TABLES/i ) {
+ $query =~ s/^(\s*LOCK\s+TABLES\s+)//i;
+ $query =~ s/\s+(?:READ|WRITE|LOCAL)+\s*//gi;
+ $query = "FROM $query";
+ }
+ $query =~ s/\\["']//g; # quoted strings
+ $query =~ s/".*?"/?/sg; # quoted strings
+ $query =~ s/'.*?'/?/sg; # quoted strings
+
+ foreach my $tbls ( $query =~ m/$tbl_regex/gio ) {
+ next if $tbls =~ m/\ASELECT\b/i;
+ foreach my $tbl ( split(',', $tbls) ) {
+ $tbl =~ s/\s*($tbl_ident)(\s+.*)?/$1/gio;
+ if ( $tbl !~ m/[a-zA-Z]/ ) {
+ # Skip suspicious table name
+ next;
+ }
+ push @tables, $tbl;
+ }
+ }
+
+ # If we have a bunch of tables like db1.tbl1 db1.tbl2, convert to
+ # db1.tbl1 -.tbl2 etc. Also remove repeated tables, and strip `quotes`.
+ $query = $verbs;
+ my $prev = '';
+ foreach my $t ( @tables, $table ) {
+ next unless $t;
+ $t =~ s/`//g;
+ next if $t eq $prev;
+ my ($prefix, undef) = split(/\./, $prev);
+ $prev = $t;
+ if ( $prefix ) {
+ $t =~ s/^$prefix\./-./;
+ }
+ $query .= " " . $t;
+ }
+ }
+
+ # die $orig_query if $query eq 'LOCK lock';
+ return $query;
+}
+
# secs_to_time {{{3
sub secs_to_time {
my ( $secs, $fmt ) = @_;
$secs ||= 0;
- return '00:00' unless $secs;
+
+ # If the inbound value has a decimal point, then format the seconds with milliseconds.
+ my $hires = $secs =~ m/\./ ? '%06.3f' : '%02d';
+
+ if ( !$secs ) {
+ return sprintf("00:$hires", $secs);
+ }
# Decide what format to use, if not given
$fmt ||= $secs >= 86_400 ? 'd'
@@ -6253,20 +7217,20 @@ sub secs_to_time {
return
$fmt eq 'd' ? sprintf(
- "%d+%02d:%02d:%02d",
+ "%d+%02d:%02d:$hires",
int($secs / 86_400),
int(($secs % 86_400) / 3_600),
int(($secs % 3_600) / 60),
- $secs % 60)
+ $secs % 60 + ($secs - int($secs)))
: $fmt eq 'h' ? sprintf(
- "%02d:%02d:%02d",
+ "%02d:%02d:$hires",
int(($secs % 86_400) / 3_600),
int(($secs % 3_600) / 60),
- $secs % 60)
+ $secs % 60 + ($secs - int($secs)))
: sprintf(
- "%02d:%02d",
+ "%02d:$hires",
int(($secs % 3_600) / 60),
- $secs % 60);
+ $secs % 60 + ($secs - int($secs)));
}
# dulint_to_int {{{3
@@ -6300,13 +7264,13 @@ sub create_statusbar {
else {
if ( $modes{$mode}->{server_group} ) {
$cxn = "Servers: " . $modes{$mode}->{server_group};
- my $err_count = grep { $dbhs{$_} && $dbhs{$_}->{err_count} } @cxns;
+ my $err_count = grep { $dbhs{$_} && $dbhs{$_}->{failed} } @cxns;
if ( $err_count ) {
$cxn .= "(" . ( scalar(@cxns) - $err_count ) . "/" . scalar(@cxns) . ")";
}
}
else {
- $cxn = join(' ', map { ($dbhs{$_}->{err_count} ? '!' : '') . $_ }
+ $cxn = join(' ', map { ($dbhs{$_}->{failed} ? '!' : '') . $_ }
grep { $dbhs{$_} } @cxns);
}
}
@@ -6317,7 +7281,7 @@ sub create_statusbar {
my $inc = inc(0, $cxns[0]);
# Format server uptime human-readably, calculate QPS...
- my $uptime = secs_to_time( $vars->{Uptime_hires} );
+ my $uptime = fuzzy_time( $vars->{Uptime_hires} );
my $qps = ($inc->{Questions}||0) / ($inc->{Uptime_hires}||1);
my $ibinfo = '';
@@ -6502,6 +7466,18 @@ sub get_connections {
if ( $modes{$mode}->{one_connection} ) {
@connections = @connections ? $connections[0] : ();
}
+ # If the connections are the same as a server group, we set the mode's
+ # group to that group.
+ if ( ! $modes{$mode}->{server_group} ) {
+ my $maybe_group = join(',', sort @connections);
+ foreach my $g ( keys %server_groups ) {
+ my $group_conns = join(',', sort @{$server_groups{$g}});
+ if ( $maybe_group eq $group_conns ) {
+ $modes{$mode}->{server_group} = $g;
+ last;
+ }
+ }
+ }
return unique(@connections);
}
@@ -6530,7 +7506,7 @@ sub choose_connections {
my $choices = prompt_list("Choose connections or a group for $mode mode",
undef, sub { return keys %$meta }, $meta);
- my @choices = unique(grep { $_ } split(/\s+/, $choices));
+ my @choices = unique(grep { $_ } $choices =~ m/(\S+)/g);
if ( @choices ) {
if ( $choices[0] =~ s/^#// && exists $server_groups{$choices[0]} ) {
$modes{$mode}->{server_group} = $choices[0];
@@ -6553,9 +7529,8 @@ sub do_stmt {
# Test if the cxn should not even be tried
return undef if $dbhs{$cxn}
- && $dbhs{$cxn}->{err_count}
- && ( !$dbhs{$cxn}->{dbh} || !$dbhs{$cxn}->{dbh}->{Active} || $dbhs{$cxn}->{mode} eq $config{mode}->{val} )
- && $dbhs{$cxn}->{wake_up} > $clock;
+ && $dbhs{$cxn}->{failed}
+ && ( !$dbhs{$cxn}->{dbh} || !$dbhs{$cxn}->{dbh}->{Active} || $dbhs{$cxn}->{mode} eq $config{mode}->{val} );
my $sth;
my $retries = 1;
@@ -6596,13 +7571,12 @@ sub do_stmt {
}
}
-# Keeps track of error count, sleep times till retries, etc etc.
-# When there's an error we retry the connection every so often, increasing in
-# Fibonacci series to prevent too much banging on the server.
+# Marks a connection as failed. When we sleep between redraws, we try to
+# reopen.
sub handle_cxn_error {
my ( $cxn, $err ) = @_;
my $meta = $dbhs{$cxn};
- $meta->{err_count}++;
+ $meta->{failed} = 1;
# This is used so errors that have to do with permissions needed by the current
# mode will get displayed as long as we're in this mode, but get ignored if the
@@ -6616,12 +7590,8 @@ sub handle_cxn_error {
}
$meta->{last_err} = $err;
- my $sleep_time = $meta->{this_sleep} + $meta->{prev_sleep};
- $meta->{prev_sleep} = $meta->{this_sleep};
- $meta->{this_sleep} = $sleep_time;
- $meta->{wake_up} = $clock + $sleep_time;
if ( $config{show_cxn_errors}->{val} ) {
- print STDERR "Error at tick $clock $cxn $err" if $config{debug}->{val};
+ print STDERR "DB error: $cxn $err" if $config{debug}->{val};
}
}
@@ -6634,9 +7604,8 @@ sub do_query {
# Test if the cxn should not even be tried
return undef if $dbhs{$cxn}
- && $dbhs{$cxn}->{err_count}
- && ( !$dbhs{$cxn}->{dbh} || !$dbhs{$cxn}->{dbh}->{Active} || $dbhs{$cxn}->{mode} eq $config{mode}->{val} )
- && $dbhs{$cxn}->{wake_up} > $clock;
+ && $dbhs{$cxn}->{failed}
+ && ( !$dbhs{$cxn}->{dbh} || !$dbhs{$cxn}->{dbh}->{Active} || $dbhs{$cxn}->{mode} eq $config{mode}->{val} );
my $sth;
my $retries = 1;
@@ -6679,9 +7648,6 @@ sub connect_to_db {
$dbhs{$cxn} ||= {
stmts => {}, # bucket for prepared statements.
- prev_sleep => 0,
- this_sleep => 1,
- wake_up => 0,
start_time => 0,
dbh => undef,
};
@@ -6689,8 +7655,7 @@ sub connect_to_db {
if ( !$href->{dbh} || ref($href->{dbh}) !~ m/DBI/ || !$href->{dbh}->ping ) {
my $dbh = get_new_db_connection($cxn);
- @{$href}{qw(dbh err_count wake_up this_sleep start_time prev_sleep)}
- = ($dbh, 0, 0, 1, 0, 0);
+ @{$href}{qw(dbh failed start_time stmts)} = ($dbh, 0, 0, {});
# Derive and store the server's start time in hi-res
my $uptime = $dbh->selectrow_hashref("show status like 'Uptime'")->{value};
@@ -6709,7 +7674,7 @@ sub connect_to_db {
# Compares versions like 5.0.27 and 4.1.15-standard-log
sub version_ge {
my ( $dbh, $target ) = @_;
- my $version = sprintf('%03d%03d%03d', $dbh->{mysql_serverinfo} =~ m/(\d+)/g);
+ my $version = sprintf('%03d%03d%03d', $dbh->{mysql_serverinfo} =~ m/^(\d+).(\d+).(\d+)/g);
return $version ge sprintf('%03d%03d%03d', $target =~ m/(\d+)/g);
}
@@ -6781,7 +7746,7 @@ sub get_cxn_errors {
return () unless $config{show_cxn_errors_in_tbl}->{val};
return
map { [ $_ . ': ' . $dbhs{$_}->{last_err}, 'red' ] }
- grep { $dbhs{$_} && $dbhs{$_}->{err_count} && $dbhs{$_}->{mode} eq $config{mode}->{val} }
+ grep { $dbhs{$_} && $dbhs{$_}->{failed} && $dbhs{$_}->{mode} eq $config{mode}->{val} }
@cxns;
}
@@ -6868,6 +7833,15 @@ sub compile_expr {
# This is a subroutine because it's called from a key to quit the program.
sub finish {
save_config();
+ foreach my $cxn ( values %dbhs ) {
+ eval {
+ foreach my $sth ( values %{$cxn->{stmts}} ) {
+ $sth->finish;
+ }
+ $cxn->{dbh}->disconnect;
+ };
+ # Ignore eval errors, we just don't care
+ }
ReadMode('normal') unless $opts{n};
print "\n";
exit(0);
@@ -6926,7 +7900,7 @@ sub load_config {
my ($old_filename, $answer);
- if ( $opts{u} or $opts{p} or $opts{h} or $opts{P} ) {
+ if ( $opts{u} or $opts{p} or $opts{h} or $opts{P} or $opts{S} ) {
my @params = $dsn_parser->get_cxn_params(\%opts); # dsn=$params[0]
add_new_dsn($opts{h} || 'localhost', $params[0], 'test.innotop_dl',
$opts{u} ? 1 : 0, $opts{u}, $opts{p} ? 1 : 0, $opts{p});
@@ -6934,8 +7908,10 @@ sub load_config {
if ($opts{c}) {
$conf_file = $opts{c};
}
- # innotop got upgraded and this is an old config file.
- elsif ( -f "$homepath/.innotop" or -f "$homepath/.innotop/innotop.ini" ) {
+ # If we don't have a new config file but we do have an old one,
+ # innotop got upgraded and this is an old config file. Convert it, but
+ # don't overwrite something existing.
+ elsif ( ! -f $default_home_conf && ( -f "$homepath/.innotop" or -f "$homepath/.innotop/innotop.ini" ) ) {
$conf_file = $default_home_conf;
if ( -f "$homepath/.innotop") {
$old_filename = "$homepath/.innotop";
@@ -7462,7 +8438,8 @@ sub load_config_tbl_meta {
foreach my $prop ( keys %col_props ) {
if ( !defined($parts{$prop}) ) {
- die "Undefined property $prop for column $col in table $tbl";
+ # Make it default to whatever's in col_props.
+ $parts{$prop} = $col_props{$prop};
}
# Un-escape escaping
@@ -7997,6 +8974,17 @@ sub choose_mode_tables {
$modes{$mode}->{cust}->{visible_tables} = 1;
}
+# set_visible_table {{{3
+sub set_visible_table {
+ my ( $tbl ) = @_;
+ my $mode = $config{mode}->{val};
+ my @tbls = grep { $_ eq $tbl } @{$modes{$mode}->{tables}};
+ if ( @tbls == 1 ) {
+ $modes{$mode}->{visible_tables} = [ $tbl ];
+ $modes{$mode}->{cust}->{visible_tables} = 1;
+ }
+}
+
# choose_visible_table {{{3
sub choose_visible_table {
my ( $grep_cond ) = @_;
@@ -8045,7 +9033,7 @@ sub choose_filters {
}
);
- my @choices = unique(split(/\s+/, $val));
+ my @choices = unique($val =~ m/(\S+)/g);
foreach my $new ( grep { !exists($filters{$_}) } @choices ) {
my $answer = prompt("There is no filter called '$new'. Create it?", undef, 'y');
if ( $answer eq 'y' ) {
@@ -8290,7 +9278,7 @@ sub choose_or_create_connection {
sub { return @available },
{ map { $_ => $connections{$_}->{dsn} } @available });
- my @new = unique(grep { !exists $connections{$_} } split(/\s+/, $new_cxns));
+ my @new = unique(grep { !exists $connections{$_} } $new_cxns =~ m/(\S+)/g);
foreach my $new ( @new ) {
my $answer = prompt("There is no connection called '$new'. Create it?", undef, "y");
if ( $answer eq 'y' ) {
@@ -8309,6 +9297,7 @@ sub choose_servers {
my @chosen = choose_or_create_connection($cxns, 'for this mode');
$modes{$mode}->{connections} = \@chosen;
$modes{$mode}->{server_group} = ''; # Clear this because it overrides {connections}
+ get_connections(); # This will set the server group if it matches connections just chosen
}
# display_license {{{3
@@ -8339,10 +9328,41 @@ sub get_status_info {
$vars->{Uptime_hires} ||= get_uptime($cxn);
$vars->{cxn} = $cxn;
- # Add SHOW VARIABLES to the hash
- $sth = do_stmt($cxn, 'SHOW_VARIABLES') or next;
- $res = $sth->fetchall_arrayref();
- map { $vars->{$_->[0]} = $_->[1] || 0 } @$res;
+ # Add SHOW VARIABLES to the hash. If we've gotten this info before, skip and re-use.
+ if ( $show_variables{$cxn} ) {
+ $res = $show_variables{$cxn};
+ }
+ else {
+ $sth = do_stmt($cxn, 'SHOW_VARIABLES') or next;
+ $res = $sth->fetchall_arrayref();
+ $res = {map { $_->[0] => $_->[1] || 0 } @$res};
+ $show_variables{$cxn} = $res;
+ }
+ @{$vars}{keys %$res} = values %$res;
+
+ # Create sparklines for QPS and Threads_running. As a consequence of
+ # this, we get QPS for free. TODO: remove QPS computation from
+ # elsewhere.
+ my $pre = $vars{$cxn}->{$clock - 1};
+ if ( $pre && $pre->{Uptime_hires} ) {
+ my @prev_qps = ($pre->{SPARK_store_qps} || '') =~ m/(\S+)/g;
+ my @prev_run = ($pre->{SPARK_store_run} || '') =~ m/(\S+)/g;
+
+ # Find out the values; throw away if too many; sparkify; store.
+ my $this_qps = (($vars->{Questions} || 0) - ($pre->{Questions} || 0))/
+ ($vars->{Uptime_hires} - $pre->{Uptime_hires});
+ push @prev_qps, $this_qps;
+ shift @prev_qps if @prev_qps > $config{spark}->{val};
+ my $qps_spark = sparkify(@prev_qps);
+ $vars->{SPARK_qps} = $qps_spark;
+ $vars->{SPARK_store_qps} = join(' ', @prev_qps);
+ my $this_run = $vars->{Threads_running};
+ push @prev_run, $this_run;
+ shift @prev_run if @prev_run > $config{spark}->{val};
+ my $run_spark = sparkify(@prev_run);
+ $vars->{SPARK_run} = $run_spark;
+ $vars->{SPARK_store_run} = join(' ', @prev_run);
+ }
}
}
}
@@ -8352,7 +9372,6 @@ sub get_status_info {
sub choose_thread {
my ( $grep_cond, $prompt ) = @_;
- # Narrow the list to queries that can be explained.
my %thread_for = map {
# Eliminate innotop's own threads.
$_ => $dbhs{$_}->{dbh} ? $dbhs{$_}->{dbh}->{mysql_thread_id} : 0
@@ -8380,7 +9399,7 @@ sub choose_thread {
my ( $a, $b ) = @_;
return $a->{query} && !$b->{query} ? 1
: $b->{query} && !$a->{query} ? -1
- : ($a->{time} || 0) <=> ($b->{time} || 0);
+ : ($a->{time} || 0) cmp ($b->{time} || 0);
};
my @threads = map { $_->{id} } reverse sort { $sort_func->($a, $b) } @candidates;
@@ -8439,7 +9458,7 @@ sub inc {
# Numeric variables get subtracted, non-numeric get passed straight through.
map {
$_ =>
- ( (defined $cur->{$_} && $cur->{$_} =~ m/$num_regex/)
+ ( (defined $cur->{$_} && $cur->{$_} =~ m/$num_regex/ && ($pre->{$_} || '') =~ m/$num_regex/ )
? $cur->{$_} - ($pre->{$_} || 0)
: $cur->{$_} )
} keys %{$cur}
@@ -8479,6 +9498,72 @@ sub extract_values {
return $result;
}
+# get_processlist_stats {{{3
+# Inserts special values as though they are SHOW STATUS counters.
+sub get_processlist_stats {
+ my @cxns = @_;
+ @current_queries = ();
+ if ( !$info_gotten{processlist_stats}++ ) {
+ foreach my $cxn ( @cxns ) {
+ my $max_query_time = 0;
+ my ($user_threads, $slaves, $longest_sql, $slave_sql, $locked);
+ $vars{$cxn}->{$clock} ||= {};
+ my $vars = $vars{$cxn}->{$clock};
+ $vars->{cxn} = $cxn;
+ my $stmt = do_stmt($cxn, 'PROCESSLIST_NO_IS') or next;
+ my $arr = $stmt->fetchall_arrayref({});
+ my $cur = undef;
+ foreach my $thread ( @$arr ) {
+ if ( ($thread->{state} || '') =~ m/lock/i ) {
+ $locked++;
+ }
+ # Ignore non-user threads, but remember the SQL in case there is
+ # no user SQL. Ignore sleeping threads and SHOW PROCESSLIST
+ # threads.
+ if ( ($thread->{user} || '') =~ m/system user/ ) {
+ if ( $thread->{info} && $thread->{time} ) {
+ $slave_sql = $thread->{info};
+ }
+ next;
+ }
+ next unless $thread->{command};
+ if ( $thread->{command} eq 'Binlog Dump' ) {
+ $slaves++;
+ next;
+ }
+ next unless $thread->{command} eq 'Query';
+ next unless $thread->{state} && $thread->{info};
+ next if $thread->{info} =~ m#/\*innotop#;
+ $user_threads++;
+ if ( $thread->{time} > $max_query_time ) {
+ $max_query_time = $thread->{time};
+ $longest_sql = $thread->{info};
+ if ( $thread->{state} eq 'Checking table' ) {
+ $longest_sql = 'CHECK TABLE ' . $thread->{info};
+ }
+ $cur = {
+ cxn => $cxn,
+ id => $thread->{id},
+ db => $thread->{db},
+ query => $thread->{info},
+ time => $thread->{time},
+ user => $thread->{user},
+ host => $thread->{host},
+ };
+ $thread->{host} =~ s/:.*$//;
+ }
+ }
+ $vars->{Max_query_time} = $max_query_time;
+ $vars->{User_threads_running} = $user_threads;
+ $vars->{Slaves} = $slaves || 0;
+ $vars->{Longest_sql} = $longest_sql || $slave_sql || '';
+ $vars->{Locked_count} = $locked || 0;
+ $vars->{Uptime_hires} ||= get_uptime($cxn);
+ push @current_queries, $cur if $cur;
+ }
+ }
+}
+
# get_full_processlist {{{3
sub get_full_processlist {
my @cxns = @_;
@@ -8503,6 +9588,54 @@ sub get_open_tables {
return @result;
}
+# get_index_statistics {{{3
+sub get_index_statistics {
+ my @cxns = @_;
+ my @result;
+ foreach my $cxn ( @cxns ) {
+ my $stmt = do_stmt($cxn, 'INDEX_STATISTICS') or next;
+ my $arr = $stmt->fetchall_arrayref({});
+ push @result, map { $_->{cxn} = $cxn; $_ } @$arr;
+ }
+ return @result;
+}
+
+# get_index_table_statistics {{{3
+sub get_index_table_statistics {
+ my @cxns = @_;
+ my @result;
+ foreach my $cxn ( @cxns ) {
+ my $stmt = do_stmt($cxn, 'INDEX_TABLE_STATISTICS') or next;
+ my $arr = $stmt->fetchall_arrayref({});
+ push @result, map { $_->{cxn} = $cxn; $_ } @$arr;
+ }
+ return @result;
+}
+
+# get_table_statistics {{{3
+sub get_table_statistics {
+ my @cxns = @_;
+ my @result;
+ foreach my $cxn ( @cxns ) {
+ my $stmt = do_stmt($cxn, 'TABLE_STATISTICS') or next;
+ my $arr = $stmt->fetchall_arrayref({});
+ push @result, map { $_->{cxn} = $cxn; $_ } @$arr;
+ }
+ return @result;
+}
+
+# get_innodb_blocked_blocker {{{3
+sub get_innodb_blocked_blocker {
+ my @cxns = @_;
+ my @result;
+ foreach my $cxn ( @cxns ) {
+ my $stmt = do_stmt($cxn, 'INNODB_BLOCKED_BLOCKER') or next;
+ my $arr = $stmt->fetchall_arrayref({});
+ push @result, map { $_->{cxn} = $cxn; $_ } @$arr;
+ }
+ return @result;
+}
+
# get_innodb_status {{{3
sub get_innodb_status {
my ( $cxns, $addl_sections ) = @_;
@@ -8549,6 +9682,7 @@ sub get_innodb_status {
}
else {
+ next if ($show_variables{$cxn}->{have_innodb} || 'YES') eq 'NO';
my $stmt = do_stmt($cxn, 'INNODB_STATUS') or next;
$innodb_status_text = $stmt->fetchrow_hashref()->{status};
}
@@ -8563,6 +9697,7 @@ sub get_innodb_status {
$config{debug}->{val},
\%sections_required,
0, # don't parse full lock information
+ $show_variables{$cxn}->{version}
)
);
if ( !$innodb_status{IB_got_all} && $config{auto_wipe_dl}->{val} ) {
@@ -8587,6 +9722,9 @@ sub clear_deadlock {
return unless $tbl;
eval {
+ # disable binary logging for the session
+ do_query($cxn, "set SQL_LOG_BIN=0");
+
# Set up the table for creating a deadlock.
my $engine = version_ge($dbhs{$cxn}->{dbh}, '4.1.2') ? 'engine' : 'type';
return unless do_query($cxn, "drop table if exists $tbl");
@@ -8616,6 +9754,11 @@ sub clear_deadlock {
# Clean up.
do_query($cxn, "drop table $tbl");
+
+ # enable binary logging for the session again
+ # the session by itself will not be used anymore, but this is clean :)
+ do_query($cxn, "set SQL_LOG_BIN=1");
+
};
if ( $EVAL_ERROR ) {
print $EVAL_ERROR;
@@ -8638,6 +9781,7 @@ sub get_master_logs {
}
# get_master_slave_status {{{3
+# Inserts special counters as though they are SHOW STATUS counters.
sub get_master_slave_status {
my @cxns = @_;
if ( !$info_gotten{replication_status}++ ) {
@@ -8645,18 +9789,61 @@ sub get_master_slave_status {
$vars{$cxn}->{$clock} ||= {};
my $vars = $vars{$cxn}->{$clock};
$vars->{cxn} = $cxn;
+ $vars->{Uptime_hires} ||= get_uptime($cxn);
my $stmt = do_stmt($cxn, 'SHOW_MASTER_STATUS') or next;
my $res = $stmt->fetchall_arrayref({})->[0];
@{$vars}{ keys %$res } = values %$res;
- $stmt = do_stmt($cxn, 'SHOW_SLAVE_STATUS') or next;
- $res = $stmt->fetchall_arrayref({})->[0];
- @{$vars}{ keys %$res } = values %$res;
- $vars->{Uptime_hires} ||= get_uptime($cxn);
+
}
}
}
+# get_slave_status {{{3
+# Separated handling of slave status to support 5.7 and replication channels
+sub get_slave_status {
+ my ($cxn, $channel) = @_;
+ my $chcxn = $channel . '=' . $cxn;
+ $vars{$chcxn}->{$clock} ||= {};
+ my $vars = $vars{$chcxn}->{$clock};
+ $vars->{chcxn} = $chcxn;
+ $vars->{Uptime_hires} ||= get_uptime($chcxn);
+
+ if ( $channel =~ /no_channels/ ) {
+ my $stmt = do_stmt($cxn, 'SHOW_SLAVE_STATUS') or next;
+ my $res = $stmt->fetchall_arrayref({});
+ if ( $res && @$res ) {
+ $res = $res->[0];
+ @{$vars}{ keys %$res } = values %$res;
+ $vars->{Slave_ok} =
+ (($res->{slave_sql_running} || 'Yes') eq 'Yes'
+ && ($res->{slave_io_running} || 'Yes') eq 'Yes') ? 'Yes' : 'No';
+ }
+ else {
+ $vars->{Slave_ok} = 'Off';
+ }
+ } else {
+ my $dbh = connect_to_db($cxn);
+ my $sql = 'SHOW SLAVE STATUS FOR CHANNEL \'' . $channel . '\'';
+ my $stmt = $dbh->prepare($sql ) ;
+ $stmt->execute();
+ my $res = $stmt->fetchall_arrayref({});
+ if ( $res && @$res ) {
+ $res = $res->[0];
+ @{$vars}{ keys %$res } = values %$res;
+ $vars->{Slave_ok} =
+ (($res->{slave_sql_running} || 'Yes') eq 'Yes'
+ && ($res->{slave_io_running} || 'Yes') eq 'Yes') ? 'Yes' : 'No';
+ }
+ else {
+ $vars->{Slave_ok} = 'Off';
+ }
+ }
+ }
+
+
+
+
sub is_func {
my ( $word ) = @_;
return defined(&$word)
@@ -8811,6 +9998,12 @@ Port to use for connection.
Don't read the central configuration file.
+=item --timestamp
+
+In -n mode, write a timestamp either before every screenful of output, or if
+the option is given twice, at the start of every line. The format is controlled
+by the timeformat config variable.
+
=item --user
User to use for connection.
@@ -8860,6 +10053,13 @@ following list:
=over
+=item A: Health Dashboard
+
+This mode displays a single table with one row per monitored server. The
+columns show essential overview information about the server's health, and
+coloration rules show whether replication is running or if there are any very
+long-running queries or excessive replication delay.
+
=item B: InnoDB Buffers
This mode displays information about the InnoDB buffer pool, page statistics,
@@ -8945,6 +10145,12 @@ This mode shows InnoDB's I/O statistics, including the I/O threads, pending I/O,
file I/O miscellaneous, and log statistics. It displays the L<"io_threads">,
L<"pending_io">, L<"file_io_misc">, and L<"log_statistics"> tables by default.
+=item K: InnoDB Lock Waits
+
+This mode shows information from InnoDB plugin's transaction and locking tables.
+You can use it to find when a transaction is waiting for another, and kill the
+blocking transaction. It displays the L<"innodb_blocked_blocker>" table.
+
=item L: Locks
This mode shows information about current locks. At the moment only InnoDB
@@ -9008,6 +10214,23 @@ tables might be locked implicitly.
This mode displays the L<"open_tables"> mode by default.
+=item U: User Statistics
+
+This mode displays data that's available in Percona's enhanced version of MySQL
+(also known as Percona Server with XtraDB). Specifically, it makes it easy to
+enable and disable the so-called "user statistics." This feature gathers stats
+on clients, threads, users, tables, and indexes and makes them available as
+INFORMATION_SCHEMA tables. These are invaluable for understanding what your
+server is doing. They are also available in MariaDB.
+
+The statistics supported so far are only from the TABLE_STATISTICS and
+INDEX_STATISTICS tables added by Percona. There are three views: one of table stats,
+one of index stats (which can be aggregated with the = key), and one of both.
+
+The server doesn't gather these stats by default. You have to set the variable
+userstat_running to turn it on. You can do this easily with innotop from U mode,
+with the 's' key.
+
=item Q: Query List
This mode displays the output from SHOW FULL PROCESSLIST, much like B<mytop>'s
@@ -9156,6 +10379,9 @@ connection names of that master's slaves (there is no way for innotop to
determine this reliably itself). innotop will find the minimum binlog in use by
these slave connections and suggest it as the argument to PURGE MASTER LOGS.
+in L<"U: User Statistics"> mode, you can use the 's' key to start and stop
+the collection of the statistics data for TABLE_STATISTICS and similar.
+
=head1 SERVER CONNECTIONS
When you create a server connection using '@', innotop asks you for a series of
@@ -9603,6 +10829,11 @@ Disables fetching SHOW INNODB STATUS, in case your server(s) do not have InnoDB
enabled and you don't want innotop to try to fetch it. This can also be useful
when you don't have the SUPER privilege, required to run SHOW INNODB STATUS.
+=item spark
+
+Specifies how wide a spark chart is. There are two ASCII spark charts in A
+mode, showing QPS and User_threads_running.
+
=item status_inc
Whether to show absolute or incremental values for status variables.
@@ -9611,6 +10842,11 @@ for that variable. This is a global setting, but will probably become
mode-specific at some point. Right now it is honored a bit inconsistently; some
modes don't pay attention to it.
+=item timeformat
+
+The C-style strftime()-compatible format for the timestamp line to be printed
+in -n mode when -t is set.
+
=back
=item plugins
@@ -9874,6 +11110,27 @@ L<"STATUS_VARIABLES">.
Displays various data about InnoDB's last foreign key error. Data source:
L<"STATUS_VARIABLES">.
+=item health_dashboard
+
+Displays an overall summary of servers, one server per line, for monitoring.
+Data source: L<"STATUS_VARIABLES">, L<"MASTER_SLAVE">, L<"PROCESSLIST_STATS">.
+
+=item index_statistics
+
+Displays data from the INDEX_STATISTICS table in Percona-enhanced servers.
+
+=item index_table_statistics
+
+Displays data from the INDEX_STATISTICS and TABLE_STATISTICS tables in
+Percona-enhanced servers. It joins the two together, grouped by the database
+and table name. It is the default view in L<"U: User Statistics"> mode,
+and makes it easy to see what tables are hot, how many rows are read from indexes,
+how many changes are made, and how many changes are made to indexes.
+
+=item innodb_blocked_blocker
+
+Displays InnoDB locks and lock waits. Data source: L<"INNODB_BLOCKED_BLOCKER">.
+
=item innodb_locks
Displays InnoDB locks. Data source: L<"INNODB_LOCKS">.
@@ -9944,6 +11201,10 @@ L<"STATUS_VARIABLES">.
Displays data about the slave SQL thread. Data source: L<"STATUS_VARIABLES">.
+=item table_statistics
+
+Displays data from the TABLE_STATISTICS table in Percona-enhanced servers.
+
=item t_header
Displays various InnoDB status values. Data source: L<"STATUS_VARIABLES">.
@@ -10021,6 +11282,10 @@ the table. Several columns are set this way, such as the count column on
L<"processlist"> and L<"innodb_transactions">, so you don't see a count when the
grouping isn't enabled, but you do when it is.
+=item *
+
+agghide: the reverse of aggonly. The column is hidden when grouping is enabled.
+
=back
=head2 FILTERS
@@ -10072,11 +11337,26 @@ persist when you restart innotop. To create a quick-filter, press the '/' key.
innotop will prompt you for the column name and filter text. Again, you can use
auto-completion on column names. The filter text can be just the text you want
to "search for." For example, to filter the L<"processlist"> table on queries
-that refer to the products table, type '/' and then 'info product'.
+that refer to the products table, type '/' and then 'info product'. Internally,
+the filter is compiled into a subroutine like this:
+
+ sub filter {
+ my ( $set ) = @_;
+ $set->{info} =~ m/product/;
+ }
The filter text can actually be any Perl regular expression, but of course a
literal string like 'product' works fine as a regular expression.
+What if you want the filter to discard matching rows, rather than showing
+matching rows? If you're familiar with Perl regular expressions, you might
+guess how to do this. You have to use a zero-width negative lookahead
+assertion. If you don't know what that means, don't worry. Let's filter out
+all rows where the command is Gandalf. Type the following:
+
+ 1. /
+ 2. cmd ^(?!Gandalf)
+
Behind the scenes innotop compiles the quick-filter into a specially tagged
filter that is otherwise like any other filter. It just isn't saved to the
configuration file.
@@ -10174,8 +11454,8 @@ That's actually quite a worrisome picture. You've got a lot of idle connections
(Sleep), and some connections executing queries (Query and Sending Data).
That's okay, but you also have a lot in Statistics status, collectively spending
over a minute. That means the query optimizer is having a really hard time
-optimizing your statements. Something is wrong; it should normally take
-milliseconds to optimize queries. You might not have seen this pattern if you
+generating execution plans for your statements. Something is wrong; it should
+normally take milliseconds to plan queries. You might not have seen this pattern if you
didn't look at your connections in aggregate. (This is a made-up example, but
it can happen in real life).
@@ -10311,12 +11591,20 @@ are defined:
Adds commas to large numbers every three decimal places.
+=item distill
+
+Distills SQL into verb-noun-noun format for quick comprehension.
+
=item dulint_to_int
Accepts two unsigned integers and converts them into a single longlong. This is
useful for certain operations with InnoDB, which uses two integers as
transaction identifiers, for example.
+=item fuzzy_time
+
+Converts a number of seconds into a friendly, readable value like "1h35m".
+
=item no_ctrl_char
Removes quoted control characters from the value. This is affected by the
@@ -10365,7 +11653,7 @@ show you something like this:
pages_modified Dirty Pages Pages modified (dirty IB_bp_pages_m
buf_pool_hit_rate Hit Rate Buffer pool hit rate IB_bp_buf_poo
total_mem_alloc Memory Total memory allocate IB_bp_total_m
- add_pool_alloc Add'l Pool Additional pool alloca IB_bp_add_poo
+ add_pool_alloc Add'l Pool Additonal pool alloca IB_bp_add_poo
The first line shows which table you're editing, and reminds you again to press
'?' for a list of key mappings. The rest is a tabular representation of the
@@ -10485,9 +11773,9 @@ or modify its existing functionality, and add new functionality. innotop's
plugin functionality is event-based: plugins register themselves to be called
when events happen. They then have a chance to influence the event.
-An innotop plugin is a Perl module placed in innotop's L<"plugin_dir">
+An innotop plugin is a Perl module (.pm) file placed in innotop's L<"plugin_dir">
directory. On UNIX systems, you can place a symbolic link to the module instead
-of putting the actual file there. innotop automatically discovers the file. If
+of putting the actual file there. innotop automatically discovers files named C<*.pm>. If
there is a corresponding entry in the L<"plugins"> configuration file section,
innotop loads and activates the plugin.
@@ -10500,7 +11788,7 @@ file and determine the package name and description.
innotop inspects the plugin module's source to determine the Perl package name.
It looks for a line of the form "package Foo;" and if found, considers the
plugin's package name to be Foo. Of course the package name can be a valid Perl
-package name, with double semicolons and so on.
+package name such as Foo::Bar, with double colons (::) and so on.
It also looks for a description in the source code, to make the plugin editor
more human-friendly. The description is a comment line of the form "#
@@ -10642,7 +11930,9 @@ $lines is an arrayref of strings.
The easiest way to explain the plugin functionality is probably with a simple
example. The following module adds a column to the beginning of every table and
-sets its value to 1.
+sets its value to 1. (If you copy and paste this example code, be sure to remove
+the first space from each line; lines such as '# description' must not start with
+whitespace).
use strict;
use warnings FATAL => 'all';
@@ -10716,6 +12006,7 @@ executes "SHOW ENGINE INNODB STATUS", while on earlier versions it executes
Statement SQL executed
=================== ===============================
+ INDEX_STATISTICS SELECT * FROM INFORMATION_SCHEMA.INDEX_STATISTICS
INNODB_STATUS SHOW [ENGINE] INNODB STATUS
KILL_CONNECTION KILL
KILL_QUERY KILL QUERY
@@ -10726,6 +12017,7 @@ executes "SHOW ENGINE INNODB STATUS", while on earlier versions it executes
SHOW_SLAVE_STATUS SHOW SLAVE STATUS
SHOW_STATUS SHOW [GLOBAL] STATUS
SHOW_VARIABLES SHOW [GLOBAL] VARIABLES
+ TABLE_STATISTICS SELECT * FROM INFORMATION_SCHEMA.TABLE_STATISTICS
=head1 DATA SOURCES
@@ -10766,6 +12058,11 @@ section of SHOW INNODB STATUS. It is nested one level deep.
This data is from the result set returned by EXPLAIN.
+=item INNODB_BLOCKED_BLOCKER
+
+This data is from the INFORMATION_SCHEMA tables related to InnoDB locks and
+the processlist.
+
=item INNODB_TRANSACTIONS
This data is from the TRANSACTIONS section of SHOW INNODB STATUS.
@@ -10780,6 +12077,10 @@ STATUS.
This data is from the TRANSACTIONS section of SHOW INNODB STATUS and is nested
two levels deep.
+=item MASTER_SLAVE
+
+This data is from the combination of SHOW MASTER STATUS and SHOW SLAVE STATUS.
+
=item OPEN_TABLES
This data is from SHOW OPEN TABLES.
@@ -10788,6 +12089,12 @@ This data is from SHOW OPEN TABLES.
This data is from SHOW FULL PROCESSLIST.
+=item PROCESSLIST_STATS
+
+This data is from SHOW FULL PROCESSLIST and computes stats such as the maximum time
+a user query has been running, and how many user queries are running. A "user
+query" excludes replication threads.
+
=item OS_WAIT_ARRAY
This data is from the SEMAPHORES section of SHOW INNODB STATUS and is nested one
@@ -10874,6 +12181,7 @@ displays it.
The following people and organizations are acknowledged for various reasons.
Hopefully no one has been forgotten.
+Aaron Racine,
Allen K. Smith,
Aurimas Mikalauskas,
Bartosz Fenski,
@@ -10925,8 +12233,8 @@ systems, you can issue `man perlgpl' or `man perlartistic' to read these
licenses.
You should have received a copy of the GNU General Public License along with
-this program; if not, write to the Free Software Foundation, Inc., 59 Temple
-Place, Suite 330, Boston, MA 02111-1307 USA.
+this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
+Street, Fifth Floor, Boston, MA 02111-1301 USA.
Execute innotop and press '!' to see this information at any time.
@@ -10937,7 +12245,7 @@ Originally written by Baron Schwartz; currently maintained by Aaron Racine.
=head1 BUGS
You can report bugs, ask for improvements, and get other help and support at
-L<http://code.google.com/p/innotop/>. There are mailing lists, a source code
+L<https://github.com/innotop/innotop>. There are mailing lists, a source code
browser, a bug tracker, etc. Please use these instead of contacting the
maintainer or author directly, as it makes our job easier and benefits others if the
discussions are permanent and public. Of course, if you need to contact us in
diff --git a/debian/additions/innotop/innotop.1 b/debian/additions/innotop/innotop.1
index fbb481f9b94..86652945109 100644
--- a/debian/additions/innotop/innotop.1
+++ b/debian/additions/innotop/innotop.1
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.1801 (Pod::Simple 3.07)
+.\" Automatically generated by Pod::Man 2.28 (Pod::Simple 3.28)
.\"
.\" Standard preamble:
.\" ========================================================================
@@ -38,6 +38,8 @@
. ds PI \(*p
. ds L" ``
. ds R" ''
+. ds C`
+. ds C'
'br\}
.\"
.\" Escape single quotes in literal strings from groff's Unicode transform.
@@ -48,17 +50,24 @@
.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
.\" entries marked with X<> in POD. Of course, you'll have to process the
.\" output yourself in some meaningful fashion.
-.ie \nF \{\
-. de IX
-. tm Index:\\$1\t\\n%\t"\\$2"
+.\"
+.\" Avoid warning from groff about undefined register 'F'.
+.de IX
..
-. nr % 0
-. rr F
-.\}
-.el \{\
-. de IX
+.nr rF 0
+.if \n(.g .if rF .nr rF 1
+.if (\n(rF:(\n(.g==0)) \{
+. if \nF \{
+. de IX
+. tm Index:\\$1\t\\n%\t"\\$2"
..
+. if !\nF==2 \{
+. nr % 0
+. nr F 2
+. \}
+. \}
.\}
+.rr rF
.\"
.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
.\" Fear. Run. Save yourself. No user-serviceable parts.
@@ -124,7 +133,7 @@
.\" ========================================================================
.\"
.IX Title "INNOTOP 1"
-.TH INNOTOP 1 "2009-03-09" "perl v5.10.0" "User Contributed Perl Documentation"
+.TH INNOTOP 1 "2017-01-23" "perl v5.20.2" "User Contributed Perl Documentation"
.\" For nroff, turn off justification. Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.if n .ad l
@@ -210,7 +219,7 @@ To quit innotop, press the 'q' key.
.IX Header "OPTIONS"
innotop is mostly configured via its configuration file, but some of the
configuration options can come from the command line. You can also specify a
-file to monitor for InnoDB status output; see \*(L"\s-1MONITORING\s0 A \s-1FILE\s0\*(R" for more
+file to monitor for InnoDB status output; see \*(L"\s-1MONITORING A FILE\*(R"\s0 for more
details.
.PP
You can negate some options by prefixing the option name with \-\-no. For
@@ -249,7 +258,7 @@ Specifies the mode in which innotop should start. Corresponds to the
configuration option \*(L"mode\*(R".
.IP "\-\-nonint" 4
.IX Item "--nonint"
-Enable non-interactive operation. See \*(L"NON-INTERACTIVE \s-1OPERATION\s0\*(R" for more.
+Enable non-interactive operation. See \*(L"NON-INTERACTIVE \s-1OPERATION\*(R"\s0 for more.
.IP "\-\-password" 4
.IX Item "--password"
Password to use for connection.
@@ -259,6 +268,11 @@ Port to use for connection.
.IP "\-\-skipcentral" 4
.IX Item "--skipcentral"
Don't read the central configuration file.
+.IP "\-\-timestamp" 4
+.IX Item "--timestamp"
+In \-n mode, write a timestamp either before every screenful of output, or if
+the option is given twice, at the start of every line. The format is controlled
+by the timeformat config variable.
.IP "\-\-user" 4
.IX Item "--user"
User to use for connection.
@@ -289,10 +303,16 @@ the servers you're monitoring. You switch between modes with uppercase keys.
The following is a brief description of each mode, in alphabetical order. To
switch to the mode, press the key listed in front of its heading in the
following list:
+.IP "A: Health Dashboard" 4
+.IX Item "A: Health Dashboard"
+This mode displays a single table with one row per monitored server. The
+columns show essential overview information about the server's health, and
+coloration rules show whether replication is running or if there are any very
+long-running queries or excessive replication delay.
.IP "B: InnoDB Buffers" 4
.IX Item "B: InnoDB Buffers"
This mode displays information about the InnoDB buffer pool, page statistics,
-insert buffer, and adaptive hash index. The data comes from \s-1SHOW\s0 \s-1INNODB\s0 \s-1STATUS\s0.
+insert buffer, and adaptive hash index. The data comes from \s-1SHOW INNODB STATUS.\s0
.Sp
This mode contains the \*(L"buffer_pool\*(R", \*(L"page_statistics\*(R",
\&\*(L"insert_buffers\*(R", and \*(L"adaptive_hash_index\*(R" tables by default.
@@ -313,7 +333,7 @@ This mode is similar to mytop's Command Summary mode. It shows the
.Ve
.Sp
The command summary table is built by extracting variables from
-\&\*(L"\s-1STATUS_VARIABLES\s0\*(R". The variables must be numeric and must match the prefix
+\&\*(L"\s-1STATUS_VARIABLES\*(R"\s0. The variables must be numeric and must match the prefix
given by the \*(L"cmd_filter\*(R" configuration variable. The variables are then
sorted by value descending and compared to the last variable, as shown above.
The percentage columns are percentage of the total of all variables in the
@@ -322,7 +342,7 @@ table, so you can see the relative weight of the variables.
The example shows what you see if the prefix is \*(L"Select_\*(R". The default
prefix is \*(L"Com_\*(R". You can choose a prefix with the 's' key.
.Sp
-It's rather like running \s-1SHOW\s0 \s-1VARIABLES\s0 \s-1LIKE\s0 \*(L"prefix%\*(R" with memory and
+It's rather like running \s-1SHOW VARIABLES LIKE \s0\*(L"prefix%\*(R" with memory and
nice formatting.
.Sp
Values are aggregated across all servers. The Pct columns are not correctly
@@ -335,10 +355,10 @@ table shows the locks each transaction held and waited for. A deadlock is
caused by a cycle in the waits-for graph, so there should be two locks held and
one waited for unless the deadlock information is truncated.
.Sp
-InnoDB puts deadlock information before some other information in the \s-1SHOW\s0
-\&\s-1INNODB\s0 \s-1STATUS\s0 output. If there are a lot of locks, the deadlock information can
-grow very large, and there is a limit on the size of the \s-1SHOW\s0 \s-1INNODB\s0
-\&\s-1STATUS\s0 output. A large deadlock can fill the entire output, or even be
+InnoDB puts deadlock information before some other information in the \s-1SHOW
+INNODB STATUS\s0 output. If there are a lot of locks, the deadlock information can
+grow very large, and there is a limit on the size of the \s-1SHOW INNODB
+STATUS\s0 output. A large deadlock can fill the entire output, or even be
truncated, and prevent you from seeing other information at all. If you are
running innotop in another mode, for example T mode, and suddenly you don't see
anything, you might want to check and see if a deadlock has wiped out the data
@@ -346,8 +366,8 @@ you need.
.Sp
If it has, you can create a small deadlock to replace the large one. Use the
\&'w' key to 'wipe' the large deadlock with a small one. This will not work
-unless you have defined a deadlock table for the connection (see \*(L"\s-1SERVER\s0
-\&\s-1CONNECTIONS\s0\*(R").
+unless you have defined a deadlock table for the connection (see \*(L"\s-1SERVER
+CONNECTIONS\*(R"\s0).
.Sp
You can also configure innotop to automatically detect when a large deadlock
needs to be replaced with a small one (see \*(L"auto_wipe_dl\*(R").
@@ -371,6 +391,11 @@ This mode displays the \*(L"fk_error\*(R" table by default.
This mode shows InnoDB's I/O statistics, including the I/O threads, pending I/O,
file I/O miscellaneous, and log statistics. It displays the \*(L"io_threads\*(R",
\&\*(L"pending_io\*(R", \*(L"file_io_misc\*(R", and \*(L"log_statistics\*(R" tables by default.
+.IP "K: InnoDB Lock Waits" 4
+.IX Item "K: InnoDB Lock Waits"
+This mode shows information from InnoDB plugin's transaction and locking tables.
+You can use it to find when a transaction is waiting for another, and kill the
+blocking transaction. It displays the "innodb_blocked_blocker" table.
.IP "L: Locks" 4
.IX Item "L: Locks"
This mode shows information about current locks. At the moment only InnoDB
@@ -384,7 +409,7 @@ You can configure MySQL and innotop to monitor not only locks for which a
transaction is waiting, but those currently held, too. You can do this with the
InnoDB Lock Monitor (<http://dev.mysql.com/doc/en/innodb\-monitor.html>). It's
not documented in the MySQL manual, but creating the lock monitor with the
-following statement also affects the output of \s-1SHOW\s0 \s-1INNODB\s0 \s-1STATUS\s0, which innotop
+following statement also affects the output of \s-1SHOW INNODB STATUS,\s0 which innotop
uses:
.Sp
.Vb 1
@@ -392,7 +417,7 @@ uses:
.Ve
.Sp
This causes InnoDB to print its output to the MySQL file every 16 seconds or so,
-as stated in the manual, but it also makes the normal \s-1SHOW\s0 \s-1INNODB\s0 \s-1STATUS\s0 output
+as stated in the manual, but it also makes the normal \s-1SHOW INNODB STATUS\s0 output
include lock information, which innotop can parse and display (that's the
undocumented feature).
.Sp
@@ -414,13 +439,13 @@ the screen when one connection is waiting for locks another connection holds:
\& localhost 11 RECORD 0 00:00 00:25 X test t1 PRIMARY
.Ve
.Sp
-You can see the first connection, \s-1ID\s0 12, is waiting for a lock on the \s-1PRIMARY\s0
+You can see the first connection, \s-1ID 12,\s0 is waiting for a lock on the \s-1PRIMARY\s0
key on test.t1, and has been waiting for 10 seconds. The second connection
isn't waiting, because the Waiting column is 0, but it holds locks on the same
index. That tells you connection 11 is blocking connection 12.
.IP "M: Master/Slave Replication Status" 4
.IX Item "M: Master/Slave Replication Status"
-This mode shows the output of \s-1SHOW\s0 \s-1SLAVE\s0 \s-1STATUS\s0 and \s-1SHOW\s0 \s-1MASTER\s0 \s-1STATUS\s0 in three
+This mode shows the output of \s-1SHOW SLAVE STATUS\s0 and \s-1SHOW MASTER STATUS\s0 in three
tables. The first two divide the slave's status into \s-1SQL\s0 and I/O thread status,
and the last shows master status. Filters are applied to eliminate non-slave
servers from the slave tables, and non-master servers from the master table.
@@ -429,15 +454,31 @@ This mode displays the \*(L"slave_sql_status\*(R", \*(L"slave_io_status\*(R", an
\&\*(L"master_status\*(R" tables by default.
.IP "O: Open Tables" 4
.IX Item "O: Open Tables"
-This section comes from MySQL's \s-1SHOW\s0 \s-1OPEN\s0 \s-1TABLES\s0 command. By default it is
+This section comes from MySQL's \s-1SHOW OPEN TABLES\s0 command. By default it is
filtered to show tables which are in use by one or more queries, so you can
get a quick look at which tables are 'hot'. You can use this to guess which
tables might be locked implicitly.
.Sp
This mode displays the \*(L"open_tables\*(R" mode by default.
+.IP "U: User Statistics" 4
+.IX Item "U: User Statistics"
+This mode displays data that's available in Percona's enhanced version of MySQL
+(also known as Percona Server with XtraDB). Specifically, it makes it easy to
+enable and disable the so-called \*(L"user statistics.\*(R" This feature gathers stats
+on clients, threads, users, tables, and indexes and makes them available as
+\&\s-1INFORMATION_SCHEMA\s0 tables. These are invaluable for understanding what your
+server is doing. They are also available in MariaDB.
+.Sp
+The statistics supported so far are only from the \s-1TABLE_STATISTICS\s0 and
+\&\s-1INDEX_STATISTICS\s0 tables added by Percona. There are three views: one of table stats,
+one of index stats (which can be aggregated with the = key), and one of both.
+.Sp
+The server doesn't gather these stats by default. You have to set the variable
+userstat_running to turn it on. You can do this easily with innotop from U mode,
+with the 's' key.
.IP "Q: Query List" 4
.IX Item "Q: Query List"
-This mode displays the output from \s-1SHOW\s0 \s-1FULL\s0 \s-1PROCESSLIST\s0, much like \fBmytop\fR's
+This mode displays the output from \s-1SHOW FULL PROCESSLIST,\s0 much like \fBmytop\fR's
query list mode. This mode does \fBnot\fR show InnoDB-related information. This
is probably one of the most useful modes for general usage.
.Sp
@@ -447,8 +488,8 @@ innotop hides inactive processes and its own process. You can toggle these on
and off with the 'i' and 'a' keys.
.Sp
You can \s-1EXPLAIN\s0 a query from this mode with the 'e' key. This displays the
-query's full text, the results of \s-1EXPLAIN\s0, and in newer MySQL versions, even
-the optimized query resulting from \s-1EXPLAIN\s0 \s-1EXTENDED\s0. innotop also tries to
+query's full text, the results of \s-1EXPLAIN,\s0 and in newer MySQL versions, even
+the optimized query resulting from \s-1EXPLAIN EXTENDED. \s0 innotop also tries to
rewrite certain queries to make them EXPLAIN-able. For example, \s-1INSERT/SELECT\s0
statements are rewritable.
.Sp
@@ -503,7 +544,7 @@ depends on the mode you're in, and what servers you're monitoring. The first
few words are always [\s-1RO\s0] (if readonly is set to 1), the innotop mode, such as
\&\*(L"InnoDB Txns\*(R" for T mode, followed by a reminder to press '?' for help at any
time.
-.SS "\s-1ONE\s0 \s-1SERVER\s0"
+.SS "\s-1ONE SERVER\s0"
.IX Subsection "ONE SERVER"
The simplest case is when you're monitoring a single server. In this case, the
name of the connection is next on the status line. This is the name you gave
@@ -511,9 +552,9 @@ when you created the connection \*(-- most likely the MySQL server's hostname.
This is followed by the server's uptime.
.PP
If you're in an InnoDB mode, such as T or B, the next word is \*(L"InnoDB\*(R" followed
-by some information about the \s-1SHOW\s0 \s-1INNODB\s0 \s-1STATUS\s0 output used to render the
-screen. The first word is the number of seconds since the last \s-1SHOW\s0 \s-1INNODB\s0
-\&\s-1STATUS\s0, which InnoDB uses to calculate some per-second statistics. The next is
+by some information about the \s-1SHOW INNODB STATUS\s0 output used to render the
+screen. The first word is the number of seconds since the last \s-1SHOW INNODB
+STATUS,\s0 which InnoDB uses to calculate some per-second statistics. The next is
a smiley face indicating whether the InnoDB output is truncated. If the smiley
face is a :\-), all is well; there is no truncation. A :^| means the transaction
list is so long, InnoDB has only printed out some of the transactions. Finally,
@@ -523,21 +564,21 @@ printing too much lock information (see \*(L"D: InnoDB Deadlocks\*(R").
The next two words indicate the server's queries per second (\s-1QPS\s0) and how many
threads (connections) exist. Finally, the server's version number is the last
thing on the line.
-.SS "\s-1MULTIPLE\s0 \s-1SERVERS\s0"
+.SS "\s-1MULTIPLE SERVERS\s0"
.IX Subsection "MULTIPLE SERVERS"
-If you are monitoring multiple servers (see \*(L"\s-1SERVER\s0 \s-1CONNECTIONS\s0\*(R"), the status
+If you are monitoring multiple servers (see \*(L"\s-1SERVER CONNECTIONS\*(R"\s0), the status
line does not show any details about individual servers. Instead, it shows the
names of the connections that are active. Again, these are connection names you
specified, which are likely to be the server's hostname. A connection that has
an error is prefixed with an exclamation point.
.PP
-If you are monitoring a group of servers (see \*(L"\s-1SERVER\s0 \s-1GROUPS\s0\*(R"), the status
+If you are monitoring a group of servers (see \*(L"\s-1SERVER GROUPS\*(R"\s0), the status
line shows the name of the group. If any connection in the group has an
error, the group's name is followed by the fraction of the connections that
don't have errors.
.PP
-See \*(L"\s-1ERROR\s0 \s-1HANDLING\s0\*(R" for more details about innotop's error handling.
-.SS "\s-1MONITORING\s0 A \s-1FILE\s0"
+See \*(L"\s-1ERROR HANDLING\*(R"\s0 for more details about innotop's error handling.
+.SS "\s-1MONITORING A FILE\s0"
.IX Subsection "MONITORING A FILE"
If you give a filename on the command line, innotop will not connect to \s-1ANY\s0
servers at all. It will watch the specified file for InnoDB status output and
@@ -553,7 +594,7 @@ commands are killing queries and stopping or starting slaves.
.PP
You can kill a connection, or in newer versions of MySQL kill a query but not a
connection, from \*(L"Q: Query List\*(R" and \*(L"T: InnoDB Transactions\*(R" modes.
-Press 'k' to issue a \s-1KILL\s0 command, or 'x' to issue a \s-1KILL\s0 \s-1QUERY\s0 command.
+Press 'k' to issue a \s-1KILL\s0 command, or 'x' to issue a \s-1KILL QUERY\s0 command.
innotop will prompt you for the server and/or connection \s-1ID\s0 to kill (innotop
does not prompt you if there is only one possible choice for any input).
innotop pre-selects the longest-running query, or the oldest connection.
@@ -561,17 +602,20 @@ Confirm the command with 'y'.
.PP
In \*(L"Slave Replication Status\*(R"\*(L" in \*(R"M: Master mode, you can start and stop slaves
with the 'a' and 'o' keys, respectively. You can send these commands to many
-slaves at once. innotop fills in a default command of \s-1START\s0 \s-1SLAVE\s0 or \s-1STOP\s0 \s-1SLAVE\s0
+slaves at once. innotop fills in a default command of \s-1START SLAVE\s0 or \s-1STOP SLAVE\s0
for you, but you can actually edit the command and send anything you wish, such
-as \s-1SET\s0 \s-1GLOBAL\s0 SQL_SLAVE_SKIP_COUNTER=1 to make the slave skip one binlog event
+as \s-1SET GLOBAL\s0 SQL_SLAVE_SKIP_COUNTER=1 to make the slave skip one binlog event
when it starts.
.PP
You can also ask innotop to calculate the earliest binlog in use by any slave
-and issue a \s-1PURGE\s0 \s-1MASTER\s0 \s-1LOGS\s0 on the master. Use the 'b' key for this. innotop
+and issue a \s-1PURGE MASTER LOGS\s0 on the master. Use the 'b' key for this. innotop
will prompt you for a master to run the command on, then prompt you for the
connection names of that master's slaves (there is no way for innotop to
determine this reliably itself). innotop will find the minimum binlog in use by
-these slave connections and suggest it as the argument to \s-1PURGE\s0 \s-1MASTER\s0 \s-1LOGS\s0.
+these slave connections and suggest it as the argument to \s-1PURGE MASTER LOGS.\s0
+.PP
+in \*(L"U: User Statistics\*(R" mode, you can use the 's' key to start and stop
+the collection of the statistics data for \s-1TABLE_STATISTICS\s0 and similar.
.SH "SERVER CONNECTIONS"
.IX Header "SERVER CONNECTIONS"
When you create a server connection using '@', innotop asks you for a series of
@@ -587,7 +631,7 @@ module for connecting to a server. It is usually of the form
.Sp
Since this \s-1DSN\s0 is passed to the DBD::mysql driver, you should read the driver's
documentation at \*(L"/search.cpan.org/dist/DBD\-mysql/lib/DBD/mysql.pm\*(R"\*(L" in \*(R"http: for
-the exact details on all the options you can pass the driver in the \s-1DSN\s0. You
+the exact details on all the options you can pass the driver in the \s-1DSN. \s0 You
can read more about \s-1DBI\s0 at <http://dbi.perl.org/docs/>, and especially at
<http://search.cpan.org/~timb/DBI/DBI.pm>.
.Sp
@@ -620,7 +664,7 @@ not encrypted in any way.
Once you finish answering these questions, you should be connected to a server.
But innotop isn't limited to monitoring a single server; you can define many
server connections and switch between them by pressing the '@' key. See
-\&\*(L"\s-1SWITCHING\s0 \s-1BETWEEN\s0 \s-1CONNECTIONS\s0\*(R".
+\&\*(L"\s-1SWITCHING BETWEEN CONNECTIONS\*(R"\s0.
.SH "SERVER GROUPS"
.IX Header "SERVER GROUPS"
If you have multiple MySQL instances, you can put them into named groups, such
@@ -640,7 +684,7 @@ want to use. This setting is per-mode, so you can monitor different connections
in each mode, and innotop remembers which connections you choose.
.PP
You can quickly switch to the 'next' connection in alphabetical order with the
-\&'n' key. If you're monitoring a server group (see \*(L"\s-1SERVER\s0 \s-1GROUPS\s0\*(R") this will
+\&'n' key. If you're monitoring a server group (see \*(L"\s-1SERVER GROUPS\*(R"\s0) this will
switch to the first connection.
.PP
You can also type many connection names, and innotop will fetch and display data
@@ -658,7 +702,7 @@ monitoring a large group or many connections, you may notice increased delay
between ticks.
.PP
When you monitor more than one connection, innotop's status bar changes. See
-\&\*(L"\s-1INNOTOP\s0 \s-1STATUS\s0\*(R".
+\&\*(L"\s-1INNOTOP STATUS\*(R"\s0.
.SH "ERROR HANDLING"
.IX Header "ERROR HANDLING"
Error handling is not that important when monitoring a single connection, but is
@@ -711,7 +755,7 @@ tick, so innotop may appear to hang.
.IP "\(bu" 4
innotop only displays the first table in each mode. This is so the output can
be easily processed with other command-line utilities such as awk and sed. To
-change which tables display in each mode, see \*(L"\s-1TABLES\s0\*(R". Since \*(L"Q: Query
+change which tables display in each mode, see \*(L"\s-1TABLES\*(R"\s0. Since \*(L"Q: Query
List\*(R" mode is so important, innotop automatically disables the \*(L"q_header\*(R"
table. This ensures you'll see the \*(L"processlist\*(R" table, even if you have
innotop configured to show the q_header table during interactive operation.
@@ -730,7 +774,7 @@ output.
innotop does not honor the \*(L"shorten\*(R" transformation, which normally shortens
some numbers to human-readable formats.
.IP "\(bu" 4
-innotop does not print a status line (see \*(L"\s-1INNOTOP\s0 \s-1STATUS\s0\*(R").
+innotop does not print a status line (see \*(L"\s-1INNOTOP STATUS\*(R"\s0).
.SH "CONFIGURING"
.IX Header "CONFIGURING"
Nearly everything about innotop is configurable. Most things are possible to
@@ -741,17 +785,17 @@ dialog. Press another key to select the type of data you want to edit:
.IP "S: Statement Sleep Times" 4
.IX Item "S: Statement Sleep Times"
Edits \s-1SQL\s0 statement sleep delays, which make innotop pause for the specified
-amount of time after executing a statement. See \*(L"\s-1SQL\s0 \s-1STATEMENTS\s0\*(R" for a
+amount of time after executing a statement. See \*(L"\s-1SQL STATEMENTS\*(R"\s0 for a
definition of each statement and what it does. By default innotop does not
delay after any statements.
.Sp
This feature is included so you can customize the side-effects caused by
monitoring your server. You may not see any effects, but some innotop users
have noticed that certain MySQL versions under very high load with InnoDB
-enabled take longer than usual to execute \s-1SHOW\s0 \s-1GLOBAL\s0 \s-1STATUS\s0. If innotop calls
-\&\s-1SHOW\s0 \s-1FULL\s0 \s-1PROCESSLIST\s0 immediately afterward, the processlist contains more
+enabled take longer than usual to execute \s-1SHOW GLOBAL STATUS. \s0 If innotop calls
+\&\s-1SHOW FULL PROCESSLIST\s0 immediately afterward, the processlist contains more
queries than the machine actually averages at any given moment. Configuring
-innotop to pause briefly after calling \s-1SHOW\s0 \s-1GLOBAL\s0 \s-1STATUS\s0 alleviates this
+innotop to pause briefly after calling \s-1SHOW GLOBAL STATUS\s0 alleviates this
effect.
.Sp
Sleep times are stored in the \*(L"stmt_sleep_times\*(R" section of the configuration
@@ -759,28 +803,28 @@ file. Fractional-second sleeps are supported, subject to your hardware's
limitations.
.IP "c: Edit Columns" 4
.IX Item "c: Edit Columns"
-Starts the table editor on one of the displayed tables. See \*(L"\s-1TABLE\s0 \s-1EDITOR\s0\*(R".
+Starts the table editor on one of the displayed tables. See \*(L"\s-1TABLE EDITOR\*(R"\s0.
An alternative way to start the table editor without entering the configuration
dialog is with the '^' key.
.IP "g: General Configuration" 4
.IX Item "g: General Configuration"
Starts the configuration editor to edit global and mode-specific configuration
-variables (see \*(L"\s-1MODES\s0\*(R"). innotop prompts you to choose a variable from among
+variables (see \*(L"\s-1MODES\*(R"\s0). innotop prompts you to choose a variable from among
the global and mode-specific ones depending on the current mode.
.IP "k: Row-Coloring Rules" 4
.IX Item "k: Row-Coloring Rules"
Starts the row-coloring rules editor on one of the displayed table(s). See
-\&\*(L"\s-1COLORS\s0\*(R" for details.
+\&\*(L"\s-1COLORS\*(R"\s0 for details.
.IP "p: Manage Plugins" 4
.IX Item "p: Manage Plugins"
-Starts the plugin configuration editor. See \*(L"\s-1PLUGINS\s0\*(R" for details.
+Starts the plugin configuration editor. See \*(L"\s-1PLUGINS\*(R"\s0 for details.
.IP "s: Server Groups" 4
.IX Item "s: Server Groups"
-Lets you create and edit server groups. See \*(L"\s-1SERVER\s0 \s-1GROUPS\s0\*(R".
+Lets you create and edit server groups. See \*(L"\s-1SERVER GROUPS\*(R"\s0.
.IP "t: Choose Displayed Tables" 4
.IX Item "t: Choose Displayed Tables"
-Lets you choose which tables to display in this mode. See \*(L"\s-1MODES\s0\*(R" and
-\&\*(L"\s-1TABLES\s0\*(R".
+Lets you choose which tables to display in this mode. See \*(L"\s-1MODES\*(R"\s0 and
+\&\*(L"\s-1TABLES\*(R"\s0.
.SH "CONFIGURATION FILE"
.IX Header "CONFIGURATION FILE"
innotop's default configuration file locations are \f(CW$HOME\fR/.innotop and
@@ -829,7 +873,7 @@ graphed; if s, values are like vmstat; if p, values are in a pivoted table.
.IP "S_set" 4
.IX Item "S_set"
Specifies which set of variables to display in \*(L"S: Variables & Status\*(R" mode.
-See \*(L"\s-1VARIABLE\s0 \s-1SETS\s0\*(R".
+See \*(L"\s-1VARIABLE SETS\*(R"\s0.
.IP "auto_wipe_dl" 4
.IX Item "auto_wipe_dl"
Instructs innotop to automatically wipe large deadlocks when it notices them.
@@ -866,7 +910,7 @@ crash.
.IP "debugfile" 4
.IX Item "debugfile"
A file to which innotop will write information when there is a crash. See
-\&\*(L"\s-1FILES\s0\*(R".
+\&\*(L"\s-1FILES\*(R"\s0.
.IP "display_table_captions" 4
.IX Item "display_table_captions"
innotop displays a table caption above most tables. This variable suppresses or
@@ -875,7 +919,7 @@ hide_caption property, which overrides this.
.IP "global" 4
.IX Item "global"
Whether to show \s-1GLOBAL\s0 variables and status. innotop only tries to do this on
-servers which support the \s-1GLOBAL\s0 option to \s-1SHOW\s0 \s-1VARIABLES\s0 and \s-1SHOW\s0 \s-1STATUS\s0. In
+servers which support the \s-1GLOBAL\s0 option to \s-1SHOW VARIABLES\s0 and \s-1SHOW STATUS. \s0 In
some MySQL versions, you need certain privileges to do this; if you don't have
them, innotop will not be able to fetch any variable and status data. This
configuration variable lets you run innotop and fetch what data you can even
@@ -904,7 +948,7 @@ This variable accepts fractions of a second.
.IP "mode" 4
.IX Item "mode"
The mode in which innotop should start. Allowable arguments are the same as the
-key presses that select a mode interactively. See \*(L"\s-1MODES\s0\*(R".
+key presses that select a mode interactively. See \*(L"\s-1MODES\*(R"\s0.
.IP "num_digits" 4
.IX Item "num_digits"
How many digits to show in fractional numbers and percents. This variable's
@@ -926,24 +970,28 @@ Specifies where plugins can be found. By default, innotop stores plugins in the
Whether the configuration file is readonly. This cannot be set interactively.
.IP "show_cxn_errors" 4
.IX Item "show_cxn_errors"
-Makes innotop print connection errors to \s-1STDOUT\s0. See \*(L"\s-1ERROR\s0 \s-1HANDLING\s0\*(R".
+Makes innotop print connection errors to \s-1STDOUT. \s0 See \*(L"\s-1ERROR HANDLING\*(R"\s0.
.IP "show_cxn_errors_in_tbl" 4
.IX Item "show_cxn_errors_in_tbl"
Makes innotop display connection errors as rows in the first table on screen.
-See \*(L"\s-1ERROR\s0 \s-1HANDLING\s0\*(R".
+See \*(L"\s-1ERROR HANDLING\*(R"\s0.
.IP "show_percent" 4
.IX Item "show_percent"
Adds a '%' character after the value returned by the \*(L"percent\*(R"
transformation.
.IP "show_statusbar" 4
.IX Item "show_statusbar"
-Controls whether to show the status bar in the display. See \*(L"\s-1INNOTOP\s0
-\&\s-1STATUS\s0\*(R".
+Controls whether to show the status bar in the display. See \*(L"\s-1INNOTOP
+STATUS\*(R"\s0.
.IP "skip_innodb" 4
.IX Item "skip_innodb"
-Disables fetching \s-1SHOW\s0 \s-1INNODB\s0 \s-1STATUS\s0, in case your server(s) do not have InnoDB
+Disables fetching \s-1SHOW INNODB STATUS,\s0 in case your server(s) do not have InnoDB
enabled and you don't want innotop to try to fetch it. This can also be useful
-when you don't have the \s-1SUPER\s0 privilege, required to run \s-1SHOW\s0 \s-1INNODB\s0 \s-1STATUS\s0.
+when you don't have the \s-1SUPER\s0 privilege, required to run \s-1SHOW INNODB STATUS.\s0
+.IP "spark" 4
+.IX Item "spark"
+Specifies how wide a spark chart is. There are two \s-1ASCII\s0 spark charts in A
+mode, showing \s-1QPS\s0 and User_threads_running.
.IP "status_inc" 4
.IX Item "status_inc"
Whether to show absolute or incremental values for status variables.
@@ -951,16 +999,20 @@ Incremental values are calculated as an offset from the last value innotop saw
for that variable. This is a global setting, but will probably become
mode-specific at some point. Right now it is honored a bit inconsistently; some
modes don't pay attention to it.
+.IP "timeformat" 4
+.IX Item "timeformat"
+The C\-style \fIstrftime()\fR\-compatible format for the timestamp line to be printed
+in \-n mode when \-t is set.
.RE
.RS 4
.RE
.IP "plugins" 4
.IX Item "plugins"
This section holds a list of package names of active plugins. If the plugin
-exists, innotop will activate it. See \*(L"\s-1PLUGINS\s0\*(R" for more information.
+exists, innotop will activate it. See \*(L"\s-1PLUGINS\*(R"\s0 for more information.
.IP "filters" 4
.IX Item "filters"
-This section holds user-defined filters (see \*(L"\s-1FILTERS\s0\*(R"). Each line is in the
+This section holds user-defined filters (see \*(L"\s-1FILTERS\*(R"\s0). Each line is in the
format filter_name=text='filter text' tbls='table list'.
.Sp
The filter text is the text of the subroutine's code. The table list is a list
@@ -973,7 +1025,7 @@ This section stores which filters are active on each table. Each line is in the
format table_name=filter_list.
.IP "tbl_meta" 4
.IX Item "tbl_meta"
-This section stores user-defined or user-customized columns (see \*(L"\s-1COLUMNS\s0\*(R").
+This section stores user-defined or user-customized columns (see \*(L"\s-1COLUMNS\*(R"\s0).
Each line is in the format col_name=properties, where the properties are a
name=quoted\-value list.
.IP "connections" 4
@@ -982,8 +1034,8 @@ This section holds the server connections you have defined. Each line is in
the format name=properties, where the properties are a name=value list. The
properties are self-explanatory, and the only one that is treated specially is
\&'pass' which is only present if 'savepass' is set. This section of the
-configuration file will be skipped if any \s-1DSN\s0, username, or password
-command-line options are used. See \*(L"\s-1SERVER\s0 \s-1CONNECTIONS\s0\*(R".
+configuration file will be skipped if any \s-1DSN,\s0 username, or password
+command-line options are used. See \*(L"\s-1SERVER CONNECTIONS\*(R"\s0.
.IP "active_connections" 4
.IX Item "active_connections"
This section holds a list of which connections are active in each mode. Each
@@ -991,7 +1043,7 @@ line is in the format mode_name=connection_list.
.IP "server_groups" 4
.IX Item "server_groups"
This section holds server groups. Each line is in the format
-name=connection_list. See \*(L"\s-1SERVER\s0 \s-1GROUPS\s0\*(R".
+name=connection_list. See \*(L"\s-1SERVER GROUPS\*(R"\s0.
.IP "active_server_groups" 4
.IX Item "active_server_groups"
This section holds a list of which server group is active in each mode. Each
@@ -1004,24 +1056,24 @@ name=value.
.IP "active_columns" 4
.IX Item "active_columns"
This section holds table column lists. Each line is in the format
-tbl_name=column_list. See \*(L"\s-1COLUMNS\s0\*(R".
+tbl_name=column_list. See \*(L"\s-1COLUMNS\*(R"\s0.
.IP "sort_cols" 4
.IX Item "sort_cols"
This section holds the sort definition. Each line is in the format
tbl_name=column_list. If a column is prefixed with '\-', that column sorts
-descending. See \*(L"\s-1SORTING\s0\*(R".
+descending. See \*(L"\s-1SORTING\*(R"\s0.
.IP "visible_tables" 4
.IX Item "visible_tables"
This section defines which tables are visible in each mode. Each line is in the
-format mode_name=table_list. See \*(L"\s-1TABLES\s0\*(R".
+format mode_name=table_list. See \*(L"\s-1TABLES\*(R"\s0.
.IP "varsets" 4
.IX Item "varsets"
This section defines variable sets for use in \*(L"S: Status & Variables\*(R" mode.
-Each line is in the format name=variable_list. See \*(L"\s-1VARIABLE\s0 \s-1SETS\s0\*(R".
+Each line is in the format name=variable_list. See \*(L"\s-1VARIABLE SETS\*(R"\s0.
.IP "colors" 4
.IX Item "colors"
This section defines colorization rules. Each line is in the format
-tbl_name=property_list. See \*(L"\s-1COLORS\s0\*(R".
+tbl_name=property_list. See \*(L"\s-1COLORS\*(R"\s0.
.IP "stmt_sleep_times" 4
.IX Item "stmt_sleep_times"
This section contains statement sleep times. Each line is in the format
@@ -1029,7 +1081,7 @@ statement_name=sleep_time. See \*(L"S: Statement Sleep Times\*(R".
.IP "group_by" 4
.IX Item "group_by"
This section contains column lists for table group_by expressions. Each line is
-in the format tbl_name=column_list. See \*(L"\s-1GROUPING\s0\*(R".
+in the format tbl_name=column_list. See \*(L"\s-1GROUPING\*(R"\s0.
.SH "CUSTOMIZING"
.IX Header "CUSTOMIZING"
You can customize innotop a great deal. For example, you can:
@@ -1065,10 +1117,10 @@ instructions to innotop. The meta-data includes the caption, a list of columns
the user has customized, a list of columns, a list of visible columns, a list of
filters, color rules, a sort-column list, sort direction, and some information
about the table's data sources. Most of this is customizable via the table
-editor (see \*(L"\s-1TABLE\s0 \s-1EDITOR\s0\*(R").
+editor (see \*(L"\s-1TABLE EDITOR\*(R"\s0).
.PP
-You can choose which tables to show by pressing the '$' key. See \*(L"\s-1MODES\s0\*(R" and
-\&\*(L"\s-1TABLES\s0\*(R".
+You can choose which tables to show by pressing the '$' key. See \*(L"\s-1MODES\*(R"\s0 and
+\&\*(L"\s-1TABLES\*(R"\s0.
.PP
The table life-cycle is as follows:
.IP "\(bu" 4
@@ -1081,21 +1133,21 @@ For each element in the data source, innotop extracts values from the source and
creates a row. This row is another hash, which later steps will refer to as
\&\f(CW$set\fR. The values innotop extracts are determined by the table's columns. Each
column has an extraction subroutine, compiled from an expression (see
-\&\*(L"\s-1EXPRESSIONS\s0\*(R"). The resulting row is a hash whose keys are named the same as
+\&\*(L"\s-1EXPRESSIONS\*(R"\s0). The resulting row is a hash whose keys are named the same as
the column name.
.IP "\(bu" 4
innotop filters the rows, removing those that don't need to be displayed. See
-\&\*(L"\s-1FILTERS\s0\*(R".
+\&\*(L"\s-1FILTERS\*(R"\s0.
.IP "\(bu" 4
-innotop sorts the rows. See \*(L"\s-1SORTING\s0\*(R".
+innotop sorts the rows. See \*(L"\s-1SORTING\*(R"\s0.
.IP "\(bu" 4
-innotop groups the rows together, if specified. See \*(L"\s-1GROUPING\s0\*(R".
+innotop groups the rows together, if specified. See \*(L"\s-1GROUPING\*(R"\s0.
.IP "\(bu" 4
-innotop colorizes the rows. See \*(L"\s-1COLORS\s0\*(R".
+innotop colorizes the rows. See \*(L"\s-1COLORS\*(R"\s0.
.IP "\(bu" 4
-innotop transforms the column values in each row. See \*(L"\s-1TRANSFORMATIONS\s0\*(R".
+innotop transforms the column values in each row. See \*(L"\s-1TRANSFORMATIONS\*(R"\s0.
.IP "\(bu" 4
-innotop optionally pivots the rows (see \*(L"\s-1PIVOTING\s0\*(R"), then filters and sorts
+innotop optionally pivots the rows (see \*(L"\s-1PIVOTING\*(R"\s0), then filters and sorts
them.
.IP "\(bu" 4
innotop formats and justifies the rows as a table. During this step, innotop
@@ -1108,7 +1160,7 @@ The lifecycle is slightly different if the table is pivoted, as noted above. To
clarify, if the table is pivoted, the process is extract, group, transform,
pivot, filter, sort, create. If it's not pivoted, the process is extract,
filter, sort, group, color, transform, create. This slightly convoluted process
-doesn't map all that well to \s-1SQL\s0, but pivoting complicates things pretty
+doesn't map all that well to \s-1SQL,\s0 but pivoting complicates things pretty
thoroughly. Roughly speaking, filtering and sorting happen as late as needed to
effect the final result as you might expect, but as early as possible for
efficiency.
@@ -1117,99 +1169,119 @@ Each built-in table is described below:
.IP "adaptive_hash_index" 4
.IX Item "adaptive_hash_index"
Displays data about InnoDB's adaptive hash index. Data source:
-\&\*(L"\s-1STATUS_VARIABLES\s0\*(R".
+\&\*(L"\s-1STATUS_VARIABLES\*(R"\s0.
.IP "buffer_pool" 4
.IX Item "buffer_pool"
-Displays data about InnoDB's buffer pool. Data source: \*(L"\s-1STATUS_VARIABLES\s0\*(R".
+Displays data about InnoDB's buffer pool. Data source: \*(L"\s-1STATUS_VARIABLES\*(R"\s0.
.IP "cmd_summary" 4
.IX Item "cmd_summary"
-Displays weighted status variables. Data source: \*(L"\s-1STATUS_VARIABLES\s0\*(R".
+Displays weighted status variables. Data source: \*(L"\s-1STATUS_VARIABLES\*(R"\s0.
.IP "deadlock_locks" 4
.IX Item "deadlock_locks"
Shows which locks were held and waited for by the last detected deadlock. Data
-source: \*(L"\s-1DEADLOCK_LOCKS\s0\*(R".
+source: \*(L"\s-1DEADLOCK_LOCKS\*(R"\s0.
.IP "deadlock_transactions" 4
.IX Item "deadlock_transactions"
Shows transactions involved in the last detected deadlock. Data source:
-\&\*(L"\s-1DEADLOCK_TRANSACTIONS\s0\*(R".
+\&\*(L"\s-1DEADLOCK_TRANSACTIONS\*(R"\s0.
.IP "explain" 4
.IX Item "explain"
-Shows the output of \s-1EXPLAIN\s0. Data source: \*(L"\s-1EXPLAIN\s0\*(R".
+Shows the output of \s-1EXPLAIN. \s0 Data source: \*(L"\s-1EXPLAIN\*(R"\s0.
.IP "file_io_misc" 4
.IX Item "file_io_misc"
Displays data about InnoDB's file and I/O operations. Data source:
-\&\*(L"\s-1STATUS_VARIABLES\s0\*(R".
+\&\*(L"\s-1STATUS_VARIABLES\*(R"\s0.
.IP "fk_error" 4
.IX Item "fk_error"
Displays various data about InnoDB's last foreign key error. Data source:
-\&\*(L"\s-1STATUS_VARIABLES\s0\*(R".
+\&\*(L"\s-1STATUS_VARIABLES\*(R"\s0.
+.IP "health_dashboard" 4
+.IX Item "health_dashboard"
+Displays an overall summary of servers, one server per line, for monitoring.
+Data source: \*(L"\s-1STATUS_VARIABLES\*(R"\s0, \*(L"\s-1MASTER_SLAVE\*(R"\s0, \*(L"\s-1PROCESSLIST_STATS\*(R"\s0.
+.IP "index_statistics" 4
+.IX Item "index_statistics"
+Displays data from the \s-1INDEX_STATISTICS\s0 table in Percona-enhanced servers.
+.IP "index_table_statistics" 4
+.IX Item "index_table_statistics"
+Displays data from the \s-1INDEX_STATISTICS\s0 and \s-1TABLE_STATISTICS\s0 tables in
+Percona-enhanced servers. It joins the two together, grouped by the database
+and table name. It is the default view in \*(L"U: User Statistics\*(R" mode,
+and makes it easy to see what tables are hot, how many rows are read from indexes,
+how many changes are made, and how many changes are made to indexes.
+.IP "innodb_blocked_blocker" 4
+.IX Item "innodb_blocked_blocker"
+Displays InnoDB locks and lock waits. Data source: \*(L"\s-1INNODB_BLOCKED_BLOCKER\*(R"\s0.
.IP "innodb_locks" 4
.IX Item "innodb_locks"
-Displays InnoDB locks. Data source: \*(L"\s-1INNODB_LOCKS\s0\*(R".
+Displays InnoDB locks. Data source: \*(L"\s-1INNODB_LOCKS\*(R"\s0.
.IP "innodb_transactions" 4
.IX Item "innodb_transactions"
Displays data about InnoDB's current transactions. Data source:
-\&\*(L"\s-1INNODB_TRANSACTIONS\s0\*(R".
+\&\*(L"\s-1INNODB_TRANSACTIONS\*(R"\s0.
.IP "insert_buffers" 4
.IX Item "insert_buffers"
-Displays data about InnoDB's insert buffer. Data source: \*(L"\s-1STATUS_VARIABLES\s0\*(R".
+Displays data about InnoDB's insert buffer. Data source: \*(L"\s-1STATUS_VARIABLES\*(R"\s0.
.IP "io_threads" 4
.IX Item "io_threads"
-Displays data about InnoDB's I/O threads. Data source: \*(L"\s-1IO_THREADS\s0\*(R".
+Displays data about InnoDB's I/O threads. Data source: \*(L"\s-1IO_THREADS\*(R"\s0.
.IP "log_statistics" 4
.IX Item "log_statistics"
-Displays data about InnoDB's logging system. Data source: \*(L"\s-1STATUS_VARIABLES\s0\*(R".
+Displays data about InnoDB's logging system. Data source: \*(L"\s-1STATUS_VARIABLES\*(R"\s0.
.IP "master_status" 4
.IX Item "master_status"
-Displays replication master status. Data source: \*(L"\s-1STATUS_VARIABLES\s0\*(R".
+Displays replication master status. Data source: \*(L"\s-1STATUS_VARIABLES\*(R"\s0.
.IP "open_tables" 4
.IX Item "open_tables"
-Displays open tables. Data source: \*(L"\s-1OPEN_TABLES\s0\*(R".
+Displays open tables. Data source: \*(L"\s-1OPEN_TABLES\*(R"\s0.
.IP "page_statistics" 4
.IX Item "page_statistics"
-Displays InnoDB page statistics. Data source: \*(L"\s-1STATUS_VARIABLES\s0\*(R".
+Displays InnoDB page statistics. Data source: \*(L"\s-1STATUS_VARIABLES\*(R"\s0.
.IP "pending_io" 4
.IX Item "pending_io"
-Displays InnoDB pending I/O operations. Data source: \*(L"\s-1STATUS_VARIABLES\s0\*(R".
+Displays InnoDB pending I/O operations. Data source: \*(L"\s-1STATUS_VARIABLES\*(R"\s0.
.IP "processlist" 4
.IX Item "processlist"
Displays current MySQL processes (threads/connections). Data source:
-\&\*(L"\s-1PROCESSLIST\s0\*(R".
+\&\*(L"\s-1PROCESSLIST\*(R"\s0.
.IP "q_header" 4
.IX Item "q_header"
-Displays various status values. Data source: \*(L"\s-1STATUS_VARIABLES\s0\*(R".
+Displays various status values. Data source: \*(L"\s-1STATUS_VARIABLES\*(R"\s0.
.IP "row_operation_misc" 4
.IX Item "row_operation_misc"
Displays data about InnoDB's row operations. Data source:
-\&\*(L"\s-1STATUS_VARIABLES\s0\*(R".
+\&\*(L"\s-1STATUS_VARIABLES\*(R"\s0.
.IP "row_operations" 4
.IX Item "row_operations"
Displays data about InnoDB's row operations. Data source:
-\&\*(L"\s-1STATUS_VARIABLES\s0\*(R".
+\&\*(L"\s-1STATUS_VARIABLES\*(R"\s0.
.IP "semaphores" 4
.IX Item "semaphores"
Displays data about InnoDB's semaphores and mutexes. Data source:
-\&\*(L"\s-1STATUS_VARIABLES\s0\*(R".
+\&\*(L"\s-1STATUS_VARIABLES\*(R"\s0.
.IP "slave_io_status" 4
.IX Item "slave_io_status"
Displays data about the slave I/O thread. Data source:
-\&\*(L"\s-1STATUS_VARIABLES\s0\*(R".
+\&\*(L"\s-1STATUS_VARIABLES\*(R"\s0.
.IP "slave_sql_status" 4
.IX Item "slave_sql_status"
-Displays data about the slave \s-1SQL\s0 thread. Data source: \*(L"\s-1STATUS_VARIABLES\s0\*(R".
+Displays data about the slave \s-1SQL\s0 thread. Data source: \*(L"\s-1STATUS_VARIABLES\*(R"\s0.
+.IP "table_statistics" 4
+.IX Item "table_statistics"
+Displays data from the \s-1TABLE_STATISTICS\s0 table in Percona-enhanced servers.
.IP "t_header" 4
.IX Item "t_header"
-Displays various InnoDB status values. Data source: \*(L"\s-1STATUS_VARIABLES\s0\*(R".
+Displays various InnoDB status values. Data source: \*(L"\s-1STATUS_VARIABLES\*(R"\s0.
.IP "var_status" 4
.IX Item "var_status"
-Displays user-configurable data. Data source: \*(L"\s-1STATUS_VARIABLES\s0\*(R".
+Displays user-configurable data. Data source: \*(L"\s-1STATUS_VARIABLES\*(R"\s0.
.IP "wait_array" 4
.IX Item "wait_array"
-Displays data about InnoDB's \s-1OS\s0 wait array. Data source: \*(L"\s-1OS_WAIT_ARRAY\s0\*(R".
+Displays data about InnoDB's \s-1OS\s0 wait array. Data source: \*(L"\s-1OS_WAIT_ARRAY\*(R"\s0.
.SS "\s-1COLUMNS\s0"
.IX Subsection "COLUMNS"
Columns belong to tables. You can choose a table's columns by pressing the '^'
-key, which starts the \*(L"\s-1TABLE\s0 \s-1EDITOR\s0\*(R" and lets you choose and edit columns.
+key, which starts the \*(L"\s-1TABLE EDITOR\*(R"\s0 and lets you choose and edit columns.
Pressing 'e' from within the table editor lets you edit the column's properties:
.IP "\(bu" 4
hdr: a column header. This appears in the first row of the table.
@@ -1226,28 +1298,30 @@ label: a small note about the column, which appears in dialogs that help the
user choose columns.
.IP "\(bu" 4
src: an expression that innotop uses to extract the column's data from its
-source (see \*(L"\s-1DATA\s0 \s-1SOURCES\s0\*(R"). See \*(L"\s-1EXPRESSIONS\s0\*(R" for more on expressions.
+source (see \*(L"\s-1DATA SOURCES\*(R"\s0). See \*(L"\s-1EXPRESSIONS\*(R"\s0 for more on expressions.
.IP "\(bu" 4
minw: specifies a minimum display width. This helps stabilize the display,
which makes it easier to read if the data is changing frequently.
.IP "\(bu" 4
maxw: similar to minw.
.IP "\(bu" 4
-trans: a list of column transformations. See \*(L"\s-1TRANSFORMATIONS\s0\*(R".
+trans: a list of column transformations. See \*(L"\s-1TRANSFORMATIONS\*(R"\s0.
.IP "\(bu" 4
-agg: an aggregate function. See \*(L"\s-1GROUPING\s0\*(R". The default is \*(L"first\*(R".
+agg: an aggregate function. See \*(L"\s-1GROUPING\*(R"\s0. The default is \*(L"first\*(R".
.IP "\(bu" 4
aggonly: controls whether the column only shows when grouping is enabled on the
-table (see \*(L"\s-1GROUPING\s0\*(R"). By default, this is disabled. This means columns
+table (see \*(L"\s-1GROUPING\*(R"\s0). By default, this is disabled. This means columns
will always be shown by default, whether grouping is enabled or not. If a
column's aggonly is set true, the column will appear when you toggle grouping on
the table. Several columns are set this way, such as the count column on
\&\*(L"processlist\*(R" and \*(L"innodb_transactions\*(R", so you don't see a count when the
grouping isn't enabled, but you do when it is.
+.IP "\(bu" 4
+agghide: the reverse of aggonly. The column is hidden when grouping is enabled.
.SS "\s-1FILTERS\s0"
.IX Subsection "FILTERS"
Filters remove rows from the display. They behave much like a \s-1WHERE\s0 clause in
-\&\s-1SQL\s0. innotop has several built-in filters, which remove irrelevant information
+\&\s-1SQL. \s0 innotop has several built-in filters, which remove irrelevant information
like inactive queries, but you can define your own as well. innotop also lets
you create quick-filters, which do not get saved to the configuration file, and
are just an easy way to quickly view only some rows.
@@ -1297,11 +1371,30 @@ persist when you restart innotop. To create a quick-filter, press the '/' key.
innotop will prompt you for the column name and filter text. Again, you can use
auto-completion on column names. The filter text can be just the text you want
to \*(L"search for.\*(R" For example, to filter the \*(L"processlist\*(R" table on queries
-that refer to the products table, type '/' and then 'info product'.
+that refer to the products table, type '/' and then 'info product'. Internally,
+the filter is compiled into a subroutine like this:
+.PP
+.Vb 4
+\& sub filter {
+\& my ( $set ) = @_;
+\& $set\->{info} =~ m/product/;
+\& }
+.Ve
.PP
The filter text can actually be any Perl regular expression, but of course a
literal string like 'product' works fine as a regular expression.
.PP
+What if you want the filter to discard matching rows, rather than showing
+matching rows? If you're familiar with Perl regular expressions, you might
+guess how to do this. You have to use a zero-width negative lookahead
+assertion. If you don't know what that means, don't worry. Let's filter out
+all rows where the command is Gandalf. Type the following:
+.PP
+.Vb 2
+\& 1. /
+\& 2. cmd ^(?!Gandalf)
+.Ve
+.PP
Behind the scenes innotop compiles the quick-filter into a specially tagged
filter that is otherwise like any other filter. It just isn't saved to the
configuration file.
@@ -1314,7 +1407,7 @@ innotop has sensible built-in defaults to sort the most important rows to the
top of the table. Like anything else in innotop, you can customize how any
table is sorted.
.PP
-To start the sort dialog, start the \*(L"\s-1TABLE\s0 \s-1EDITOR\s0\*(R" with the '^' key, choose a
+To start the sort dialog, start the \*(L"\s-1TABLE EDITOR\*(R"\s0 with the '^' key, choose a
table if necessary, and press the 's' key. You'll see a list of columns you can
use in the sort expression and the current sort expression, if any. Enter a
list of columns by which you want to sort and press Enter. If you want to
@@ -1328,9 +1421,9 @@ sort direction. Press '?' as usual to see which keys are mapped in any mode.
.SS "\s-1GROUPING\s0"
.IX Subsection "GROUPING"
innotop can group, or aggregate, rows together (the terms are used
-interchangeably). This is quite similar to an \s-1SQL\s0 \s-1GROUP\s0 \s-1BY\s0 clause. You can
+interchangeably). This is quite similar to an \s-1SQL GROUP BY\s0 clause. You can
specify to group on certain columns, or if you don't specify any, the entire set
-of rows is treated as one group. This is quite like \s-1SQL\s0 so far, but unlike \s-1SQL\s0,
+of rows is treated as one group. This is quite like \s-1SQL\s0 so far, but unlike \s-1SQL,\s0
you can also select un-grouped columns. innotop actually aggregates every
column. If you don't explicitly specify a grouping function, the default is
\&'first'. This is basically a convenience so you don't have to specify an
@@ -1391,8 +1484,8 @@ That's actually quite a worrisome picture. You've got a lot of idle connections
(Sleep), and some connections executing queries (Query and Sending Data).
That's okay, but you also have a lot in Statistics status, collectively spending
over a minute. That means the query optimizer is having a really hard time
-optimizing your statements. Something is wrong; it should normally take
-milliseconds to optimize queries. You might not have seen this pattern if you
+generating execution plans for your statements. Something is wrong; it should
+normally take milliseconds to plan queries. You might not have seen this pattern if you
didn't look at your connections in aggregate. (This is a made-up example, but
it can happen in real life).
.SS "\s-1PIVOTING\s0"
@@ -1467,7 +1560,7 @@ quoted something.
.IX Subsection "EXPRESSIONS"
Expressions are at the core of how innotop works, and are what enables you to
extend innotop as you wish. Recall the table lifecycle explained in
-\&\*(L"\s-1TABLES\s0\*(R". Expressions are used in the earliest step, where it extracts
+\&\*(L"\s-1TABLES\*(R"\s0. Expressions are used in the earliest step, where it extracts
values from a data source to form rows.
.PP
It does this by calling a subroutine for each column, passing it the source data
@@ -1500,7 +1593,7 @@ subroutine, like this:
.PP
Here's a concrete example, taken from the header table \*(L"q_header\*(R" in \*(L"Q:
Query List\*(R" mode. This expression calculates the qps, or Queries Per Second,
-column's values, from the values returned by \s-1SHOW\s0 \s-1STATUS:\s0
+column's values, from the values returned by \s-1SHOW STATUS:\s0
.PP
.Vb 1
\& Questions/Uptime_hires
@@ -1532,11 +1625,17 @@ are defined:
.IP "commify" 4
.IX Item "commify"
Adds commas to large numbers every three decimal places.
+.IP "distill" 4
+.IX Item "distill"
+Distills \s-1SQL\s0 into verb-noun-noun format for quick comprehension.
.IP "dulint_to_int" 4
.IX Item "dulint_to_int"
Accepts two unsigned integers and converts them into a single longlong. This is
useful for certain operations with InnoDB, which uses two integers as
transaction identifiers, for example.
+.IP "fuzzy_time" 4
+.IX Item "fuzzy_time"
+Converts a number of seconds into a friendly, readable value like \*(L"1h35m\*(R".
.IP "no_ctrl_char" 4
.IX Item "no_ctrl_char"
Removes quoted control characters from the value. This is affected by the
@@ -1561,7 +1660,7 @@ Formats numbers with \*(L"num_digits\*(R" number of digits after the decimal poi
.IX Item "shorten"
Formats a number as a unit of 1024 (k/M/G/T) and with \*(L"num_digits\*(R" number of
digits after the decimal point.
-.SS "\s-1TABLE\s0 \s-1EDITOR\s0"
+.SS "\s-1TABLE EDITOR\s0"
.IX Subsection "TABLE EDITOR"
The innotop table editor lets you customize tables with keystrokes. You start
the table editor with the '^' key. If there's more than one table on the
@@ -1579,7 +1678,7 @@ show you something like this:
\& pages_modified Dirty Pages Pages modified (dirty IB_bp_pages_m
\& buf_pool_hit_rate Hit Rate Buffer pool hit rate IB_bp_buf_poo
\& total_mem_alloc Memory Total memory allocate IB_bp_total_m
-\& add_pool_alloc Add\*(Aql Pool Additional pool alloca IB_bp_add_poo
+\& add_pool_alloc Add\*(Aql Pool Additonal pool alloca IB_bp_add_poo
.Ve
.PP
The first line shows which table you're editing, and reminds you again to press
@@ -1590,7 +1689,7 @@ editor, color rule editor, and more.
.PP
Each row in the display shows a single column in the table you're editing, along
with a couple of its properties such as its header and source expression (see
-\&\*(L"\s-1EXPRESSIONS\s0\*(R").
+\&\*(L"\s-1EXPRESSIONS\*(R"\s0).
.PP
The key mappings are Vim-style, as in many other places. Pressing 'j' and 'k'
moves the highlight up or down. You can then (d)elete or (e)dit the highlighted
@@ -1615,9 +1714,9 @@ the table header. This can have spaces and funny characters, but be careful not
to make it too wide and waste space on-screen.
.IP "\(bu" 4
The column's data source: this is an expression that determines what data from
-the source (see \*(L"\s-1TABLES\s0\*(R") innotop will put into the column. This can just be
+the source (see \*(L"\s-1TABLES\*(R"\s0) innotop will put into the column. This can just be
the name of an item in the source, or it can be a more complex expression, as
-described in \*(L"\s-1EXPRESSIONS\s0\*(R".
+described in \*(L"\s-1EXPRESSIONS\*(R"\s0.
.PP
Once you've entered the required data, your table has a new column. There is no
difference between this column and the built-in ones; it can have all the same
@@ -1645,10 +1744,10 @@ what variables you want to monitor. Behind the scenes they are compiled to a
list of expressions, and then into a column list so they can be treated just
like columns in any other table, in terms of data extraction and
transformations. However, you're protected from the tedious details by a syntax
-that ought to feel very natural to you: a \s-1SQL\s0 \s-1SELECT\s0 list.
+that ought to feel very natural to you: a \s-1SQL SELECT\s0 list.
.PP
The data source for variable sets, and indeed the entire S mode, is the
-combination of \s-1SHOW\s0 \s-1STATUS\s0, \s-1SHOW\s0 \s-1VARIABLES\s0, and \s-1SHOW\s0 \s-1INNODB\s0 \s-1STATUS\s0. Imagine
+combination of \s-1SHOW STATUS, SHOW VARIABLES,\s0 and \s-1SHOW INNODB STATUS. \s0 Imagine
that you had a huge table with one column per variable returned from those
statements. That's the data source for variable sets. You can now query this
data source just like you'd expect. For example:
@@ -1669,7 +1768,7 @@ start for creating your own. Press 'e' to edit the current variable set, or
just to see how it's defined. To create a new one, just press 'c' and type its
name.
.PP
-You may want to use some of the functions listed in \*(L"\s-1TRANSFORMATIONS\s0\*(R" to help
+You may want to use some of the functions listed in \*(L"\s-1TRANSFORMATIONS\*(R"\s0 to help
format the results. In particular, \*(L"set_precision\*(R" is often useful to limit
the number of digits you see. Extending the above example, here's how:
.PP
@@ -1694,9 +1793,9 @@ or modify its existing functionality, and add new functionality. innotop's
plugin functionality is event-based: plugins register themselves to be called
when events happen. They then have a chance to influence the event.
.PP
-An innotop plugin is a Perl module placed in innotop's \*(L"plugin_dir\*(R"
+An innotop plugin is a Perl module (.pm) file placed in innotop's \*(L"plugin_dir\*(R"
directory. On \s-1UNIX\s0 systems, you can place a symbolic link to the module instead
-of putting the actual file there. innotop automatically discovers the file. If
+of putting the actual file there. innotop automatically discovers files named \f(CW\*(C`*.pm\*(C'\fR. If
there is a corresponding entry in the \*(L"plugins\*(R" configuration file section,
innotop loads and activates the plugin.
.PP
@@ -1708,7 +1807,7 @@ file and determine the package name and description.
innotop inspects the plugin module's source to determine the Perl package name.
It looks for a line of the form \*(L"package Foo;\*(R" and if found, considers the
plugin's package name to be Foo. Of course the package name can be a valid Perl
-package name, with double semicolons and so on.
+package name such as Foo::Bar, with double colons (::) and so on.
.PP
It also looks for a description in the source code, to make the plugin editor
more human-friendly. The description is a comment line of the form \*(L"#
@@ -1758,7 +1857,7 @@ for later use. The variables are defined in the innotop variable
A hashref of key mappings. These are innotop's global hot-keys.
.IP "agg_funcs" 4
.IX Item "agg_funcs"
-A hashref of functions that can be used for grouping. See \*(L"\s-1GROUPING\s0\*(R".
+A hashref of functions that can be used for grouping. See \*(L"\s-1GROUPING\*(R"\s0.
.IP "config" 4
.IX Item "config"
The global configuration hash.
@@ -1772,23 +1871,23 @@ A hashref of innotop's database connections. These are actual \s-1DBI\s0 connec
objects.
.IP "filters" 4
.IX Item "filters"
-A hashref of filters applied to table rows. See \*(L"\s-1FILTERS\s0\*(R" for more.
+A hashref of filters applied to table rows. See \*(L"\s-1FILTERS\*(R"\s0 for more.
.IP "modes" 4
.IX Item "modes"
-A hashref of modes. See \*(L"\s-1MODES\s0\*(R" for more.
+A hashref of modes. See \*(L"\s-1MODES\*(R"\s0 for more.
.IP "server_groups" 4
.IX Item "server_groups"
-A hashref of server groups. See \*(L"\s-1SERVER\s0 \s-1GROUPS\s0\*(R".
+A hashref of server groups. See \*(L"\s-1SERVER GROUPS\*(R"\s0.
.IP "tbl_meta" 4
.IX Item "tbl_meta"
A hashref of innotop's table meta-data, with one entry per table (see
-\&\*(L"\s-1TABLES\s0\*(R" for more information).
+\&\*(L"\s-1TABLES\*(R"\s0 for more information).
.IP "trans_funcs" 4
.IX Item "trans_funcs"
-A hashref of transformation functions. See \*(L"\s-1TRANSFORMATIONS\s0\*(R".
+A hashref of transformation functions. See \*(L"\s-1TRANSFORMATIONS\*(R"\s0.
.IP "var_sets" 4
.IX Item "var_sets"
-A hashref of variable sets. See \*(L"\s-1VARIABLE\s0 \s-1SETS\s0\*(R".
+A hashref of variable sets. See \*(L"\s-1VARIABLE SETS\*(R"\s0.
.SS "Plugin Events"
.IX Subsection "Plugin Events"
Each event is defined somewhere in the innotop source code. When innotop runs
@@ -1818,7 +1917,9 @@ This event occurs inside the subroutine that prints the lines to the screen.
.IX Subsection "Simple Plugin Example"
The easiest way to explain the plugin functionality is probably with a simple
example. The following module adds a column to the beginning of every table and
-sets its value to 1.
+sets its value to 1. (If you copy and paste this example code, be sure to remove
+the first space from each line; lines such as '# description' must not start with
+whitespace).
.PP
.Vb 2
\& use strict;
@@ -1887,12 +1988,13 @@ inactive. Exit the editor and restart innotop for the changes to take effect.
innotop uses a limited set of \s-1SQL\s0 statements to retrieve data from MySQL for
display. The statements are customized depending on the server version against
which they are executed; for example, on MySQL 5 and newer, \s-1INNODB_STATUS\s0
-executes \*(L"\s-1SHOW\s0 \s-1ENGINE\s0 \s-1INNODB\s0 \s-1STATUS\s0\*(R", while on earlier versions it executes
-\&\*(L"\s-1SHOW\s0 \s-1INNODB\s0 \s-1STATUS\s0\*(R". The statements are as follows:
+executes \*(L"\s-1SHOW ENGINE INNODB STATUS\*(R",\s0 while on earlier versions it executes
+\&\*(L"\s-1SHOW INNODB STATUS\*(R". \s0 The statements are as follows:
.PP
-.Vb 12
+.Vb 10
\& Statement SQL executed
\& =================== ===============================
+\& INDEX_STATISTICS SELECT * FROM INFORMATION_SCHEMA.INDEX_STATISTICS
\& INNODB_STATUS SHOW [ENGINE] INNODB STATUS
\& KILL_CONNECTION KILL
\& KILL_QUERY KILL QUERY
@@ -1903,13 +2005,14 @@ executes \*(L"\s-1SHOW\s0 \s-1ENGINE\s0 \s-1INNODB\s0 \s-1STATUS\s0\*(R", while
\& SHOW_SLAVE_STATUS SHOW SLAVE STATUS
\& SHOW_STATUS SHOW [GLOBAL] STATUS
\& SHOW_VARIABLES SHOW [GLOBAL] VARIABLES
+\& TABLE_STATISTICS SELECT * FROM INFORMATION_SCHEMA.TABLE_STATISTICS
.Ve
.SH "DATA SOURCES"
.IX Header "DATA SOURCES"
-Each time innotop extracts values to create a table (see \*(L"\s-1EXPRESSIONS\s0\*(R" and
-\&\*(L"\s-1TABLES\s0\*(R"), it does so from a particular data source. Largely because of the
-complex data extracted from \s-1SHOW\s0 \s-1INNODB\s0 \s-1STATUS\s0, this is slightly messy. \s-1SHOW\s0
-\&\s-1INNODB\s0 \s-1STATUS\s0 contains a mixture of single values and repeated values that form
+Each time innotop extracts values to create a table (see \*(L"\s-1EXPRESSIONS\*(R"\s0 and
+\&\*(L"\s-1TABLES\*(R"\s0), it does so from a particular data source. Largely because of the
+complex data extracted from \s-1SHOW INNODB STATUS,\s0 this is slightly messy. \s-1SHOW
+INNODB STATUS\s0 contains a mixture of single values and repeated values that form
nested data sets.
.PP
Whenever innotop fetches data from MySQL, it adds two extra bits to each set:
@@ -1921,41 +2024,53 @@ Here are the kinds of data sources from which data is extracted:
.IP "\s-1STATUS_VARIABLES\s0" 4
.IX Item "STATUS_VARIABLES"
This is the broadest category, into which the most kinds of data fall. It
-begins with the combination of \s-1SHOW\s0 \s-1STATUS\s0 and \s-1SHOW\s0 \s-1VARIABLES\s0, but other sources
-may be included as needed, for example, \s-1SHOW\s0 \s-1MASTER\s0 \s-1STATUS\s0 and \s-1SHOW\s0 \s-1SLAVE\s0
-\&\s-1STATUS\s0, as well as many of the non-repeated values from \s-1SHOW\s0 \s-1INNODB\s0 \s-1STATUS\s0.
+begins with the combination of \s-1SHOW STATUS\s0 and \s-1SHOW VARIABLES,\s0 but other sources
+may be included as needed, for example, \s-1SHOW MASTER STATUS\s0 and \s-1SHOW SLAVE
+STATUS,\s0 as well as many of the non-repeated values from \s-1SHOW INNODB STATUS.\s0
.IP "\s-1DEADLOCK_LOCKS\s0" 4
.IX Item "DEADLOCK_LOCKS"
-This data is extracted from the transaction list in the \s-1LATEST\s0 \s-1DETECTED\s0 \s-1DEADLOCK\s0
-section of \s-1SHOW\s0 \s-1INNODB\s0 \s-1STATUS\s0. It is nested two levels deep: transactions, then
+This data is extracted from the transaction list in the \s-1LATEST DETECTED DEADLOCK\s0
+section of \s-1SHOW INNODB STATUS. \s0 It is nested two levels deep: transactions, then
locks.
.IP "\s-1DEADLOCK_TRANSACTIONS\s0" 4
.IX Item "DEADLOCK_TRANSACTIONS"
-This data is from the transaction list in the \s-1LATEST\s0 \s-1DETECTED\s0 \s-1DEADLOCK\s0
-section of \s-1SHOW\s0 \s-1INNODB\s0 \s-1STATUS\s0. It is nested one level deep.
+This data is from the transaction list in the \s-1LATEST DETECTED DEADLOCK\s0
+section of \s-1SHOW INNODB STATUS. \s0 It is nested one level deep.
.IP "\s-1EXPLAIN\s0" 4
.IX Item "EXPLAIN"
-This data is from the result set returned by \s-1EXPLAIN\s0.
+This data is from the result set returned by \s-1EXPLAIN.\s0
+.IP "\s-1INNODB_BLOCKED_BLOCKER\s0" 4
+.IX Item "INNODB_BLOCKED_BLOCKER"
+This data is from the \s-1INFORMATION_SCHEMA\s0 tables related to InnoDB locks and
+the processlist.
.IP "\s-1INNODB_TRANSACTIONS\s0" 4
.IX Item "INNODB_TRANSACTIONS"
-This data is from the \s-1TRANSACTIONS\s0 section of \s-1SHOW\s0 \s-1INNODB\s0 \s-1STATUS\s0.
+This data is from the \s-1TRANSACTIONS\s0 section of \s-1SHOW INNODB STATUS.\s0
.IP "\s-1IO_THREADS\s0" 4
.IX Item "IO_THREADS"
-This data is from the list of threads in the the \s-1FILE\s0 I/O section of \s-1SHOW\s0 \s-1INNODB\s0
-\&\s-1STATUS\s0.
+This data is from the list of threads in the the \s-1FILE I/O\s0 section of \s-1SHOW INNODB
+STATUS.\s0
.IP "\s-1INNODB_LOCKS\s0" 4
.IX Item "INNODB_LOCKS"
-This data is from the \s-1TRANSACTIONS\s0 section of \s-1SHOW\s0 \s-1INNODB\s0 \s-1STATUS\s0 and is nested
+This data is from the \s-1TRANSACTIONS\s0 section of \s-1SHOW INNODB STATUS\s0 and is nested
two levels deep.
+.IP "\s-1MASTER_SLAVE\s0" 4
+.IX Item "MASTER_SLAVE"
+This data is from the combination of \s-1SHOW MASTER STATUS\s0 and \s-1SHOW SLAVE STATUS.\s0
.IP "\s-1OPEN_TABLES\s0" 4
.IX Item "OPEN_TABLES"
-This data is from \s-1SHOW\s0 \s-1OPEN\s0 \s-1TABLES\s0.
+This data is from \s-1SHOW OPEN TABLES.\s0
.IP "\s-1PROCESSLIST\s0" 4
.IX Item "PROCESSLIST"
-This data is from \s-1SHOW\s0 \s-1FULL\s0 \s-1PROCESSLIST\s0.
+This data is from \s-1SHOW FULL PROCESSLIST.\s0
+.IP "\s-1PROCESSLIST_STATS\s0" 4
+.IX Item "PROCESSLIST_STATS"
+This data is from \s-1SHOW FULL PROCESSLIST\s0 and computes stats such as the maximum time
+a user query has been running, and how many user queries are running. A \*(L"user
+query\*(R" excludes replication threads.
.IP "\s-1OS_WAIT_ARRAY\s0" 4
.IX Item "OS_WAIT_ARRAY"
-This data is from the \s-1SEMAPHORES\s0 section of \s-1SHOW\s0 \s-1INNODB\s0 \s-1STATUS\s0 and is nested one
+This data is from the \s-1SEMAPHORES\s0 section of \s-1SHOW INNODB STATUS\s0 and is nested one
level deep. It comes from the lines that look like this:
.Sp
.Vb 1
@@ -1976,15 +2091,15 @@ mode.
You need special privileges to start and stop slave servers.
.IP "\(bu" 4
You need appropriate privileges to create and drop the deadlock tables if needed
-(see \*(L"\s-1SERVER\s0 \s-1CONNECTIONS\s0\*(R").
+(see \*(L"\s-1SERVER CONNECTIONS\*(R"\s0).
.SH "SYSTEM REQUIREMENTS"
.IX Header "SYSTEM REQUIREMENTS"
-You need Perl to run innotop, of course. You also need a few Perl modules: \s-1DBI\s0,
+You need Perl to run innotop, of course. You also need a few Perl modules: \s-1DBI,\s0
DBD::mysql, Term::ReadKey, and Time::HiRes. These should be included with most
Perl distributions, but in case they are not, I recommend using versions
-distributed with your operating system or Perl distribution, not from \s-1CPAN\s0.
+distributed with your operating system or Perl distribution, not from \s-1CPAN.\s0
Term::ReadKey in particular has been known to cause problems if installed from
-\&\s-1CPAN\s0.
+\&\s-1CPAN.\s0
.PP
If you have Term::ANSIColor, innotop will use it to format headers more readably
and compactly. (Under Microsoft Windows, you also need Win32::Console::ANSI for
@@ -1992,7 +2107,7 @@ terminal formatting codes to be honored). If you install Term::ReadLine,
preferably Term::ReadLine::Gnu, you'll get nice auto-completion support.
.PP
I run innotop on Gentoo GNU/Linux, Debian and Ubuntu, and I've had feedback from
-people successfully running it on Red Hat, CentOS, Solaris, and Mac \s-1OSX\s0. I
+people successfully running it on Red Hat, CentOS, Solaris, and Mac \s-1OSX. I\s0
don't see any reason why it won't work on other UNIX-ish operating systems, but
I don't know for sure. It also runs on Windows under ActivePerl without
problem.
@@ -2017,6 +2132,7 @@ displays it.
The following people and organizations are acknowledged for various reasons.
Hopefully no one has been forgotten.
.PP
+Aaron Racine,
Allen K. Smith,
Aurimas Mikalauskas,
Bartosz Fenski,
@@ -2038,7 +2154,7 @@ Kristian Kohntopp,
Lenz Grimmer,
Maciej Dobrzanski,
Michiel Betel,
-MySQL \s-1AB\s0,
+MySQL \s-1AB,\s0
Paul McCullagh,
Sebastien Estienne,
Sourceforge.net,
@@ -2056,9 +2172,9 @@ not be able to compile it then).
This program is copyright (c) 2006 Baron Schwartz.
Feedback and improvements are welcome.
.PP
-\&\s-1THIS\s0 \s-1PROGRAM\s0 \s-1IS\s0 \s-1PROVIDED\s0 \*(L"\s-1AS\s0 \s-1IS\s0\*(R" \s-1AND\s0 \s-1WITHOUT\s0 \s-1ANY\s0 \s-1EXPRESS\s0 \s-1OR\s0 \s-1IMPLIED\s0
-\&\s-1WARRANTIES\s0, \s-1INCLUDING\s0, \s-1WITHOUT\s0 \s-1LIMITATION\s0, \s-1THE\s0 \s-1IMPLIED\s0 \s-1WARRANTIES\s0 \s-1OF\s0
-\&\s-1MERCHANTIBILITY\s0 \s-1AND\s0 \s-1FITNESS\s0 \s-1FOR\s0 A \s-1PARTICULAR\s0 \s-1PURPOSE\s0.
+\&\s-1THIS PROGRAM IS PROVIDED \*(L"AS IS\*(R" AND WITHOUT ANY EXPRESS OR IMPLIED
+WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
+MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.\s0
.PP
This program is free software; you can redistribute it and/or modify it under
the terms of the \s-1GNU\s0 General Public License as published by the Free Software
@@ -2067,8 +2183,8 @@ systems, you can issue `man perlgpl' or `man perlartistic' to read these
licenses.
.PP
You should have received a copy of the \s-1GNU\s0 General Public License along with
-this program; if not, write to the Free Software Foundation, Inc., 59 Temple
-Place, Suite 330, Boston, \s-1MA\s0 02111\-1307 \s-1USA\s0.
+this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
+Street, Fifth Floor, Boston, \s-1MA\s0 02111\-1301 \s-1USA\s0.
.PP
Execute innotop and press '!' to see this information at any time.
.SH "AUTHOR"
@@ -2077,7 +2193,7 @@ Originally written by Baron Schwartz; currently maintained by Aaron Racine.
.SH "BUGS"
.IX Header "BUGS"
You can report bugs, ask for improvements, and get other help and support at
-<http://code.google.com/p/innotop/>. There are mailing lists, a source code
+<https://github.com/innotop/innotop>. There are mailing lists, a source code
browser, a bug tracker, etc. Please use these instead of contacting the
maintainer or author directly, as it makes our job easier and benefits others if the
discussions are permanent and public. Of course, if you need to contact us in
diff --git a/debian/additions/mysqlreport b/debian/additions/mysqlreport
index 3e116bf4a43..64eaf93783a 100755
--- a/debian/additions/mysqlreport
+++ b/debian/additions/mysqlreport
@@ -357,7 +357,7 @@ sub read_relative_infiles
select $tmpfile_fh[$i];
- # Read infile again and copy each set of status values to seperate tmp files
+ # Read infile again and copy each set of status values to separate tmp files
open INFILE, "< $infile" or warn and next;
while(<INFILE>)
{
@@ -365,7 +365,7 @@ sub read_relative_infiles
next if /^$/;
# The infile must begin with the system variable values.
- # Therefore, the first occurance of Aborted_clients indicates the beginning
+ # Therefore, the first occurrence of Aborted_clients indicates the beginning
# of the first set of status values if no sets have occurred yet ($stat_n == 0).
# In this case, the following status values are printed to the current fh,
# along with the system variable values read thus far, until Aborted_clients
diff --git a/debian/mariadb-server-10.2.mysql-server.logrotate b/debian/mariadb-server-10.2.mysql-server.logrotate
index 2a9c3cd3031..4111a276dc3 100644
--- a/debian/mariadb-server-10.2.mysql-server.logrotate
+++ b/debian/mariadb-server-10.2.mysql-server.logrotate
@@ -13,7 +13,8 @@
test -x /usr/bin/mysqladmin || exit 0
if [ -f `my_print_defaults --mysqld | grep -oP "pid-file=\K[^$]+"` ]; then
# If this fails, check debian.conf!
- mysqladmin --defaults-file=/etc/mysql/debian.cnf flush-logs
+ mysqladmin --defaults-file=/etc/mysql/debian.cnf --local flush-error-log \
+ flush-engine-log flush-general-log flush-slow-log
fi
endscript
}
diff --git a/extra/charset2html.c b/extra/charset2html.c
index cafac2c1cd5..5851f206a1c 100644
--- a/extra/charset2html.c
+++ b/extra/charset2html.c
@@ -97,7 +97,7 @@ static void print_cs(CHARSET_INFO *cs)
{
/*
Control characters 0x0080..0x009F are dysplayed by some
- browers as if they were letters. Don't print them to
+ browsers as if they were letters. Don't print them to
avoid confusion.
*/
printf("<TD>ctrl<TD>ctrl<TD>ctrl");
diff --git a/extra/innochecksum.cc b/extra/innochecksum.cc
index 819b05364f8..fa50ca72867 100644
--- a/extra/innochecksum.cc
+++ b/extra/innochecksum.cc
@@ -51,6 +51,7 @@ The parts not included are excluded by #ifndef UNIV_INNOCHECKSUM. */
#include "fut0lst.h" /* FLST_NODE_SIZE */
#include "buf0checksum.h" /* buf_calc_page_*() */
#include "fil0fil.h" /* FIL_* */
+#include "fil0crypt.h"
#include "os0file.h"
#include "fsp0fsp.h" /* fsp_flags_get_page_size() &
fsp_flags_get_zip_size() */
@@ -64,24 +65,6 @@ The parts not included are excluded by #ifndef UNIV_INNOCHECKSUM. */
#define PRIuMAX "llu"
#endif
-/*********************************************************************
-Verify checksum for a page (iff it's encrypted)
-NOTE: currently this function can only be run in single threaded mode
-as it modifies srv_checksum_algorithm (temporarily)
-@param[in] src_fame page to verify
-@param[in] page_size page_size
-@param[in] page_no page number of given read_buf
-@param[in] strict_check true if strict-check option is enabled
-@return true if page is encrypted AND OK, false otherwise */
-UNIV_INTERN
-bool
-fil_space_verify_crypt_checksum(
-/*============================*/
- const byte* src_frame, /*!< in: page the verify */
- const page_size_t& page_size /*!< in: page size */
- ,uintmax_t page_no,
- bool strict_check);
-
/* Global variables */
static bool verbose;
static bool just_count;
@@ -576,6 +559,9 @@ is_page_corrupted(
}
}
+ /* FIXME: Read the page number from the tablespace header,
+ and check that every page carries the same page number. */
+
/* If page is encrypted, use different checksum calculation
as innochecksum can't decrypt pages. Note that some old InnoDB
versions did not initialize FIL_PAGE_FILE_FLUSH_LSN field
@@ -583,15 +569,19 @@ is_page_corrupted(
normal method.
*/
if (mach_read_from_4(buf+FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION) != 0) {
- is_corrupted = fil_space_verify_crypt_checksum(buf, page_size,
- cur_page_num, strict_verify);
+ is_corrupted = fil_space_verify_crypt_checksum(
+ const_cast<byte*>(buf), page_size,
+ strict_verify, is_log_enabled ? log_file : NULL,
+ mach_read_from_4(buf
+ + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID),
+ cur_page_num);
} else {
is_corrupted = true;
}
if (is_corrupted) {
is_corrupted = buf_page_is_corrupted(
- true, buf, page_size, false,
+ true, buf, page_size, NULL,
cur_page_num, strict_verify,
is_log_enabled, log_file);
}
diff --git a/extra/replace.c b/extra/replace.c
index 56cf02f2002..a9982670384 100644
--- a/extra/replace.c
+++ b/extra/replace.c
@@ -36,7 +36,7 @@
The programs make a DFA-state-machine of the strings and the speed isn't
dependent on the count of replace-strings (only of the number of replaces).
A line is assumed ending with \n or \0.
- There are no limit exept memory on length of strings.
+ There are no limit except memory on length of strings.
Written by Monty.
fill_buffer_retaining() is taken from gnu-grep and modified.
diff --git a/extra/yassl/src/ssl.cpp b/extra/yassl/src/ssl.cpp
index c903516eca1..cb845a34c8a 100644
--- a/extra/yassl/src/ssl.cpp
+++ b/extra/yassl/src/ssl.cpp
@@ -774,7 +774,6 @@ int SSL_CTX_load_verify_locations(SSL_CTX* ctx, const char* file,
const char* path)
{
int ret = SSL_FAILURE;
- const int HALF_PATH = 128;
if (file) ret = read_file(ctx, file, SSL_FILETYPE_PEM, CA);
diff --git a/include/base64.h b/include/base64.h
deleted file mode 100644
index cb5ac5e0b5e..00000000000
--- a/include/base64.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/* Copyright (c) 2003-2006 MySQL AB
- Use is subject to license terms
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; version 2 of the License.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */
-
-#ifndef __BASE64_H_INCLUDED__
-#define __BASE64_H_INCLUDED__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
- Calculate how much memory needed for dst of my_base64_encode()
-*/
-int my_base64_needed_encoded_length(int length_of_data);
-
-/*
- Maximum length my_base64_encode_needed_length() can accept with no overflow.
-*/
-int my_base64_encode_max_arg_length(void);
-
-/*
- Calculate how much memory needed for dst of my_base64_decode()
-*/
-int my_base64_needed_decoded_length(int length_of_encoded_data);
-
-/*
- Maximum length my_base64_decode_needed_length() can accept with no overflow.
-*/
-int my_base64_decode_max_arg_length();
-
-/*
- Encode data as a base64 string
-*/
-int my_base64_encode(const void *src, size_t src_len, char *dst);
-
-/*
- Decode a base64 string into data
-*/
-int my_base64_decode(const char *src, size_t src_len,
- void *dst, const char **end_ptr, int flags);
-
-/* Allow multuple chunks 'AAA= AA== AA==', binlog uses this */
-#define MY_BASE64_DECODE_ALLOW_MULTIPLE_CHUNKS 1
-
-
-#ifdef __cplusplus
-}
-#endif
-#endif /* !__BASE64_H_INCLUDED__ */
diff --git a/include/m_string.h b/include/m_string.h
index 0f3cd362b4d..8817e7faa78 100644
--- a/include/m_string.h
+++ b/include/m_string.h
@@ -74,11 +74,13 @@ extern void *(*my_str_malloc)(size_t);
extern void *(*my_str_realloc)(void *, size_t);
extern void (*my_str_free)(void *);
+#ifdef DBUG_OFF
#if defined(HAVE_STPCPY) && MY_GNUC_PREREQ(3, 4) && !defined(__INTEL_COMPILER)
#define strmov(A,B) __builtin_stpcpy((A),(B))
#elif defined(HAVE_STPCPY)
#define strmov(A,B) stpcpy((A),(B))
#endif
+#endif
/* Declared in int2str() */
extern const char _dig_vec_upper[];
diff --git a/include/maria.h b/include/maria.h
index 1305b6444c0..ab8fc944c8c 100644
--- a/include/maria.h
+++ b/include/maria.h
@@ -13,7 +13,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
/* This file should be included when using maria functions */
diff --git a/include/my_decimal_limits.h b/include/my_decimal_limits.h
index a287e82f989..92be53d051b 100644
--- a/include/my_decimal_limits.h
+++ b/include/my_decimal_limits.h
@@ -13,7 +13,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#define DECIMAL_LONGLONG_DIGITS 22
#define DECIMAL_LONG_DIGITS 10
diff --git a/include/my_default.h b/include/my_default.h
index 1d556de69ee..0ed94b09492 100644
--- a/include/my_default.h
+++ b/include/my_default.h
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
/* Definitions for mysys/my_default.c */
diff --git a/include/my_global.h b/include/my_global.h
index 30db38ce35b..7e31783e326 100644
--- a/include/my_global.h
+++ b/include/my_global.h
@@ -1076,10 +1076,9 @@ typedef ulong myf; /* Type of MyFlags in my_funcs */
static inline char *dlerror(void)
{
static char win_errormsg[2048];
- if(FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM,
- 0, GetLastError(), 0, win_errormsg, 2048, NULL))
- return win_errormsg;
- return "";
+ FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM,
+ 0, GetLastError(), 0, win_errormsg, 2048, NULL);
+ return win_errormsg;
}
#define HAVE_DLOPEN 1
#define HAVE_DLERROR 1
diff --git a/include/my_rnd.h b/include/my_rnd.h
index b4a5d735811..ab8b3e10d23 100644
--- a/include/my_rnd.h
+++ b/include/my_rnd.h
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#ifndef _my_rnd_h
#define _my_rnd_h
diff --git a/include/my_sys.h b/include/my_sys.h
index 6834bbd8dc2..9cc069d1fd3 100644
--- a/include/my_sys.h
+++ b/include/my_sys.h
@@ -66,9 +66,10 @@ typedef struct my_aio_result {
#define MY_FAE 8U /* Fatal if any error */
#define MY_WME 16U /* Write message on error */
#define MY_WAIT_IF_FULL 32U /* Wait and try again if disk full error */
-#define MY_IGNORE_BADFD 32U /* my_sync: ignore 'bad descriptor' errors */
+#define MY_IGNORE_BADFD 32U /* my_sync(): ignore 'bad descriptor' errors */
#define MY_ENCRYPT 64U /* Encrypt IO_CACHE temporary files */
-#define MY_FULL_IO 512U /* For my_read - loop intil I/O is complete */
+#define MY_NOSYMLINKS 512U /* my_open(): don't follow symlinks */
+#define MY_FULL_IO 512U /* my_read(): loop until I/O is complete */
#define MY_DONT_CHECK_FILESIZE 128U /* Option to init_io_cache() */
#define MY_LINK_WARNING 32U /* my_redel() gives warning if links */
#define MY_COPYTIME 64U /* my_redel() copys time */
@@ -269,7 +270,7 @@ extern ulong my_file_opened,my_stream_opened, my_tmp_file_created;
extern ulong my_file_total_opened;
extern ulong my_sync_count;
extern uint mysys_usage_id;
-extern my_bool my_init_done;
+extern my_bool my_init_done, my_thr_key_mysys_exists;
extern my_bool my_assert_on_error;
extern myf my_global_flags; /* Set to MY_WME for more error messages */
/* Point to current my_message() */
@@ -625,6 +626,7 @@ int my_b_pread(IO_CACHE *info, uchar *Buffer, size_t Count, my_off_t pos);
typedef uint32 ha_checksum;
+extern int (*mysys_test_invalid_symlink)(const char *filename);
#include <my_alloc.h>
/* Prototypes for mysys and my_func functions */
@@ -652,9 +654,10 @@ extern int my_realpath(char *to, const char *filename, myf MyFlags);
extern File my_create_with_symlink(const char *linkname, const char *filename,
int createflags, int access_flags,
myf MyFlags);
-extern int my_delete_with_symlink(const char *name, myf MyFlags);
extern int my_rename_with_symlink(const char *from,const char *to,myf MyFlags);
extern int my_symlink(const char *content, const char *linkname, myf MyFlags);
+extern int my_handler_delete_with_symlink(const char *filename, myf sync_dir);
+
extern size_t my_read(File Filedes,uchar *Buffer,size_t Count,myf MyFlags);
extern size_t my_pread(File Filedes,uchar *Buffer,size_t Count,my_off_t offset,
myf MyFlags);
@@ -1009,6 +1012,8 @@ void my_uuid(uchar *guid);
void my_uuid2str(const uchar *guid, char *s);
void my_uuid_end(void);
+const char *my_dlerror(const char *dlpath);
+
/* character sets */
extern void my_charset_loader_init_mysys(MY_CHARSET_LOADER *loader);
extern uint get_charset_number(const char *cs_name, uint cs_flags);
diff --git a/include/my_valgrind.h b/include/my_valgrind.h
index 3519d7bb757..dbbc4fad5ab 100644
--- a/include/my_valgrind.h
+++ b/include/my_valgrind.h
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#ifdef HAVE_valgrind
#define IF_VALGRIND(A,B) A
diff --git a/include/myisamchk.h b/include/myisamchk.h
index 40aa0b19d49..1a9605aac46 100644
--- a/include/myisamchk.h
+++ b/include/myisamchk.h
@@ -13,7 +13,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
/* Definitions needed for myisamchk/mariachk.c */
diff --git a/include/mysql.h b/include/mysql.h
index 80e75c264e8..8d8e0589282 100644
--- a/include/mysql.h
+++ b/include/mysql.h
@@ -48,7 +48,11 @@ extern "C" {
#ifndef MYSQL_ABI_CHECK
#include <sys/types.h>
#endif
+
+#ifndef MYSQL_PLUGIN_INCLUDED
typedef char my_bool;
+#endif
+
#if (defined(_WIN32) || defined(_WIN64)) && !defined(__WIN__)
#define __WIN__
#endif
diff --git a/include/mysql/auth_dialog_client.h b/include/mysql/auth_dialog_client.h
index 2c58aac9444..5cbafcc22cc 100644
--- a/include/mysql/auth_dialog_client.h
+++ b/include/mysql/auth_dialog_client.h
@@ -12,7 +12,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
/**
@file
diff --git a/include/mysql/plugin.h b/include/mysql/plugin.h
index b3c71c65488..a5bfa1bbc9e 100644
--- a/include/mysql/plugin.h
+++ b/include/mysql/plugin.h
@@ -1,5 +1,5 @@
/* Copyright (c) 2005, 2013, Oracle and/or its affiliates
- Copyright (C) 2009, 2013, Monty Program Ab
+ Copyright (C) 2009, 2017, MariaDB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -14,8 +14,8 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
-#ifndef _my_plugin_h
-#define _my_plugin_h
+#ifndef MYSQL_PLUGIN_INCLUDED
+#define MYSQL_PLUGIN_INCLUDED
/*
On Windows, exports from DLL need to be declared
@@ -75,7 +75,7 @@ typedef struct st_mysql_xid MYSQL_XID;
#define MYSQL_PLUGIN_INTERFACE_VERSION 0x0104
/* MariaDB plugin interface version */
-#define MARIA_PLUGIN_INTERFACE_VERSION 0x010b
+#define MARIA_PLUGIN_INTERFACE_VERSION 0x010c
/*
The allowable types of plugins
diff --git a/include/mysql/plugin_audit.h.pp b/include/mysql/plugin_audit.h.pp
index aaf41c74a54..2adde48dc22 100644
--- a/include/mysql/plugin_audit.h.pp
+++ b/include/mysql/plugin_audit.h.pp
@@ -1,186 +1,22 @@
typedef char my_bool;
typedef void * MYSQL_PLUGIN;
-extern struct my_snprintf_service_st {
- size_t (*my_snprintf_type)(char*, size_t, const char*, ...);
- size_t (*my_vsnprintf_type)(char *, size_t, const char*, va_list);
-} *my_snprintf_service;
-size_t my_snprintf(char* to, size_t n, const char* fmt, ...);
-size_t my_vsnprintf(char *to, size_t n, const char* fmt, va_list ap);
-struct st_mysql_lex_string
-{
- char *str;
- size_t length;
-};
-typedef struct st_mysql_lex_string MYSQL_LEX_STRING;
-extern struct thd_alloc_service_st {
- void *(*thd_alloc_func)(void*, unsigned int);
- void *(*thd_calloc_func)(void*, unsigned int);
- char *(*thd_strdup_func)(void*, const char *);
- char *(*thd_strmake_func)(void*, const char *, unsigned int);
- void *(*thd_memdup_func)(void*, const void*, unsigned int);
- MYSQL_LEX_STRING *(*thd_make_lex_string_func)(void*, MYSQL_LEX_STRING *,
- const char *, unsigned int, int);
-} *thd_alloc_service;
-void *thd_alloc(void* thd, unsigned int size);
-void *thd_calloc(void* thd, unsigned int size);
-char *thd_strdup(void* thd, const char *str);
-char *thd_strmake(void* thd, const char *str, unsigned int size);
-void *thd_memdup(void* thd, const void* str, unsigned int size);
-MYSQL_LEX_STRING *thd_make_lex_string(void* thd, MYSQL_LEX_STRING *lex_str,
- const char *str, unsigned int size,
- int allocate_lex_string);
-typedef enum _thd_wait_type_e {
- THD_WAIT_SLEEP= 1,
- THD_WAIT_DISKIO= 2,
- THD_WAIT_ROW_LOCK= 3,
- THD_WAIT_GLOBAL_LOCK= 4,
- THD_WAIT_META_DATA_LOCK= 5,
- THD_WAIT_TABLE_LOCK= 6,
- THD_WAIT_USER_LOCK= 7,
- THD_WAIT_BINLOG= 8,
- THD_WAIT_GROUP_COMMIT= 9,
- THD_WAIT_SYNC= 10,
- THD_WAIT_NET= 11,
- THD_WAIT_LAST= 12
-} thd_wait_type;
-extern struct thd_wait_service_st {
- void (*thd_wait_begin_func)(void*, int);
- void (*thd_wait_end_func)(void*);
-} *thd_wait_service;
-void thd_wait_begin(void* thd, int wait_type);
-void thd_wait_end(void* thd);
-extern struct progress_report_service_st {
- void (*thd_progress_init_func)(void* thd, unsigned int max_stage);
- void (*thd_progress_report_func)(void* thd,
- unsigned long long progress,
- unsigned long long max_progress);
- void (*thd_progress_next_stage_func)(void* thd);
- void (*thd_progress_end_func)(void* thd);
- const char *(*set_thd_proc_info_func)(void*, const char *info,
- const char *func,
- const char *file,
- unsigned int line);
-} *progress_report_service;
-void thd_progress_init(void* thd, unsigned int max_stage);
-void thd_progress_report(void* thd,
- unsigned long long progress,
- unsigned long long max_progress);
-void thd_progress_next_stage(void* thd);
-void thd_progress_end(void* thd);
-const char *set_thd_proc_info(void*, const char * info, const char *func,
- const char *file, unsigned int line);
+extern struct base64_service_st {
+ int (*base64_needed_encoded_length_ptr)(int length_of_data);
+ int (*base64_encode_max_arg_length_ptr)(void);
+ int (*base64_needed_decoded_length_ptr)(int length_of_encoded_data);
+ int (*base64_decode_max_arg_length_ptr)();
+ int (*base64_encode_ptr)(const void *src, size_t src_len, char *dst);
+ int (*base64_decode_ptr)(const char *src, size_t src_len,
+ void *dst, const char **end_ptr, int flags);
+} *base64_service;
+int my_base64_needed_encoded_length(int length_of_data);
+int my_base64_encode_max_arg_length(void);
+int my_base64_needed_decoded_length(int length_of_encoded_data);
+int my_base64_decode_max_arg_length();
+int my_base64_encode(const void *src, size_t src_len, char *dst);
+int my_base64_decode(const char *src, size_t src_len,
+ void *dst, const char **end_ptr, int flags);
extern void (*debug_sync_C_callback_ptr)(void*, const char *, size_t);
-enum thd_kill_levels {
- THD_IS_NOT_KILLED=0,
- THD_ABORT_SOFTLY=50,
- THD_ABORT_ASAP=100,
-};
-extern struct kill_statement_service_st {
- enum thd_kill_levels (*thd_kill_level_func)(const void*);
-} *thd_kill_statement_service;
-enum thd_kill_levels thd_kill_level(const void*);
-typedef long my_time_t;
-enum enum_mysql_timestamp_type
-{
- MYSQL_TIMESTAMP_NONE= -2, MYSQL_TIMESTAMP_ERROR= -1,
- MYSQL_TIMESTAMP_DATE= 0, MYSQL_TIMESTAMP_DATETIME= 1, MYSQL_TIMESTAMP_TIME= 2
-};
-typedef struct st_mysql_time
-{
- unsigned int year, month, day, hour, minute, second;
- unsigned long second_part;
- my_bool neg;
- enum enum_mysql_timestamp_type time_type;
-} MYSQL_TIME;
-extern struct thd_timezone_service_st {
- my_time_t (*thd_TIME_to_gmt_sec)(void* thd, const MYSQL_TIME *ltime, unsigned int *errcode);
- void (*thd_gmt_sec_to_TIME)(void* thd, MYSQL_TIME *ltime, my_time_t t);
-} *thd_timezone_service;
-my_time_t thd_TIME_to_gmt_sec(void* thd, const MYSQL_TIME *ltime, unsigned int *errcode);
-void thd_gmt_sec_to_TIME(void* thd, MYSQL_TIME *ltime, my_time_t t);
-extern struct my_sha1_service_st {
- void (*my_sha1_type)(unsigned char*, const char*, size_t);
- void (*my_sha1_multi_type)(unsigned char*, ...);
- size_t (*my_sha1_context_size_type)();
- void (*my_sha1_init_type)(void *);
- void (*my_sha1_input_type)(void *, const unsigned char *, size_t);
- void (*my_sha1_result_type)(void *, unsigned char *);
-} *my_sha1_service;
-void my_sha1(unsigned char*, const char*, size_t);
-void my_sha1_multi(unsigned char*, ...);
-size_t my_sha1_context_size();
-void my_sha1_init(void *context);
-void my_sha1_input(void *context, const unsigned char *buf, size_t len);
-void my_sha1_result(void *context, unsigned char *digest);
-extern struct my_md5_service_st {
- void (*my_md5_type)(unsigned char*, const char*, size_t);
- void (*my_md5_multi_type)(unsigned char*, ...);
- size_t (*my_md5_context_size_type)();
- void (*my_md5_init_type)(void *);
- void (*my_md5_input_type)(void *, const unsigned char *, size_t);
- void (*my_md5_result_type)(void *, unsigned char *);
-} *my_md5_service;
-void my_md5(unsigned char*, const char*, size_t);
-void my_md5_multi(unsigned char*, ...);
-size_t my_md5_context_size();
-void my_md5_init(void *context);
-void my_md5_input(void *context, const unsigned char *buf, size_t len);
-void my_md5_result(void *context, unsigned char *digest);
-typedef struct logger_handle_st LOGGER_HANDLE;
-extern struct logger_service_st {
- void (*logger_init_mutexes)();
- LOGGER_HANDLE* (*open)(const char *path,
- unsigned long long size_limit,
- unsigned int rotations);
- int (*close)(LOGGER_HANDLE *log);
- int (*vprintf)(LOGGER_HANDLE *log, const char *fmt, va_list argptr);
- int (*printf)(LOGGER_HANDLE *log, const char *fmt, ...);
- int (*write)(LOGGER_HANDLE *log, const char *buffer, size_t size);
- int (*rotate)(LOGGER_HANDLE *log);
-} *logger_service;
- void logger_init_mutexes();
- LOGGER_HANDLE *logger_open(const char *path,
- unsigned long long size_limit,
- unsigned int rotations);
- int logger_close(LOGGER_HANDLE *log);
- int logger_vprintf(LOGGER_HANDLE *log, const char *fmt, va_list argptr);
- int logger_printf(LOGGER_HANDLE *log, const char *fmt, ...);
- int logger_write(LOGGER_HANDLE *log, const char *buffer, size_t size);
- int logger_rotate(LOGGER_HANDLE *log);
-extern struct thd_autoinc_service_st {
- void (*thd_get_autoinc_func)(const void* thd,
- unsigned long* off, unsigned long* inc);
-} *thd_autoinc_service;
-void thd_get_autoinc(const void* thd,
- unsigned long* off, unsigned long* inc);
-extern struct thd_error_context_service_st {
- const char *(*thd_get_error_message_func)(const void* thd);
- unsigned int (*thd_get_error_number_func)(const void* thd);
- unsigned long (*thd_get_error_row_func)(const void* thd);
- void (*thd_inc_error_row_func)(void* thd);
- char *(*thd_get_error_context_description_func)(void* thd,
- char *buffer,
- unsigned int length,
- unsigned int max_query_length);
-} *thd_error_context_service;
-const char *thd_get_error_message(const void* thd);
-unsigned int thd_get_error_number(const void* thd);
-unsigned long thd_get_error_row(const void* thd);
-void thd_inc_error_row(void* thd);
-char *thd_get_error_context_description(void* thd,
- char *buffer, unsigned int length,
- unsigned int max_query_length);
-typedef int MYSQL_THD_KEY_T;
-extern struct thd_specifics_service_st {
- int (*thd_key_create_func)(MYSQL_THD_KEY_T *key);
- void (*thd_key_delete_func)(MYSQL_THD_KEY_T *key);
- void *(*thd_getspecific_func)(void* thd, MYSQL_THD_KEY_T key);
- int (*thd_setspecific_func)(void* thd, MYSQL_THD_KEY_T key, void *value);
-} *thd_specifics_service;
-int thd_key_create(MYSQL_THD_KEY_T *key);
-void thd_key_delete(MYSQL_THD_KEY_T *key);
-void* thd_getspecific(void* thd, MYSQL_THD_KEY_T key);
-int thd_setspecific(void* thd, MYSQL_THD_KEY_T key, void *value);
struct encryption_service_st {
unsigned int (*encryption_key_get_latest_version_func)(unsigned int key_id);
unsigned int (*encryption_key_get_func)(unsigned int key_id, unsigned int key_version,
@@ -257,6 +93,242 @@ int encryption_scheme_decrypt(const unsigned char* src, unsigned int slen,
struct st_encryption_scheme *scheme,
unsigned int key_version, unsigned int i32_1,
unsigned int i32_2, unsigned long long i64);
+enum thd_kill_levels {
+ THD_IS_NOT_KILLED=0,
+ THD_ABORT_SOFTLY=50,
+ THD_ABORT_ASAP=100,
+};
+extern struct kill_statement_service_st {
+ enum thd_kill_levels (*thd_kill_level_func)(const void*);
+} *thd_kill_statement_service;
+enum thd_kill_levels thd_kill_level(const void*);
+typedef struct logger_handle_st LOGGER_HANDLE;
+extern struct logger_service_st {
+ void (*logger_init_mutexes)();
+ LOGGER_HANDLE* (*open)(const char *path,
+ unsigned long long size_limit,
+ unsigned int rotations);
+ int (*close)(LOGGER_HANDLE *log);
+ int (*vprintf)(LOGGER_HANDLE *log, const char *fmt, va_list argptr);
+ int (*printf)(LOGGER_HANDLE *log, const char *fmt, ...);
+ int (*write)(LOGGER_HANDLE *log, const char *buffer, size_t size);
+ int (*rotate)(LOGGER_HANDLE *log);
+} *logger_service;
+ void logger_init_mutexes();
+ LOGGER_HANDLE *logger_open(const char *path,
+ unsigned long long size_limit,
+ unsigned int rotations);
+ int logger_close(LOGGER_HANDLE *log);
+ int logger_vprintf(LOGGER_HANDLE *log, const char *fmt, va_list argptr);
+ int logger_printf(LOGGER_HANDLE *log, const char *fmt, ...);
+ int logger_write(LOGGER_HANDLE *log, const char *buffer, size_t size);
+ int logger_rotate(LOGGER_HANDLE *log);
+extern struct my_md5_service_st {
+ void (*my_md5_type)(unsigned char*, const char*, size_t);
+ void (*my_md5_multi_type)(unsigned char*, ...);
+ size_t (*my_md5_context_size_type)();
+ void (*my_md5_init_type)(void *);
+ void (*my_md5_input_type)(void *, const unsigned char *, size_t);
+ void (*my_md5_result_type)(void *, unsigned char *);
+} *my_md5_service;
+void my_md5(unsigned char*, const char*, size_t);
+void my_md5_multi(unsigned char*, ...);
+size_t my_md5_context_size();
+void my_md5_init(void *context);
+void my_md5_input(void *context, const unsigned char *buf, size_t len);
+void my_md5_result(void *context, unsigned char *digest);
+extern struct my_snprintf_service_st {
+ size_t (*my_snprintf_type)(char*, size_t, const char*, ...);
+ size_t (*my_vsnprintf_type)(char *, size_t, const char*, va_list);
+} *my_snprintf_service;
+size_t my_snprintf(char* to, size_t n, const char* fmt, ...);
+size_t my_vsnprintf(char *to, size_t n, const char* fmt, va_list ap);
+extern struct progress_report_service_st {
+ void (*thd_progress_init_func)(void* thd, unsigned int max_stage);
+ void (*thd_progress_report_func)(void* thd,
+ unsigned long long progress,
+ unsigned long long max_progress);
+ void (*thd_progress_next_stage_func)(void* thd);
+ void (*thd_progress_end_func)(void* thd);
+ const char *(*set_thd_proc_info_func)(void*, const char *info,
+ const char *func,
+ const char *file,
+ unsigned int line);
+} *progress_report_service;
+void thd_progress_init(void* thd, unsigned int max_stage);
+void thd_progress_report(void* thd,
+ unsigned long long progress,
+ unsigned long long max_progress);
+void thd_progress_next_stage(void* thd);
+void thd_progress_end(void* thd);
+const char *set_thd_proc_info(void*, const char * info, const char *func,
+ const char *file, unsigned int line);
+extern struct my_sha1_service_st {
+ void (*my_sha1_type)(unsigned char*, const char*, size_t);
+ void (*my_sha1_multi_type)(unsigned char*, ...);
+ size_t (*my_sha1_context_size_type)();
+ void (*my_sha1_init_type)(void *);
+ void (*my_sha1_input_type)(void *, const unsigned char *, size_t);
+ void (*my_sha1_result_type)(void *, unsigned char *);
+} *my_sha1_service;
+void my_sha1(unsigned char*, const char*, size_t);
+void my_sha1_multi(unsigned char*, ...);
+size_t my_sha1_context_size();
+void my_sha1_init(void *context);
+void my_sha1_input(void *context, const unsigned char *buf, size_t len);
+void my_sha1_result(void *context, unsigned char *digest);
+extern struct my_sha2_service_st {
+ void (*my_sha224_type)(unsigned char*, const char*, size_t);
+ void (*my_sha224_multi_type)(unsigned char*, ...);
+ size_t (*my_sha224_context_size_type)();
+ void (*my_sha224_init_type)(void *);
+ void (*my_sha224_input_type)(void *, const unsigned char *, size_t);
+ void (*my_sha224_result_type)(void *, unsigned char *);
+ void (*my_sha256_type)(unsigned char*, const char*, size_t);
+ void (*my_sha256_multi_type)(unsigned char*, ...);
+ size_t (*my_sha256_context_size_type)();
+ void (*my_sha256_init_type)(void *);
+ void (*my_sha256_input_type)(void *, const unsigned char *, size_t);
+ void (*my_sha256_result_type)(void *, unsigned char *);
+ void (*my_sha384_type)(unsigned char*, const char*, size_t);
+ void (*my_sha384_multi_type)(unsigned char*, ...);
+ size_t (*my_sha384_context_size_type)();
+ void (*my_sha384_init_type)(void *);
+ void (*my_sha384_input_type)(void *, const unsigned char *, size_t);
+ void (*my_sha384_result_type)(void *, unsigned char *);
+ void (*my_sha512_type)(unsigned char*, const char*, size_t);
+ void (*my_sha512_multi_type)(unsigned char*, ...);
+ size_t (*my_sha512_context_size_type)();
+ void (*my_sha512_init_type)(void *);
+ void (*my_sha512_input_type)(void *, const unsigned char *, size_t);
+ void (*my_sha512_result_type)(void *, unsigned char *);
+} *my_sha2_service;
+void my_sha224(unsigned char*, const char*, size_t);
+void my_sha224_multi(unsigned char*, ...);
+size_t my_sha224_context_size();
+void my_sha224_init(void *context);
+void my_sha224_input(void *context, const unsigned char *buf, size_t len);
+void my_sha224_result(void *context, unsigned char *digest);
+void my_sha256(unsigned char*, const char*, size_t);
+void my_sha256_multi(unsigned char*, ...);
+size_t my_sha256_context_size();
+void my_sha256_init(void *context);
+void my_sha256_input(void *context, const unsigned char *buf, size_t len);
+void my_sha256_result(void *context, unsigned char *digest);
+void my_sha384(unsigned char*, const char*, size_t);
+void my_sha384_multi(unsigned char*, ...);
+size_t my_sha384_context_size();
+void my_sha384_init(void *context);
+void my_sha384_input(void *context, const unsigned char *buf, size_t len);
+void my_sha384_result(void *context, unsigned char *digest);
+void my_sha512(unsigned char*, const char*, size_t);
+void my_sha512_multi(unsigned char*, ...);
+size_t my_sha512_context_size();
+void my_sha512_init(void *context);
+void my_sha512_input(void *context, const unsigned char *buf, size_t len);
+void my_sha512_result(void *context, unsigned char *digest);
+struct st_mysql_lex_string
+{
+ char *str;
+ size_t length;
+};
+typedef struct st_mysql_lex_string MYSQL_LEX_STRING;
+extern struct thd_alloc_service_st {
+ void *(*thd_alloc_func)(void*, unsigned int);
+ void *(*thd_calloc_func)(void*, unsigned int);
+ char *(*thd_strdup_func)(void*, const char *);
+ char *(*thd_strmake_func)(void*, const char *, unsigned int);
+ void *(*thd_memdup_func)(void*, const void*, unsigned int);
+ MYSQL_LEX_STRING *(*thd_make_lex_string_func)(void*, MYSQL_LEX_STRING *,
+ const char *, unsigned int, int);
+} *thd_alloc_service;
+void *thd_alloc(void* thd, unsigned int size);
+void *thd_calloc(void* thd, unsigned int size);
+char *thd_strdup(void* thd, const char *str);
+char *thd_strmake(void* thd, const char *str, unsigned int size);
+void *thd_memdup(void* thd, const void* str, unsigned int size);
+MYSQL_LEX_STRING *thd_make_lex_string(void* thd, MYSQL_LEX_STRING *lex_str,
+ const char *str, unsigned int size,
+ int allocate_lex_string);
+extern struct thd_autoinc_service_st {
+ void (*thd_get_autoinc_func)(const void* thd,
+ unsigned long* off, unsigned long* inc);
+} *thd_autoinc_service;
+void thd_get_autoinc(const void* thd,
+ unsigned long* off, unsigned long* inc);
+extern struct thd_error_context_service_st {
+ const char *(*thd_get_error_message_func)(const void* thd);
+ unsigned int (*thd_get_error_number_func)(const void* thd);
+ unsigned long (*thd_get_error_row_func)(const void* thd);
+ void (*thd_inc_error_row_func)(void* thd);
+ char *(*thd_get_error_context_description_func)(void* thd,
+ char *buffer,
+ unsigned int length,
+ unsigned int max_query_length);
+} *thd_error_context_service;
+const char *thd_get_error_message(const void* thd);
+unsigned int thd_get_error_number(const void* thd);
+unsigned long thd_get_error_row(const void* thd);
+void thd_inc_error_row(void* thd);
+char *thd_get_error_context_description(void* thd,
+ char *buffer, unsigned int length,
+ unsigned int max_query_length);
+extern struct thd_rnd_service_st {
+ double (*thd_rnd_ptr)(void* thd);
+ void (*thd_c_r_p_ptr)(void* thd, char *to, size_t length);
+} *thd_rnd_service;
+double thd_rnd(void* thd);
+void thd_create_random_password(void* thd, char *to, size_t length);
+typedef int MYSQL_THD_KEY_T;
+extern struct thd_specifics_service_st {
+ int (*thd_key_create_func)(MYSQL_THD_KEY_T *key);
+ void (*thd_key_delete_func)(MYSQL_THD_KEY_T *key);
+ void *(*thd_getspecific_func)(void* thd, MYSQL_THD_KEY_T key);
+ int (*thd_setspecific_func)(void* thd, MYSQL_THD_KEY_T key, void *value);
+} *thd_specifics_service;
+int thd_key_create(MYSQL_THD_KEY_T *key);
+void thd_key_delete(MYSQL_THD_KEY_T *key);
+void* thd_getspecific(void* thd, MYSQL_THD_KEY_T key);
+int thd_setspecific(void* thd, MYSQL_THD_KEY_T key, void *value);
+typedef long my_time_t;
+enum enum_mysql_timestamp_type
+{
+ MYSQL_TIMESTAMP_NONE= -2, MYSQL_TIMESTAMP_ERROR= -1,
+ MYSQL_TIMESTAMP_DATE= 0, MYSQL_TIMESTAMP_DATETIME= 1, MYSQL_TIMESTAMP_TIME= 2
+};
+typedef struct st_mysql_time
+{
+ unsigned int year, month, day, hour, minute, second;
+ unsigned long second_part;
+ my_bool neg;
+ enum enum_mysql_timestamp_type time_type;
+} MYSQL_TIME;
+extern struct thd_timezone_service_st {
+ my_time_t (*thd_TIME_to_gmt_sec)(void* thd, const MYSQL_TIME *ltime, unsigned int *errcode);
+ void (*thd_gmt_sec_to_TIME)(void* thd, MYSQL_TIME *ltime, my_time_t t);
+} *thd_timezone_service;
+my_time_t thd_TIME_to_gmt_sec(void* thd, const MYSQL_TIME *ltime, unsigned int *errcode);
+void thd_gmt_sec_to_TIME(void* thd, MYSQL_TIME *ltime, my_time_t t);
+typedef enum _thd_wait_type_e {
+ THD_WAIT_SLEEP= 1,
+ THD_WAIT_DISKIO= 2,
+ THD_WAIT_ROW_LOCK= 3,
+ THD_WAIT_GLOBAL_LOCK= 4,
+ THD_WAIT_META_DATA_LOCK= 5,
+ THD_WAIT_TABLE_LOCK= 6,
+ THD_WAIT_USER_LOCK= 7,
+ THD_WAIT_BINLOG= 8,
+ THD_WAIT_GROUP_COMMIT= 9,
+ THD_WAIT_SYNC= 10,
+ THD_WAIT_NET= 11,
+ THD_WAIT_LAST= 12
+} thd_wait_type;
+extern struct thd_wait_service_st {
+ void (*thd_wait_begin_func)(void*, int);
+ void (*thd_wait_end_func)(void*);
+} *thd_wait_service;
+void thd_wait_begin(void* thd, int wait_type);
+void thd_wait_end(void* thd);
struct st_mysql_xid {
long formatID;
long gtrid_length;
diff --git a/include/mysql/plugin_auth.h b/include/mysql/plugin_auth.h
index d776ed79a61..807bfd4e652 100644
--- a/include/mysql/plugin_auth.h
+++ b/include/mysql/plugin_auth.h
@@ -27,7 +27,7 @@
#include <mysql/plugin.h>
-#define MYSQL_AUTHENTICATION_INTERFACE_VERSION 0x0200
+#define MYSQL_AUTHENTICATION_INTERFACE_VERSION 0x0201
#include <mysql/plugin_auth_common.h>
@@ -105,6 +105,11 @@ typedef struct st_mysql_server_auth_info
*/
unsigned int host_or_ip_length;
+ /**
+ Current THD pointer (to use with various services)
+ */
+ MYSQL_THD thd;
+
} MYSQL_SERVER_AUTH_INFO;
/**
diff --git a/include/mysql/plugin_auth.h.pp b/include/mysql/plugin_auth.h.pp
index 10cd10bf9c8..a9cb8044c4f 100644
--- a/include/mysql/plugin_auth.h.pp
+++ b/include/mysql/plugin_auth.h.pp
@@ -1,186 +1,22 @@
typedef char my_bool;
typedef void * MYSQL_PLUGIN;
-extern struct my_snprintf_service_st {
- size_t (*my_snprintf_type)(char*, size_t, const char*, ...);
- size_t (*my_vsnprintf_type)(char *, size_t, const char*, va_list);
-} *my_snprintf_service;
-size_t my_snprintf(char* to, size_t n, const char* fmt, ...);
-size_t my_vsnprintf(char *to, size_t n, const char* fmt, va_list ap);
-struct st_mysql_lex_string
-{
- char *str;
- size_t length;
-};
-typedef struct st_mysql_lex_string MYSQL_LEX_STRING;
-extern struct thd_alloc_service_st {
- void *(*thd_alloc_func)(void*, unsigned int);
- void *(*thd_calloc_func)(void*, unsigned int);
- char *(*thd_strdup_func)(void*, const char *);
- char *(*thd_strmake_func)(void*, const char *, unsigned int);
- void *(*thd_memdup_func)(void*, const void*, unsigned int);
- MYSQL_LEX_STRING *(*thd_make_lex_string_func)(void*, MYSQL_LEX_STRING *,
- const char *, unsigned int, int);
-} *thd_alloc_service;
-void *thd_alloc(void* thd, unsigned int size);
-void *thd_calloc(void* thd, unsigned int size);
-char *thd_strdup(void* thd, const char *str);
-char *thd_strmake(void* thd, const char *str, unsigned int size);
-void *thd_memdup(void* thd, const void* str, unsigned int size);
-MYSQL_LEX_STRING *thd_make_lex_string(void* thd, MYSQL_LEX_STRING *lex_str,
- const char *str, unsigned int size,
- int allocate_lex_string);
-typedef enum _thd_wait_type_e {
- THD_WAIT_SLEEP= 1,
- THD_WAIT_DISKIO= 2,
- THD_WAIT_ROW_LOCK= 3,
- THD_WAIT_GLOBAL_LOCK= 4,
- THD_WAIT_META_DATA_LOCK= 5,
- THD_WAIT_TABLE_LOCK= 6,
- THD_WAIT_USER_LOCK= 7,
- THD_WAIT_BINLOG= 8,
- THD_WAIT_GROUP_COMMIT= 9,
- THD_WAIT_SYNC= 10,
- THD_WAIT_NET= 11,
- THD_WAIT_LAST= 12
-} thd_wait_type;
-extern struct thd_wait_service_st {
- void (*thd_wait_begin_func)(void*, int);
- void (*thd_wait_end_func)(void*);
-} *thd_wait_service;
-void thd_wait_begin(void* thd, int wait_type);
-void thd_wait_end(void* thd);
-extern struct progress_report_service_st {
- void (*thd_progress_init_func)(void* thd, unsigned int max_stage);
- void (*thd_progress_report_func)(void* thd,
- unsigned long long progress,
- unsigned long long max_progress);
- void (*thd_progress_next_stage_func)(void* thd);
- void (*thd_progress_end_func)(void* thd);
- const char *(*set_thd_proc_info_func)(void*, const char *info,
- const char *func,
- const char *file,
- unsigned int line);
-} *progress_report_service;
-void thd_progress_init(void* thd, unsigned int max_stage);
-void thd_progress_report(void* thd,
- unsigned long long progress,
- unsigned long long max_progress);
-void thd_progress_next_stage(void* thd);
-void thd_progress_end(void* thd);
-const char *set_thd_proc_info(void*, const char * info, const char *func,
- const char *file, unsigned int line);
+extern struct base64_service_st {
+ int (*base64_needed_encoded_length_ptr)(int length_of_data);
+ int (*base64_encode_max_arg_length_ptr)(void);
+ int (*base64_needed_decoded_length_ptr)(int length_of_encoded_data);
+ int (*base64_decode_max_arg_length_ptr)();
+ int (*base64_encode_ptr)(const void *src, size_t src_len, char *dst);
+ int (*base64_decode_ptr)(const char *src, size_t src_len,
+ void *dst, const char **end_ptr, int flags);
+} *base64_service;
+int my_base64_needed_encoded_length(int length_of_data);
+int my_base64_encode_max_arg_length(void);
+int my_base64_needed_decoded_length(int length_of_encoded_data);
+int my_base64_decode_max_arg_length();
+int my_base64_encode(const void *src, size_t src_len, char *dst);
+int my_base64_decode(const char *src, size_t src_len,
+ void *dst, const char **end_ptr, int flags);
extern void (*debug_sync_C_callback_ptr)(void*, const char *, size_t);
-enum thd_kill_levels {
- THD_IS_NOT_KILLED=0,
- THD_ABORT_SOFTLY=50,
- THD_ABORT_ASAP=100,
-};
-extern struct kill_statement_service_st {
- enum thd_kill_levels (*thd_kill_level_func)(const void*);
-} *thd_kill_statement_service;
-enum thd_kill_levels thd_kill_level(const void*);
-typedef long my_time_t;
-enum enum_mysql_timestamp_type
-{
- MYSQL_TIMESTAMP_NONE= -2, MYSQL_TIMESTAMP_ERROR= -1,
- MYSQL_TIMESTAMP_DATE= 0, MYSQL_TIMESTAMP_DATETIME= 1, MYSQL_TIMESTAMP_TIME= 2
-};
-typedef struct st_mysql_time
-{
- unsigned int year, month, day, hour, minute, second;
- unsigned long second_part;
- my_bool neg;
- enum enum_mysql_timestamp_type time_type;
-} MYSQL_TIME;
-extern struct thd_timezone_service_st {
- my_time_t (*thd_TIME_to_gmt_sec)(void* thd, const MYSQL_TIME *ltime, unsigned int *errcode);
- void (*thd_gmt_sec_to_TIME)(void* thd, MYSQL_TIME *ltime, my_time_t t);
-} *thd_timezone_service;
-my_time_t thd_TIME_to_gmt_sec(void* thd, const MYSQL_TIME *ltime, unsigned int *errcode);
-void thd_gmt_sec_to_TIME(void* thd, MYSQL_TIME *ltime, my_time_t t);
-extern struct my_sha1_service_st {
- void (*my_sha1_type)(unsigned char*, const char*, size_t);
- void (*my_sha1_multi_type)(unsigned char*, ...);
- size_t (*my_sha1_context_size_type)();
- void (*my_sha1_init_type)(void *);
- void (*my_sha1_input_type)(void *, const unsigned char *, size_t);
- void (*my_sha1_result_type)(void *, unsigned char *);
-} *my_sha1_service;
-void my_sha1(unsigned char*, const char*, size_t);
-void my_sha1_multi(unsigned char*, ...);
-size_t my_sha1_context_size();
-void my_sha1_init(void *context);
-void my_sha1_input(void *context, const unsigned char *buf, size_t len);
-void my_sha1_result(void *context, unsigned char *digest);
-extern struct my_md5_service_st {
- void (*my_md5_type)(unsigned char*, const char*, size_t);
- void (*my_md5_multi_type)(unsigned char*, ...);
- size_t (*my_md5_context_size_type)();
- void (*my_md5_init_type)(void *);
- void (*my_md5_input_type)(void *, const unsigned char *, size_t);
- void (*my_md5_result_type)(void *, unsigned char *);
-} *my_md5_service;
-void my_md5(unsigned char*, const char*, size_t);
-void my_md5_multi(unsigned char*, ...);
-size_t my_md5_context_size();
-void my_md5_init(void *context);
-void my_md5_input(void *context, const unsigned char *buf, size_t len);
-void my_md5_result(void *context, unsigned char *digest);
-typedef struct logger_handle_st LOGGER_HANDLE;
-extern struct logger_service_st {
- void (*logger_init_mutexes)();
- LOGGER_HANDLE* (*open)(const char *path,
- unsigned long long size_limit,
- unsigned int rotations);
- int (*close)(LOGGER_HANDLE *log);
- int (*vprintf)(LOGGER_HANDLE *log, const char *fmt, va_list argptr);
- int (*printf)(LOGGER_HANDLE *log, const char *fmt, ...);
- int (*write)(LOGGER_HANDLE *log, const char *buffer, size_t size);
- int (*rotate)(LOGGER_HANDLE *log);
-} *logger_service;
- void logger_init_mutexes();
- LOGGER_HANDLE *logger_open(const char *path,
- unsigned long long size_limit,
- unsigned int rotations);
- int logger_close(LOGGER_HANDLE *log);
- int logger_vprintf(LOGGER_HANDLE *log, const char *fmt, va_list argptr);
- int logger_printf(LOGGER_HANDLE *log, const char *fmt, ...);
- int logger_write(LOGGER_HANDLE *log, const char *buffer, size_t size);
- int logger_rotate(LOGGER_HANDLE *log);
-extern struct thd_autoinc_service_st {
- void (*thd_get_autoinc_func)(const void* thd,
- unsigned long* off, unsigned long* inc);
-} *thd_autoinc_service;
-void thd_get_autoinc(const void* thd,
- unsigned long* off, unsigned long* inc);
-extern struct thd_error_context_service_st {
- const char *(*thd_get_error_message_func)(const void* thd);
- unsigned int (*thd_get_error_number_func)(const void* thd);
- unsigned long (*thd_get_error_row_func)(const void* thd);
- void (*thd_inc_error_row_func)(void* thd);
- char *(*thd_get_error_context_description_func)(void* thd,
- char *buffer,
- unsigned int length,
- unsigned int max_query_length);
-} *thd_error_context_service;
-const char *thd_get_error_message(const void* thd);
-unsigned int thd_get_error_number(const void* thd);
-unsigned long thd_get_error_row(const void* thd);
-void thd_inc_error_row(void* thd);
-char *thd_get_error_context_description(void* thd,
- char *buffer, unsigned int length,
- unsigned int max_query_length);
-typedef int MYSQL_THD_KEY_T;
-extern struct thd_specifics_service_st {
- int (*thd_key_create_func)(MYSQL_THD_KEY_T *key);
- void (*thd_key_delete_func)(MYSQL_THD_KEY_T *key);
- void *(*thd_getspecific_func)(void* thd, MYSQL_THD_KEY_T key);
- int (*thd_setspecific_func)(void* thd, MYSQL_THD_KEY_T key, void *value);
-} *thd_specifics_service;
-int thd_key_create(MYSQL_THD_KEY_T *key);
-void thd_key_delete(MYSQL_THD_KEY_T *key);
-void* thd_getspecific(void* thd, MYSQL_THD_KEY_T key);
-int thd_setspecific(void* thd, MYSQL_THD_KEY_T key, void *value);
struct encryption_service_st {
unsigned int (*encryption_key_get_latest_version_func)(unsigned int key_id);
unsigned int (*encryption_key_get_func)(unsigned int key_id, unsigned int key_version,
@@ -257,6 +93,242 @@ int encryption_scheme_decrypt(const unsigned char* src, unsigned int slen,
struct st_encryption_scheme *scheme,
unsigned int key_version, unsigned int i32_1,
unsigned int i32_2, unsigned long long i64);
+enum thd_kill_levels {
+ THD_IS_NOT_KILLED=0,
+ THD_ABORT_SOFTLY=50,
+ THD_ABORT_ASAP=100,
+};
+extern struct kill_statement_service_st {
+ enum thd_kill_levels (*thd_kill_level_func)(const void*);
+} *thd_kill_statement_service;
+enum thd_kill_levels thd_kill_level(const void*);
+typedef struct logger_handle_st LOGGER_HANDLE;
+extern struct logger_service_st {
+ void (*logger_init_mutexes)();
+ LOGGER_HANDLE* (*open)(const char *path,
+ unsigned long long size_limit,
+ unsigned int rotations);
+ int (*close)(LOGGER_HANDLE *log);
+ int (*vprintf)(LOGGER_HANDLE *log, const char *fmt, va_list argptr);
+ int (*printf)(LOGGER_HANDLE *log, const char *fmt, ...);
+ int (*write)(LOGGER_HANDLE *log, const char *buffer, size_t size);
+ int (*rotate)(LOGGER_HANDLE *log);
+} *logger_service;
+ void logger_init_mutexes();
+ LOGGER_HANDLE *logger_open(const char *path,
+ unsigned long long size_limit,
+ unsigned int rotations);
+ int logger_close(LOGGER_HANDLE *log);
+ int logger_vprintf(LOGGER_HANDLE *log, const char *fmt, va_list argptr);
+ int logger_printf(LOGGER_HANDLE *log, const char *fmt, ...);
+ int logger_write(LOGGER_HANDLE *log, const char *buffer, size_t size);
+ int logger_rotate(LOGGER_HANDLE *log);
+extern struct my_md5_service_st {
+ void (*my_md5_type)(unsigned char*, const char*, size_t);
+ void (*my_md5_multi_type)(unsigned char*, ...);
+ size_t (*my_md5_context_size_type)();
+ void (*my_md5_init_type)(void *);
+ void (*my_md5_input_type)(void *, const unsigned char *, size_t);
+ void (*my_md5_result_type)(void *, unsigned char *);
+} *my_md5_service;
+void my_md5(unsigned char*, const char*, size_t);
+void my_md5_multi(unsigned char*, ...);
+size_t my_md5_context_size();
+void my_md5_init(void *context);
+void my_md5_input(void *context, const unsigned char *buf, size_t len);
+void my_md5_result(void *context, unsigned char *digest);
+extern struct my_snprintf_service_st {
+ size_t (*my_snprintf_type)(char*, size_t, const char*, ...);
+ size_t (*my_vsnprintf_type)(char *, size_t, const char*, va_list);
+} *my_snprintf_service;
+size_t my_snprintf(char* to, size_t n, const char* fmt, ...);
+size_t my_vsnprintf(char *to, size_t n, const char* fmt, va_list ap);
+extern struct progress_report_service_st {
+ void (*thd_progress_init_func)(void* thd, unsigned int max_stage);
+ void (*thd_progress_report_func)(void* thd,
+ unsigned long long progress,
+ unsigned long long max_progress);
+ void (*thd_progress_next_stage_func)(void* thd);
+ void (*thd_progress_end_func)(void* thd);
+ const char *(*set_thd_proc_info_func)(void*, const char *info,
+ const char *func,
+ const char *file,
+ unsigned int line);
+} *progress_report_service;
+void thd_progress_init(void* thd, unsigned int max_stage);
+void thd_progress_report(void* thd,
+ unsigned long long progress,
+ unsigned long long max_progress);
+void thd_progress_next_stage(void* thd);
+void thd_progress_end(void* thd);
+const char *set_thd_proc_info(void*, const char * info, const char *func,
+ const char *file, unsigned int line);
+extern struct my_sha1_service_st {
+ void (*my_sha1_type)(unsigned char*, const char*, size_t);
+ void (*my_sha1_multi_type)(unsigned char*, ...);
+ size_t (*my_sha1_context_size_type)();
+ void (*my_sha1_init_type)(void *);
+ void (*my_sha1_input_type)(void *, const unsigned char *, size_t);
+ void (*my_sha1_result_type)(void *, unsigned char *);
+} *my_sha1_service;
+void my_sha1(unsigned char*, const char*, size_t);
+void my_sha1_multi(unsigned char*, ...);
+size_t my_sha1_context_size();
+void my_sha1_init(void *context);
+void my_sha1_input(void *context, const unsigned char *buf, size_t len);
+void my_sha1_result(void *context, unsigned char *digest);
+extern struct my_sha2_service_st {
+ void (*my_sha224_type)(unsigned char*, const char*, size_t);
+ void (*my_sha224_multi_type)(unsigned char*, ...);
+ size_t (*my_sha224_context_size_type)();
+ void (*my_sha224_init_type)(void *);
+ void (*my_sha224_input_type)(void *, const unsigned char *, size_t);
+ void (*my_sha224_result_type)(void *, unsigned char *);
+ void (*my_sha256_type)(unsigned char*, const char*, size_t);
+ void (*my_sha256_multi_type)(unsigned char*, ...);
+ size_t (*my_sha256_context_size_type)();
+ void (*my_sha256_init_type)(void *);
+ void (*my_sha256_input_type)(void *, const unsigned char *, size_t);
+ void (*my_sha256_result_type)(void *, unsigned char *);
+ void (*my_sha384_type)(unsigned char*, const char*, size_t);
+ void (*my_sha384_multi_type)(unsigned char*, ...);
+ size_t (*my_sha384_context_size_type)();
+ void (*my_sha384_init_type)(void *);
+ void (*my_sha384_input_type)(void *, const unsigned char *, size_t);
+ void (*my_sha384_result_type)(void *, unsigned char *);
+ void (*my_sha512_type)(unsigned char*, const char*, size_t);
+ void (*my_sha512_multi_type)(unsigned char*, ...);
+ size_t (*my_sha512_context_size_type)();
+ void (*my_sha512_init_type)(void *);
+ void (*my_sha512_input_type)(void *, const unsigned char *, size_t);
+ void (*my_sha512_result_type)(void *, unsigned char *);
+} *my_sha2_service;
+void my_sha224(unsigned char*, const char*, size_t);
+void my_sha224_multi(unsigned char*, ...);
+size_t my_sha224_context_size();
+void my_sha224_init(void *context);
+void my_sha224_input(void *context, const unsigned char *buf, size_t len);
+void my_sha224_result(void *context, unsigned char *digest);
+void my_sha256(unsigned char*, const char*, size_t);
+void my_sha256_multi(unsigned char*, ...);
+size_t my_sha256_context_size();
+void my_sha256_init(void *context);
+void my_sha256_input(void *context, const unsigned char *buf, size_t len);
+void my_sha256_result(void *context, unsigned char *digest);
+void my_sha384(unsigned char*, const char*, size_t);
+void my_sha384_multi(unsigned char*, ...);
+size_t my_sha384_context_size();
+void my_sha384_init(void *context);
+void my_sha384_input(void *context, const unsigned char *buf, size_t len);
+void my_sha384_result(void *context, unsigned char *digest);
+void my_sha512(unsigned char*, const char*, size_t);
+void my_sha512_multi(unsigned char*, ...);
+size_t my_sha512_context_size();
+void my_sha512_init(void *context);
+void my_sha512_input(void *context, const unsigned char *buf, size_t len);
+void my_sha512_result(void *context, unsigned char *digest);
+struct st_mysql_lex_string
+{
+ char *str;
+ size_t length;
+};
+typedef struct st_mysql_lex_string MYSQL_LEX_STRING;
+extern struct thd_alloc_service_st {
+ void *(*thd_alloc_func)(void*, unsigned int);
+ void *(*thd_calloc_func)(void*, unsigned int);
+ char *(*thd_strdup_func)(void*, const char *);
+ char *(*thd_strmake_func)(void*, const char *, unsigned int);
+ void *(*thd_memdup_func)(void*, const void*, unsigned int);
+ MYSQL_LEX_STRING *(*thd_make_lex_string_func)(void*, MYSQL_LEX_STRING *,
+ const char *, unsigned int, int);
+} *thd_alloc_service;
+void *thd_alloc(void* thd, unsigned int size);
+void *thd_calloc(void* thd, unsigned int size);
+char *thd_strdup(void* thd, const char *str);
+char *thd_strmake(void* thd, const char *str, unsigned int size);
+void *thd_memdup(void* thd, const void* str, unsigned int size);
+MYSQL_LEX_STRING *thd_make_lex_string(void* thd, MYSQL_LEX_STRING *lex_str,
+ const char *str, unsigned int size,
+ int allocate_lex_string);
+extern struct thd_autoinc_service_st {
+ void (*thd_get_autoinc_func)(const void* thd,
+ unsigned long* off, unsigned long* inc);
+} *thd_autoinc_service;
+void thd_get_autoinc(const void* thd,
+ unsigned long* off, unsigned long* inc);
+extern struct thd_error_context_service_st {
+ const char *(*thd_get_error_message_func)(const void* thd);
+ unsigned int (*thd_get_error_number_func)(const void* thd);
+ unsigned long (*thd_get_error_row_func)(const void* thd);
+ void (*thd_inc_error_row_func)(void* thd);
+ char *(*thd_get_error_context_description_func)(void* thd,
+ char *buffer,
+ unsigned int length,
+ unsigned int max_query_length);
+} *thd_error_context_service;
+const char *thd_get_error_message(const void* thd);
+unsigned int thd_get_error_number(const void* thd);
+unsigned long thd_get_error_row(const void* thd);
+void thd_inc_error_row(void* thd);
+char *thd_get_error_context_description(void* thd,
+ char *buffer, unsigned int length,
+ unsigned int max_query_length);
+extern struct thd_rnd_service_st {
+ double (*thd_rnd_ptr)(void* thd);
+ void (*thd_c_r_p_ptr)(void* thd, char *to, size_t length);
+} *thd_rnd_service;
+double thd_rnd(void* thd);
+void thd_create_random_password(void* thd, char *to, size_t length);
+typedef int MYSQL_THD_KEY_T;
+extern struct thd_specifics_service_st {
+ int (*thd_key_create_func)(MYSQL_THD_KEY_T *key);
+ void (*thd_key_delete_func)(MYSQL_THD_KEY_T *key);
+ void *(*thd_getspecific_func)(void* thd, MYSQL_THD_KEY_T key);
+ int (*thd_setspecific_func)(void* thd, MYSQL_THD_KEY_T key, void *value);
+} *thd_specifics_service;
+int thd_key_create(MYSQL_THD_KEY_T *key);
+void thd_key_delete(MYSQL_THD_KEY_T *key);
+void* thd_getspecific(void* thd, MYSQL_THD_KEY_T key);
+int thd_setspecific(void* thd, MYSQL_THD_KEY_T key, void *value);
+typedef long my_time_t;
+enum enum_mysql_timestamp_type
+{
+ MYSQL_TIMESTAMP_NONE= -2, MYSQL_TIMESTAMP_ERROR= -1,
+ MYSQL_TIMESTAMP_DATE= 0, MYSQL_TIMESTAMP_DATETIME= 1, MYSQL_TIMESTAMP_TIME= 2
+};
+typedef struct st_mysql_time
+{
+ unsigned int year, month, day, hour, minute, second;
+ unsigned long second_part;
+ my_bool neg;
+ enum enum_mysql_timestamp_type time_type;
+} MYSQL_TIME;
+extern struct thd_timezone_service_st {
+ my_time_t (*thd_TIME_to_gmt_sec)(void* thd, const MYSQL_TIME *ltime, unsigned int *errcode);
+ void (*thd_gmt_sec_to_TIME)(void* thd, MYSQL_TIME *ltime, my_time_t t);
+} *thd_timezone_service;
+my_time_t thd_TIME_to_gmt_sec(void* thd, const MYSQL_TIME *ltime, unsigned int *errcode);
+void thd_gmt_sec_to_TIME(void* thd, MYSQL_TIME *ltime, my_time_t t);
+typedef enum _thd_wait_type_e {
+ THD_WAIT_SLEEP= 1,
+ THD_WAIT_DISKIO= 2,
+ THD_WAIT_ROW_LOCK= 3,
+ THD_WAIT_GLOBAL_LOCK= 4,
+ THD_WAIT_META_DATA_LOCK= 5,
+ THD_WAIT_TABLE_LOCK= 6,
+ THD_WAIT_USER_LOCK= 7,
+ THD_WAIT_BINLOG= 8,
+ THD_WAIT_GROUP_COMMIT= 9,
+ THD_WAIT_SYNC= 10,
+ THD_WAIT_NET= 11,
+ THD_WAIT_LAST= 12
+} thd_wait_type;
+extern struct thd_wait_service_st {
+ void (*thd_wait_begin_func)(void*, int);
+ void (*thd_wait_end_func)(void*);
+} *thd_wait_service;
+void thd_wait_begin(void* thd, int wait_type);
+void thd_wait_end(void* thd);
struct st_mysql_xid {
long formatID;
long gtrid_length;
@@ -438,6 +510,7 @@ typedef struct st_mysql_server_auth_info
int password_used;
const char *host_or_ip;
unsigned int host_or_ip_length;
+ void* thd;
} MYSQL_SERVER_AUTH_INFO;
struct st_mysql_auth
{
diff --git a/include/mysql/plugin_encryption.h.pp b/include/mysql/plugin_encryption.h.pp
index 46d3c3d5a55..4675f0cf6ec 100644
--- a/include/mysql/plugin_encryption.h.pp
+++ b/include/mysql/plugin_encryption.h.pp
@@ -1,186 +1,22 @@
typedef char my_bool;
typedef void * MYSQL_PLUGIN;
-extern struct my_snprintf_service_st {
- size_t (*my_snprintf_type)(char*, size_t, const char*, ...);
- size_t (*my_vsnprintf_type)(char *, size_t, const char*, va_list);
-} *my_snprintf_service;
-size_t my_snprintf(char* to, size_t n, const char* fmt, ...);
-size_t my_vsnprintf(char *to, size_t n, const char* fmt, va_list ap);
-struct st_mysql_lex_string
-{
- char *str;
- size_t length;
-};
-typedef struct st_mysql_lex_string MYSQL_LEX_STRING;
-extern struct thd_alloc_service_st {
- void *(*thd_alloc_func)(void*, unsigned int);
- void *(*thd_calloc_func)(void*, unsigned int);
- char *(*thd_strdup_func)(void*, const char *);
- char *(*thd_strmake_func)(void*, const char *, unsigned int);
- void *(*thd_memdup_func)(void*, const void*, unsigned int);
- MYSQL_LEX_STRING *(*thd_make_lex_string_func)(void*, MYSQL_LEX_STRING *,
- const char *, unsigned int, int);
-} *thd_alloc_service;
-void *thd_alloc(void* thd, unsigned int size);
-void *thd_calloc(void* thd, unsigned int size);
-char *thd_strdup(void* thd, const char *str);
-char *thd_strmake(void* thd, const char *str, unsigned int size);
-void *thd_memdup(void* thd, const void* str, unsigned int size);
-MYSQL_LEX_STRING *thd_make_lex_string(void* thd, MYSQL_LEX_STRING *lex_str,
- const char *str, unsigned int size,
- int allocate_lex_string);
-typedef enum _thd_wait_type_e {
- THD_WAIT_SLEEP= 1,
- THD_WAIT_DISKIO= 2,
- THD_WAIT_ROW_LOCK= 3,
- THD_WAIT_GLOBAL_LOCK= 4,
- THD_WAIT_META_DATA_LOCK= 5,
- THD_WAIT_TABLE_LOCK= 6,
- THD_WAIT_USER_LOCK= 7,
- THD_WAIT_BINLOG= 8,
- THD_WAIT_GROUP_COMMIT= 9,
- THD_WAIT_SYNC= 10,
- THD_WAIT_NET= 11,
- THD_WAIT_LAST= 12
-} thd_wait_type;
-extern struct thd_wait_service_st {
- void (*thd_wait_begin_func)(void*, int);
- void (*thd_wait_end_func)(void*);
-} *thd_wait_service;
-void thd_wait_begin(void* thd, int wait_type);
-void thd_wait_end(void* thd);
-extern struct progress_report_service_st {
- void (*thd_progress_init_func)(void* thd, unsigned int max_stage);
- void (*thd_progress_report_func)(void* thd,
- unsigned long long progress,
- unsigned long long max_progress);
- void (*thd_progress_next_stage_func)(void* thd);
- void (*thd_progress_end_func)(void* thd);
- const char *(*set_thd_proc_info_func)(void*, const char *info,
- const char *func,
- const char *file,
- unsigned int line);
-} *progress_report_service;
-void thd_progress_init(void* thd, unsigned int max_stage);
-void thd_progress_report(void* thd,
- unsigned long long progress,
- unsigned long long max_progress);
-void thd_progress_next_stage(void* thd);
-void thd_progress_end(void* thd);
-const char *set_thd_proc_info(void*, const char * info, const char *func,
- const char *file, unsigned int line);
+extern struct base64_service_st {
+ int (*base64_needed_encoded_length_ptr)(int length_of_data);
+ int (*base64_encode_max_arg_length_ptr)(void);
+ int (*base64_needed_decoded_length_ptr)(int length_of_encoded_data);
+ int (*base64_decode_max_arg_length_ptr)();
+ int (*base64_encode_ptr)(const void *src, size_t src_len, char *dst);
+ int (*base64_decode_ptr)(const char *src, size_t src_len,
+ void *dst, const char **end_ptr, int flags);
+} *base64_service;
+int my_base64_needed_encoded_length(int length_of_data);
+int my_base64_encode_max_arg_length(void);
+int my_base64_needed_decoded_length(int length_of_encoded_data);
+int my_base64_decode_max_arg_length();
+int my_base64_encode(const void *src, size_t src_len, char *dst);
+int my_base64_decode(const char *src, size_t src_len,
+ void *dst, const char **end_ptr, int flags);
extern void (*debug_sync_C_callback_ptr)(void*, const char *, size_t);
-enum thd_kill_levels {
- THD_IS_NOT_KILLED=0,
- THD_ABORT_SOFTLY=50,
- THD_ABORT_ASAP=100,
-};
-extern struct kill_statement_service_st {
- enum thd_kill_levels (*thd_kill_level_func)(const void*);
-} *thd_kill_statement_service;
-enum thd_kill_levels thd_kill_level(const void*);
-typedef long my_time_t;
-enum enum_mysql_timestamp_type
-{
- MYSQL_TIMESTAMP_NONE= -2, MYSQL_TIMESTAMP_ERROR= -1,
- MYSQL_TIMESTAMP_DATE= 0, MYSQL_TIMESTAMP_DATETIME= 1, MYSQL_TIMESTAMP_TIME= 2
-};
-typedef struct st_mysql_time
-{
- unsigned int year, month, day, hour, minute, second;
- unsigned long second_part;
- my_bool neg;
- enum enum_mysql_timestamp_type time_type;
-} MYSQL_TIME;
-extern struct thd_timezone_service_st {
- my_time_t (*thd_TIME_to_gmt_sec)(void* thd, const MYSQL_TIME *ltime, unsigned int *errcode);
- void (*thd_gmt_sec_to_TIME)(void* thd, MYSQL_TIME *ltime, my_time_t t);
-} *thd_timezone_service;
-my_time_t thd_TIME_to_gmt_sec(void* thd, const MYSQL_TIME *ltime, unsigned int *errcode);
-void thd_gmt_sec_to_TIME(void* thd, MYSQL_TIME *ltime, my_time_t t);
-extern struct my_sha1_service_st {
- void (*my_sha1_type)(unsigned char*, const char*, size_t);
- void (*my_sha1_multi_type)(unsigned char*, ...);
- size_t (*my_sha1_context_size_type)();
- void (*my_sha1_init_type)(void *);
- void (*my_sha1_input_type)(void *, const unsigned char *, size_t);
- void (*my_sha1_result_type)(void *, unsigned char *);
-} *my_sha1_service;
-void my_sha1(unsigned char*, const char*, size_t);
-void my_sha1_multi(unsigned char*, ...);
-size_t my_sha1_context_size();
-void my_sha1_init(void *context);
-void my_sha1_input(void *context, const unsigned char *buf, size_t len);
-void my_sha1_result(void *context, unsigned char *digest);
-extern struct my_md5_service_st {
- void (*my_md5_type)(unsigned char*, const char*, size_t);
- void (*my_md5_multi_type)(unsigned char*, ...);
- size_t (*my_md5_context_size_type)();
- void (*my_md5_init_type)(void *);
- void (*my_md5_input_type)(void *, const unsigned char *, size_t);
- void (*my_md5_result_type)(void *, unsigned char *);
-} *my_md5_service;
-void my_md5(unsigned char*, const char*, size_t);
-void my_md5_multi(unsigned char*, ...);
-size_t my_md5_context_size();
-void my_md5_init(void *context);
-void my_md5_input(void *context, const unsigned char *buf, size_t len);
-void my_md5_result(void *context, unsigned char *digest);
-typedef struct logger_handle_st LOGGER_HANDLE;
-extern struct logger_service_st {
- void (*logger_init_mutexes)();
- LOGGER_HANDLE* (*open)(const char *path,
- unsigned long long size_limit,
- unsigned int rotations);
- int (*close)(LOGGER_HANDLE *log);
- int (*vprintf)(LOGGER_HANDLE *log, const char *fmt, va_list argptr);
- int (*printf)(LOGGER_HANDLE *log, const char *fmt, ...);
- int (*write)(LOGGER_HANDLE *log, const char *buffer, size_t size);
- int (*rotate)(LOGGER_HANDLE *log);
-} *logger_service;
- void logger_init_mutexes();
- LOGGER_HANDLE *logger_open(const char *path,
- unsigned long long size_limit,
- unsigned int rotations);
- int logger_close(LOGGER_HANDLE *log);
- int logger_vprintf(LOGGER_HANDLE *log, const char *fmt, va_list argptr);
- int logger_printf(LOGGER_HANDLE *log, const char *fmt, ...);
- int logger_write(LOGGER_HANDLE *log, const char *buffer, size_t size);
- int logger_rotate(LOGGER_HANDLE *log);
-extern struct thd_autoinc_service_st {
- void (*thd_get_autoinc_func)(const void* thd,
- unsigned long* off, unsigned long* inc);
-} *thd_autoinc_service;
-void thd_get_autoinc(const void* thd,
- unsigned long* off, unsigned long* inc);
-extern struct thd_error_context_service_st {
- const char *(*thd_get_error_message_func)(const void* thd);
- unsigned int (*thd_get_error_number_func)(const void* thd);
- unsigned long (*thd_get_error_row_func)(const void* thd);
- void (*thd_inc_error_row_func)(void* thd);
- char *(*thd_get_error_context_description_func)(void* thd,
- char *buffer,
- unsigned int length,
- unsigned int max_query_length);
-} *thd_error_context_service;
-const char *thd_get_error_message(const void* thd);
-unsigned int thd_get_error_number(const void* thd);
-unsigned long thd_get_error_row(const void* thd);
-void thd_inc_error_row(void* thd);
-char *thd_get_error_context_description(void* thd,
- char *buffer, unsigned int length,
- unsigned int max_query_length);
-typedef int MYSQL_THD_KEY_T;
-extern struct thd_specifics_service_st {
- int (*thd_key_create_func)(MYSQL_THD_KEY_T *key);
- void (*thd_key_delete_func)(MYSQL_THD_KEY_T *key);
- void *(*thd_getspecific_func)(void* thd, MYSQL_THD_KEY_T key);
- int (*thd_setspecific_func)(void* thd, MYSQL_THD_KEY_T key, void *value);
-} *thd_specifics_service;
-int thd_key_create(MYSQL_THD_KEY_T *key);
-void thd_key_delete(MYSQL_THD_KEY_T *key);
-void* thd_getspecific(void* thd, MYSQL_THD_KEY_T key);
-int thd_setspecific(void* thd, MYSQL_THD_KEY_T key, void *value);
struct encryption_service_st {
unsigned int (*encryption_key_get_latest_version_func)(unsigned int key_id);
unsigned int (*encryption_key_get_func)(unsigned int key_id, unsigned int key_version,
@@ -257,6 +93,242 @@ int encryption_scheme_decrypt(const unsigned char* src, unsigned int slen,
struct st_encryption_scheme *scheme,
unsigned int key_version, unsigned int i32_1,
unsigned int i32_2, unsigned long long i64);
+enum thd_kill_levels {
+ THD_IS_NOT_KILLED=0,
+ THD_ABORT_SOFTLY=50,
+ THD_ABORT_ASAP=100,
+};
+extern struct kill_statement_service_st {
+ enum thd_kill_levels (*thd_kill_level_func)(const void*);
+} *thd_kill_statement_service;
+enum thd_kill_levels thd_kill_level(const void*);
+typedef struct logger_handle_st LOGGER_HANDLE;
+extern struct logger_service_st {
+ void (*logger_init_mutexes)();
+ LOGGER_HANDLE* (*open)(const char *path,
+ unsigned long long size_limit,
+ unsigned int rotations);
+ int (*close)(LOGGER_HANDLE *log);
+ int (*vprintf)(LOGGER_HANDLE *log, const char *fmt, va_list argptr);
+ int (*printf)(LOGGER_HANDLE *log, const char *fmt, ...);
+ int (*write)(LOGGER_HANDLE *log, const char *buffer, size_t size);
+ int (*rotate)(LOGGER_HANDLE *log);
+} *logger_service;
+ void logger_init_mutexes();
+ LOGGER_HANDLE *logger_open(const char *path,
+ unsigned long long size_limit,
+ unsigned int rotations);
+ int logger_close(LOGGER_HANDLE *log);
+ int logger_vprintf(LOGGER_HANDLE *log, const char *fmt, va_list argptr);
+ int logger_printf(LOGGER_HANDLE *log, const char *fmt, ...);
+ int logger_write(LOGGER_HANDLE *log, const char *buffer, size_t size);
+ int logger_rotate(LOGGER_HANDLE *log);
+extern struct my_md5_service_st {
+ void (*my_md5_type)(unsigned char*, const char*, size_t);
+ void (*my_md5_multi_type)(unsigned char*, ...);
+ size_t (*my_md5_context_size_type)();
+ void (*my_md5_init_type)(void *);
+ void (*my_md5_input_type)(void *, const unsigned char *, size_t);
+ void (*my_md5_result_type)(void *, unsigned char *);
+} *my_md5_service;
+void my_md5(unsigned char*, const char*, size_t);
+void my_md5_multi(unsigned char*, ...);
+size_t my_md5_context_size();
+void my_md5_init(void *context);
+void my_md5_input(void *context, const unsigned char *buf, size_t len);
+void my_md5_result(void *context, unsigned char *digest);
+extern struct my_snprintf_service_st {
+ size_t (*my_snprintf_type)(char*, size_t, const char*, ...);
+ size_t (*my_vsnprintf_type)(char *, size_t, const char*, va_list);
+} *my_snprintf_service;
+size_t my_snprintf(char* to, size_t n, const char* fmt, ...);
+size_t my_vsnprintf(char *to, size_t n, const char* fmt, va_list ap);
+extern struct progress_report_service_st {
+ void (*thd_progress_init_func)(void* thd, unsigned int max_stage);
+ void (*thd_progress_report_func)(void* thd,
+ unsigned long long progress,
+ unsigned long long max_progress);
+ void (*thd_progress_next_stage_func)(void* thd);
+ void (*thd_progress_end_func)(void* thd);
+ const char *(*set_thd_proc_info_func)(void*, const char *info,
+ const char *func,
+ const char *file,
+ unsigned int line);
+} *progress_report_service;
+void thd_progress_init(void* thd, unsigned int max_stage);
+void thd_progress_report(void* thd,
+ unsigned long long progress,
+ unsigned long long max_progress);
+void thd_progress_next_stage(void* thd);
+void thd_progress_end(void* thd);
+const char *set_thd_proc_info(void*, const char * info, const char *func,
+ const char *file, unsigned int line);
+extern struct my_sha1_service_st {
+ void (*my_sha1_type)(unsigned char*, const char*, size_t);
+ void (*my_sha1_multi_type)(unsigned char*, ...);
+ size_t (*my_sha1_context_size_type)();
+ void (*my_sha1_init_type)(void *);
+ void (*my_sha1_input_type)(void *, const unsigned char *, size_t);
+ void (*my_sha1_result_type)(void *, unsigned char *);
+} *my_sha1_service;
+void my_sha1(unsigned char*, const char*, size_t);
+void my_sha1_multi(unsigned char*, ...);
+size_t my_sha1_context_size();
+void my_sha1_init(void *context);
+void my_sha1_input(void *context, const unsigned char *buf, size_t len);
+void my_sha1_result(void *context, unsigned char *digest);
+extern struct my_sha2_service_st {
+ void (*my_sha224_type)(unsigned char*, const char*, size_t);
+ void (*my_sha224_multi_type)(unsigned char*, ...);
+ size_t (*my_sha224_context_size_type)();
+ void (*my_sha224_init_type)(void *);
+ void (*my_sha224_input_type)(void *, const unsigned char *, size_t);
+ void (*my_sha224_result_type)(void *, unsigned char *);
+ void (*my_sha256_type)(unsigned char*, const char*, size_t);
+ void (*my_sha256_multi_type)(unsigned char*, ...);
+ size_t (*my_sha256_context_size_type)();
+ void (*my_sha256_init_type)(void *);
+ void (*my_sha256_input_type)(void *, const unsigned char *, size_t);
+ void (*my_sha256_result_type)(void *, unsigned char *);
+ void (*my_sha384_type)(unsigned char*, const char*, size_t);
+ void (*my_sha384_multi_type)(unsigned char*, ...);
+ size_t (*my_sha384_context_size_type)();
+ void (*my_sha384_init_type)(void *);
+ void (*my_sha384_input_type)(void *, const unsigned char *, size_t);
+ void (*my_sha384_result_type)(void *, unsigned char *);
+ void (*my_sha512_type)(unsigned char*, const char*, size_t);
+ void (*my_sha512_multi_type)(unsigned char*, ...);
+ size_t (*my_sha512_context_size_type)();
+ void (*my_sha512_init_type)(void *);
+ void (*my_sha512_input_type)(void *, const unsigned char *, size_t);
+ void (*my_sha512_result_type)(void *, unsigned char *);
+} *my_sha2_service;
+void my_sha224(unsigned char*, const char*, size_t);
+void my_sha224_multi(unsigned char*, ...);
+size_t my_sha224_context_size();
+void my_sha224_init(void *context);
+void my_sha224_input(void *context, const unsigned char *buf, size_t len);
+void my_sha224_result(void *context, unsigned char *digest);
+void my_sha256(unsigned char*, const char*, size_t);
+void my_sha256_multi(unsigned char*, ...);
+size_t my_sha256_context_size();
+void my_sha256_init(void *context);
+void my_sha256_input(void *context, const unsigned char *buf, size_t len);
+void my_sha256_result(void *context, unsigned char *digest);
+void my_sha384(unsigned char*, const char*, size_t);
+void my_sha384_multi(unsigned char*, ...);
+size_t my_sha384_context_size();
+void my_sha384_init(void *context);
+void my_sha384_input(void *context, const unsigned char *buf, size_t len);
+void my_sha384_result(void *context, unsigned char *digest);
+void my_sha512(unsigned char*, const char*, size_t);
+void my_sha512_multi(unsigned char*, ...);
+size_t my_sha512_context_size();
+void my_sha512_init(void *context);
+void my_sha512_input(void *context, const unsigned char *buf, size_t len);
+void my_sha512_result(void *context, unsigned char *digest);
+struct st_mysql_lex_string
+{
+ char *str;
+ size_t length;
+};
+typedef struct st_mysql_lex_string MYSQL_LEX_STRING;
+extern struct thd_alloc_service_st {
+ void *(*thd_alloc_func)(void*, unsigned int);
+ void *(*thd_calloc_func)(void*, unsigned int);
+ char *(*thd_strdup_func)(void*, const char *);
+ char *(*thd_strmake_func)(void*, const char *, unsigned int);
+ void *(*thd_memdup_func)(void*, const void*, unsigned int);
+ MYSQL_LEX_STRING *(*thd_make_lex_string_func)(void*, MYSQL_LEX_STRING *,
+ const char *, unsigned int, int);
+} *thd_alloc_service;
+void *thd_alloc(void* thd, unsigned int size);
+void *thd_calloc(void* thd, unsigned int size);
+char *thd_strdup(void* thd, const char *str);
+char *thd_strmake(void* thd, const char *str, unsigned int size);
+void *thd_memdup(void* thd, const void* str, unsigned int size);
+MYSQL_LEX_STRING *thd_make_lex_string(void* thd, MYSQL_LEX_STRING *lex_str,
+ const char *str, unsigned int size,
+ int allocate_lex_string);
+extern struct thd_autoinc_service_st {
+ void (*thd_get_autoinc_func)(const void* thd,
+ unsigned long* off, unsigned long* inc);
+} *thd_autoinc_service;
+void thd_get_autoinc(const void* thd,
+ unsigned long* off, unsigned long* inc);
+extern struct thd_error_context_service_st {
+ const char *(*thd_get_error_message_func)(const void* thd);
+ unsigned int (*thd_get_error_number_func)(const void* thd);
+ unsigned long (*thd_get_error_row_func)(const void* thd);
+ void (*thd_inc_error_row_func)(void* thd);
+ char *(*thd_get_error_context_description_func)(void* thd,
+ char *buffer,
+ unsigned int length,
+ unsigned int max_query_length);
+} *thd_error_context_service;
+const char *thd_get_error_message(const void* thd);
+unsigned int thd_get_error_number(const void* thd);
+unsigned long thd_get_error_row(const void* thd);
+void thd_inc_error_row(void* thd);
+char *thd_get_error_context_description(void* thd,
+ char *buffer, unsigned int length,
+ unsigned int max_query_length);
+extern struct thd_rnd_service_st {
+ double (*thd_rnd_ptr)(void* thd);
+ void (*thd_c_r_p_ptr)(void* thd, char *to, size_t length);
+} *thd_rnd_service;
+double thd_rnd(void* thd);
+void thd_create_random_password(void* thd, char *to, size_t length);
+typedef int MYSQL_THD_KEY_T;
+extern struct thd_specifics_service_st {
+ int (*thd_key_create_func)(MYSQL_THD_KEY_T *key);
+ void (*thd_key_delete_func)(MYSQL_THD_KEY_T *key);
+ void *(*thd_getspecific_func)(void* thd, MYSQL_THD_KEY_T key);
+ int (*thd_setspecific_func)(void* thd, MYSQL_THD_KEY_T key, void *value);
+} *thd_specifics_service;
+int thd_key_create(MYSQL_THD_KEY_T *key);
+void thd_key_delete(MYSQL_THD_KEY_T *key);
+void* thd_getspecific(void* thd, MYSQL_THD_KEY_T key);
+int thd_setspecific(void* thd, MYSQL_THD_KEY_T key, void *value);
+typedef long my_time_t;
+enum enum_mysql_timestamp_type
+{
+ MYSQL_TIMESTAMP_NONE= -2, MYSQL_TIMESTAMP_ERROR= -1,
+ MYSQL_TIMESTAMP_DATE= 0, MYSQL_TIMESTAMP_DATETIME= 1, MYSQL_TIMESTAMP_TIME= 2
+};
+typedef struct st_mysql_time
+{
+ unsigned int year, month, day, hour, minute, second;
+ unsigned long second_part;
+ my_bool neg;
+ enum enum_mysql_timestamp_type time_type;
+} MYSQL_TIME;
+extern struct thd_timezone_service_st {
+ my_time_t (*thd_TIME_to_gmt_sec)(void* thd, const MYSQL_TIME *ltime, unsigned int *errcode);
+ void (*thd_gmt_sec_to_TIME)(void* thd, MYSQL_TIME *ltime, my_time_t t);
+} *thd_timezone_service;
+my_time_t thd_TIME_to_gmt_sec(void* thd, const MYSQL_TIME *ltime, unsigned int *errcode);
+void thd_gmt_sec_to_TIME(void* thd, MYSQL_TIME *ltime, my_time_t t);
+typedef enum _thd_wait_type_e {
+ THD_WAIT_SLEEP= 1,
+ THD_WAIT_DISKIO= 2,
+ THD_WAIT_ROW_LOCK= 3,
+ THD_WAIT_GLOBAL_LOCK= 4,
+ THD_WAIT_META_DATA_LOCK= 5,
+ THD_WAIT_TABLE_LOCK= 6,
+ THD_WAIT_USER_LOCK= 7,
+ THD_WAIT_BINLOG= 8,
+ THD_WAIT_GROUP_COMMIT= 9,
+ THD_WAIT_SYNC= 10,
+ THD_WAIT_NET= 11,
+ THD_WAIT_LAST= 12
+} thd_wait_type;
+extern struct thd_wait_service_st {
+ void (*thd_wait_begin_func)(void*, int);
+ void (*thd_wait_end_func)(void*);
+} *thd_wait_service;
+void thd_wait_begin(void* thd, int wait_type);
+void thd_wait_end(void* thd);
struct st_mysql_xid {
long formatID;
long gtrid_length;
diff --git a/include/mysql/plugin_ftparser.h.pp b/include/mysql/plugin_ftparser.h.pp
index 17de800875e..34d968b60ab 100644
--- a/include/mysql/plugin_ftparser.h.pp
+++ b/include/mysql/plugin_ftparser.h.pp
@@ -1,186 +1,22 @@
typedef char my_bool;
typedef void * MYSQL_PLUGIN;
-extern struct my_snprintf_service_st {
- size_t (*my_snprintf_type)(char*, size_t, const char*, ...);
- size_t (*my_vsnprintf_type)(char *, size_t, const char*, va_list);
-} *my_snprintf_service;
-size_t my_snprintf(char* to, size_t n, const char* fmt, ...);
-size_t my_vsnprintf(char *to, size_t n, const char* fmt, va_list ap);
-struct st_mysql_lex_string
-{
- char *str;
- size_t length;
-};
-typedef struct st_mysql_lex_string MYSQL_LEX_STRING;
-extern struct thd_alloc_service_st {
- void *(*thd_alloc_func)(void*, unsigned int);
- void *(*thd_calloc_func)(void*, unsigned int);
- char *(*thd_strdup_func)(void*, const char *);
- char *(*thd_strmake_func)(void*, const char *, unsigned int);
- void *(*thd_memdup_func)(void*, const void*, unsigned int);
- MYSQL_LEX_STRING *(*thd_make_lex_string_func)(void*, MYSQL_LEX_STRING *,
- const char *, unsigned int, int);
-} *thd_alloc_service;
-void *thd_alloc(void* thd, unsigned int size);
-void *thd_calloc(void* thd, unsigned int size);
-char *thd_strdup(void* thd, const char *str);
-char *thd_strmake(void* thd, const char *str, unsigned int size);
-void *thd_memdup(void* thd, const void* str, unsigned int size);
-MYSQL_LEX_STRING *thd_make_lex_string(void* thd, MYSQL_LEX_STRING *lex_str,
- const char *str, unsigned int size,
- int allocate_lex_string);
-typedef enum _thd_wait_type_e {
- THD_WAIT_SLEEP= 1,
- THD_WAIT_DISKIO= 2,
- THD_WAIT_ROW_LOCK= 3,
- THD_WAIT_GLOBAL_LOCK= 4,
- THD_WAIT_META_DATA_LOCK= 5,
- THD_WAIT_TABLE_LOCK= 6,
- THD_WAIT_USER_LOCK= 7,
- THD_WAIT_BINLOG= 8,
- THD_WAIT_GROUP_COMMIT= 9,
- THD_WAIT_SYNC= 10,
- THD_WAIT_NET= 11,
- THD_WAIT_LAST= 12
-} thd_wait_type;
-extern struct thd_wait_service_st {
- void (*thd_wait_begin_func)(void*, int);
- void (*thd_wait_end_func)(void*);
-} *thd_wait_service;
-void thd_wait_begin(void* thd, int wait_type);
-void thd_wait_end(void* thd);
-extern struct progress_report_service_st {
- void (*thd_progress_init_func)(void* thd, unsigned int max_stage);
- void (*thd_progress_report_func)(void* thd,
- unsigned long long progress,
- unsigned long long max_progress);
- void (*thd_progress_next_stage_func)(void* thd);
- void (*thd_progress_end_func)(void* thd);
- const char *(*set_thd_proc_info_func)(void*, const char *info,
- const char *func,
- const char *file,
- unsigned int line);
-} *progress_report_service;
-void thd_progress_init(void* thd, unsigned int max_stage);
-void thd_progress_report(void* thd,
- unsigned long long progress,
- unsigned long long max_progress);
-void thd_progress_next_stage(void* thd);
-void thd_progress_end(void* thd);
-const char *set_thd_proc_info(void*, const char * info, const char *func,
- const char *file, unsigned int line);
+extern struct base64_service_st {
+ int (*base64_needed_encoded_length_ptr)(int length_of_data);
+ int (*base64_encode_max_arg_length_ptr)(void);
+ int (*base64_needed_decoded_length_ptr)(int length_of_encoded_data);
+ int (*base64_decode_max_arg_length_ptr)();
+ int (*base64_encode_ptr)(const void *src, size_t src_len, char *dst);
+ int (*base64_decode_ptr)(const char *src, size_t src_len,
+ void *dst, const char **end_ptr, int flags);
+} *base64_service;
+int my_base64_needed_encoded_length(int length_of_data);
+int my_base64_encode_max_arg_length(void);
+int my_base64_needed_decoded_length(int length_of_encoded_data);
+int my_base64_decode_max_arg_length();
+int my_base64_encode(const void *src, size_t src_len, char *dst);
+int my_base64_decode(const char *src, size_t src_len,
+ void *dst, const char **end_ptr, int flags);
extern void (*debug_sync_C_callback_ptr)(void*, const char *, size_t);
-enum thd_kill_levels {
- THD_IS_NOT_KILLED=0,
- THD_ABORT_SOFTLY=50,
- THD_ABORT_ASAP=100,
-};
-extern struct kill_statement_service_st {
- enum thd_kill_levels (*thd_kill_level_func)(const void*);
-} *thd_kill_statement_service;
-enum thd_kill_levels thd_kill_level(const void*);
-typedef long my_time_t;
-enum enum_mysql_timestamp_type
-{
- MYSQL_TIMESTAMP_NONE= -2, MYSQL_TIMESTAMP_ERROR= -1,
- MYSQL_TIMESTAMP_DATE= 0, MYSQL_TIMESTAMP_DATETIME= 1, MYSQL_TIMESTAMP_TIME= 2
-};
-typedef struct st_mysql_time
-{
- unsigned int year, month, day, hour, minute, second;
- unsigned long second_part;
- my_bool neg;
- enum enum_mysql_timestamp_type time_type;
-} MYSQL_TIME;
-extern struct thd_timezone_service_st {
- my_time_t (*thd_TIME_to_gmt_sec)(void* thd, const MYSQL_TIME *ltime, unsigned int *errcode);
- void (*thd_gmt_sec_to_TIME)(void* thd, MYSQL_TIME *ltime, my_time_t t);
-} *thd_timezone_service;
-my_time_t thd_TIME_to_gmt_sec(void* thd, const MYSQL_TIME *ltime, unsigned int *errcode);
-void thd_gmt_sec_to_TIME(void* thd, MYSQL_TIME *ltime, my_time_t t);
-extern struct my_sha1_service_st {
- void (*my_sha1_type)(unsigned char*, const char*, size_t);
- void (*my_sha1_multi_type)(unsigned char*, ...);
- size_t (*my_sha1_context_size_type)();
- void (*my_sha1_init_type)(void *);
- void (*my_sha1_input_type)(void *, const unsigned char *, size_t);
- void (*my_sha1_result_type)(void *, unsigned char *);
-} *my_sha1_service;
-void my_sha1(unsigned char*, const char*, size_t);
-void my_sha1_multi(unsigned char*, ...);
-size_t my_sha1_context_size();
-void my_sha1_init(void *context);
-void my_sha1_input(void *context, const unsigned char *buf, size_t len);
-void my_sha1_result(void *context, unsigned char *digest);
-extern struct my_md5_service_st {
- void (*my_md5_type)(unsigned char*, const char*, size_t);
- void (*my_md5_multi_type)(unsigned char*, ...);
- size_t (*my_md5_context_size_type)();
- void (*my_md5_init_type)(void *);
- void (*my_md5_input_type)(void *, const unsigned char *, size_t);
- void (*my_md5_result_type)(void *, unsigned char *);
-} *my_md5_service;
-void my_md5(unsigned char*, const char*, size_t);
-void my_md5_multi(unsigned char*, ...);
-size_t my_md5_context_size();
-void my_md5_init(void *context);
-void my_md5_input(void *context, const unsigned char *buf, size_t len);
-void my_md5_result(void *context, unsigned char *digest);
-typedef struct logger_handle_st LOGGER_HANDLE;
-extern struct logger_service_st {
- void (*logger_init_mutexes)();
- LOGGER_HANDLE* (*open)(const char *path,
- unsigned long long size_limit,
- unsigned int rotations);
- int (*close)(LOGGER_HANDLE *log);
- int (*vprintf)(LOGGER_HANDLE *log, const char *fmt, va_list argptr);
- int (*printf)(LOGGER_HANDLE *log, const char *fmt, ...);
- int (*write)(LOGGER_HANDLE *log, const char *buffer, size_t size);
- int (*rotate)(LOGGER_HANDLE *log);
-} *logger_service;
- void logger_init_mutexes();
- LOGGER_HANDLE *logger_open(const char *path,
- unsigned long long size_limit,
- unsigned int rotations);
- int logger_close(LOGGER_HANDLE *log);
- int logger_vprintf(LOGGER_HANDLE *log, const char *fmt, va_list argptr);
- int logger_printf(LOGGER_HANDLE *log, const char *fmt, ...);
- int logger_write(LOGGER_HANDLE *log, const char *buffer, size_t size);
- int logger_rotate(LOGGER_HANDLE *log);
-extern struct thd_autoinc_service_st {
- void (*thd_get_autoinc_func)(const void* thd,
- unsigned long* off, unsigned long* inc);
-} *thd_autoinc_service;
-void thd_get_autoinc(const void* thd,
- unsigned long* off, unsigned long* inc);
-extern struct thd_error_context_service_st {
- const char *(*thd_get_error_message_func)(const void* thd);
- unsigned int (*thd_get_error_number_func)(const void* thd);
- unsigned long (*thd_get_error_row_func)(const void* thd);
- void (*thd_inc_error_row_func)(void* thd);
- char *(*thd_get_error_context_description_func)(void* thd,
- char *buffer,
- unsigned int length,
- unsigned int max_query_length);
-} *thd_error_context_service;
-const char *thd_get_error_message(const void* thd);
-unsigned int thd_get_error_number(const void* thd);
-unsigned long thd_get_error_row(const void* thd);
-void thd_inc_error_row(void* thd);
-char *thd_get_error_context_description(void* thd,
- char *buffer, unsigned int length,
- unsigned int max_query_length);
-typedef int MYSQL_THD_KEY_T;
-extern struct thd_specifics_service_st {
- int (*thd_key_create_func)(MYSQL_THD_KEY_T *key);
- void (*thd_key_delete_func)(MYSQL_THD_KEY_T *key);
- void *(*thd_getspecific_func)(void* thd, MYSQL_THD_KEY_T key);
- int (*thd_setspecific_func)(void* thd, MYSQL_THD_KEY_T key, void *value);
-} *thd_specifics_service;
-int thd_key_create(MYSQL_THD_KEY_T *key);
-void thd_key_delete(MYSQL_THD_KEY_T *key);
-void* thd_getspecific(void* thd, MYSQL_THD_KEY_T key);
-int thd_setspecific(void* thd, MYSQL_THD_KEY_T key, void *value);
struct encryption_service_st {
unsigned int (*encryption_key_get_latest_version_func)(unsigned int key_id);
unsigned int (*encryption_key_get_func)(unsigned int key_id, unsigned int key_version,
@@ -257,6 +93,242 @@ int encryption_scheme_decrypt(const unsigned char* src, unsigned int slen,
struct st_encryption_scheme *scheme,
unsigned int key_version, unsigned int i32_1,
unsigned int i32_2, unsigned long long i64);
+enum thd_kill_levels {
+ THD_IS_NOT_KILLED=0,
+ THD_ABORT_SOFTLY=50,
+ THD_ABORT_ASAP=100,
+};
+extern struct kill_statement_service_st {
+ enum thd_kill_levels (*thd_kill_level_func)(const void*);
+} *thd_kill_statement_service;
+enum thd_kill_levels thd_kill_level(const void*);
+typedef struct logger_handle_st LOGGER_HANDLE;
+extern struct logger_service_st {
+ void (*logger_init_mutexes)();
+ LOGGER_HANDLE* (*open)(const char *path,
+ unsigned long long size_limit,
+ unsigned int rotations);
+ int (*close)(LOGGER_HANDLE *log);
+ int (*vprintf)(LOGGER_HANDLE *log, const char *fmt, va_list argptr);
+ int (*printf)(LOGGER_HANDLE *log, const char *fmt, ...);
+ int (*write)(LOGGER_HANDLE *log, const char *buffer, size_t size);
+ int (*rotate)(LOGGER_HANDLE *log);
+} *logger_service;
+ void logger_init_mutexes();
+ LOGGER_HANDLE *logger_open(const char *path,
+ unsigned long long size_limit,
+ unsigned int rotations);
+ int logger_close(LOGGER_HANDLE *log);
+ int logger_vprintf(LOGGER_HANDLE *log, const char *fmt, va_list argptr);
+ int logger_printf(LOGGER_HANDLE *log, const char *fmt, ...);
+ int logger_write(LOGGER_HANDLE *log, const char *buffer, size_t size);
+ int logger_rotate(LOGGER_HANDLE *log);
+extern struct my_md5_service_st {
+ void (*my_md5_type)(unsigned char*, const char*, size_t);
+ void (*my_md5_multi_type)(unsigned char*, ...);
+ size_t (*my_md5_context_size_type)();
+ void (*my_md5_init_type)(void *);
+ void (*my_md5_input_type)(void *, const unsigned char *, size_t);
+ void (*my_md5_result_type)(void *, unsigned char *);
+} *my_md5_service;
+void my_md5(unsigned char*, const char*, size_t);
+void my_md5_multi(unsigned char*, ...);
+size_t my_md5_context_size();
+void my_md5_init(void *context);
+void my_md5_input(void *context, const unsigned char *buf, size_t len);
+void my_md5_result(void *context, unsigned char *digest);
+extern struct my_snprintf_service_st {
+ size_t (*my_snprintf_type)(char*, size_t, const char*, ...);
+ size_t (*my_vsnprintf_type)(char *, size_t, const char*, va_list);
+} *my_snprintf_service;
+size_t my_snprintf(char* to, size_t n, const char* fmt, ...);
+size_t my_vsnprintf(char *to, size_t n, const char* fmt, va_list ap);
+extern struct progress_report_service_st {
+ void (*thd_progress_init_func)(void* thd, unsigned int max_stage);
+ void (*thd_progress_report_func)(void* thd,
+ unsigned long long progress,
+ unsigned long long max_progress);
+ void (*thd_progress_next_stage_func)(void* thd);
+ void (*thd_progress_end_func)(void* thd);
+ const char *(*set_thd_proc_info_func)(void*, const char *info,
+ const char *func,
+ const char *file,
+ unsigned int line);
+} *progress_report_service;
+void thd_progress_init(void* thd, unsigned int max_stage);
+void thd_progress_report(void* thd,
+ unsigned long long progress,
+ unsigned long long max_progress);
+void thd_progress_next_stage(void* thd);
+void thd_progress_end(void* thd);
+const char *set_thd_proc_info(void*, const char * info, const char *func,
+ const char *file, unsigned int line);
+extern struct my_sha1_service_st {
+ void (*my_sha1_type)(unsigned char*, const char*, size_t);
+ void (*my_sha1_multi_type)(unsigned char*, ...);
+ size_t (*my_sha1_context_size_type)();
+ void (*my_sha1_init_type)(void *);
+ void (*my_sha1_input_type)(void *, const unsigned char *, size_t);
+ void (*my_sha1_result_type)(void *, unsigned char *);
+} *my_sha1_service;
+void my_sha1(unsigned char*, const char*, size_t);
+void my_sha1_multi(unsigned char*, ...);
+size_t my_sha1_context_size();
+void my_sha1_init(void *context);
+void my_sha1_input(void *context, const unsigned char *buf, size_t len);
+void my_sha1_result(void *context, unsigned char *digest);
+extern struct my_sha2_service_st {
+ void (*my_sha224_type)(unsigned char*, const char*, size_t);
+ void (*my_sha224_multi_type)(unsigned char*, ...);
+ size_t (*my_sha224_context_size_type)();
+ void (*my_sha224_init_type)(void *);
+ void (*my_sha224_input_type)(void *, const unsigned char *, size_t);
+ void (*my_sha224_result_type)(void *, unsigned char *);
+ void (*my_sha256_type)(unsigned char*, const char*, size_t);
+ void (*my_sha256_multi_type)(unsigned char*, ...);
+ size_t (*my_sha256_context_size_type)();
+ void (*my_sha256_init_type)(void *);
+ void (*my_sha256_input_type)(void *, const unsigned char *, size_t);
+ void (*my_sha256_result_type)(void *, unsigned char *);
+ void (*my_sha384_type)(unsigned char*, const char*, size_t);
+ void (*my_sha384_multi_type)(unsigned char*, ...);
+ size_t (*my_sha384_context_size_type)();
+ void (*my_sha384_init_type)(void *);
+ void (*my_sha384_input_type)(void *, const unsigned char *, size_t);
+ void (*my_sha384_result_type)(void *, unsigned char *);
+ void (*my_sha512_type)(unsigned char*, const char*, size_t);
+ void (*my_sha512_multi_type)(unsigned char*, ...);
+ size_t (*my_sha512_context_size_type)();
+ void (*my_sha512_init_type)(void *);
+ void (*my_sha512_input_type)(void *, const unsigned char *, size_t);
+ void (*my_sha512_result_type)(void *, unsigned char *);
+} *my_sha2_service;
+void my_sha224(unsigned char*, const char*, size_t);
+void my_sha224_multi(unsigned char*, ...);
+size_t my_sha224_context_size();
+void my_sha224_init(void *context);
+void my_sha224_input(void *context, const unsigned char *buf, size_t len);
+void my_sha224_result(void *context, unsigned char *digest);
+void my_sha256(unsigned char*, const char*, size_t);
+void my_sha256_multi(unsigned char*, ...);
+size_t my_sha256_context_size();
+void my_sha256_init(void *context);
+void my_sha256_input(void *context, const unsigned char *buf, size_t len);
+void my_sha256_result(void *context, unsigned char *digest);
+void my_sha384(unsigned char*, const char*, size_t);
+void my_sha384_multi(unsigned char*, ...);
+size_t my_sha384_context_size();
+void my_sha384_init(void *context);
+void my_sha384_input(void *context, const unsigned char *buf, size_t len);
+void my_sha384_result(void *context, unsigned char *digest);
+void my_sha512(unsigned char*, const char*, size_t);
+void my_sha512_multi(unsigned char*, ...);
+size_t my_sha512_context_size();
+void my_sha512_init(void *context);
+void my_sha512_input(void *context, const unsigned char *buf, size_t len);
+void my_sha512_result(void *context, unsigned char *digest);
+struct st_mysql_lex_string
+{
+ char *str;
+ size_t length;
+};
+typedef struct st_mysql_lex_string MYSQL_LEX_STRING;
+extern struct thd_alloc_service_st {
+ void *(*thd_alloc_func)(void*, unsigned int);
+ void *(*thd_calloc_func)(void*, unsigned int);
+ char *(*thd_strdup_func)(void*, const char *);
+ char *(*thd_strmake_func)(void*, const char *, unsigned int);
+ void *(*thd_memdup_func)(void*, const void*, unsigned int);
+ MYSQL_LEX_STRING *(*thd_make_lex_string_func)(void*, MYSQL_LEX_STRING *,
+ const char *, unsigned int, int);
+} *thd_alloc_service;
+void *thd_alloc(void* thd, unsigned int size);
+void *thd_calloc(void* thd, unsigned int size);
+char *thd_strdup(void* thd, const char *str);
+char *thd_strmake(void* thd, const char *str, unsigned int size);
+void *thd_memdup(void* thd, const void* str, unsigned int size);
+MYSQL_LEX_STRING *thd_make_lex_string(void* thd, MYSQL_LEX_STRING *lex_str,
+ const char *str, unsigned int size,
+ int allocate_lex_string);
+extern struct thd_autoinc_service_st {
+ void (*thd_get_autoinc_func)(const void* thd,
+ unsigned long* off, unsigned long* inc);
+} *thd_autoinc_service;
+void thd_get_autoinc(const void* thd,
+ unsigned long* off, unsigned long* inc);
+extern struct thd_error_context_service_st {
+ const char *(*thd_get_error_message_func)(const void* thd);
+ unsigned int (*thd_get_error_number_func)(const void* thd);
+ unsigned long (*thd_get_error_row_func)(const void* thd);
+ void (*thd_inc_error_row_func)(void* thd);
+ char *(*thd_get_error_context_description_func)(void* thd,
+ char *buffer,
+ unsigned int length,
+ unsigned int max_query_length);
+} *thd_error_context_service;
+const char *thd_get_error_message(const void* thd);
+unsigned int thd_get_error_number(const void* thd);
+unsigned long thd_get_error_row(const void* thd);
+void thd_inc_error_row(void* thd);
+char *thd_get_error_context_description(void* thd,
+ char *buffer, unsigned int length,
+ unsigned int max_query_length);
+extern struct thd_rnd_service_st {
+ double (*thd_rnd_ptr)(void* thd);
+ void (*thd_c_r_p_ptr)(void* thd, char *to, size_t length);
+} *thd_rnd_service;
+double thd_rnd(void* thd);
+void thd_create_random_password(void* thd, char *to, size_t length);
+typedef int MYSQL_THD_KEY_T;
+extern struct thd_specifics_service_st {
+ int (*thd_key_create_func)(MYSQL_THD_KEY_T *key);
+ void (*thd_key_delete_func)(MYSQL_THD_KEY_T *key);
+ void *(*thd_getspecific_func)(void* thd, MYSQL_THD_KEY_T key);
+ int (*thd_setspecific_func)(void* thd, MYSQL_THD_KEY_T key, void *value);
+} *thd_specifics_service;
+int thd_key_create(MYSQL_THD_KEY_T *key);
+void thd_key_delete(MYSQL_THD_KEY_T *key);
+void* thd_getspecific(void* thd, MYSQL_THD_KEY_T key);
+int thd_setspecific(void* thd, MYSQL_THD_KEY_T key, void *value);
+typedef long my_time_t;
+enum enum_mysql_timestamp_type
+{
+ MYSQL_TIMESTAMP_NONE= -2, MYSQL_TIMESTAMP_ERROR= -1,
+ MYSQL_TIMESTAMP_DATE= 0, MYSQL_TIMESTAMP_DATETIME= 1, MYSQL_TIMESTAMP_TIME= 2
+};
+typedef struct st_mysql_time
+{
+ unsigned int year, month, day, hour, minute, second;
+ unsigned long second_part;
+ my_bool neg;
+ enum enum_mysql_timestamp_type time_type;
+} MYSQL_TIME;
+extern struct thd_timezone_service_st {
+ my_time_t (*thd_TIME_to_gmt_sec)(void* thd, const MYSQL_TIME *ltime, unsigned int *errcode);
+ void (*thd_gmt_sec_to_TIME)(void* thd, MYSQL_TIME *ltime, my_time_t t);
+} *thd_timezone_service;
+my_time_t thd_TIME_to_gmt_sec(void* thd, const MYSQL_TIME *ltime, unsigned int *errcode);
+void thd_gmt_sec_to_TIME(void* thd, MYSQL_TIME *ltime, my_time_t t);
+typedef enum _thd_wait_type_e {
+ THD_WAIT_SLEEP= 1,
+ THD_WAIT_DISKIO= 2,
+ THD_WAIT_ROW_LOCK= 3,
+ THD_WAIT_GLOBAL_LOCK= 4,
+ THD_WAIT_META_DATA_LOCK= 5,
+ THD_WAIT_TABLE_LOCK= 6,
+ THD_WAIT_USER_LOCK= 7,
+ THD_WAIT_BINLOG= 8,
+ THD_WAIT_GROUP_COMMIT= 9,
+ THD_WAIT_SYNC= 10,
+ THD_WAIT_NET= 11,
+ THD_WAIT_LAST= 12
+} thd_wait_type;
+extern struct thd_wait_service_st {
+ void (*thd_wait_begin_func)(void*, int);
+ void (*thd_wait_end_func)(void*);
+} *thd_wait_service;
+void thd_wait_begin(void* thd, int wait_type);
+void thd_wait_end(void* thd);
struct st_mysql_xid {
long formatID;
long gtrid_length;
diff --git a/include/mysql/plugin_password_validation.h.pp b/include/mysql/plugin_password_validation.h.pp
index 1abdbd30f57..5a642a55d08 100644
--- a/include/mysql/plugin_password_validation.h.pp
+++ b/include/mysql/plugin_password_validation.h.pp
@@ -1,186 +1,22 @@
typedef char my_bool;
typedef void * MYSQL_PLUGIN;
-extern struct my_snprintf_service_st {
- size_t (*my_snprintf_type)(char*, size_t, const char*, ...);
- size_t (*my_vsnprintf_type)(char *, size_t, const char*, va_list);
-} *my_snprintf_service;
-size_t my_snprintf(char* to, size_t n, const char* fmt, ...);
-size_t my_vsnprintf(char *to, size_t n, const char* fmt, va_list ap);
-struct st_mysql_lex_string
-{
- char *str;
- size_t length;
-};
-typedef struct st_mysql_lex_string MYSQL_LEX_STRING;
-extern struct thd_alloc_service_st {
- void *(*thd_alloc_func)(void*, unsigned int);
- void *(*thd_calloc_func)(void*, unsigned int);
- char *(*thd_strdup_func)(void*, const char *);
- char *(*thd_strmake_func)(void*, const char *, unsigned int);
- void *(*thd_memdup_func)(void*, const void*, unsigned int);
- MYSQL_LEX_STRING *(*thd_make_lex_string_func)(void*, MYSQL_LEX_STRING *,
- const char *, unsigned int, int);
-} *thd_alloc_service;
-void *thd_alloc(void* thd, unsigned int size);
-void *thd_calloc(void* thd, unsigned int size);
-char *thd_strdup(void* thd, const char *str);
-char *thd_strmake(void* thd, const char *str, unsigned int size);
-void *thd_memdup(void* thd, const void* str, unsigned int size);
-MYSQL_LEX_STRING *thd_make_lex_string(void* thd, MYSQL_LEX_STRING *lex_str,
- const char *str, unsigned int size,
- int allocate_lex_string);
-typedef enum _thd_wait_type_e {
- THD_WAIT_SLEEP= 1,
- THD_WAIT_DISKIO= 2,
- THD_WAIT_ROW_LOCK= 3,
- THD_WAIT_GLOBAL_LOCK= 4,
- THD_WAIT_META_DATA_LOCK= 5,
- THD_WAIT_TABLE_LOCK= 6,
- THD_WAIT_USER_LOCK= 7,
- THD_WAIT_BINLOG= 8,
- THD_WAIT_GROUP_COMMIT= 9,
- THD_WAIT_SYNC= 10,
- THD_WAIT_NET= 11,
- THD_WAIT_LAST= 12
-} thd_wait_type;
-extern struct thd_wait_service_st {
- void (*thd_wait_begin_func)(void*, int);
- void (*thd_wait_end_func)(void*);
-} *thd_wait_service;
-void thd_wait_begin(void* thd, int wait_type);
-void thd_wait_end(void* thd);
-extern struct progress_report_service_st {
- void (*thd_progress_init_func)(void* thd, unsigned int max_stage);
- void (*thd_progress_report_func)(void* thd,
- unsigned long long progress,
- unsigned long long max_progress);
- void (*thd_progress_next_stage_func)(void* thd);
- void (*thd_progress_end_func)(void* thd);
- const char *(*set_thd_proc_info_func)(void*, const char *info,
- const char *func,
- const char *file,
- unsigned int line);
-} *progress_report_service;
-void thd_progress_init(void* thd, unsigned int max_stage);
-void thd_progress_report(void* thd,
- unsigned long long progress,
- unsigned long long max_progress);
-void thd_progress_next_stage(void* thd);
-void thd_progress_end(void* thd);
-const char *set_thd_proc_info(void*, const char * info, const char *func,
- const char *file, unsigned int line);
+extern struct base64_service_st {
+ int (*base64_needed_encoded_length_ptr)(int length_of_data);
+ int (*base64_encode_max_arg_length_ptr)(void);
+ int (*base64_needed_decoded_length_ptr)(int length_of_encoded_data);
+ int (*base64_decode_max_arg_length_ptr)();
+ int (*base64_encode_ptr)(const void *src, size_t src_len, char *dst);
+ int (*base64_decode_ptr)(const char *src, size_t src_len,
+ void *dst, const char **end_ptr, int flags);
+} *base64_service;
+int my_base64_needed_encoded_length(int length_of_data);
+int my_base64_encode_max_arg_length(void);
+int my_base64_needed_decoded_length(int length_of_encoded_data);
+int my_base64_decode_max_arg_length();
+int my_base64_encode(const void *src, size_t src_len, char *dst);
+int my_base64_decode(const char *src, size_t src_len,
+ void *dst, const char **end_ptr, int flags);
extern void (*debug_sync_C_callback_ptr)(void*, const char *, size_t);
-enum thd_kill_levels {
- THD_IS_NOT_KILLED=0,
- THD_ABORT_SOFTLY=50,
- THD_ABORT_ASAP=100,
-};
-extern struct kill_statement_service_st {
- enum thd_kill_levels (*thd_kill_level_func)(const void*);
-} *thd_kill_statement_service;
-enum thd_kill_levels thd_kill_level(const void*);
-typedef long my_time_t;
-enum enum_mysql_timestamp_type
-{
- MYSQL_TIMESTAMP_NONE= -2, MYSQL_TIMESTAMP_ERROR= -1,
- MYSQL_TIMESTAMP_DATE= 0, MYSQL_TIMESTAMP_DATETIME= 1, MYSQL_TIMESTAMP_TIME= 2
-};
-typedef struct st_mysql_time
-{
- unsigned int year, month, day, hour, minute, second;
- unsigned long second_part;
- my_bool neg;
- enum enum_mysql_timestamp_type time_type;
-} MYSQL_TIME;
-extern struct thd_timezone_service_st {
- my_time_t (*thd_TIME_to_gmt_sec)(void* thd, const MYSQL_TIME *ltime, unsigned int *errcode);
- void (*thd_gmt_sec_to_TIME)(void* thd, MYSQL_TIME *ltime, my_time_t t);
-} *thd_timezone_service;
-my_time_t thd_TIME_to_gmt_sec(void* thd, const MYSQL_TIME *ltime, unsigned int *errcode);
-void thd_gmt_sec_to_TIME(void* thd, MYSQL_TIME *ltime, my_time_t t);
-extern struct my_sha1_service_st {
- void (*my_sha1_type)(unsigned char*, const char*, size_t);
- void (*my_sha1_multi_type)(unsigned char*, ...);
- size_t (*my_sha1_context_size_type)();
- void (*my_sha1_init_type)(void *);
- void (*my_sha1_input_type)(void *, const unsigned char *, size_t);
- void (*my_sha1_result_type)(void *, unsigned char *);
-} *my_sha1_service;
-void my_sha1(unsigned char*, const char*, size_t);
-void my_sha1_multi(unsigned char*, ...);
-size_t my_sha1_context_size();
-void my_sha1_init(void *context);
-void my_sha1_input(void *context, const unsigned char *buf, size_t len);
-void my_sha1_result(void *context, unsigned char *digest);
-extern struct my_md5_service_st {
- void (*my_md5_type)(unsigned char*, const char*, size_t);
- void (*my_md5_multi_type)(unsigned char*, ...);
- size_t (*my_md5_context_size_type)();
- void (*my_md5_init_type)(void *);
- void (*my_md5_input_type)(void *, const unsigned char *, size_t);
- void (*my_md5_result_type)(void *, unsigned char *);
-} *my_md5_service;
-void my_md5(unsigned char*, const char*, size_t);
-void my_md5_multi(unsigned char*, ...);
-size_t my_md5_context_size();
-void my_md5_init(void *context);
-void my_md5_input(void *context, const unsigned char *buf, size_t len);
-void my_md5_result(void *context, unsigned char *digest);
-typedef struct logger_handle_st LOGGER_HANDLE;
-extern struct logger_service_st {
- void (*logger_init_mutexes)();
- LOGGER_HANDLE* (*open)(const char *path,
- unsigned long long size_limit,
- unsigned int rotations);
- int (*close)(LOGGER_HANDLE *log);
- int (*vprintf)(LOGGER_HANDLE *log, const char *fmt, va_list argptr);
- int (*printf)(LOGGER_HANDLE *log, const char *fmt, ...);
- int (*write)(LOGGER_HANDLE *log, const char *buffer, size_t size);
- int (*rotate)(LOGGER_HANDLE *log);
-} *logger_service;
- void logger_init_mutexes();
- LOGGER_HANDLE *logger_open(const char *path,
- unsigned long long size_limit,
- unsigned int rotations);
- int logger_close(LOGGER_HANDLE *log);
- int logger_vprintf(LOGGER_HANDLE *log, const char *fmt, va_list argptr);
- int logger_printf(LOGGER_HANDLE *log, const char *fmt, ...);
- int logger_write(LOGGER_HANDLE *log, const char *buffer, size_t size);
- int logger_rotate(LOGGER_HANDLE *log);
-extern struct thd_autoinc_service_st {
- void (*thd_get_autoinc_func)(const void* thd,
- unsigned long* off, unsigned long* inc);
-} *thd_autoinc_service;
-void thd_get_autoinc(const void* thd,
- unsigned long* off, unsigned long* inc);
-extern struct thd_error_context_service_st {
- const char *(*thd_get_error_message_func)(const void* thd);
- unsigned int (*thd_get_error_number_func)(const void* thd);
- unsigned long (*thd_get_error_row_func)(const void* thd);
- void (*thd_inc_error_row_func)(void* thd);
- char *(*thd_get_error_context_description_func)(void* thd,
- char *buffer,
- unsigned int length,
- unsigned int max_query_length);
-} *thd_error_context_service;
-const char *thd_get_error_message(const void* thd);
-unsigned int thd_get_error_number(const void* thd);
-unsigned long thd_get_error_row(const void* thd);
-void thd_inc_error_row(void* thd);
-char *thd_get_error_context_description(void* thd,
- char *buffer, unsigned int length,
- unsigned int max_query_length);
-typedef int MYSQL_THD_KEY_T;
-extern struct thd_specifics_service_st {
- int (*thd_key_create_func)(MYSQL_THD_KEY_T *key);
- void (*thd_key_delete_func)(MYSQL_THD_KEY_T *key);
- void *(*thd_getspecific_func)(void* thd, MYSQL_THD_KEY_T key);
- int (*thd_setspecific_func)(void* thd, MYSQL_THD_KEY_T key, void *value);
-} *thd_specifics_service;
-int thd_key_create(MYSQL_THD_KEY_T *key);
-void thd_key_delete(MYSQL_THD_KEY_T *key);
-void* thd_getspecific(void* thd, MYSQL_THD_KEY_T key);
-int thd_setspecific(void* thd, MYSQL_THD_KEY_T key, void *value);
struct encryption_service_st {
unsigned int (*encryption_key_get_latest_version_func)(unsigned int key_id);
unsigned int (*encryption_key_get_func)(unsigned int key_id, unsigned int key_version,
@@ -257,6 +93,242 @@ int encryption_scheme_decrypt(const unsigned char* src, unsigned int slen,
struct st_encryption_scheme *scheme,
unsigned int key_version, unsigned int i32_1,
unsigned int i32_2, unsigned long long i64);
+enum thd_kill_levels {
+ THD_IS_NOT_KILLED=0,
+ THD_ABORT_SOFTLY=50,
+ THD_ABORT_ASAP=100,
+};
+extern struct kill_statement_service_st {
+ enum thd_kill_levels (*thd_kill_level_func)(const void*);
+} *thd_kill_statement_service;
+enum thd_kill_levels thd_kill_level(const void*);
+typedef struct logger_handle_st LOGGER_HANDLE;
+extern struct logger_service_st {
+ void (*logger_init_mutexes)();
+ LOGGER_HANDLE* (*open)(const char *path,
+ unsigned long long size_limit,
+ unsigned int rotations);
+ int (*close)(LOGGER_HANDLE *log);
+ int (*vprintf)(LOGGER_HANDLE *log, const char *fmt, va_list argptr);
+ int (*printf)(LOGGER_HANDLE *log, const char *fmt, ...);
+ int (*write)(LOGGER_HANDLE *log, const char *buffer, size_t size);
+ int (*rotate)(LOGGER_HANDLE *log);
+} *logger_service;
+ void logger_init_mutexes();
+ LOGGER_HANDLE *logger_open(const char *path,
+ unsigned long long size_limit,
+ unsigned int rotations);
+ int logger_close(LOGGER_HANDLE *log);
+ int logger_vprintf(LOGGER_HANDLE *log, const char *fmt, va_list argptr);
+ int logger_printf(LOGGER_HANDLE *log, const char *fmt, ...);
+ int logger_write(LOGGER_HANDLE *log, const char *buffer, size_t size);
+ int logger_rotate(LOGGER_HANDLE *log);
+extern struct my_md5_service_st {
+ void (*my_md5_type)(unsigned char*, const char*, size_t);
+ void (*my_md5_multi_type)(unsigned char*, ...);
+ size_t (*my_md5_context_size_type)();
+ void (*my_md5_init_type)(void *);
+ void (*my_md5_input_type)(void *, const unsigned char *, size_t);
+ void (*my_md5_result_type)(void *, unsigned char *);
+} *my_md5_service;
+void my_md5(unsigned char*, const char*, size_t);
+void my_md5_multi(unsigned char*, ...);
+size_t my_md5_context_size();
+void my_md5_init(void *context);
+void my_md5_input(void *context, const unsigned char *buf, size_t len);
+void my_md5_result(void *context, unsigned char *digest);
+extern struct my_snprintf_service_st {
+ size_t (*my_snprintf_type)(char*, size_t, const char*, ...);
+ size_t (*my_vsnprintf_type)(char *, size_t, const char*, va_list);
+} *my_snprintf_service;
+size_t my_snprintf(char* to, size_t n, const char* fmt, ...);
+size_t my_vsnprintf(char *to, size_t n, const char* fmt, va_list ap);
+extern struct progress_report_service_st {
+ void (*thd_progress_init_func)(void* thd, unsigned int max_stage);
+ void (*thd_progress_report_func)(void* thd,
+ unsigned long long progress,
+ unsigned long long max_progress);
+ void (*thd_progress_next_stage_func)(void* thd);
+ void (*thd_progress_end_func)(void* thd);
+ const char *(*set_thd_proc_info_func)(void*, const char *info,
+ const char *func,
+ const char *file,
+ unsigned int line);
+} *progress_report_service;
+void thd_progress_init(void* thd, unsigned int max_stage);
+void thd_progress_report(void* thd,
+ unsigned long long progress,
+ unsigned long long max_progress);
+void thd_progress_next_stage(void* thd);
+void thd_progress_end(void* thd);
+const char *set_thd_proc_info(void*, const char * info, const char *func,
+ const char *file, unsigned int line);
+extern struct my_sha1_service_st {
+ void (*my_sha1_type)(unsigned char*, const char*, size_t);
+ void (*my_sha1_multi_type)(unsigned char*, ...);
+ size_t (*my_sha1_context_size_type)();
+ void (*my_sha1_init_type)(void *);
+ void (*my_sha1_input_type)(void *, const unsigned char *, size_t);
+ void (*my_sha1_result_type)(void *, unsigned char *);
+} *my_sha1_service;
+void my_sha1(unsigned char*, const char*, size_t);
+void my_sha1_multi(unsigned char*, ...);
+size_t my_sha1_context_size();
+void my_sha1_init(void *context);
+void my_sha1_input(void *context, const unsigned char *buf, size_t len);
+void my_sha1_result(void *context, unsigned char *digest);
+extern struct my_sha2_service_st {
+ void (*my_sha224_type)(unsigned char*, const char*, size_t);
+ void (*my_sha224_multi_type)(unsigned char*, ...);
+ size_t (*my_sha224_context_size_type)();
+ void (*my_sha224_init_type)(void *);
+ void (*my_sha224_input_type)(void *, const unsigned char *, size_t);
+ void (*my_sha224_result_type)(void *, unsigned char *);
+ void (*my_sha256_type)(unsigned char*, const char*, size_t);
+ void (*my_sha256_multi_type)(unsigned char*, ...);
+ size_t (*my_sha256_context_size_type)();
+ void (*my_sha256_init_type)(void *);
+ void (*my_sha256_input_type)(void *, const unsigned char *, size_t);
+ void (*my_sha256_result_type)(void *, unsigned char *);
+ void (*my_sha384_type)(unsigned char*, const char*, size_t);
+ void (*my_sha384_multi_type)(unsigned char*, ...);
+ size_t (*my_sha384_context_size_type)();
+ void (*my_sha384_init_type)(void *);
+ void (*my_sha384_input_type)(void *, const unsigned char *, size_t);
+ void (*my_sha384_result_type)(void *, unsigned char *);
+ void (*my_sha512_type)(unsigned char*, const char*, size_t);
+ void (*my_sha512_multi_type)(unsigned char*, ...);
+ size_t (*my_sha512_context_size_type)();
+ void (*my_sha512_init_type)(void *);
+ void (*my_sha512_input_type)(void *, const unsigned char *, size_t);
+ void (*my_sha512_result_type)(void *, unsigned char *);
+} *my_sha2_service;
+void my_sha224(unsigned char*, const char*, size_t);
+void my_sha224_multi(unsigned char*, ...);
+size_t my_sha224_context_size();
+void my_sha224_init(void *context);
+void my_sha224_input(void *context, const unsigned char *buf, size_t len);
+void my_sha224_result(void *context, unsigned char *digest);
+void my_sha256(unsigned char*, const char*, size_t);
+void my_sha256_multi(unsigned char*, ...);
+size_t my_sha256_context_size();
+void my_sha256_init(void *context);
+void my_sha256_input(void *context, const unsigned char *buf, size_t len);
+void my_sha256_result(void *context, unsigned char *digest);
+void my_sha384(unsigned char*, const char*, size_t);
+void my_sha384_multi(unsigned char*, ...);
+size_t my_sha384_context_size();
+void my_sha384_init(void *context);
+void my_sha384_input(void *context, const unsigned char *buf, size_t len);
+void my_sha384_result(void *context, unsigned char *digest);
+void my_sha512(unsigned char*, const char*, size_t);
+void my_sha512_multi(unsigned char*, ...);
+size_t my_sha512_context_size();
+void my_sha512_init(void *context);
+void my_sha512_input(void *context, const unsigned char *buf, size_t len);
+void my_sha512_result(void *context, unsigned char *digest);
+struct st_mysql_lex_string
+{
+ char *str;
+ size_t length;
+};
+typedef struct st_mysql_lex_string MYSQL_LEX_STRING;
+extern struct thd_alloc_service_st {
+ void *(*thd_alloc_func)(void*, unsigned int);
+ void *(*thd_calloc_func)(void*, unsigned int);
+ char *(*thd_strdup_func)(void*, const char *);
+ char *(*thd_strmake_func)(void*, const char *, unsigned int);
+ void *(*thd_memdup_func)(void*, const void*, unsigned int);
+ MYSQL_LEX_STRING *(*thd_make_lex_string_func)(void*, MYSQL_LEX_STRING *,
+ const char *, unsigned int, int);
+} *thd_alloc_service;
+void *thd_alloc(void* thd, unsigned int size);
+void *thd_calloc(void* thd, unsigned int size);
+char *thd_strdup(void* thd, const char *str);
+char *thd_strmake(void* thd, const char *str, unsigned int size);
+void *thd_memdup(void* thd, const void* str, unsigned int size);
+MYSQL_LEX_STRING *thd_make_lex_string(void* thd, MYSQL_LEX_STRING *lex_str,
+ const char *str, unsigned int size,
+ int allocate_lex_string);
+extern struct thd_autoinc_service_st {
+ void (*thd_get_autoinc_func)(const void* thd,
+ unsigned long* off, unsigned long* inc);
+} *thd_autoinc_service;
+void thd_get_autoinc(const void* thd,
+ unsigned long* off, unsigned long* inc);
+extern struct thd_error_context_service_st {
+ const char *(*thd_get_error_message_func)(const void* thd);
+ unsigned int (*thd_get_error_number_func)(const void* thd);
+ unsigned long (*thd_get_error_row_func)(const void* thd);
+ void (*thd_inc_error_row_func)(void* thd);
+ char *(*thd_get_error_context_description_func)(void* thd,
+ char *buffer,
+ unsigned int length,
+ unsigned int max_query_length);
+} *thd_error_context_service;
+const char *thd_get_error_message(const void* thd);
+unsigned int thd_get_error_number(const void* thd);
+unsigned long thd_get_error_row(const void* thd);
+void thd_inc_error_row(void* thd);
+char *thd_get_error_context_description(void* thd,
+ char *buffer, unsigned int length,
+ unsigned int max_query_length);
+extern struct thd_rnd_service_st {
+ double (*thd_rnd_ptr)(void* thd);
+ void (*thd_c_r_p_ptr)(void* thd, char *to, size_t length);
+} *thd_rnd_service;
+double thd_rnd(void* thd);
+void thd_create_random_password(void* thd, char *to, size_t length);
+typedef int MYSQL_THD_KEY_T;
+extern struct thd_specifics_service_st {
+ int (*thd_key_create_func)(MYSQL_THD_KEY_T *key);
+ void (*thd_key_delete_func)(MYSQL_THD_KEY_T *key);
+ void *(*thd_getspecific_func)(void* thd, MYSQL_THD_KEY_T key);
+ int (*thd_setspecific_func)(void* thd, MYSQL_THD_KEY_T key, void *value);
+} *thd_specifics_service;
+int thd_key_create(MYSQL_THD_KEY_T *key);
+void thd_key_delete(MYSQL_THD_KEY_T *key);
+void* thd_getspecific(void* thd, MYSQL_THD_KEY_T key);
+int thd_setspecific(void* thd, MYSQL_THD_KEY_T key, void *value);
+typedef long my_time_t;
+enum enum_mysql_timestamp_type
+{
+ MYSQL_TIMESTAMP_NONE= -2, MYSQL_TIMESTAMP_ERROR= -1,
+ MYSQL_TIMESTAMP_DATE= 0, MYSQL_TIMESTAMP_DATETIME= 1, MYSQL_TIMESTAMP_TIME= 2
+};
+typedef struct st_mysql_time
+{
+ unsigned int year, month, day, hour, minute, second;
+ unsigned long second_part;
+ my_bool neg;
+ enum enum_mysql_timestamp_type time_type;
+} MYSQL_TIME;
+extern struct thd_timezone_service_st {
+ my_time_t (*thd_TIME_to_gmt_sec)(void* thd, const MYSQL_TIME *ltime, unsigned int *errcode);
+ void (*thd_gmt_sec_to_TIME)(void* thd, MYSQL_TIME *ltime, my_time_t t);
+} *thd_timezone_service;
+my_time_t thd_TIME_to_gmt_sec(void* thd, const MYSQL_TIME *ltime, unsigned int *errcode);
+void thd_gmt_sec_to_TIME(void* thd, MYSQL_TIME *ltime, my_time_t t);
+typedef enum _thd_wait_type_e {
+ THD_WAIT_SLEEP= 1,
+ THD_WAIT_DISKIO= 2,
+ THD_WAIT_ROW_LOCK= 3,
+ THD_WAIT_GLOBAL_LOCK= 4,
+ THD_WAIT_META_DATA_LOCK= 5,
+ THD_WAIT_TABLE_LOCK= 6,
+ THD_WAIT_USER_LOCK= 7,
+ THD_WAIT_BINLOG= 8,
+ THD_WAIT_GROUP_COMMIT= 9,
+ THD_WAIT_SYNC= 10,
+ THD_WAIT_NET= 11,
+ THD_WAIT_LAST= 12
+} thd_wait_type;
+extern struct thd_wait_service_st {
+ void (*thd_wait_begin_func)(void*, int);
+ void (*thd_wait_end_func)(void*);
+} *thd_wait_service;
+void thd_wait_begin(void* thd, int wait_type);
+void thd_wait_end(void* thd);
struct st_mysql_xid {
long formatID;
long gtrid_length;
diff --git a/include/mysql/psi/mysql_file.h b/include/mysql/psi/mysql_file.h
index c839b2b019b..2f388c285bf 100644
--- a/include/mysql/psi/mysql_file.h
+++ b/include/mysql/psi/mysql_file.h
@@ -442,17 +442,17 @@
#endif
/**
- @def mysql_file_delete_with_symlink(K, P1, P2)
+ @def mysql_file_delete_with_symlink(K, P1, P2, P3)
Instrumented delete with symbolic link.
@c mysql_file_delete_with_symlink is a replacement
- for @c my_delete_with_symlink.
+ for @c my_handler_delete_with_symlink.
*/
#ifdef HAVE_PSI_FILE_INTERFACE
- #define mysql_file_delete_with_symlink(K, P1, P2) \
- inline_mysql_file_delete_with_symlink(K, __FILE__, __LINE__, P1, P2)
+ #define mysql_file_delete_with_symlink(K, P1, P2, P3) \
+ inline_mysql_file_delete_with_symlink(K, __FILE__, __LINE__, P1, P2, P3)
#else
- #define mysql_file_delete_with_symlink(K, P1, P2) \
- inline_mysql_file_delete_with_symlink(P1, P2)
+ #define mysql_file_delete_with_symlink(K, P1, P2, P3) \
+ inline_mysql_file_delete_with_symlink(P1, P2, P3)
#endif
/**
@@ -1308,6 +1308,7 @@ inline_mysql_file_rename(
return result;
}
+
static inline File
inline_mysql_file_create_with_symlink(
#ifdef HAVE_PSI_FILE_INTERFACE
@@ -1337,32 +1338,36 @@ inline_mysql_file_create_with_symlink(
return file;
}
+
static inline int
inline_mysql_file_delete_with_symlink(
#ifdef HAVE_PSI_FILE_INTERFACE
PSI_file_key key, const char *src_file, uint src_line,
#endif
- const char *name, myf flags)
+ const char *name, const char *ext, myf flags)
{
int result;
+ char buf[FN_REFLEN];
+ char *fullname= fn_format(buf, name, "", ext, MY_UNPACK_FILENAME | MY_APPEND_EXT);
#ifdef HAVE_PSI_FILE_INTERFACE
struct PSI_file_locker *locker;
PSI_file_locker_state state;
locker= PSI_FILE_CALL(get_thread_file_name_locker)
- (&state, key, PSI_FILE_DELETE, name, &locker);
+ (&state, key, PSI_FILE_DELETE, fullname, &locker);
if (likely(locker != NULL))
{
PSI_FILE_CALL(start_file_close_wait)(locker, src_file, src_line);
- result= my_delete_with_symlink(name, flags);
+ result= my_handler_delete_with_symlink(fullname, flags);
PSI_FILE_CALL(end_file_close_wait)(locker, result);
return result;
}
#endif
- result= my_delete_with_symlink(name, flags);
+ result= my_handler_delete_with_symlink(fullname, flags);
return result;
}
+
static inline int
inline_mysql_file_rename_with_symlink(
#ifdef HAVE_PSI_FILE_INTERFACE
diff --git a/include/mysql/psi/psi.h b/include/mysql/psi/psi.h
index 7fcff89c8b6..3f43445e08a 100644
--- a/include/mysql/psi/psi.h
+++ b/include/mysql/psi/psi.h
@@ -417,7 +417,7 @@ enum PSI_file_operation
PSI_FILE_FSTAT= 12,
/** File chsize, as in @c my_chsize(). */
PSI_FILE_CHSIZE= 13,
- /** File delete, such as @c my_delete() or @c my_delete_with_symlink(). */
+ /** File delete, such as @c my_delete() or @c my_handler_delete_with_symlink(). */
PSI_FILE_DELETE= 14,
/** File rename, such as @c my_rename() or @c my_rename_with_symlink(). */
PSI_FILE_RENAME= 15,
diff --git a/include/mysql/service_base64.h b/include/mysql/service_base64.h
new file mode 100644
index 00000000000..b4914d2c3c0
--- /dev/null
+++ b/include/mysql/service_base64.h
@@ -0,0 +1,82 @@
+#ifndef MYSQL_SERVICE_BASE64_INCLUDED
+/* Copyright (c) 2017, MariaDB
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+/**
+ @file
+ my base64 service
+
+ Functions for base64 en- and decoding
+*/
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef MYSQL_ABI_CHECK
+#include <stdlib.h>
+#endif
+
+/* Allow multuple chunks 'AAA= AA== AA==', binlog uses this */
+#define MY_BASE64_DECODE_ALLOW_MULTIPLE_CHUNKS 1
+
+extern struct base64_service_st {
+ int (*base64_needed_encoded_length_ptr)(int length_of_data);
+ int (*base64_encode_max_arg_length_ptr)(void);
+ int (*base64_needed_decoded_length_ptr)(int length_of_encoded_data);
+ int (*base64_decode_max_arg_length_ptr)();
+ int (*base64_encode_ptr)(const void *src, size_t src_len, char *dst);
+ int (*base64_decode_ptr)(const char *src, size_t src_len,
+ void *dst, const char **end_ptr, int flags);
+} *base64_service;
+
+#ifdef MYSQL_DYNAMIC_PLUGIN
+
+#define my_base64_needed_encoded_length(A) base64_service->base64_needed_encoded_length_ptr(A)
+#define my_base64_encode_max_arg_length() base64_service->base64_encode_max_arg_length_ptr()
+#define my_base64_needed_decoded_length(A) base64_service->base64_needed_decoded_length_ptr(A)
+#define my_base64_decode_max_arg_length() base64_service->base64_decode_max_arg_length_ptr()
+#define my_base64_encode(A,B,C) base64_service->base64_encode_ptr(A,B,C)
+#define my_base64_decode(A,B,C,D,E) base64_service->base64_decode_ptr(A,B,C,D,E)
+
+#else
+
+/* Calculate how much memory needed for dst of my_base64_encode() */
+int my_base64_needed_encoded_length(int length_of_data);
+
+/* Maximum length my_base64_encode_needed_length() can accept with no overflow. */
+int my_base64_encode_max_arg_length(void);
+
+/* Calculate how much memory needed for dst of my_base64_decode() */
+int my_base64_needed_decoded_length(int length_of_encoded_data);
+
+/* Maximum length my_base64_decode_needed_length() can accept with no overflow. */
+int my_base64_decode_max_arg_length();
+
+/* Encode data as a my_base64 string */
+int my_base64_encode(const void *src, size_t src_len, char *dst);
+
+/* Decode a my_base64 string into data */
+int my_base64_decode(const char *src, size_t src_len,
+ void *dst, const char **end_ptr, int flags);
+
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#define MYSQL_SERVICE_BASE64_INCLUDED
+#endif
diff --git a/include/mysql/service_logger.h b/include/mysql/service_logger.h
index d14b28da712..aa2c1b335e3 100644
--- a/include/mysql/service_logger.h
+++ b/include/mysql/service_logger.h
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#ifndef MYSQL_SERVICE_LOGGER_INCLUDED
#define MYSQL_SERVICE_LOGGER_INCLUDED
diff --git a/include/mysql/service_progress_report.h b/include/mysql/service_progress_report.h
index 7ec3aa4c946..fc935b6bd0c 100644
--- a/include/mysql/service_progress_report.h
+++ b/include/mysql/service_progress_report.h
@@ -12,7 +12,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
/**
@file
diff --git a/include/mysql/service_sha2.h b/include/mysql/service_sha2.h
new file mode 100644
index 00000000000..ee4975f7f24
--- /dev/null
+++ b/include/mysql/service_sha2.h
@@ -0,0 +1,130 @@
+#ifndef MYSQL_SERVICE_SHA2_INCLUDED
+/* Copyright (c) 2017, MariaDB
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+/**
+ @file
+ my sha2 service
+
+ Functions to calculate SHA2 hash from a memory buffer
+*/
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef MYSQL_ABI_CHECK
+#include <stdlib.h>
+#endif
+
+extern struct my_sha2_service_st {
+ void (*my_sha224_type)(unsigned char*, const char*, size_t);
+ void (*my_sha224_multi_type)(unsigned char*, ...);
+ size_t (*my_sha224_context_size_type)();
+ void (*my_sha224_init_type)(void *);
+ void (*my_sha224_input_type)(void *, const unsigned char *, size_t);
+ void (*my_sha224_result_type)(void *, unsigned char *);
+
+ void (*my_sha256_type)(unsigned char*, const char*, size_t);
+ void (*my_sha256_multi_type)(unsigned char*, ...);
+ size_t (*my_sha256_context_size_type)();
+ void (*my_sha256_init_type)(void *);
+ void (*my_sha256_input_type)(void *, const unsigned char *, size_t);
+ void (*my_sha256_result_type)(void *, unsigned char *);
+
+ void (*my_sha384_type)(unsigned char*, const char*, size_t);
+ void (*my_sha384_multi_type)(unsigned char*, ...);
+ size_t (*my_sha384_context_size_type)();
+ void (*my_sha384_init_type)(void *);
+ void (*my_sha384_input_type)(void *, const unsigned char *, size_t);
+ void (*my_sha384_result_type)(void *, unsigned char *);
+
+ void (*my_sha512_type)(unsigned char*, const char*, size_t);
+ void (*my_sha512_multi_type)(unsigned char*, ...);
+ size_t (*my_sha512_context_size_type)();
+ void (*my_sha512_init_type)(void *);
+ void (*my_sha512_input_type)(void *, const unsigned char *, size_t);
+ void (*my_sha512_result_type)(void *, unsigned char *);
+} *my_sha2_service;
+
+#ifdef MYSQL_DYNAMIC_PLUGIN
+
+#define my_sha224(A,B,C) my_sha2_service->my_sha224_type(A,B,C)
+#define my_sha224_multi my_sha2_service->my_sha224_multi_type
+#define my_sha224_context_size() my_sha2_service->my_sha224_context_size_type()
+#define my_sha224_init(A) my_sha2_service->my_sha224_init_type(A)
+#define my_sha224_input(A,B,C) my_sha2_service->my_sha224_input_type(A,B,C)
+#define my_sha224_result(A,B) my_sha2_service->my_sha224_result_type(A,B)
+
+#define my_sha256(A,B,C) my_sha2_service->my_sha256_type(A,B,C)
+#define my_sha256_multi my_sha2_service->my_sha256_multi_type
+#define my_sha256_context_size() my_sha2_service->my_sha256_context_size_type()
+#define my_sha256_init(A) my_sha2_service->my_sha256_init_type(A)
+#define my_sha256_input(A,B,C) my_sha2_service->my_sha256_input_type(A,B,C)
+#define my_sha256_result(A,B) my_sha2_service->my_sha256_result_type(A,B)
+
+#define my_sha384(A,B,C) my_sha2_service->my_sha384_type(A,B,C)
+#define my_sha384_multi my_sha2_service->my_sha384_multi_type
+#define my_sha384_context_size() my_sha2_service->my_sha384_context_size_type()
+#define my_sha384_init(A) my_sha2_service->my_sha384_init_type(A)
+#define my_sha384_input(A,B,C) my_sha2_service->my_sha384_input_type(A,B,C)
+#define my_sha384_result(A,B) my_sha2_service->my_sha384_result_type(A,B)
+
+#define my_sha512(A,B,C) my_sha2_service->my_sha512_type(A,B,C)
+#define my_sha512_multi my_sha2_service->my_sha512_multi_type
+#define my_sha512_context_size() my_sha2_service->my_sha512_context_size_type()
+#define my_sha512_init(A) my_sha2_service->my_sha512_init_type(A)
+#define my_sha512_input(A,B,C) my_sha2_service->my_sha512_input_type(A,B,C)
+#define my_sha512_result(A,B) my_sha2_service->my_sha512_result_type(A,B)
+
+#else
+
+void my_sha224(unsigned char*, const char*, size_t);
+void my_sha224_multi(unsigned char*, ...);
+size_t my_sha224_context_size();
+void my_sha224_init(void *context);
+void my_sha224_input(void *context, const unsigned char *buf, size_t len);
+void my_sha224_result(void *context, unsigned char *digest);
+
+void my_sha256(unsigned char*, const char*, size_t);
+void my_sha256_multi(unsigned char*, ...);
+size_t my_sha256_context_size();
+void my_sha256_init(void *context);
+void my_sha256_input(void *context, const unsigned char *buf, size_t len);
+void my_sha256_result(void *context, unsigned char *digest);
+
+void my_sha384(unsigned char*, const char*, size_t);
+void my_sha384_multi(unsigned char*, ...);
+size_t my_sha384_context_size();
+void my_sha384_init(void *context);
+void my_sha384_input(void *context, const unsigned char *buf, size_t len);
+void my_sha384_result(void *context, unsigned char *digest);
+
+void my_sha512(unsigned char*, const char*, size_t);
+void my_sha512_multi(unsigned char*, ...);
+size_t my_sha512_context_size();
+void my_sha512_init(void *context);
+void my_sha512_input(void *context, const unsigned char *buf, size_t len);
+void my_sha512_result(void *context, unsigned char *digest);
+
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#define MYSQL_SERVICE_SHA2_INCLUDED
+#endif
+
diff --git a/include/mysql/service_thd_rnd.h b/include/mysql/service_thd_rnd.h
new file mode 100644
index 00000000000..21133c7889f
--- /dev/null
+++ b/include/mysql/service_thd_rnd.h
@@ -0,0 +1,62 @@
+#ifndef MYSQL_SERVICE_THD_RND_INCLUDED
+/* 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 St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+/**
+ @file
+ This service provides access to the thd-local random number generator.
+
+ It's preferrable over the global one, because concurrent threads
+ can generate random numbers without fighting each other over the access
+ to the shared rnd state.
+*/
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef MYSQL_ABI_CHECK
+#include <stdlib.h>
+#endif
+
+extern struct thd_rnd_service_st {
+ double (*thd_rnd_ptr)(MYSQL_THD thd);
+ void (*thd_c_r_p_ptr)(MYSQL_THD thd, char *to, size_t length);
+} *thd_rnd_service;
+
+#ifdef MYSQL_DYNAMIC_PLUGIN
+#define thd_rnd(A) thd_rnd_service->thd_rnd_ptr(A)
+#define thd_create_random_password(A,B,C) thd_rnd_service->thd_c_r_p_ptr(A,B,C)
+#else
+
+double thd_rnd(MYSQL_THD thd);
+
+/**
+ Generate string of printable random characters of requested length.
+
+ @param to[out] Buffer for generation; must be at least length+1 bytes
+ long; result string is always null-terminated
+ @param length[in] How many random characters to put in buffer
+*/
+void thd_create_random_password(MYSQL_THD thd, char *to, size_t length);
+
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#define MYSQL_SERVICE_THD_RND_INCLUDED
+#endif
diff --git a/include/mysql/services.h b/include/mysql/services.h
index 9d031a9b094..420f2430a36 100644
--- a/include/mysql/services.h
+++ b/include/mysql/services.h
@@ -1,6 +1,6 @@
#ifndef MYSQL_SERVICES_INCLUDED
/* Copyright (c) 2009, 2010, Oracle and/or its affiliates.
- Copyright (c) 2012, 2013, Monty Program Ab
+ Copyright (c) 2012, 2017, MariaDB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -19,21 +19,24 @@
extern "C" {
#endif
-#include <mysql/service_my_snprintf.h>
-#include <mysql/service_thd_alloc.h>
-#include <mysql/service_thd_wait.h>
-#include <mysql/service_progress_report.h>
+#include <mysql/service_base64.h>
#include <mysql/service_debug_sync.h>
+#include <mysql/service_encryption.h>
+#include <mysql/service_encryption_scheme.h>
#include <mysql/service_kill_statement.h>
-#include <mysql/service_thd_timezone.h>
-#include <mysql/service_sha1.h>
-#include <mysql/service_md5.h>
#include <mysql/service_logger.h>
+#include <mysql/service_md5.h>
+#include <mysql/service_my_snprintf.h>
+#include <mysql/service_progress_report.h>
+#include <mysql/service_sha1.h>
+#include <mysql/service_sha2.h>
+#include <mysql/service_thd_alloc.h>
#include <mysql/service_thd_autoinc.h>
#include <mysql/service_thd_error_context.h>
+#include <mysql/service_thd_rnd.h>
#include <mysql/service_thd_specifics.h>
-#include <mysql/service_encryption.h>
-#include <mysql/service_encryption_scheme.h>
+#include <mysql/service_thd_timezone.h>
+#include <mysql/service_thd_wait.h>
/*#include <mysql/service_wsrep.h>*/
#ifdef __cplusplus
diff --git a/include/mysql_async.h b/include/mysql_async.h
index 2728b9c1dc7..04b975211db 100644
--- a/include/mysql_async.h
+++ b/include/mysql_async.h
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
/* Common definitions for MariaDB non-blocking client library. */
diff --git a/include/service_versions.h b/include/service_versions.h
index 0f0990d43b3..d79474f1d36 100644
--- a/include/service_versions.h
+++ b/include/service_versions.h
@@ -1,5 +1,5 @@
/* Copyright (c) 2009, 2010, Oracle and/or its affiliates.
- Copyright (c) 2012, 2013, Monty Program Ab
+ Copyright (c) 2012, 2017, MariaDB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -23,18 +23,20 @@
#define VERSION_debug_sync 0x1000
#define VERSION_kill_statement 0x1000
+#define VERSION_base64 0x0100
+#define VERSION_encryption 0x0300
+#define VERSION_encryption_scheme 0x0100
+#define VERSION_logger 0x0100
+#define VERSION_my_md5 0x0100
+#define VERSION_my_sha1 0x0101
+#define VERSION_my_sha2 0x0100
#define VERSION_my_snprintf 0x0100
-#define VERSION_thd_alloc 0x0100
-#define VERSION_thd_wait 0x0100
#define VERSION_progress_report 0x0100
-#define VERSION_thd_timezone 0x0100
-#define VERSION_my_sha1 0x0101
-#define VERSION_my_md5 0x0100
-#define VERSION_wsrep 0x0201
-#define VERSION_logger 0x0100
+#define VERSION_thd_alloc 0x0100
#define VERSION_thd_autoinc 0x0100
#define VERSION_thd_error_context 0x0100
+#define VERSION_thd_rnd 0x0100
#define VERSION_thd_specifics 0x0100
-#define VERSION_encryption 0x0300
-#define VERSION_encryption_scheme 0x0100
-
+#define VERSION_thd_timezone 0x0100
+#define VERSION_thd_wait 0x0100
+#define VERSION_wsrep 0x0201
diff --git a/include/sha1.h b/include/sha1.h
deleted file mode 100644
index d927cd26ad9..00000000000
--- a/include/sha1.h
+++ /dev/null
@@ -1,25 +0,0 @@
-#ifndef SHA1_INCLUDED
-#define SHA1_INCLUDED
-
-/* Copyright (c) 2013, Monty Program Ab
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; version 2 of the License.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-*/
-
-#include <mysql/service_sha1.h>
-#define SHA1_HASH_SIZE MY_SHA1_HASH_SIZE
-#define compute_sha1_hash(A,B,C) my_sha1(A,B,C)
-#define compute_sha1_hash_multi(A,B,C,D,E) my_sha1_multi(A,B,C,D,E,NULL)
-
-#endif /* SHA__INCLUDED */
diff --git a/include/sha2.h b/include/sha2.h
deleted file mode 100644
index 737658e9ced..00000000000
--- a/include/sha2.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/* Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; version 2 of the License.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
-
-#ifndef included_sha2_h
-#define included_sha2_h
-
-#include <my_config.h>
-
-#if defined(HAVE_YASSL) || defined(HAVE_OPENSSL)
-
-# ifdef HAVE_STDDEF_H
-# include <stddef.h>
-# endif
-
-# ifndef HAVE_YASSL
-# include <openssl/sha.h>
-
-# else
-
-#include "../extra/yassl/taocrypt/include/sha.hpp"
-
-# ifdef __cplusplus
-extern "C" {
-# endif
-
-#ifndef SHA512_DIGEST_LENGTH
-#define SHA512_DIGEST_LENGTH TaoCrypt::SHA512::DIGEST_SIZE
-#endif
-
-#ifndef SHA384_DIGEST_LENGTH
-#define SHA384_DIGEST_LENGTH TaoCrypt::SHA384::DIGEST_SIZE
-#endif
-
-#ifndef SHA256_DIGEST_LENGTH
-#define SHA256_DIGEST_LENGTH TaoCrypt::SHA256::DIGEST_SIZE
-#endif
-
-#ifndef SHA224_DIGEST_LENGTH
-#define SHA224_DIGEST_LENGTH TaoCrypt::SHA224::DIGEST_SIZE
-#endif
-
-#define GEN_YASSL_SHA2_BRIDGE(size) \
-unsigned char* SHA##size(const unsigned char *input_ptr, size_t input_length, \
- char unsigned *output_ptr);
-
-GEN_YASSL_SHA2_BRIDGE(512);
-GEN_YASSL_SHA2_BRIDGE(384);
-GEN_YASSL_SHA2_BRIDGE(256);
-GEN_YASSL_SHA2_BRIDGE(224);
-
-#undef GEN_YASSL_SHA2_BRIDGE
-
-# ifdef __cplusplus
-}
-# endif
-
-# endif /* HAVE_YASSL */
-
-#endif /* HAVE_OPENSSL || HAVE_YASSL */
-#endif /* included_sha2_h */
diff --git a/include/waiting_threads.h b/include/waiting_threads.h
index e17874b9611..cd4db35701c 100644
--- a/include/waiting_threads.h
+++ b/include/waiting_threads.h
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#ifndef _waiting_threads_h
#define _waiting_threads_h
diff --git a/include/wqueue.h b/include/wqueue.h
index e568ab8e91e..69cb715a97d 100644
--- a/include/wqueue.h
+++ b/include/wqueue.h
@@ -13,7 +13,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#ifndef WQUEUE_INCLUDED
#define WQUEUE_INCLUDED
diff --git a/include/wsrep.h b/include/wsrep.h
index 0f5455c8d50..532e4339f10 100644
--- a/include/wsrep.h
+++ b/include/wsrep.h
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#include <my_config.h>
diff --git a/libmysqld/CMakeLists.txt b/libmysqld/CMakeLists.txt
index 62aab628ed2..5516cd7013a 100644
--- a/libmysqld/CMakeLists.txt
+++ b/libmysqld/CMakeLists.txt
@@ -56,7 +56,7 @@ SET(SQL_EMBEDDED_SOURCES emb_qcache.cc libmysqld.c lib_sql.cc
../sql/net_serv.cc ../sql/opt_range.cc ../sql/opt_sum.cc
../sql/parse_file.cc ../sql/procedure.cc ../sql/protocol.cc
../sql/records.cc ../sql/repl_failsafe.cc ../sql/rpl_filter.cc
- ../sql/rpl_record.cc ../sql/sha2.cc ../sql/des_key_file.cc
+ ../sql/rpl_record.cc ../sql/des_key_file.cc
../sql/rpl_injector.cc ../sql/set_var.cc ../sql/spatial.cc
../sql/sp_cache.cc ../sql/sp.cc ../sql/sp_head.cc
../sql/sp_pcontext.cc ../sql/sp_rcontext.cc ../sql/sql_acl.cc
diff --git a/libmysqld/libmysql.c b/libmysqld/libmysql.c
index 7d36931dd1f..09d5abbbb6a 100644
--- a/libmysqld/libmysql.c
+++ b/libmysqld/libmysql.c
@@ -193,7 +193,7 @@ int STDCALL mysql_server_init(int argc, char **argv, char **groups)
the library.
To make things simpler when used with windows dll's (which calls this
- function automaticly), it's safe to call this function multiple times.
+ function automatically), it's safe to call this function multiple times.
*/
@@ -603,7 +603,7 @@ static int default_local_infile_init(void **ptr, const char *filename,
default_local_infile_read()
ptr Points to handle allocated by _init
buf Read data here
- buf_len Ammount of data to read
+ buf_len Amount of data to read
RETURN
> 0 number of bytes read
@@ -658,7 +658,7 @@ static void default_local_infile_end(void *ptr)
ptr Points to handle allocated by _init
May be NULL if _init failed!
error_msg Store error text here
- error_msg_len Max lenght of error_msg
+ error_msg_len Max length of error_msg
RETURN
error message number
@@ -1268,7 +1268,7 @@ static int stmt_read_row_no_result_set(MYSQL_STMT *stmt, unsigned char **row);
static void stmt_update_metadata(MYSQL_STMT *stmt, MYSQL_ROWS *data);
static my_bool setup_one_fetch_function(MYSQL_BIND *, MYSQL_FIELD *field);
-/* Auxilary function used to reset statement handle. */
+/* Auxiliary function used to reset statement handle. */
#define RESET_SERVER_SIDE 1
#define RESET_LONG_DATA 2
@@ -1812,7 +1812,7 @@ static void update_stmt_fields(MYSQL_STMT *stmt)
RETURN
NULL statement contains no result set or out of memory.
- In the latter case you can retreive error message
+ In the latter case you can retrieve error message
with mysql_stmt_error.
MYSQL_RES a result set with no rows
*/
@@ -1850,7 +1850,7 @@ mysql_stmt_result_metadata(MYSQL_STMT *stmt)
Returns parameter columns meta information in the form of
result set.
- SYNOPSYS
+ SYNOPSIS
mysql_stmt_param_metadata()
stmt statement handle
@@ -1899,7 +1899,7 @@ static void store_param_type(unsigned char **pos, MYSQL_BIND *param)
param MySQL bind param
DESCRIPTION
- These funtions are invoked from mysql_stmt_execute() by
+ These functions are invoked from mysql_stmt_execute() by
MYSQL_BIND::store_param_func pointer. This pointer is set once per
many executions in mysql_stmt_bind_param(). The caller must ensure
that network buffer have enough capacity to store parameter
@@ -2076,7 +2076,7 @@ static my_bool store_param(MYSQL_STMT *stmt, MYSQL_BIND *param)
/*
- Auxilary function to send COM_STMT_EXECUTE packet to server and read reply.
+ Auxiliary function to send COM_STMT_EXECUTE packet to server and read reply.
Used from cli_stmt_execute, which is in turn used by mysql_stmt_execute.
*/
@@ -4464,7 +4464,7 @@ int STDCALL mysql_stmt_store_result(MYSQL_STMT *stmt)
if (stmt->update_max_length && !stmt->bind_result_done)
{
/*
- We must initalize the bind structure to be able to calculate
+ We must initialize the bind structure to be able to calculate
max_length
*/
MYSQL_BIND *my_bind, *end;
diff --git a/libservices/CMakeLists.txt b/libservices/CMakeLists.txt
index 62181a00aa2..0b68a156077 100644
--- a/libservices/CMakeLists.txt
+++ b/libservices/CMakeLists.txt
@@ -16,22 +16,26 @@
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)
SET(MYSQLSERVICES_SOURCES
+ base64_service.c
+ debug_sync_service.c
+ encryption_scheme_service.c
+ encryption_service.c
+ kill_statement_service.c
+ logger_service.c
+ my_md5_service.c
+ my_sha1_service.c
+ my_sha2_service.c
my_snprintf_service.c
+ progress_report_service.c
thd_alloc_service.c
- thd_wait_service.c
- thd_timezone_service.c
thd_autoinc_service.c
thd_error_context_service.c
+ thd_rnd_service.c
thd_specifics_service.c
- progress_report_service.c
- debug_sync_service.c
- my_sha1_service.c
- my_md5_service.c
+ thd_timezone_service.c
+ thd_wait_service.c
wsrep_service.c
- encryption_service.c
- encryption_scheme_service.c
- kill_statement_service.c
- logger_service.c)
+)
ADD_CONVENIENCE_LIBRARY(mysqlservices ${MYSQLSERVICES_SOURCES})
INSTALL(TARGETS mysqlservices DESTINATION ${INSTALL_LIBDIR} COMPONENT Development)
diff --git a/libservices/HOWTO b/libservices/HOWTO
index 69d96f8aa25..6a581bf22e2 100644
--- a/libservices/HOWTO
+++ b/libservices/HOWTO
@@ -74,7 +74,7 @@ it should also declare all the accompanying data structures, as necessary
#define VERSION_foo 0x0100
==================================================================
-6. create a new file libservices/foo_service.h using the following template:
+6. create a new file libservices/foo_service.c using the following template:
==================================================================
/* GPL header */
#include <service_versions.h>
@@ -82,7 +82,7 @@ it should also declare all the accompanying data structures, as necessary
==================================================================
7. add the new file to libservices/CMakeLists.txt (MYSQLSERVICES_SOURCES)
-8. Add all new files to repository (bzr add)
+8. Add all new files to repository (git add)
9. and finally, register your service for dynamic linking in
sql/sql_plugin_services.ic as follows:
9.1 fill in the service structure:
diff --git a/libservices/base64_service.c b/libservices/base64_service.c
new file mode 100644
index 00000000000..af35ccd2a1c
--- /dev/null
+++ b/libservices/base64_service.c
@@ -0,0 +1,18 @@
+/* Copyright (c) 2017 MariaDB
+ Use is subject to license terms.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#include <service_versions.h>
+SERVICE_VERSION base64_service= (void*)VERSION_base64;
diff --git a/libservices/logger_service.c b/libservices/logger_service.c
index 615e595c6bc..7d2ab40a7c5 100644
--- a/libservices/logger_service.c
+++ b/libservices/logger_service.c
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#include <service_versions.h>
diff --git a/libservices/my_sha2_service.c b/libservices/my_sha2_service.c
new file mode 100644
index 00000000000..aa174e7d1f0
--- /dev/null
+++ b/libservices/my_sha2_service.c
@@ -0,0 +1,18 @@
+/* Copyright (c) 2017 MariaDB
+ Use is subject to license terms.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#include <service_versions.h>
+SERVICE_VERSION my_sha2_service= (void*)VERSION_my_sha2;
diff --git a/libservices/progress_report_service.c b/libservices/progress_report_service.c
index e55daf31e7d..cbae2d67426 100644
--- a/libservices/progress_report_service.c
+++ b/libservices/progress_report_service.c
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#include <service_versions.h>
SERVICE_VERSION progress_report_service= (void*)VERSION_progress_report;
diff --git a/libservices/thd_rnd_service.c b/libservices/thd_rnd_service.c
new file mode 100644
index 00000000000..fbba611a8ff
--- /dev/null
+++ b/libservices/thd_rnd_service.c
@@ -0,0 +1,17 @@
+/* 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 St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#include <service_versions.h>
+SERVICE_VERSION thd_rnd_service= (void *) VERSION_thd_rnd;
diff --git a/libservices/wsrep_service.c b/libservices/wsrep_service.c
index 5faf1a12d05..cdd7e400571 100644
--- a/libservices/wsrep_service.c
+++ b/libservices/wsrep_service.c
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#include <service_versions.h>
diff --git a/man/CMakeLists.txt b/man/CMakeLists.txt
index b99ea688d21..f24c5c95d69 100644
--- a/man/CMakeLists.txt
+++ b/man/CMakeLists.txt
@@ -22,7 +22,11 @@ SET(MAN1_SERVER innochecksum.1 my_print_defaults.1 myisam_ftdump.1 myisamchk.1
mysql_tzinfo_to_sql.1 mysql_upgrade.1
mysqld_multi.1 mysqld_safe.1 mysqldumpslow.1 mysqlhotcopy.1
mysqltest.1 perror.1 replace.1 resolve_stack_dump.1
- resolveip.1)
+ resolveip.1 mariadb-service-convert.1
+ mysqld_safe_helper.1 tokuftdump.1 wsrep_sst_common.1
+ wsrep_sst_mysqldump.1 wsrep_sst_rsync.1
+ wsrep_sst_xtrabackup-v2.1 wsrep_sst_xtrabackup.1
+ galera_recovery.1 galera_new_cluster.1)
SET(MAN8_SERVER mysqld.8)
SET(MAN1_CLIENT msql2mysql.1 mysql.1 mysql_find_rows.1 mysql_waitpid.1
mysqlaccess.1 mysqladmin.1 mysqlbinlog.1 mysqlcheck.1
diff --git a/man/galera_new_cluster.1 b/man/galera_new_cluster.1
new file mode 100644
index 00000000000..c351a5e0c5f
--- /dev/null
+++ b/man/galera_new_cluster.1
@@ -0,0 +1,16 @@
+'\" t
+.\"
+.TH "\FBGALERA_NEW_CLUSTER\FR" "1" "26 January 2017" "MariaDB 10\&.1" "MariaDB Database System"
+.\" -----------------------------------------------------------------
+.\" * set default formatting
+.\" -----------------------------------------------------------------
+.\" disable hyphenation
+.nh
+.\" disable justification (adjust text to left margin only)
+.ad l
+.SH NAME
+galera_new_cluster \- starting a new Galera cluster
+.SH DESCRIPTION
+Use: Starting a new Galera Cluster\.
+.PP
+For more information, please refer to the MariaDB Knowledge Base, available online at https://mariadb.com/kb/
diff --git a/man/galera_recovery.1 b/man/galera_recovery.1
new file mode 100644
index 00000000000..12cb450da46
--- /dev/null
+++ b/man/galera_recovery.1
@@ -0,0 +1,16 @@
+'\" t
+.\"
+.TH "\FBGALERA_RECOVERY\FR" "1" "26 January 2017" "MariaDB 10\&.1" "MariaDB Database System"
+.\" -----------------------------------------------------------------
+.\" * set default formatting
+.\" -----------------------------------------------------------------
+.\" disable hyphenation
+.nh
+.\" disable justification (adjust text to left margin only)
+.ad l
+.SH NAME
+galera_recovery \- recover from non\-graceful shutdown
+.SH DESCRIPTION
+Use: Recover from non\-graceful shutdown\.
+.PP
+For more information, please refer to the MariaDB Knowledge Base, available online at https://mariadb.com/kb/
diff --git a/man/mariadb-service-convert.1 b/man/mariadb-service-convert.1
new file mode 100644
index 00000000000..6301087208b
--- /dev/null
+++ b/man/mariadb-service-convert.1
@@ -0,0 +1,20 @@
+'\" t
+.\"
+.TH "\FBMARIADB-SERVICE-CONVERT\FR" "1" "26 January 2017" "MariaDB 10\&.1" "MariaDB Database System"
+.\" -----------------------------------------------------------------
+.\" * set default formatting
+.\" -----------------------------------------------------------------
+.\" disable hyphenation
+.nh
+.\" disable justification (adjust text to left margin only)
+.ad l
+.SH NAME
+mariadb-service-convert \- generate a mariadb.service file based on the current mysql/mariadb settings
+.SH DESCRIPTION
+Use: Generate a mariadb.service file based on the current mysql/mariadb settings\.
+This is to assist distro maintainers in migrating to systemd service definations from
+a user mysqld_safe settings in the my.cnf files\.
+.PP
+Redirect output to user directory like /etc/systemd/system/mariadb.service.d/migrated-from-my.cnf-settings.conf
+.PP
+For more information, please refer to the MariaDB Knowledge Base, available online at https://mariadb.com/kb/
diff --git a/man/mysqladmin.1 b/man/mysqladmin.1
index 3fb78d33f14..786b288f101 100644
--- a/man/mysqladmin.1
+++ b/man/mysqladmin.1
@@ -816,6 +816,18 @@ Connect to the MariaDB server on the given host\&.
.sp -1
.IP \(bu 2.3
.\}
+.\" mysqladmin: local option
+.\" local option: mysqladmin
+\fB\-\-local\fR,
+\fB\-l\fR
+.sp
+Suppress the SQL command(s) from being written to the binary log by enabling sql_log_bin=0 for the session\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
.\" mysqladmin: no-beep option
.\" no-beep option: mysqladmin
\fB\-\-no\-beep\fR,
diff --git a/man/mysqld_safe_helper.1 b/man/mysqld_safe_helper.1
new file mode 100644
index 00000000000..63770a49d28
--- /dev/null
+++ b/man/mysqld_safe_helper.1
@@ -0,0 +1,16 @@
+'\" t
+.\"
+.TH "\FBMYSQLD_SAFE_HELPER\FR" "1" "26 January 2017" "MariaDB 10\&.1" "MariaDB Database System"
+.\" -----------------------------------------------------------------
+.\" * set default formatting
+.\" -----------------------------------------------------------------
+.\" disable hyphenation
+.nh
+.\" disable justification (adjust text to left margin only)
+.ad l
+.SH NAME
+mysqld_safe_helper \- helper script
+.SH DESCRIPTION
+Use: Helper script\.
+.PP
+For more information, please refer to the MariaDB Knowledge Base, available online at https://mariadb.com/kb/
diff --git a/man/tokuftdump.1 b/man/tokuftdump.1
new file mode 100644
index 00000000000..d0a11a840a5
--- /dev/null
+++ b/man/tokuftdump.1
@@ -0,0 +1,237 @@
+'\" t
+.\"
+.TH "\FBTOKUFTDUMP\FR" "1" "9 March 2017" "MariaDB 10\&.1" "MariaDB Database System"
+.\" -----------------------------------------------------------------
+.\" * set default formatting
+.\" -----------------------------------------------------------------
+.\" disable hyphenation
+.nh
+.\" disable justification (adjust text to left margin only)
+.ad l
+.\" -----------------------------------------------------------------
+.\" * MAIN CONTENT STARTS HERE *
+.\" -----------------------------------------------------------------
+.\" tokuftdump
+.\" upgrading MySQL
+.SH "NAME"
+tokuftdump \- look into the fractal tree file
+.SH "SYNOPSIS"
+.HP \w'\fBtokuftdump\ [\fR\fB\fIoptions\fR\fR\fB]\fR\ 'u
+\fBtokuftdump [\fR\fB\fIoptions\fR\fR\fB]\fR
+.SH "DESCRIPTION"
+.PP
+\fBtokuftdump\fR
+Investigates and diagnoses the fractal tree\&.
+.PP
+\fBtokuftdump\fR
+supports the following options for processing option files\&.
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+.\" tokuftdump: interactive option
+.\" interactive option: tokuftdump
+\fB\-\-interactive\fR
+.sp
+Interactive\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+.\" tokuftdump: support option
+.\" support option: tokuftdump
+\fB\-\-support \fI/path/to/fractal-tree/file\fR
+.sp
+An interactive way to see what messages and/or switch between FTs\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+.\" tokuftdump: json option
+.\" json option: tokuftdump
+\fB\-\-json \fI/path/to/fractal-tree/file [output_json_file]\fR
+.sp
+If the output json file is left empty, FT\&.json will be created automatically\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+.\" tokuftdump: nodata option
+.\" nodata option: tokuftdump
+\fB\-\-nodata\fR
+.sp
+Nodata\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+.\" tokuftdump: dumpdata option
+.\" dumpdata option: tokuftdump
+\fB\-\-dumpdata = \fR\fB\fI0|1\fR\fR
+.sp
+Dumpdata\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+.\" tokuftdump: header option
+.\" header option: tokuftdump
+\fB\-\-header\fR
+.sp
+Header\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+.\" tokuftdump: rootnode option
+.\" rootnode option: tokuftdump
+\fB\-\-rootnode\fR
+.sp
+Rootnode\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+.\" tokuftdump: node option
+.\" node option: tokuftdump
+\fB\-\-node \fIN\fR
+.sp
+Node\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+.\" tokuftdump: fragmentation option
+.\" fragmentation option: tokuftdump
+\fB\-\-fragmentation\fR
+.sp
+Fragmentation\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+.\" tokuftdump: garbage option
+.\" garbage option: tokuftdump
+\fB\-\-garbage\fR
+.sp
+Garbage\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+.\" tokuftdump: tsv option
+.\" tsv option: tokuftdump
+\fB\-\-tsv\fR
+.sp
+TSV\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+.\" tokuftdump: translation-table option
+.\" translation-table option: tokuftdump
+\fB\-\-translation\-table\fR
+.sp
+Translation table\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+.\" tokuftdump: summary option
+.\" summary option: tokuftdump
+\fB\-\-summary\fR
+.sp
+Provide summary info\&.
+.RE
+.SH "COPYRIGHT"
+.br
+.PP
+Copyright 2016 MariaDB Foundation
+.PP
+This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License.
+.PP
+This documentation 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.
+.PP
+You should have received a copy of the GNU General Public License along with the program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or see http://www.gnu.org/licenses/.
+.sp
+.SH "SEE ALSO"
+For more information, please refer to the MariaDB Knowledge Base, available online at https://mariadb.com/kb/
+.SH AUTHOR
+MariaDB Foundation (http://www.mariadb.org/).
diff --git a/man/wsrep_sst_common.1 b/man/wsrep_sst_common.1
new file mode 100644
index 00000000000..05242e66c00
--- /dev/null
+++ b/man/wsrep_sst_common.1
@@ -0,0 +1,16 @@
+'\" t
+.\"
+.TH "\FBWSREP_SST_COMMON\FR" "1" "26 January 2017" "MariaDB 10\&.1" "MariaDB Database System"
+.\" -----------------------------------------------------------------
+.\" * set default formatting
+.\" -----------------------------------------------------------------
+.\" disable hyphenation
+.nh
+.\" disable justification (adjust text to left margin only)
+.ad l
+.SH NAME
+wsrep_sst_common \- common command line parser to be sourced by other SST scripts
+.SH DESCRIPTION
+Use: Common command line parser to be sourced by other SST scripts\.
+.PP
+For more information, please refer to the MariaDB Knowledge Base, available online at https://mariadb.com/kb/
diff --git a/man/wsrep_sst_mysqldump.1 b/man/wsrep_sst_mysqldump.1
new file mode 100644
index 00000000000..17ad5b2cdf1
--- /dev/null
+++ b/man/wsrep_sst_mysqldump.1
@@ -0,0 +1,16 @@
+'\" t
+.\"
+.TH "\FBWSREP_SST_MYSQLDUMP\FR" "1" "26 January 2017" "MariaDB 10\&.1" "MariaDB Database System"
+.\" -----------------------------------------------------------------
+.\" * set default formatting
+.\" -----------------------------------------------------------------
+.\" disable hyphenation
+.nh
+.\" disable justification (adjust text to left margin only)
+.ad l
+.SH NAME
+wsrep_sst_mysqldump \- mysqldump\-based state snapshot transfer
+.SH DESCRIPTION
+Use: mysqldump-based state snapshot transfer\.
+.PP
+For more information, please refer to the MariaDB Knowledge Base, available online at https://mariadb.com/kb/
diff --git a/man/wsrep_sst_rsync.1 b/man/wsrep_sst_rsync.1
new file mode 100644
index 00000000000..95a80b20821
--- /dev/null
+++ b/man/wsrep_sst_rsync.1
@@ -0,0 +1,16 @@
+'\" t
+.\"
+.TH "\FBWSREP_SST_RSYNC\FR" "1" "26 January 2017" "MariaDB 10\&.1" "MariaDB Database System"
+.\" -----------------------------------------------------------------
+.\" * set default formatting
+.\" -----------------------------------------------------------------
+.\" disable hyphenation
+.nh
+.\" disable justification (adjust text to left margin only)
+.ad l
+.SH NAME
+wsrep_sst_mysqldump \- rsync-based state snapshot transfer
+.SH DESCRIPTION
+Use: rsync-based state snapshot transfer\.
+.PP
+For more information, please refer to the MariaDB Knowledge Base, available online at https://mariadb.com/kb/
diff --git a/man/wsrep_sst_xtrabackup-v2.1 b/man/wsrep_sst_xtrabackup-v2.1
new file mode 100644
index 00000000000..d61ce803b93
--- /dev/null
+++ b/man/wsrep_sst_xtrabackup-v2.1
@@ -0,0 +1,16 @@
+'\" t
+.\"
+.TH "\FBWSREP_SST_XTRABACKUP-V2\FR" "1" "26 January 2017" "MariaDB 10\&.1" "MariaDB Database System"
+.\" -----------------------------------------------------------------
+.\" * set default formatting
+.\" -----------------------------------------------------------------
+.\" disable hyphenation
+.nh
+.\" disable justification (adjust text to left margin only)
+.ad l
+.SH NAME
+wsrep_sst_xtrabackup-v2 \- xtrabackup\-based state snapshot transfer
+.SH DESCRIPTION
+Use: xtrabackup-based state snapshot transfer\.
+.PP
+For more information, please refer to the MariaDB Knowledge Base, available online at https://mariadb.com/kb/
diff --git a/man/wsrep_sst_xtrabackup.1 b/man/wsrep_sst_xtrabackup.1
new file mode 100644
index 00000000000..9644a29c4ca
--- /dev/null
+++ b/man/wsrep_sst_xtrabackup.1
@@ -0,0 +1,16 @@
+'\" t
+.\"
+.TH "\FBWSREP_SST_XTRABACKUP\FR" "1" "24 January 2017" "MariaDB 10\&.1" "MariaDB Database System"
+.\" -----------------------------------------------------------------
+.\" * set default formatting
+.\" -----------------------------------------------------------------
+.\" disable hyphenation
+.nh
+.\" disable justification (adjust text to left margin only)
+.ad l
+.SH NAME
+wsrep_sst_xtrabackup \- xtrabackup\-based state snapshot transfer
+.SH DESCRIPTION
+Use: xtrabackup-based state snapshot transfer\.
+.PP
+For more information, please refer to the MariaDB Knowledge Base, available online at https://mariadb.com/kb/
diff --git a/mysql-test/include/check-testcase.test b/mysql-test/include/check-testcase.test
index abac3861c66..3b2c2a46590 100644
--- a/mysql-test/include/check-testcase.test
+++ b/mysql-test/include/check-testcase.test
@@ -79,5 +79,9 @@ if (!$tmp) {
}
call mtr.check_testcase();
+
+let $datadir=`select @@datadir`;
+list_files $datadir mysql_upgrade_info;
+
--enable_query_log
diff --git a/mysql-test/include/gap_lock_error_all.inc b/mysql-test/include/gap_lock_error_all.inc
new file mode 100644
index 00000000000..fc69dfb56f0
--- /dev/null
+++ b/mysql-test/include/gap_lock_error_all.inc
@@ -0,0 +1,27 @@
+--source include/have_partition.inc
+--source include/gap_lock_error_init.inc
+
+let $select_lock=for update;
+let $autocommit = 0;
+--source include/gap_lock_error_select.inc
+let $autocommit = 1;
+--source include/gap_lock_error_select.inc
+
+let $select_lock=lock in share mode;
+let $autocommit = 0;
+--source include/gap_lock_error_select.inc
+let $autocommit = 1;
+--source include/gap_lock_error_select.inc
+
+let $select_lock=;
+let $autocommit = 0;
+--source include/gap_lock_error_select.inc
+let $autocommit = 1;
+--source include/gap_lock_error_select.inc
+
+let $autocommit = 0;
+--source include/gap_lock_error_update.inc
+let $autocommit = 1;
+--source include/gap_lock_error_update.inc
+
+--source include/gap_lock_error_cleanup.inc
diff --git a/mysql-test/include/gap_lock_error_cleanup.inc b/mysql-test/include/gap_lock_error_cleanup.inc
new file mode 100644
index 00000000000..8558b5a528f
--- /dev/null
+++ b/mysql-test/include/gap_lock_error_cleanup.inc
@@ -0,0 +1 @@
+drop table gap1, gap2, gap3, gap4;
diff --git a/mysql-test/include/gap_lock_error_init.inc b/mysql-test/include/gap_lock_error_init.inc
new file mode 100644
index 00000000000..26aa852a398
--- /dev/null
+++ b/mysql-test/include/gap_lock_error_init.inc
@@ -0,0 +1,24 @@
+eval CREATE TABLE gap1 (id1 INT, id2 INT, id3 INT, c1 INT, value INT,
+ PRIMARY KEY (id1, id2, id3),
+ INDEX i (c1)) ENGINE=$engine;
+CREATE TABLE gap2 like gap1;
+eval CREATE TABLE gap3 (id INT, value INT,
+ PRIMARY KEY (id),
+ UNIQUE KEY ui(value)) ENGINE=$engine;
+eval CREATE TABLE gap4 (id INT, value INT,
+ PRIMARY KEY (id)) ENGINE=$engine
+ PARTITION BY HASH(id) PARTITIONS 2;
+--disable_query_log
+let $max = 1000;
+let $i = 1;
+while ($i <= $max) {
+ eval INSERT INTO gap1 (id1, id2, id3, c1, value)
+ VALUES ($i div 2, $i div 10, $i, $i, $i);
+ eval INSERT INTO gap2 (id1, id2, id3, c1, value)
+ VALUES ($i div 2, $i div 10, $i, $i, $i);
+ inc $i;
+}
+--enable_query_log
+
+insert into gap3 values (1,1), (2,2),(3,3),(4,4),(5,5);
+insert into gap4 values (1,1), (2,2),(3,3),(4,4),(5,5);
diff --git a/mysql-test/include/gap_lock_error_select.inc b/mysql-test/include/gap_lock_error_select.inc
new file mode 100644
index 00000000000..91db9bed68a
--- /dev/null
+++ b/mysql-test/include/gap_lock_error_select.inc
@@ -0,0 +1,89 @@
+eval set session autocommit=$autocommit;
+let $is_gaplock_target = `SELECT @@autocommit = 0 && '$select_lock' != '' && '$expect_gap_lock_errors' = 1`;
+
+if ($is_gaplock_target)
+{
+# rnd_init
+--error ER_UNKNOWN_ERROR
+eval select * from gap1 limit 1 $select_lock;
+--error ER_UNKNOWN_ERROR
+eval select * from gap1 where value != 100 limit 1 $select_lock;
+# index_read_map
+--error ER_UNKNOWN_ERROR
+eval select * from gap1 where id1=1 $select_lock;
+--error ER_UNKNOWN_ERROR
+eval select * from gap1 where id1=1 and id2= 1 $select_lock;
+# read_range_first
+--error ER_UNKNOWN_ERROR
+eval select * from gap1 where id1=1 and id2= 1 and id3 != 1 $select_lock;
+--error ER_UNKNOWN_ERROR
+eval select * from gap1 where id1=1 and id2= 1 and id3
+ between 1 and 3 $select_lock;
+--error ER_UNKNOWN_ERROR
+eval select * from gap1 where id1=1 and id2= 1 order by id3 asc
+ limit 1 $select_lock;
+--error ER_UNKNOWN_ERROR
+eval select * from gap1 where id1=1 and id2= 1 order by id3 desc
+ limit 1 $select_lock;
+# index_first
+--error ER_UNKNOWN_ERROR
+eval select * from gap1 order by id1 asc limit 1 $select_lock;
+--error ER_UNKNOWN_ERROR
+eval select * from gap1 order by id1 asc, id2 asc, id3 asc limit 1 $select_lock;
+# index_last
+--error ER_UNKNOWN_ERROR
+eval select * from gap1 order by id1 desc limit 1 $select_lock;
+--error ER_UNKNOWN_ERROR
+eval select * from gap1 order by id1 desc, id2 desc, id3 desc
+ limit 1 $select_lock;
+# secondary index lookup
+--error ER_UNKNOWN_ERROR
+eval select * from gap1 force index(i) where c1=1 $select_lock;
+# unique index lookup, ensure no gap lock errors as this is effectively a
+# single point select that does not lock ranges or gaps of keys
+eval select * from gap3 force index(ui) where value=1 $select_lock;
+# primary key lookup, ensure no gap lock errors as these are effectively
+# single point selects that do not lock ranges or gaps of keys
+eval select * from gap1 where id1=1 and id2=1 and id3=1 $select_lock;
+eval select * from gap1 where id1=1 and id2=1 and id3 in (1, 2, 3) $select_lock;
+eval select * from gap1 where id1=1 and id2=1 and id3=1 and value=1
+ order by c1 $select_lock;
+eval select * from gap3 where id=1 $select_lock;
+eval select * from gap4 where id=1 $select_lock;
+eval select * from gap4 where id in (1, 2, 3) $select_lock;
+--error ER_UNKNOWN_ERROR
+eval select * from gap4 $select_lock;
+--error ER_UNKNOWN_ERROR
+eval select * from gap4 where id between 3 and 7 $select_lock;
+}
+
+if (!$is_gaplock_target)
+{
+eval select * from gap1 limit 1 $select_lock;
+eval select * from gap1 where value != 100 limit 1 $select_lock;
+eval select * from gap1 where id1=1 $select_lock;
+eval select * from gap1 where id1=1 and id2= 1 $select_lock;
+eval select * from gap1 where id1=1 and id2= 1 and id3 != 1 $select_lock;
+eval select * from gap1 where id1=1 and id2= 1 and id3
+ between 1 and 3 $select_lock;
+eval select * from gap1 where id1=1 and id2= 1 order by id3 asc
+ limit 1 $select_lock;
+eval select * from gap1 where id1=1 and id2= 1 order by id3 desc
+ limit 1 $select_lock;
+eval select * from gap1 order by id1 asc limit 1 $select_lock;
+eval select * from gap1 order by id1 asc, id2 asc, id3 asc limit 1 $select_lock;
+eval select * from gap1 order by id1 desc limit 1 $select_lock;
+eval select * from gap1 order by id1 desc, id2 desc, id3 desc
+ limit 1 $select_lock;
+eval select * from gap1 force index(i) where c1=1 $select_lock;
+eval select * from gap3 force index(ui) where value=1 $select_lock;
+eval select * from gap1 where id1=1 and id2=1 and id3=1 $select_lock;
+eval select * from gap1 where id1=1 and id2=1 and id3 in (1, 2, 3) $select_lock;
+eval select * from gap1 where id1=1 and id2=1 and id3=1 and value=1
+ order by c1 $select_lock;
+eval select * from gap3 where id=1 $select_lock;
+eval select * from gap4 where id=1 $select_lock;
+eval select * from gap4 where id in (1, 2, 3) $select_lock;
+eval select * from gap4 $select_lock;
+eval select * from gap4 where id between 3 and 7 $select_lock;
+}
diff --git a/mysql-test/include/gap_lock_error_update.inc b/mysql-test/include/gap_lock_error_update.inc
new file mode 100644
index 00000000000..d456cf81588
--- /dev/null
+++ b/mysql-test/include/gap_lock_error_update.inc
@@ -0,0 +1,91 @@
+eval set session autocommit=$autocommit;
+let $is_gaplock_target = `SELECT @@autocommit = 0 && '$expect_gap_lock_errors' = 1`;
+
+if ($is_gaplock_target)
+{
+## single-table insert,update,delete
+insert into gap1 (id1, id2, id3) values (-1,-1,-1);
+insert into gap1 (id1, id2, id3) values (-1,-1,-1)
+ on duplicate key update value=100;
+--error ER_UNKNOWN_ERROR
+update gap1 set value=100 where id1=1;
+update gap1 set value=100 where id1=1 and id2=1 and id3=1;
+--error ER_UNKNOWN_ERROR
+delete from gap1 where id1=2;
+delete from gap1 where id1=-1 and id2=-1 and id3=-1;
+commit;
+
+## multi-table statements (preventing all gap locks with autocommit)
+# insert into select
+--error ER_UNKNOWN_ERROR
+insert into gap2 select * from gap1;
+--error ER_UNKNOWN_ERROR
+insert into gap2 select * from gap1 where id1=1;
+insert into gap2 select * from gap1 where id1=1 and id2=1 and id3=1;
+
+# create table select
+create table t4 select * from gap1 where id1=1 and id2=1 and id3=1;
+drop table t4;
+--error ER_UNKNOWN_ERROR
+create table t4 select * from gap1;
+--error ER_UNKNOWN_ERROR
+create table t4 select * from gap1 where id1=1;
+
+# update join
+update gap1 join gap2 on gap1.id1 and gap1.id2=gap2.id2 set gap1.value=100 where gap2.id1=3
+ and gap2.id2=3 and gap2.id3=3;
+--error ER_UNKNOWN_ERROR
+update gap1 join gap2 on gap1.id1 and gap1.id2=gap2.id2 set gap1.value=100 where gap2.id1=3;
+--error ER_UNKNOWN_ERROR
+update gap1 join gap2 on gap1.id1 and gap1.id2=gap2.id2 join gap3 on gap1.id1=gap3.id
+ set gap1.value=100 where gap2.id1=3;
+--error ER_UNKNOWN_ERROR
+update gap1 set gap1.value= (select count(*) from gap2);
+
+# delete join
+delete gap1 from gap1 join gap2 on gap1.id1 and gap1.id2=gap2.id2 where gap2.id1=3
+ and gap2.id2=3 and gap2.id3=3;
+--error ER_UNKNOWN_ERROR
+delete gap1 from gap1 join gap2 on gap1.id1 and gap1.id2=gap2.id2 where gap2.id1=3;
+
+# select join / self join
+--error ER_UNKNOWN_ERROR
+select * from gap1, gap2 limit 1 for update;
+--error ER_UNKNOWN_ERROR
+select * from gap1 a, gap1 b limit 1 for update;
+
+# unique secondary key
+create table u1(
+ c1 int,
+ c2 int,
+ c3 int,
+ c4 int,
+ primary key (c1, c2, c3),
+ unique key (c3, c1)
+);
+begin;
+insert into u1 values (1,1,1,1);
+commit;
+begin;
+insert into u1 values (1,2,1,1) on duplicate key update c4=10;
+commit;
+begin;
+select * from u1 where c3=1 and c1 = 1 for update;
+--error ER_UNKNOWN_ERROR
+select * from u1 where c3=1 for update;
+commit;
+drop table u1;
+}
+
+if (!$is_gaplock_target)
+{
+# autocommit doesn't prevent single table operations
+insert into gap1 (id1, id2, id3) values (-1,-1,-1);
+insert into gap1 (id1, id2, id3) values (-1,-1,-1)
+ on duplicate key update value=100;
+update gap1 set value=100 where id1=1;
+update gap1 set value=100 where id1=1 and id2=1 and id3=1;
+delete from gap1 where id1=2;
+delete from gap1 where id1=-1 and id2=-1 and id3=-1;
+commit;
+}
diff --git a/mysql-test/include/mtr_warnings.sql b/mysql-test/include/mtr_warnings.sql
index 635dfd9b8c3..71c693961c1 100644
--- a/mysql-test/include/mtr_warnings.sql
+++ b/mysql-test/include/mtr_warnings.sql
@@ -284,6 +284,7 @@ CREATE DEFINER=root@localhost
PROCEDURE add_suppression(pattern VARCHAR(255))
BEGIN
INSERT INTO test_suppressions (pattern) VALUES (pattern);
+ FLUSH NO_WRITE_TO_BINLOG TABLE test_suppressions;
END
*/||
diff --git a/mysql-test/lib/My/CoreDump.pm b/mysql-test/lib/My/CoreDump.pm
index f9f7b3d8d4b..a421d51ec98 100644
--- a/mysql-test/lib/My/CoreDump.pm
+++ b/mysql-test/lib/My/CoreDump.pm
@@ -53,9 +53,19 @@ sub _verify_binpath {
sub _gdb {
my ($core_name)= @_;
- print "\nTrying 'gdb' to get a backtrace\n";
+ # Check that gdb exists
+ `gdb --version`;
+ if ($?) {
+ print "gdb not found, cannot get the stack trace\n";
+ return;
+ }
- return unless -f $core_name;
+ if (-f $core_name) {
+ print "\nTrying 'gdb' to get a backtrace from coredump $core_name\n";
+ } else {
+ print "\nCoredump $core_name does not exist, cannot run 'gdb'\n";
+ return;
+ }
# Find out name of binary that generated core
`gdb -c '$core_name' --batch 2>&1` =~
diff --git a/mysql-test/lib/generate-ssl-certs.sh b/mysql-test/lib/generate-ssl-certs.sh
index 5dca21a755d..cc919dfe32e 100755
--- a/mysql-test/lib/generate-ssl-certs.sh
+++ b/mysql-test/lib/generate-ssl-certs.sh
@@ -1,4 +1,4 @@
-#/bin/sh -xe
+#!/bin/sh -xe
# simply run me from mysql-test/
cd std_data/
diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl
index dbc2c775e72..296a646d9ba 100755
--- a/mysql-test/mysql-test-run.pl
+++ b/mysql-test/mysql-test-run.pl
@@ -1028,7 +1028,7 @@ sub print_global_resfile {
resfile_global("gprof", $opt_gprof ? 1 : 0);
resfile_global("valgrind", $opt_valgrind ? 1 : 0);
resfile_global("callgrind", $opt_callgrind ? 1 : 0);
- resfile_global("mem", $opt_mem ? 1 : 0);
+ resfile_global("mem", $opt_mem);
resfile_global("tmpdir", $opt_tmpdir);
resfile_global("vardir", $opt_vardir);
resfile_global("fast", $opt_fast ? 1 : 0);
@@ -1423,12 +1423,14 @@ sub command_line_setup {
# Search through list of locations that are known
# to be "fast disks" to find a suitable location
- # Use --mem=<dir> as first location to look.
- my @tmpfs_locations= ($opt_mem,"/run/shm", "/dev/shm", "/tmp");
+ my @tmpfs_locations= ("/run/shm", "/dev/shm", "/tmp");
+
+ # Use $ENV{'MTR_MEM'} as first location to look (if defined)
+ unshift(@tmpfs_locations, $ENV{'MTR_MEM'}) if defined $ENV{'MTR_MEM'};
foreach my $fs (@tmpfs_locations)
{
- if ( -d $fs )
+ if ( -d $fs && ! -l $fs )
{
my $template= "var_${opt_build_thread}_XXXX";
$opt_mem= tempdir( $template, DIR => $fs, CLEANUP => 0);
@@ -4348,7 +4350,7 @@ sub extract_warning_lines ($$) {
qr/InnoDB: Warning: a long semaphore wait:/,
qr/InnoDB: Dumping buffer pool.*/,
qr/InnoDB: Buffer pool.*/,
- qr/InnoDB: Warning: Writer thread is waiting this semaphore/,
+ qr/InnoDB: Warning: Writer thread is waiting this semaphore:/,
qr/Slave: Unknown table 't1' .* 1051/,
qr/Slave SQL:.*(Internal MariaDB error code: [[:digit:]]+|Query:.*)/,
qr/slave SQL thread aborted/,
@@ -5974,9 +5976,9 @@ Options to control directories to use
vardir=DIR The directory where files generated from the test run
is stored (default: ./var). Specifying a ramdisk or
tmpfs will speed up tests.
- mem Run testsuite in "memory" using tmpfs or ramdisk
- Attempts to find a suitable location
- using a builtin list of standard locations
+ mem[=DIR] Run testsuite in "memory" using tmpfs or ramdisk
+ Attempts to use DIR first if specified else
+ uses a builtin list of standard locations
for tmpfs (/run/shm, /dev/shm, /tmp)
The option can also be set using environment
variable MTR_MEM=[DIR]
diff --git a/mysql-test/r/alter_table.result b/mysql-test/r/alter_table.result
index 7cdd042e0a6..c88abd9867e 100644
--- a/mysql-test/r/alter_table.result
+++ b/mysql-test/r/alter_table.result
@@ -1925,8 +1925,8 @@ ALTER TABLE ti1 FORCE;
affected rows: 0
info: Records: 0 Duplicates: 0 Warnings: 0
ALTER TABLE tm1 FORCE;
-affected rows: 2
-info: Records: 2 Duplicates: 0 Warnings: 0
+affected rows: 0
+info: Records: 0 Duplicates: 0 Warnings: 0
ALTER TABLE ti1 AUTO_INCREMENT 3;
affected rows: 0
info: Records: 0 Duplicates: 0 Warnings: 0
@@ -2104,6 +2104,27 @@ Note 1061 Duplicate key name 'id1'
DROP TABLE t2;
DROP TABLE t1;
#
+# MDEV-6390 CONVERT TO CHARACTER SET utf8 doesn't change DEFAULT CHARSET.
+#
+CREATE TABLE t1 (id int(11) NOT NULL, a int(11) NOT NULL, b int(11))
+ENGINE=InnoDB DEFAULT CHARSET=latin1;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` int(11) NOT NULL,
+ `a` int(11) NOT NULL,
+ `b` int(11) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+ALTER TABLE t1 CONVERT TO CHARACTER SET utf8;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` int(11) NOT NULL,
+ `a` int(11) NOT NULL,
+ `b` int(11) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=utf8
+DROP TABLE t1;
+#
# Start of 10.1 tests
#
#
diff --git a/mysql-test/r/contributors.result b/mysql-test/r/contributors.result
index f3f5e227d3a..4a26d0f19dd 100644
--- a/mysql-test/r/contributors.result
+++ b/mysql-test/r/contributors.result
@@ -1,15 +1,17 @@
SHOW CONTRIBUTORS;
Name Location Comment
-Booking.com http://www.booking.com Founding member, Platinum Sponsor of the MariaDB Foundation
+Booking.com https://www.booking.com Founding member, Platinum Sponsor of the MariaDB Foundation
+Alibaba Cloud https://intl.aliyun.com Platinum Sponsor of the MariaDB Foundation
MariaDB Corporation https://mariadb.com Founding member, Gold Sponsor of the MariaDB Foundation
-Visma http://visma.com Gold Sponsor of the MariaDB Foundation
-DBS http://dbs.com Gold Sponsor of the MariaDB Foundation
+Visma https://visma.com Gold Sponsor of the MariaDB Foundation
+DBS https://dbs.com Gold Sponsor of the MariaDB Foundation
Nexedi https://www.nexedi.com Silver Sponsor of the MariaDB Foundation
Acronis http://www.acronis.com Silver Sponsor of the MariaDB Foundation
Auttomattic https://automattic.com Bronze Sponsor of the MariaDB Foundation
-Verkkokauppa.com https://virtuozzo.com Bronze Sponsor of the MariaDB Foundation
-Virtuozzo https://virtuozzo.com/ Bronze Sponsor of the MariaDB Foundation
-Tencent Game DBA http://tencentdba.com/about/ Bronze Sponsor of the MariaDB Foundation
+Verkkokauppa.com https://www.verkkokauppa.com Bronze Sponsor of the MariaDB Foundation
+Virtuozzo https://virtuozzo.com Bronze Sponsor of the MariaDB Foundation
+Tencent Game DBA http://tencentdba.com/about Bronze Sponsor of the MariaDB Foundation
+Tencent TDSQL http://tdsql.org Bronze Sponsor of the MariaDB Foundation
Google USA Sponsoring encryption, parallel replication and GTID
Facebook USA Sponsoring non-blocking API, LIMIT ROWS EXAMINED etc
Ronald Bradford Brisbane, Australia EFF contribution for UC2006 Auction
diff --git a/mysql-test/r/ctype_upgrade.result b/mysql-test/r/ctype_upgrade.result
index b317be42d5c..53cb858035b 100644
--- a/mysql-test/r/ctype_upgrade.result
+++ b/mysql-test/r/ctype_upgrade.result
@@ -227,7 +227,7 @@ DROP TABLE mysql050614_xxx_croatian_ci;
# Checking mysql_upgrade
#
# Running mysql_upgrade
-Phase 1/6: Checking and upgrading mysql database
+Phase 1/7: Checking and upgrading mysql database
Processing databases
mysql
mysql.column_stats OK
@@ -258,10 +258,11 @@ mysql.time_zone_name OK
mysql.time_zone_transition OK
mysql.time_zone_transition_type OK
mysql.user OK
-Phase 2/6: Fixing views
-Phase 3/6: Running 'mysql_fix_privilege_tables'
-Phase 4/6: Fixing table and database names
-Phase 5/6: Checking and upgrading tables
+Phase 2/7: Installing used storage engines... Skipped
+Phase 3/7: Fixing views
+Phase 4/7: Running 'mysql_fix_privilege_tables'
+Phase 5/7: Fixing table and database names
+Phase 6/7: Checking and upgrading tables
Processing databases
information_schema
mtr
@@ -280,11 +281,11 @@ test.maria050313_ucs2_croatian_ci_def OK
test.maria050313_utf8_croatian_ci OK
test.maria050533_xxx_croatian_ci OK
test.maria100004_xxx_croatian_ci OK
-Phase 6/6: Running 'FLUSH PRIVILEGES'
+Phase 7/7: Running 'FLUSH PRIVILEGES'
OK
# Running mysql_upgrade for the second time
# This should report OK for all tables
-Phase 1/6: Checking and upgrading mysql database
+Phase 1/7: Checking and upgrading mysql database
Processing databases
mysql
mysql.column_stats OK
@@ -315,10 +316,11 @@ mysql.time_zone_name OK
mysql.time_zone_transition OK
mysql.time_zone_transition_type OK
mysql.user OK
-Phase 2/6: Fixing views
-Phase 3/6: Running 'mysql_fix_privilege_tables'
-Phase 4/6: Fixing table and database names
-Phase 5/6: Checking and upgrading tables
+Phase 2/7: Installing used storage engines... Skipped
+Phase 3/7: Fixing views
+Phase 4/7: Running 'mysql_fix_privilege_tables'
+Phase 5/7: Fixing table and database names
+Phase 6/7: Checking and upgrading tables
Processing databases
information_schema
mtr
@@ -331,7 +333,7 @@ test.maria050313_utf8_croatian_ci OK
test.maria050533_xxx_croatian_ci OK
test.maria100004_xxx_croatian_ci OK
test.mysql050614_xxx_croatian_ci OK
-Phase 6/6: Running 'FLUSH PRIVILEGES'
+Phase 7/7: Running 'FLUSH PRIVILEGES'
OK
SHOW CREATE TABLE maria050313_ucs2_croatian_ci_def;
Table Create Table
diff --git a/mysql-test/r/derived.result b/mysql-test/r/derived.result
index d0ac61493c2..8a7422ba5ec 100644
--- a/mysql-test/r/derived.result
+++ b/mysql-test/r/derived.result
@@ -1018,6 +1018,29 @@ David Yes 210
Edward Yes 150
DROP TABLE example1463;
set sql_mode= @save_sql_mode;
+#
+# MDEV-9028: SELECT DISTINCT constant column of derived table
+# used as the second operand of LEFT JOIN
+#
+create table t1 (id int, data varchar(255));
+insert into t1 values (1,'yes'),(2,'yes');
+select distinct t1.id, tt.id, tt.data
+from t1
+left join
+(select t1.id, 'yes' as data from t1) as tt
+on t1.id = tt.id;
+id id data
+1 1 yes
+2 2 yes
+select distinct t1.id, tt.id, tt.data
+from t1
+left join
+(select t1.id, 'yes' as data from t1 where id > 1) as tt
+on t1.id = tt.id;
+id id data
+2 2 yes
+1 NULL NULL
+drop table t1;
# end of 5.5
#
# Start of 10.1 tests
diff --git a/mysql-test/r/derived_cond_pushdown.result b/mysql-test/r/derived_cond_pushdown.result
index fd58ee038c7..021633200e1 100644
--- a/mysql-test/r/derived_cond_pushdown.result
+++ b/mysql-test/r/derived_cond_pushdown.result
@@ -8317,7 +8317,7 @@ EXPLAIN
"access_type": "ALL",
"rows": 2,
"filtered": 100,
- "attached_condition": "<in_optimizer>(1,<exists>(subquery#2)) or v1.c = 'foo'",
+ "attached_condition": "<cache>(<in_optimizer>(1,<exists>(subquery#2))) or v1.c = 'foo'",
"materialized": {
"query_block": {
"select_id": 3,
diff --git a/mysql-test/r/derived_view.result b/mysql-test/r/derived_view.result
index 316d7bdc4bc..7a451a312ca 100644
--- a/mysql-test/r/derived_view.result
+++ b/mysql-test/r/derived_view.result
@@ -2305,6 +2305,11 @@ GROUP BY TABLE_SCHEMA) AS UNIQUES
ON ( COLUMNS.TABLE_SCHEMA = UNIQUES.TABLE_SCHEMA);
COUNT(*) > 0
1
+Warnings:
+Warning 1286 Unknown storage engine 'InnoDB'
+Warning 1286 Unknown storage engine 'InnoDB'
+Warning 1286 Unknown storage engine 'InnoDB'
+Warning 1286 Unknown storage engine 'InnoDB'
DROP TABLE t1;
SET SESSION optimizer_switch= @save_optimizer_switch;
#
diff --git a/mysql-test/r/drop_bad_db_type.result b/mysql-test/r/drop_bad_db_type.result
index 6a125cdccf5..de22373e0fd 100644
--- a/mysql-test/r/drop_bad_db_type.result
+++ b/mysql-test/r/drop_bad_db_type.result
@@ -4,6 +4,27 @@ create table t1 (a int) engine=archive;
insert t1 values (1),(2),(3);
flush tables;
uninstall soname 'ha_archive';
+select table_schema, table_name from information_schema.tables where table_name like 't1';
+table_schema test
+table_name t1
+select table_schema, table_name, engine, version from information_schema.tables where table_name like 't1';
+table_schema test
+table_name t1
+engine ARCHIVE
+version NULL
+Warnings:
+Level Warning
+Code 1286
+Message Unknown storage engine 'ARCHIVE'
+select table_schema, table_name, engine, row_format from information_schema.tables where table_name like 't1';
+table_schema test
+table_name t1
+engine ARCHIVE
+row_format NULL
+Warnings:
+Level Warning
+Code 1286
+Message Unknown storage engine 'ARCHIVE'
install soname 'ha_archive';
t1.ARZ
t1.frm
diff --git a/mysql-test/r/gis.result b/mysql-test/r/gis.result
index 005b4239e9c..b9ee2a9136f 100644
--- a/mysql-test/r/gis.result
+++ b/mysql-test/r/gis.result
@@ -1730,7 +1730,7 @@ SPATIAL_REF_SYS CREATE TEMPORARY TABLE `SPATIAL_REF_SYS` (
) ENGINE=MEMORY DEFAULT CHARSET=utf8
create table t1(g GEOMETRY, pt POINT);
create table t2(g LINESTRING, pl POLYGON);
-select * from information_schema.geometry_columns;
+select * from information_schema.geometry_columns where f_table_schema='test';
F_TABLE_CATALOG F_TABLE_SCHEMA F_TABLE_NAME F_GEOMETRY_COLUMN G_TABLE_CATALOG G_TABLE_SCHEMA G_TABLE_NAME G_GEOMETRY_COLUMN STORAGE_TYPE GEOMETRY_TYPE COORD_DIMENSION MAX_PPR SRID
def test t1 def test t1 g 1 0 2 0 0
def test t1 def test t1 pt 1 1 2 0 0
@@ -1739,7 +1739,7 @@ def test t2 def test t2 pl 1 3 2 0 0
drop table t1, t2;
10.1 tests
create table t1(g GEOMETRY(9,4) REF_SYSTEM_ID=101, pt POINT(8,2), pg GEOMETRY REF_SYSTEM_ID=102);
-SELECT SRID from information_schema.geometry_columns WHERE G_TABLE_NAME='t1';
+SELECT SRID from information_schema.geometry_columns WHERE f_table_schema='test' and G_TABLE_NAME='t1';
SRID
101
0
diff --git a/mysql-test/r/grant.result b/mysql-test/r/grant.result
index 2d6d9f3b632..b250137ebf8 100644
--- a/mysql-test/r/grant.result
+++ b/mysql-test/r/grant.result
@@ -2616,6 +2616,61 @@ DROP USER mysqltest_u1@localhost;
# End of Bug#38347.
#
+# BUG#11759114 - '51401: GRANT TREATS NONEXISTENT FUNCTIONS/PRIVILEGES
+# DIFFERENTLY'.
+#
+drop database if exists mysqltest_db1;
+create database mysqltest_db1;
+create user mysqltest_u1;
+# Both GRANT statements below should fail with the same error.
+grant execute on function mysqltest_db1.f1 to mysqltest_u1;
+ERROR 42000: FUNCTION or PROCEDURE f1 does not exist
+grant execute on procedure mysqltest_db1.p1 to mysqltest_u1;
+ERROR 42000: FUNCTION or PROCEDURE p1 does not exist
+# Let us show that GRANT behaviour for routines is consistent
+# with GRANT behaviour for tables. Attempt to grant privilege
+# on non-existent table also results in an error.
+grant select on mysqltest_db1.t1 to mysqltest_u1;
+ERROR 42S02: Table 'mysqltest_db1.t1' doesn't exist
+show grants for mysqltest_u1;
+Grants for mysqltest_u1@%
+GRANT USAGE ON *.* TO 'mysqltest_u1'@'%'
+drop database mysqltest_db1;
+drop user mysqltest_u1;
+#
+# Bug#12766319 - 61865: RENAME USER DOES NOT WORK CORRECTLY -
+# REQUIRES FLUSH PRIVILEGES
+#
+CREATE USER foo@'127.0.0.1';
+GRANT ALL ON *.* TO foo@'127.0.0.1';
+# First attempt, should connect successfully
+connect conn1, '127.0.0.1', foo,,test;
+SELECT user(), current_user();
+user() current_user()
+foo@localhost foo@127.0.0.1
+# Rename the user
+RENAME USER foo@'127.0.0.1' to foo@'127.0.0.0/255.0.0.0';
+# Second attempt, should connect successfully as its valid mask
+# This was failing without fix
+connect conn2, '127.0.0.1', foo,,test;
+SELECT user(), current_user();
+user() current_user()
+foo@localhost foo@127.0.0.0/255.0.0.0
+# Rename the user back to original
+RENAME USER foo@'127.0.0.0/255.0.0.0' to foo@'127.0.0.1';
+# Third attempt, should connect successfully
+connect conn3, '127.0.0.1', foo,,test;
+SELECT user(), current_user();
+user() current_user()
+foo@localhost foo@127.0.0.1
+# Clean-up
+connection default;
+disconnect conn1;
+disconnect conn2;
+disconnect conn3;
+DROP USER foo@'127.0.0.1';
+# End of Bug#12766319
+#
# Bug#11756966 - 48958: STORED PROCEDURES CAN BE LEVERAGED TO BYPASS
# DATABASE SECURITY
#
@@ -2642,28 +2697,6 @@ connection default;
disconnect con1;
DROP USER untrusted@localhost;
DROP DATABASE secret;
-#
-# BUG#11759114 - '51401: GRANT TREATS NONEXISTENT FUNCTIONS/PRIVILEGES
-# DIFFERENTLY'.
-#
-drop database if exists mysqltest_db1;
-create database mysqltest_db1;
-create user mysqltest_u1;
-# Both GRANT statements below should fail with the same error.
-grant execute on function mysqltest_db1.f1 to mysqltest_u1;
-ERROR 42000: FUNCTION or PROCEDURE f1 does not exist
-grant execute on procedure mysqltest_db1.p1 to mysqltest_u1;
-ERROR 42000: FUNCTION or PROCEDURE p1 does not exist
-# Let us show that GRANT behaviour for routines is consistent
-# with GRANT behaviour for tables. Attempt to grant privilege
-# on non-existent table also results in an error.
-grant select on mysqltest_db1.t1 to mysqltest_u1;
-ERROR 42S02: Table 'mysqltest_db1.t1' doesn't exist
-show grants for mysqltest_u1;
-Grants for mysqltest_u1@%
-GRANT USAGE ON *.* TO 'mysqltest_u1'@'%'
-drop database mysqltest_db1;
-drop user mysqltest_u1;
set GLOBAL sql_mode=default;
#
# Start of 10.2 tests
diff --git a/mysql-test/r/handlersocket.result b/mysql-test/r/handlersocket.result
index e38de6bf5c2..26c77813b26 100644
--- a/mysql-test/r/handlersocket.result
+++ b/mysql-test/r/handlersocket.result
@@ -5,7 +5,7 @@ plugin_version 1.0
plugin_status ACTIVE
plugin_type DAEMON
plugin_library handlersocket.so
-plugin_library_version 1.11
+plugin_library_version 1.12
plugin_author higuchi dot akira at dena dot jp
plugin_description Direct access into InnoDB
plugin_license BSD
diff --git a/mysql-test/r/join.result b/mysql-test/r/join.result
index 17e48ae329c..aea2d604b03 100644
--- a/mysql-test/r/join.result
+++ b/mysql-test/r/join.result
@@ -759,6 +759,9 @@ from information_schema.statistics join information_schema.columns using(table_n
TABLE_NAME COLUMN_NAME TABLE_CATALOG TABLE_SCHEMA NON_UNIQUE INDEX_SCHEMA INDEX_NAME SEQ_IN_INDEX COLLATION SUB_PART PACKED NULLABLE INDEX_TYPE COMMENT TABLE_CATALOG TABLE_SCHEMA COLUMN_DEFAULT IS_NULLABLE DATA_TYPE CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH NUMERIC_PRECISION NUMERIC_SCALE CHARACTER_SET_NAME COLLATION_NAME COLUMN_TYPE COLUMN_KEY EXTRA COLUMN_COMMENT
user Host def mysql 0 mysql PRIMARY 1 A NULL NULL BTREE def mysql NO char 60 180 NULL NULL utf8 utf8_bin char(60) PRI
user User def mysql 0 mysql PRIMARY 2 A NULL NULL BTREE def mysql NO char 80 240 NULL NULL utf8 utf8_bin char(80) PRI
+Warnings:
+Warning 1286 Unknown storage engine 'InnoDB'
+Warning 1286 Unknown storage engine 'InnoDB'
drop table t1;
drop table t2;
drop table t3;
diff --git a/mysql-test/r/join_nested.result b/mysql-test/r/join_nested.result
index 28f8a1e5990..917a31e2a79 100644
--- a/mysql-test/r/join_nested.result
+++ b/mysql-test/r/join_nested.result
@@ -1870,4 +1870,99 @@ f4
NULL
NULL
DROP TABLE t1,t2,t3,t4,t5;
+#
+# MDEV-7992: Nested left joins + 'not exists' optimization
+#
+CREATE TABLE t1(
+K1 INT PRIMARY KEY,
+Name VARCHAR(15)
+);
+INSERT INTO t1 VALUES
+(1,'T1Row1'), (2,'T1Row2');
+CREATE TABLE t2(
+K2 INT PRIMARY KEY,
+K1r INT,
+rowTimestamp DATETIME,
+Event VARCHAR(15)
+);
+INSERT INTO t2 VALUES
+(1, 1, '2015-04-13 10:42:11' ,'T1Row1Event1'),
+(2, 1, '2015-04-13 10:42:12' ,'T1Row1Event2'),
+(3, 1, '2015-04-13 10:42:12' ,'T1Row1Event3');
+SELECT t1a.*, t2a.*,
+t2i.K2 AS K2B, t2i.K1r AS K1rB,
+t2i.rowTimestamp AS rowTimestampB, t2i.Event AS EventB
+FROM
+t1 t1a JOIN t2 t2a ON t2a.K1r = t1a.K1
+LEFT JOIN
+( t1 t1i LEFT JOIN t2 t2i ON t2i.K1r = t1i.K1)
+ON (t1i.K1 = 1) AND
+(((t2i.K1r = t1a.K1 AND t2i.rowTimestamp > t2a.rowTimestamp ) OR
+(t2i.rowTimestamp = t2a.rowTimestamp AND t2i.K2 > t2a.K2))
+OR (t2i.K2 IS NULL))
+WHERE
+t2a.K1r = 1 AND t2i.K2 IS NULL;
+K1 Name K2 K1r rowTimestamp Event K2B K1rB rowTimestampB EventB
+1 T1Row1 3 1 2015-04-13 10:42:12 T1Row1Event3 NULL NULL NULL NULL
+EXPLAIN EXTENDED SELECT t1a.*, t2a.*,
+t2i.K2 AS K2B, t2i.K1r AS K1rB,
+t2i.rowTimestamp AS rowTimestampB, t2i.Event AS EventB
+FROM
+t1 t1a JOIN t2 t2a ON t2a.K1r = t1a.K1
+LEFT JOIN
+( t1 t1i LEFT JOIN t2 t2i ON t2i.K1r = t1i.K1)
+ON (t1i.K1 = 1) AND
+(((t2i.K1r = t1a.K1 AND t2i.rowTimestamp > t2a.rowTimestamp ) OR
+(t2i.rowTimestamp = t2a.rowTimestamp AND t2i.K2 > t2a.K2))
+OR (t2i.K2 IS NULL))
+WHERE
+t2a.K1r = 1 AND t2i.K2 IS NULL;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1a const PRIMARY PRIMARY 4 const 1 100.00
+1 SIMPLE t2a ALL NULL NULL NULL NULL 3 100.00 Using where
+1 SIMPLE t1i const PRIMARY PRIMARY 4 const 1 100.00 Using index
+1 SIMPLE t2i ALL NULL NULL NULL NULL 3 100.00 Using where; Not exists
+Warnings:
+Note 1003 select 1 AS `K1`,'T1Row1' AS `Name`,`test`.`t2a`.`K2` AS `K2`,`test`.`t2a`.`K1r` AS `K1r`,`test`.`t2a`.`rowTimestamp` AS `rowTimestamp`,`test`.`t2a`.`Event` AS `Event`,`test`.`t2i`.`K2` AS `K2B`,`test`.`t2i`.`K1r` AS `K1rB`,`test`.`t2i`.`rowTimestamp` AS `rowTimestampB`,`test`.`t2i`.`Event` AS `EventB` from `test`.`t1` `t1a` join `test`.`t2` `t2a` left join (`test`.`t1` `t1i` left join `test`.`t2` `t2i` on(`test`.`t2i`.`K1r` = 1)) on(`test`.`t1i`.`K1` = 1 and (`test`.`t2i`.`K1r` = 1 and `test`.`t2i`.`rowTimestamp` > `test`.`t2a`.`rowTimestamp` or `test`.`t2i`.`rowTimestamp` = `test`.`t2a`.`rowTimestamp` and `test`.`t2i`.`K2` > `test`.`t2a`.`K2` or `test`.`t2i`.`K2` is null)) where `test`.`t2a`.`K1r` = 1 and `test`.`t2i`.`K2` is null
+CREATE VIEW v1 AS
+SELECT t2i.*
+FROM t1 as t1i LEFT JOIN t2 as t2i ON t2i.K1r = t1i.K1
+WHERE t1i.K1 = 1 ;
+SELECT
+t1a.*, t2a.*, t2b.K2 as K2B, t2b.K1r as K1rB,
+t2b.rowTimestamp as rowTimestampB, t2b.Event as EventB
+FROM
+t1 as t1a JOIN t2 as t2a ON t2a.K1r = t1a.K1
+LEFT JOIN
+v1 as t2b
+ON ((t2b.K1r = t1a.K1 AND t2b.rowTimestamp > t2a.rowTimestamp) OR
+(t2b.rowTimestamp = t2a.rowTimestamp AND t2b.K2 > t2a.K2))
+OR (t2b.K2 IS NULL)
+WHERE
+t1a.K1 = 1 AND
+t2b.K2 IS NULL;
+K1 Name K2 K1r rowTimestamp Event K2B K1rB rowTimestampB EventB
+1 T1Row1 3 1 2015-04-13 10:42:12 T1Row1Event3 NULL NULL NULL NULL
+EXPLAIN EXTENDED SELECT
+t1a.*, t2a.*, t2b.K2 as K2B, t2b.K1r as K1rB,
+t2b.rowTimestamp as rowTimestampB, t2b.Event as EventB
+FROM
+t1 as t1a JOIN t2 as t2a ON t2a.K1r = t1a.K1
+LEFT JOIN
+v1 as t2b
+ON ((t2b.K1r = t1a.K1 AND t2b.rowTimestamp > t2a.rowTimestamp) OR
+(t2b.rowTimestamp = t2a.rowTimestamp AND t2b.K2 > t2a.K2))
+OR (t2b.K2 IS NULL)
+WHERE
+t1a.K1 = 1 AND
+t2b.K2 IS NULL;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1a const PRIMARY PRIMARY 4 const 1 100.00
+1 SIMPLE t2a ALL NULL NULL NULL NULL 3 100.00 Using where
+1 SIMPLE t1i const PRIMARY PRIMARY 4 const 1 100.00 Using index
+1 SIMPLE t2i ALL NULL NULL NULL NULL 3 100.00 Using where; Not exists
+Warnings:
+Note 1003 select 1 AS `K1`,'T1Row1' AS `Name`,`t2a`.`K2` AS `K2`,`t2a`.`K1r` AS `K1r`,`t2a`.`rowTimestamp` AS `rowTimestamp`,`t2a`.`Event` AS `Event`,`test`.`t2i`.`K2` AS `K2B`,`test`.`t2i`.`K1r` AS `K1rB`,`test`.`t2i`.`rowTimestamp` AS `rowTimestampB`,`test`.`t2i`.`Event` AS `EventB` from `test`.`t1` `t1a` join `test`.`t2` `t2a` left join (`test`.`t1` `t1i` left join `test`.`t2` `t2i` on(`test`.`t2i`.`K1r` = 1)) on(`test`.`t1i`.`K1` = 1 and (`test`.`t2i`.`K1r` = 1 and `test`.`t2i`.`rowTimestamp` > `t2a`.`rowTimestamp` or `test`.`t2i`.`rowTimestamp` = `t2a`.`rowTimestamp` and `test`.`t2i`.`K2` > `t2a`.`K2` or `test`.`t2i`.`K2` is null)) where `t2a`.`K1r` = 1 and `test`.`t2i`.`K2` is null
+DROP VIEW v1;
+DROP TABLE t1,t2;
set optimizer_search_depth= @tmp_mdev621;
diff --git a/mysql-test/r/join_nested_jcl6.result b/mysql-test/r/join_nested_jcl6.result
index d1f402054cf..1ffd94547cc 100644
--- a/mysql-test/r/join_nested_jcl6.result
+++ b/mysql-test/r/join_nested_jcl6.result
@@ -1881,6 +1881,101 @@ f4
NULL
NULL
DROP TABLE t1,t2,t3,t4,t5;
+#
+# MDEV-7992: Nested left joins + 'not exists' optimization
+#
+CREATE TABLE t1(
+K1 INT PRIMARY KEY,
+Name VARCHAR(15)
+);
+INSERT INTO t1 VALUES
+(1,'T1Row1'), (2,'T1Row2');
+CREATE TABLE t2(
+K2 INT PRIMARY KEY,
+K1r INT,
+rowTimestamp DATETIME,
+Event VARCHAR(15)
+);
+INSERT INTO t2 VALUES
+(1, 1, '2015-04-13 10:42:11' ,'T1Row1Event1'),
+(2, 1, '2015-04-13 10:42:12' ,'T1Row1Event2'),
+(3, 1, '2015-04-13 10:42:12' ,'T1Row1Event3');
+SELECT t1a.*, t2a.*,
+t2i.K2 AS K2B, t2i.K1r AS K1rB,
+t2i.rowTimestamp AS rowTimestampB, t2i.Event AS EventB
+FROM
+t1 t1a JOIN t2 t2a ON t2a.K1r = t1a.K1
+LEFT JOIN
+( t1 t1i LEFT JOIN t2 t2i ON t2i.K1r = t1i.K1)
+ON (t1i.K1 = 1) AND
+(((t2i.K1r = t1a.K1 AND t2i.rowTimestamp > t2a.rowTimestamp ) OR
+(t2i.rowTimestamp = t2a.rowTimestamp AND t2i.K2 > t2a.K2))
+OR (t2i.K2 IS NULL))
+WHERE
+t2a.K1r = 1 AND t2i.K2 IS NULL;
+K1 Name K2 K1r rowTimestamp Event K2B K1rB rowTimestampB EventB
+1 T1Row1 3 1 2015-04-13 10:42:12 T1Row1Event3 NULL NULL NULL NULL
+EXPLAIN EXTENDED SELECT t1a.*, t2a.*,
+t2i.K2 AS K2B, t2i.K1r AS K1rB,
+t2i.rowTimestamp AS rowTimestampB, t2i.Event AS EventB
+FROM
+t1 t1a JOIN t2 t2a ON t2a.K1r = t1a.K1
+LEFT JOIN
+( t1 t1i LEFT JOIN t2 t2i ON t2i.K1r = t1i.K1)
+ON (t1i.K1 = 1) AND
+(((t2i.K1r = t1a.K1 AND t2i.rowTimestamp > t2a.rowTimestamp ) OR
+(t2i.rowTimestamp = t2a.rowTimestamp AND t2i.K2 > t2a.K2))
+OR (t2i.K2 IS NULL))
+WHERE
+t2a.K1r = 1 AND t2i.K2 IS NULL;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1a const PRIMARY PRIMARY 4 const 1 100.00
+1 SIMPLE t2a ALL NULL NULL NULL NULL 3 100.00 Using where
+1 SIMPLE t1i const PRIMARY PRIMARY 4 const 1 100.00 Using index
+1 SIMPLE t2i ALL NULL NULL NULL NULL 3 100.00 Using where; Not exists
+Warnings:
+Note 1003 select 1 AS `K1`,'T1Row1' AS `Name`,`test`.`t2a`.`K2` AS `K2`,`test`.`t2a`.`K1r` AS `K1r`,`test`.`t2a`.`rowTimestamp` AS `rowTimestamp`,`test`.`t2a`.`Event` AS `Event`,`test`.`t2i`.`K2` AS `K2B`,`test`.`t2i`.`K1r` AS `K1rB`,`test`.`t2i`.`rowTimestamp` AS `rowTimestampB`,`test`.`t2i`.`Event` AS `EventB` from `test`.`t1` `t1a` join `test`.`t2` `t2a` left join (`test`.`t1` `t1i` left join `test`.`t2` `t2i` on(`test`.`t2i`.`K1r` = 1)) on(`test`.`t1i`.`K1` = 1 and (`test`.`t2i`.`K1r` = 1 and `test`.`t2i`.`rowTimestamp` > `test`.`t2a`.`rowTimestamp` or `test`.`t2i`.`rowTimestamp` = `test`.`t2a`.`rowTimestamp` and `test`.`t2i`.`K2` > `test`.`t2a`.`K2` or `test`.`t2i`.`K2` is null)) where `test`.`t2a`.`K1r` = 1 and `test`.`t2i`.`K2` is null
+CREATE VIEW v1 AS
+SELECT t2i.*
+FROM t1 as t1i LEFT JOIN t2 as t2i ON t2i.K1r = t1i.K1
+WHERE t1i.K1 = 1 ;
+SELECT
+t1a.*, t2a.*, t2b.K2 as K2B, t2b.K1r as K1rB,
+t2b.rowTimestamp as rowTimestampB, t2b.Event as EventB
+FROM
+t1 as t1a JOIN t2 as t2a ON t2a.K1r = t1a.K1
+LEFT JOIN
+v1 as t2b
+ON ((t2b.K1r = t1a.K1 AND t2b.rowTimestamp > t2a.rowTimestamp) OR
+(t2b.rowTimestamp = t2a.rowTimestamp AND t2b.K2 > t2a.K2))
+OR (t2b.K2 IS NULL)
+WHERE
+t1a.K1 = 1 AND
+t2b.K2 IS NULL;
+K1 Name K2 K1r rowTimestamp Event K2B K1rB rowTimestampB EventB
+1 T1Row1 3 1 2015-04-13 10:42:12 T1Row1Event3 NULL NULL NULL NULL
+EXPLAIN EXTENDED SELECT
+t1a.*, t2a.*, t2b.K2 as K2B, t2b.K1r as K1rB,
+t2b.rowTimestamp as rowTimestampB, t2b.Event as EventB
+FROM
+t1 as t1a JOIN t2 as t2a ON t2a.K1r = t1a.K1
+LEFT JOIN
+v1 as t2b
+ON ((t2b.K1r = t1a.K1 AND t2b.rowTimestamp > t2a.rowTimestamp) OR
+(t2b.rowTimestamp = t2a.rowTimestamp AND t2b.K2 > t2a.K2))
+OR (t2b.K2 IS NULL)
+WHERE
+t1a.K1 = 1 AND
+t2b.K2 IS NULL;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1a const PRIMARY PRIMARY 4 const 1 100.00
+1 SIMPLE t2a ALL NULL NULL NULL NULL 3 100.00 Using where
+1 SIMPLE t1i const PRIMARY PRIMARY 4 const 1 100.00 Using index
+1 SIMPLE t2i ALL NULL NULL NULL NULL 3 100.00 Using where; Not exists
+Warnings:
+Note 1003 select 1 AS `K1`,'T1Row1' AS `Name`,`t2a`.`K2` AS `K2`,`t2a`.`K1r` AS `K1r`,`t2a`.`rowTimestamp` AS `rowTimestamp`,`t2a`.`Event` AS `Event`,`test`.`t2i`.`K2` AS `K2B`,`test`.`t2i`.`K1r` AS `K1rB`,`test`.`t2i`.`rowTimestamp` AS `rowTimestampB`,`test`.`t2i`.`Event` AS `EventB` from `test`.`t1` `t1a` join `test`.`t2` `t2a` left join (`test`.`t1` `t1i` left join `test`.`t2` `t2i` on(`test`.`t2i`.`K1r` = 1)) on(`test`.`t1i`.`K1` = 1 and (`test`.`t2i`.`K1r` = 1 and `test`.`t2i`.`rowTimestamp` > `t2a`.`rowTimestamp` or `test`.`t2i`.`rowTimestamp` = `t2a`.`rowTimestamp` and `test`.`t2i`.`K2` > `t2a`.`K2` or `test`.`t2i`.`K2` is null)) where `t2a`.`K1r` = 1 and `test`.`t2i`.`K2` is null
+DROP VIEW v1;
+DROP TABLE t1,t2;
set optimizer_search_depth= @tmp_mdev621;
CREATE TABLE t5 (a int, b int, c int, PRIMARY KEY(a), KEY b_i (b));
CREATE TABLE t6 (a int, b int, c int, PRIMARY KEY(a), KEY b_i (b));
diff --git a/mysql-test/r/log_tables.result b/mysql-test/r/log_tables.result
index 2ec12bfe1c4..126230a8765 100644
--- a/mysql-test/r/log_tables.result
+++ b/mysql-test/r/log_tables.result
@@ -436,9 +436,9 @@ My own slow query sleep(2)
My own slow query 0
SELECT * FROM mysql.slow_log WHERE seq >= 2 LIMIT 3;
start_time user_host query_time lock_time rows_sent rows_examined db last_insert_id insert_id server_id sql_text thread_id rows_affected seq
-START_TIME USER_HOST QUERY_TIME 00:00:00.000000 1 0 test 0 0 1 SELECT "My own slow query", sleep(2) 3 0 2
-START_TIME USER_HOST QUERY_TIME 00:00:00.000000 1 0 test 0 0 1 SELECT "My own slow query", sleep(2) 3 0 3
-START_TIME USER_HOST QUERY_TIME 00:00:00.000000 1 0 test 0 0 1 SELECT "My own slow query", sleep(2) 3 0 4
+START_TIME USER_HOST QUERY_TIME 00:00:00.000000 1 0 test 0 0 1 SELECT "My own slow query", sleep(2) 4 0 2
+START_TIME USER_HOST QUERY_TIME 00:00:00.000000 1 0 test 0 0 1 SELECT "My own slow query", sleep(2) 4 0 3
+START_TIME USER_HOST QUERY_TIME 00:00:00.000000 1 0 test 0 0 1 SELECT "My own slow query", sleep(2) 4 0 4
SET GLOBAL slow_query_log = 0;
SET SESSION long_query_time =@saved_long_query_time;
FLUSH LOGS;
diff --git a/mysql-test/r/log_tables_upgrade.result b/mysql-test/r/log_tables_upgrade.result
index 6cbb25bd1d4..a56d067c2cd 100644
--- a/mysql-test/r/log_tables_upgrade.result
+++ b/mysql-test/r/log_tables_upgrade.result
@@ -11,7 +11,7 @@ Table Op Msg_type Msg_text
test.bug49823 repair status OK
RENAME TABLE general_log TO renamed_general_log;
RENAME TABLE test.bug49823 TO general_log;
-Phase 1/6: Checking and upgrading mysql database
+Phase 1/7: Checking and upgrading mysql database
Processing databases
mysql
mysql.column_stats OK
@@ -43,10 +43,11 @@ mysql.time_zone_name OK
mysql.time_zone_transition OK
mysql.time_zone_transition_type OK
mysql.user OK
-Phase 2/6: Fixing views
-Phase 3/6: Running 'mysql_fix_privilege_tables'
-Phase 4/6: Fixing table and database names
-Phase 5/6: Checking and upgrading tables
+Phase 2/7: Installing used storage engines... Skipped
+Phase 3/7: Fixing views
+Phase 4/7: Running 'mysql_fix_privilege_tables'
+Phase 5/7: Fixing table and database names
+Phase 6/7: Checking and upgrading tables
Processing databases
information_schema
mtr
@@ -54,7 +55,7 @@ mtr.global_suppressions OK
mtr.test_suppressions OK
performance_schema
test
-Phase 6/6: Running 'FLUSH PRIVILEGES'
+Phase 7/7: Running 'FLUSH PRIVILEGES'
OK
DROP TABLE general_log;
RENAME TABLE renamed_general_log TO general_log;
diff --git a/mysql-test/r/mysql_upgrade-6984.result b/mysql-test/r/mysql_upgrade-6984.result
index fec0fcacb5f..59c9a865b7c 100644
--- a/mysql-test/r/mysql_upgrade-6984.result
+++ b/mysql-test/r/mysql_upgrade-6984.result
@@ -1,5 +1,5 @@
update mysql.user set password=password("foo") where user='root';
-Phase 1/6: Checking and upgrading mysql database
+Phase 1/7: Checking and upgrading mysql database
Processing databases
mysql
mysql.column_stats OK
@@ -42,10 +42,11 @@ error : Corrupt
mysql.innodb_table_stats
Error : Unknown storage engine 'InnoDB'
error : Corrupt
-Phase 2/6: Fixing views
-Phase 3/6: Running 'mysql_fix_privilege_tables'
-Phase 4/6: Fixing table and database names
-Phase 5/6: Checking and upgrading tables
+Phase 2/7: Installing used storage engines... Skipped
+Phase 3/7: Fixing views
+Phase 4/7: Running 'mysql_fix_privilege_tables'
+Phase 5/7: Fixing table and database names
+Phase 6/7: Checking and upgrading tables
Processing databases
information_schema
mtr
@@ -53,7 +54,7 @@ mtr.global_suppressions OK
mtr.test_suppressions OK
performance_schema
test
-Phase 6/6: Running 'FLUSH PRIVILEGES'
+Phase 7/7: Running 'FLUSH PRIVILEGES'
OK
connect con1,localhost,root,foo,,,;
update mysql.user set password='' where user='root';
diff --git a/mysql-test/r/mysql_upgrade.result b/mysql-test/r/mysql_upgrade.result
index 99446cd9d6f..a337a939acc 100644
--- a/mysql-test/r/mysql_upgrade.result
+++ b/mysql-test/r/mysql_upgrade.result
@@ -1,6 +1,6 @@
set sql_mode="";
Run mysql_upgrade once
-Phase 1/6: Checking and upgrading mysql database
+Phase 1/7: Checking and upgrading mysql database
Processing databases
mysql
mysql.column_stats OK
@@ -31,10 +31,11 @@ mysql.time_zone_name OK
mysql.time_zone_transition OK
mysql.time_zone_transition_type OK
mysql.user OK
-Phase 2/6: Fixing views
-Phase 3/6: Running 'mysql_fix_privilege_tables'
-Phase 4/6: Fixing table and database names
-Phase 5/6: Checking and upgrading tables
+Phase 2/7: Installing used storage engines... Skipped
+Phase 3/7: Fixing views
+Phase 4/7: Running 'mysql_fix_privilege_tables'
+Phase 5/7: Fixing table and database names
+Phase 6/7: Checking and upgrading tables
Processing databases
information_schema
mtr
@@ -42,12 +43,12 @@ mtr.global_suppressions OK
mtr.test_suppressions OK
performance_schema
test
-Phase 6/6: Running 'FLUSH PRIVILEGES'
+Phase 7/7: Running 'FLUSH PRIVILEGES'
OK
Run it again - should say already completed
This installation of MySQL is already upgraded to VERSION, use --force if you still need to run mysql_upgrade
Force should run it regardless of whether it has been run before
-Phase 1/6: Checking and upgrading mysql database
+Phase 1/7: Checking and upgrading mysql database
Processing databases
mysql
mysql.column_stats OK
@@ -78,10 +79,11 @@ mysql.time_zone_name OK
mysql.time_zone_transition OK
mysql.time_zone_transition_type OK
mysql.user OK
-Phase 2/6: Fixing views
-Phase 3/6: Running 'mysql_fix_privilege_tables'
-Phase 4/6: Fixing table and database names
-Phase 5/6: Checking and upgrading tables
+Phase 2/7: Installing used storage engines... Skipped
+Phase 3/7: Fixing views
+Phase 4/7: Running 'mysql_fix_privilege_tables'
+Phase 5/7: Fixing table and database names
+Phase 6/7: Checking and upgrading tables
Processing databases
information_schema
mtr
@@ -89,12 +91,12 @@ mtr.global_suppressions OK
mtr.test_suppressions OK
performance_schema
test
-Phase 6/6: Running 'FLUSH PRIVILEGES'
+Phase 7/7: Running 'FLUSH PRIVILEGES'
OK
CREATE USER mysqltest1@'%' IDENTIFIED by 'sakila';
GRANT ALL ON *.* TO mysqltest1@'%';
Run mysql_upgrade with password protected account
-Phase 1/6: Checking and upgrading mysql database
+Phase 1/7: Checking and upgrading mysql database
Processing databases
mysql
mysql.column_stats OK
@@ -125,10 +127,11 @@ mysql.time_zone_name OK
mysql.time_zone_transition OK
mysql.time_zone_transition_type OK
mysql.user OK
-Phase 2/6: Fixing views
-Phase 3/6: Running 'mysql_fix_privilege_tables'
-Phase 4/6: Fixing table and database names
-Phase 5/6: Checking and upgrading tables
+Phase 2/7: Installing used storage engines... Skipped
+Phase 3/7: Fixing views
+Phase 4/7: Running 'mysql_fix_privilege_tables'
+Phase 5/7: Fixing table and database names
+Phase 6/7: Checking and upgrading tables
Processing databases
information_schema
mtr
@@ -136,7 +139,7 @@ mtr.global_suppressions OK
mtr.test_suppressions OK
performance_schema
test
-Phase 6/6: Running 'FLUSH PRIVILEGES'
+Phase 7/7: Running 'FLUSH PRIVILEGES'
OK
DROP USER mysqltest1@'%';
Version check failed. Got the following error when calling the 'mysql' command line client
@@ -146,7 +149,7 @@ Run mysql_upgrade with a non existing server socket
mysqlcheck: Got error: 2005: Unknown MySQL server host 'not_existing_host' (errno) when trying to connect
FATAL ERROR: Upgrade failed
set GLOBAL sql_mode='STRICT_ALL_TABLES,ANSI_QUOTES,NO_ZERO_DATE';
-Phase 1/6: Checking and upgrading mysql database
+Phase 1/7: Checking and upgrading mysql database
Processing databases
mysql
mysql.column_stats OK
@@ -177,10 +180,11 @@ mysql.time_zone_name OK
mysql.time_zone_transition OK
mysql.time_zone_transition_type OK
mysql.user OK
-Phase 2/6: Fixing views
-Phase 3/6: Running 'mysql_fix_privilege_tables'
-Phase 4/6: Fixing table and database names
-Phase 5/6: Checking and upgrading tables
+Phase 2/7: Installing used storage engines... Skipped
+Phase 3/7: Fixing views
+Phase 4/7: Running 'mysql_fix_privilege_tables'
+Phase 5/7: Fixing table and database names
+Phase 6/7: Checking and upgrading tables
Processing databases
information_schema
mtr
@@ -188,7 +192,7 @@ mtr.global_suppressions OK
mtr.test_suppressions OK
performance_schema
test
-Phase 6/6: Running 'FLUSH PRIVILEGES'
+Phase 7/7: Running 'FLUSH PRIVILEGES'
OK
set GLOBAL sql_mode=default;
#
@@ -199,7 +203,7 @@ CREATE PROCEDURE testproc() BEGIN END;
UPDATE mysql.proc SET character_set_client = NULL WHERE name LIKE 'testproc';
UPDATE mysql.proc SET collation_connection = NULL WHERE name LIKE 'testproc';
UPDATE mysql.proc SET db_collation = NULL WHERE name LIKE 'testproc';
-Phase 1/6: Checking and upgrading mysql database
+Phase 1/7: Checking and upgrading mysql database
Processing databases
mysql
mysql.column_stats OK
@@ -230,10 +234,11 @@ mysql.time_zone_name OK
mysql.time_zone_transition OK
mysql.time_zone_transition_type OK
mysql.user OK
-Phase 2/6: Fixing views
-Phase 3/6: Running 'mysql_fix_privilege_tables'
-Phase 4/6: Fixing table and database names
-Phase 5/6: Checking and upgrading tables
+Phase 2/7: Installing used storage engines... Skipped
+Phase 3/7: Fixing views
+Phase 4/7: Running 'mysql_fix_privilege_tables'
+Phase 5/7: Fixing table and database names
+Phase 6/7: Checking and upgrading tables
Processing databases
information_schema
mtr
@@ -241,7 +246,7 @@ mtr.global_suppressions OK
mtr.test_suppressions OK
performance_schema
test
-Phase 6/6: Running 'FLUSH PRIVILEGES'
+Phase 7/7: Running 'FLUSH PRIVILEGES'
OK
CALL testproc();
DROP PROCEDURE testproc;
@@ -255,7 +260,7 @@ WARNING: NULL values of the 'db_collation' column ('mysql.proc' table) have been
GRANT USAGE ON *.* TO 'user3'@'%';
GRANT ALL PRIVILEGES ON `roelt`.`test2` TO 'user3'@'%';
Run mysql_upgrade with all privileges on a user
-Phase 1/6: Checking and upgrading mysql database
+Phase 1/7: Checking and upgrading mysql database
Processing databases
mysql
mysql.column_stats OK
@@ -286,10 +291,11 @@ mysql.time_zone_name OK
mysql.time_zone_transition OK
mysql.time_zone_transition_type OK
mysql.user OK
-Phase 2/6: Fixing views
-Phase 3/6: Running 'mysql_fix_privilege_tables'
-Phase 4/6: Fixing table and database names
-Phase 5/6: Checking and upgrading tables
+Phase 2/7: Installing used storage engines... Skipped
+Phase 3/7: Fixing views
+Phase 4/7: Running 'mysql_fix_privilege_tables'
+Phase 5/7: Fixing table and database names
+Phase 6/7: Checking and upgrading tables
Processing databases
information_schema
mtr
@@ -297,7 +303,7 @@ mtr.global_suppressions OK
mtr.test_suppressions OK
performance_schema
test
-Phase 6/6: Running 'FLUSH PRIVILEGES'
+Phase 7/7: Running 'FLUSH PRIVILEGES'
OK
SHOW GRANTS FOR 'user3'@'%';
Grants for user3@%
@@ -306,7 +312,7 @@ GRANT ALL PRIVILEGES ON `roelt`.`test2` TO 'user3'@'%'
DROP USER 'user3'@'%';
End of 5.1 tests
The --upgrade-system-tables option was used, user tables won't be touched.
-Phase 1/6: Checking and upgrading mysql database
+Phase 1/7: Checking and upgrading mysql database
Processing databases
mysql
mysql.column_stats OK
@@ -337,11 +343,12 @@ mysql.time_zone_name OK
mysql.time_zone_transition OK
mysql.time_zone_transition_type OK
mysql.user OK
-Phase 2/6: Fixing views... Skipped
-Phase 3/6: Running 'mysql_fix_privilege_tables'
-Phase 4/6: Fixing table and database names ... Skipped
-Phase 5/6: Checking and upgrading tables... Skipped
-Phase 6/6: Running 'FLUSH PRIVILEGES'
+Phase 2/7: Installing used storage engines... Skipped
+Phase 3/7: Fixing views... Skipped
+Phase 4/7: Running 'mysql_fix_privilege_tables'
+Phase 5/7: Fixing table and database names ... Skipped
+Phase 6/7: Checking and upgrading tables... Skipped
+Phase 7/7: Running 'FLUSH PRIVILEGES'
OK
#
# Bug#11827359 60223: MYSQL_UPGRADE PROBLEM WITH OPTION
@@ -349,7 +356,7 @@ OK
#
# Droping the previously created mysql_upgrade_info file..
# Running mysql_upgrade with --skip-write-binlog..
-Phase 1/6: Checking and upgrading mysql database
+Phase 1/7: Checking and upgrading mysql database
Processing databases
mysql
mysql.column_stats OK
@@ -380,10 +387,11 @@ mysql.time_zone_name OK
mysql.time_zone_transition OK
mysql.time_zone_transition_type OK
mysql.user OK
-Phase 2/6: Fixing views
-Phase 3/6: Running 'mysql_fix_privilege_tables'
-Phase 4/6: Fixing table and database names
-Phase 5/6: Checking and upgrading tables
+Phase 2/7: Installing used storage engines... Skipped
+Phase 3/7: Fixing views
+Phase 4/7: Running 'mysql_fix_privilege_tables'
+Phase 5/7: Fixing table and database names
+Phase 6/7: Checking and upgrading tables
Processing databases
information_schema
mtr
@@ -391,7 +399,7 @@ mtr.global_suppressions OK
mtr.test_suppressions OK
performance_schema
test
-Phase 6/6: Running 'FLUSH PRIVILEGES'
+Phase 7/7: Running 'FLUSH PRIVILEGES'
OK
#
# Bug #21489398: MYSQL_UPGRADE: FATAL ERROR: UPGRADE FAILED - IMPROVE ERROR
@@ -413,7 +421,7 @@ GRANT INSERT ON mysql.user TO very_long_user_name_number_2;
GRANT UPDATE (User) ON mysql.db TO very_long_user_name_number_1;
GRANT UPDATE (User) ON mysql.db TO very_long_user_name_number_2;
CREATE PROCEDURE test.pr() BEGIN END;
-Phase 1/6: Checking and upgrading mysql database
+Phase 1/7: Checking and upgrading mysql database
Processing databases
mysql
mysql.column_stats OK
@@ -444,10 +452,11 @@ mysql.time_zone_name OK
mysql.time_zone_transition OK
mysql.time_zone_transition_type OK
mysql.user OK
-Phase 2/6: Fixing views
-Phase 3/6: Running 'mysql_fix_privilege_tables'
-Phase 4/6: Fixing table and database names
-Phase 5/6: Checking and upgrading tables
+Phase 2/7: Installing used storage engines... Skipped
+Phase 3/7: Fixing views
+Phase 4/7: Running 'mysql_fix_privilege_tables'
+Phase 5/7: Fixing table and database names
+Phase 6/7: Checking and upgrading tables
Processing databases
information_schema
mtr
@@ -455,7 +464,7 @@ mtr.global_suppressions OK
mtr.test_suppressions OK
performance_schema
test
-Phase 6/6: Running 'FLUSH PRIVILEGES'
+Phase 7/7: Running 'FLUSH PRIVILEGES'
OK
SELECT definer FROM mysql.proc WHERE db = 'test' AND name = 'pr';
definer
@@ -471,7 +480,7 @@ set sql_mode=default;
create table test.t1(a int) engine=MyISAM;
# Trying to enforce InnoDB for all tables
SET GLOBAL enforce_storage_engine=InnoDB;
-Phase 1/6: Checking and upgrading mysql database
+Phase 1/7: Checking and upgrading mysql database
Processing databases
mysql
mysql.column_stats OK
@@ -502,10 +511,11 @@ mysql.time_zone_name OK
mysql.time_zone_transition OK
mysql.time_zone_transition_type OK
mysql.user OK
-Phase 2/6: Fixing views
-Phase 3/6: Running 'mysql_fix_privilege_tables'
-Phase 4/6: Fixing table and database names
-Phase 5/6: Checking and upgrading tables
+Phase 2/7: Installing used storage engines... Skipped
+Phase 3/7: Fixing views
+Phase 4/7: Running 'mysql_fix_privilege_tables'
+Phase 5/7: Fixing table and database names
+Phase 6/7: Checking and upgrading tables
Processing databases
information_schema
mtr
@@ -514,7 +524,7 @@ mtr.test_suppressions OK
performance_schema
test
test.t1 OK
-Phase 6/6: Running 'FLUSH PRIVILEGES'
+Phase 7/7: Running 'FLUSH PRIVILEGES'
OK
# Should return 2
SELECT count(*) FROM information_schema.tables where ENGINE="InnoDB";
diff --git a/mysql-test/r/mysql_upgrade_no_innodb.result b/mysql-test/r/mysql_upgrade_no_innodb.result
index acbca131587..6ad818278f8 100644
--- a/mysql-test/r/mysql_upgrade_no_innodb.result
+++ b/mysql-test/r/mysql_upgrade_no_innodb.result
@@ -1,5 +1,5 @@
The --upgrade-system-tables option was used, user tables won't be touched.
-Phase 1/6: Checking and upgrading mysql database
+Phase 1/7: Checking and upgrading mysql database
Processing databases
mysql
mysql.column_stats OK
@@ -42,9 +42,10 @@ error : Corrupt
mysql.innodb_table_stats
Error : Unknown storage engine 'InnoDB'
error : Corrupt
-Phase 2/6: Fixing views... Skipped
-Phase 3/6: Running 'mysql_fix_privilege_tables'
-Phase 4/6: Fixing table and database names ... Skipped
-Phase 5/6: Checking and upgrading tables... Skipped
-Phase 6/6: Running 'FLUSH PRIVILEGES'
+Phase 2/7: Installing used storage engines... Skipped
+Phase 3/7: Fixing views... Skipped
+Phase 4/7: Running 'mysql_fix_privilege_tables'
+Phase 5/7: Fixing table and database names ... Skipped
+Phase 6/7: Checking and upgrading tables... Skipped
+Phase 7/7: Running 'FLUSH PRIVILEGES'
OK
diff --git a/mysql-test/r/mysql_upgrade_noengine.result b/mysql-test/r/mysql_upgrade_noengine.result
new file mode 100644
index 00000000000..09e705abb69
--- /dev/null
+++ b/mysql-test/r/mysql_upgrade_noengine.result
@@ -0,0 +1,297 @@
+install soname 'ha_blackhole';
+install soname 'ha_archive';
+create table t1 (a int) engine=blackhole;
+create table t2 (a int) engine=archive;
+select table_catalog, table_schema, table_name, table_type, engine, row_format, table_rows, data_length, table_comment from information_schema.tables where table_schema='test';
+table_catalog def
+table_schema test
+table_name t1
+table_type BASE TABLE
+engine BLACKHOLE
+row_format Fixed
+table_rows 0
+data_length 0
+table_comment
+table_catalog def
+table_schema test
+table_name t2
+table_type BASE TABLE
+engine ARCHIVE
+row_format Compressed
+table_rows 0
+data_length 521
+table_comment
+flush tables;
+uninstall plugin blackhole;
+uninstall plugin archive;
+select table_catalog, table_schema, table_name, table_type, engine, row_format, table_rows, data_length, table_comment from information_schema.tables where table_schema='test';
+table_catalog def
+table_schema test
+table_name t1
+table_type BASE TABLE
+engine BLACKHOLE
+row_format NULL
+table_rows NULL
+data_length NULL
+table_comment Unknown storage engine 'BLACKHOLE'
+table_catalog def
+table_schema test
+table_name t2
+table_type BASE TABLE
+engine ARCHIVE
+row_format NULL
+table_rows NULL
+data_length NULL
+table_comment Unknown storage engine 'ARCHIVE'
+Warnings:
+Level Warning
+Code 1286
+Message Unknown storage engine 'BLACKHOLE'
+Level Warning
+Code 1286
+Message Unknown storage engine 'ARCHIVE'
+Phase 1/7: Checking and upgrading mysql database
+Processing databases
+mysql
+mysql.column_stats OK
+mysql.columns_priv OK
+mysql.db OK
+mysql.event OK
+mysql.func OK
+mysql.gtid_slave_pos OK
+mysql.help_category OK
+mysql.help_keyword OK
+mysql.help_relation OK
+mysql.help_topic OK
+mysql.host OK
+mysql.index_stats OK
+mysql.innodb_index_stats OK
+mysql.innodb_table_stats OK
+mysql.plugin OK
+mysql.proc OK
+mysql.procs_priv OK
+mysql.proxies_priv OK
+mysql.roles_mapping OK
+mysql.servers OK
+mysql.table_stats OK
+mysql.tables_priv OK
+mysql.time_zone OK
+mysql.time_zone_leap_second OK
+mysql.time_zone_name OK
+mysql.time_zone_transition OK
+mysql.time_zone_transition_type OK
+mysql.user OK
+Phase 2/7: Installing used storage engines... Skipped
+Phase 3/7: Fixing views
+Phase 4/7: Running 'mysql_fix_privilege_tables'
+Phase 5/7: Fixing table and database names
+Phase 6/7: Checking and upgrading tables
+Processing databases
+information_schema
+mtr
+mtr.global_suppressions OK
+mtr.test_suppressions OK
+performance_schema
+test
+test.t1
+Error : Unknown storage engine 'BLACKHOLE'
+error : Corrupt
+test.t2
+Error : Unknown storage engine 'ARCHIVE'
+error : Corrupt
+
+Repairing tables
+test.t1
+Error : Unknown storage engine 'BLACKHOLE'
+error : Corrupt
+test.t2
+Error : Unknown storage engine 'ARCHIVE'
+error : Corrupt
+Phase 7/7: Running 'FLUSH PRIVILEGES'
+OK
+select table_catalog, table_schema, table_name, table_type, engine, row_format, table_rows, data_length, table_comment from information_schema.tables where table_schema='test';
+table_catalog def
+table_schema test
+table_name t1
+table_type BASE TABLE
+engine BLACKHOLE
+row_format NULL
+table_rows NULL
+data_length NULL
+table_comment Unknown storage engine 'BLACKHOLE'
+table_catalog def
+table_schema test
+table_name t2
+table_type BASE TABLE
+engine ARCHIVE
+row_format NULL
+table_rows NULL
+data_length NULL
+table_comment Unknown storage engine 'ARCHIVE'
+Warnings:
+Level Warning
+Code 1286
+Message Unknown storage engine 'BLACKHOLE'
+Level Warning
+Code 1286
+Message Unknown storage engine 'ARCHIVE'
+alter table mysql.user drop column default_role, drop column max_statement_time;
+Phase 1/7: Checking and upgrading mysql database
+Processing databases
+mysql
+mysql.column_stats OK
+mysql.columns_priv OK
+mysql.db OK
+mysql.event OK
+mysql.func OK
+mysql.gtid_slave_pos OK
+mysql.help_category OK
+mysql.help_keyword OK
+mysql.help_relation OK
+mysql.help_topic OK
+mysql.host OK
+mysql.index_stats OK
+mysql.innodb_index_stats OK
+mysql.innodb_table_stats OK
+mysql.plugin OK
+mysql.proc OK
+mysql.procs_priv OK
+mysql.proxies_priv OK
+mysql.roles_mapping OK
+mysql.servers OK
+mysql.table_stats OK
+mysql.tables_priv OK
+mysql.time_zone OK
+mysql.time_zone_leap_second OK
+mysql.time_zone_name OK
+mysql.time_zone_transition OK
+mysql.time_zone_transition_type OK
+mysql.user OK
+Phase 2/7: Installing used storage engines... Skipped
+Phase 3/7: Fixing views
+Phase 4/7: Running 'mysql_fix_privilege_tables'
+Phase 5/7: Fixing table and database names
+Phase 6/7: Checking and upgrading tables
+Processing databases
+information_schema
+mtr
+mtr.global_suppressions OK
+mtr.test_suppressions OK
+performance_schema
+test
+test.t1
+Error : Unknown storage engine 'BLACKHOLE'
+error : Corrupt
+test.t2
+Error : Unknown storage engine 'ARCHIVE'
+error : Corrupt
+
+Repairing tables
+test.t1
+Error : Unknown storage engine 'BLACKHOLE'
+error : Corrupt
+test.t2
+Error : Unknown storage engine 'ARCHIVE'
+error : Corrupt
+Phase 7/7: Running 'FLUSH PRIVILEGES'
+OK
+select table_catalog, table_schema, table_name, table_type, engine, row_format, table_rows, data_length, table_comment from information_schema.tables where table_schema='test';
+table_catalog def
+table_schema test
+table_name t1
+table_type BASE TABLE
+engine BLACKHOLE
+row_format NULL
+table_rows NULL
+data_length NULL
+table_comment Unknown storage engine 'BLACKHOLE'
+table_catalog def
+table_schema test
+table_name t2
+table_type BASE TABLE
+engine ARCHIVE
+row_format NULL
+table_rows NULL
+data_length NULL
+table_comment Unknown storage engine 'ARCHIVE'
+Warnings:
+Level Warning
+Code 1286
+Message Unknown storage engine 'BLACKHOLE'
+Level Warning
+Code 1286
+Message Unknown storage engine 'ARCHIVE'
+alter table mysql.user drop column default_role, drop column max_statement_time;
+Phase 1/7: Checking and upgrading mysql database
+Processing databases
+mysql
+mysql.column_stats OK
+mysql.columns_priv OK
+mysql.db OK
+mysql.event OK
+mysql.func OK
+mysql.gtid_slave_pos OK
+mysql.help_category OK
+mysql.help_keyword OK
+mysql.help_relation OK
+mysql.help_topic OK
+mysql.host OK
+mysql.index_stats OK
+mysql.innodb_index_stats OK
+mysql.innodb_table_stats OK
+mysql.plugin OK
+mysql.proc OK
+mysql.procs_priv OK
+mysql.proxies_priv OK
+mysql.roles_mapping OK
+mysql.servers OK
+mysql.table_stats OK
+mysql.tables_priv OK
+mysql.time_zone OK
+mysql.time_zone_leap_second OK
+mysql.time_zone_name OK
+mysql.time_zone_transition OK
+mysql.time_zone_transition_type OK
+mysql.user OK
+Upgrading from a version before MariaDB-10.1
+Phase 2/7: Installing used storage engines
+Checking for tables with unknown storage engine
+installing plugin for 'blackhole' storage engine
+installing plugin for 'archive' storage engine
+Phase 3/7: Fixing views
+Phase 4/7: Running 'mysql_fix_privilege_tables'
+Phase 5/7: Fixing table and database names
+Phase 6/7: Checking and upgrading tables
+Processing databases
+information_schema
+mtr
+mtr.global_suppressions OK
+mtr.test_suppressions OK
+performance_schema
+test
+test.t1 OK
+test.t2 OK
+Phase 7/7: Running 'FLUSH PRIVILEGES'
+OK
+select table_catalog, table_schema, table_name, table_type, engine, row_format, table_rows, data_length, table_comment from information_schema.tables where table_schema='test';
+table_catalog def
+table_schema test
+table_name t1
+table_type BASE TABLE
+engine BLACKHOLE
+row_format Fixed
+table_rows 0
+data_length 0
+table_comment
+table_catalog def
+table_schema test
+table_name t2
+table_type BASE TABLE
+engine ARCHIVE
+row_format Compressed
+table_rows 0
+data_length 521
+table_comment
+drop table t1, t2;
+uninstall plugin blackhole;
+uninstall plugin archive;
diff --git a/mysql-test/r/mysql_upgrade_ssl.result b/mysql-test/r/mysql_upgrade_ssl.result
index e06d1bb1671..918a24ffc71 100644
--- a/mysql-test/r/mysql_upgrade_ssl.result
+++ b/mysql-test/r/mysql_upgrade_ssl.result
@@ -1,7 +1,7 @@
#
# Bug#55672 mysql_upgrade dies with internal error
#
-Phase 1/6: Checking and upgrading mysql database
+Phase 1/7: Checking and upgrading mysql database
Processing databases
mysql
mysql.column_stats OK
@@ -32,10 +32,11 @@ mysql.time_zone_name OK
mysql.time_zone_transition OK
mysql.time_zone_transition_type OK
mysql.user OK
-Phase 2/6: Fixing views
-Phase 3/6: Running 'mysql_fix_privilege_tables'
-Phase 4/6: Fixing table and database names
-Phase 5/6: Checking and upgrading tables
+Phase 2/7: Installing used storage engines... Skipped
+Phase 3/7: Fixing views
+Phase 4/7: Running 'mysql_fix_privilege_tables'
+Phase 5/7: Fixing table and database names
+Phase 6/7: Checking and upgrading tables
Processing databases
information_schema
mtr
@@ -43,5 +44,5 @@ mtr.global_suppressions OK
mtr.test_suppressions OK
performance_schema
test
-Phase 6/6: Running 'FLUSH PRIVILEGES'
+Phase 7/7: Running 'FLUSH PRIVILEGES'
OK
diff --git a/mysql-test/r/mysql_upgrade_view.result b/mysql-test/r/mysql_upgrade_view.result
index f43f42f97fd..dc31592566a 100644
--- a/mysql-test/r/mysql_upgrade_view.result
+++ b/mysql-test/r/mysql_upgrade_view.result
@@ -63,7 +63,7 @@ test.v2 check error Upgrade required. Please do "REPAIR VIEW `v2`" or dump/reloa
check view v3 for upgrade;
Table Op Msg_type Msg_text
test.v3 check error Upgrade required. Please do "REPAIR VIEW `v3`" or dump/reload to fix it!
-Phase 1/6: Checking and upgrading mysql database
+Phase 1/7: Checking and upgrading mysql database
Processing databases
mysql
mysql.column_stats OK
@@ -106,14 +106,15 @@ error : Corrupt
mysql.innodb_table_stats
Error : Unknown storage engine 'InnoDB'
error : Corrupt
-Phase 2/6: Fixing views
+Phase 2/7: Installing used storage engines... Skipped
+Phase 3/7: Fixing views
test.v1 OK
test.v1badcheck OK
test.v2 OK
test.v3 OK
-Phase 3/6: Running 'mysql_fix_privilege_tables'
-Phase 4/6: Fixing table and database names
-Phase 5/6: Checking and upgrading tables
+Phase 4/7: Running 'mysql_fix_privilege_tables'
+Phase 5/7: Fixing table and database names
+Phase 6/7: Checking and upgrading tables
Processing databases
information_schema
mtr
@@ -123,7 +124,7 @@ performance_schema
test
test.kv OK
test.t1 OK
-Phase 6/6: Running 'FLUSH PRIVILEGES'
+Phase 7/7: Running 'FLUSH PRIVILEGES'
OK
show create view v1;
View Create View character_set_client collation_connection
@@ -205,7 +206,7 @@ show create view v4;
View Create View character_set_client collation_connection
v4 CREATE ALGORITHM=TEMPTABLE DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v4` AS select `t1`.`a` AS `a` from `t1` latin1 latin1_swedish_ci
MySQL upgrade detected
-Phase 1/6: Checking and upgrading mysql database
+Phase 1/7: Checking and upgrading mysql database
Processing databases
mysql
mysql.column_stats OK
@@ -249,14 +250,15 @@ error : Corrupt
mysql.innodb_table_stats
Error : Unknown storage engine 'InnoDB'
error : Corrupt
-Phase 2/6: Fixing views from mysql
+Phase 2/7: Installing used storage engines... Skipped
+Phase 3/7: Fixing views from mysql
test.v1 OK
test.v2 OK
test.v3 OK
test.v4 OK
-Phase 3/6: Running 'mysql_fix_privilege_tables'
-Phase 4/6: Fixing table and database names
-Phase 5/6: Checking and upgrading tables
+Phase 4/7: Running 'mysql_fix_privilege_tables'
+Phase 5/7: Fixing table and database names
+Phase 6/7: Checking and upgrading tables
Processing databases
information_schema
mtr
@@ -266,7 +268,7 @@ performance_schema
test
test.kv OK
test.t1 OK
-Phase 6/6: Running 'FLUSH PRIVILEGES'
+Phase 7/7: Running 'FLUSH PRIVILEGES'
OK
flush tables;
show create view v1;
@@ -323,7 +325,7 @@ rename table mysql.event to mysql.ev_bk;
flush tables;
The --upgrade-system-tables option was used, user tables won't be touched.
MySQL upgrade detected
-Phase 1/6: Checking and upgrading mysql database
+Phase 1/7: Checking and upgrading mysql database
Processing databases
mysql
mysql.column_stats OK
@@ -367,14 +369,15 @@ error : Corrupt
mysql.innodb_table_stats
Error : Unknown storage engine 'InnoDB'
error : Corrupt
-Phase 2/6: Fixing views from mysql
+Phase 2/7: Installing used storage engines... Skipped
+Phase 3/7: Fixing views from mysql
test.v1 OK
test.v2 OK
test.v3 OK
-Phase 3/6: Running 'mysql_fix_privilege_tables'
-Phase 4/6: Fixing table and database names ... Skipped
-Phase 5/6: Checking and upgrading tables... Skipped
-Phase 6/6: Running 'FLUSH PRIVILEGES'
+Phase 4/7: Running 'mysql_fix_privilege_tables'
+Phase 5/7: Fixing table and database names ... Skipped
+Phase 6/7: Checking and upgrading tables... Skipped
+Phase 7/7: Running 'FLUSH PRIVILEGES'
OK
drop table mysql.event;
rename table mysql.ev_bk to mysql.event;
diff --git a/mysql-test/r/mysqlbinlog_row_compressed.result b/mysql-test/r/mysqlbinlog_row_compressed.result
index 0583ee354df..24fff723ec8 100644
--- a/mysql-test/r/mysqlbinlog_row_compressed.result
+++ b/mysql-test/r/mysqlbinlog_row_compressed.result
@@ -29,10 +29,10 @@ ROLLBACK/*!*/;
/*!100001 SET @@session.server_id=1*//*!*/;
/*!100001 SET @@session.gtid_seq_no=1*//*!*/;
# at 371
-#<date> server id 1 end_log_pos 533 CRC32 XXX Query_compressed thread_id=4 exec_time=x error_code=0
+#<date> server id 1 end_log_pos 533 CRC32 XXX Query_compressed thread_id=5 exec_time=x error_code=0
use `test`/*!*/;
SET TIMESTAMP=X/*!*/;
-SET @@session.pseudo_thread_id=4/*!*/;
+SET @@session.pseudo_thread_id=5/*!*/;
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=1411383296/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
@@ -46,7 +46,7 @@ CREATE TABLE t1 (pk INT PRIMARY KEY, f1 INT, f2 INT, f3 TINYINT, f4 MEDIUMINT, f
#<date> server id 1 end_log_pos 575 CRC32 XXX GTID 0-1-2 ddl
/*!100001 SET @@session.gtid_seq_no=2*//*!*/;
# at 575
-#<date> server id 1 end_log_pos 727 CRC32 XXX Query_compressed thread_id=4 exec_time=x error_code=0
+#<date> server id 1 end_log_pos 727 CRC32 XXX Query_compressed thread_id=5 exec_time=x error_code=0
SET TIMESTAMP=X/*!*/;
CREATE TABLE t2 (pk INT PRIMARY KEY, f1 INT, f2 INT, f3 INT, f4 INT, f5 MEDIUMINT, f6 INT, f7 INT, f8 char(1))
/*!*/;
@@ -74,7 +74,7 @@ BEGIN
### @8=7 /* INT meta=0 nullable=1 is_null=0 */
### @9='' /* STRING(1) meta=65025 nullable=1 is_null=0 */
# at 967
-#<date> server id 1 end_log_pos 1040 CRC32 XXX Query thread_id=4 exec_time=x error_code=0
+#<date> server id 1 end_log_pos 1040 CRC32 XXX Query thread_id=5 exec_time=x error_code=0
SET TIMESTAMP=X/*!*/;
COMMIT
/*!*/;
@@ -102,7 +102,7 @@ BEGIN
### @8=7 /* INT meta=0 nullable=1 is_null=0 */
### @9=NULL /* STRING(1) meta=65025 nullable=1 is_null=1 */
# at 1281
-#<date> server id 1 end_log_pos 1354 CRC32 XXX Query thread_id=4 exec_time=x error_code=0
+#<date> server id 1 end_log_pos 1354 CRC32 XXX Query thread_id=5 exec_time=x error_code=0
SET TIMESTAMP=X/*!*/;
COMMIT
/*!*/;
@@ -130,7 +130,7 @@ BEGIN
### @8=7 /* INT meta=0 nullable=1 is_null=0 */
### @9='A' /* STRING(1) meta=65025 nullable=1 is_null=0 */
# at 1596
-#<date> server id 1 end_log_pos 1669 CRC32 XXX Query thread_id=4 exec_time=x error_code=0
+#<date> server id 1 end_log_pos 1669 CRC32 XXX Query thread_id=5 exec_time=x error_code=0
SET TIMESTAMP=X/*!*/;
COMMIT
/*!*/;
@@ -158,7 +158,7 @@ BEGIN
### @8=7 /* INT meta=0 nullable=1 is_null=0 */
### @9='A' /* STRING(1) meta=65025 nullable=1 is_null=0 */
# at 1909
-#<date> server id 1 end_log_pos 1982 CRC32 XXX Query thread_id=4 exec_time=x error_code=0
+#<date> server id 1 end_log_pos 1982 CRC32 XXX Query thread_id=5 exec_time=x error_code=0
SET TIMESTAMP=X/*!*/;
COMMIT
/*!*/;
@@ -219,7 +219,7 @@ BEGIN
### @8=7 /* INT meta=0 nullable=1 is_null=0 */
### @9='A' /* STRING(1) meta=65025 nullable=1 is_null=0 */
# at 2225
-#<date> server id 1 end_log_pos 2298 CRC32 XXX Query thread_id=4 exec_time=x error_code=0
+#<date> server id 1 end_log_pos 2298 CRC32 XXX Query thread_id=5 exec_time=x error_code=0
SET TIMESTAMP=X/*!*/;
COMMIT
/*!*/;
@@ -299,7 +299,7 @@ BEGIN
### @8=7 /* INT meta=0 nullable=1 is_null=0 */
### @9='A' /* STRING(1) meta=65025 nullable=1 is_null=0 */
# at 2561
-#<date> server id 1 end_log_pos 2634 CRC32 XXX Query thread_id=4 exec_time=x error_code=0
+#<date> server id 1 end_log_pos 2634 CRC32 XXX Query thread_id=5 exec_time=x error_code=0
SET TIMESTAMP=X/*!*/;
COMMIT
/*!*/;
@@ -360,7 +360,7 @@ BEGIN
### @8=7 /* INT meta=0 nullable=1 is_null=0 */
### @9='A' /* STRING(1) meta=65025 nullable=1 is_null=0 */
# at 2861
-#<date> server id 1 end_log_pos 2934 CRC32 XXX Query thread_id=4 exec_time=x error_code=0
+#<date> server id 1 end_log_pos 2934 CRC32 XXX Query thread_id=5 exec_time=x error_code=0
SET TIMESTAMP=X/*!*/;
COMMIT
/*!*/;
@@ -421,7 +421,7 @@ BEGIN
### @8=7 /* INT meta=0 nullable=1 is_null=0 */
### @9='A' /* STRING(1) meta=65025 nullable=1 is_null=0 */
# at 3154
-#<date> server id 1 end_log_pos 3227 CRC32 XXX Query thread_id=4 exec_time=x error_code=0
+#<date> server id 1 end_log_pos 3227 CRC32 XXX Query thread_id=5 exec_time=x error_code=0
SET TIMESTAMP=X/*!*/;
COMMIT
/*!*/;
diff --git a/mysql-test/r/mysqlbinlog_row_minimal.result b/mysql-test/r/mysqlbinlog_row_minimal.result
index 6d36ec0e82f..ca8e43bfb33 100644
--- a/mysql-test/r/mysqlbinlog_row_minimal.result
+++ b/mysql-test/r/mysqlbinlog_row_minimal.result
@@ -27,10 +27,10 @@ ROLLBACK/*!*/;
/*!100001 SET @@session.server_id=1*//*!*/;
/*!100001 SET @@session.gtid_seq_no=1*//*!*/;
# at 371
-#<date> server id 1 end_log_pos 555 CRC32 XXX Query thread_id=4 exec_time=x error_code=0
+#<date> server id 1 end_log_pos 555 CRC32 XXX Query thread_id=5 exec_time=x error_code=0
use `test`/*!*/;
SET TIMESTAMP=X/*!*/;
-SET @@session.pseudo_thread_id=4/*!*/;
+SET @@session.pseudo_thread_id=5/*!*/;
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=1411383296/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
@@ -44,7 +44,7 @@ CREATE TABLE t1 (pk INT PRIMARY KEY, f1 INT, f2 INT, f3 TINYINT, f4 MEDIUMINT, f
#<date> server id 1 end_log_pos 597 CRC32 XXX GTID 0-1-2 ddl
/*!100001 SET @@session.gtid_seq_no=2*//*!*/;
# at 597
-#<date> server id 1 end_log_pos 774 CRC32 XXX Query thread_id=4 exec_time=x error_code=0
+#<date> server id 1 end_log_pos 774 CRC32 XXX Query thread_id=5 exec_time=x error_code=0
SET TIMESTAMP=X/*!*/;
CREATE TABLE t2 (pk INT PRIMARY KEY, f1 INT, f2 INT, f3 INT, f4 INT, f5 MEDIUMINT, f6 INT, f7 INT, f8 char(1))
/*!*/;
@@ -72,7 +72,7 @@ BEGIN
### @8=7 /* INT meta=0 nullable=1 is_null=0 */
### @9='' /* STRING(1) meta=65025 nullable=1 is_null=0 */
# at 1015
-#<date> server id 1 end_log_pos 1088 CRC32 XXX Query thread_id=4 exec_time=x error_code=0
+#<date> server id 1 end_log_pos 1088 CRC32 XXX Query thread_id=5 exec_time=x error_code=0
SET TIMESTAMP=X/*!*/;
COMMIT
/*!*/;
@@ -100,7 +100,7 @@ BEGIN
### @8=7 /* INT meta=0 nullable=1 is_null=0 */
### @9=NULL /* STRING(1) meta=65025 nullable=1 is_null=1 */
# at 1330
-#<date> server id 1 end_log_pos 1403 CRC32 XXX Query thread_id=4 exec_time=x error_code=0
+#<date> server id 1 end_log_pos 1403 CRC32 XXX Query thread_id=5 exec_time=x error_code=0
SET TIMESTAMP=X/*!*/;
COMMIT
/*!*/;
@@ -128,7 +128,7 @@ BEGIN
### @8=7 /* INT meta=0 nullable=1 is_null=0 */
### @9='A' /* STRING(1) meta=65025 nullable=1 is_null=0 */
# at 1646
-#<date> server id 1 end_log_pos 1719 CRC32 XXX Query thread_id=4 exec_time=x error_code=0
+#<date> server id 1 end_log_pos 1719 CRC32 XXX Query thread_id=5 exec_time=x error_code=0
SET TIMESTAMP=X/*!*/;
COMMIT
/*!*/;
@@ -156,7 +156,7 @@ BEGIN
### @8=7 /* INT meta=0 nullable=1 is_null=0 */
### @9='A' /* STRING(1) meta=65025 nullable=1 is_null=0 */
# at 1962
-#<date> server id 1 end_log_pos 2035 CRC32 XXX Query thread_id=4 exec_time=x error_code=0
+#<date> server id 1 end_log_pos 2035 CRC32 XXX Query thread_id=5 exec_time=x error_code=0
SET TIMESTAMP=X/*!*/;
COMMIT
/*!*/;
@@ -217,7 +217,7 @@ BEGIN
### @8=7 /* INT meta=0 nullable=1 is_null=0 */
### @9='A' /* STRING(1) meta=65025 nullable=1 is_null=0 */
# at 2354
-#<date> server id 1 end_log_pos 2427 CRC32 XXX Query thread_id=4 exec_time=x error_code=0
+#<date> server id 1 end_log_pos 2427 CRC32 XXX Query thread_id=5 exec_time=x error_code=0
SET TIMESTAMP=X/*!*/;
COMMIT
/*!*/;
@@ -252,7 +252,7 @@ BEGIN
### SET
### @5=5 /* INT meta=0 nullable=1 is_null=0 */
# at 2665
-#<date> server id 1 end_log_pos 2738 CRC32 XXX Query thread_id=4 exec_time=x error_code=0
+#<date> server id 1 end_log_pos 2738 CRC32 XXX Query thread_id=5 exec_time=x error_code=0
SET TIMESTAMP=X/*!*/;
COMMIT
/*!*/;
@@ -281,7 +281,7 @@ BEGIN
### WHERE
### @1=13 /* INT meta=0 nullable=0 is_null=0 */
# at 2927
-#<date> server id 1 end_log_pos 3000 CRC32 XXX Query thread_id=4 exec_time=x error_code=0
+#<date> server id 1 end_log_pos 3000 CRC32 XXX Query thread_id=5 exec_time=x error_code=0
SET TIMESTAMP=X/*!*/;
COMMIT
/*!*/;
@@ -310,7 +310,7 @@ BEGIN
### WHERE
### @1=13 /* INT meta=0 nullable=0 is_null=0 */
# at 3189
-#<date> server id 1 end_log_pos 3262 CRC32 XXX Query thread_id=4 exec_time=x error_code=0
+#<date> server id 1 end_log_pos 3262 CRC32 XXX Query thread_id=5 exec_time=x error_code=0
SET TIMESTAMP=X/*!*/;
COMMIT
/*!*/;
diff --git a/mysql-test/r/mysqlbinlog_stmt_compressed.result b/mysql-test/r/mysqlbinlog_stmt_compressed.result
index cb268cac0d4..cd8e98c1ee3 100644
--- a/mysql-test/r/mysqlbinlog_stmt_compressed.result
+++ b/mysql-test/r/mysqlbinlog_stmt_compressed.result
@@ -29,10 +29,10 @@ ROLLBACK/*!*/;
/*!100001 SET @@session.server_id=1*//*!*/;
/*!100001 SET @@session.gtid_seq_no=1*//*!*/;
# at 371
-#<date> server id 1 end_log_pos 533 CRC32 XXX Query_compressed thread_id=4 exec_time=x error_code=0
+#<date> server id 1 end_log_pos 533 CRC32 XXX Query_compressed thread_id=5 exec_time=x error_code=0
use `test`/*!*/;
SET TIMESTAMP=X/*!*/;
-SET @@session.pseudo_thread_id=4/*!*/;
+SET @@session.pseudo_thread_id=5/*!*/;
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=1411383296/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
@@ -46,7 +46,7 @@ CREATE TABLE t1 (pk INT PRIMARY KEY, f1 INT, f2 INT, f3 TINYINT, f4 MEDIUMINT, f
#<date> server id 1 end_log_pos 575 CRC32 XXX GTID 0-1-2 ddl
/*!100001 SET @@session.gtid_seq_no=2*//*!*/;
# at 575
-#<date> server id 1 end_log_pos 727 CRC32 XXX Query_compressed thread_id=4 exec_time=x error_code=0
+#<date> server id 1 end_log_pos 727 CRC32 XXX Query_compressed thread_id=5 exec_time=x error_code=0
SET TIMESTAMP=X/*!*/;
CREATE TABLE t2 (pk INT PRIMARY KEY, f1 INT, f2 INT, f3 INT, f4 INT, f5 MEDIUMINT, f6 INT, f7 INT, f8 char(1))
/*!*/;
@@ -56,12 +56,12 @@ CREATE TABLE t2 (pk INT PRIMARY KEY, f1 INT, f2 INT, f3 INT, f4 INT, f5 MEDIUMIN
BEGIN
/*!*/;
# at 769
-#<date> server id 1 end_log_pos 897 CRC32 XXX Query_compressed thread_id=4 exec_time=x error_code=0
+#<date> server id 1 end_log_pos 897 CRC32 XXX Query_compressed thread_id=5 exec_time=x error_code=0
SET TIMESTAMP=X/*!*/;
INSERT INTO t1 VALUES (10, 1, 2, 3, 4, 5, 6, 7, "")
/*!*/;
# at 897
-#<date> server id 1 end_log_pos 970 CRC32 XXX Query thread_id=4 exec_time=x error_code=0
+#<date> server id 1 end_log_pos 970 CRC32 XXX Query thread_id=5 exec_time=x error_code=0
SET TIMESTAMP=X/*!*/;
COMMIT
/*!*/;
@@ -71,12 +71,12 @@ COMMIT
BEGIN
/*!*/;
# at 1012
-#<date> server id 1 end_log_pos 1140 CRC32 XXX Query_compressed thread_id=4 exec_time=x error_code=0
+#<date> server id 1 end_log_pos 1140 CRC32 XXX Query_compressed thread_id=5 exec_time=x error_code=0
SET TIMESTAMP=X/*!*/;
INSERT INTO t1 VALUES (11, 1, 2, 3, 4, 5, 6, 7, NULL)
/*!*/;
# at 1140
-#<date> server id 1 end_log_pos 1213 CRC32 XXX Query thread_id=4 exec_time=x error_code=0
+#<date> server id 1 end_log_pos 1213 CRC32 XXX Query thread_id=5 exec_time=x error_code=0
SET TIMESTAMP=X/*!*/;
COMMIT
/*!*/;
@@ -86,12 +86,12 @@ COMMIT
BEGIN
/*!*/;
# at 1255
-#<date> server id 1 end_log_pos 1385 CRC32 XXX Query_compressed thread_id=4 exec_time=x error_code=0
+#<date> server id 1 end_log_pos 1385 CRC32 XXX Query_compressed thread_id=5 exec_time=x error_code=0
SET TIMESTAMP=X/*!*/;
INSERT INTO t1 VALUES (12, 1, 2, 3, NULL, 5, 6, 7, "A")
/*!*/;
# at 1385
-#<date> server id 1 end_log_pos 1458 CRC32 XXX Query thread_id=4 exec_time=x error_code=0
+#<date> server id 1 end_log_pos 1458 CRC32 XXX Query thread_id=5 exec_time=x error_code=0
SET TIMESTAMP=X/*!*/;
COMMIT
/*!*/;
@@ -101,12 +101,12 @@ COMMIT
BEGIN
/*!*/;
# at 1500
-#<date> server id 1 end_log_pos 1627 CRC32 XXX Query_compressed thread_id=4 exec_time=x error_code=0
+#<date> server id 1 end_log_pos 1627 CRC32 XXX Query_compressed thread_id=5 exec_time=x error_code=0
SET TIMESTAMP=X/*!*/;
INSERT INTO t1 VALUES (13, 1, 2, 3, 0, 5, 6, 7, "A")
/*!*/;
# at 1627
-#<date> server id 1 end_log_pos 1700 CRC32 XXX Query thread_id=4 exec_time=x error_code=0
+#<date> server id 1 end_log_pos 1700 CRC32 XXX Query thread_id=5 exec_time=x error_code=0
SET TIMESTAMP=X/*!*/;
COMMIT
/*!*/;
@@ -116,12 +116,12 @@ COMMIT
BEGIN
/*!*/;
# at 1742
-#<date> server id 1 end_log_pos 1850 CRC32 XXX Query_compressed thread_id=4 exec_time=x error_code=0
+#<date> server id 1 end_log_pos 1850 CRC32 XXX Query_compressed thread_id=5 exec_time=x error_code=0
SET TIMESTAMP=X/*!*/;
INSERT INTO t2 SELECT * FROM t1
/*!*/;
# at 1850
-#<date> server id 1 end_log_pos 1923 CRC32 XXX Query thread_id=4 exec_time=x error_code=0
+#<date> server id 1 end_log_pos 1923 CRC32 XXX Query thread_id=5 exec_time=x error_code=0
SET TIMESTAMP=X/*!*/;
COMMIT
/*!*/;
@@ -131,12 +131,12 @@ COMMIT
BEGIN
/*!*/;
# at 1965
-#<date> server id 1 end_log_pos 2082 CRC32 XXX Query_compressed thread_id=4 exec_time=x error_code=0
+#<date> server id 1 end_log_pos 2082 CRC32 XXX Query_compressed thread_id=5 exec_time=x error_code=0
SET TIMESTAMP=X/*!*/;
UPDATE t2 SET f4=5 WHERE f4>0 or f4 is NULL
/*!*/;
# at 2082
-#<date> server id 1 end_log_pos 2155 CRC32 XXX Query thread_id=4 exec_time=x error_code=0
+#<date> server id 1 end_log_pos 2155 CRC32 XXX Query thread_id=5 exec_time=x error_code=0
SET TIMESTAMP=X/*!*/;
COMMIT
/*!*/;
@@ -146,12 +146,12 @@ COMMIT
BEGIN
/*!*/;
# at 2197
-#<date> server id 1 end_log_pos 2288 CRC32 XXX Query_compressed thread_id=4 exec_time=x error_code=0
+#<date> server id 1 end_log_pos 2288 CRC32 XXX Query_compressed thread_id=5 exec_time=x error_code=0
SET TIMESTAMP=X/*!*/;
DELETE FROM t1
/*!*/;
# at 2288
-#<date> server id 1 end_log_pos 2361 CRC32 XXX Query thread_id=4 exec_time=x error_code=0
+#<date> server id 1 end_log_pos 2361 CRC32 XXX Query thread_id=5 exec_time=x error_code=0
SET TIMESTAMP=X/*!*/;
COMMIT
/*!*/;
@@ -161,12 +161,12 @@ COMMIT
BEGIN
/*!*/;
# at 2403
-#<date> server id 1 end_log_pos 2494 CRC32 XXX Query_compressed thread_id=4 exec_time=x error_code=0
+#<date> server id 1 end_log_pos 2494 CRC32 XXX Query_compressed thread_id=5 exec_time=x error_code=0
SET TIMESTAMP=X/*!*/;
DELETE FROM t2
/*!*/;
# at 2494
-#<date> server id 1 end_log_pos 2567 CRC32 XXX Query thread_id=4 exec_time=x error_code=0
+#<date> server id 1 end_log_pos 2567 CRC32 XXX Query thread_id=5 exec_time=x error_code=0
SET TIMESTAMP=X/*!*/;
COMMIT
/*!*/;
diff --git a/mysql-test/r/mysqldump.result b/mysql-test/r/mysqldump.result
index 277c7ab64dc..b46115c26f9 100644
--- a/mysql-test/r/mysqldump.result
+++ b/mysql-test/r/mysqldump.result
@@ -5533,3 +5533,4 @@ USE `db1`;
DROP DATABASE db1;
DROP DATABASE db2;
+FOUND /Database: mysql/ in bug11505.sql
diff --git a/mysql-test/r/partition_column.result b/mysql-test/r/partition_column.result
index 06d39771466..3df31078a50 100644
--- a/mysql-test/r/partition_column.result
+++ b/mysql-test/r/partition_column.result
@@ -540,7 +540,7 @@ a b
drop table t1;
create table t1 as select to_seconds(null) as to_seconds;
select data_type from information_schema.columns
-where column_name='to_seconds';
+where table_schema='test' and column_name='to_seconds';
data_type
int
drop table t1;
diff --git a/mysql-test/r/partition_innodb.result b/mysql-test/r/partition_innodb.result
index c1eff91de53..047b6dac2b6 100644
--- a/mysql-test/r/partition_innodb.result
+++ b/mysql-test/r/partition_innodb.result
@@ -740,6 +740,97 @@ SELECT * FROM t1 WHERE d = '1991-01-01';
d
1991-01-01
DROP TABLE t1;
+set global default_storage_engine=default;
+#
+# MDEV-9455: [ERROR] mysqld got signal 11
+#
+CREATE TABLE `t1` (
+`DIARY_TOTAL_DAY_SEQ` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
+`IMORY_ID` bigint(20) NOT NULL,
+`NAME` varchar(75) DEFAULT NULL,
+`DATETIME` varchar(10) NOT NULL DEFAULT '',
+`DAILY_CALL_CNT` int(11) DEFAULT NULL,
+`DAILY_SMS_CNT` int(11) DEFAULT NULL,
+`NUMBER` varchar(64) DEFAULT NULL,
+`DURATION` varchar(16) DEFAULT NULL,
+PRIMARY KEY (`DIARY_TOTAL_DAY_SEQ`,`DATETIME`),
+KEY `IDX_t1_01` (`IMORY_ID`,`DATETIME`)
+) AUTO_INCREMENT=328702514 DEFAULT CHARSET=utf8mb4
+PARTITION BY RANGE COLUMNS(`DATETIME`)
+(PARTITION p0 VALUES LESS THAN ('2015-10-01') ENGINE = InnoDB,
+PARTITION p1 VALUES LESS THAN ('2015-11-01') ENGINE = InnoDB,
+PARTITION p2 VALUES LESS THAN ('2015-12-01') ENGINE = InnoDB,
+PARTITION p3 VALUES LESS THAN ('2016-01-01') ENGINE = InnoDB,
+PARTITION p4 VALUES LESS THAN ('2016-02-01') ENGINE = InnoDB,
+PARTITION p5 VALUES LESS THAN ('2016-03-01') ENGINE = InnoDB,
+PARTITION p6 VALUES LESS THAN ('2016-04-01') ENGINE = InnoDB,
+PARTITION p7 VALUES LESS THAN ('2016-05-01') ENGINE = InnoDB,
+PARTITION p8 VALUES LESS THAN ('2016-06-01') ENGINE = InnoDB,
+PARTITION p9 VALUES LESS THAN ('2016-07-01') ENGINE = InnoDB,
+PARTITION p10 VALUES LESS THAN ('2016-08-01') ENGINE = InnoDB)
+;
+CREATE TABLE `t2` (
+`DIARY_SEQ` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
+`IMORY_ID` bigint(20) NOT NULL,
+`CALL_TYPE` varchar(1) DEFAULT NULL,
+`DATA_TYPE` varchar(1) DEFAULT NULL,
+`FEATURES` varchar(1) DEFAULT NULL,
+`NAME` varchar(75) DEFAULT NULL,
+`NUMBER` varchar(64) DEFAULT NULL,
+`DATETIME` datetime NOT NULL,
+`REG_DATE` datetime NOT NULL,
+`TITLE` varchar(50) DEFAULT NULL,
+`BODY` varchar(4200) DEFAULT NULL,
+`MIME_TYPE` varchar(32) DEFAULT NULL,
+`DURATION` varchar(16) DEFAULT NULL,
+`DEVICE_ID` varchar(64) DEFAULT NULL,
+`DEVICE_NAME` varchar(32) DEFAULT NULL,
+PRIMARY KEY (`DIARY_SEQ`,`DATETIME`,`REG_DATE`),
+KEY `IDX_TB_DIARY_01` (`IMORY_ID`,`DATETIME`,`CALL_TYPE`,`NUMBER`),
+KEY `IDX_TB_DIARY_02` (`REG_DATE`)
+) AUTO_INCREMENT=688799006 DEFAULT CHARSET=utf8mb4
+PARTITION BY RANGE COLUMNS(REG_DATE)
+(PARTITION p0 VALUES LESS THAN ('2015-10-01') ENGINE = InnoDB,
+PARTITION p1 VALUES LESS THAN ('2015-11-01') ENGINE = InnoDB,
+PARTITION p2 VALUES LESS THAN ('2015-12-01') ENGINE = InnoDB,
+PARTITION p3 VALUES LESS THAN ('2016-01-01') ENGINE = InnoDB,
+PARTITION p4 VALUES LESS THAN ('2016-02-01') ENGINE = InnoDB,
+PARTITION p5 VALUES LESS THAN ('2016-03-01') ENGINE = InnoDB,
+PARTITION p6 VALUES LESS THAN ('2016-04-01') ENGINE = InnoDB,
+PARTITION p7 VALUES LESS THAN ('2016-05-01') ENGINE = InnoDB,
+PARTITION p8 VALUES LESS THAN ('2016-06-01') ENGINE = InnoDB,
+PARTITION p9 VALUES LESS THAN ('2016-07-01') ENGINE = InnoDB,
+PARTITION p10 VALUES LESS THAN ('2016-08-01') ENGINE = InnoDB)
+;
+SELECT
+A.IMORY_ID,
+A.NUMBER,
+A.NAME,
+DATE_FORMAT(A.DATETIME, '%Y-%m-%d') AS TARGET_DATE,
+SUM( CASE WHEN A.DATA_TYPE='1' THEN 1 ELSE 0 END) AS CALL_CNT,
+SUM( CASE WHEN A.DATA_TYPE IN ('2', '3') THEN 1 ELSE 0 END) AS SMS_CNT,
+SUM(CAST(A.DURATION AS INT)) AS DURATION,
+( SELECT COUNT(*)
+FROM t1
+WHERE IMORY_ID=A.IMORY_ID
+AND NUMBER=A.NUMBER
+AND NAME=A.NAME
+AND DATETIME = DATE_FORMAT(A.DATETIME, '%Y-%m-%d')
+) STATS_COUNT
+FROM t2 A
+WHERE A.IMORY_ID = 55094102
+AND A.DATETIME LIKE (
+SELECT CONCAT (DATE_FORMAT(DATETIME, '%Y-%m-%d') ,'%')
+FROM t2
+WHERE IMORY_ID=55094102
+AND DIARY_SEQ IN ( 608351221, 608351225, 608351229 )
+group by DATE_FORMAT(DATETIME, '%Y-%m-%d')
+)
+GROUP BY A.IMORY_ID, A.NUMBER, A.NAME, DATE_FORMAT(A.DATETIME, '%Y-%m-%d')
+;
+IMORY_ID NUMBER NAME TARGET_DATE CALL_CNT SMS_CNT DURATION STATS_COUNT
+drop table t2, t1;
+set global default_storage_engine='innodb';
#
# MDEV-5963: InnoDB: Assertion failure in file row0sel.cc line 2503,
# Failing assertion: 0 with "key ptr now exceeds key end by 762 bytes"
diff --git a/mysql-test/r/partition_myisam.result b/mysql-test/r/partition_myisam.result
index f9f917a2803..664eb60c2c5 100644
--- a/mysql-test/r/partition_myisam.result
+++ b/mysql-test/r/partition_myisam.result
@@ -230,6 +230,22 @@ PARTITION pMax VALUES LESS THAN MAXVALUE);
INSERT INTO t1 VALUES (1, "Partition p1, first row");
DROP TABLE t1;
#
+# MDEV-10418 Assertion `m_extra_cache' failed
+# in ha_partition::late_extra_cache(uint)
+#
+CREATE TABLE t1 (f1 INT) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (1),(2);
+CREATE TABLE t2 (f2 INT) ENGINE=MyISAM PARTITION BY RANGE(f2) (PARTITION pmax VALUES LESS THAN MAXVALUE);
+INSERT INTO t2 VALUES (8);
+CREATE ALGORITHM = MERGE VIEW v AS SELECT f2 FROM t2, t1;
+UPDATE v SET f2 = 1;
+SELECT * FROM t2;
+f2
+1
+DROP VIEW v;
+DROP TABLE t2;
+DROP TABLE t1;
+#
# bug#11760213-52599: ALTER TABLE REMOVE PARTITIONING ON NON-PARTITIONED
# TABLE CORRUPTS MYISAM
DROP TABLE if exists `t1`;
diff --git a/mysql-test/r/plugin.result b/mysql-test/r/plugin.result
index c23c4f2d8a2..f278724cc9a 100644
--- a/mysql-test/r/plugin.result
+++ b/mysql-test/r/plugin.result
@@ -12,7 +12,7 @@ PLUGIN_STATUS ACTIVE
PLUGIN_TYPE STORAGE ENGINE
PLUGIN_TYPE_VERSION #
PLUGIN_LIBRARY ha_example.so
-PLUGIN_LIBRARY_VERSION 1.11
+PLUGIN_LIBRARY_VERSION 1.12
PLUGIN_AUTHOR Brian Aker, MySQL AB
PLUGIN_DESCRIPTION Example storage engine
PLUGIN_LICENSE GPL
@@ -25,7 +25,7 @@ PLUGIN_STATUS ACTIVE
PLUGIN_TYPE DAEMON
PLUGIN_TYPE_VERSION #
PLUGIN_LIBRARY ha_example.so
-PLUGIN_LIBRARY_VERSION 1.11
+PLUGIN_LIBRARY_VERSION 1.12
PLUGIN_AUTHOR Sergei Golubchik
PLUGIN_DESCRIPTION Unusable Daemon
PLUGIN_LICENSE GPL
@@ -64,7 +64,7 @@ PLUGIN_STATUS DELETED
PLUGIN_TYPE STORAGE ENGINE
PLUGIN_TYPE_VERSION #
PLUGIN_LIBRARY ha_example.so
-PLUGIN_LIBRARY_VERSION 1.11
+PLUGIN_LIBRARY_VERSION 1.12
PLUGIN_AUTHOR Brian Aker, MySQL AB
PLUGIN_DESCRIPTION Example storage engine
PLUGIN_LICENSE GPL
diff --git a/mysql-test/r/ps.result b/mysql-test/r/ps.result
index eb21f8ed7ea..40746d2e6c6 100644
--- a/mysql-test/r/ps.result
+++ b/mysql-test/r/ps.result
@@ -1208,12 +1208,21 @@ prepare my_stmt from @aux;
execute my_stmt;
COUNT(*)
46
+Warnings:
+Warning 1286 Unknown storage engine 'InnoDB'
+Warning 1286 Unknown storage engine 'InnoDB'
execute my_stmt;
COUNT(*)
46
+Warnings:
+Warning 1286 Unknown storage engine 'InnoDB'
+Warning 1286 Unknown storage engine 'InnoDB'
execute my_stmt;
COUNT(*)
46
+Warnings:
+Warning 1286 Unknown storage engine 'InnoDB'
+Warning 1286 Unknown storage engine 'InnoDB'
deallocate prepare my_stmt;
drop procedure if exists p1|
drop table if exists t1|
@@ -3930,8 +3939,6 @@ c1 c2 count(c3)
2012-03-01 01:00:00 3 1
2012-03-01 02:00:00 3 1
DEALLOCATE PREPARE s1;
-#
-# End of 5.5 tests.
prepare stmt from "select date('2010-10-10') between '2010-09-09' and ?";
set @a='2010-11-11';
execute stmt using @a;
@@ -4123,6 +4130,78 @@ NULL
NULL
deallocate prepare stmt;
drop table t1,t2,t3,t4;
+#
+# MDEV-11859: the plans for the first and the second executions
+# of PS are not the same
+#
+create table t1 (id int, c varchar(3), key idx(c))engine=myisam;
+insert into t1 values (3,'bar'), (1,'xxx'), (2,'foo'), (5,'yyy');
+prepare stmt1 from
+"explain extended
+ select * from t1 where (1, 2) in ( select 3, 4 ) or c = 'foo'";
+execute stmt1;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t1 ref idx idx 6 const 1 100.00 Using index condition
+2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Warnings:
+Note 1003 select `test`.`t1`.`id` AS `id`,`test`.`t1`.`c` AS `c` from `test`.`t1` where `test`.`t1`.`c` = 'foo'
+execute stmt1;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t1 ref idx idx 6 const 1 100.00 Using index condition
+2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Warnings:
+Note 1003 select `test`.`t1`.`id` AS `id`,`test`.`t1`.`c` AS `c` from `test`.`t1` where `test`.`t1`.`c` = 'foo'
+deallocate prepare stmt1;
+prepare stmt1 from
+"select * from t1 where (1, 2) in ( select 3, 4 ) or c = 'foo'";
+flush status;
+execute stmt1;
+id c
+2 foo
+show status like '%Handler_read%';
+Variable_name Value
+Handler_read_first 0
+Handler_read_key 1
+Handler_read_last 0
+Handler_read_next 1
+Handler_read_prev 0
+Handler_read_retry 0
+Handler_read_rnd 0
+Handler_read_rnd_deleted 0
+Handler_read_rnd_next 0
+flush status;
+execute stmt1;
+id c
+2 foo
+show status like '%Handler_read%';
+Variable_name Value
+Handler_read_first 0
+Handler_read_key 1
+Handler_read_last 0
+Handler_read_next 1
+Handler_read_prev 0
+Handler_read_retry 0
+Handler_read_rnd 0
+Handler_read_rnd_deleted 0
+Handler_read_rnd_next 0
+deallocate prepare stmt1;
+prepare stmt2 from
+"explain extended
+ select * from t1 where (1, 2) in ( select 3, 4 )";
+execute stmt2;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
+2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Warnings:
+Note 1003 select `test`.`t1`.`id` AS `id`,`test`.`t1`.`c` AS `c` from `test`.`t1` where 0
+execute stmt2;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
+2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Warnings:
+Note 1003 select `test`.`t1`.`id` AS `id`,`test`.`t1`.`c` AS `c` from `test`.`t1` where 0
+deallocate prepare stmt2;
+drop table t1;
# End of 5.5 tests
#
# Start of 10.2 tests
diff --git a/mysql-test/r/range_vs_index_merge.result b/mysql-test/r/range_vs_index_merge.result
index 9af359a55f3..6813c40a5cf 100644
--- a/mysql-test/r/range_vs_index_merge.result
+++ b/mysql-test/r/range_vs_index_merge.result
@@ -60,11 +60,11 @@ id select_type table type possible_keys key key_len ref rows Extra
EXPLAIN
SELECT * FROM City
WHERE Population > 100000 AND Name LIKE 'Aba%' OR
-Country IN ('CAN', 'ARG') AND ID < 3800 OR
-Country < 'U' AND Name LIKE 'Zhu%' OR
-ID BETWEEN 3800 AND 3810;
+Country IN ('CAN', 'ARG') AND ID BETWEEN 120 AND 130 OR
+Country <= 'ALB' AND Name LIKE 'L%' OR
+ID BETWEEN 3807 AND 3810;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE City index_merge PRIMARY,Population,Country,Name Name,Country,PRIMARY 35,3,4 NULL 132 Using sort_union(Name,Country,PRIMARY); Using where
+1 SIMPLE City index_merge PRIMARY,Population,Country,Name Name,PRIMARY,Country 35,4,3 NULL 31 Using sort_union(Name,PRIMARY,Country); Using where
EXPLAIN
SELECT * FROM City
WHERE (Population > 101000 AND Population < 115000);
@@ -1769,4 +1769,42 @@ a b
167 9999
168 10000
DROP TABLE t1;
+#
+# MDEV-8603: Wrong result OR/AND condition over index fields
+#
+CREATE TABLE t1 (
+id INT NOT NULL,
+state VARCHAR(64),
+capital VARCHAR(64),
+UNIQUE KEY (id),
+KEY state (state,id),
+KEY capital (capital, id)
+);
+INSERT INTO t1 VALUES
+(1,'Arizona','Phoenix'),
+(2,'Hawaii','Honolulu'),
+(3,'Georgia','Atlanta'),
+(4,'Florida','Tallahassee'),
+(5,'Alaska','Juneau'),
+(6,'Michigan','Lansing'),
+(7,'Pennsylvania','Harrisburg'),
+(8,'Virginia','Richmond')
+;
+EXPLAIN
+SELECT * FROM t1 FORCE KEY (state,capital)
+WHERE ( state = 'Alabama' OR state >= 'Colorado' ) AND id != 9
+OR ( capital >= 'Topeka' OR state = 'Kansas' ) AND state != 'Texas';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range state,capital state 71 NULL 12 Using index condition; Using where
+SELECT * FROM t1 FORCE KEY (state,capital)
+WHERE ( state = 'Alabama' OR state >= 'Colorado' ) AND id != 9
+OR ( capital >= 'Topeka' OR state = 'Kansas' ) AND state != 'Texas';
+id state capital
+4 Florida Tallahassee
+3 Georgia Atlanta
+2 Hawaii Honolulu
+6 Michigan Lansing
+7 Pennsylvania Harrisburg
+8 Virginia Richmond
+DROP TABLE t1;
set session optimizer_switch='index_merge_sort_intersection=default';
diff --git a/mysql-test/r/range_vs_index_merge_innodb.result b/mysql-test/r/range_vs_index_merge_innodb.result
index 225d341f1de..0c3b682b197 100644
--- a/mysql-test/r/range_vs_index_merge_innodb.result
+++ b/mysql-test/r/range_vs_index_merge_innodb.result
@@ -61,11 +61,11 @@ id select_type table type possible_keys key key_len ref rows Extra
EXPLAIN
SELECT * FROM City
WHERE Population > 100000 AND Name LIKE 'Aba%' OR
-Country IN ('CAN', 'ARG') AND ID < 3800 OR
-Country < 'U' AND Name LIKE 'Zhu%' OR
-ID BETWEEN 3800 AND 3810;
+Country IN ('CAN', 'ARG') AND ID BETWEEN 120 AND 130 OR
+Country <= 'ALB' AND Name LIKE 'L%' OR
+ID BETWEEN 3807 AND 3810;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE City index_merge PRIMARY,Population,Country,Name Name,Country,PRIMARY 35,7,4 NULL 125 Using sort_union(Name,Country,PRIMARY); Using where
+1 SIMPLE City index_merge PRIMARY,Population,Country,Name Name,Country,PRIMARY 35,3,4 NULL 32 Using sort_union(Name,Country,PRIMARY); Using where
EXPLAIN
SELECT * FROM City
WHERE (Population > 101000 AND Population < 115000);
@@ -369,7 +369,7 @@ WHERE ((ID < 200) AND (Name LIKE 'Ha%' OR (Country > 'A' AND Country < 'ARG')))
OR ((ID BETWEEN 100 AND 200) AND
(Name LIKE 'Pa%' OR (Population > 103000 AND Population < 104000)));
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE City range PRIMARY,Population,Country,Name PRIMARY 4 NULL 200 Using where
+1 SIMPLE City index_merge PRIMARY,Population,Country,Name Name,Population,PRIMARY 39,4,4 NULL 307 Using sort_union(Name,Population,PRIMARY); Using where
SELECT * FROM City USE INDEX ()
WHERE ((ID < 10) AND (Name LIKE 'H%' OR (Country > 'A' AND Country < 'ARG')))
OR ((ID BETWEEN 100 AND 110) AND
@@ -1770,5 +1770,43 @@ a b
167 9999
168 10000
DROP TABLE t1;
+#
+# MDEV-8603: Wrong result OR/AND condition over index fields
+#
+CREATE TABLE t1 (
+id INT NOT NULL,
+state VARCHAR(64),
+capital VARCHAR(64),
+UNIQUE KEY (id),
+KEY state (state,id),
+KEY capital (capital, id)
+);
+INSERT INTO t1 VALUES
+(1,'Arizona','Phoenix'),
+(2,'Hawaii','Honolulu'),
+(3,'Georgia','Atlanta'),
+(4,'Florida','Tallahassee'),
+(5,'Alaska','Juneau'),
+(6,'Michigan','Lansing'),
+(7,'Pennsylvania','Harrisburg'),
+(8,'Virginia','Richmond')
+;
+EXPLAIN
+SELECT * FROM t1 FORCE KEY (state,capital)
+WHERE ( state = 'Alabama' OR state >= 'Colorado' ) AND id != 9
+OR ( capital >= 'Topeka' OR state = 'Kansas' ) AND state != 'Texas';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range state,capital state 71 NULL 12 Using index condition; Using where
+SELECT * FROM t1 FORCE KEY (state,capital)
+WHERE ( state = 'Alabama' OR state >= 'Colorado' ) AND id != 9
+OR ( capital >= 'Topeka' OR state = 'Kansas' ) AND state != 'Texas';
+id state capital
+4 Florida Tallahassee
+3 Georgia Atlanta
+2 Hawaii Honolulu
+6 Michigan Lansing
+7 Pennsylvania Harrisburg
+8 Virginia Richmond
+DROP TABLE t1;
set session optimizer_switch='index_merge_sort_intersection=default';
SET SESSION STORAGE_ENGINE=DEFAULT;
diff --git a/mysql-test/r/repair_symlink-5543.result b/mysql-test/r/repair_symlink-5543.result
index 98ded32686e..c77e7162a51 100644
--- a/mysql-test/r/repair_symlink-5543.result
+++ b/mysql-test/r/repair_symlink-5543.result
@@ -1,13 +1,18 @@
create table t1 (a int) engine=myisam data directory='MYSQL_TMP_DIR';
insert t1 values (1);
+# Some systems fail with errcode 40, when doing openat, while others
+# don't have openat and fail with errcode 20.
repair table t1;
Table Op Msg_type Msg_text
-test.t1 repair status OK
+test.t1 repair error 20 for record at pos 0
+test.t1 repair Error File 'MYSQL_TMP_DIR/t1.MYD' not found (Errcode: 20 "<errmsg>")
+test.t1 repair status Operation failed
drop table t1;
create table t2 (a int) engine=aria data directory='MYSQL_TMP_DIR';
insert t2 values (1);
repair table t2;
Table Op Msg_type Msg_text
-test.t2 repair status OK
+test.t2 repair error 20 for record at pos 256
+test.t2 repair Error File 'MYSQL_TMP_DIR/t2.MAD' not found (Errcode: 20 "<errmsg>")
+test.t2 repair status Operation failed
drop table t2;
-foobar5543
diff --git a/mysql-test/r/select.result b/mysql-test/r/select.result
index a39ca3379c6..90216c6cedc 100644
--- a/mysql-test/r/select.result
+++ b/mysql-test/r/select.result
@@ -2956,7 +2956,7 @@ insert into t1 values (1,'x',5);
select * from t1 natural join v1;
s1 s2 s3
Warnings:
-Warning 1292 Truncated incorrect DOUBLE value: 'x'
+Warning 1292 Truncated incorrect DECIMAL value: 'x'
drop table t1;
drop view v1;
create table t1(a1 int);
diff --git a/mysql-test/r/select_jcl6.result b/mysql-test/r/select_jcl6.result
index 482fca0d530..054aa94763a 100644
--- a/mysql-test/r/select_jcl6.result
+++ b/mysql-test/r/select_jcl6.result
@@ -2967,7 +2967,7 @@ insert into t1 values (1,'x',5);
select * from t1 natural join v1;
s1 s2 s3
Warnings:
-Warning 1292 Truncated incorrect DOUBLE value: 'x'
+Warning 1292 Truncated incorrect DECIMAL value: 'x'
drop table t1;
drop view v1;
create table t1(a1 int);
diff --git a/mysql-test/r/select_pkeycache.result b/mysql-test/r/select_pkeycache.result
index a39ca3379c6..90216c6cedc 100644
--- a/mysql-test/r/select_pkeycache.result
+++ b/mysql-test/r/select_pkeycache.result
@@ -2956,7 +2956,7 @@ insert into t1 values (1,'x',5);
select * from t1 natural join v1;
s1 s2 s3
Warnings:
-Warning 1292 Truncated incorrect DOUBLE value: 'x'
+Warning 1292 Truncated incorrect DECIMAL value: 'x'
drop table t1;
drop view v1;
create table t1(a1 int);
diff --git a/mysql-test/r/sp.result b/mysql-test/r/sp.result
index a843b9a5f95..47adafa93ba 100644
--- a/mysql-test/r/sp.result
+++ b/mysql-test/r/sp.result
@@ -7963,6 +7963,44 @@ set global table_open_cache= @tmp_toc;
set global table_definition_cache= @tmp_tdc;
drop procedure p1;
drop table t1,t2,t3,t4,t5,t6;
+#
+# MDEV-11935: Queries in stored procedures with and
+# EXISTS(SELECT * FROM VIEW) crashes and closes hte conneciton.
+#
+CREATE TABLE ANY_TABLE (
+ENTITY_UID BIGINT NOT NULL
+);
+CREATE TABLE SECURITY_PATH(
+origid BIGINT UNSIGNED NOT NULL,
+destid BIGINT UNSIGNED NOT NULL,
+KEY (destid)
+);
+CREATE VIEW ENTITY_ACCESS (
+ENTITY_UID,
+OWNER_UID
+) AS
+SELECT SP1.origid,
+SP2.destid
+FROM SECURITY_PATH SP1
+JOIN SECURITY_PATH SP2 ON SP1.destid = SP2.origid
+;
+CREATE PROCEDURE SP_EXAMPLE_SELECT ()
+BEGIN
+SELECT *
+FROM ANY_TABLE AT1
+WHERE EXISTS ( SELECT *
+FROM ENTITY_ACCESS EA
+WHERE AT1.ENTITY_UID = EA.ENTITY_UID
+AND EA.OWNER_UID IS NULL );
+END
+//
+CALL SP_EXAMPLE_SELECT ();
+ENTITY_UID
+CALL SP_EXAMPLE_SELECT ();
+ENTITY_UID
+drop procedure SP_EXAMPLE_SELECT;
+drop view ENTITY_ACCESS;
+drop table ANY_TABLE, SECURITY_PATH;
# End of 10.0 test
CREATE FUNCTION f(f1 VARCHAR(64) COLLATE latin1_german2_ci)
RETURNS VARCHAR(64)
diff --git a/mysql-test/r/stat_tables_par.result b/mysql-test/r/stat_tables_par.result
index b965e289e1d..006df89f358 100644
--- a/mysql-test/r/stat_tables_par.result
+++ b/mysql-test/r/stat_tables_par.result
@@ -46,14 +46,14 @@ dbt3_s001 supplier PRIMARY 1 1.0000
dbt3_s001 supplier i_s_nationkey 1 1.1111
flush table lineitem;
set use_stat_tables='never';
-select sum(l_extendedprice*l_discount) as revenue
+select round(sum(l_extendedprice*l_discount),4) as revenue
from lineitem
where l_shipdate >= date '1994-01-01'
and l_shipdate < date '1994-01-01' + interval '1' year
and l_discount between 0.06 - 0.01 and 0.06 + 0.01
and l_quantity < 24;
revenue
-77949.91860000002
+77949.9186
connect con1, localhost, root,,;
connect con2, localhost, root,,;
connection con1;
@@ -61,7 +61,7 @@ set debug_sync='statistics_mem_alloc_start1 WAIT_FOR second_thread_started_too'
set debug_sync='statistics_mem_alloc_start2 SIGNAL first_thread_working';
use dbt3_s001;
set use_stat_tables='preferably';
-select sum(l_extendedprice*l_discount) as revenue
+select round(sum(l_extendedprice*l_discount),4) as revenue
from lineitem
where l_shipdate >= date '1994-01-01'
and l_shipdate < date '1994-01-01' + interval '1' year
@@ -72,7 +72,7 @@ set debug_sync='statistics_mem_alloc_start1 SIGNAL second_thread_started_too';
set debug_sync='statistics_mem_alloc_start2 WAIT_FOR first_thread_working';
use dbt3_s001;
set use_stat_tables='preferably';
-select sum(l_extendedprice*l_discount) as revenue
+select round(sum(l_extendedprice*l_discount),4) as revenue
from lineitem
where l_shipdate >= date '1994-01-01'
and l_shipdate < date '1994-01-01' + interval '1' year
@@ -80,10 +80,10 @@ and l_discount between 0.06 - 0.01 and 0.06 + 0.01
and l_quantity < 24;
connection con1;
revenue
-77949.91860000002
+77949.9186
connection con2;
revenue
-77949.91860000002
+77949.9186
connection default;
set use_stat_tables='preferably';
disconnect con1;
diff --git a/mysql-test/r/stat_tables_par_innodb.result b/mysql-test/r/stat_tables_par_innodb.result
index 155582c9192..8fc0483d9aa 100644
--- a/mysql-test/r/stat_tables_par_innodb.result
+++ b/mysql-test/r/stat_tables_par_innodb.result
@@ -49,14 +49,14 @@ dbt3_s001 supplier PRIMARY 1 1.0000
dbt3_s001 supplier i_s_nationkey 1 1.1111
flush table lineitem;
set use_stat_tables='never';
-select sum(l_extendedprice*l_discount) as revenue
+select round(sum(l_extendedprice*l_discount),4) as revenue
from lineitem
where l_shipdate >= date '1994-01-01'
and l_shipdate < date '1994-01-01' + interval '1' year
and l_discount between 0.06 - 0.01 and 0.06 + 0.01
and l_quantity < 24;
revenue
-77949.91860000002
+77949.9186
connect con1, localhost, root,,;
connect con2, localhost, root,,;
connection con1;
@@ -64,7 +64,7 @@ set debug_sync='statistics_mem_alloc_start1 WAIT_FOR second_thread_started_too'
set debug_sync='statistics_mem_alloc_start2 SIGNAL first_thread_working';
use dbt3_s001;
set use_stat_tables='preferably';
-select sum(l_extendedprice*l_discount) as revenue
+select round(sum(l_extendedprice*l_discount),4) as revenue
from lineitem
where l_shipdate >= date '1994-01-01'
and l_shipdate < date '1994-01-01' + interval '1' year
@@ -75,7 +75,7 @@ set debug_sync='statistics_mem_alloc_start1 SIGNAL second_thread_started_too';
set debug_sync='statistics_mem_alloc_start2 WAIT_FOR first_thread_working';
use dbt3_s001;
set use_stat_tables='preferably';
-select sum(l_extendedprice*l_discount) as revenue
+select round(sum(l_extendedprice*l_discount),4) as revenue
from lineitem
where l_shipdate >= date '1994-01-01'
and l_shipdate < date '1994-01-01' + interval '1' year
@@ -83,10 +83,10 @@ and l_discount between 0.06 - 0.01 and 0.06 + 0.01
and l_quantity < 24;
connection con1;
revenue
-77949.91860000002
+77949.9186
connection con2;
revenue
-77949.91860000002
+77949.9186
connection default;
set use_stat_tables='preferably';
disconnect con1;
diff --git a/mysql-test/r/subselect4.result b/mysql-test/r/subselect4.result
index 6bbb80c0662..3d0dfd189a8 100644
--- a/mysql-test/r/subselect4.result
+++ b/mysql-test/r/subselect4.result
@@ -2440,6 +2440,53 @@ EXECUTE stmt;
i
6
drop table t1, t2, t3;
+#
+# MDEV-11078: NULL NOT IN (non-empty subquery) should never return results
+#
+create table t1(a int,b int);
+create table t2(a int,b int);
+insert into t1 value (1,2);
+select (NULL) in (select 1 from t1);
+(NULL) in (select 1 from t1)
+NULL
+select (null) in (select 1 from t2);
+(null) in (select 1 from t2)
+0
+select 1 in (select 1 from t1);
+1 in (select 1 from t1)
+1
+select 1 in (select 1 from t2);
+1 in (select 1 from t2)
+0
+select 1 from dual where null in (select 1 from t1);
+1
+select 1 from dual where null in (select 1 from t2);
+1
+select (null,null) in (select * from t1);
+(null,null) in (select * from t1)
+NULL
+select (null,null) in (select * from t2);
+(null,null) in (select * from t2)
+0
+select 1 from dual where null not in (select 1 from t1);
+1
+select 1 from dual where null not in (select 1 from t2);
+1
+1
+drop table t1,t2;
+#
+# MDEV-6486: Assertion `!table || (!table->read_set || bitmap_is_set(table->read_set, field_index))'
+# failed with SELECT SQ, TEXT field
+#
+CREATE TABLE t1 (a VARCHAR(8), KEY(a)) ENGINE=MyISAM;
+INSERT INTO t1 VALUES ('foo'),( 'bar');
+CREATE TABLE t2 (b VARCHAR(8), c TINYTEXT, KEY(b)) ENGINE=MyISAM;
+INSERT INTO t2 VALUES ('baz','baz'),('qux', 'qux');
+SELECT ( SELECT COUNT(*) FROM t1 WHERE a = c ) AS field, COUNT(DISTINCT c)
+FROM t2 WHERE b <= 'quux' GROUP BY field;
+field COUNT(DISTINCT c)
+0 1
+drop table t1,t2;
SET optimizer_switch= @@global.optimizer_switch;
set @@tmp_table_size= @@global.tmp_table_size;
#
diff --git a/mysql-test/r/subselect_innodb.result b/mysql-test/r/subselect_innodb.result
index cfbe5d41418..11221c797ff 100644
--- a/mysql-test/r/subselect_innodb.result
+++ b/mysql-test/r/subselect_innodb.result
@@ -494,6 +494,21 @@ HAVING SQ2_alias1 . col_int_key >= 7
drop table t1;
set optimizer_switch=@subselect_innodb_tmp;
#
+# MDEV-9635:Server crashes in part_of_refkey or assertion
+# `!created && key_to_save < (int)s->keys' failed in
+# TABLE::use_index(int) or with join_cache_level>2
+#
+SET join_cache_level=3;
+CREATE TABLE t1 (f1 VARCHAR(1024)) ENGINE=InnoDB;
+CREATE ALGORITHM=TEMPTABLE VIEW v1 AS SELECT * FROM t1;
+CREATE TABLE t2 (f2 VARCHAR(4)) ENGINE=InnoDB;
+INSERT INTO t2 VALUES ('foo'),('bar');
+SELECT * FROM v1, t2 WHERE ( f1, f2 ) IN ( SELECT f1, f1 FROM t1 );
+f1 f2
+set join_cache_level = default;
+drop view v1;
+drop table t1,t2;
+#
# MDEV-6041: ORDER BY+subqueries: subquery_table.key=outer_table.col is not recongized as binding
#
create table t1(a int) engine=innodb;
diff --git a/mysql-test/r/symlink-aria-11902.result b/mysql-test/r/symlink-aria-11902.result
new file mode 100644
index 00000000000..4d8f179dac9
--- /dev/null
+++ b/mysql-test/r/symlink-aria-11902.result
@@ -0,0 +1,43 @@
+set default_storage_engine=Aria;
+call mtr.add_suppression("File.*t1.* not found");
+create table mysql.t1 (a int, b char(16), index(a));
+insert mysql.t1 values (100, 'test'),(101,'test');
+create table t1 (a int, b char(16), index(a))
+data directory="MYSQLTEST_VARDIR/tmp/foo";
+insert t1 values (200, 'some'),(201,'some');
+select * from t1;
+a b
+200 some
+201 some
+flush tables;
+set debug_sync='mi_open_datafile SIGNAL ok WAIT_FOR go';
+select * from t1;
+connect con1, localhost, root;
+set debug_sync='now WAIT_FOR ok';
+set debug_sync='now SIGNAL go';
+connection default;
+ERROR HY000: File 'MYSQLTEST_VARDIR/tmp/foo/t1.MAD' not found (Errcode: 20 <errmsg>)
+flush tables;
+drop table if exists t1;
+create table t1 (a int, b char(16), index (a))
+index directory="MYSQLTEST_VARDIR/tmp/foo";
+insert t1 values (200, 'some'),(201,'some');
+explain select a from t1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index NULL a 5 NULL 2 Using index
+select a from t1;
+a
+200
+201
+flush tables;
+set debug_sync='mi_open_kfile SIGNAL waiting WAIT_FOR run';
+select a from t1;
+connection con1;
+set debug_sync='now WAIT_FOR waiting';
+set debug_sync='now SIGNAL run';
+connection default;
+ERROR HY000: Can't find file: './test/t1.MAI' (errno: 20 <errmsg>)
+flush tables;
+drop table if exists t1;
+drop table mysql.t1;
+set debug_sync='RESET';
diff --git a/mysql-test/r/symlink-myisam-11902.result b/mysql-test/r/symlink-myisam-11902.result
new file mode 100644
index 00000000000..bc9a0316bab
--- /dev/null
+++ b/mysql-test/r/symlink-myisam-11902.result
@@ -0,0 +1,42 @@
+call mtr.add_suppression("File.*t1.* not found");
+create table mysql.t1 (a int, b char(16), index(a));
+insert mysql.t1 values (100, 'test'),(101,'test');
+create table t1 (a int, b char(16), index(a))
+data directory="MYSQLTEST_VARDIR/tmp/foo";
+insert t1 values (200, 'some'),(201,'some');
+select * from t1;
+a b
+200 some
+201 some
+flush tables;
+set debug_sync='mi_open_datafile SIGNAL ok WAIT_FOR go';
+select * from t1;
+connect con1, localhost, root;
+set debug_sync='now WAIT_FOR ok';
+set debug_sync='now SIGNAL go';
+connection default;
+ERROR HY000: File 'MYSQLTEST_VARDIR/tmp/foo/t1.MYD' not found (Errcode: 20 <errmsg>)
+flush tables;
+drop table if exists t1;
+create table t1 (a int, b char(16), index (a))
+index directory="MYSQLTEST_VARDIR/tmp/foo";
+insert t1 values (200, 'some'),(201,'some');
+explain select a from t1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index NULL a 5 NULL 2 Using index
+select a from t1;
+a
+200
+201
+flush tables;
+set debug_sync='mi_open_kfile SIGNAL waiting WAIT_FOR run';
+select a from t1;
+connection con1;
+set debug_sync='now WAIT_FOR waiting';
+set debug_sync='now SIGNAL run';
+connection default;
+ERROR HY000: Can't find file: './test/t1.MYI' (errno: 20 <errmsg>)
+flush tables;
+drop table if exists t1;
+drop table mysql.t1;
+set debug_sync='RESET';
diff --git a/mysql-test/r/table_elim.result b/mysql-test/r/table_elim.result
index a7b0842d14f..764a1b2780e 100644
--- a/mysql-test/r/table_elim.result
+++ b/mysql-test/r/table_elim.result
@@ -597,7 +597,8 @@ CREATE TABLE t1 (a int(11), b varchar(1)) ;
INSERT IGNORE INTO t1 VALUES (0,'g');
CREATE TABLE t3 ( a varchar(1)) ;
INSERT IGNORE INTO t3 VALUES ('g');
-CREATE TABLE t2 ( a int(11) NOT NULL, PRIMARY KEY (a)) ;
+CREATE TABLE t2 ( a int(11) NOT NULL, PRIMARY KEY (a));
+INSERT INTO t2 VALUES (9), (10);
create view v1 as SELECT t1.* FROM t1 LEFT JOIN t2 ON ( t1.a = t2.a ) WHERE t2.a <> 0;
SELECT alias1.* FROM t3 LEFT JOIN v1 as alias1 ON ( t3.a = alias1.b );
a b
@@ -606,7 +607,7 @@ EXPLAIN SELECT alias1.* FROM t3 LEFT JOIN v1 as alias1 ON ( t3.a = alias1.b );
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t3 system NULL NULL NULL NULL 1
1 SIMPLE t1 ALL NULL NULL NULL NULL 1 Using where
-1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t1.a 1 Using where; Using index
+1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t1.a 1 Using index
drop view v1;
DROP TABLE t1,t2,t3;
#
diff --git a/mysql-test/r/trigger_no_defaults-11698.result b/mysql-test/r/trigger_no_defaults-11698.result
index 40546cee41d..8ce495eaf3a 100644
--- a/mysql-test/r/trigger_no_defaults-11698.result
+++ b/mysql-test/r/trigger_no_defaults-11698.result
@@ -20,3 +20,23 @@ a b
10 10
0 30
drop table t1;
+set sql_mode=default;
+set sql_mode='';
+create table t1 (
+id int(11) not null auto_increment primary key,
+data1 varchar(10) not null,
+data2 varchar(10) not null
+);
+insert into t1 (data2) values ('x');
+Warnings:
+Warning 1364 Field 'data1' doesn't have a default value
+create trigger test_trigger before insert on t1 for each row begin end;
+insert into t1 (data2) values ('y');
+Warnings:
+Warning 1364 Field 'data1' doesn't have a default value
+select * from t1;
+id data1 data2
+1 x
+2 y
+drop table t1;
+set sql_mode=default;
diff --git a/mysql-test/r/type_newdecimal.result b/mysql-test/r/type_newdecimal.result
index 313894b4b77..ab0e2dbc71d 100644
--- a/mysql-test/r/type_newdecimal.result
+++ b/mysql-test/r/type_newdecimal.result
@@ -2239,11 +2239,50 @@ t1 CREATE TABLE `t1` (
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
#
+# Bug#18408499 UNSIGNED BIGINT HIGH VALUES
+# WRONG NUMERICAL COMPARISON RESULTS
+#
+CREATE TABLE t1(value DECIMAL(24,0) NOT NULL);
+INSERT INTO t1(value)
+VALUES('100000000000000000000001'),
+('100000000000000000000002'),
+('100000000000000000000003');
+SELECT * FROM t1 WHERE value = '100000000000000000000002';
+value
+100000000000000000000002
+SELECT * FROM t1 WHERE '100000000000000000000002' = value;
+value
+100000000000000000000002
+SELECT * FROM t1 WHERE value + 0 = '100000000000000000000002';
+value
+100000000000000000000002
+SELECT * FROM t1 WHERE value = 100000000000000000000002;
+value
+100000000000000000000002
+SELECT * FROM t1 WHERE value + 0 = 100000000000000000000002;
+value
+100000000000000000000002
+PREPARE stmt FROM 'SELECT * FROM t1 WHERE value = ?';
+set @a="100000000000000000000002";
+EXECUTE stmt using @a;
+value
+100000000000000000000002
+set @a=100000000000000000000002;
+EXECUTE stmt using @a;
+value
+100000000000000000000002
+DEALLOCATE PREPARE stmt;
+ALTER TABLE t1 ADD INDEX value (value);
+SELECT * FROM t1 WHERE value = '100000000000000000000002';
+value
+100000000000000000000002
+DROP TABLE t1;
+#
# End of 10.1 tests
#
#
# Test CREATE .. SELECT
-
+#
create or replace table t1 as select 1.000000000000000000000000000000000 as a;
show create table t1;
Table Create Table
diff --git a/mysql-test/r/type_num.result b/mysql-test/r/type_num.result
index 9573852ce72..193a59741f5 100644
--- a/mysql-test/r/type_num.result
+++ b/mysql-test/r/type_num.result
@@ -570,7 +570,7 @@ SELECT COUNT(*) FROM t1 WHERE d='1 ';
COUNT(*)
2
Warnings:
-Note 1292 Truncated incorrect DOUBLE value: '1 '
+Note 1292 Truncated incorrect DECIMAL value: '1 '
SELECT COUNT(*) FROM t1 WHERE f4='';
COUNT(*)
2
@@ -605,7 +605,7 @@ SELECT COUNT(*) FROM t1 WHERE d='';
COUNT(*)
2
Warnings:
-Warning 1292 Truncated incorrect DOUBLE value: ''
+Warning 1292 Truncated incorrect DECIMAL value: ''
SELECT COUNT(*) FROM t1 WHERE f4='x';
COUNT(*)
2
@@ -640,7 +640,7 @@ SELECT COUNT(*) FROM t1 WHERE d='x';
COUNT(*)
2
Warnings:
-Warning 1292 Truncated incorrect DOUBLE value: 'x'
+Warning 1292 Truncated incorrect DECIMAL value: 'x'
SELECT COUNT(*) FROM t1 WHERE f4=' x';
COUNT(*)
2
@@ -675,7 +675,7 @@ SELECT COUNT(*) FROM t1 WHERE d=' x';
COUNT(*)
2
Warnings:
-Warning 1292 Truncated incorrect DOUBLE value: ' x'
+Warning 1292 Truncated incorrect DECIMAL value: ' x'
SELECT COUNT(*) FROM t1 WHERE f4='.';
COUNT(*)
2
@@ -710,7 +710,7 @@ SELECT COUNT(*) FROM t1 WHERE d='.';
COUNT(*)
2
Warnings:
-Warning 1292 Truncated incorrect DOUBLE value: '.'
+Warning 1292 Truncated incorrect DECIMAL value: '.'
SELECT COUNT(*) FROM t1 WHERE f4='-';
COUNT(*)
2
@@ -745,7 +745,7 @@ SELECT COUNT(*) FROM t1 WHERE d='-';
COUNT(*)
2
Warnings:
-Warning 1292 Truncated incorrect DOUBLE value: '-'
+Warning 1292 Truncated incorrect DECIMAL value: '-'
SELECT COUNT(*) FROM t1 WHERE f4='+';
COUNT(*)
2
@@ -780,7 +780,7 @@ SELECT COUNT(*) FROM t1 WHERE d='+';
COUNT(*)
2
Warnings:
-Warning 1292 Truncated incorrect DOUBLE value: '+'
+Warning 1292 Truncated incorrect DECIMAL value: '+'
SELECT COUNT(*) FROM t1 WHERE f4='1x';
COUNT(*)
2
@@ -815,7 +815,7 @@ SELECT COUNT(*) FROM t1 WHERE d='1x';
COUNT(*)
2
Warnings:
-Warning 1292 Truncated incorrect DOUBLE value: '1x'
+Warning 1292 Truncated incorrect DECIMAL value: '1x'
SELECT COUNT(*) FROM t1 WHERE f4='1e';
COUNT(*)
2
@@ -850,7 +850,7 @@ SELECT COUNT(*) FROM t1 WHERE d='1e';
COUNT(*)
2
Warnings:
-Warning 1292 Truncated incorrect DOUBLE value: '1e'
+Warning 1292 Truncated incorrect DECIMAL value: '1e'
SELECT COUNT(*) FROM t1 WHERE f4='1e+';
COUNT(*)
2
@@ -885,7 +885,7 @@ SELECT COUNT(*) FROM t1 WHERE d='1e+';
COUNT(*)
2
Warnings:
-Warning 1292 Truncated incorrect DOUBLE value: '1e+'
+Warning 1292 Truncated incorrect DECIMAL value: '1e+'
SELECT COUNT(*) FROM t1 WHERE f4='1E-';
COUNT(*)
2
@@ -920,7 +920,7 @@ SELECT COUNT(*) FROM t1 WHERE d='1E-';
COUNT(*)
2
Warnings:
-Warning 1292 Truncated incorrect DOUBLE value: '1E-'
+Warning 1292 Truncated incorrect DECIMAL value: '1E-'
SELECT COUNT(*) FROM t1 WHERE f4='1Ex';
COUNT(*)
2
@@ -955,7 +955,7 @@ SELECT COUNT(*) FROM t1 WHERE d='1Ex';
COUNT(*)
2
Warnings:
-Warning 1292 Truncated incorrect DOUBLE value: '1Ex'
+Warning 1292 Truncated incorrect DECIMAL value: '1Ex'
SELECT COUNT(*) FROM t1 WHERE f4='1e+x';
COUNT(*)
2
@@ -990,7 +990,7 @@ SELECT COUNT(*) FROM t1 WHERE d='1e+x';
COUNT(*)
2
Warnings:
-Warning 1292 Truncated incorrect DOUBLE value: '1e+x'
+Warning 1292 Truncated incorrect DECIMAL value: '1e+x'
SELECT COUNT(*) FROM t1 WHERE f4='1e1000';
COUNT(*)
0
@@ -1025,7 +1025,8 @@ SELECT COUNT(*) FROM t1 WHERE d='1e1000';
COUNT(*)
0
Warnings:
-Warning 1292 Truncated incorrect DOUBLE value: '1e1000'
+Warning 1916 Got overflow when converting '' to DECIMAL. Value truncated
+Warning 1292 Truncated incorrect DECIMAL value: '1e1000'
ALTER TABLE t1
ADD KEY f4(f4),
ADD KEY f8(f8),
diff --git a/mysql-test/r/update_innodb.result b/mysql-test/r/update_innodb.result
index 88c86c50625..5fcc584035a 100644
--- a/mysql-test/r/update_innodb.result
+++ b/mysql-test/r/update_innodb.result
@@ -29,3 +29,29 @@ CREATE ALGORITHM=UNDEFINED VIEW `v1` AS select `t4`.`c1` AS `c1`,`t4`.`c2` AS `c
UPDATE t1 a JOIN t2 b ON a.c1 = b.c1 JOIN v1 vw ON b.c2 = vw.c1 JOIN t3 del ON vw.c2 = del.c2 SET a.c2 = ( SELECT max(t.c1) FROM t3 t, v1 i WHERE del.c2 = t.c2 AND vw.c3 = i.c3 AND t.c3 = 4 ) WHERE a.c2 IS NULL OR a.c2 < '2011-05-01';
drop view v1;
drop table t1,t2,t3,t4;
+#
+# MDEV-10232 Scalar result of subquery changes after adding an outer select stmt
+#
+CREATE TABLE t1 (
+a_id INT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
+b_id INT(20) UNSIGNED NULL DEFAULT NULL,
+c_id VARCHAR(255) NULL DEFAULT NULL,
+PRIMARY KEY (a_id))COLLATE = 'utf8_general_ci' ENGINE = InnoDB;
+CREATE TABLE t2 (
+b_id INT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
+c_id VARCHAR(255) NULL DEFAULT NULL,
+PRIMARY KEY (b_id),
+INDEX idx_c_id (c_id))COLLATE = 'utf8_general_ci' ENGINE = InnoDB;
+INSERT INTO t1 (b_id, c_id) VALUES (NULL, NULL);
+INSERT INTO t2 (c_id) VALUES (NULL);
+INSERT INTO t2 (c_id) VALUES (NULL);
+SELECT * FROM t1;
+a_id b_id c_id
+1 NULL NULL
+SELECT t2.b_id FROM t1,t2 WHERE t2.c_id = t1.c_id;
+b_id
+UPDATE t1 SET b_id = (SELECT t2.b_id FROM t2 t2 WHERE t2.c_id = t1.c_id);
+SELECT * FROM t1;
+a_id b_id c_id
+1 NULL NULL
+drop table t1,t2;
diff --git a/mysql-test/r/view.result b/mysql-test/r/view.result
index 5d8f71ef708..b899695f11f 100644
--- a/mysql-test/r/view.result
+++ b/mysql-test/r/view.result
@@ -5583,6 +5583,89 @@ Warnings:
Warning 1356 View 'test.v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
drop view v1;
drop table t1,t2;
+#
+# MDEV-12099: usage of mergeable view with LEFT JOIN
+# that can be converted to INNER JOIN
+#
+create table t1 (a int, b int, key(a)) engine=myisam;
+insert into t1 values
+(3,20), (7,10), (2,10), (4,30), (8,70),
+(7,70), (9,100), (9,60), (8,80), (7,60);
+create table t2 (c int, d int, key (c)) engine=myisam;
+insert into t2 values
+(50,100), (20, 200), (10,300),
+(150,100), (120, 200), (110,300),
+(250,100), (220, 200), (210,300);
+create table t3(e int, f int not null, key(e), unique (f)) engine=myisam;
+insert into t3 values
+(100, 3), (300, 5), (400, 4), (300,7),
+(300,2), (600, 13), (800, 15), (700, 14),
+(600, 23), (800, 25), (700, 24);
+create view v1 as
+select * from t2 left join t3 on t3.e=t2.d where t3.f is not null;
+select *
+from t1 left join v1 on v1.c=t1.b
+where t1.a < 5;
+a b c d e f
+2 10 10 300 300 5
+2 10 10 300 300 7
+2 10 10 300 300 2
+3 20 NULL NULL NULL NULL
+4 30 NULL NULL NULL NULL
+select *
+from t1 left join ( t2 left join t3 on t3.e=t2.d )
+on t2.c=t1.b and t3.f is not null
+where t1.a < 5;
+a b c d e f
+2 10 10 300 300 5
+2 10 10 300 300 7
+2 10 10 300 300 2
+3 20 NULL NULL NULL NULL
+4 30 NULL NULL NULL NULL
+explain extended
+select *
+from t1 left join v1 on v1.c=t1.b
+where t1.a < 5;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 range a a 5 NULL 3 100.00 Using index condition
+1 SIMPLE t2 ref c c 5 test.t1.b 2 100.00 Using where
+1 SIMPLE t3 ref f,e e 5 test.t2.d 2 100.00 Using where
+Warnings:
+Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d`,`test`.`t3`.`e` AS `e`,`test`.`t3`.`f` AS `f` from `test`.`t1` left join (`test`.`t2` join `test`.`t3`) on(`test`.`t2`.`c` = `test`.`t1`.`b` and `test`.`t3`.`e` = `test`.`t2`.`d` and `test`.`t3`.`f` is not null and `test`.`t1`.`b` is not null and `test`.`t2`.`d` is not null) where `test`.`t1`.`a` < 5
+explain extended
+select *
+from t1 left join ( t2 left join t3 on t3.e=t2.d )
+on t2.c=t1.b and t3.f is not null
+where t1.a < 5;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 range a a 5 NULL 3 100.00 Using index condition
+1 SIMPLE t2 ref c c 5 test.t1.b 2 100.00 Using where
+1 SIMPLE t3 ref f,e e 5 test.t2.d 2 100.00 Using where
+Warnings:
+Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d`,`test`.`t3`.`e` AS `e`,`test`.`t3`.`f` AS `f` from `test`.`t1` left join (`test`.`t2` join `test`.`t3`) on(`test`.`t2`.`c` = `test`.`t1`.`b` and `test`.`t3`.`e` = `test`.`t2`.`d` and `test`.`t3`.`f` is not null and `test`.`t1`.`b` is not null and `test`.`t2`.`d` is not null) where `test`.`t1`.`a` < 5
+explain extended
+select *
+from t1 left join v1 on v1.c=t1.b and v1.f=t1.a
+where t1.a < 5;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 range a a 5 NULL 3 100.00 Using index condition
+1 SIMPLE t3 eq_ref f,e f 4 test.t1.a 1 100.00 Using where
+1 SIMPLE t2 ref c c 5 test.t1.b 2 100.00 Using where
+Warnings:
+Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d`,`test`.`t3`.`e` AS `e`,`test`.`t3`.`f` AS `f` from `test`.`t1` left join (`test`.`t2` join `test`.`t3`) on(`test`.`t2`.`c` = `test`.`t1`.`b` and `test`.`t3`.`f` = `test`.`t1`.`a` and `test`.`t2`.`d` = `test`.`t3`.`e` and `test`.`t1`.`a` is not null and `test`.`t1`.`a` is not null and `test`.`t1`.`b` is not null) where `test`.`t1`.`a` < 5
+explain extended
+select *
+from t1 left join ( t2 left join t3 on t3.e=t2.d )
+on t2.c=t1.b and t3.f=t1.a and t3.f is not null
+where t1.a < 5;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 range a a 5 NULL 3 100.00 Using index condition
+1 SIMPLE t3 eq_ref f,e f 4 test.t1.a 1 100.00 Using where
+1 SIMPLE t2 ref c c 5 test.t1.b 2 100.00 Using where
+Warnings:
+Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d`,`test`.`t3`.`e` AS `e`,`test`.`t3`.`f` AS `f` from `test`.`t1` left join (`test`.`t2` join `test`.`t3`) on(`test`.`t2`.`c` = `test`.`t1`.`b` and `test`.`t3`.`f` = `test`.`t1`.`a` and `test`.`t2`.`d` = `test`.`t3`.`e` and `test`.`t1`.`a` is not null and `test`.`t1`.`a` is not null and `test`.`t1`.`b` is not null) where `test`.`t1`.`a` < 5
+drop view v1;
+drop table t1,t2,t3;
# -----------------------------------------------------------------
# -- End of 5.5 tests.
# -----------------------------------------------------------------
diff --git a/mysql-test/suite/encryption/r/debug_key_management.result b/mysql-test/suite/encryption/r/debug_key_management.result
index 8793e6ba363..02e05b4d221 100644
--- a/mysql-test/suite/encryption/r/debug_key_management.result
+++ b/mysql-test/suite/encryption/r/debug_key_management.result
@@ -6,16 +6,12 @@ innodb_encrypt_tables ON
innodb_encryption_rotate_key_age 2
innodb_encryption_rotation_iops 100
innodb_encryption_threads 4
-select space,name,current_key_version from information_schema.innodb_tablespaces_encryption order by space;
-space name current_key_version
-0 NULL 1
-1 mysql/innodb_table_stats 1
-2 mysql/innodb_index_stats 1
+select count(*) from information_schema.innodb_tablespaces_encryption where current_key_version <> 1;
+count(*)
+0
set global debug_key_management_version=10;
-select space,name,current_key_version from information_schema.innodb_tablespaces_encryption order by space;
-space name current_key_version
-0 NULL 10
-1 mysql/innodb_table_stats 10
-2 mysql/innodb_index_stats 10
+select count(*) from information_schema.innodb_tablespaces_encryption where current_key_version <> 10;
+count(*)
+0
set global innodb_encrypt_tables=OFF;
set global debug_key_management_version=1;
diff --git a/mysql-test/suite/encryption/r/encrypt_and_grep.result b/mysql-test/suite/encryption/r/encrypt_and_grep.result
index f95e70bf19e..bd20b79aafe 100644
--- a/mysql-test/suite/encryption/r/encrypt_and_grep.result
+++ b/mysql-test/suite/encryption/r/encrypt_and_grep.result
@@ -6,6 +6,16 @@ insert t1 values (repeat('foobar', 42));
insert t2 values (repeat('temp', 42));
insert t3 values (repeat('dummy', 42));
# Wait max 10 min for key encryption threads to encrypt all spaces
+SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0;
+NAME
+test/t3
+SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0;
+NAME
+mysql/innodb_table_stats
+mysql/innodb_index_stats
+test/t1
+test/t2
+innodb_system
# t1 yes on expecting NOT FOUND
NOT FOUND /foobar/ in t1.ibd
# t2 ... on expecting NOT FOUND
@@ -15,13 +25,23 @@ FOUND /dummy/ in t3.ibd
# ibdata1 expecting NOT FOUND
NOT FOUND /foobar/ in ibdata1
# Now turn off encryption and wait for threads to decrypt everything
-SET GLOBAL innodb_encryption_threads = 4;
+SET GLOBAL innodb_encryption_threads = 1;
SET GLOBAL innodb_encrypt_tables = off;
# Wait max 10 min for key encryption threads to decrypt all spaces
+SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0;
+NAME
+mysql/innodb_table_stats
+mysql/innodb_index_stats
+test/t2
+test/t3
+innodb_system
+SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0;
+NAME
+test/t1
# t1 yes on expecting NOT FOUND
NOT FOUND /foobar/ in t1.ibd
# t2 ... on expecting FOUND
-FOUND /temp/ in t2.ibd
+NOT FOUND /temp/ in t2.ibd
# t3 no on expecting FOUND
FOUND /dummy/ in t3.ibd
# ibdata1 expecting NOT FOUND
@@ -30,6 +50,16 @@ NOT FOUND /foobar/ in ibdata1
SET GLOBAL innodb_encryption_threads = 4;
SET GLOBAL innodb_encrypt_tables = on;
# Wait max 10 min for key encryption threads to encrypt all spaces
+SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0;
+NAME
+test/t3
+SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0;
+NAME
+mysql/innodb_table_stats
+mysql/innodb_index_stats
+test/t1
+test/t2
+innodb_system
# t1 yes on expecting NOT FOUND
NOT FOUND /foobar/ in t1.ibd
# t2 ... on expecting NOT FOUND
@@ -38,5 +68,4 @@ NOT FOUND /temp/ in t2.ibd
FOUND /dummy/ in t3.ibd
# ibdata1 expecting NOT FOUND
NOT FOUND /foobar/ in ibdata1
-# TODO: add shutdown + grep tests
drop table t1, t2, t3;
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 dc5be714f66..798057e3fb5 100644
--- a/mysql-test/suite/encryption/r/innodb-bad-key-change.result
+++ b/mysql-test/suite/encryption/r/innodb-bad-key-change.result
@@ -1,14 +1,7 @@
call mtr.add_suppression("Plugin 'file_key_management' init function returned error");
-call mtr.add_suppression("InnoDB: Database page corruption on disk or a failed.*");
call mtr.add_suppression("Plugin 'file_key_management' registration.*failed");
-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 .* 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.");
-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("mysqld: File .*");
-call mtr.add_suppression("InnoDB: Tablespace id .* is encrypted but encryption service or used key_id .* is not available. Can't continue opening tablespace.");
-call mtr.add_suppression("InnoDB: InnoDB: Page may be an index page where index id is .*");
+call mtr.add_suppression("InnoDB: The page .* in file test/.* cannot be decrypted");
+call mtr.add_suppression("mysqld: File .* not found");
# Start server with keys2.txt
CREATE TABLE t1 (c VARCHAR(8)) ENGINE=InnoDB ENCRYPTED=YES ENCRYPTION_KEY_ID=2;
diff --git a/mysql-test/suite/encryption/r/innodb-bad-key-change2.result b/mysql-test/suite/encryption/r/innodb-bad-key-change2.result
index ea760e7a213..adf984b9708 100644
--- a/mysql-test/suite/encryption/r/innodb-bad-key-change2.result
+++ b/mysql-test/suite/encryption/r/innodb-bad-key-change2.result
@@ -1,9 +1,5 @@
-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.");
-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*");
+call mtr.add_suppression("InnoDB: The page .* in file test/t1 cannot be decrypted");
+call mtr.add_suppression("Couldn't load plugins from 'file_key_management");
CREATE TABLE t1 (pk INT PRIMARY KEY, f VARCHAR(8)) ENGINE=InnoDB ENCRYPTION_KEY_ID=4;
INSERT INTO t1 VALUES (1,'foo'),(2,'bar');
select * from t1;
@@ -24,3 +20,4 @@ show warnings;
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;
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 d6c2706e8bf..69f11d8745b 100644
--- a/mysql-test/suite/encryption/r/innodb-bad-key-change4.result
+++ b/mysql-test/suite/encryption/r/innodb-bad-key-change4.result
@@ -1,9 +1,5 @@
-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.");
-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*");
+call mtr.add_suppression("InnoDB: The page .* in file test/t1 cannot be decrypted");
+call mtr.add_suppression("Couldn't load plugins from 'file_key_management");
CREATE TABLE t1 (pk INT PRIMARY KEY, f VARCHAR(8)) ENGINE=InnoDB ENCRYPTION_KEY_ID=4;
INSERT INTO t1 VALUES (1,'foo'),(2,'bar');
CHECK TABLE t1;
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 75a0587d35d..13b74f3b23d 100644
--- a/mysql-test/suite/encryption/r/innodb-bad-key-change5.result
+++ b/mysql-test/suite/encryption/r/innodb-bad-key-change5.result
@@ -1,9 +1,5 @@
-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.");
-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*");
+call mtr.add_suppression("InnoDB: The page .* in file test/t1 cannot be decrypted");
+call mtr.add_suppression("Couldn't load plugins from 'file_key_management");
CREATE TABLE t1 (pk INT PRIMARY KEY, f VARCHAR(8)) ENGINE=InnoDB ENCRYPTION_KEY_ID=4;
INSERT INTO t1 VALUES (1,'foo'),(2,'bar');
OPTIMIZE TABLE t1;
diff --git a/mysql-test/suite/encryption/r/innodb-bad-key-shutdown.result b/mysql-test/suite/encryption/r/innodb-bad-key-shutdown.result
index 630fba146bf..447329a74da 100644
--- a/mysql-test/suite/encryption/r/innodb-bad-key-shutdown.result
+++ b/mysql-test/suite/encryption/r/innodb-bad-key-shutdown.result
@@ -1,17 +1,13 @@
-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 .* 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.");
-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*");
-#
+call mtr.add_suppression("InnoDB: The page .* in file test/t1 cannot be decrypted");
+call mtr.add_suppression("Couldn't load plugins from 'file_key_management");
+#
# Restart the server with key 4 in the key file
-#
+#
CREATE TABLE t1 (i INT, KEY(i)) ENGINE=InnoDB ENCRYPTED=YES ENCRYPTION_KEY_ID=4;
INSERT INTO t1 VALUES (1);
-#
+#
# Restart the server with a different value for key 4 in the key file
-#
+#
SELECT * FROM t1;
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
SELECT * FROM t1;
diff --git a/mysql-test/suite/encryption/r/innodb-encryption-disable.result b/mysql-test/suite/encryption/r/innodb-encryption-disable.result
index 63ad0cf13fb..d19124ab602 100644
--- a/mysql-test/suite/encryption/r/innodb-encryption-disable.result
+++ b/mysql-test/suite/encryption/r/innodb-encryption-disable.result
@@ -1,10 +1,5 @@
-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.");
-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*");
-call mtr.add_suppression("InnoDB: Tablespace id.* is encrypted but encryption service or used key_id .* is not available. Can't continue opening tablespace.");
+call mtr.add_suppression("InnoDB: The page .* in file test/t[15] cannot be decrypted");
+call mtr.add_suppression("Couldn't load plugins from 'file_key_management");
create table t5 (
`intcol1` int(32) DEFAULT NULL,
`intcol2` int(32) DEFAULT NULL,
diff --git a/mysql-test/suite/encryption/r/innodb-key-rotation-disable.result b/mysql-test/suite/encryption/r/innodb-key-rotation-disable.result
new file mode 100644
index 00000000000..07f6f98b88a
--- /dev/null
+++ b/mysql-test/suite/encryption/r/innodb-key-rotation-disable.result
@@ -0,0 +1,66 @@
+SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0;
+NAME
+SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0;
+NAME
+mysql/innodb_table_stats
+mysql/innodb_index_stats
+innodb_system
+create database enctests;
+use enctests;
+create table t1(a int not null primary key, b char(200)) engine=innodb;
+create table t2(a int not null primary key, b char(200)) engine=innodb row_format=compressed;
+create table t3(a int not null primary key, b char(200)) engine=innodb page_compressed=yes;
+create table t4(a int not null primary key, b char(200)) engine=innodb encrypted=yes;
+create table t5(a int not null primary key, b char(200)) engine=innodb encrypted=yes row_format=compressed;
+create table t6(a int not null primary key, b char(200)) engine=innodb encrypted=yes page_compressed=yes;
+create table t7(a int not null primary key, b char(200)) engine=innodb encrypted=no;
+create table t8(a int not null primary key, b char(200)) engine=innodb encrypted=no row_format=compressed;
+create table t9(a int not null primary key, b char(200)) engine=innodb encrypted=no page_compressed=yes;
+insert into t1 values (1, 'secredmessage');
+insert into t2 values (1, 'secredmessage');
+insert into t3 values (1, 'secredmessagecompressedaaaaaaaaabbbbbbbbbbbbbbccccccccccccccc');
+insert into t4 values (1, 'secredmessage');
+insert into t5 values (1, 'secredmessage');
+insert into t6 values (1, 'secredmessagecompressedaaaaaaaaabbbbbbbbbbbbbbccccccccccccccc');
+insert into t7 values (1, 'publicmessage');
+insert into t8 values (1, 'publicmessage');
+insert into t9 values (1, 'pugliccompressedaaaaaaaaabbbbbbbbbbbbbbccccccccccccccc');
+# should list tables t1-t6
+SELECT NAME,ENCRYPTION_SCHEME,CURRENT_KEY_ID FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0 AND NAME LIKE 'enctests%';
+NAME ENCRYPTION_SCHEME CURRENT_KEY_ID
+enctests/t1 1 1
+enctests/t2 1 1
+enctests/t3 1 1
+enctests/t4 1 1
+enctests/t5 1 1
+enctests/t6 1 1
+# should list tables t7-t9
+SELECT NAME,ENCRYPTION_SCHEME,CURRENT_KEY_ID FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0 and NAME LIKE 'enctests%';
+NAME ENCRYPTION_SCHEME CURRENT_KEY_ID
+enctests/t7 0 1
+enctests/t8 0 1
+enctests/t9 0 1
+SET GLOBAL innodb_encrypt_tables=OFF;
+ERROR 42000: Variable 'innodb_encrypt_tables' can't be set to the value of 'OFF'
+SET GLOBAL innodb_encrypt_tables=ON;
+ERROR 42000: Variable 'innodb_encrypt_tables' can't be set to the value of 'ON'
+# t1 default on expecting NOT FOUND
+NOT FOUND /secred/ in t1.ibd
+# t2 default on expecting NOT FOUND
+NOT FOUND /secred/ in t2.ibd
+# t3 default on expecting NOT FOUND
+NOT FOUND /secred/ in t3.ibd
+# t4 on expecting NOT FOUND
+NOT FOUND /secred/ in t4.ibd
+# t5 on expecting NOT FOUND
+NOT FOUND /secred/ in t5.ibd
+# t6 on expecting NOT FOUND
+NOT FOUND /secred/ in t6.ibd
+# t7 off expecting FOUND
+FOUND /public/ in t7.ibd
+# t8 row compressed expecting NOT FOUND
+FOUND /public/ in t8.ibd
+# t9 page compressed expecting NOT FOUND
+NOT FOUND /public/ in t9.ibd
+use test;
+drop database enctests;
diff --git a/mysql-test/suite/encryption/r/innodb-missing-key.result b/mysql-test/suite/encryption/r/innodb-missing-key.result
index b59ec158273..2d2bc91c321 100644
--- a/mysql-test/suite/encryption/r/innodb-missing-key.result
+++ b/mysql-test/suite/encryption/r/innodb-missing-key.result
@@ -1,6 +1,4 @@
-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 .* 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.");
+call mtr.add_suppression("InnoDB: The page .* in file test/t. cannot be decrypted");
# Start server with keys2.txt
CREATE TABLE t1(a int not null primary key auto_increment, b varchar(128)) engine=innodb ENCRYPTED=YES ENCRYPTION_KEY_ID=19;
diff --git a/mysql-test/suite/encryption/r/innodb-spatial-index.result b/mysql-test/suite/encryption/r/innodb-spatial-index.result
index 7ad0af72bcd..852be0b9a73 100644
--- a/mysql-test/suite/encryption/r/innodb-spatial-index.result
+++ b/mysql-test/suite/encryption/r/innodb-spatial-index.result
@@ -36,7 +36,7 @@ mysql/innodb_table_stats
mysql/innodb_index_stats
test/t1
test/t2
-NULL
+innodb_system
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0;
NAME
DROP TABLE t1, t2;
diff --git a/mysql-test/suite/encryption/r/innodb_encryption.result b/mysql-test/suite/encryption/r/innodb_encryption.result
index 9b762bbba11..26c77499d25 100644
--- a/mysql-test/suite/encryption/r/innodb_encryption.result
+++ b/mysql-test/suite/encryption/r/innodb_encryption.result
@@ -17,6 +17,7 @@ CURRENT_KEY_VERSION int(11) unsigned NO 0
KEY_ROTATION_PAGE_NUMBER bigint(21) unsigned YES NULL
KEY_ROTATION_MAX_PAGE_NUMBER bigint(21) unsigned YES NULL
CURRENT_KEY_ID int(11) unsigned NO 0
+ROTATING_OR_FLUSHING int(1) unsigned NO 0
# Wait max 5 min for key encryption threads to encrypt one space
# Success!
# Wait max 10 min for key encryption threads to encrypt all space
diff --git a/mysql-test/suite/encryption/r/innodb_onlinealter_encryption.result b/mysql-test/suite/encryption/r/innodb_onlinealter_encryption.result
index d04525b0d5a..26765229a2e 100644
--- a/mysql-test/suite/encryption/r/innodb_onlinealter_encryption.result
+++ b/mysql-test/suite/encryption/r/innodb_onlinealter_encryption.result
@@ -22,7 +22,7 @@ end while;
end//
commit;
set autocommit=0;
-call innodb_insert_proc(15000);
+call innodb_insert_proc(1500);
commit;
set autocommit=1;
# Wait max 10 min for key encryption threads to encrypt all spaces
@@ -40,6 +40,8 @@ NOT FOUND /author/ in t5.ibd
NOT FOUND /mangled/ in t6.ibd
# t7 ... on expecting NOT FOUND
NOT FOUND /mysql/ in t7.ibd
+SET GLOBAL innodb_file_format = `Barracuda`;
+SET GLOBAL innodb_file_per_table = ON;
ALTER TABLE t1 ADD COLUMN b int default 2;
ALTER TABLE t2 ADD COLUMN b int default 2;
ALTER TABLE t7 ADD COLUMN b int default 2;
@@ -133,42 +135,5 @@ NOT FOUND /author/ in t5.ibd
NOT FOUND /mangled/ in t6.ibd
# t7 ... on expecting NOT FOUND
NOT FOUND /mysql/ in t7.ibd
-# Restarting server
-# Done restarting server
-select count(1) from t1;
-count(1)
-15000
-select count(1) from t2;
-count(1)
-15000
-select count(1) from t3;
-count(1)
-15000
-select count(1) from t4;
-count(1)
-15000
-select count(1) from t5;
-count(1)
-15000
-select count(1) from t6;
-count(1)
-15000
-select count(1) from t7;
-count(1)
-15000
-# t1 yes on expecting NOT FOUND
-NOT FOUND /foobar/ in t1.ibd
-# t2 ... on expecting NOT FOUND
-NOT FOUND /temp/ in t2.ibd
-# t3 ... on expecting NOT FOUND
-NOT FOUND /barfoo/ in t3.ibd
-# t4 ... on expecting NOT FOUND
-NOT FOUND /repeat/ in t4.ibd
-# t5 ... on expecting NOT FOUND
-NOT FOUND /author/ in t5.ibd
-# t6 ... on expecting NOT FOUND
-NOT FOUND /mangled/ in t6.ibd
-# t7 ... on expecting NOT FOUND
-NOT FOUND /mysql/ in t7.ibd
DROP PROCEDURE innodb_insert_proc;
DROP TABLE t1, t2, t3, t4, t5, t6, t7;
diff --git a/mysql-test/suite/encryption/t/debug_key_management.test b/mysql-test/suite/encryption/t/debug_key_management.test
index b4dc8c41916..5001ac6a516 100644
--- a/mysql-test/suite/encryption/t/debug_key_management.test
+++ b/mysql-test/suite/encryption/t/debug_key_management.test
@@ -11,14 +11,15 @@ show variables like 'innodb_encrypt%';
let $wait_condition= select count(*) = 3 from information_schema.innodb_tablespaces_encryption where current_key_version=1;
--source include/wait_condition.inc
-select space,name,current_key_version from information_schema.innodb_tablespaces_encryption order by space;
+select count(*) from information_schema.innodb_tablespaces_encryption where current_key_version <> 1;
set global debug_key_management_version=10;
let $wait_condition= select count(*) = 3 from information_schema.innodb_tablespaces_encryption where current_key_version=10;
--source include/wait_condition.inc
-select space,name,current_key_version from information_schema.innodb_tablespaces_encryption order by space;
+select count(*) from information_schema.innodb_tablespaces_encryption where current_key_version <> 10;
# Note that we expect that key_version is increasing so disable encryption before reset
+
set global innodb_encrypt_tables=OFF;
set global debug_key_management_version=1;
diff --git a/mysql-test/suite/encryption/t/encrypt_and_grep.opt b/mysql-test/suite/encryption/t/encrypt_and_grep.opt
index bcff011eb82..5c9aaf65b06 100644
--- a/mysql-test/suite/encryption/t/encrypt_and_grep.opt
+++ b/mysql-test/suite/encryption/t/encrypt_and_grep.opt
@@ -1,8 +1,7 @@
--innodb-encrypt-tables=ON
--innodb-encrypt-log=ON
--innodb-encryption-rotate-key-age=15
---innodb-encryption-threads=4
+--innodb-encryption-threads=1
--innodb-tablespaces-encryption
---innodb-max-dirty-pages-pct=0.001
diff --git a/mysql-test/suite/encryption/t/encrypt_and_grep.test b/mysql-test/suite/encryption/t/encrypt_and_grep.test
index 2a5fcbcebf8..fd54fc74f0a 100644
--- a/mysql-test/suite/encryption/t/encrypt_and_grep.test
+++ b/mysql-test/suite/encryption/t/encrypt_and_grep.test
@@ -1,5 +1,5 @@
-- source include/have_innodb.inc
--- source include/have_example_key_management_plugin.inc
+-- source include/have_file_key_management_plugin.inc
# embedded does not support restart
-- source include/not_embedded.inc
@@ -30,7 +30,10 @@ insert t3 values (repeat('dummy', 42));
--let $wait_condition=SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0
--source include/wait_condition.inc
---sleep 5
+SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0;
+SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0;
+
+--source include/shutdown_mysqld.inc
--let SEARCH_PATTERN=foobar
--echo # t1 yes on expecting NOT FOUND
@@ -49,15 +52,21 @@ insert t3 values (repeat('dummy', 42));
-- let SEARCH_FILE=$ib1_IBD
-- source include/search_pattern_in_file.inc
+-- source include/start_mysqld.inc
+
--echo # Now turn off encryption and wait for threads to decrypt everything
-SET GLOBAL innodb_encryption_threads = 4;
+SET GLOBAL innodb_encryption_threads = 1;
SET GLOBAL innodb_encrypt_tables = off;
--echo # Wait max 10 min for key encryption threads to decrypt all spaces
--let $wait_timeout= 600
---let $wait_condition=SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0;
+--let $wait_condition=SELECT COUNT(*) = 5 FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0 AND KEY_ROTATION_PAGE_NUMBER IS NULL;
--source include/wait_condition.inc
---sleep 5
+
+SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0;
+SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0;
+
+--source include/shutdown_mysqld.inc
--let SEARCH_PATTERN=foobar
--echo # t1 yes on expecting NOT FOUND
@@ -76,6 +85,8 @@ SET GLOBAL innodb_encrypt_tables = off;
-- let SEARCH_FILE=$ib1_IBD
-- source include/search_pattern_in_file.inc
+-- source include/start_mysqld.inc
+
--echo # Now turn on encryption and wait for threads to encrypt all spaces
SET GLOBAL innodb_encryption_threads = 4;
SET GLOBAL innodb_encrypt_tables = on;
@@ -84,7 +95,11 @@ SET GLOBAL innodb_encrypt_tables = on;
--let $wait_timeout= 600
--let $wait_condition=SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0;
--source include/wait_condition.inc
---sleep 5
+
+SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0;
+SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0;
+
+--source include/shutdown_mysqld.inc
--let SEARCH_PATTERN=foobar
--echo # t1 yes on expecting NOT FOUND
@@ -103,6 +118,6 @@ SET GLOBAL innodb_encrypt_tables = on;
-- let SEARCH_FILE=$ib1_IBD
-- source include/search_pattern_in_file.inc
---echo # TODO: add shutdown + grep tests
+-- source include/start_mysqld.inc
drop table t1, t2, t3;
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 cc5e6b36ac3..e8b5de99d80 100644
--- a/mysql-test/suite/encryption/t/innodb-bad-key-change.test
+++ b/mysql-test/suite/encryption/t/innodb-bad-key-change.test
@@ -13,16 +13,9 @@
#
call mtr.add_suppression("Plugin 'file_key_management' init function returned error");
-call mtr.add_suppression("InnoDB: Database page corruption on disk or a failed.*");
call mtr.add_suppression("Plugin 'file_key_management' registration.*failed");
-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 .* 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.");
-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("mysqld: File .*");
-call mtr.add_suppression("InnoDB: Tablespace id .* is encrypted but encryption service or used key_id .* is not available. Can't continue opening tablespace.");
-call mtr.add_suppression("InnoDB: InnoDB: Page may be an index page where index id is .*");
+call mtr.add_suppression("InnoDB: The page .* in file test/.* cannot be decrypted");
+call mtr.add_suppression("mysqld: File .* not found");
--echo
--echo # Start server with keys2.txt
diff --git a/mysql-test/suite/encryption/t/innodb-bad-key-change2.test b/mysql-test/suite/encryption/t/innodb-bad-key-change2.test
index 7c61c34ec59..c7c9e66dcf8 100644
--- a/mysql-test/suite/encryption/t/innodb-bad-key-change2.test
+++ b/mysql-test/suite/encryption/t/innodb-bad-key-change2.test
@@ -8,42 +8,28 @@
#
# MDEV-8750: Server crashes in page_cur_is_after_last on altering table using a wrong encryption key
#
-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.");
-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("InnoDB: The page .* in file test/t1 cannot be decrypted");
# Suppression for builds where file_key_management plugin is linked statically
-call mtr.add_suppression("Couldn't load plugins from 'file_key_management*");
-
---exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
---shutdown_server
---source include/wait_until_disconnected.inc
+call mtr.add_suppression("Couldn't load plugins from 'file_key_management");
--write_file $MYSQLTEST_VARDIR/keys1.txt
1;770A8A65DA156D24EE2A093277530142
4;770A8A65DA156D24EE2A093277530143
EOF
---exec echo "restart:--innodb-encrypt-tables --innodb-stats-persistent --plugin-load-add=file_key_management.so --file-key-management --file-key-management-filename=$MYSQLTEST_VARDIR/keys1.txt" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
---enable_reconnect
---source include/wait_until_connected_again.inc
+--let $restart_parameters= --innodb-encrypt-tables --innodb-stats-persistent --plugin-load-add=file_key_management.so --file-key-management --file-key-management-filename=$MYSQLTEST_VARDIR/keys1.txt
+--source include/restart_mysqld.inc
CREATE TABLE t1 (pk INT PRIMARY KEY, f VARCHAR(8)) ENGINE=InnoDB ENCRYPTION_KEY_ID=4;
INSERT INTO t1 VALUES (1,'foo'),(2,'bar');
---exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
---shutdown_server
---source include/wait_until_disconnected.inc
-
--write_file $MYSQLTEST_VARDIR/keys2.txt
1;770A8A65DA156D24EE2A093277530142
4;770A8A65DA156D24EE2A093277530144
EOF
---exec echo "restart:--innodb-encrypt-tables --innodb-stats-persistent --plugin-load-add=file_key_management.so --file-key-management --file-key-management-filename=$MYSQLTEST_VARDIR/keys2.txt" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
---enable_reconnect
---source include/wait_until_connected_again.inc
+--let $restart_parameters= --innodb-encrypt-tables --innodb-stats-persistent --plugin-load-add=file_key_management.so --file-key-management --file-key-management-filename=$MYSQLTEST_VARDIR/keys2.txt
+--source include/restart_mysqld.inc
--error ER_GET_ERRMSG
select * from t1;
@@ -55,5 +41,9 @@ show warnings;
alter table t1 engine=InnoDB;
show warnings;
+--let $restart_parameters= --innodb-encrypt-tables --innodb-stats-persistent --plugin-load-add=file_key_management.so --file-key-management --file-key-management-filename=$MYSQLTEST_VARDIR/keys1.txt
+--source include/restart_mysqld.inc
+
+DROP TABLE t1;
--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 0b1db40b866..0459c433ece 100644
--- a/mysql-test/suite/encryption/t/innodb-bad-key-change4.test
+++ b/mysql-test/suite/encryption/t/innodb-bad-key-change4.test
@@ -8,66 +8,36 @@
#
# MDEV-8768: Server crash at file btr0btr.ic line 122 when checking encrypted table using incorrect keys
#
-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.");
-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("InnoDB: The page .* in file test/t1 cannot be decrypted");
# Suppression for builds where file_key_management plugin is linked statically
-call mtr.add_suppression("Couldn't load plugins from 'file_key_management*");
-
---exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
---shutdown_server
---source include/wait_until_disconnected.inc
+call mtr.add_suppression("Couldn't load plugins from 'file_key_management");
--write_file $MYSQLTEST_VARDIR/keys1.txt
1;770A8A65DA156D24EE2A093277530142
4;770A8A65DA156D24EE2A093277530143
EOF
---exec echo "restart:--innodb-encrypt-tables --innodb-stats-persistent --plugin-load-add=file_key_management.so --file-key-management --file-key-management-filename=$MYSQLTEST_VARDIR/keys1.txt" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
---enable_reconnect
---source include/wait_until_connected_again.inc
-
---let $MYSQLD_TMPDIR = `SELECT @@tmpdir`
---let $MYSQLD_DATADIR = `SELECT @@datadir`
+--let $restart_parameters= --innodb-encrypt-tables --innodb-stats-persistent --plugin-load-add=file_key_management.so --file-key-management --file-key-management-filename=$MYSQLTEST_VARDIR/keys1.txt
+--source include/restart_mysqld.inc
CREATE TABLE t1 (pk INT PRIMARY KEY, f VARCHAR(8)) ENGINE=InnoDB ENCRYPTION_KEY_ID=4;
INSERT INTO t1 VALUES (1,'foo'),(2,'bar');
---exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
---shutdown_server
---source include/wait_until_disconnected.inc
-
--write_file $MYSQLTEST_VARDIR/keys2.txt
1;770A8A65DA156D24EE2A093277530142
4;770A8A65DA156D24EE2A093277530144
EOF
---exec echo "restart:--innodb-encrypt-tables --innodb-stats-persistent --plugin-load-add=file_key_management.so --file-key-management --file-key-management-filename=$MYSQLTEST_VARDIR/keys2.txt" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
---enable_reconnect
---source include/wait_until_connected_again.inc
+--let $restart_parameters= --innodb-encrypt-tables --innodb-stats-persistent --plugin-load-add=file_key_management.so --file-key-management --file-key-management-filename=$MYSQLTEST_VARDIR/keys2.txt
+--source include/restart_mysqld.inc
--replace_regex /tablespace [0-9]*/tablespace #/
CHECK TABLE t1;
SHOW WARNINGS;
---remove_file $MYSQLTEST_VARDIR/keys1.txt
---remove_file $MYSQLTEST_VARDIR/keys2.txt
-
---exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
---shutdown_server
---source include/wait_until_disconnected.inc
-
---write_file $MYSQLTEST_VARDIR/keys1.txt
-1;770A8A65DA156D24EE2A093277530142
-4;770A8A65DA156D24EE2A093277530143
-EOF
-
---exec echo "restart:--innodb-encrypt-tables --innodb-stats-persistent --plugin-load-add=file_key_management.so --file-key-management --file-key-management-filename=$MYSQLTEST_VARDIR/keys1.txt" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
---enable_reconnect
---source include/wait_until_connected_again.inc
+--let $restart_parameters= --innodb-encrypt-tables --innodb-stats-persistent --plugin-load-add=file_key_management.so --file-key-management --file-key-management-filename=$MYSQLTEST_VARDIR/keys1.txt
+--source include/restart_mysqld.inc
DROP TABLE t1;
-
--remove_file $MYSQLTEST_VARDIR/keys1.txt
+--remove_file $MYSQLTEST_VARDIR/keys2.txt
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 5f63eebe034..b205d203374 100644
--- a/mysql-test/suite/encryption/t/innodb-bad-key-change5.test
+++ b/mysql-test/suite/encryption/t/innodb-bad-key-change5.test
@@ -8,64 +8,35 @@
#
# MDEV-8769: Server crash at file btr0btr.ic line 122 when defragmenting encrypted table using incorrect keys
#
-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.");
-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("InnoDB: The page .* in file test/t1 cannot be decrypted");
# Suppression for builds where file_key_management plugin is linked statically
-call mtr.add_suppression("Couldn't load plugins from 'file_key_management*");
-
---exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
---shutdown_server
---source include/wait_until_disconnected.inc
+call mtr.add_suppression("Couldn't load plugins from 'file_key_management");
--write_file $MYSQLTEST_VARDIR/keys1.txt
1;770A8A65DA156D24EE2A093277530142
4;770A8A65DA156D24EE2A093277530143
EOF
---exec echo "restart:--innodb-encrypt-tables --innodb-defragment=1 --innodb-stats-persistent --plugin-load-add=file_key_management.so --file-key-management --file-key-management-filename=$MYSQLTEST_VARDIR/keys1.txt" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
---enable_reconnect
---source include/wait_until_connected_again.inc
-
---let $MYSQLD_TMPDIR = `SELECT @@tmpdir`
---let $MYSQLD_DATADIR = `SELECT @@datadir`
+--let $restart_parameters= --innodb-encrypt-tables --innodb-defragment=1 --innodb-stats-persistent --plugin-load-add=file_key_management.so --file-key-management --file-key-management-filename=$MYSQLTEST_VARDIR/keys1.txt
+--source include/restart_mysqld.inc
CREATE TABLE t1 (pk INT PRIMARY KEY, f VARCHAR(8)) ENGINE=InnoDB ENCRYPTION_KEY_ID=4;
INSERT INTO t1 VALUES (1,'foo'),(2,'bar');
---exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
---shutdown_server
---source include/wait_until_disconnected.inc
-
--write_file $MYSQLTEST_VARDIR/keys2.txt
1;770A8A65DA156D24EE2A093277530142
4;770A8A65DA156D24EE2A093277530144
EOF
---exec echo "restart:--innodb-encrypt-tables --innodb-defragment=1 --innodb-stats-persistent --plugin-load-add=file_key_management.so --file-key-management --file-key-management-filename=$MYSQLTEST_VARDIR/keys2.txt" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
---enable_reconnect
---source include/wait_until_connected_again.inc
+--let $restart_parameters= --innodb-encrypt-tables --innodb-defragment=1 --innodb-stats-persistent --plugin-load-add=file_key_management.so --file-key-management --file-key-management-filename=$MYSQLTEST_VARDIR/keys2.txt
+--source include/restart_mysqld.inc
OPTIMIZE TABLE t1;
SHOW WARNINGS;
---remove_file $MYSQLTEST_VARDIR/keys1.txt
---remove_file $MYSQLTEST_VARDIR/keys2.txt
-
---exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
---shutdown_server
---source include/wait_until_disconnected.inc
-
---write_file $MYSQLTEST_VARDIR/keys1.txt
-1;770A8A65DA156D24EE2A093277530142
-4;770A8A65DA156D24EE2A093277530143
-EOF
-
---exec echo "restart:--innodb-encrypt-tables --innodb-defragment=1 --innodb-stats-persistent --plugin-load-add=file_key_management.so --file-key-management --file-key-management-filename=$MYSQLTEST_VARDIR/keys1.txt" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
---enable_reconnect
---source include/wait_until_connected_again.inc
+--let $restart_parameters= --innodb-encrypt-tables --innodb-defragment=1 --innodb-stats-persistent --plugin-load-add=file_key_management.so --file-key-management --file-key-management-filename=$MYSQLTEST_VARDIR/keys1.txt
+--source include/restart_mysqld.inc
DROP TABLE t1;
--remove_file $MYSQLTEST_VARDIR/keys1.txt
+--remove_file $MYSQLTEST_VARDIR/keys2.txt
diff --git a/mysql-test/suite/encryption/t/innodb-bad-key-shutdown.test b/mysql-test/suite/encryption/t/innodb-bad-key-shutdown.test
index d27402edaa8..d1b009fad93 100644
--- a/mysql-test/suite/encryption/t/innodb-bad-key-shutdown.test
+++ b/mysql-test/suite/encryption/t/innodb-bad-key-shutdown.test
@@ -2,67 +2,51 @@
# MDEV-8727: Server/InnoDB hangs on shutdown after trying to read an encrypted table with a wrong key
#
-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 .* 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.");
-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/.*");
-# Suppression for builds where file_key_management plugin is linked statically
-call mtr.add_suppression("Couldn't load plugins from 'file_key_management*");
-
---echo #
---echo # Restart the server with key 4 in the key file
---echo #
-
--source include/have_innodb.inc
--source include/not_embedded.inc
---exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
---shutdown_server
---source include/wait_until_disconnected.inc
+call mtr.add_suppression("InnoDB: The page .* in file test/t1 cannot be decrypted");
+# Suppression for builds where file_key_management plugin is linked statically
+call mtr.add_suppression("Couldn't load plugins from 'file_key_management");
+
+--echo #
+--echo # Restart the server with key 4 in the key file
+--echo #
--write_file $MYSQLTEST_VARDIR/keys1.txt
1;770A8A65DA156D24EE2A093277530142
4;18420B5CBA31CCDFFE9716E91EB61374D05914F3ADE23E03
EOF
---exec echo "restart:--plugin-load-add=file_key_management.so --file-key-management --file-key-management-filename=$MYSQLTEST_VARDIR/keys1.txt" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
---enable_reconnect
---source include/wait_until_connected_again.inc
+--let $restart_parameters= --plugin-load-add=file_key_management.so --file-key-management --file-key-management-filename=$MYSQLTEST_VARDIR/keys1.txt
+--source include/restart_mysqld.inc
CREATE TABLE t1 (i INT, KEY(i)) ENGINE=InnoDB ENCRYPTED=YES ENCRYPTION_KEY_ID=4;
INSERT INTO t1 VALUES (1);
---echo #
+--echo #
--echo # Restart the server with a different value for key 4 in the key file
---echo #
-
---exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
---shutdown_server
---source include/wait_until_disconnected.inc
+--echo #
--write_file $MYSQLTEST_VARDIR/keys2.txt
1;770A8A65DA156D24EE2A093277530142
4;22222222222222222222222222222222
EOF
---exec echo "restart:--plugin-load-add=file_key_management.so --file-key-management --file-key-management-filename=$MYSQLTEST_VARDIR/keys2.txt" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
---enable_reconnect
---source include/wait_until_connected_again.inc
+--let $restart_parameters= --plugin-load-add=file_key_management.so --file-key-management --file-key-management-filename=$MYSQLTEST_VARDIR/keys2.txt
+--source include/restart_mysqld.inc
---error 1296
+--error ER_GET_ERRMSG
SELECT * FROM t1;
---exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
---shutdown_server
---source include/wait_until_disconnected.inc
-
---exec echo "restart:--plugin-load-add=file_key_management.so --file-key-management --file-key-management-filename=$MYSQLTEST_VARDIR/keys1.txt" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
---enable_reconnect
---source include/wait_until_connected_again.inc
+--let $restart_parameters= --plugin-load-add=file_key_management.so --file-key-management --file-key-management-filename=$MYSQLTEST_VARDIR/keys1.txt
+--source include/restart_mysqld.inc
SELECT * FROM t1;
DROP TABLE t1;
+--let $restart_parameters=
+--source include/restart_mysqld.inc
+
--remove_file $MYSQLTEST_VARDIR/keys2.txt
--remove_file $MYSQLTEST_VARDIR/keys1.txt
diff --git a/mysql-test/suite/encryption/t/innodb-encryption-disable.test b/mysql-test/suite/encryption/t/innodb-encryption-disable.test
index 8a8b451f5b1..fed9878ffbc 100644
--- a/mysql-test/suite/encryption/t/innodb-encryption-disable.test
+++ b/mysql-test/suite/encryption/t/innodb-encryption-disable.test
@@ -9,29 +9,15 @@
#
# MDEV-9559: Server without encryption configs crashes if selecting from an implicitly encrypted table
#
-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.");
-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/.*");
-# Suppression for builds where file_key_management plugin is linked statically
-call mtr.add_suppression("Couldn't load plugins from 'file_key_management*");
-call mtr.add_suppression("InnoDB: Tablespace id.* is encrypted but encryption service or used key_id .* is not available. Can't continue opening tablespace.");
+call mtr.add_suppression("InnoDB: The page .* in file test/t[15] cannot be decrypted");
+call mtr.add_suppression("Couldn't load plugins from 'file_key_management");
---exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
---shutdown_server
---source include/wait_until_disconnected.inc
-
---error 0,1,2
---remove_file $MYSQLTEST_VARDIR/encryption-disable-keys1.txt
---write_file $MYSQLTEST_VARDIR/encryption-disable-keys1.txt
+--write_file $MYSQLTEST_VARDIR/keys1.txt
1;770A8A65DA156D24EE2A093277530142
-4;770A8A65DA156D24EE2A093277530143
EOF
---exec echo "restart:--innodb-encrypt-tables --plugin-load-add=file_key_management.so --file-key-management --file-key-management-filename=$MYSQLTEST_VARDIR/encryption-disable-keys1.txt" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
---enable_reconnect
---source include/wait_until_connected_again.inc
+--let $restart_parameters= --innodb-encrypt-tables --plugin-load-add=file_key_management.so --file-key-management --file-key-management-filename=$MYSQLTEST_VARDIR/keys1.txt
+--source include/restart_mysqld.inc
create table t5 (
`intcol1` int(32) DEFAULT NULL,
@@ -61,28 +47,18 @@ alter table t1 encrypted='yes' `encryption_key_id`=1;
select * from t1;
select * from t5;
---exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
---shutdown_server
---source include/wait_until_disconnected.inc
-
---exec echo "restart:--innodb-encrypt-tables=OFF" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
---enable_reconnect
---source include/wait_until_connected_again.inc
+--let $restart_parameters= --innodb-encrypt-tables=OFF
+--source include/restart_mysqld.inc
---error 1296
+--error ER_GET_ERRMSG
select * from t1;
---error 1296
+--error ER_GET_ERRMSG
select * from t5;
---exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
---shutdown_server
---source include/wait_until_disconnected.inc
-
---exec echo "restart:--innodb-encrypt-tables --plugin-load-add=file_key_management.so --file-key-management --file-key-management-filename=$MYSQLTEST_VARDIR/encryption-disable-keys1.txt" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
---enable_reconnect
---source include/wait_until_connected_again.inc
+--let $restart_parameters= --innodb-encrypt-tables --plugin-load-add=file_key_management.so --file-key-management --file-key-management-filename=$MYSQLTEST_VARDIR/keys1.txt
+--source include/restart_mysqld.inc
drop table t1;
drop table t5;
---remove_file $MYSQLTEST_VARDIR/encryption-disable-keys1.txt
+--remove_file $MYSQLTEST_VARDIR/keys1.txt
diff --git a/mysql-test/suite/encryption/t/innodb-key-rotation-disable.opt b/mysql-test/suite/encryption/t/innodb-key-rotation-disable.opt
new file mode 100644
index 00000000000..03a0028d371
--- /dev/null
+++ b/mysql-test/suite/encryption/t/innodb-key-rotation-disable.opt
@@ -0,0 +1,5 @@
+--innodb-encrypt-tables
+--innodb-encrypt-log
+--innodb-encryption-rotate-key-age=0
+--innodb-encryption-threads=4
+--innodb-tablespaces-encryption
diff --git a/mysql-test/suite/encryption/t/innodb-key-rotation-disable.test b/mysql-test/suite/encryption/t/innodb-key-rotation-disable.test
new file mode 100644
index 00000000000..fdbd6c8da7c
--- /dev/null
+++ b/mysql-test/suite/encryption/t/innodb-key-rotation-disable.test
@@ -0,0 +1,102 @@
+-- source include/have_innodb.inc
+-- source include/have_file_key_management_plugin.inc
+# not embedded because of restarts
+-- source include/not_embedded.inc
+
+SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0;
+SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0;
+
+--disable_query_log
+--disable_warnings
+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`;
+SET GLOBAL innodb_file_format = `Barracuda`;
+SET GLOBAL innodb_file_per_table = ON;
+# zlib
+set global innodb_compression_algorithm = 1;
+--enable_warnings
+--enable_query_log
+
+create database enctests;
+use enctests;
+create table t1(a int not null primary key, b char(200)) engine=innodb;
+create table t2(a int not null primary key, b char(200)) engine=innodb row_format=compressed;
+create table t3(a int not null primary key, b char(200)) engine=innodb page_compressed=yes;
+create table t4(a int not null primary key, b char(200)) engine=innodb encrypted=yes;
+create table t5(a int not null primary key, b char(200)) engine=innodb encrypted=yes row_format=compressed;
+create table t6(a int not null primary key, b char(200)) engine=innodb encrypted=yes page_compressed=yes;
+create table t7(a int not null primary key, b char(200)) engine=innodb encrypted=no;
+create table t8(a int not null primary key, b char(200)) engine=innodb encrypted=no row_format=compressed;
+create table t9(a int not null primary key, b char(200)) engine=innodb encrypted=no page_compressed=yes;
+
+insert into t1 values (1, 'secredmessage');
+insert into t2 values (1, 'secredmessage');
+insert into t3 values (1, 'secredmessagecompressedaaaaaaaaabbbbbbbbbbbbbbccccccccccccccc');
+insert into t4 values (1, 'secredmessage');
+insert into t5 values (1, 'secredmessage');
+insert into t6 values (1, 'secredmessagecompressedaaaaaaaaabbbbbbbbbbbbbbccccccccccccccc');
+insert into t7 values (1, 'publicmessage');
+insert into t8 values (1, 'publicmessage');
+insert into t9 values (1, 'pugliccompressedaaaaaaaaabbbbbbbbbbbbbbccccccccccccccc');
+
+--echo # should list tables t1-t6
+SELECT NAME,ENCRYPTION_SCHEME,CURRENT_KEY_ID FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0 AND NAME LIKE 'enctests%';
+--echo # should list tables t7-t9
+SELECT NAME,ENCRYPTION_SCHEME,CURRENT_KEY_ID FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0 and NAME LIKE 'enctests%';
+
+--error ER_WRONG_VALUE_FOR_VAR
+SET GLOBAL innodb_encrypt_tables=OFF;
+--error ER_WRONG_VALUE_FOR_VAR
+SET GLOBAL innodb_encrypt_tables=ON;
+
+--let $MYSQLD_DATADIR=`select @@datadir`
+
+-- source include/shutdown_mysqld.inc
+
+--let SEARCH_RANGE = 10000000
+--let SEARCH_PATTERN=secred
+--echo # t1 default on expecting NOT FOUND
+-- let SEARCH_FILE=$MYSQLD_DATADIR/enctests/t1.ibd
+-- source include/search_pattern_in_file.inc
+--echo # t2 default on expecting NOT FOUND
+-- let SEARCH_FILE=$MYSQLD_DATADIR/enctests/t2.ibd
+-- source include/search_pattern_in_file.inc
+--echo # t3 default on expecting NOT FOUND
+-- let SEARCH_FILE=$MYSQLD_DATADIR/enctests/t3.ibd
+-- source include/search_pattern_in_file.inc
+--echo # t4 on expecting NOT FOUND
+-- let SEARCH_FILE=$MYSQLD_DATADIR/enctests/t4.ibd
+-- source include/search_pattern_in_file.inc
+--echo # t5 on expecting NOT FOUND
+-- let SEARCH_FILE=$MYSQLD_DATADIR/enctests/t5.ibd
+-- source include/search_pattern_in_file.inc
+--echo # t6 on expecting NOT FOUND
+-- let SEARCH_FILE=$MYSQLD_DATADIR/enctests/t6.ibd
+-- source include/search_pattern_in_file.inc
+--let SEARCH_PATTERN=public
+--echo # t7 off expecting FOUND
+-- let SEARCH_FILE=$MYSQLD_DATADIR/enctests/t7.ibd
+-- source include/search_pattern_in_file.inc
+--echo # t8 row compressed expecting NOT FOUND
+-- let SEARCH_FILE=$MYSQLD_DATADIR/enctests/t8.ibd
+-- source include/search_pattern_in_file.inc
+--echo # t9 page compressed expecting NOT FOUND
+-- let SEARCH_FILE=$MYSQLD_DATADIR/enctests/t9.ibd
+-- source include/search_pattern_in_file.inc
+
+-- source include/start_mysqld.inc
+
+use test;
+drop database enctests;
+# reset system
+
+--disable_query_log
+--disable_warnings
+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;
+set global innodb_compression_algorithm = DEFAULT;
+--enable_warnings
+--enable_query_log
diff --git a/mysql-test/suite/encryption/t/innodb-missing-key.test b/mysql-test/suite/encryption/t/innodb-missing-key.test
index 8fcfb766117..84ca92010e9 100644
--- a/mysql-test/suite/encryption/t/innodb-missing-key.test
+++ b/mysql-test/suite/encryption/t/innodb-missing-key.test
@@ -2,16 +2,11 @@
-- source include/have_file_key_management_plugin.inc
# embedded does not support restart
-- source include/not_embedded.inc
--- source include/not_valgrind.inc
-# Avoid CrashReporter popup on Mac
--- source include/not_crashrep.inc
#
# MDEV-11004: Unable to start (Segfault or os error 2) when encryption key missing
#
-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 .* 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.");
+call mtr.add_suppression("InnoDB: The page .* in file test/t. cannot be decrypted");
--echo
--echo # Start server with keys2.txt
diff --git a/mysql-test/suite/encryption/t/innodb_onlinealter_encryption.test b/mysql-test/suite/encryption/t/innodb_onlinealter_encryption.test
index eb90c446a81..e7e8405e839 100644
--- a/mysql-test/suite/encryption/t/innodb_onlinealter_encryption.test
+++ b/mysql-test/suite/encryption/t/innodb_onlinealter_encryption.test
@@ -1,18 +1,7 @@
-- source include/have_innodb.inc
--- source include/have_example_key_management_plugin.inc
--- source include/not_valgrind.inc
+-- source include/have_file_key_management_plugin.inc
+# test uses restart
-- source include/not_embedded.inc
--- source include/not_windows.inc
-
---let $MYSQLD_DATADIR=`select @@datadir`
---let SEARCH_RANGE = 10000000
---let t1_IBD = $MYSQLD_DATADIR/test/t1.ibd
---let t2_IBD = $MYSQLD_DATADIR/test/t2.ibd
---let t3_IBD = $MYSQLD_DATADIR/test/t3.ibd
---let t4_IBD = $MYSQLD_DATADIR/test/t4.ibd
---let t5_IBD = $MYSQLD_DATADIR/test/t5.ibd
---let t6_IBD = $MYSQLD_DATADIR/test/t6.ibd
---let t7_IBD = $MYSQLD_DATADIR/test/t7.ibd
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;
@@ -42,7 +31,7 @@ delimiter ;//
commit;
set autocommit=0;
-call innodb_insert_proc(15000);
+call innodb_insert_proc(1500);
commit;
set autocommit=1;
@@ -50,37 +39,48 @@ set autocommit=1;
--let $wait_timeout= 600
--let $wait_condition=SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0
--source include/wait_condition.inc
+--let $MYSQLD_DATADIR=`select @@datadir`
---sleep 10
+--source include/shutdown_mysqld.inc
+--source include/wait_until_disconnected.inc
+
+--let SEARCH_RANGE = 10000000
--let SEARCH_PATTERN=foobar
--echo # t1 yes on expecting NOT FOUND
--- let SEARCH_FILE=$t1_IBD
+-- let SEARCH_FILE=$MYSQLD_DATADIR/test/t1.ibd
-- source include/search_pattern_in_file.inc
--let SEARCH_PATTERN=temp
--echo # t2 ... on expecting NOT FOUND
--- let SEARCH_FILE=$t2_IBD
+-- let SEARCH_FILE=$MYSQLD_DATADIR/test/t2.ibd
-- source include/search_pattern_in_file.inc
--let SEARCH_PATTERN=barfoo
--echo # t3 ... on expecting NOT FOUND
--- let SEARCH_FILE=$t3_IBD
+-- let SEARCH_FILE=$MYSQLD_DATADIR/test/t3.ibd
-- source include/search_pattern_in_file.inc
--let SEARCH_PATTERN=repeat
--echo # t4 ... on expecting NOT FOUND
--- let SEARCH_FILE=$t4_IBD
+-- let SEARCH_FILE=$MYSQLD_DATADIR/test/t4.ibd
-- source include/search_pattern_in_file.inc
--let SEARCH_PATTERN=author
--echo # t5 ... on expecting NOT FOUND
--- let SEARCH_FILE=$t5_IBD
+-- let SEARCH_FILE=$MYSQLD_DATADIR/test/t5.ibd
-- source include/search_pattern_in_file.inc
--let SEARCH_PATTERN=mangled
--echo # t6 ... on expecting NOT FOUND
--- let SEARCH_FILE=$t6_IBD
+-- let SEARCH_FILE=$MYSQLD_DATADIR/test/t6.ibd
-- source include/search_pattern_in_file.inc
--let SEARCH_PATTERN=mysql
--echo # t7 ... on expecting NOT FOUND
--- let SEARCH_FILE=$t7_IBD
+-- let SEARCH_FILE=$MYSQLD_DATADIR/test/t7.ibd
-- source include/search_pattern_in_file.inc
+-- source include/start_mysqld.inc
+
+--disable_warnings
+SET GLOBAL innodb_file_format = `Barracuda`;
+SET GLOBAL innodb_file_per_table = ON;
+--enable_warnings
+
ALTER TABLE t1 ADD COLUMN b int default 2;
ALTER TABLE t2 ADD COLUMN b int default 2;
ALTER TABLE t7 ADD COLUMN b int default 2;
@@ -102,76 +102,39 @@ SHOW CREATE TABLE t5;
SHOW CREATE TABLE t6;
SHOW CREATE TABLE t7;
---sleep 10
---let SEARCH_PATTERN=foobar
---echo # t1 yes on expecting NOT FOUND
--- let SEARCH_FILE=$t1_IBD
--- source include/search_pattern_in_file.inc
---let SEARCH_PATTERN=temp
---echo # t2 ... on expecting NOT FOUND
--- let SEARCH_FILE=$t2_IBD
--- source include/search_pattern_in_file.inc
---let SEARCH_PATTERN=barfoo
---echo # t3 ... on expecting NOT FOUND
--- let SEARCH_FILE=$t3_IBD
--- source include/search_pattern_in_file.inc
---let SEARCH_PATTERN=repeat
---echo # t4 ... on expecting NOT FOUND
--- let SEARCH_FILE=$t4_IBD
--- source include/search_pattern_in_file.inc
---let SEARCH_PATTERN=author
---echo # t5 ... on expecting NOT FOUND
--- let SEARCH_FILE=$t5_IBD
--- source include/search_pattern_in_file.inc
---let SEARCH_PATTERN=mangled
---echo # t6 ... on expecting NOT FOUND
--- let SEARCH_FILE=$t6_IBD
--- source include/search_pattern_in_file.inc
---let SEARCH_PATTERN=mysql
---echo # t7 ... on expecting NOT FOUND
--- let SEARCH_FILE=$t7_IBD
--- source include/search_pattern_in_file.inc
-
---echo # Restarting server
--- source include/restart_mysqld.inc
---echo # Done restarting server
-
-select count(1) from t1;
-select count(1) from t2;
-select count(1) from t3;
-select count(1) from t4;
-select count(1) from t5;
-select count(1) from t6;
-select count(1) from t7;
+--source include/shutdown_mysqld.inc
+--source include/wait_until_disconnected.inc
--let SEARCH_PATTERN=foobar
--echo # t1 yes on expecting NOT FOUND
--- let SEARCH_FILE=$t1_IBD
+-- let SEARCH_FILE=$MYSQLD_DATADIR/test/t1.ibd
-- source include/search_pattern_in_file.inc
--let SEARCH_PATTERN=temp
--echo # t2 ... on expecting NOT FOUND
--- let SEARCH_FILE=$t2_IBD
+-- let SEARCH_FILE=$MYSQLD_DATADIR/test/t2.ibd
-- source include/search_pattern_in_file.inc
--let SEARCH_PATTERN=barfoo
--echo # t3 ... on expecting NOT FOUND
--- let SEARCH_FILE=$t3_IBD
+-- let SEARCH_FILE=$MYSQLD_DATADIR/test/t3.ibd
-- source include/search_pattern_in_file.inc
--let SEARCH_PATTERN=repeat
--echo # t4 ... on expecting NOT FOUND
--- let SEARCH_FILE=$t4_IBD
+-- let SEARCH_FILE=$MYSQLD_DATADIR/test/t4.ibd
-- source include/search_pattern_in_file.inc
--let SEARCH_PATTERN=author
--echo # t5 ... on expecting NOT FOUND
--- let SEARCH_FILE=$t5_IBD
+-- let SEARCH_FILE=$MYSQLD_DATADIR/test/t5.ibd
-- source include/search_pattern_in_file.inc
--let SEARCH_PATTERN=mangled
--echo # t6 ... on expecting NOT FOUND
--- let SEARCH_FILE=$t6_IBD
+-- let SEARCH_FILE=$MYSQLD_DATADIR/test/t6.ibd
-- source include/search_pattern_in_file.inc
--let SEARCH_PATTERN=mysql
--echo # t7 ... on expecting NOT FOUND
--- let SEARCH_FILE=$t7_IBD
+-- let SEARCH_FILE=$MYSQLD_DATADIR/test/t7.ibd
-- source include/search_pattern_in_file.inc
+-- source include/start_mysqld.inc
+
DROP PROCEDURE innodb_insert_proc;
DROP TABLE t1, t2, t3, t4, t5, t6, t7;
diff --git a/mysql-test/suite/federated/federated_bug_35333.test b/mysql-test/suite/federated/federated_bug_35333.test
index 47feefd75a1..d43f4e930f8 100644
--- a/mysql-test/suite/federated/federated_bug_35333.test
+++ b/mysql-test/suite/federated/federated_bug_35333.test
@@ -61,6 +61,7 @@ let $MYSQLD_DATADIR= `SELECT @@datadir`;
--echo #
--echo # Trigger a MyISAM system error during an INFORMATION_SCHEMA.TABLES query
--echo #
+--replace_result 20 2
SELECT TABLE_SCHEMA, TABLE_NAME, TABLE_TYPE, ENGINE, ROW_FORMAT, TABLE_ROWS, DATA_LENGTH, TABLE_COMMENT
FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
diff --git a/mysql-test/suite/funcs_1/r/is_columns.result b/mysql-test/suite/funcs_1/r/is_columns.result
index 338f3064a71..26a8677495b 100644
--- a/mysql-test/suite/funcs_1/r/is_columns.result
+++ b/mysql-test/suite/funcs_1/r/is_columns.result
@@ -103,6 +103,9 @@ GENERATION_EXPRESSION longtext YES NULL
SELECT table_catalog, table_schema, table_name, column_name
FROM information_schema.columns WHERE table_catalog IS NULL OR table_catalog <> 'def';
table_catalog table_schema table_name column_name
+Warnings:
+Warning 1286 Unknown storage engine 'InnoDB'
+Warning 1286 Unknown storage engine 'InnoDB'
###############################################################################
# Testcase 3.2.6.2 + 3.2.6.3: INFORMATION_SCHEMA.COLUMNS accessible information
###############################################################################
diff --git a/mysql-test/suite/funcs_1/r/is_columns_mysql.result b/mysql-test/suite/funcs_1/r/is_columns_mysql.result
index 73e9579f7f2..b12574a0dc4 100644
--- a/mysql-test/suite/funcs_1/r/is_columns_mysql.result
+++ b/mysql-test/suite/funcs_1/r/is_columns_mysql.result
@@ -117,6 +117,20 @@ def mysql index_stats db_name 1 NULL NO varchar 64 192 NULL NULL NULL utf8 utf8_
def mysql index_stats index_name 3 NULL NO varchar 64 192 NULL NULL NULL utf8 utf8_bin varchar(64) PRI select,insert,update,references NEVER NULL
def mysql index_stats prefix_arity 4 NULL NO int NULL NULL 10 0 NULL NULL NULL int(11) unsigned PRI select,insert,update,references NEVER NULL
def mysql index_stats table_name 2 NULL NO varchar 64 192 NULL NULL NULL utf8 utf8_bin varchar(64) PRI select,insert,update,references NEVER NULL
+def mysql innodb_index_stats database_name 1 NULL NO varchar 64 192 NULL NULL NULL utf8 utf8_bin varchar(64) PRI select,insert,update,references NEVER NULL
+def mysql innodb_index_stats index_name 3 NULL NO varchar 64 192 NULL NULL NULL utf8 utf8_bin varchar(64) PRI select,insert,update,references NEVER NULL
+def mysql innodb_index_stats last_update 4 current_timestamp() NO timestamp NULL NULL NULL NULL 0 NULL NULL timestamp on update current_timestamp() select,insert,update,references NEVER NULL
+def mysql innodb_index_stats sample_size 7 NULL YES bigint NULL NULL 20 0 NULL NULL NULL bigint(20) unsigned select,insert,update,references NEVER NULL
+def mysql innodb_index_stats stat_description 8 NULL NO varchar 1024 3072 NULL NULL NULL utf8 utf8_bin varchar(1024) select,insert,update,references NEVER NULL
+def mysql innodb_index_stats stat_name 5 NULL NO varchar 64 192 NULL NULL NULL utf8 utf8_bin varchar(64) PRI select,insert,update,references NEVER NULL
+def mysql innodb_index_stats stat_value 6 NULL NO bigint NULL NULL 20 0 NULL NULL NULL bigint(20) unsigned select,insert,update,references NEVER NULL
+def mysql innodb_index_stats table_name 2 NULL NO varchar 64 192 NULL NULL NULL utf8 utf8_bin varchar(64) PRI select,insert,update,references NEVER NULL
+def mysql innodb_table_stats clustered_index_size 5 NULL NO bigint NULL NULL 20 0 NULL NULL NULL bigint(20) unsigned select,insert,update,references NEVER NULL
+def mysql innodb_table_stats database_name 1 NULL NO varchar 64 192 NULL NULL NULL utf8 utf8_bin varchar(64) PRI select,insert,update,references NEVER NULL
+def mysql innodb_table_stats last_update 3 current_timestamp() NO timestamp NULL NULL NULL NULL 0 NULL NULL timestamp on update current_timestamp() select,insert,update,references NEVER NULL
+def mysql innodb_table_stats n_rows 4 NULL NO bigint NULL NULL 20 0 NULL NULL NULL bigint(20) unsigned select,insert,update,references NEVER NULL
+def mysql innodb_table_stats sum_of_other_index_sizes 6 NULL NO bigint NULL NULL 20 0 NULL NULL NULL bigint(20) unsigned select,insert,update,references NEVER NULL
+def mysql innodb_table_stats table_name 2 NULL NO varchar 64 192 NULL NULL NULL utf8 utf8_bin varchar(64) PRI select,insert,update,references NEVER NULL
def mysql plugin dl 2 NO varchar 128 384 NULL NULL NULL utf8 utf8_general_ci varchar(128) select,insert,update,references NEVER NULL
def mysql plugin name 1 NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) PRI select,insert,update,references NEVER NULL
def mysql proc body 11 NULL NO longblob 4294967295 4294967295 NULL NULL NULL NULL NULL longblob select,insert,update,references NEVER NULL
@@ -438,6 +452,20 @@ NULL mysql help_topic help_category_id smallint NULL NULL NULL NULL smallint(5)
3.0000 mysql index_stats index_name varchar 64 192 utf8 utf8_bin varchar(64)
NULL mysql index_stats prefix_arity int NULL NULL NULL NULL int(11) unsigned
NULL mysql index_stats avg_frequency decimal NULL NULL NULL NULL decimal(12,4)
+3.0000 mysql innodb_index_stats database_name varchar 64 192 utf8 utf8_bin varchar(64)
+3.0000 mysql innodb_index_stats table_name varchar 64 192 utf8 utf8_bin varchar(64)
+3.0000 mysql innodb_index_stats index_name varchar 64 192 utf8 utf8_bin varchar(64)
+NULL mysql innodb_index_stats last_update timestamp NULL NULL NULL NULL timestamp
+3.0000 mysql innodb_index_stats stat_name varchar 64 192 utf8 utf8_bin varchar(64)
+NULL mysql innodb_index_stats stat_value bigint NULL NULL NULL NULL bigint(20) unsigned
+NULL mysql innodb_index_stats sample_size bigint NULL NULL NULL NULL bigint(20) unsigned
+3.0000 mysql innodb_index_stats stat_description varchar 1024 3072 utf8 utf8_bin varchar(1024)
+3.0000 mysql innodb_table_stats database_name varchar 64 192 utf8 utf8_bin varchar(64)
+3.0000 mysql innodb_table_stats table_name varchar 64 192 utf8 utf8_bin varchar(64)
+NULL mysql innodb_table_stats last_update timestamp NULL NULL NULL NULL timestamp
+NULL mysql innodb_table_stats n_rows bigint NULL NULL NULL NULL bigint(20) unsigned
+NULL mysql innodb_table_stats clustered_index_size bigint NULL NULL NULL NULL bigint(20) unsigned
+NULL mysql innodb_table_stats sum_of_other_index_sizes bigint NULL NULL NULL NULL bigint(20) unsigned
3.0000 mysql plugin name varchar 64 192 utf8 utf8_general_ci varchar(64)
3.0000 mysql plugin dl varchar 128 384 utf8 utf8_general_ci varchar(128)
3.0000 mysql proc db char 64 192 utf8 utf8_bin char(64)
diff --git a/mysql-test/suite/funcs_1/r/is_columns_mysql_embedded.result b/mysql-test/suite/funcs_1/r/is_columns_mysql_embedded.result
index cbfe9daef70..9beb736edc6 100644
--- a/mysql-test/suite/funcs_1/r/is_columns_mysql_embedded.result
+++ b/mysql-test/suite/funcs_1/r/is_columns_mysql_embedded.result
@@ -251,6 +251,9 @@ def mysql user Update_priv 6 N NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci e
def mysql user User 2 NO char 80 240 NULL NULL NULL utf8 utf8_bin char(80) PRI NEVER NULL
def mysql user x509_issuer 35 NULL NO blob 65535 65535 NULL NULL NULL NULL NULL blob NEVER NULL
def mysql user x509_subject 36 NULL NO blob 65535 65535 NULL NULL NULL NULL NULL blob NEVER NULL
+Warnings:
+Warning 1286 Unknown storage engine 'InnoDB'
+Warning 1286 Unknown storage engine 'InnoDB'
##########################################################################
# Show the quotient of CHARACTER_OCTET_LENGTH and CHARACTER_MAXIMUM_LENGTH
##########################################################################
@@ -272,6 +275,9 @@ COL_CML DATA_TYPE CHARACTER_SET_NAME COLLATION_NAME
1.0000 text utf8 utf8_bin
1.0000 mediumtext utf8 utf8_general_ci
1.0000 text utf8 utf8_general_ci
+Warnings:
+Warning 1286 Unknown storage engine 'InnoDB'
+Warning 1286 Unknown storage engine 'InnoDB'
SELECT DISTINCT
CHARACTER_OCTET_LENGTH / CHARACTER_MAXIMUM_LENGTH AS COL_CML,
DATA_TYPE,
@@ -289,6 +295,9 @@ COL_CML DATA_TYPE CHARACTER_SET_NAME COLLATION_NAME
3.0000 enum utf8 utf8_general_ci
3.0000 set utf8 utf8_general_ci
3.0000 varchar utf8 utf8_general_ci
+Warnings:
+Warning 1286 Unknown storage engine 'InnoDB'
+Warning 1286 Unknown storage engine 'InnoDB'
SELECT DISTINCT
CHARACTER_OCTET_LENGTH / CHARACTER_MAXIMUM_LENGTH AS COL_CML,
DATA_TYPE,
@@ -307,6 +316,9 @@ NULL smallint NULL NULL
NULL time NULL NULL
NULL timestamp NULL NULL
NULL tinyint NULL NULL
+Warnings:
+Warning 1286 Unknown storage engine 'InnoDB'
+Warning 1286 Unknown storage engine 'InnoDB'
--> CHAR(0) is allowed (see manual), and here both CHARACHTER_* values
--> are 0, which is intended behavior, and the result of 0 / 0 IS NULL
SELECT CHARACTER_OCTET_LENGTH / CHARACTER_MAXIMUM_LENGTH AS COL_CML,
@@ -572,3 +584,6 @@ NULL mysql user max_user_connections int NULL NULL NULL NULL int(11)
3.0000 mysql user is_role enum 1 3 utf8 utf8_general_ci enum('N','Y')
3.0000 mysql user default_role char 80 240 utf8 utf8_bin char(80)
NULL mysql user max_statement_time decimal NULL NULL NULL NULL decimal(12,6)
+Warnings:
+Warning 1286 Unknown storage engine 'InnoDB'
+Warning 1286 Unknown storage engine 'InnoDB'
diff --git a/mysql-test/suite/funcs_1/r/is_statistics.result b/mysql-test/suite/funcs_1/r/is_statistics.result
index 8197f043e48..749b09fa87d 100644
--- a/mysql-test/suite/funcs_1/r/is_statistics.result
+++ b/mysql-test/suite/funcs_1/r/is_statistics.result
@@ -151,6 +151,9 @@ def mysql time_zone_transition_type mysql PRIMARY
def mysql time_zone_transition_type mysql PRIMARY
def mysql user mysql PRIMARY
def mysql user mysql PRIMARY
+Warnings:
+Warning 1286 Unknown storage engine 'InnoDB'
+Warning 1286 Unknown storage engine 'InnoDB'
####################################################################################
# Testcase 3.2.14.2 + 3.2.14.3: INFORMATION_SCHEMA.STATISTICS accessible information
####################################################################################
diff --git a/mysql-test/suite/funcs_1/t/is_columns_mysql.test b/mysql-test/suite/funcs_1/t/is_columns_mysql.test
index a844e18f5be..0566241bd20 100644
--- a/mysql-test/suite/funcs_1/t/is_columns_mysql.test
+++ b/mysql-test/suite/funcs_1/t/is_columns_mysql.test
@@ -13,6 +13,7 @@
#
--source include/not_embedded.inc
+--source include/have_innodb.inc
let $my_where = WHERE table_schema = 'mysql';
--source suite/funcs_1/datadict/columns.inc
diff --git a/mysql-test/suite/innodb/disabled.def b/mysql-test/suite/innodb/disabled.def
index 9f8de75ae14..631f01a8e65 100644
--- a/mysql-test/suite/innodb/disabled.def
+++ b/mysql-test/suite/innodb/disabled.def
@@ -11,4 +11,4 @@
##############################################################################
innodb_defragment_fill_factor : MDEV-10771
-
+innodb_bug14147491 : MDEV-12253 ut_ad(buf_pool->n_pend_reads > 0)
diff --git a/mysql-test/suite/innodb/include/ibd_convert.pl b/mysql-test/suite/innodb/include/ibd_convert.pl
index 32eef96fd23..9c7e829f455 100644
--- a/mysql-test/suite/innodb/include/ibd_convert.pl
+++ b/mysql-test/suite/innodb/include/ibd_convert.pl
@@ -1,4 +1,3 @@
-#!/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.
diff --git a/mysql-test/suite/innodb/r/alter_key_block_size-11757.result b/mysql-test/suite/innodb/r/alter_key_block_size-11757.result
new file mode 100644
index 00000000000..6e3b35b6f1a
--- /dev/null
+++ b/mysql-test/suite/innodb/r/alter_key_block_size-11757.result
@@ -0,0 +1,50 @@
+create table t1 (
+id1 bigint(20) not null,
+id2 bigint(20) not null,
+primary key (id1),
+unique key id2 (id2)
+) engine=innodb row_format=compressed key_block_size=8;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id1` bigint(20) NOT NULL,
+ `id2` bigint(20) NOT NULL,
+ PRIMARY KEY (`id1`),
+ UNIQUE KEY `id2` (`id2`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8
+SET innodb_strict_mode=ON;
+alter table t1 row_format=dynamic;
+ERROR HY000: Table storage engine 'InnoDB' does not support the create option 'KEY_BLOCK_SIZE'
+SET innodb_strict_mode=OFF;
+alter table t1 row_format=dynamic;
+Warnings:
+Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=8 unless ROW_FORMAT=COMPRESSED.
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id1` bigint(20) NOT NULL,
+ `id2` bigint(20) NOT NULL,
+ PRIMARY KEY (`id1`),
+ UNIQUE KEY `id2` (`id2`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC KEY_BLOCK_SIZE=8
+SET innodb_strict_mode=ON;
+alter table t1 key_block_size=0;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id1` bigint(20) NOT NULL,
+ `id2` bigint(20) NOT NULL,
+ PRIMARY KEY (`id1`) KEY_BLOCK_SIZE=8,
+ UNIQUE KEY `id2` (`id2`) KEY_BLOCK_SIZE=8
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC
+alter table t1 drop primary key, add primary key (id1),
+drop key id2, add unique (id2);
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id1` bigint(20) NOT NULL,
+ `id2` bigint(20) NOT NULL,
+ PRIMARY KEY (`id1`),
+ UNIQUE KEY `id2` (`id2`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC
+drop table t1;
diff --git a/mysql-test/suite/innodb/r/innodb-32k-crash.result b/mysql-test/suite/innodb/r/innodb-32k-crash.result
index 4fcb6ab19ef..d0bc25968c6 100644
--- a/mysql-test/suite/innodb/r/innodb-32k-crash.result
+++ b/mysql-test/suite/innodb/r/innodb-32k-crash.result
@@ -115,6 +115,7 @@ UPDATE t2 SET ka=@l,la=@l,ma=@l,na=@l,oa=@l,pa=@l;
UPDATE t2 SET qa=@l,ra=@l,sa=@l,ta=@l,ua=@l;
UPDATE t2 SET va=@l,wa=@l,xa=@l,ya=@l,za=@l;
COMMIT;
+BEGIN;
INSERT INTO t1 SELECT * from t2;
BEGIN;
UPDATE t1 SET a=@e,b=@e,c=@e,d=@e,e=@e;
diff --git a/mysql-test/suite/innodb/r/innodb-blob.result b/mysql-test/suite/innodb/r/innodb-blob.result
index fe4b1908fcb..afdaca9acd2 100644
--- a/mysql-test/suite/innodb/r/innodb-blob.result
+++ b/mysql-test/suite/innodb/r/innodb-blob.result
@@ -41,11 +41,9 @@ a
1
2
3
-SET DEBUG='+d,crash_commit_before';
-Warnings:
-Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead
+BEGIN;
INSERT INTO t2 VALUES (42);
-ERROR HY000: Lost connection to MySQL server during query
+# Kill and restart
disconnect con1;
disconnect con2;
connection default;
@@ -100,11 +98,7 @@ SELECT info FROM information_schema.processlist
WHERE state = 'debug sync point: before_row_upd_extern';
info
UPDATE t3 SET c=REPEAT('i',3000) WHERE a=2
-SET DEBUG='+d,crash_commit_before';
-Warnings:
-Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead
-COMMIT;
-ERROR HY000: Lost connection to MySQL server during query
+# Kill and restart
disconnect con2;
connection default;
ERROR HY000: Lost connection to MySQL server during query
@@ -136,11 +130,7 @@ SELECT info FROM information_schema.processlist
WHERE state = 'debug sync point: after_row_upd_extern';
info
UPDATE t3 SET c=REPEAT('j',3000) WHERE a=2
-SET DEBUG='+d,crash_commit_before';
-Warnings:
-Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead
-COMMIT;
-ERROR HY000: Lost connection to MySQL server during query
+# Kill and restart
disconnect con2;
connection default;
ERROR HY000: Lost connection to MySQL server during query
diff --git a/mysql-test/suite/innodb/r/innodb-get-fk.result b/mysql-test/suite/innodb/r/innodb-get-fk.result
index 928fa322f81..ee17f262854 100644
--- a/mysql-test/suite/innodb/r/innodb-get-fk.result
+++ b/mysql-test/suite/innodb/r/innodb-get-fk.result
@@ -26,7 +26,8 @@ KEY `fk_crewRoleAssigned_roleCode` (`role_code`),
CONSTRAINT `fk_crewRoleAssigned_crewId` FOREIGN KEY (`crew_id`) REFERENCES `repro`.`crew` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `fk_crewRoleAssigned_pilotId` FOREIGN KEY (`crew_id`) REFERENCES `repro`.`pilot` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB COMMENT="This is a comment about tables";
-# Restart mysqld --innodb_read_only=1
+ALTER TABLE `repro`.`crew_role_assigned` COMMENT = 'innodb_read_only';
+ERROR HY000: Table 'crew_role_assigned' is read only
SHOW CREATE TABLE `repro`.`crew_role_assigned`;
Table Create Table
crew_role_assigned CREATE TABLE `crew_role_assigned` (
@@ -52,7 +53,6 @@ crew_role_assigned CREATE TABLE `crew_role_assigned` (
CONSTRAINT `fk_crewRoleAssigned_crewId` FOREIGN KEY (`crew_id`) REFERENCES `crew` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `fk_crewRoleAssigned_pilotId` FOREIGN KEY (`crew_id`) REFERENCES `pilot` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='This is a new comment about tables'
-# Restart mysqld --innodb_read_only=1
SHOW CREATE TABLE `repro`.`crew_role_assigned`;
Table Create Table
crew_role_assigned CREATE TABLE `crew_role_assigned` (
diff --git a/mysql-test/suite/innodb/r/innodb-wl5522-debug.result b/mysql-test/suite/innodb/r/innodb-wl5522-debug.result
index 54f8797f0cb..27909b57df8 100644
--- a/mysql-test/suite/innodb/r/innodb-wl5522-debug.result
+++ b/mysql-test/suite/innodb/r/innodb-wl5522-debug.result
@@ -10,12 +10,6 @@ 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
-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;
INSERT INTO test_wl5522.t1 VALUES(1),(2),(3);
@@ -31,9 +25,6 @@ ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
ERROR HY000: Lost connection to MySQL server during query
DROP TABLE test_wl5522.t1;
SET GLOBAL innodb_file_per_table = 1;
-SELECT @@innodb_file_per_table;
-@@innodb_file_per_table
-1
CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb;
INSERT INTO test_wl5522.t1 VALUES (1), (2), (3), (4);
FLUSH TABLES test_wl5522.t1 FOR EXPORT;
diff --git a/mysql-test/suite/innodb/r/innodb_bug14676111.result b/mysql-test/suite/innodb/r/innodb_bug14676111.result
index eda04736cc0..d1e21c92d95 100644
--- a/mysql-test/suite/innodb/r/innodb_bug14676111.result
+++ b/mysql-test/suite/innodb/r/innodb_bug14676111.result
@@ -40,7 +40,7 @@ test.t1 analyze status OK
select CLUST_INDEX_SIZE from information_schema.INNODB_SYS_TABLESTATS where NAME = 'test/t1';
CLUST_INDEX_SIZE
5
-set global innodb_limit_optimistic_insert_debug = 0;
+set global innodb_limit_optimistic_insert_debug = 10000;
connection con2;
rollback;
disconnect con2;
diff --git a/mysql-test/suite/innodb/r/innodb_bug53756.result b/mysql-test/suite/innodb/r/innodb_bug53756.result
index 6b44479677f..9809682a4b2 100644
--- a/mysql-test/suite/innodb/r/innodb_bug53756.result
+++ b/mysql-test/suite/innodb/r/innodb_bug53756.result
@@ -1,4 +1,3 @@
-DROP TABLE IF EXISTS bug_53756 ;
CREATE TABLE bug_53756 (pk INT, c1 INT) ENGINE=InnoDB;
ALTER TABLE bug_53756 ADD PRIMARY KEY (pk);
INSERT INTO bug_53756 VALUES(1, 11), (2, 22), (3, 33), (4, 44);
@@ -76,15 +75,9 @@ pk c1
2 22
3 77
4 44
-connection default;
-#
-# Crash server.
START TRANSACTION;
INSERT INTO bug_53756 VALUES (666,666);
-SET SESSION debug_dbug="+d,crash_commit_before";
-COMMIT;
-ERROR HY000: Lost connection to MySQL server during query
-
+# Kill and restart
disconnect con1;
disconnect con2;
disconnect con3;
@@ -92,9 +85,6 @@ disconnect con4;
disconnect con5;
disconnect con6;
#
-# Restart server.
-
-#
# Select recovered data.
# Delete of row 1 was committed.
# Update of row 3 was committed.
@@ -106,6 +96,4 @@ pk c1
2 22
3 77
4 44
-
-# Clean up.
DROP TABLE bug_53756;
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 a031cfaa278..4cde68b5505 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
@@ -383,11 +383,11 @@ Warnings:
Warning 1012 InnoDB: SELECTing from INFORMATION_SCHEMA.innodb_sys_datafiles but the InnoDB storage engine is not installed
select * from information_schema.innodb_changed_pages;
select * from information_schema.innodb_tablespaces_encryption;
-SPACE NAME ENCRYPTION_SCHEME KEYSERVER_REQUESTS MIN_KEY_VERSION CURRENT_KEY_VERSION KEY_ROTATION_PAGE_NUMBER KEY_ROTATION_MAX_PAGE_NUMBER CURRENT_KEY_ID
+SPACE NAME ENCRYPTION_SCHEME KEYSERVER_REQUESTS MIN_KEY_VERSION CURRENT_KEY_VERSION KEY_ROTATION_PAGE_NUMBER KEY_ROTATION_MAX_PAGE_NUMBER CURRENT_KEY_ID ROTATING_OR_FLUSHING
Warnings:
Warning 1012 InnoDB: SELECTing from INFORMATION_SCHEMA.innodb_tablespaces_encryption but the InnoDB storage engine is not installed
select * from information_schema.innodb_tablespaces_scrubbing;
-SPACE NAME COMPRESSED LAST_SCRUB_COMPLETED CURRENT_SCRUB_STARTED CURRENT_SCRUB_ACTIVE_THREADS CURRENT_SCRUB_PAGE_NUMBER CURRENT_SCRUB_MAX_PAGE_NUMBER
+SPACE NAME COMPRESSED LAST_SCRUB_COMPLETED CURRENT_SCRUB_STARTED CURRENT_SCRUB_ACTIVE_THREADS CURRENT_SCRUB_PAGE_NUMBER CURRENT_SCRUB_MAX_PAGE_NUMBER ROTATING_OR_FLUSHING
Warnings:
Warning 1012 InnoDB: SELECTing from INFORMATION_SCHEMA.innodb_tablespaces_scrubbing but the InnoDB storage engine is not installed
select * from information_schema.innodb_mutexes;
diff --git a/mysql-test/suite/innodb/t/alter_key_block_size-11757.test b/mysql-test/suite/innodb/t/alter_key_block_size-11757.test
new file mode 100644
index 00000000000..c11da6e8cc5
--- /dev/null
+++ b/mysql-test/suite/innodb/t/alter_key_block_size-11757.test
@@ -0,0 +1,25 @@
+#
+# MDEV-11757 KEY_BLOCK_SIZE strangeness when UNCOMPRESSing COMPRESSed InnoDB tables
+#
+source include/have_innodb.inc;
+
+create table t1 (
+ id1 bigint(20) not null,
+ id2 bigint(20) not null,
+ primary key (id1),
+ unique key id2 (id2)
+) engine=innodb row_format=compressed key_block_size=8;
+show create table t1;
+SET innodb_strict_mode=ON;
+--error ER_ILLEGAL_HA_CREATE_OPTION
+alter table t1 row_format=dynamic;
+SET innodb_strict_mode=OFF;
+alter table t1 row_format=dynamic;
+show create table t1;
+SET innodb_strict_mode=ON;
+alter table t1 key_block_size=0;
+show create table t1;
+alter table t1 drop primary key, add primary key (id1),
+ drop key id2, add unique (id2);
+show create table t1;
+drop table t1;
diff --git a/mysql-test/suite/innodb/t/innodb-32k-crash.test b/mysql-test/suite/innodb/t/innodb-32k-crash.test
index 42d2b5adc9f..c77e44ce9d6 100644
--- a/mysql-test/suite/innodb/t/innodb-32k-crash.test
+++ b/mysql-test/suite/innodb/t/innodb-32k-crash.test
@@ -139,6 +139,7 @@ UPDATE t2 SET qa=@l,ra=@l,sa=@l,ta=@l,ua=@l;
UPDATE t2 SET va=@l,wa=@l,xa=@l,ya=@l,za=@l;
COMMIT;
+BEGIN;
INSERT INTO t1 SELECT * from t2;
BEGIN;
diff --git a/mysql-test/suite/innodb/t/innodb-64k-crash.test b/mysql-test/suite/innodb/t/innodb-64k-crash.test
index 39fbf974efe..78f14d539a5 100644
--- a/mysql-test/suite/innodb/t/innodb-64k-crash.test
+++ b/mysql-test/suite/innodb/t/innodb-64k-crash.test
@@ -299,6 +299,7 @@ UPDATE t1 SET a=@c,b=@c,c=@c,d=@c,e=@c,f=@c,g=@c,h=@c,i=@c,j=@c,
ac=@c,bc=@c,cc=@c,dc=@c,ec=@c,fc=@c,gc=@c,hc=@c,ic=@c,jc=@c,
kc=@c,lc=@c,mc=@c,nc=@c,oc=@c,pc=@c,qc=@c,rc=@c,sc=@c,tc=@c,uc=@c,
vc=@c,wc=@c,xc=@c,yc=@c,zc=@c;
+
--source include/kill_and_restart_mysqld.inc
UPDATE t1 SET a=@e,b=@e,c=@e,d=@e,e=@e,f=@e,g=@e,h=@e,i=@e,j=@e,
diff --git a/mysql-test/suite/innodb/t/innodb-blob.test b/mysql-test/suite/innodb/t/innodb-blob.test
index c1f9ee5992f..ea50af4a7fc 100644
--- a/mysql-test/suite/innodb/t/innodb-blob.test
+++ b/mysql-test/suite/innodb/t/innodb-blob.test
@@ -9,12 +9,8 @@
# DEBUG_SYNC must be compiled in.
--source include/have_debug_sync.inc
-# Valgrind would complain about memory leaks when we crash on purpose.
---source include/not_valgrind.inc
-# Embedded server does not support crashing
+# Embedded server does not support restarting
--source include/not_embedded.inc
-# Avoid CrashReporter popup on Mac
---source include/not_crashrep.inc
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!");
@@ -71,12 +67,11 @@ SELECT a, RIGHT(b,20) FROM t1;
SELECT a FROM t1;
# Request a crash, and restart the server.
-SET DEBUG='+d,crash_commit_before';
-# Write file to make mysql-test-run.pl restart the server
---exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
---error 2013
+BEGIN;
INSERT INTO t2 VALUES (42);
+--source include/kill_and_restart_mysqld.inc
+
disconnect con1;
disconnect con2;
connection default;
@@ -143,12 +138,7 @@ SET DEBUG_SYNC='now WAIT_FOR have_latch';
SELECT info FROM information_schema.processlist
WHERE state = 'debug sync point: before_row_upd_extern';
-# Request a crash, and restart the server.
-SET DEBUG='+d,crash_commit_before';
-# Write file to make mysql-test-run.pl restart the server
---exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
---error 2013
-COMMIT;
+--source include/kill_and_restart_mysqld.inc
disconnect con2;
connection default;
@@ -187,12 +177,7 @@ SET DEBUG_SYNC='now WAIT_FOR have_latch';
SELECT info FROM information_schema.processlist
WHERE state = 'debug sync point: after_row_upd_extern';
-# Request a crash, and restart the server.
-SET DEBUG='+d,crash_commit_before';
-# Write file to make mysql-test-run.pl restart the server
---exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
---error 2013
-COMMIT;
+--source include/kill_and_restart_mysqld.inc
disconnect con2;
connection default;
@@ -203,7 +188,6 @@ reap;
--enable_reconnect
--source include/wait_until_connected_again.inc
--disable_reconnect
-
CHECK TABLE t1,t2,t3;
SELECT a, RIGHT(b,20), RIGHT(c,20) FROM t3;
SELECT a FROM t3;
diff --git a/mysql-test/suite/innodb/t/innodb-get-fk.test b/mysql-test/suite/innodb/t/innodb-get-fk.test
index 3e330ffeda3..339a7968623 100644
--- a/mysql-test/suite/innodb/t/innodb-get-fk.test
+++ b/mysql-test/suite/innodb/t/innodb-get-fk.test
@@ -33,10 +33,11 @@ CONSTRAINT `fk_crewRoleAssigned_crewId` FOREIGN KEY (`crew_id`) REFERENCES `repr
CONSTRAINT `fk_crewRoleAssigned_pilotId` FOREIGN KEY (`crew_id`) REFERENCES `repro`.`pilot` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB COMMENT="This is a comment about tables";
---echo # Restart mysqld --innodb_read_only=1
--- let $restart_parameters=--innodb-read-only=1
+-- let $restart_parameters=--innodb-read-only
-- source include/restart_mysqld.inc
+--error ER_OPEN_AS_READONLY
+ALTER TABLE `repro`.`crew_role_assigned` COMMENT = 'innodb_read_only';
SHOW CREATE TABLE `repro`.`crew_role_assigned`;
-- let $restart_parameters=
@@ -45,8 +46,7 @@ SHOW CREATE TABLE `repro`.`crew_role_assigned`;
ALTER TABLE `repro`.`crew_role_assigned` COMMENT = "This is a new comment about tables";
SHOW CREATE TABLE `repro`.`crew_role_assigned`;
---echo # Restart mysqld --innodb_read_only=1
--- let $restart_parameters=--innodb-read-only=1
+-- let $restart_parameters=--innodb-read-only
-- source include/restart_mysqld.inc
#
diff --git a/mysql-test/suite/innodb/t/innodb-wl5522-debug.test b/mysql-test/suite/innodb/t/innodb-wl5522-debug.test
index b57ac62e1d8..68c5d3000cb 100644
--- a/mysql-test/suite/innodb/t/innodb-wl5522-debug.test
+++ b/mysql-test/suite/innodb/t/innodb-wl5522-debug.test
@@ -33,9 +33,7 @@ let $pathfix=/: '.*test_wl5522.*t1.ibd'/: 'test_wl5522\\t1.ibd'/;
let $strerrfix=/ (\(.+\))//;
SET GLOBAL innodb_file_per_table = 1;
-SELECT @@innodb_file_per_table;
-DROP DATABASE IF EXISTS test_wl5522;
CREATE DATABASE test_wl5522;
CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = InnoDB;
@@ -68,7 +66,6 @@ ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
DROP TABLE test_wl5522.t1;
SET GLOBAL innodb_file_per_table = 1;
-SELECT @@innodb_file_per_table;
# Create the table that we will use for crash recovery (during IMPORT)
CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb;
diff --git a/mysql-test/suite/innodb/t/innodb_bug14147491.test b/mysql-test/suite/innodb/t/innodb_bug14147491.test
index c73571af6dd..c848d24294d 100644
--- a/mysql-test/suite/innodb/t/innodb_bug14147491.test
+++ b/mysql-test/suite/innodb/t/innodb_bug14147491.test
@@ -22,7 +22,6 @@ CALL mtr.add_suppression("\\[ERROR\\] \\[FATAL\\] InnoDB: Unable to read page \\
CALL mtr.add_suppression("\\[ERROR\\] InnoDB: Database page corruption on disk or a failed");
--enable_query_log
-
CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY, b TEXT) ROW_FORMAT=COMPACT ENGINE=InnoDB;
INSERT INTO t1 (b) VALUES ('corrupt me');
--disable_query_log
@@ -94,8 +93,5 @@ SLEEP 1;
--source include/start_mysqld.inc
-# Note SET DEBUG = '-d,innodb_page_corruption_retries' is not required
-# because the session information is lost after server restart
-
--echo # Cleanup
DROP TABLE t1;
diff --git a/mysql-test/suite/innodb/t/innodb_bug14676111.test b/mysql-test/suite/innodb/t/innodb_bug14676111.test
index d8b78394cc2..3abc574a8d2 100644
--- a/mysql-test/suite/innodb/t/innodb_bug14676111.test
+++ b/mysql-test/suite/innodb/t/innodb_bug14676111.test
@@ -82,7 +82,7 @@ select CLUST_INDEX_SIZE from information_schema.INNODB_SYS_TABLESTATS where NAME
#
#disable the artificial limitation of records in a page
-set global innodb_limit_optimistic_insert_debug = 0;
+set global innodb_limit_optimistic_insert_debug = 10000;
--connection con2
rollback;
--disconnect con2
@@ -117,7 +117,6 @@ insert into t1 values (2);
#current tree form
# (1)
# (1, 2, 3) <- lift up this level next, because the father is root
-
rollback;
#current tree form
# (1, 3)
diff --git a/mysql-test/suite/innodb/t/innodb_bug53756.test b/mysql-test/suite/innodb/t/innodb_bug53756.test
index 4aee0f87746..d6bccf70147 100644
--- a/mysql-test/suite/innodb/t/innodb_bug53756.test
+++ b/mysql-test/suite/innodb/t/innodb_bug53756.test
@@ -6,24 +6,8 @@
# metadata in the function dict_load_table_on_id() during crash recovery.
#
-# innobackup needs to connect to the server. Not supported in embedded.
+# The embedded server test does not support restarting.
--source include/not_embedded.inc
-#
-# This test case needs to crash the server. Needs a debug server.
---source include/have_debug.inc
-#
-# Don't test this under valgrind, memory leaks will occur.
---source include/not_valgrind.inc
-
-# Avoid CrashReporter popup on Mac
---source include/not_crashrep.inc
-
-#
-# Precautionary clean up.
-#
---disable_warnings
-DROP TABLE IF EXISTS bug_53756 ;
---enable_warnings
#
# Create test data.
@@ -34,9 +18,6 @@ INSERT INTO bug_53756 VALUES(1, 11), (2, 22), (3, 33), (4, 44);
--echo
--echo # Select a less restrictive isolation level.
-# Don't use user variables. They won't survive server crash.
---let $global_isolation= `SELECT @@global.tx_isolation`
---let $session_isolation= `SELECT @@session.tx_isolation`
SET GLOBAL TRANSACTION ISOLATION LEVEL READ COMMITTED;
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
COMMIT;
@@ -100,45 +81,16 @@ ROLLBACK;
--connection default
SELECT * FROM bug_53756;
---connection default
---echo #
---echo # Crash server.
-#
-# Write file to make mysql-test-run.pl expect the "crash", but don't start
-# it until it's told to
---exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
-#
START TRANSACTION;
INSERT INTO bug_53756 VALUES (666,666);
-#
-# Request a crash on next execution of commit.
-SET SESSION debug_dbug="+d,crash_commit_before";
-#
-# Write file to make mysql-test-run.pl start up the server again
---exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
-#
-# Execute the statement that causes the crash.
---error 2013
-COMMIT;
---echo
+
+--source include/kill_and_restart_mysqld.inc
--disconnect con1
--disconnect con2
--disconnect con3
--disconnect con4
--disconnect con5
--disconnect con6
---echo #
---echo # Restart server.
-#
-# Turn on reconnect
---enable_reconnect
-#
-# Call script that will poll the server waiting for it to be back online again
---source include/wait_until_connected_again.inc
-#
-# Turn off reconnect again
---disable_reconnect
---echo
--echo #
--echo # Select recovered data.
@@ -149,11 +101,4 @@ COMMIT;
--echo # Delete of row 2 and insert of row 5 should be rolled back
SELECT * FROM bug_53756;
---echo
---echo # Clean up.
DROP TABLE bug_53756;
-
---disable_query_log
-eval SET GLOBAL tx_isolation= '$global_isolation';
-eval SET SESSION tx_isolation= '$session_isolation';
---enable_query_log
diff --git a/mysql-test/suite/innodb_fts/r/innodb_fts_stopword_charset.result b/mysql-test/suite/innodb_fts/r/innodb_fts_stopword_charset.result
index adec37c930f..c49c7f8ae6c 100644
--- a/mysql-test/suite/innodb_fts/r/innodb_fts_stopword_charset.result
+++ b/mysql-test/suite/innodb_fts/r/innodb_fts_stopword_charset.result
@@ -316,6 +316,3 @@ id title
13 lòve
14 LÃ’VE
DROP TABLE articles;
-SET SESSION innodb_ft_enable_stopword=1;
-SET GLOBAL innodb_ft_server_stopword_table=default;
-SET SESSION innodb_ft_user_stopword_table=default;
diff --git a/mysql-test/suite/innodb_fts/t/innodb_fts_stopword_charset.test b/mysql-test/suite/innodb_fts/t/innodb_fts_stopword_charset.test
index 4974783b9be..16ee91c30f4 100644
--- a/mysql-test/suite/innodb_fts/t/innodb_fts_stopword_charset.test
+++ b/mysql-test/suite/innodb_fts/t/innodb_fts_stopword_charset.test
@@ -2,16 +2,8 @@
-- source include/have_innodb.inc
-# Valgrind would complain about memory leaks when we crash on purpose.
---source include/not_valgrind.inc
-# Embedded server does not support crashing
+# Embedded server tests do not support restarting
--source include/not_embedded.inc
-# Avoid CrashReporter popup on Mac
---source include/not_crashrep.inc
-
-let $innodb_ft_server_stopword_table_orig=`SELECT @@innodb_ft_server_stopword_table`;
-let $innodb_ft_enable_stopword_orig=`SELECT @@innodb_ft_enable_stopword`;
-let $innodb_ft_user_stopword_table_orig=`SELECT @@innodb_ft_user_stopword_table`;
SELECT @@innodb_ft_server_stopword_table;
SELECT @@innodb_ft_enable_stopword;
@@ -414,8 +406,3 @@ SELECT * FROM articles WHERE MATCH (title)
AGAINST ('love' IN NATURAL LANGUAGE MODE);
DROP TABLE articles;
-
-# Restore Values
-eval SET SESSION innodb_ft_enable_stopword=$innodb_ft_enable_stopword_orig;
-eval SET GLOBAL innodb_ft_server_stopword_table=default;
-eval SET SESSION innodb_ft_user_stopword_table=default;
diff --git a/mysql-test/suite/parts/r/partition_bigint_innodb.result b/mysql-test/suite/parts/r/partition_bigint_innodb.result
new file mode 100644
index 00000000000..c11e72d85d3
--- /dev/null
+++ b/mysql-test/suite/parts/r/partition_bigint_innodb.result
@@ -0,0 +1,121 @@
+create table t1 (a bigint unsigned not null, primary key(a)) engine='InnoDB'
+partition by key (a) (
+partition pa1 max_rows=20 min_rows=2,
+partition pa2 max_rows=30 min_rows=3,
+partition pa3 max_rows=30 min_rows=4,
+partition pa4 max_rows=40 min_rows=2);
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` bigint(20) unsigned NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+ PARTITION BY KEY (a)
+(PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = InnoDB,
+ PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = InnoDB,
+ PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = InnoDB,
+ PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = InnoDB)
+insert into t1 values (18446744073709551615), (0xFFFFFFFFFFFFFFFE), (18446744073709551613), (18446744073709551612), (1), (2), (65535);
+select * from t1;
+a
+1
+18446744073709551612
+18446744073709551613
+18446744073709551614
+18446744073709551615
+2
+65535
+select * from t1 where a=-2;
+a
+delete from t1 where a=-2;
+select * from t1;
+a
+1
+18446744073709551612
+18446744073709551613
+18446744073709551614
+18446744073709551615
+2
+65535
+select * from t1 where a=18446744073709551615;
+a
+18446744073709551615
+delete from t1 where a=18446744073709551615;
+select * from t1;
+a
+1
+18446744073709551612
+18446744073709551613
+18446744073709551614
+2
+65535
+drop table t1;
+create table t2 (a bigint unsigned not null, primary key(a)) engine='InnoDB'
+partition by key (a) partitions 8;
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` bigint(20) unsigned NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+ PARTITION BY KEY (a)
+PARTITIONS 8
+insert into t2 values (18446744073709551615), (0xFFFFFFFFFFFFFFFE), (18446744073709551613), (18446744073709551612);
+select * from t2;
+a
+18446744073709551612
+18446744073709551613
+18446744073709551614
+18446744073709551615
+select * from t2 where a=18446744073709551615;
+a
+18446744073709551615
+delete from t2 where a=18446744073709551615;
+select * from t2;
+a
+18446744073709551612
+18446744073709551613
+18446744073709551614
+delete from t2;
+1024 inserts;
+select count(*) from t2;
+count(*)
+1024
+drop table t2;
+create table t3 (a bigint not null, primary key(a)) engine='InnoDB'
+partition by key (a) partitions 7;
+show create table t3;
+Table Create Table
+t3 CREATE TABLE `t3` (
+ `a` bigint(20) NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+ PARTITION BY KEY (a)
+PARTITIONS 7
+insert into t3 values (9223372036854775807), (9223372036854775806), (9223372036854775805), (9223372036854775804), (-9223372036854775808), (-9223372036854775807), (1), (-1), (0);
+select * from t3;
+a
+-1
+-9223372036854775807
+-9223372036854775808
+0
+1
+9223372036854775804
+9223372036854775805
+9223372036854775806
+9223372036854775807
+select * from t3 where a=9223372036854775806;
+a
+9223372036854775806
+delete from t3 where a=9223372036854775806;
+select * from t3;
+a
+-1
+-9223372036854775807
+-9223372036854775808
+0
+1
+9223372036854775804
+9223372036854775805
+9223372036854775807
+drop table t3;
diff --git a/mysql-test/suite/parts/r/partition_bigint_myisam.result b/mysql-test/suite/parts/r/partition_bigint_myisam.result
new file mode 100644
index 00000000000..6407fdf23d6
--- /dev/null
+++ b/mysql-test/suite/parts/r/partition_bigint_myisam.result
@@ -0,0 +1,121 @@
+create table t1 (a bigint unsigned not null, primary key(a)) engine='MYISAM'
+partition by key (a) (
+partition pa1 max_rows=20 min_rows=2,
+partition pa2 max_rows=30 min_rows=3,
+partition pa3 max_rows=30 min_rows=4,
+partition pa4 max_rows=40 min_rows=2);
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` bigint(20) unsigned NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+ PARTITION BY KEY (a)
+(PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = MyISAM,
+ PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = MyISAM,
+ PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = MyISAM,
+ PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = MyISAM)
+insert into t1 values (18446744073709551615), (0xFFFFFFFFFFFFFFFE), (18446744073709551613), (18446744073709551612), (1), (2), (65535);
+select * from t1;
+a
+1
+18446744073709551612
+18446744073709551613
+18446744073709551614
+18446744073709551615
+2
+65535
+select * from t1 where a=-2;
+a
+delete from t1 where a=-2;
+select * from t1;
+a
+1
+18446744073709551612
+18446744073709551613
+18446744073709551614
+18446744073709551615
+2
+65535
+select * from t1 where a=18446744073709551615;
+a
+18446744073709551615
+delete from t1 where a=18446744073709551615;
+select * from t1;
+a
+1
+18446744073709551612
+18446744073709551613
+18446744073709551614
+2
+65535
+drop table t1;
+create table t2 (a bigint unsigned not null, primary key(a)) engine='MYISAM'
+partition by key (a) partitions 8;
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` bigint(20) unsigned NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+ PARTITION BY KEY (a)
+PARTITIONS 8
+insert into t2 values (18446744073709551615), (0xFFFFFFFFFFFFFFFE), (18446744073709551613), (18446744073709551612);
+select * from t2;
+a
+18446744073709551612
+18446744073709551613
+18446744073709551614
+18446744073709551615
+select * from t2 where a=18446744073709551615;
+a
+18446744073709551615
+delete from t2 where a=18446744073709551615;
+select * from t2;
+a
+18446744073709551612
+18446744073709551613
+18446744073709551614
+delete from t2;
+65535 inserts;
+select count(*) from t2;
+count(*)
+65535
+drop table t2;
+create table t3 (a bigint not null, primary key(a)) engine='MYISAM'
+partition by key (a) partitions 7;
+show create table t3;
+Table Create Table
+t3 CREATE TABLE `t3` (
+ `a` bigint(20) NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+ PARTITION BY KEY (a)
+PARTITIONS 7
+insert into t3 values (9223372036854775807), (9223372036854775806), (9223372036854775805), (9223372036854775804), (-9223372036854775808), (-9223372036854775807), (1), (-1), (0);
+select * from t3;
+a
+-1
+-9223372036854775807
+-9223372036854775808
+0
+1
+9223372036854775804
+9223372036854775805
+9223372036854775806
+9223372036854775807
+select * from t3 where a=9223372036854775806;
+a
+9223372036854775806
+delete from t3 where a=9223372036854775806;
+select * from t3;
+a
+-1
+-9223372036854775807
+-9223372036854775808
+0
+1
+9223372036854775804
+9223372036854775805
+9223372036854775807
+drop table t3;
diff --git a/mysql-test/suite/parts/r/partition_double_innodb.result b/mysql-test/suite/parts/r/partition_double_innodb.result
new file mode 100644
index 00000000000..f2618519930
--- /dev/null
+++ b/mysql-test/suite/parts/r/partition_double_innodb.result
@@ -0,0 +1,82 @@
+create table t1 (a double not null, primary key(a)) engine='InnoDB'
+partition by key (a) (
+partition pa1 max_rows=20 min_rows=2,
+partition pa2 max_rows=30 min_rows=3,
+partition pa3 max_rows=30 min_rows=4,
+partition pa4 max_rows=40 min_rows=2);
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` double NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+ PARTITION BY KEY (a)
+(PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = InnoDB,
+ PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = InnoDB,
+ PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = InnoDB,
+ PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = InnoDB)
+insert into t1 values (-2.2250738585072014E+208), (-2.2250738585072014E-208), (-1.5), (-1), (0), (1.5), (1234.567), (2.2250738585072014E+208);
+select * from t1;
+a
+-2.2250738585072016e208
+-1.5
+-1
+-2.2250738585072014e-208
+0
+1.5
+1234.567
+2.2250738585072016e208
+select * from t1 where a=1.5;
+a
+1.5
+delete from t1 where a=1.5;
+select * from t1;
+a
+-2.2250738585072016e208
+-1.5
+-1
+-2.2250738585072014e-208
+0
+1234.567
+2.2250738585072016e208
+drop table t1;
+create table t2 (a double not null, primary key(a)) engine='InnoDB'
+partition by key (a) partitions 10;
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` double NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+ PARTITION BY KEY (a)
+PARTITIONS 10
+insert into t2 values (-2.2250738585072014E+208), (-2.2250738585072014E-208), (-1.5), (-1), (0), (1.5), (1234.567), (2.2250738585072014E+208);
+select * from t2;
+a
+-2.2250738585072016e208
+-1.5
+-1
+-2.2250738585072014e-208
+0
+1.5
+1234.567
+2.2250738585072016e208
+select * from t2 where a=1234.567;
+a
+1234.567
+delete from t2 where a=1234.567;
+select * from t2;
+a
+-2.2250738585072016e208
+-1.5
+-1
+-2.2250738585072014e-208
+0
+1.5
+2.2250738585072016e208
+delete from t2;
+1024*3 inserts;
+select count(*) from t2;
+count(*)
+3072
+drop table t2;
diff --git a/mysql-test/suite/parts/r/partition_double_myisam.result b/mysql-test/suite/parts/r/partition_double_myisam.result
new file mode 100644
index 00000000000..b01db2f7d31
--- /dev/null
+++ b/mysql-test/suite/parts/r/partition_double_myisam.result
@@ -0,0 +1,82 @@
+create table t1 (a double not null, primary key(a)) engine='MYISAM'
+partition by key (a) (
+partition pa1 max_rows=20 min_rows=2,
+partition pa2 max_rows=30 min_rows=3,
+partition pa3 max_rows=30 min_rows=4,
+partition pa4 max_rows=40 min_rows=2);
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` double NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+ PARTITION BY KEY (a)
+(PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = MyISAM,
+ PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = MyISAM,
+ PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = MyISAM,
+ PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = MyISAM)
+insert into t1 values (-2.2250738585072014E+208), (-2.2250738585072014E-208), (-1.5), (-1), (0), (1.5), (1234.567), (2.2250738585072014E+208);
+select * from t1;
+a
+-2.2250738585072016e208
+-1.5
+-1
+-2.2250738585072014e-208
+0
+1.5
+1234.567
+2.2250738585072016e208
+select * from t1 where a=1.5;
+a
+1.5
+delete from t1 where a=1.5;
+select * from t1;
+a
+-2.2250738585072016e208
+-1.5
+-1
+-2.2250738585072014e-208
+0
+1234.567
+2.2250738585072016e208
+drop table t1;
+create table t2 (a double not null, primary key(a)) engine='MYISAM'
+partition by key (a) partitions 10;
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` double NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+ PARTITION BY KEY (a)
+PARTITIONS 10
+insert into t2 values (-2.2250738585072014E+208), (-2.2250738585072014E-208), (-1.5), (-1), (0), (1.5), (1234.567), (2.2250738585072014E+208);
+select * from t2;
+a
+-2.2250738585072016e208
+-1.5
+-1
+-2.2250738585072014e-208
+0
+1.5
+1234.567
+2.2250738585072016e208
+select * from t2 where a=1234.567;
+a
+1234.567
+delete from t2 where a=1234.567;
+select * from t2;
+a
+-2.2250738585072016e208
+-1.5
+-1
+-2.2250738585072014e-208
+0
+1.5
+2.2250738585072016e208
+delete from t2;
+16384*3 inserts;
+select count(*) from t2;
+count(*)
+49152
+drop table t2;
diff --git a/mysql-test/suite/parts/r/partition_exch_innodb.result b/mysql-test/suite/parts/r/partition_exch_innodb.result
index d444e2e3558..d444e2e3558 100755..100644
--- a/mysql-test/suite/parts/r/partition_exch_innodb.result
+++ b/mysql-test/suite/parts/r/partition_exch_innodb.result
diff --git a/mysql-test/suite/parts/r/partition_exch_myisam.result b/mysql-test/suite/parts/r/partition_exch_myisam.result
index d444e2e3558..d444e2e3558 100755..100644
--- a/mysql-test/suite/parts/r/partition_exch_myisam.result
+++ b/mysql-test/suite/parts/r/partition_exch_myisam.result
diff --git a/mysql-test/suite/parts/r/partition_exch_myisam_innodb.result b/mysql-test/suite/parts/r/partition_exch_myisam_innodb.result
index 9ff4afcfe35..9ff4afcfe35 100755..100644
--- a/mysql-test/suite/parts/r/partition_exch_myisam_innodb.result
+++ b/mysql-test/suite/parts/r/partition_exch_myisam_innodb.result
diff --git a/mysql-test/suite/parts/r/partition_exch_qa.result b/mysql-test/suite/parts/r/partition_exch_qa.result
index d444e2e3558..d444e2e3558 100755..100644
--- a/mysql-test/suite/parts/r/partition_exch_qa.result
+++ b/mysql-test/suite/parts/r/partition_exch_qa.result
diff --git a/mysql-test/suite/parts/r/partition_exch_qa_11.result b/mysql-test/suite/parts/r/partition_exch_qa_11.result
index 2fe6c05e29c..2fe6c05e29c 100755..100644
--- a/mysql-test/suite/parts/r/partition_exch_qa_11.result
+++ b/mysql-test/suite/parts/r/partition_exch_qa_11.result
diff --git a/mysql-test/suite/parts/r/partition_exch_qa_14.result b/mysql-test/suite/parts/r/partition_exch_qa_14.result
index f6866727184..f6866727184 100755..100644
--- a/mysql-test/suite/parts/r/partition_exch_qa_14.result
+++ b/mysql-test/suite/parts/r/partition_exch_qa_14.result
diff --git a/mysql-test/suite/parts/r/partition_exch_qa_3.result b/mysql-test/suite/parts/r/partition_exch_qa_3.result
index 9f4043a055a..9f4043a055a 100755..100644
--- a/mysql-test/suite/parts/r/partition_exch_qa_3.result
+++ b/mysql-test/suite/parts/r/partition_exch_qa_3.result
diff --git a/mysql-test/suite/parts/r/partition_exch_qa_4_innodb.result b/mysql-test/suite/parts/r/partition_exch_qa_4_innodb.result
index 35f3499fce7..35f3499fce7 100755..100644
--- a/mysql-test/suite/parts/r/partition_exch_qa_4_innodb.result
+++ b/mysql-test/suite/parts/r/partition_exch_qa_4_innodb.result
diff --git a/mysql-test/suite/parts/r/partition_exch_qa_4_myisam.result b/mysql-test/suite/parts/r/partition_exch_qa_4_myisam.result
index 35f3499fce7..35f3499fce7 100755..100644
--- a/mysql-test/suite/parts/r/partition_exch_qa_4_myisam.result
+++ b/mysql-test/suite/parts/r/partition_exch_qa_4_myisam.result
diff --git a/mysql-test/suite/parts/r/partition_float_innodb.result b/mysql-test/suite/parts/r/partition_float_innodb.result
index d7f6e4bb4ac..863d9bfe000 100644
--- a/mysql-test/suite/parts/r/partition_float_innodb.result
+++ b/mysql-test/suite/parts/r/partition_float_innodb.result
@@ -88,85 +88,3 @@ select count(*) from t2;
count(*)
3072
drop table t2;
-create table t1 (a double not null, primary key(a)) engine='InnoDB'
-partition by key (a) (
-partition pa1 max_rows=20 min_rows=2,
-partition pa2 max_rows=30 min_rows=3,
-partition pa3 max_rows=30 min_rows=4,
-partition pa4 max_rows=40 min_rows=2);
-show create table t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `a` double NOT NULL,
- PRIMARY KEY (`a`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1
- PARTITION BY KEY (a)
-(PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = InnoDB,
- PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = InnoDB,
- PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = InnoDB,
- PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = InnoDB)
-insert into t1 values (-2.2250738585072014E+208), (-2.2250738585072014E-208), (-1.5), (-1), (0), (1.5), (1234.567), (2.2250738585072014E+208);
-select * from t1;
-a
--2.2250738585072016e208
--1.5
--1
--2.2250738585072014e-208
-0
-1.5
-1234.567
-2.2250738585072016e208
-select * from t1 where a=1.5;
-a
-1.5
-delete from t1 where a=1.5;
-select * from t1;
-a
--2.2250738585072016e208
--1.5
--1
--2.2250738585072014e-208
-0
-1234.567
-2.2250738585072016e208
-drop table t1;
-create table t2 (a double not null, primary key(a)) engine='InnoDB'
-partition by key (a) partitions 10;
-show create table t2;
-Table Create Table
-t2 CREATE TABLE `t2` (
- `a` double NOT NULL,
- PRIMARY KEY (`a`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1
- PARTITION BY KEY (a)
-PARTITIONS 10
-insert into t2 values (-2.2250738585072014E+208), (-2.2250738585072014E-208), (-1.5), (-1), (0), (1.5), (1234.567), (2.2250738585072014E+208);
-select * from t2;
-a
--2.2250738585072016e208
--1.5
--1
--2.2250738585072014e-208
-0
-1.5
-1234.567
-2.2250738585072016e208
-select * from t2 where a=1234.567;
-a
-1234.567
-delete from t2 where a=1234.567;
-select * from t2;
-a
--2.2250738585072016e208
--1.5
--1
--2.2250738585072014e-208
-0
-1.5
-2.2250738585072016e208
-delete from t2;
-1024*3 inserts;
-select count(*) from t2;
-count(*)
-3072
-drop table t2;
diff --git a/mysql-test/suite/parts/r/partition_float_myisam.result b/mysql-test/suite/parts/r/partition_float_myisam.result
index f4b57fc271a..ff77ae17b37 100644
--- a/mysql-test/suite/parts/r/partition_float_myisam.result
+++ b/mysql-test/suite/parts/r/partition_float_myisam.result
@@ -88,85 +88,3 @@ select count(*) from t2;
count(*)
49152
drop table t2;
-create table t1 (a double not null, primary key(a)) engine='MYISAM'
-partition by key (a) (
-partition pa1 max_rows=20 min_rows=2,
-partition pa2 max_rows=30 min_rows=3,
-partition pa3 max_rows=30 min_rows=4,
-partition pa4 max_rows=40 min_rows=2);
-show create table t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `a` double NOT NULL,
- PRIMARY KEY (`a`)
-) ENGINE=MyISAM DEFAULT CHARSET=latin1
- PARTITION BY KEY (a)
-(PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = MyISAM,
- PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = MyISAM,
- PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = MyISAM,
- PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = MyISAM)
-insert into t1 values (-2.2250738585072014E+208), (-2.2250738585072014E-208), (-1.5), (-1), (0), (1.5), (1234.567), (2.2250738585072014E+208);
-select * from t1;
-a
--2.2250738585072016e208
--1.5
--1
--2.2250738585072014e-208
-0
-1.5
-1234.567
-2.2250738585072016e208
-select * from t1 where a=1.5;
-a
-1.5
-delete from t1 where a=1.5;
-select * from t1;
-a
--2.2250738585072016e208
--1.5
--1
--2.2250738585072014e-208
-0
-1234.567
-2.2250738585072016e208
-drop table t1;
-create table t2 (a double not null, primary key(a)) engine='MYISAM'
-partition by key (a) partitions 10;
-show create table t2;
-Table Create Table
-t2 CREATE TABLE `t2` (
- `a` double NOT NULL,
- PRIMARY KEY (`a`)
-) ENGINE=MyISAM DEFAULT CHARSET=latin1
- PARTITION BY KEY (a)
-PARTITIONS 10
-insert into t2 values (-2.2250738585072014E+208), (-2.2250738585072014E-208), (-1.5), (-1), (0), (1.5), (1234.567), (2.2250738585072014E+208);
-select * from t2;
-a
--2.2250738585072016e208
--1.5
--1
--2.2250738585072014e-208
-0
-1.5
-1234.567
-2.2250738585072016e208
-select * from t2 where a=1234.567;
-a
-1234.567
-delete from t2 where a=1234.567;
-select * from t2;
-a
--2.2250738585072016e208
--1.5
--1
--2.2250738585072014e-208
-0
-1.5
-2.2250738585072016e208
-delete from t2;
-16384*3 inserts;
-select count(*) from t2;
-count(*)
-49152
-drop table t2;
diff --git a/mysql-test/suite/parts/r/partition_int_innodb.result b/mysql-test/suite/parts/r/partition_int_innodb.result
index 9556aca2a96..31a61209d4d 100644
--- a/mysql-test/suite/parts/r/partition_int_innodb.result
+++ b/mysql-test/suite/parts/r/partition_int_innodb.result
@@ -1,221 +1,3 @@
-create table t1 (a tinyint unsigned not null, primary key(a)) engine='InnoDB'
-partition by key (a) (
-partition pa1 max_rows=20 min_rows=2,
-partition pa2 max_rows=30 min_rows=3,
-partition pa3 max_rows=30 min_rows=4,
-partition pa4 max_rows=40 min_rows=2);
-show create table t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `a` tinyint(3) unsigned NOT NULL,
- PRIMARY KEY (`a`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1
- PARTITION BY KEY (a)
-(PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = InnoDB,
- PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = InnoDB,
- PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = InnoDB,
- PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = InnoDB)
-insert into t1 values (255), (254), (253), (252), (1), (2), (128);
-select * from t1;
-a
-1
-128
-2
-252
-253
-254
-255
-select * from t1 where a=253;
-a
-253
-delete from t1 where a=253;
-select * from t1;
-a
-1
-128
-2
-252
-254
-255
-drop table t1;
-create table t2 (a tinyint unsigned not null, primary key(a)) engine='InnoDB'
-partition by key (a) partitions 8;
-show create table t2;
-Table Create Table
-t2 CREATE TABLE `t2` (
- `a` tinyint(3) unsigned NOT NULL,
- PRIMARY KEY (`a`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1
- PARTITION BY KEY (a)
-PARTITIONS 8
-insert into t2 values (255), (254), (253), (252);
-select * from t2;
-a
-252
-253
-254
-255
-select * from t2 where a=253;
-a
-253
-delete from t2 where a=253;
-select * from t2;
-a
-252
-254
-255
-delete from t2;
-255 inserts;
-select count(*) from t2;
-count(*)
-255
-drop table t2;
-create table t3 (a tinyint not null, primary key(a)) engine='InnoDB'
-partition by key (a) partitions 7;
-show create table t3;
-Table Create Table
-t3 CREATE TABLE `t3` (
- `a` tinyint(4) NOT NULL,
- PRIMARY KEY (`a`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1
- PARTITION BY KEY (a)
-PARTITIONS 7
-insert into t3 values (127), (126), (125), (124), (-128), (-127), (1), (-1), (0);
-select * from t3;
-a
--1
--127
--128
-0
-1
-124
-125
-126
-127
-select * from t3 where a=125;
-a
-125
-delete from t3 where a=125;
-select * from t3;
-a
--1
--127
--128
-0
-1
-124
-126
-127
-drop table t3;
-create table t1 (a smallint unsigned not null, primary key(a)) engine='InnoDB'
-partition by key (a) (
-partition pa1 max_rows=20 min_rows=2,
-partition pa2 max_rows=30 min_rows=3,
-partition pa3 max_rows=30 min_rows=4,
-partition pa4 max_rows=40 min_rows=2);
-show create table t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `a` smallint(5) unsigned NOT NULL,
- PRIMARY KEY (`a`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1
- PARTITION BY KEY (a)
-(PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = InnoDB,
- PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = InnoDB,
- PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = InnoDB,
- PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = InnoDB)
-insert into t1 values (65535), (65534), (65533), (65532), (1), (2), (256);
-select * from t1;
-a
-1
-2
-256
-65532
-65533
-65534
-65535
-select * from t1 where a=65533;
-a
-65533
-delete from t1 where a=65533;
-select * from t1;
-a
-1
-2
-256
-65532
-65534
-65535
-drop table t1;
-create table t2 (a smallint unsigned not null, primary key(a)) engine='InnoDB'
-partition by key (a) partitions 8;
-show create table t2;
-Table Create Table
-t2 CREATE TABLE `t2` (
- `a` smallint(5) unsigned NOT NULL,
- PRIMARY KEY (`a`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1
- PARTITION BY KEY (a)
-PARTITIONS 8
-insert into t2 values (65535), (65534), (65533), (65532);
-select * from t2;
-a
-65532
-65533
-65534
-65535
-select * from t2 where a=65533;
-a
-65533
-delete from t2 where a=65533;
-select * from t2;
-a
-65532
-65534
-65535
-delete from t2;
-1024 inserts;
-select count(*) from t2;
-count(*)
-1024
-drop table t2;
-create table t3 (a smallint not null, primary key(a)) engine='InnoDB'
-partition by key (a) partitions 7;
-show create table t3;
-Table Create Table
-t3 CREATE TABLE `t3` (
- `a` smallint(6) NOT NULL,
- PRIMARY KEY (`a`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1
- PARTITION BY KEY (a)
-PARTITIONS 7
-insert into t3 values (32767), (32766), (32765), (32764), (-32768), (-32767), (1), (-1), (0);
-select * from t3;
-a
--1
--32767
--32768
-0
-1
-32764
-32765
-32766
-32767
-select * from t3 where a=32765;
-a
-32765
-delete from t3 where a=32765;
-select * from t3;
-a
--1
--32767
--32768
-0
-1
-32764
-32766
-32767
-drop table t3;
create table t1 (a int unsigned not null, primary key(a)) engine='InnoDB'
partition by key (a) (
partition pa1 max_rows=20 min_rows=2,
@@ -325,233 +107,3 @@ a
2147483646
2147483647
drop table t3;
-create table t1 (a mediumint unsigned not null, primary key(a)) engine='InnoDB'
-partition by key (a) (
-partition pa1 max_rows=20 min_rows=2,
-partition pa2 max_rows=30 min_rows=3,
-partition pa3 max_rows=30 min_rows=4,
-partition pa4 max_rows=40 min_rows=2);
-show create table t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `a` mediumint(8) unsigned NOT NULL,
- PRIMARY KEY (`a`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1
- PARTITION BY KEY (a)
-(PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = InnoDB,
- PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = InnoDB,
- PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = InnoDB,
- PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = InnoDB)
-insert into t1 values (16777215), (16777214), (16777213), (16777212), (1), (2), (65535);
-select * from t1;
-a
-1
-16777212
-16777213
-16777214
-16777215
-2
-65535
-select * from t1 where a=16777213;
-a
-16777213
-delete from t1 where a=16777213;
-select * from t1;
-a
-1
-16777212
-16777214
-16777215
-2
-65535
-drop table t1;
-create table t2 (a mediumint unsigned not null, primary key(a)) engine='InnoDB'
-partition by key (a) partitions 8;
-show create table t2;
-Table Create Table
-t2 CREATE TABLE `t2` (
- `a` mediumint(8) unsigned NOT NULL,
- PRIMARY KEY (`a`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1
- PARTITION BY KEY (a)
-PARTITIONS 8
-insert into t2 values (16777215), (16777214), (16777213), (16777212);
-select * from t2;
-a
-16777212
-16777213
-16777214
-16777215
-select * from t2 where a=16777213;
-a
-16777213
-delete from t2 where a=16777213;
-select * from t2;
-a
-16777212
-16777214
-16777215
-delete from t2;
-1024 inserts;
-select count(*) from t2;
-count(*)
-1024
-drop table t2;
-create table t3 (a mediumint not null, primary key(a)) engine='InnoDB'
-partition by key (a) partitions 7;
-show create table t3;
-Table Create Table
-t3 CREATE TABLE `t3` (
- `a` mediumint(9) NOT NULL,
- PRIMARY KEY (`a`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1
- PARTITION BY KEY (a)
-PARTITIONS 7
-insert into t3 values (8388607), (8388606), (8388605), (8388604), (-8388608), (-8388607), (1), (-1), (0);
-select * from t3;
-a
--1
--8388607
--8388608
-0
-1
-8388604
-8388605
-8388606
-8388607
-select * from t3 where a=8388605;
-a
-8388605
-delete from t3 where a=8388605;
-select * from t3;
-a
--1
--8388607
--8388608
-0
-1
-8388604
-8388606
-8388607
-drop table t3;
-create table t1 (a bigint unsigned not null, primary key(a)) engine='InnoDB'
-partition by key (a) (
-partition pa1 max_rows=20 min_rows=2,
-partition pa2 max_rows=30 min_rows=3,
-partition pa3 max_rows=30 min_rows=4,
-partition pa4 max_rows=40 min_rows=2);
-show create table t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `a` bigint(20) unsigned NOT NULL,
- PRIMARY KEY (`a`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1
- PARTITION BY KEY (a)
-(PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = InnoDB,
- PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = InnoDB,
- PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = InnoDB,
- PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = InnoDB)
-insert into t1 values (18446744073709551615), (0xFFFFFFFFFFFFFFFE), (18446744073709551613), (18446744073709551612), (1), (2), (65535);
-select * from t1;
-a
-1
-18446744073709551612
-18446744073709551613
-18446744073709551614
-18446744073709551615
-2
-65535
-select * from t1 where a=-2;
-a
-delete from t1 where a=-2;
-select * from t1;
-a
-1
-18446744073709551612
-18446744073709551613
-18446744073709551614
-18446744073709551615
-2
-65535
-select * from t1 where a=18446744073709551615;
-a
-18446744073709551615
-delete from t1 where a=18446744073709551615;
-select * from t1;
-a
-1
-18446744073709551612
-18446744073709551613
-18446744073709551614
-2
-65535
-drop table t1;
-create table t2 (a bigint unsigned not null, primary key(a)) engine='InnoDB'
-partition by key (a) partitions 8;
-show create table t2;
-Table Create Table
-t2 CREATE TABLE `t2` (
- `a` bigint(20) unsigned NOT NULL,
- PRIMARY KEY (`a`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1
- PARTITION BY KEY (a)
-PARTITIONS 8
-insert into t2 values (18446744073709551615), (0xFFFFFFFFFFFFFFFE), (18446744073709551613), (18446744073709551612);
-select * from t2;
-a
-18446744073709551612
-18446744073709551613
-18446744073709551614
-18446744073709551615
-select * from t2 where a=18446744073709551615;
-a
-18446744073709551615
-delete from t2 where a=18446744073709551615;
-select * from t2;
-a
-18446744073709551612
-18446744073709551613
-18446744073709551614
-delete from t2;
-1024 inserts;
-select count(*) from t2;
-count(*)
-1024
-drop table t2;
-create table t3 (a bigint not null, primary key(a)) engine='InnoDB'
-partition by key (a) partitions 7;
-show create table t3;
-Table Create Table
-t3 CREATE TABLE `t3` (
- `a` bigint(20) NOT NULL,
- PRIMARY KEY (`a`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1
- PARTITION BY KEY (a)
-PARTITIONS 7
-insert into t3 values (9223372036854775807), (9223372036854775806), (9223372036854775805), (9223372036854775804), (-9223372036854775808), (-9223372036854775807), (1), (-1), (0);
-select * from t3;
-a
--1
--9223372036854775807
--9223372036854775808
-0
-1
-9223372036854775804
-9223372036854775805
-9223372036854775806
-9223372036854775807
-select * from t3 where a=9223372036854775806;
-a
-9223372036854775806
-delete from t3 where a=9223372036854775806;
-select * from t3;
-a
--1
--9223372036854775807
--9223372036854775808
-0
-1
-9223372036854775804
-9223372036854775805
-9223372036854775807
-drop table t3;
diff --git a/mysql-test/suite/parts/r/partition_int_myisam.result b/mysql-test/suite/parts/r/partition_int_myisam.result
index 9eaa98af38f..813d4b20e1a 100644
--- a/mysql-test/suite/parts/r/partition_int_myisam.result
+++ b/mysql-test/suite/parts/r/partition_int_myisam.result
@@ -1,221 +1,3 @@
-create table t1 (a tinyint unsigned not null, primary key(a)) engine='MYISAM'
-partition by key (a) (
-partition pa1 max_rows=20 min_rows=2,
-partition pa2 max_rows=30 min_rows=3,
-partition pa3 max_rows=30 min_rows=4,
-partition pa4 max_rows=40 min_rows=2);
-show create table t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `a` tinyint(3) unsigned NOT NULL,
- PRIMARY KEY (`a`)
-) ENGINE=MyISAM DEFAULT CHARSET=latin1
- PARTITION BY KEY (a)
-(PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = MyISAM,
- PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = MyISAM,
- PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = MyISAM,
- PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = MyISAM)
-insert into t1 values (255), (254), (253), (252), (1), (2), (128);
-select * from t1;
-a
-1
-128
-2
-252
-253
-254
-255
-select * from t1 where a=253;
-a
-253
-delete from t1 where a=253;
-select * from t1;
-a
-1
-128
-2
-252
-254
-255
-drop table t1;
-create table t2 (a tinyint unsigned not null, primary key(a)) engine='MYISAM'
-partition by key (a) partitions 8;
-show create table t2;
-Table Create Table
-t2 CREATE TABLE `t2` (
- `a` tinyint(3) unsigned NOT NULL,
- PRIMARY KEY (`a`)
-) ENGINE=MyISAM DEFAULT CHARSET=latin1
- PARTITION BY KEY (a)
-PARTITIONS 8
-insert into t2 values (255), (254), (253), (252);
-select * from t2;
-a
-252
-253
-254
-255
-select * from t2 where a=253;
-a
-253
-delete from t2 where a=253;
-select * from t2;
-a
-252
-254
-255
-delete from t2;
-255 inserts;
-select count(*) from t2;
-count(*)
-255
-drop table t2;
-create table t3 (a tinyint not null, primary key(a)) engine='MYISAM'
-partition by key (a) partitions 7;
-show create table t3;
-Table Create Table
-t3 CREATE TABLE `t3` (
- `a` tinyint(4) NOT NULL,
- PRIMARY KEY (`a`)
-) ENGINE=MyISAM DEFAULT CHARSET=latin1
- PARTITION BY KEY (a)
-PARTITIONS 7
-insert into t3 values (127), (126), (125), (124), (-128), (-127), (1), (-1), (0);
-select * from t3;
-a
--1
--127
--128
-0
-1
-124
-125
-126
-127
-select * from t3 where a=125;
-a
-125
-delete from t3 where a=125;
-select * from t3;
-a
--1
--127
--128
-0
-1
-124
-126
-127
-drop table t3;
-create table t1 (a smallint unsigned not null, primary key(a)) engine='MYISAM'
-partition by key (a) (
-partition pa1 max_rows=20 min_rows=2,
-partition pa2 max_rows=30 min_rows=3,
-partition pa3 max_rows=30 min_rows=4,
-partition pa4 max_rows=40 min_rows=2);
-show create table t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `a` smallint(5) unsigned NOT NULL,
- PRIMARY KEY (`a`)
-) ENGINE=MyISAM DEFAULT CHARSET=latin1
- PARTITION BY KEY (a)
-(PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = MyISAM,
- PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = MyISAM,
- PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = MyISAM,
- PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = MyISAM)
-insert into t1 values (65535), (65534), (65533), (65532), (1), (2), (256);
-select * from t1;
-a
-1
-2
-256
-65532
-65533
-65534
-65535
-select * from t1 where a=65533;
-a
-65533
-delete from t1 where a=65533;
-select * from t1;
-a
-1
-2
-256
-65532
-65534
-65535
-drop table t1;
-create table t2 (a smallint unsigned not null, primary key(a)) engine='MYISAM'
-partition by key (a) partitions 8;
-show create table t2;
-Table Create Table
-t2 CREATE TABLE `t2` (
- `a` smallint(5) unsigned NOT NULL,
- PRIMARY KEY (`a`)
-) ENGINE=MyISAM DEFAULT CHARSET=latin1
- PARTITION BY KEY (a)
-PARTITIONS 8
-insert into t2 values (65535), (65534), (65533), (65532);
-select * from t2;
-a
-65532
-65533
-65534
-65535
-select * from t2 where a=65533;
-a
-65533
-delete from t2 where a=65533;
-select * from t2;
-a
-65532
-65534
-65535
-delete from t2;
-65535 inserts;
-select count(*) from t2;
-count(*)
-65535
-drop table t2;
-create table t3 (a smallint not null, primary key(a)) engine='MYISAM'
-partition by key (a) partitions 7;
-show create table t3;
-Table Create Table
-t3 CREATE TABLE `t3` (
- `a` smallint(6) NOT NULL,
- PRIMARY KEY (`a`)
-) ENGINE=MyISAM DEFAULT CHARSET=latin1
- PARTITION BY KEY (a)
-PARTITIONS 7
-insert into t3 values (32767), (32766), (32765), (32764), (-32768), (-32767), (1), (-1), (0);
-select * from t3;
-a
--1
--32767
--32768
-0
-1
-32764
-32765
-32766
-32767
-select * from t3 where a=32765;
-a
-32765
-delete from t3 where a=32765;
-select * from t3;
-a
--1
--32767
--32768
-0
-1
-32764
-32766
-32767
-drop table t3;
create table t1 (a int unsigned not null, primary key(a)) engine='MYISAM'
partition by key (a) (
partition pa1 max_rows=20 min_rows=2,
@@ -325,233 +107,3 @@ a
2147483646
2147483647
drop table t3;
-create table t1 (a mediumint unsigned not null, primary key(a)) engine='MYISAM'
-partition by key (a) (
-partition pa1 max_rows=20 min_rows=2,
-partition pa2 max_rows=30 min_rows=3,
-partition pa3 max_rows=30 min_rows=4,
-partition pa4 max_rows=40 min_rows=2);
-show create table t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `a` mediumint(8) unsigned NOT NULL,
- PRIMARY KEY (`a`)
-) ENGINE=MyISAM DEFAULT CHARSET=latin1
- PARTITION BY KEY (a)
-(PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = MyISAM,
- PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = MyISAM,
- PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = MyISAM,
- PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = MyISAM)
-insert into t1 values (16777215), (16777214), (16777213), (16777212), (1), (2), (65535);
-select * from t1;
-a
-1
-16777212
-16777213
-16777214
-16777215
-2
-65535
-select * from t1 where a=16777213;
-a
-16777213
-delete from t1 where a=16777213;
-select * from t1;
-a
-1
-16777212
-16777214
-16777215
-2
-65535
-drop table t1;
-create table t2 (a mediumint unsigned not null, primary key(a)) engine='MYISAM'
-partition by key (a) partitions 8;
-show create table t2;
-Table Create Table
-t2 CREATE TABLE `t2` (
- `a` mediumint(8) unsigned NOT NULL,
- PRIMARY KEY (`a`)
-) ENGINE=MyISAM DEFAULT CHARSET=latin1
- PARTITION BY KEY (a)
-PARTITIONS 8
-insert into t2 values (16777215), (16777214), (16777213), (16777212);
-select * from t2;
-a
-16777212
-16777213
-16777214
-16777215
-select * from t2 where a=16777213;
-a
-16777213
-delete from t2 where a=16777213;
-select * from t2;
-a
-16777212
-16777214
-16777215
-delete from t2;
-65535 inserts;
-select count(*) from t2;
-count(*)
-65535
-drop table t2;
-create table t3 (a mediumint not null, primary key(a)) engine='MYISAM'
-partition by key (a) partitions 7;
-show create table t3;
-Table Create Table
-t3 CREATE TABLE `t3` (
- `a` mediumint(9) NOT NULL,
- PRIMARY KEY (`a`)
-) ENGINE=MyISAM DEFAULT CHARSET=latin1
- PARTITION BY KEY (a)
-PARTITIONS 7
-insert into t3 values (8388607), (8388606), (8388605), (8388604), (-8388608), (-8388607), (1), (-1), (0);
-select * from t3;
-a
--1
--8388607
--8388608
-0
-1
-8388604
-8388605
-8388606
-8388607
-select * from t3 where a=8388605;
-a
-8388605
-delete from t3 where a=8388605;
-select * from t3;
-a
--1
--8388607
--8388608
-0
-1
-8388604
-8388606
-8388607
-drop table t3;
-create table t1 (a bigint unsigned not null, primary key(a)) engine='MYISAM'
-partition by key (a) (
-partition pa1 max_rows=20 min_rows=2,
-partition pa2 max_rows=30 min_rows=3,
-partition pa3 max_rows=30 min_rows=4,
-partition pa4 max_rows=40 min_rows=2);
-show create table t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `a` bigint(20) unsigned NOT NULL,
- PRIMARY KEY (`a`)
-) ENGINE=MyISAM DEFAULT CHARSET=latin1
- PARTITION BY KEY (a)
-(PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = MyISAM,
- PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = MyISAM,
- PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = MyISAM,
- PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = MyISAM)
-insert into t1 values (18446744073709551615), (0xFFFFFFFFFFFFFFFE), (18446744073709551613), (18446744073709551612), (1), (2), (65535);
-select * from t1;
-a
-1
-18446744073709551612
-18446744073709551613
-18446744073709551614
-18446744073709551615
-2
-65535
-select * from t1 where a=-2;
-a
-delete from t1 where a=-2;
-select * from t1;
-a
-1
-18446744073709551612
-18446744073709551613
-18446744073709551614
-18446744073709551615
-2
-65535
-select * from t1 where a=18446744073709551615;
-a
-18446744073709551615
-delete from t1 where a=18446744073709551615;
-select * from t1;
-a
-1
-18446744073709551612
-18446744073709551613
-18446744073709551614
-2
-65535
-drop table t1;
-create table t2 (a bigint unsigned not null, primary key(a)) engine='MYISAM'
-partition by key (a) partitions 8;
-show create table t2;
-Table Create Table
-t2 CREATE TABLE `t2` (
- `a` bigint(20) unsigned NOT NULL,
- PRIMARY KEY (`a`)
-) ENGINE=MyISAM DEFAULT CHARSET=latin1
- PARTITION BY KEY (a)
-PARTITIONS 8
-insert into t2 values (18446744073709551615), (0xFFFFFFFFFFFFFFFE), (18446744073709551613), (18446744073709551612);
-select * from t2;
-a
-18446744073709551612
-18446744073709551613
-18446744073709551614
-18446744073709551615
-select * from t2 where a=18446744073709551615;
-a
-18446744073709551615
-delete from t2 where a=18446744073709551615;
-select * from t2;
-a
-18446744073709551612
-18446744073709551613
-18446744073709551614
-delete from t2;
-65535 inserts;
-select count(*) from t2;
-count(*)
-65535
-drop table t2;
-create table t3 (a bigint not null, primary key(a)) engine='MYISAM'
-partition by key (a) partitions 7;
-show create table t3;
-Table Create Table
-t3 CREATE TABLE `t3` (
- `a` bigint(20) NOT NULL,
- PRIMARY KEY (`a`)
-) ENGINE=MyISAM DEFAULT CHARSET=latin1
- PARTITION BY KEY (a)
-PARTITIONS 7
-insert into t3 values (9223372036854775807), (9223372036854775806), (9223372036854775805), (9223372036854775804), (-9223372036854775808), (-9223372036854775807), (1), (-1), (0);
-select * from t3;
-a
--1
--9223372036854775807
--9223372036854775808
-0
-1
-9223372036854775804
-9223372036854775805
-9223372036854775806
-9223372036854775807
-select * from t3 where a=9223372036854775806;
-a
-9223372036854775806
-delete from t3 where a=9223372036854775806;
-select * from t3;
-a
--1
--9223372036854775807
--9223372036854775808
-0
-1
-9223372036854775804
-9223372036854775805
-9223372036854775807
-drop table t3;
diff --git a/mysql-test/suite/parts/r/partition_mediumint_innodb.result b/mysql-test/suite/parts/r/partition_mediumint_innodb.result
new file mode 100644
index 00000000000..3e04cf23754
--- /dev/null
+++ b/mysql-test/suite/parts/r/partition_mediumint_innodb.result
@@ -0,0 +1,109 @@
+create table t1 (a mediumint unsigned not null, primary key(a)) engine='InnoDB'
+partition by key (a) (
+partition pa1 max_rows=20 min_rows=2,
+partition pa2 max_rows=30 min_rows=3,
+partition pa3 max_rows=30 min_rows=4,
+partition pa4 max_rows=40 min_rows=2);
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` mediumint(8) unsigned NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+ PARTITION BY KEY (a)
+(PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = InnoDB,
+ PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = InnoDB,
+ PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = InnoDB,
+ PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = InnoDB)
+insert into t1 values (16777215), (16777214), (16777213), (16777212), (1), (2), (65535);
+select * from t1;
+a
+1
+16777212
+16777213
+16777214
+16777215
+2
+65535
+select * from t1 where a=16777213;
+a
+16777213
+delete from t1 where a=16777213;
+select * from t1;
+a
+1
+16777212
+16777214
+16777215
+2
+65535
+drop table t1;
+create table t2 (a mediumint unsigned not null, primary key(a)) engine='InnoDB'
+partition by key (a) partitions 8;
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` mediumint(8) unsigned NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+ PARTITION BY KEY (a)
+PARTITIONS 8
+insert into t2 values (16777215), (16777214), (16777213), (16777212);
+select * from t2;
+a
+16777212
+16777213
+16777214
+16777215
+select * from t2 where a=16777213;
+a
+16777213
+delete from t2 where a=16777213;
+select * from t2;
+a
+16777212
+16777214
+16777215
+delete from t2;
+1024 inserts;
+select count(*) from t2;
+count(*)
+1024
+drop table t2;
+create table t3 (a mediumint not null, primary key(a)) engine='InnoDB'
+partition by key (a) partitions 7;
+show create table t3;
+Table Create Table
+t3 CREATE TABLE `t3` (
+ `a` mediumint(9) NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+ PARTITION BY KEY (a)
+PARTITIONS 7
+insert into t3 values (8388607), (8388606), (8388605), (8388604), (-8388608), (-8388607), (1), (-1), (0);
+select * from t3;
+a
+-1
+-8388607
+-8388608
+0
+1
+8388604
+8388605
+8388606
+8388607
+select * from t3 where a=8388605;
+a
+8388605
+delete from t3 where a=8388605;
+select * from t3;
+a
+-1
+-8388607
+-8388608
+0
+1
+8388604
+8388606
+8388607
+drop table t3;
diff --git a/mysql-test/suite/parts/r/partition_mediumint_myisam.result b/mysql-test/suite/parts/r/partition_mediumint_myisam.result
new file mode 100644
index 00000000000..21e2d29ea14
--- /dev/null
+++ b/mysql-test/suite/parts/r/partition_mediumint_myisam.result
@@ -0,0 +1,109 @@
+create table t1 (a mediumint unsigned not null, primary key(a)) engine='MYISAM'
+partition by key (a) (
+partition pa1 max_rows=20 min_rows=2,
+partition pa2 max_rows=30 min_rows=3,
+partition pa3 max_rows=30 min_rows=4,
+partition pa4 max_rows=40 min_rows=2);
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` mediumint(8) unsigned NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+ PARTITION BY KEY (a)
+(PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = MyISAM,
+ PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = MyISAM,
+ PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = MyISAM,
+ PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = MyISAM)
+insert into t1 values (16777215), (16777214), (16777213), (16777212), (1), (2), (65535);
+select * from t1;
+a
+1
+16777212
+16777213
+16777214
+16777215
+2
+65535
+select * from t1 where a=16777213;
+a
+16777213
+delete from t1 where a=16777213;
+select * from t1;
+a
+1
+16777212
+16777214
+16777215
+2
+65535
+drop table t1;
+create table t2 (a mediumint unsigned not null, primary key(a)) engine='MYISAM'
+partition by key (a) partitions 8;
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` mediumint(8) unsigned NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+ PARTITION BY KEY (a)
+PARTITIONS 8
+insert into t2 values (16777215), (16777214), (16777213), (16777212);
+select * from t2;
+a
+16777212
+16777213
+16777214
+16777215
+select * from t2 where a=16777213;
+a
+16777213
+delete from t2 where a=16777213;
+select * from t2;
+a
+16777212
+16777214
+16777215
+delete from t2;
+65535 inserts;
+select count(*) from t2;
+count(*)
+65535
+drop table t2;
+create table t3 (a mediumint not null, primary key(a)) engine='MYISAM'
+partition by key (a) partitions 7;
+show create table t3;
+Table Create Table
+t3 CREATE TABLE `t3` (
+ `a` mediumint(9) NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+ PARTITION BY KEY (a)
+PARTITIONS 7
+insert into t3 values (8388607), (8388606), (8388605), (8388604), (-8388608), (-8388607), (1), (-1), (0);
+select * from t3;
+a
+-1
+-8388607
+-8388608
+0
+1
+8388604
+8388605
+8388606
+8388607
+select * from t3 where a=8388605;
+a
+8388605
+delete from t3 where a=8388605;
+select * from t3;
+a
+-1
+-8388607
+-8388608
+0
+1
+8388604
+8388606
+8388607
+drop table t3;
diff --git a/mysql-test/suite/parts/r/partition_smallint_innodb.result b/mysql-test/suite/parts/r/partition_smallint_innodb.result
new file mode 100644
index 00000000000..baf9255bae1
--- /dev/null
+++ b/mysql-test/suite/parts/r/partition_smallint_innodb.result
@@ -0,0 +1,109 @@
+create table t1 (a smallint unsigned not null, primary key(a)) engine='InnoDB'
+partition by key (a) (
+partition pa1 max_rows=20 min_rows=2,
+partition pa2 max_rows=30 min_rows=3,
+partition pa3 max_rows=30 min_rows=4,
+partition pa4 max_rows=40 min_rows=2);
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` smallint(5) unsigned NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+ PARTITION BY KEY (a)
+(PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = InnoDB,
+ PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = InnoDB,
+ PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = InnoDB,
+ PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = InnoDB)
+insert into t1 values (65535), (65534), (65533), (65532), (1), (2), (256);
+select * from t1;
+a
+1
+2
+256
+65532
+65533
+65534
+65535
+select * from t1 where a=65533;
+a
+65533
+delete from t1 where a=65533;
+select * from t1;
+a
+1
+2
+256
+65532
+65534
+65535
+drop table t1;
+create table t2 (a smallint unsigned not null, primary key(a)) engine='InnoDB'
+partition by key (a) partitions 8;
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` smallint(5) unsigned NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+ PARTITION BY KEY (a)
+PARTITIONS 8
+insert into t2 values (65535), (65534), (65533), (65532);
+select * from t2;
+a
+65532
+65533
+65534
+65535
+select * from t2 where a=65533;
+a
+65533
+delete from t2 where a=65533;
+select * from t2;
+a
+65532
+65534
+65535
+delete from t2;
+1024 inserts;
+select count(*) from t2;
+count(*)
+1024
+drop table t2;
+create table t3 (a smallint not null, primary key(a)) engine='InnoDB'
+partition by key (a) partitions 7;
+show create table t3;
+Table Create Table
+t3 CREATE TABLE `t3` (
+ `a` smallint(6) NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+ PARTITION BY KEY (a)
+PARTITIONS 7
+insert into t3 values (32767), (32766), (32765), (32764), (-32768), (-32767), (1), (-1), (0);
+select * from t3;
+a
+-1
+-32767
+-32768
+0
+1
+32764
+32765
+32766
+32767
+select * from t3 where a=32765;
+a
+32765
+delete from t3 where a=32765;
+select * from t3;
+a
+-1
+-32767
+-32768
+0
+1
+32764
+32766
+32767
+drop table t3;
diff --git a/mysql-test/suite/parts/r/partition_smallint_myisam.result b/mysql-test/suite/parts/r/partition_smallint_myisam.result
new file mode 100644
index 00000000000..57a5dbe67a7
--- /dev/null
+++ b/mysql-test/suite/parts/r/partition_smallint_myisam.result
@@ -0,0 +1,109 @@
+create table t1 (a smallint unsigned not null, primary key(a)) engine='MYISAM'
+partition by key (a) (
+partition pa1 max_rows=20 min_rows=2,
+partition pa2 max_rows=30 min_rows=3,
+partition pa3 max_rows=30 min_rows=4,
+partition pa4 max_rows=40 min_rows=2);
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` smallint(5) unsigned NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+ PARTITION BY KEY (a)
+(PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = MyISAM,
+ PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = MyISAM,
+ PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = MyISAM,
+ PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = MyISAM)
+insert into t1 values (65535), (65534), (65533), (65532), (1), (2), (256);
+select * from t1;
+a
+1
+2
+256
+65532
+65533
+65534
+65535
+select * from t1 where a=65533;
+a
+65533
+delete from t1 where a=65533;
+select * from t1;
+a
+1
+2
+256
+65532
+65534
+65535
+drop table t1;
+create table t2 (a smallint unsigned not null, primary key(a)) engine='MYISAM'
+partition by key (a) partitions 8;
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` smallint(5) unsigned NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+ PARTITION BY KEY (a)
+PARTITIONS 8
+insert into t2 values (65535), (65534), (65533), (65532);
+select * from t2;
+a
+65532
+65533
+65534
+65535
+select * from t2 where a=65533;
+a
+65533
+delete from t2 where a=65533;
+select * from t2;
+a
+65532
+65534
+65535
+delete from t2;
+65535 inserts;
+select count(*) from t2;
+count(*)
+65535
+drop table t2;
+create table t3 (a smallint not null, primary key(a)) engine='MYISAM'
+partition by key (a) partitions 7;
+show create table t3;
+Table Create Table
+t3 CREATE TABLE `t3` (
+ `a` smallint(6) NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+ PARTITION BY KEY (a)
+PARTITIONS 7
+insert into t3 values (32767), (32766), (32765), (32764), (-32768), (-32767), (1), (-1), (0);
+select * from t3;
+a
+-1
+-32767
+-32768
+0
+1
+32764
+32765
+32766
+32767
+select * from t3 where a=32765;
+a
+32765
+delete from t3 where a=32765;
+select * from t3;
+a
+-1
+-32767
+-32768
+0
+1
+32764
+32766
+32767
+drop table t3;
diff --git a/mysql-test/suite/parts/r/partition_tinyint_innodb.result b/mysql-test/suite/parts/r/partition_tinyint_innodb.result
new file mode 100644
index 00000000000..a607b29a78a
--- /dev/null
+++ b/mysql-test/suite/parts/r/partition_tinyint_innodb.result
@@ -0,0 +1,109 @@
+create table t1 (a tinyint unsigned not null, primary key(a)) engine='InnoDB'
+partition by key (a) (
+partition pa1 max_rows=20 min_rows=2,
+partition pa2 max_rows=30 min_rows=3,
+partition pa3 max_rows=30 min_rows=4,
+partition pa4 max_rows=40 min_rows=2);
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` tinyint(3) unsigned NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+ PARTITION BY KEY (a)
+(PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = InnoDB,
+ PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = InnoDB,
+ PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = InnoDB,
+ PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = InnoDB)
+insert into t1 values (255), (254), (253), (252), (1), (2), (128);
+select * from t1;
+a
+1
+128
+2
+252
+253
+254
+255
+select * from t1 where a=253;
+a
+253
+delete from t1 where a=253;
+select * from t1;
+a
+1
+128
+2
+252
+254
+255
+drop table t1;
+create table t2 (a tinyint unsigned not null, primary key(a)) engine='InnoDB'
+partition by key (a) partitions 8;
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` tinyint(3) unsigned NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+ PARTITION BY KEY (a)
+PARTITIONS 8
+insert into t2 values (255), (254), (253), (252);
+select * from t2;
+a
+252
+253
+254
+255
+select * from t2 where a=253;
+a
+253
+delete from t2 where a=253;
+select * from t2;
+a
+252
+254
+255
+delete from t2;
+255 inserts;
+select count(*) from t2;
+count(*)
+255
+drop table t2;
+create table t3 (a tinyint not null, primary key(a)) engine='InnoDB'
+partition by key (a) partitions 7;
+show create table t3;
+Table Create Table
+t3 CREATE TABLE `t3` (
+ `a` tinyint(4) NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+ PARTITION BY KEY (a)
+PARTITIONS 7
+insert into t3 values (127), (126), (125), (124), (-128), (-127), (1), (-1), (0);
+select * from t3;
+a
+-1
+-127
+-128
+0
+1
+124
+125
+126
+127
+select * from t3 where a=125;
+a
+125
+delete from t3 where a=125;
+select * from t3;
+a
+-1
+-127
+-128
+0
+1
+124
+126
+127
+drop table t3;
diff --git a/mysql-test/suite/parts/r/partition_tinyint_myisam.result b/mysql-test/suite/parts/r/partition_tinyint_myisam.result
new file mode 100644
index 00000000000..dded4068b11
--- /dev/null
+++ b/mysql-test/suite/parts/r/partition_tinyint_myisam.result
@@ -0,0 +1,109 @@
+create table t1 (a tinyint unsigned not null, primary key(a)) engine='MYISAM'
+partition by key (a) (
+partition pa1 max_rows=20 min_rows=2,
+partition pa2 max_rows=30 min_rows=3,
+partition pa3 max_rows=30 min_rows=4,
+partition pa4 max_rows=40 min_rows=2);
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` tinyint(3) unsigned NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+ PARTITION BY KEY (a)
+(PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = MyISAM,
+ PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = MyISAM,
+ PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = MyISAM,
+ PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = MyISAM)
+insert into t1 values (255), (254), (253), (252), (1), (2), (128);
+select * from t1;
+a
+1
+128
+2
+252
+253
+254
+255
+select * from t1 where a=253;
+a
+253
+delete from t1 where a=253;
+select * from t1;
+a
+1
+128
+2
+252
+254
+255
+drop table t1;
+create table t2 (a tinyint unsigned not null, primary key(a)) engine='MYISAM'
+partition by key (a) partitions 8;
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` tinyint(3) unsigned NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+ PARTITION BY KEY (a)
+PARTITIONS 8
+insert into t2 values (255), (254), (253), (252);
+select * from t2;
+a
+252
+253
+254
+255
+select * from t2 where a=253;
+a
+253
+delete from t2 where a=253;
+select * from t2;
+a
+252
+254
+255
+delete from t2;
+255 inserts;
+select count(*) from t2;
+count(*)
+255
+drop table t2;
+create table t3 (a tinyint not null, primary key(a)) engine='MYISAM'
+partition by key (a) partitions 7;
+show create table t3;
+Table Create Table
+t3 CREATE TABLE `t3` (
+ `a` tinyint(4) NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+ PARTITION BY KEY (a)
+PARTITIONS 7
+insert into t3 values (127), (126), (125), (124), (-128), (-127), (1), (-1), (0);
+select * from t3;
+a
+-1
+-127
+-128
+0
+1
+124
+125
+126
+127
+select * from t3 where a=125;
+a
+125
+delete from t3 where a=125;
+select * from t3;
+a
+-1
+-127
+-128
+0
+1
+124
+126
+127
+drop table t3;
diff --git a/mysql-test/suite/parts/t/partition_bigint_innodb.test b/mysql-test/suite/parts/t/partition_bigint_innodb.test
new file mode 100644
index 00000000000..348ee0add05
--- /dev/null
+++ b/mysql-test/suite/parts/t/partition_bigint_innodb.test
@@ -0,0 +1,46 @@
+################################################################################
+# t/partition_bigint_innodb.test #
+# #
+# Purpose: #
+# Tests around integer type #
+# INNODB branch #
+# #
+#------------------------------------------------------------------------------#
+# Original Author: HH #
+# Original Date: 2006-08-01 #
+# Change Author: Elena Stepanova #
+# Change Date: 2017-02-18 #
+# Change: The test file is spawned from the mega-test partition_int_innodb #
+################################################################################
+
+#
+# NOTE: PLEASE DO NOT ADD NOT INNODB SPECIFIC TESTCASES HERE !
+# TESTCASES WHICH MUST BE APPLIED TO ALL STORAGE ENGINES MUST BE ADDED IN
+# THE SOURCED FILES ONLY.
+#
+# Please read the README at the end of inc/partition.pre before changing
+# any of the variables.
+#
+
+#------------------------------------------------------------------------------#
+# General not engine specific settings and requirements
+
+##### Options, for debugging support #####
+let $debug= 0;
+
+# The server must support partitioning.
+--source include/have_partition.inc
+
+#------------------------------------------------------------------------------#
+# Engine specific settings and requirements
+
+##### Storage engine to be tested
+--source include/have_innodb.inc
+let $engine= 'InnoDB';
+
+##### max rows to be inserted
+let $maxrows=1024;
+
+#------------------------------------------------------------------------------#
+# Execute the tests to be applied to all storage engines
+--source suite/parts/inc/partition_bigint.inc
diff --git a/mysql-test/suite/parts/t/partition_bigint_myisam.test b/mysql-test/suite/parts/t/partition_bigint_myisam.test
new file mode 100644
index 00000000000..f427ffce08d
--- /dev/null
+++ b/mysql-test/suite/parts/t/partition_bigint_myisam.test
@@ -0,0 +1,46 @@
+################################################################################
+# t/partition_bigint_myisam.test #
+# #
+# Purpose: #
+# Tests around integer type #
+# MyISAM branch #
+# #
+#------------------------------------------------------------------------------#
+# Original Author: HH #
+# Original Date: 2006-08-01 #
+# Change Author: Elena Stepanova #
+# Change Date: 2017-02-18 #
+# Change: The test file is spawned from the mega-test partition_int_myisam #
+################################################################################
+
+#
+# NOTE: PLEASE DO NOT ADD NOT MYISAM SPECIFIC TESTCASES HERE !
+# TESTCASES WHICH MUST BE APPLIED TO ALL STORAGE ENGINES MUST BE ADDED IN
+# THE SOURCED FILES ONLY.
+#
+# Please read the README at the end of inc/partition.pre before changing
+# any of the variables.
+#
+
+--source include/long_test.inc
+
+#------------------------------------------------------------------------------#
+# General not engine specific settings and requirements
+
+##### Options, for debugging support #####
+let $debug= 0;
+
+# The server must support partitioning.
+--source include/have_partition.inc
+
+#------------------------------------------------------------------------------#
+# Engine specific settings and requirements
+
+##### Storage engine to be tested
+let $engine= 'MYISAM';
+##### number of rows to be inserted
+let $maxrows=65535;
+
+#------------------------------------------------------------------------------#
+# Execute the tests to be applied to all storage engines
+--source suite/parts/inc/partition_bigint.inc
diff --git a/mysql-test/suite/parts/t/partition_double_innodb.test b/mysql-test/suite/parts/t/partition_double_innodb.test
new file mode 100644
index 00000000000..e31f7049502
--- /dev/null
+++ b/mysql-test/suite/parts/t/partition_double_innodb.test
@@ -0,0 +1,46 @@
+################################################################################
+# t/partition_double_innodb.test #
+# #
+# Purpose: #
+# Tests around float type #
+# INNODB branch #
+# #
+#------------------------------------------------------------------------------#
+# Original Author: HH #
+# Original Date: 2006-08-01 #
+# Change Author: Elena Stepanova #
+# Change Date: 2017-02-18 #
+# Change: The test file is spawned from the mega-test partition_float_innodb #
+################################################################################
+
+#
+# NOTE: PLEASE DO NOT ADD NOT INNODB SPECIFIC TESTCASES HERE !
+# TESTCASES WHICH MUST BE APPLIED TO ALL STORAGE ENGINES MUST BE ADDED IN
+# THE SOURCED FILES ONLY.
+#
+# Please read the README at the end of inc/partition.pre before changing
+# any of the variables.
+#
+
+#------------------------------------------------------------------------------#
+# General not engine specific settings and requirements
+
+##### Options, for debugging support #####
+let $debug= 0;
+
+# The server must support partitioning.
+--source include/have_partition.inc
+
+#------------------------------------------------------------------------------#
+# Engine specific settings and requirements
+
+##### Storage engine to be tested
+--source include/have_innodb.inc
+let $engine= 'InnoDB';
+
+##### Number of row to be inserted.
+let $maxrows=1024;
+
+#------------------------------------------------------------------------------#
+# Execute the tests to be applied to all storage engines
+--source suite/parts/inc/partition_double.inc
diff --git a/mysql-test/suite/parts/t/partition_double_myisam.test b/mysql-test/suite/parts/t/partition_double_myisam.test
new file mode 100644
index 00000000000..6228d657c48
--- /dev/null
+++ b/mysql-test/suite/parts/t/partition_double_myisam.test
@@ -0,0 +1,46 @@
+################################################################################
+# t/partition_double_myisam.test #
+# #
+# Purpose: #
+# Tests around float type #
+# MyISAM branch #
+# #
+#------------------------------------------------------------------------------#
+# Original Author: HH #
+# Original Date: 2006-08-01 #
+# Change Author: Elena Stepanova #
+# Change Date: 2017-02-18 #
+# Change: The test file is spawned from the mega-test partition_float_myisam #
+################################################################################
+
+#
+# NOTE: PLEASE DO NOT ADD NOT MYISAM SPECIFIC TESTCASES HERE !
+# TESTCASES WHICH MUST BE APPLIED TO ALL STORAGE ENGINES MUST BE ADDED IN
+# THE SOURCED FILES ONLY.
+#
+# Please read the README at the end of inc/partition.pre before changing
+# any of the variables.
+#
+
+--source include/long_test.inc
+
+#------------------------------------------------------------------------------#
+# General not engine specific settings and requirements
+
+##### Options, for debugging support #####
+let $debug= 0;
+
+# The server must support partitioning.
+--source include/have_partition.inc
+
+#------------------------------------------------------------------------------#
+# Engine specific settings and requirements
+
+##### Storage engine to be tested
+let $engine= 'MYISAM';
+##### Number of row to be inserted.
+let $maxrows=16384;
+
+#------------------------------------------------------------------------------#
+# Execute the tests to be applied to all storage engines
+--source suite/parts/inc/partition_double.inc
diff --git a/mysql-test/suite/parts/t/partition_float_innodb.test b/mysql-test/suite/parts/t/partition_float_innodb.test
index 2f1fe723dad..8d96eafbb06 100644
--- a/mysql-test/suite/parts/t/partition_float_innodb.test
+++ b/mysql-test/suite/parts/t/partition_float_innodb.test
@@ -8,9 +8,9 @@
#------------------------------------------------------------------------------#
# Original Author: HH #
# Original Date: 2006-08-01 #
-# Change Author: #
-# Change Date: #
-# Change: #
+# Change Author: Elena Stepanova #
+# Change Date: 2017-02-18 #
+# Change: The test for double type has been spawned into a separate test file #
################################################################################
#
@@ -44,4 +44,3 @@ let $maxrows=1024;
#------------------------------------------------------------------------------#
# Execute the tests to be applied to all storage engines
--source suite/parts/inc/partition_float.inc
---source suite/parts/inc/partition_double.inc
diff --git a/mysql-test/suite/parts/t/partition_float_myisam.test b/mysql-test/suite/parts/t/partition_float_myisam.test
index f15e6ad3636..bdc0edd41bb 100644
--- a/mysql-test/suite/parts/t/partition_float_myisam.test
+++ b/mysql-test/suite/parts/t/partition_float_myisam.test
@@ -8,9 +8,9 @@
#------------------------------------------------------------------------------#
# Original Author: HH #
# Original Date: 2006-08-01 #
-# Change Author: #
-# Change Date: #
-# Change: #
+# Change Author: Elena Stepanova #
+# Change Date: 2017-02-18 #
+# Change: The test for double type has been spawned into a separate test file #
################################################################################
#
@@ -44,4 +44,3 @@ let $maxrows=16384;
#------------------------------------------------------------------------------#
# Execute the tests to be applied to all storage engines
--source suite/parts/inc/partition_float.inc
---source suite/parts/inc/partition_double.inc
diff --git a/mysql-test/suite/parts/t/partition_int_innodb.test b/mysql-test/suite/parts/t/partition_int_innodb.test
index 698a2c93c22..fd00e6a0d80 100644
--- a/mysql-test/suite/parts/t/partition_int_innodb.test
+++ b/mysql-test/suite/parts/t/partition_int_innodb.test
@@ -8,9 +8,9 @@
#------------------------------------------------------------------------------#
# Original Author: HH #
# Original Date: 2006-08-01 #
-# Change Author: #
-# Change Date: #
-# Change: #
+# Change Author: Elena Stepanova #
+# Change Date: 2017-02-18 #
+# Change: Int subtypes (tinyint etc.) have been spawned into separate tests #
################################################################################
#
@@ -43,8 +43,4 @@ let $maxrows=1024;
#------------------------------------------------------------------------------#
# Execute the tests to be applied to all storage engines
---source suite/parts/inc/partition_tinyint.inc
---source suite/parts/inc/partition_smallint.inc
--source suite/parts/inc/partition_int.inc
---source suite/parts/inc/partition_mediumint.inc
---source suite/parts/inc/partition_bigint.inc
diff --git a/mysql-test/suite/parts/t/partition_int_myisam.test b/mysql-test/suite/parts/t/partition_int_myisam.test
index 5f29b575244..e8de09f1bf3 100644
--- a/mysql-test/suite/parts/t/partition_int_myisam.test
+++ b/mysql-test/suite/parts/t/partition_int_myisam.test
@@ -8,9 +8,9 @@
#------------------------------------------------------------------------------#
# Original Author: HH #
# Original Date: 2006-08-01 #
-# Change Author: #
-# Change Date: #
-# Change: #
+# Change Author: Elena Stepanova #
+# Change Date: 2017-02-18 #
+# Change: Int subtypes (tinyint etc.) have been spawned into separate tests #
################################################################################
#
@@ -43,8 +43,4 @@ let $maxrows=65535;
#------------------------------------------------------------------------------#
# Execute the tests to be applied to all storage engines
---source suite/parts/inc/partition_tinyint.inc
---source suite/parts/inc/partition_smallint.inc
--source suite/parts/inc/partition_int.inc
---source suite/parts/inc/partition_mediumint.inc
---source suite/parts/inc/partition_bigint.inc
diff --git a/mysql-test/suite/parts/t/partition_mediumint_innodb.test b/mysql-test/suite/parts/t/partition_mediumint_innodb.test
new file mode 100644
index 00000000000..9218b55fa78
--- /dev/null
+++ b/mysql-test/suite/parts/t/partition_mediumint_innodb.test
@@ -0,0 +1,46 @@
+################################################################################
+# t/partition_mediumint_innodb.test #
+# #
+# Purpose: #
+# Tests around integer type #
+# INNODB branch #
+# #
+#------------------------------------------------------------------------------#
+# Original Author: HH #
+# Original Date: 2006-08-01 #
+# Change Author: Elena Stepanova #
+# Change Date: 2017-02-18 #
+# Change: The test file is spawned from the mega-test partition_int_innodb #
+################################################################################
+
+#
+# NOTE: PLEASE DO NOT ADD NOT INNODB SPECIFIC TESTCASES HERE !
+# TESTCASES WHICH MUST BE APPLIED TO ALL STORAGE ENGINES MUST BE ADDED IN
+# THE SOURCED FILES ONLY.
+#
+# Please read the README at the end of inc/partition.pre before changing
+# any of the variables.
+#
+
+#------------------------------------------------------------------------------#
+# General not engine specific settings and requirements
+
+##### Options, for debugging support #####
+let $debug= 0;
+
+# The server must support partitioning.
+--source include/have_partition.inc
+
+#------------------------------------------------------------------------------#
+# Engine specific settings and requirements
+
+##### Storage engine to be tested
+--source include/have_innodb.inc
+let $engine= 'InnoDB';
+
+##### max rows to be inserted
+let $maxrows=1024;
+
+#------------------------------------------------------------------------------#
+# Execute the tests to be applied to all storage engines
+--source suite/parts/inc/partition_mediumint.inc
diff --git a/mysql-test/suite/parts/t/partition_mediumint_myisam.test b/mysql-test/suite/parts/t/partition_mediumint_myisam.test
new file mode 100644
index 00000000000..bbf1775ba97
--- /dev/null
+++ b/mysql-test/suite/parts/t/partition_mediumint_myisam.test
@@ -0,0 +1,46 @@
+################################################################################
+# t/partition_mediumint_myisam.test #
+# #
+# Purpose: #
+# Tests around integer type #
+# MyISAM branch #
+# #
+#------------------------------------------------------------------------------#
+# Original Author: HH #
+# Original Date: 2006-08-01 #
+# Change Author: Elena Stepanova #
+# Change Date: 2017-02-18 #
+# Change: The test file is spawned from the mega-test partition_int_myisam #
+################################################################################
+
+#
+# NOTE: PLEASE DO NOT ADD NOT MYISAM SPECIFIC TESTCASES HERE !
+# TESTCASES WHICH MUST BE APPLIED TO ALL STORAGE ENGINES MUST BE ADDED IN
+# THE SOURCED FILES ONLY.
+#
+# Please read the README at the end of inc/partition.pre before changing
+# any of the variables.
+#
+
+--source include/long_test.inc
+
+#------------------------------------------------------------------------------#
+# General not engine specific settings and requirements
+
+##### Options, for debugging support #####
+let $debug= 0;
+
+# The server must support partitioning.
+--source include/have_partition.inc
+
+#------------------------------------------------------------------------------#
+# Engine specific settings and requirements
+
+##### Storage engine to be tested
+let $engine= 'MYISAM';
+##### number of rows to be inserted
+let $maxrows=65535;
+
+#------------------------------------------------------------------------------#
+# Execute the tests to be applied to all storage engines
+--source suite/parts/inc/partition_mediumint.inc
diff --git a/mysql-test/suite/parts/t/partition_smallint_innodb.test b/mysql-test/suite/parts/t/partition_smallint_innodb.test
new file mode 100644
index 00000000000..22d16cf9d55
--- /dev/null
+++ b/mysql-test/suite/parts/t/partition_smallint_innodb.test
@@ -0,0 +1,46 @@
+################################################################################
+# t/partition_smallint_innodb.test #
+# #
+# Purpose: #
+# Tests around integer type #
+# INNODB branch #
+# #
+#------------------------------------------------------------------------------#
+# Original Author: HH #
+# Original Date: 2006-08-01 #
+# Change Author: Elena Stepanova #
+# Change Date: 2017-02-18 #
+# Change: The test file is spawned from the mega-test partition_int_innodb #
+################################################################################
+
+#
+# NOTE: PLEASE DO NOT ADD NOT INNODB SPECIFIC TESTCASES HERE !
+# TESTCASES WHICH MUST BE APPLIED TO ALL STORAGE ENGINES MUST BE ADDED IN
+# THE SOURCED FILES ONLY.
+#
+# Please read the README at the end of inc/partition.pre before changing
+# any of the variables.
+#
+
+#------------------------------------------------------------------------------#
+# General not engine specific settings and requirements
+
+##### Options, for debugging support #####
+let $debug= 0;
+
+# The server must support partitioning.
+--source include/have_partition.inc
+
+#------------------------------------------------------------------------------#
+# Engine specific settings and requirements
+
+##### Storage engine to be tested
+--source include/have_innodb.inc
+let $engine= 'InnoDB';
+
+##### max rows to be inserted
+let $maxrows=1024;
+
+#------------------------------------------------------------------------------#
+# Execute the tests to be applied to all storage engines
+--source suite/parts/inc/partition_smallint.inc
diff --git a/mysql-test/suite/parts/t/partition_smallint_myisam.test b/mysql-test/suite/parts/t/partition_smallint_myisam.test
new file mode 100644
index 00000000000..f473a6772f8
--- /dev/null
+++ b/mysql-test/suite/parts/t/partition_smallint_myisam.test
@@ -0,0 +1,46 @@
+################################################################################
+# t/partition_smallint_myisam.test #
+# #
+# Purpose: #
+# Tests around integer type #
+# MyISAM branch #
+# #
+#------------------------------------------------------------------------------#
+# Original Author: HH #
+# Original Date: 2006-08-01 #
+# Change Author: Elena Stepanova #
+# Change Date: 2017-02-18 #
+# Change: The test file is spawned from the mega-test partition_int_myisam #
+################################################################################
+
+#
+# NOTE: PLEASE DO NOT ADD NOT MYISAM SPECIFIC TESTCASES HERE !
+# TESTCASES WHICH MUST BE APPLIED TO ALL STORAGE ENGINES MUST BE ADDED IN
+# THE SOURCED FILES ONLY.
+#
+# Please read the README at the end of inc/partition.pre before changing
+# any of the variables.
+#
+
+--source include/long_test.inc
+
+#------------------------------------------------------------------------------#
+# General not engine specific settings and requirements
+
+##### Options, for debugging support #####
+let $debug= 0;
+
+# The server must support partitioning.
+--source include/have_partition.inc
+
+#------------------------------------------------------------------------------#
+# Engine specific settings and requirements
+
+##### Storage engine to be tested
+let $engine= 'MYISAM';
+##### number of rows to be inserted
+let $maxrows=65535;
+
+#------------------------------------------------------------------------------#
+# Execute the tests to be applied to all storage engines
+--source suite/parts/inc/partition_smallint.inc
diff --git a/mysql-test/suite/parts/t/partition_tinyint_innodb.test b/mysql-test/suite/parts/t/partition_tinyint_innodb.test
new file mode 100644
index 00000000000..aec10c1aea5
--- /dev/null
+++ b/mysql-test/suite/parts/t/partition_tinyint_innodb.test
@@ -0,0 +1,46 @@
+################################################################################
+# t/partition_tinyint_innodb.test #
+# #
+# Purpose: #
+# Tests around integer type #
+# INNODB branch #
+# #
+#------------------------------------------------------------------------------#
+# Original Author: HH #
+# Original Date: 2006-08-01 #
+# Change Author: Elena Stepanova #
+# Change Date: 2017-02-18 #
+# Change: The test file is spawned from the mega-test partition_int_innodb #
+################################################################################
+
+#
+# NOTE: PLEASE DO NOT ADD NOT INNODB SPECIFIC TESTCASES HERE !
+# TESTCASES WHICH MUST BE APPLIED TO ALL STORAGE ENGINES MUST BE ADDED IN
+# THE SOURCED FILES ONLY.
+#
+# Please read the README at the end of inc/partition.pre before changing
+# any of the variables.
+#
+
+#------------------------------------------------------------------------------#
+# General not engine specific settings and requirements
+
+##### Options, for debugging support #####
+let $debug= 0;
+
+# The server must support partitioning.
+--source include/have_partition.inc
+
+#------------------------------------------------------------------------------#
+# Engine specific settings and requirements
+
+##### Storage engine to be tested
+--source include/have_innodb.inc
+let $engine= 'InnoDB';
+
+##### max rows to be inserted
+let $maxrows=1024;
+
+#------------------------------------------------------------------------------#
+# Execute the tests to be applied to all storage engines
+--source suite/parts/inc/partition_tinyint.inc
diff --git a/mysql-test/suite/parts/t/partition_tinyint_myisam.test b/mysql-test/suite/parts/t/partition_tinyint_myisam.test
new file mode 100644
index 00000000000..9807bffb1da
--- /dev/null
+++ b/mysql-test/suite/parts/t/partition_tinyint_myisam.test
@@ -0,0 +1,46 @@
+################################################################################
+# t/partition_tinyint_myisam.test #
+# #
+# Purpose: #
+# Tests around integer type #
+# MyISAM branch #
+# #
+#------------------------------------------------------------------------------#
+# Original Author: HH #
+# Original Date: 2006-08-01 #
+# Change Author: Elena Stepanova #
+# Change Date: 2017-02-18 #
+# Change: The test file is spawned from the mega-test partition_int_myisam #
+################################################################################
+
+#
+# NOTE: PLEASE DO NOT ADD NOT MYISAM SPECIFIC TESTCASES HERE !
+# TESTCASES WHICH MUST BE APPLIED TO ALL STORAGE ENGINES MUST BE ADDED IN
+# THE SOURCED FILES ONLY.
+#
+# Please read the README at the end of inc/partition.pre before changing
+# any of the variables.
+#
+
+--source include/long_test.inc
+
+#------------------------------------------------------------------------------#
+# General not engine specific settings and requirements
+
+##### Options, for debugging support #####
+let $debug= 0;
+
+# The server must support partitioning.
+--source include/have_partition.inc
+
+#------------------------------------------------------------------------------#
+# Engine specific settings and requirements
+
+##### Storage engine to be tested
+let $engine= 'MYISAM';
+##### number of rows to be inserted
+let $maxrows=65535;
+
+#------------------------------------------------------------------------------#
+# Execute the tests to be applied to all storage engines
+--source suite/parts/inc/partition_tinyint.inc
diff --git a/mysql-test/suite/perfschema/include/pfs_no_running_event_scheduler.inc b/mysql-test/suite/perfschema/include/pfs_no_running_event_scheduler.inc
new file mode 100644
index 00000000000..eff3d7df854
--- /dev/null
+++ b/mysql-test/suite/perfschema/include/pfs_no_running_event_scheduler.inc
@@ -0,0 +1,10 @@
+# threads are removed from:
+# - information_schema.processlist
+# - performance_schema.threads
+# at different times, so we may have to wait a little more
+# for the event_scheduler to shutdown
+#
+let $wait_condition=
+ SELECT COUNT(*) = 0 FROM performance_schema.threads
+ WHERE name like 'thread/sql/event%';
+--source include/wait_condition.inc
diff --git a/mysql-test/suite/perfschema/include/pfs_running_event_scheduler.inc b/mysql-test/suite/perfschema/include/pfs_running_event_scheduler.inc
new file mode 100644
index 00000000000..219a41051fb
--- /dev/null
+++ b/mysql-test/suite/perfschema/include/pfs_running_event_scheduler.inc
@@ -0,0 +1,10 @@
+# threads are removed from:
+# - information_schema.processlist
+# - performance_schema.threads
+# at different times, so we may have to wait a little more
+# for the event_scheduler to shutdown
+#
+let $wait_condition=
+ SELECT COUNT(*) = 1 FROM performance_schema.threads
+ WHERE name like 'thread/sql/event%';
+--source include/wait_condition.inc
diff --git a/mysql-test/suite/perfschema/include/table_io_result_helper.inc b/mysql-test/suite/perfschema/include/table_io_result_helper.inc
index 789f7135a1a..4732806488e 100644
--- a/mysql-test/suite/perfschema/include/table_io_result_helper.inc
+++ b/mysql-test/suite/perfschema/include/table_io_result_helper.inc
@@ -14,7 +14,8 @@ eval select event_name,
order by thread_id, event_id;
# In case of failures, this will tell if table io are lost.
-show status like 'performance_schema_%';
+show status where Variable_name like 'performance_schema_%' and
+ Variable_name not like 'performance_schema_%_classes_lost';
# Cleanup
truncate performance_schema.events_waits_history_long;
diff --git a/mysql-test/suite/perfschema/include/upgrade_check.inc b/mysql-test/suite/perfschema/include/upgrade_check.inc
index 327d63cc633..79a81311b05 100644
--- a/mysql-test/suite/perfschema/include/upgrade_check.inc
+++ b/mysql-test/suite/perfschema/include/upgrade_check.inc
@@ -3,15 +3,14 @@
#
--source include/count_sessions.inc
---exec $MYSQL_UPGRADE --skip-verbose --force > $out_file 2> $err_file
+--exec $MYSQL_UPGRADE --skip-verbose --force > $MYSQLTEST_VARDIR/tmp/out_file 2> $MYSQLTEST_VARDIR/tmp/err_file
--source include/wait_until_count_sessions.inc
# Verify that mysql_upgrade does not complain about the performance_schema
--replace_regex /at line [0-9]+/at line ###/
---cat_file $err_file
---error 0,1
---remove_file $out_file
---error 0,1
---remove_file $err_file
+--cat_file $MYSQLTEST_VARDIR/tmp/err_file
+--remove_file $MYSQLTEST_VARDIR/tmp/out_file
+--remove_file $MYSQLTEST_VARDIR/tmp/err_file
+--remove_file $MYSQLD_DATADIR/mysql_upgrade_info
diff --git a/mysql-test/suite/perfschema/r/csv_table_io.result b/mysql-test/suite/perfschema/r/csv_table_io.result
index f0b5a6bb935..84b39119dd8 100644
--- a/mysql-test/suite/perfschema/r/csv_table_io.result
+++ b/mysql-test/suite/perfschema/r/csv_table_io.result
@@ -111,29 +111,22 @@ wait/io/table/sql/handler handler.cc: TABLE test no_index_tab fetch NULL
wait/io/table/sql/handler handler.cc: TABLE test no_index_tab fetch NULL
wait/io/table/sql/handler handler.cc: TABLE test marker insert NULL
wait/io/table/sql/handler handler.cc: TABLE test marker insert NULL
-show status like 'performance_schema_%';
+show status where Variable_name like 'performance_schema_%' and
+Variable_name not like 'performance_schema_%_classes_lost';
Variable_name Value
Performance_schema_accounts_lost 0
-Performance_schema_cond_classes_lost 0
Performance_schema_cond_instances_lost 0
Performance_schema_digest_lost 0
-Performance_schema_file_classes_lost 0
Performance_schema_file_handles_lost 0
Performance_schema_file_instances_lost 0
Performance_schema_hosts_lost 0
Performance_schema_locker_lost 0
-Performance_schema_mutex_classes_lost 0
Performance_schema_mutex_instances_lost 0
-Performance_schema_rwlock_classes_lost 0
Performance_schema_rwlock_instances_lost 0
Performance_schema_session_connect_attrs_lost 0
-Performance_schema_socket_classes_lost 0
Performance_schema_socket_instances_lost 0
-Performance_schema_stage_classes_lost 0
-Performance_schema_statement_classes_lost 0
Performance_schema_table_handles_lost 0
Performance_schema_table_instances_lost 0
-Performance_schema_thread_classes_lost 0
Performance_schema_thread_instances_lost 0
Performance_schema_users_lost 0
truncate performance_schema.events_waits_history_long;
diff --git a/mysql-test/suite/perfschema/r/innodb_table_io.result b/mysql-test/suite/perfschema/r/innodb_table_io.result
index 460518aeb65..c37c1035e5a 100644
--- a/mysql-test/suite/perfschema/r/innodb_table_io.result
+++ b/mysql-test/suite/perfschema/r/innodb_table_io.result
@@ -112,29 +112,22 @@ wait/io/table/sql/handler handler.cc: TABLE test no_index_tab fetch NULL
wait/io/table/sql/handler handler.cc: TABLE test no_index_tab fetch NULL
wait/io/table/sql/handler handler.cc: TABLE test marker insert NULL
wait/io/table/sql/handler handler.cc: TABLE test marker insert NULL
-show status like 'performance_schema_%';
+show status where Variable_name like 'performance_schema_%' and
+Variable_name not like 'performance_schema_%_classes_lost';
Variable_name Value
Performance_schema_accounts_lost 0
-Performance_schema_cond_classes_lost 0
Performance_schema_cond_instances_lost 0
Performance_schema_digest_lost 0
-Performance_schema_file_classes_lost 0
Performance_schema_file_handles_lost 0
Performance_schema_file_instances_lost 0
Performance_schema_hosts_lost 0
Performance_schema_locker_lost 0
-Performance_schema_mutex_classes_lost 0
Performance_schema_mutex_instances_lost 0
-Performance_schema_rwlock_classes_lost 0
Performance_schema_rwlock_instances_lost 0
Performance_schema_session_connect_attrs_lost 0
-Performance_schema_socket_classes_lost 0
Performance_schema_socket_instances_lost 0
-Performance_schema_stage_classes_lost 0
-Performance_schema_statement_classes_lost 0
Performance_schema_table_handles_lost 0
Performance_schema_table_instances_lost 0
-Performance_schema_thread_classes_lost 0
Performance_schema_thread_instances_lost 0
Performance_schema_users_lost 0
truncate performance_schema.events_waits_history_long;
diff --git a/mysql-test/suite/perfschema/r/memory_table_io.result b/mysql-test/suite/perfschema/r/memory_table_io.result
index 230de713846..7942015f618 100644
--- a/mysql-test/suite/perfschema/r/memory_table_io.result
+++ b/mysql-test/suite/perfschema/r/memory_table_io.result
@@ -113,29 +113,22 @@ wait/io/table/sql/handler handler.cc: TABLE test no_index_tab fetch NULL
wait/io/table/sql/handler handler.cc: TABLE test no_index_tab fetch NULL
wait/io/table/sql/handler handler.cc: TABLE test marker insert NULL
wait/io/table/sql/handler handler.cc: TABLE test marker insert NULL
-show status like 'performance_schema_%';
+show status where Variable_name like 'performance_schema_%' and
+Variable_name not like 'performance_schema_%_classes_lost';
Variable_name Value
Performance_schema_accounts_lost 0
-Performance_schema_cond_classes_lost 0
Performance_schema_cond_instances_lost 0
Performance_schema_digest_lost 0
-Performance_schema_file_classes_lost 0
Performance_schema_file_handles_lost 0
Performance_schema_file_instances_lost 0
Performance_schema_hosts_lost 0
Performance_schema_locker_lost 0
-Performance_schema_mutex_classes_lost 0
Performance_schema_mutex_instances_lost 0
-Performance_schema_rwlock_classes_lost 0
Performance_schema_rwlock_instances_lost 0
Performance_schema_session_connect_attrs_lost 0
-Performance_schema_socket_classes_lost 0
Performance_schema_socket_instances_lost 0
-Performance_schema_stage_classes_lost 0
-Performance_schema_statement_classes_lost 0
Performance_schema_table_handles_lost 0
Performance_schema_table_instances_lost 0
-Performance_schema_thread_classes_lost 0
Performance_schema_thread_instances_lost 0
Performance_schema_users_lost 0
truncate performance_schema.events_waits_history_long;
diff --git a/mysql-test/suite/perfschema/r/merge_table_io.result b/mysql-test/suite/perfschema/r/merge_table_io.result
index 7f0b602778c..d390ba67b5f 100644
--- a/mysql-test/suite/perfschema/r/merge_table_io.result
+++ b/mysql-test/suite/perfschema/r/merge_table_io.result
@@ -143,29 +143,22 @@ wait/io/table/sql/handler handler.cc: TABLE test marker insert NULL
wait/io/table/sql/handler handler.cc: TABLE test marker insert NULL
wait/io/table/sql/handler handler.cc: TABLE test marker insert NULL
wait/io/table/sql/handler handler.cc: TABLE test marker insert NULL
-show status like 'performance_schema_%';
+show status where Variable_name like 'performance_schema_%' and
+Variable_name not like 'performance_schema_%_classes_lost';
Variable_name Value
Performance_schema_accounts_lost 0
-Performance_schema_cond_classes_lost 0
Performance_schema_cond_instances_lost 0
Performance_schema_digest_lost 0
-Performance_schema_file_classes_lost 0
Performance_schema_file_handles_lost 0
Performance_schema_file_instances_lost 0
Performance_schema_hosts_lost 0
Performance_schema_locker_lost 0
-Performance_schema_mutex_classes_lost 0
Performance_schema_mutex_instances_lost 0
-Performance_schema_rwlock_classes_lost 0
Performance_schema_rwlock_instances_lost 0
Performance_schema_session_connect_attrs_lost 0
-Performance_schema_socket_classes_lost 0
Performance_schema_socket_instances_lost 0
-Performance_schema_stage_classes_lost 0
-Performance_schema_statement_classes_lost 0
Performance_schema_table_handles_lost 0
Performance_schema_table_instances_lost 0
-Performance_schema_thread_classes_lost 0
Performance_schema_thread_instances_lost 0
Performance_schema_users_lost 0
truncate performance_schema.events_waits_history_long;
diff --git a/mysql-test/suite/perfschema/r/multi_table_io.result b/mysql-test/suite/perfschema/r/multi_table_io.result
index 74c8b94c1d5..929e1791c61 100644
--- a/mysql-test/suite/perfschema/r/multi_table_io.result
+++ b/mysql-test/suite/perfschema/r/multi_table_io.result
@@ -72,29 +72,22 @@ wait/io/table/sql/handler handler.cc: TABLE test1 t2 fetch NULL
wait/io/table/sql/handler handler.cc: TABLE test t1 delete NULL
wait/io/table/sql/handler handler.cc: TABLE test1 t2 fetch NULL
wait/io/table/sql/handler handler.cc: TABLE test1 t2 delete NULL
-show status like 'performance_schema_%';
+show status where Variable_name like 'performance_schema_%' and
+Variable_name not like 'performance_schema_%_classes_lost';
Variable_name Value
Performance_schema_accounts_lost 0
-Performance_schema_cond_classes_lost 0
Performance_schema_cond_instances_lost 0
Performance_schema_digest_lost 0
-Performance_schema_file_classes_lost 0
Performance_schema_file_handles_lost 0
Performance_schema_file_instances_lost 0
Performance_schema_hosts_lost 0
Performance_schema_locker_lost 0
-Performance_schema_mutex_classes_lost 0
Performance_schema_mutex_instances_lost 0
-Performance_schema_rwlock_classes_lost 0
Performance_schema_rwlock_instances_lost 0
Performance_schema_session_connect_attrs_lost 0
-Performance_schema_socket_classes_lost 0
Performance_schema_socket_instances_lost 0
-Performance_schema_stage_classes_lost 0
-Performance_schema_statement_classes_lost 0
Performance_schema_table_handles_lost 0
Performance_schema_table_instances_lost 0
-Performance_schema_thread_classes_lost 0
Performance_schema_thread_instances_lost 0
Performance_schema_users_lost 0
truncate performance_schema.events_waits_history_long;
diff --git a/mysql-test/suite/perfschema/r/myisam_table_io.result b/mysql-test/suite/perfschema/r/myisam_table_io.result
index 432e5964802..97a099581d4 100644
--- a/mysql-test/suite/perfschema/r/myisam_table_io.result
+++ b/mysql-test/suite/perfschema/r/myisam_table_io.result
@@ -111,29 +111,22 @@ wait/io/table/sql/handler handler.cc: TABLE test no_index_tab fetch NULL
wait/io/table/sql/handler handler.cc: TABLE test no_index_tab fetch NULL
wait/io/table/sql/handler handler.cc: TABLE test marker insert NULL
wait/io/table/sql/handler handler.cc: TABLE test marker insert NULL
-show status like 'performance_schema_%';
+show status where Variable_name like 'performance_schema_%' and
+Variable_name not like 'performance_schema_%_classes_lost';
Variable_name Value
Performance_schema_accounts_lost 0
-Performance_schema_cond_classes_lost 0
Performance_schema_cond_instances_lost 0
Performance_schema_digest_lost 0
-Performance_schema_file_classes_lost 0
Performance_schema_file_handles_lost 0
Performance_schema_file_instances_lost 0
Performance_schema_hosts_lost 0
Performance_schema_locker_lost 0
-Performance_schema_mutex_classes_lost 0
Performance_schema_mutex_instances_lost 0
-Performance_schema_rwlock_classes_lost 0
Performance_schema_rwlock_instances_lost 0
Performance_schema_session_connect_attrs_lost 0
-Performance_schema_socket_classes_lost 0
Performance_schema_socket_instances_lost 0
-Performance_schema_stage_classes_lost 0
-Performance_schema_statement_classes_lost 0
Performance_schema_table_handles_lost 0
Performance_schema_table_instances_lost 0
-Performance_schema_thread_classes_lost 0
Performance_schema_thread_instances_lost 0
Performance_schema_users_lost 0
truncate performance_schema.events_waits_history_long;
diff --git a/mysql-test/suite/perfschema/r/part_table_io.result b/mysql-test/suite/perfschema/r/part_table_io.result
index 0fd8653734d..1958801d8d2 100644
--- a/mysql-test/suite/perfschema/r/part_table_io.result
+++ b/mysql-test/suite/perfschema/r/part_table_io.result
@@ -113,29 +113,22 @@ wait/io/table/sql/handler handler.cc: TABLE test no_index_tab fetch NULL
wait/io/table/sql/handler handler.cc: TABLE test no_index_tab fetch NULL
wait/io/table/sql/handler handler.cc: TABLE test marker insert NULL
wait/io/table/sql/handler handler.cc: TABLE test marker insert NULL
-show status like 'performance_schema_%';
+show status where Variable_name like 'performance_schema_%' and
+Variable_name not like 'performance_schema_%_classes_lost';
Variable_name Value
Performance_schema_accounts_lost 0
-Performance_schema_cond_classes_lost 0
Performance_schema_cond_instances_lost 0
Performance_schema_digest_lost 0
-Performance_schema_file_classes_lost 0
Performance_schema_file_handles_lost 0
Performance_schema_file_instances_lost 0
Performance_schema_hosts_lost 0
Performance_schema_locker_lost 0
-Performance_schema_mutex_classes_lost 0
Performance_schema_mutex_instances_lost 0
-Performance_schema_rwlock_classes_lost 0
Performance_schema_rwlock_instances_lost 0
Performance_schema_session_connect_attrs_lost 0
-Performance_schema_socket_classes_lost 0
Performance_schema_socket_instances_lost 0
-Performance_schema_stage_classes_lost 0
-Performance_schema_statement_classes_lost 0
Performance_schema_table_handles_lost 0
Performance_schema_table_instances_lost 0
-Performance_schema_thread_classes_lost 0
Performance_schema_thread_instances_lost 0
Performance_schema_users_lost 0
truncate performance_schema.events_waits_history_long;
diff --git a/mysql-test/suite/perfschema/r/pfs_upgrade_event.result b/mysql-test/suite/perfschema/r/pfs_upgrade_event.result
index 6397ef7d90c..2bcebe06e96 100644
--- a/mysql-test/suite/perfschema/r/pfs_upgrade_event.result
+++ b/mysql-test/suite/perfschema/r/pfs_upgrade_event.result
@@ -1,4 +1,3 @@
-drop event if exists test.user_event;
"Testing mysql_upgrade with EVENT performance_schema.user_event"
create event test.user_event on schedule every 1 day do
select "not supposed to be here";
diff --git a/mysql-test/suite/perfschema/r/pfs_upgrade_func.result b/mysql-test/suite/perfschema/r/pfs_upgrade_func.result
index e03b526b045..b91cb5d14a8 100644
--- a/mysql-test/suite/perfschema/r/pfs_upgrade_func.result
+++ b/mysql-test/suite/perfschema/r/pfs_upgrade_func.result
@@ -1,4 +1,3 @@
-drop function if exists test.user_func;
"Testing mysql_upgrade with FUNCTION performance_schema.user_func"
create function test.user_func() returns integer
return 0;
diff --git a/mysql-test/suite/perfschema/r/pfs_upgrade_proc.result b/mysql-test/suite/perfschema/r/pfs_upgrade_proc.result
index 95e0943d326..651bc506eee 100644
--- a/mysql-test/suite/perfschema/r/pfs_upgrade_proc.result
+++ b/mysql-test/suite/perfschema/r/pfs_upgrade_proc.result
@@ -1,4 +1,3 @@
-drop procedure if exists test.user_proc;
"Testing mysql_upgrade with PROCEDURE performance_schema.user_proc"
create procedure test.user_proc()
select "Not supposed to be here";
diff --git a/mysql-test/suite/perfschema/r/pfs_upgrade_table.result b/mysql-test/suite/perfschema/r/pfs_upgrade_table.result
index a5f5ad5ae17..5ff608a825f 100644
--- a/mysql-test/suite/perfschema/r/pfs_upgrade_table.result
+++ b/mysql-test/suite/perfschema/r/pfs_upgrade_table.result
@@ -1,4 +1,3 @@
-drop table if exists test.user_table;
"Testing mysql_upgrade with TABLE performance_schema.user_table"
create table test.user_table(a int);
use performance_schema;
diff --git a/mysql-test/suite/perfschema/r/pfs_upgrade_view.result b/mysql-test/suite/perfschema/r/pfs_upgrade_view.result
index 3c6df20a62c..14a1d8deae4 100644
--- a/mysql-test/suite/perfschema/r/pfs_upgrade_view.result
+++ b/mysql-test/suite/perfschema/r/pfs_upgrade_view.result
@@ -1,4 +1,3 @@
-drop view if exists test.user_view;
"Testing mysql_upgrade with VIEW performance_schema.user_view"
create view test.user_view as select "Not supposed to be here";
use performance_schema;
diff --git a/mysql-test/suite/perfschema/r/privilege_table_io.result b/mysql-test/suite/perfschema/r/privilege_table_io.result
index aeacd0ba011..ea5fb2bc703 100644
--- a/mysql-test/suite/perfschema/r/privilege_table_io.result
+++ b/mysql-test/suite/perfschema/r/privilege_table_io.result
@@ -114,29 +114,22 @@ wait/io/table/sql/handler handler.cc: TABLE mysql servers fetch NULL
wait/io/table/sql/handler handler.cc: TABLE test marker insert NULL
wait/io/table/sql/handler handler.cc: TABLE test marker insert NULL
wait/io/table/sql/handler handler.cc: TABLE test marker insert NULL
-show status like 'performance_schema_%';
+show status where Variable_name like 'performance_schema_%' and
+Variable_name not like 'performance_schema_%_classes_lost';
Variable_name Value
Performance_schema_accounts_lost 0
-Performance_schema_cond_classes_lost 0
Performance_schema_cond_instances_lost 0
Performance_schema_digest_lost 0
-Performance_schema_file_classes_lost 0
Performance_schema_file_handles_lost 0
Performance_schema_file_instances_lost 0
Performance_schema_hosts_lost 0
Performance_schema_locker_lost 0
-Performance_schema_mutex_classes_lost 0
Performance_schema_mutex_instances_lost 0
-Performance_schema_rwlock_classes_lost 0
Performance_schema_rwlock_instances_lost 0
Performance_schema_session_connect_attrs_lost 0
-Performance_schema_socket_classes_lost 0
Performance_schema_socket_instances_lost 0
-Performance_schema_stage_classes_lost 0
-Performance_schema_statement_classes_lost 0
Performance_schema_table_handles_lost 0
Performance_schema_table_instances_lost 0
-Performance_schema_thread_classes_lost 0
Performance_schema_thread_instances_lost 0
Performance_schema_users_lost 0
truncate performance_schema.events_waits_history_long;
diff --git a/mysql-test/suite/perfschema/r/rollback_table_io.result b/mysql-test/suite/perfschema/r/rollback_table_io.result
index f08d11e21d8..a9cc5b1da39 100644
--- a/mysql-test/suite/perfschema/r/rollback_table_io.result
+++ b/mysql-test/suite/perfschema/r/rollback_table_io.result
@@ -54,29 +54,22 @@ wait/io/table/sql/handler handler.cc: TABLE test marker insert NULL
wait/io/table/sql/handler handler.cc: TABLE test marker insert NULL
wait/io/table/sql/handler handler.cc: TABLE test t1 insert NULL
wait/io/table/sql/handler handler.cc: TABLE test marker insert NULL
-show status like 'performance_schema_%';
+show status where Variable_name like 'performance_schema_%' and
+Variable_name not like 'performance_schema_%_classes_lost';
Variable_name Value
Performance_schema_accounts_lost 0
-Performance_schema_cond_classes_lost 0
Performance_schema_cond_instances_lost 0
Performance_schema_digest_lost 0
-Performance_schema_file_classes_lost 0
Performance_schema_file_handles_lost 0
Performance_schema_file_instances_lost 0
Performance_schema_hosts_lost 0
Performance_schema_locker_lost 0
-Performance_schema_mutex_classes_lost 0
Performance_schema_mutex_instances_lost 0
-Performance_schema_rwlock_classes_lost 0
Performance_schema_rwlock_instances_lost 0
Performance_schema_session_connect_attrs_lost 0
-Performance_schema_socket_classes_lost 0
Performance_schema_socket_instances_lost 0
-Performance_schema_stage_classes_lost 0
-Performance_schema_statement_classes_lost 0
Performance_schema_table_handles_lost 0
Performance_schema_table_instances_lost 0
-Performance_schema_thread_classes_lost 0
Performance_schema_thread_instances_lost 0
Performance_schema_users_lost 0
truncate performance_schema.events_waits_history_long;
diff --git a/mysql-test/suite/perfschema/r/temp_table_io.result b/mysql-test/suite/perfschema/r/temp_table_io.result
index c5de365dbf4..0e1bf01ef9a 100644
--- a/mysql-test/suite/perfschema/r/temp_table_io.result
+++ b/mysql-test/suite/perfschema/r/temp_table_io.result
@@ -84,29 +84,22 @@ wait/io/table/sql/handler handler.cc: TABLE test marker insert NULL
wait/io/table/sql/handler handler.cc: TABLE test marker insert NULL
wait/io/table/sql/handler handler.cc: TABLE test marker insert NULL
wait/io/table/sql/handler handler.cc: TABLE test marker insert NULL
-show status like 'performance_schema_%';
+show status where Variable_name like 'performance_schema_%' and
+Variable_name not like 'performance_schema_%_classes_lost';
Variable_name Value
Performance_schema_accounts_lost 0
-Performance_schema_cond_classes_lost 0
Performance_schema_cond_instances_lost 0
Performance_schema_digest_lost 0
-Performance_schema_file_classes_lost 0
Performance_schema_file_handles_lost 0
Performance_schema_file_instances_lost 0
Performance_schema_hosts_lost 0
Performance_schema_locker_lost 0
-Performance_schema_mutex_classes_lost 0
Performance_schema_mutex_instances_lost 0
-Performance_schema_rwlock_classes_lost 0
Performance_schema_rwlock_instances_lost 0
Performance_schema_session_connect_attrs_lost 0
-Performance_schema_socket_classes_lost 0
Performance_schema_socket_instances_lost 0
-Performance_schema_stage_classes_lost 0
-Performance_schema_statement_classes_lost 0
Performance_schema_table_handles_lost 0
Performance_schema_table_instances_lost 0
-Performance_schema_thread_classes_lost 0
Performance_schema_thread_instances_lost 0
Performance_schema_users_lost 0
truncate performance_schema.events_waits_history_long;
diff --git a/mysql-test/suite/perfschema/r/trigger_table_io.result b/mysql-test/suite/perfschema/r/trigger_table_io.result
index e77e7d864f1..9fc63e69675 100644
--- a/mysql-test/suite/perfschema/r/trigger_table_io.result
+++ b/mysql-test/suite/perfschema/r/trigger_table_io.result
@@ -169,29 +169,22 @@ wait/io/table/sql/handler handler.cc: TABLE test marker insert NULL
wait/io/table/sql/handler handler.cc: TABLE test t2 fetch NULL
wait/io/table/sql/handler handler.cc: TABLE test t2 fetch NULL
wait/io/table/sql/handler handler.cc: TABLE test t2 fetch NULL
-show status like 'performance_schema_%';
+show status where Variable_name like 'performance_schema_%' and
+Variable_name not like 'performance_schema_%_classes_lost';
Variable_name Value
Performance_schema_accounts_lost 0
-Performance_schema_cond_classes_lost 0
Performance_schema_cond_instances_lost 0
Performance_schema_digest_lost 0
-Performance_schema_file_classes_lost 0
Performance_schema_file_handles_lost 0
Performance_schema_file_instances_lost 0
Performance_schema_hosts_lost 0
Performance_schema_locker_lost 0
-Performance_schema_mutex_classes_lost 0
Performance_schema_mutex_instances_lost 0
-Performance_schema_rwlock_classes_lost 0
Performance_schema_rwlock_instances_lost 0
Performance_schema_session_connect_attrs_lost 0
-Performance_schema_socket_classes_lost 0
Performance_schema_socket_instances_lost 0
-Performance_schema_stage_classes_lost 0
-Performance_schema_statement_classes_lost 0
Performance_schema_table_handles_lost 0
Performance_schema_table_instances_lost 0
-Performance_schema_thread_classes_lost 0
Performance_schema_thread_instances_lost 0
Performance_schema_users_lost 0
truncate performance_schema.events_waits_history_long;
diff --git a/mysql-test/suite/perfschema/r/view_table_io.result b/mysql-test/suite/perfschema/r/view_table_io.result
index db6acf65c73..5d8ad26ae77 100644
--- a/mysql-test/suite/perfschema/r/view_table_io.result
+++ b/mysql-test/suite/perfschema/r/view_table_io.result
@@ -120,29 +120,22 @@ wait/io/table/sql/handler handler.cc: TABLE test no_index_tab fetch NULL
wait/io/table/sql/handler handler.cc: TABLE test marker insert NULL
wait/io/table/sql/handler handler.cc: TABLE test marker insert NULL
wait/io/table/sql/handler handler.cc: TABLE test marker insert NULL
-show status like 'performance_schema_%';
+show status where Variable_name like 'performance_schema_%' and
+Variable_name not like 'performance_schema_%_classes_lost';
Variable_name Value
Performance_schema_accounts_lost 0
-Performance_schema_cond_classes_lost 0
Performance_schema_cond_instances_lost 0
Performance_schema_digest_lost 0
-Performance_schema_file_classes_lost 0
Performance_schema_file_handles_lost 0
Performance_schema_file_instances_lost 0
Performance_schema_hosts_lost 0
Performance_schema_locker_lost 0
-Performance_schema_mutex_classes_lost 0
Performance_schema_mutex_instances_lost 0
-Performance_schema_rwlock_classes_lost 0
Performance_schema_rwlock_instances_lost 0
Performance_schema_session_connect_attrs_lost 0
-Performance_schema_socket_classes_lost 0
Performance_schema_socket_instances_lost 0
-Performance_schema_stage_classes_lost 0
-Performance_schema_statement_classes_lost 0
Performance_schema_table_handles_lost 0
Performance_schema_table_instances_lost 0
-Performance_schema_thread_classes_lost 0
Performance_schema_thread_instances_lost 0
Performance_schema_users_lost 0
truncate performance_schema.events_waits_history_long;
diff --git a/mysql-test/suite/perfschema/t/pfs_upgrade_event.test b/mysql-test/suite/perfschema/t/pfs_upgrade_event.test
index db7613052d4..f16a073f212 100644
--- a/mysql-test/suite/perfschema/t/pfs_upgrade_event.test
+++ b/mysql-test/suite/perfschema/t/pfs_upgrade_event.test
@@ -7,18 +7,7 @@
--source include/have_perfschema.inc
--source include/have_innodb.inc
-# Some initial settings + Preemptive cleanup
let $MYSQLD_DATADIR= `SELECT @@datadir`;
-let $err_file= $MYSQLTEST_VARDIR/tmp/pfs_upgrade_event.err;
-let $out_file= $MYSQLTEST_VARDIR/tmp/pfs_upgrade_event.out;
---error 0,1
---remove_file $out_file
---error 0,1
---remove_file $err_file
-
---disable_warnings
-drop event if exists test.user_event;
---enable_warnings
--echo "Testing mysql_upgrade with EVENT performance_schema.user_event"
@@ -33,4 +22,3 @@ select name from mysql.event where db='performance_schema';
update mysql.event set db='test' where name='user_event';
drop event test.user_event;
-
diff --git a/mysql-test/suite/perfschema/t/pfs_upgrade_func.test b/mysql-test/suite/perfschema/t/pfs_upgrade_func.test
index 4f53aa1bdd1..da2bc371308 100644
--- a/mysql-test/suite/perfschema/t/pfs_upgrade_func.test
+++ b/mysql-test/suite/perfschema/t/pfs_upgrade_func.test
@@ -7,18 +7,7 @@
--source include/have_perfschema.inc
--source include/have_innodb.inc
-# Some initial settings + Preemptive cleanup
let $MYSQLD_DATADIR= `SELECT @@datadir`;
-let $err_file= $MYSQLTEST_VARDIR/tmp/pfs_upgrade_func.err;
-let $out_file= $MYSQLTEST_VARDIR/tmp/pfs_upgrade_func.out;
---error 0,1
---remove_file $out_file
---error 0,1
---remove_file $err_file
-
---disable_warnings
-drop function if exists test.user_func;
---enable_warnings
--echo "Testing mysql_upgrade with FUNCTION performance_schema.user_func"
@@ -33,4 +22,3 @@ select name from mysql.proc where db='performance_schema';
update mysql.proc set db='test' where name='user_func';
drop function test.user_func;
-
diff --git a/mysql-test/suite/perfschema/t/pfs_upgrade_proc.test b/mysql-test/suite/perfschema/t/pfs_upgrade_proc.test
index 432cee6fb1a..99e0816ccbd 100644
--- a/mysql-test/suite/perfschema/t/pfs_upgrade_proc.test
+++ b/mysql-test/suite/perfschema/t/pfs_upgrade_proc.test
@@ -7,18 +7,7 @@
--source include/have_perfschema.inc
--source include/have_innodb.inc
-# Some initial settings + Preemptive cleanup
let $MYSQLD_DATADIR= `SELECT @@datadir`;
-let $err_file= $MYSQLTEST_VARDIR/tmp/pfs_upgrade_proc.err;
-let $out_file= $MYSQLTEST_VARDIR/tmp/pfs_upgrade_proc.out;
---error 0,1
---remove_file $out_file
---error 0,1
---remove_file $err_file
-
---disable_warnings
-drop procedure if exists test.user_proc;
---enable_warnings
--echo "Testing mysql_upgrade with PROCEDURE performance_schema.user_proc"
@@ -33,4 +22,3 @@ select name from mysql.proc where db='performance_schema';
update mysql.proc set db='test' where name='user_proc';
drop procedure test.user_proc;
-
diff --git a/mysql-test/suite/perfschema/t/pfs_upgrade_table.test b/mysql-test/suite/perfschema/t/pfs_upgrade_table.test
index c68e156a2db..897ec23c552 100644
--- a/mysql-test/suite/perfschema/t/pfs_upgrade_table.test
+++ b/mysql-test/suite/perfschema/t/pfs_upgrade_table.test
@@ -7,25 +7,12 @@
--source include/have_perfschema.inc
--source include/have_innodb.inc
-# Some initial settings + Preemptive cleanup
let $MYSQLD_DATADIR= `SELECT @@datadir`;
-let $err_file= $MYSQLTEST_VARDIR/tmp/pfs_upgrade_table.err;
-let $out_file= $MYSQLTEST_VARDIR/tmp/pfs_upgrade_table.out;
---error 0,1
---remove_file $out_file
---error 0,1
---remove_file $err_file
-
---disable_warnings
-drop table if exists test.user_table;
---enable_warnings
--echo "Testing mysql_upgrade with TABLE performance_schema.user_table"
create table test.user_table(a int);
---error 0,1
---remove_file $MYSQLD_DATADIR/performance_schema/user_table.frm
--copy_file $MYSQLD_DATADIR/test/user_table.frm $MYSQLD_DATADIR/performance_schema/user_table.frm
# Make sure the table is visible
@@ -41,4 +28,3 @@ use test;
--remove_file $MYSQLD_DATADIR/performance_schema/user_table.frm
drop table test.user_table;
-
diff --git a/mysql-test/suite/perfschema/t/pfs_upgrade_view.test b/mysql-test/suite/perfschema/t/pfs_upgrade_view.test
index 38ce377f235..0c9af73a1d4 100644
--- a/mysql-test/suite/perfschema/t/pfs_upgrade_view.test
+++ b/mysql-test/suite/perfschema/t/pfs_upgrade_view.test
@@ -7,25 +7,12 @@
--source include/have_perfschema.inc
--source include/have_innodb.inc
-# Some initial settings + Preemptive cleanup
let $MYSQLD_DATADIR= `SELECT @@datadir`;
-let $err_file= $MYSQLTEST_VARDIR/tmp/pfs_upgrade_view.err;
-let $out_file= $MYSQLTEST_VARDIR/tmp/pfs_upgrade_view.out;
---error 0,1
---remove_file $out_file
---error 0,1
---remove_file $err_file
-
---disable_warnings
-drop view if exists test.user_view;
---enable_warnings
--echo "Testing mysql_upgrade with VIEW performance_schema.user_view"
create view test.user_view as select "Not supposed to be here";
---error 0,1
---remove_file $MYSQLD_DATADIR/performance_schema/user_view.frm
--copy_file $MYSQLD_DATADIR/test/user_view.frm $MYSQLD_DATADIR/performance_schema/user_view.frm
# Make sure the view is visible
@@ -41,4 +28,3 @@ use test;
--remove_file $MYSQLD_DATADIR/performance_schema/user_view.frm
drop view test.user_view;
-
diff --git a/mysql-test/suite/perfschema/t/table_name.test b/mysql-test/suite/perfschema/t/table_name.test
index a8179f2d1f8..5fb8ccd0f7f 100644
--- a/mysql-test/suite/perfschema/t/table_name.test
+++ b/mysql-test/suite/perfschema/t/table_name.test
@@ -31,6 +31,7 @@ INSERT INTO `sql_1` VALUES(1,'one');
--echo
--echo # Verify that the tables are treated as normal tables .
--echo
+--sorted_result
SELECT object_type, object_schema, object_name
FROM performance_schema.objects_summary_global_by_type
WHERE object_schema="test";
diff --git a/mysql-test/suite/perfschema/t/threads_mysql.test b/mysql-test/suite/perfschema/t/threads_mysql.test
index 8576c8767d6..c33f421863e 100644
--- a/mysql-test/suite/perfschema/t/threads_mysql.test
+++ b/mysql-test/suite/perfschema/t/threads_mysql.test
@@ -9,22 +9,10 @@
# Ensure that the event scheduler (started via threads_mysql-master.opt)
# is really running.
---source include/running_event_scheduler.inc
+--source include/pfs_running_event_scheduler.inc
SET GLOBAL event_scheduler = OFF;
---source include/no_running_event_scheduler.inc
-
-# threads are removed from:
-# - information_schema.processlist
-# - performance_schema.threads
-# at different times, so we may have to wait a little more
-# for the event_scheduler to shutdown
-#
-let $wait_timeout= 1;
-let $wait_condition=
- SELECT COUNT(*) = 0 FROM performance_schema.threads
- WHERE name like 'thread/sql/event%';
---source include/wait_condition.inc
+--source include/pfs_no_running_event_scheduler.inc
--vertical_results
@@ -59,7 +47,7 @@ WHERE name LIKE 'thread/sql%';
SET GLOBAL event_scheduler = ON;
---source include/running_event_scheduler.inc
+--source include/pfs_running_event_scheduler.inc
# Show entries belonging to the just started event scheduler
SELECT name, type, processlist_user, processlist_host, processlist_db,
diff --git a/mysql-test/suite/plugins/r/auth_ed25519.result b/mysql-test/suite/plugins/r/auth_ed25519.result
new file mode 100644
index 00000000000..5c5581d37b0
--- /dev/null
+++ b/mysql-test/suite/plugins/r/auth_ed25519.result
@@ -0,0 +1,54 @@
+create function ed25519_password returns string soname "auth_ed25519.so";
+select ed25519_password();
+ERROR HY000: Can't initialize function 'ed25519_password'; Wrong arguments to ed25519_password()
+select ed25519_password(1);
+ERROR HY000: Can't initialize function 'ed25519_password'; Wrong arguments to ed25519_password()
+select ed25519_password("foo", "bar");
+ERROR HY000: Can't initialize function 'ed25519_password'; Wrong arguments to ed25519_password()
+select ed25519_password("foo");
+ERROR HY000: Can't initialize function 'ed25519_password'; Authentication plugin ed25519 is not loaded
+install soname 'auth_ed25519';
+select ed25519_password("foo");
+ed25519_password("foo")
+vubFBzIrapbfHct1/J72dnUryz5VS7lA6XHH8sIx4TI
+select ed25519_password("foobar");
+ed25519_password("foobar")
+qv2mG6HWCuy32Slb5xhV4THStewNz2VINVPbgk+XAJ8
+select ed25519_password("foo bar");
+ed25519_password("foo bar")
+Y5fV74JAVRMOK2cdnUsYS+WW9sXaaL/o+6WGKOgqnzc
+select ed25519_password(NULL);
+ed25519_password(NULL)
+NULL
+select * from information_schema.plugins where plugin_name='ed25519';
+PLUGIN_NAME ed25519
+PLUGIN_VERSION 1.0
+PLUGIN_STATUS ACTIVE
+PLUGIN_TYPE AUTHENTICATION
+PLUGIN_TYPE_VERSION 2.1
+PLUGIN_LIBRARY auth_ed25519.so
+PLUGIN_LIBRARY_VERSION 1.12
+PLUGIN_AUTHOR Sergei Golubchik
+PLUGIN_DESCRIPTION Elliptic curve ED25519 based authentication
+PLUGIN_LICENSE GPL
+LOAD_OPTION ON
+PLUGIN_MATURITY Beta
+PLUGIN_AUTH_VERSION 1.0-alpha
+create user test1@localhost identified via ed25519 using 'ZIgUREUg5PVgQ6LskhXmO+eZLS0nC8be6HPjYWR4YJY';
+show grants for test1@localhost;
+Grants for test1@localhost
+GRANT USAGE ON *.* TO 'test1'@'localhost' IDENTIFIED VIA ed25519 USING 'ZIgUREUg5PVgQ6LskhXmO+eZLS0nC8be6HPjYWR4YJY'
+connect(localhost,test1,public,test,PORT,SOCKET);
+connect con1, localhost, test1, public;
+ERROR 28000: Access denied for user 'test1'@'localhost' (using password: YES)
+connect con1, localhost, test1, secret;
+select current_user();
+current_user()
+test1@localhost
+disconnect con1;
+connection default;
+drop user test1@localhost;
+uninstall plugin ed25519;
+select ed25519_password("foo");
+ERROR HY000: Can't initialize function 'ed25519_password'; Authentication plugin ed25519 is not loaded
+drop function ed25519_password;
diff --git a/mysql-test/suite/plugins/r/cracklib_password_check.result b/mysql-test/suite/plugins/r/cracklib_password_check.result
index 158a7501240..479b4b00698 100644
--- a/mysql-test/suite/plugins/r/cracklib_password_check.result
+++ b/mysql-test/suite/plugins/r/cracklib_password_check.result
@@ -6,7 +6,7 @@ PLUGIN_STATUS ACTIVE
PLUGIN_TYPE PASSWORD VALIDATION
PLUGIN_TYPE_VERSION 1.0
PLUGIN_LIBRARY cracklib_password_check.so
-PLUGIN_LIBRARY_VERSION 1.11
+PLUGIN_LIBRARY_VERSION 1.12
PLUGIN_AUTHOR Sergei Golubchik
PLUGIN_DESCRIPTION Password validation via CrackLib
PLUGIN_LICENSE GPL
diff --git a/mysql-test/suite/plugins/r/show_all_plugins.result b/mysql-test/suite/plugins/r/show_all_plugins.result
index fae706f56fa..7ed26b8aef6 100644
--- a/mysql-test/suite/plugins/r/show_all_plugins.result
+++ b/mysql-test/suite/plugins/r/show_all_plugins.result
@@ -4,8 +4,8 @@ Variable_name Value
Opened_plugin_libraries 0
select * from information_schema.all_plugins where plugin_library='ha_example.so';
PLUGIN_NAME PLUGIN_VERSION PLUGIN_STATUS PLUGIN_TYPE PLUGIN_TYPE_VERSION PLUGIN_LIBRARY PLUGIN_LIBRARY_VERSION PLUGIN_AUTHOR PLUGIN_DESCRIPTION PLUGIN_LICENSE LOAD_OPTION PLUGIN_MATURITY PLUGIN_AUTH_VERSION
-EXAMPLE 0.1 NOT INSTALLED STORAGE ENGINE MYSQL_VERSION_ID ha_example.so 1.11 Brian Aker, MySQL AB Example storage engine GPL OFF Experimental 0.1
-UNUSABLE 3.14 NOT INSTALLED DAEMON MYSQL_VERSION_ID ha_example.so 1.11 Sergei Golubchik Unusable Daemon GPL OFF Experimental 3.14.15.926
+EXAMPLE 0.1 NOT INSTALLED STORAGE ENGINE MYSQL_VERSION_ID ha_example.so 1.12 Brian Aker, MySQL AB Example storage engine GPL OFF Experimental 0.1
+UNUSABLE 3.14 NOT INSTALLED DAEMON MYSQL_VERSION_ID ha_example.so 1.12 Sergei Golubchik Unusable Daemon GPL OFF Experimental 3.14.15.926
show status like '%libraries%';
Variable_name Value
Opened_plugin_libraries 1
diff --git a/mysql-test/suite/plugins/r/simple_password_check.result b/mysql-test/suite/plugins/r/simple_password_check.result
index 015a26adc87..11385bd6b01 100644
--- a/mysql-test/suite/plugins/r/simple_password_check.result
+++ b/mysql-test/suite/plugins/r/simple_password_check.result
@@ -6,7 +6,7 @@ PLUGIN_STATUS ACTIVE
PLUGIN_TYPE PASSWORD VALIDATION
PLUGIN_TYPE_VERSION 1.0
PLUGIN_LIBRARY simple_password_check.so
-PLUGIN_LIBRARY_VERSION 1.11
+PLUGIN_LIBRARY_VERSION 1.12
PLUGIN_AUTHOR Sergei Golubchik
PLUGIN_DESCRIPTION Simple password strength checks
PLUGIN_LICENSE GPL
diff --git a/mysql-test/suite/plugins/t/auth_ed25519.test b/mysql-test/suite/plugins/t/auth_ed25519.test
new file mode 100644
index 00000000000..3e02bdf97d2
--- /dev/null
+++ b/mysql-test/suite/plugins/t/auth_ed25519.test
@@ -0,0 +1,44 @@
+#
+# MDEV-12160 Modern alternative to the SHA1 authentication plugin
+#
+source include/not_embedded.inc;
+if (!$AUTH_ED25519_SO) {
+ skip No auth_ed25519 plugin;
+}
+
+replace_result dll so;
+eval create function ed25519_password returns string soname "$AUTH_ED25519_SO";
+error ER_CANT_INITIALIZE_UDF;
+select ed25519_password();
+error ER_CANT_INITIALIZE_UDF;
+select ed25519_password(1);
+error ER_CANT_INITIALIZE_UDF;
+select ed25519_password("foo", "bar");
+error ER_CANT_INITIALIZE_UDF;
+select ed25519_password("foo");
+
+install soname 'auth_ed25519';
+select ed25519_password("foo");
+select ed25519_password("foobar");
+select ed25519_password("foo bar");
+select ed25519_password(NULL);
+
+replace_result dll so;
+query_vertical select * from information_schema.plugins where plugin_name='ed25519';
+let $pwd=`select ed25519_password("secret")`;
+eval create user test1@localhost identified via ed25519 using '$pwd';
+show grants for test1@localhost;
+
+replace_result $MASTER_MYPORT PORT $MASTER_MYSOCK SOCKET;
+error ER_ACCESS_DENIED_ERROR;
+connect con1, localhost, test1, public;
+connect con1, localhost, test1, secret;
+select current_user();
+disconnect con1;
+connection default;
+
+drop user test1@localhost;
+uninstall plugin ed25519;
+error ER_CANT_INITIALIZE_UDF;
+select ed25519_password("foo");
+drop function ed25519_password;
diff --git a/mysql-test/suite/rpl/r/rpl_heartbeat_basic.result b/mysql-test/suite/rpl/r/rpl_heartbeat_basic.result
index 619ee41d1ed..4ffa8fc9883 100644
--- a/mysql-test/suite/rpl/r/rpl_heartbeat_basic.result
+++ b/mysql-test/suite/rpl/r/rpl_heartbeat_basic.result
@@ -9,7 +9,6 @@ SET @restore_slave_net_timeout=@@global.slave_net_timeout;
connection master;
RESET MASTER;
SET @restore_slave_net_timeout=@@global.slave_net_timeout;
-SET @restore_event_scheduler=@@global.event_scheduler;
connection slave;
*** Default value ***
@@ -245,7 +244,9 @@ include/start_slave.inc
connection master;
SET @@global.event_scheduler=1;
connection slave;
-Number of received heartbeat events: 0
+connection master;
+connection slave;
+Received heartbeats meet expectations: TRUE
connection master;
DELETE FROM t1;
DROP EVENT e1;
diff --git a/mysql-test/suite/rpl/r/rpl_mdev6386.result b/mysql-test/suite/rpl/r/rpl_mdev6386.result
index 00838127302..91ba9569343 100644
--- a/mysql-test/suite/rpl/r/rpl_mdev6386.result
+++ b/mysql-test/suite/rpl/r/rpl_mdev6386.result
@@ -2,7 +2,6 @@ include/master-slave.inc
[connection master]
connection master;
ALTER TABLE mysql.gtid_slave_pos ENGINE = InnoDB;
-FLUSH LOGS;
CREATE TABLE t1 (a INT PRIMARY KEY, b INT) Engine=InnoDB;
connection slave;
connection slave;
@@ -26,6 +25,7 @@ INSERT INTO t2 VALUE (4, 1);
INSERT INTO t2 VALUE (5, 1);
INSERT INTO t1 SELECT * FROM t2;
DROP TEMPORARY TABLE t2;
+INSERT INTO t1 VALUE (6, 3);
include/save_master_gtid.inc
Contents on master:
SELECT * FROM t1 ORDER BY a;
@@ -35,6 +35,7 @@ a b
3 1
4 1
5 1
+6 3
connection slave;
START SLAVE;
include/wait_for_slave_sql_error.inc [errno=1062]
@@ -56,6 +57,7 @@ a b
3 1
4 1
5 1
+6 3
connection master;
DROP TABLE t1;
connection slave;
diff --git a/mysql-test/suite/rpl/t/rpl_heartbeat_basic.test b/mysql-test/suite/rpl/t/rpl_heartbeat_basic.test
index 5b55f11da85..4c8d3a1fedb 100644
--- a/mysql-test/suite/rpl/t/rpl_heartbeat_basic.test
+++ b/mysql-test/suite/rpl/t/rpl_heartbeat_basic.test
@@ -34,7 +34,6 @@ eval SET @restore_slave_heartbeat_timeout=$slave_heartbeat_timeout;
--connection master
RESET MASTER;
SET @restore_slave_net_timeout=@@global.slave_net_timeout;
-SET @restore_event_scheduler=@@global.event_scheduler;
--echo
#
@@ -352,21 +351,54 @@ eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTE
--connection master
# Enable scheduler
SET @@global.event_scheduler=1;
+
--sync_slave_with_master
let $rcvd_heartbeats_before= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1);
-# Wait some updates for table t1 from master
-let $wait_condition= SELECT COUNT(*)=1 FROM t1 WHERE a > 5;
---source include/wait_condition.inc
+
+--connection master
+
+# Whether or not to send a heartbeat is decided on the master, based on
+# whether the binlog was updated during the period or not.
+# Even with the 1-second event, we cannot make the master to write binary
+# logs (or execute SQL) in a timely manner. We can only check that they
+# were executed in a timely manner, and if they were not, neutralize the
+# heartbeat check on the slave.
+# We will wait for 5 events, and keep checking 'Binlog_commits' on master.
+# Time interval between consequent events will be measured.
+# We can only expect that no heartbeats have been sent if the interval
+# between events never exceeded MASTER_HEARTBEAT_PERIOD.
+# If it has exceeded the value at least once, the slave can legitimately
+# receive a heartbeat (but we cannot require it, because the delay
+# could have occurred somewhere else, e.g. upon checking the status).
+# So, if the delay is detected, we will signal slave to ignore possible
+# heartbeats.
+
+let $possible_heartbeats= 0;
+let $commits_to_wait= 5;
+while ($commits_to_wait)
+{
+ let $tm= `SELECT UNIX_TIMESTAMP(NOW(3))`;
+ let $binlog_commits= query_get_value(SHOW STATUS LIKE 'Binlog_commits', Value, 1);
+ let $wait_condition= SELECT VARIABLE_VALUE > $binlog_commits FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME= 'BINLOG_COMMITS';
+ --source include/wait_condition.inc
+ dec $commits_to_wait;
+ if (`SELECT UNIX_TIMESTAMP(NOW(3)) > $tm + 5`)
+ {
+ let $possible_heartbeats= 1;
+ let $commits_to_wait= 0;
+ }
+}
+
+--connection slave
let $rcvd_heartbeats_after= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1);
-let $result= query_get_value(SELECT ($rcvd_heartbeats_after - $rcvd_heartbeats_before) > 0 AS Result, Result, 1);
---echo Number of received heartbeat events: $result
+let $result= `SELECT CASE WHEN $possible_heartbeats THEN 'TRUE' WHEN $rcvd_heartbeats_after - $rcvd_heartbeats_before > 0 THEN 'FALSE' ELSE 'TRUE' END`;
+--echo Received heartbeats meet expectations: $result
--connection master
DELETE FROM t1;
DROP EVENT e1;
--sync_slave_with_master
--echo
-
# Check received heartbeat events while logs flushed on slave
--echo *** Flush logs on slave ***
STOP SLAVE;
diff --git a/mysql-test/suite/rpl/t/rpl_mdev6386.test b/mysql-test/suite/rpl/t/rpl_mdev6386.test
index 3e4e79ea5a3..e85b1ae0132 100644
--- a/mysql-test/suite/rpl/t/rpl_mdev6386.test
+++ b/mysql-test/suite/rpl/t/rpl_mdev6386.test
@@ -2,9 +2,7 @@
--source include/master-slave.inc
--connection master
-# ToDo: Remove this FLUSH LOGS when MDEV-6403 is fixed.
ALTER TABLE mysql.gtid_slave_pos ENGINE = InnoDB;
-FLUSH LOGS;
CREATE TABLE t1 (a INT PRIMARY KEY, b INT) Engine=InnoDB;
--sync_slave_with_master
@@ -31,6 +29,7 @@ INSERT INTO t2 VALUE (4, 1);
INSERT INTO t2 VALUE (5, 1);
INSERT INTO t1 SELECT * FROM t2;
DROP TEMPORARY TABLE t2;
+INSERT INTO t1 VALUE (6, 3);
--source include/save_master_gtid.inc
--echo Contents on master:
SELECT * FROM t1 ORDER BY a;
diff --git a/mysql-test/suite/rpl/t/rpl_mysql_upgrade.test b/mysql-test/suite/rpl/t/rpl_mysql_upgrade.test
index e99a233ac34..1931e2eab2a 100644
--- a/mysql-test/suite/rpl/t/rpl_mysql_upgrade.test
+++ b/mysql-test/suite/rpl/t/rpl_mysql_upgrade.test
@@ -43,6 +43,9 @@ connection master;
#With '--force' option, mysql_upgrade always executes all sql statements for upgrading.
--exec $MYSQL_UPGRADE --skip-verbose --write-binlog --force --user=root > $MYSQLTEST_VARDIR/log/mysql_upgrade.log 2>&1
+let $datadir= `select @@datadir`;
+remove_file $datadir/mysql_upgrade_info;
+
connection master;
let $after_file= query_get_value(SHOW MASTER STATUS, File, 1);
let $after_position= query_get_value(SHOW MASTER STATUS, Position, 1);
diff --git a/mysql-test/suite/sys_vars/r/innodb_stats_include_delete_marked_basic.result b/mysql-test/suite/sys_vars/r/innodb_stats_include_delete_marked_basic.result
new file mode 100644
index 00000000000..ffd208e7927
--- /dev/null
+++ b/mysql-test/suite/sys_vars/r/innodb_stats_include_delete_marked_basic.result
@@ -0,0 +1,25 @@
+SELECT @@innodb_stats_include_delete_marked;
+@@innodb_stats_include_delete_marked
+0
+SET GLOBAL innodb_stats_include_delete_marked=1;
+SELECT @@innodb_stats_include_delete_marked;
+@@innodb_stats_include_delete_marked
+1
+SET SESSION innodb_stats_include_delete_marked=1;
+ERROR HY000: Variable 'innodb_stats_include_delete_marked' is a GLOBAL variable and should be set with SET GLOBAL
+SET GLOBAL innodb_stats_include_delete_marked=100;
+ERROR 42000: Variable 'innodb_stats_include_delete_marked' can't be set to the value of '100'
+SET GLOBAL innodb_stats_include_delete_marked=foo;
+ERROR 42000: Variable 'innodb_stats_include_delete_marked' can't be set to the value of 'foo'
+SET GLOBAL innodb_stats_include_delete_marked=OFF ;
+SELECT @@innodb_stats_include_delete_marked;
+@@innodb_stats_include_delete_marked
+0
+SET GLOBAL innodb_stats_include_delete_marked=ON ;
+SELECT @@innodb_stats_include_delete_marked;
+@@innodb_stats_include_delete_marked
+1
+SET GLOBAL innodb_stats_include_delete_marked=Default ;
+SELECT @@innodb_stats_include_delete_marked;
+@@innodb_stats_include_delete_marked
+0
diff --git a/mysql-test/suite/sys_vars/r/sysvars_innodb,32bit,xtradb.rdiff-disabled b/mysql-test/suite/sys_vars/r/sysvars_innodb,32bit,xtradb.rdiff-disabled
index 285caafb3d0..858df585a7b 100644
--- a/mysql-test/suite/sys_vars/r/sysvars_innodb,32bit,xtradb.rdiff-disabled
+++ b/mysql-test/suite/sys_vars/r/sysvars_innodb,32bit,xtradb.rdiff-disabled
@@ -1,7 +1,7 @@
--- suite/sys_vars/r/sysvars_innodb.result 2016-05-06 14:03:16.000000000 +0300
+++ suite/sys_vars/r/sysvars_innodb,32bit.reject 2016-05-08 13:28:44.312418574 +0300
@@ -47,13 +47,27 @@
- ENUM_VALUE_LIST NULL
+ ENUM_VALUE_LIST OFF,ON
READ_ONLY NO
COMMAND_LINE_ARGUMENT OPTIONAL
+VARIABLE_NAME INNODB_ADAPTIVE_HASH_INDEX_PARTITIONS
@@ -97,7 +97,7 @@
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 64
@@ -355,6 +369,20 @@
- ENUM_VALUE_LIST NULL
+ ENUM_VALUE_LIST OFF,ON
READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
+VARIABLE_NAME INNODB_BUFFER_POOL_POPULATE
@@ -418,15 +418,6 @@
VARIABLE_COMMENT Helps to save your data in case the disk image of the database becomes corrupt.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 6
-@@ -1047,7 +1215,7 @@
- GLOBAL_VALUE_ORIGIN COMPILE-TIME
- DEFAULT_VALUE 0
- VARIABLE_SCOPE GLOBAL
--VARIABLE_TYPE BIGINT UNSIGNED
-+VARIABLE_TYPE INT UNSIGNED
- VARIABLE_COMMENT Kills the server during crash recovery.
- NUMERIC_MIN_VALUE 0
- NUMERIC_MAX_VALUE 10
@@ -1055,6 +1223,20 @@
ENUM_VALUE_LIST NULL
READ_ONLY YES
@@ -1227,8 +1218,8 @@
COMMAND_LINE_ARGUMENT OPTIONAL
VARIABLE_NAME INNODB_VERSION
SESSION_VALUE NULL
--GLOBAL_VALUE 5.6.33
-+GLOBAL_VALUE 5.6.34-79.1
+-GLOBAL_VALUE 5.6.35
++GLOBAL_VALUE 5.6.35-80.0
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE NULL
VARIABLE_SCOPE GLOBAL
diff --git a/mysql-test/suite/sys_vars/r/sysvars_innodb,xtradb.rdiff-disabled b/mysql-test/suite/sys_vars/r/sysvars_innodb,xtradb.rdiff-disabled
index a2e6c1d5c4c..d801270c6b6 100644
--- a/mysql-test/suite/sys_vars/r/sysvars_innodb,xtradb.rdiff-disabled
+++ b/mysql-test/suite/sys_vars/r/sysvars_innodb,xtradb.rdiff-disabled
@@ -661,8 +661,8 @@
COMMAND_LINE_ARGUMENT OPTIONAL
VARIABLE_NAME INNODB_VERSION
SESSION_VALUE NULL
--GLOBAL_VALUE 5.6.33
-+GLOBAL_VALUE 5.6.34-79.1
+-GLOBAL_VALUE 5.6.35
++GLOBAL_VALUE 5.6.35-80.0
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE NULL
VARIABLE_SCOPE GLOBAL
diff --git a/mysql-test/suite/sys_vars/r/sysvars_innodb.result b/mysql-test/suite/sys_vars/r/sysvars_innodb.result
index a6a36ccf6d6..d7d35da8459 100644
--- a/mysql-test/suite/sys_vars/r/sysvars_innodb.result
+++ b/mysql-test/suite/sys_vars/r/sysvars_innodb.result
@@ -797,7 +797,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 1
VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE INT UNSIGNED
-VARIABLE_COMMENT Key rotation - re-encrypt in background all pages that were encrypted with a key that many (or more) versions behind
+VARIABLE_COMMENT Key rotation - re-encrypt in background all pages that were encrypted with a key that many (or more) versions behind. Value 0 indicates that key rotation is disabled.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 4294967295
NUMERIC_BLOCK_SIZE 0
diff --git a/mysql-test/suite/sys_vars/t/innodb_stats_include_delete_marked_basic.test b/mysql-test/suite/sys_vars/t/innodb_stats_include_delete_marked_basic.test
new file mode 100644
index 00000000000..a3a9b99a133
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_stats_include_delete_marked_basic.test
@@ -0,0 +1,58 @@
+###############################################################################
+# #
+# Variable Name: innodb_stats_include_delete_marked #
+# Scope: Global #
+# Access Type: Dynamic #
+# Data Type: numeric #
+# #
+# #
+# Creation Date: 2016-08-29 #
+# Author : Aditya #
+# #
+# #
+# Description: #
+# * Value check #
+# * Scope check #
+# #
+###############################################################################
+
+--source include/have_innodb.inc
+
+if (`select plugin_auth_version <= "5.7.17" from information_schema.plugins where plugin_name='innodb'`)
+{
+ --skip Not present before MySQL 5.7.17 or 5.6.35
+}
+
+####################################################################
+# Display default value #
+####################################################################
+SELECT @@innodb_stats_include_delete_marked;
+
+SET GLOBAL innodb_stats_include_delete_marked=1;
+
+SELECT @@innodb_stats_include_delete_marked;
+
+# check error
+--error ER_GLOBAL_VARIABLE
+SET SESSION innodb_stats_include_delete_marked=1;
+
+# check error
+--error ER_WRONG_VALUE_FOR_VAR
+SET GLOBAL innodb_stats_include_delete_marked=100;
+
+# check error
+--error ER_WRONG_VALUE_FOR_VAR
+SET GLOBAL innodb_stats_include_delete_marked=foo;
+
+SET GLOBAL innodb_stats_include_delete_marked=OFF ;
+
+SELECT @@innodb_stats_include_delete_marked;
+
+SET GLOBAL innodb_stats_include_delete_marked=ON ;
+
+SELECT @@innodb_stats_include_delete_marked;
+
+# Check with default setting
+SET GLOBAL innodb_stats_include_delete_marked=Default ;
+
+SELECT @@innodb_stats_include_delete_marked;
diff --git a/mysql-test/suite/sys_vars/t/max_digest_length_basic.test b/mysql-test/suite/sys_vars/t/max_digest_length_basic.test
index b5e1d834d7e..38b493b3bab 100644
--- a/mysql-test/suite/sys_vars/t/max_digest_length_basic.test
+++ b/mysql-test/suite/sys_vars/t/max_digest_length_basic.test
@@ -11,7 +11,7 @@
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/not_embedded.inc
diff --git a/mysql-test/suite/sys_vars/t/pfs_digests_size_basic.test b/mysql-test/suite/sys_vars/t/pfs_digests_size_basic.test
index 29b4232b7fa..31692081053 100644
--- a/mysql-test/suite/sys_vars/t/pfs_digests_size_basic.test
+++ b/mysql-test/suite/sys_vars/t/pfs_digests_size_basic.test
@@ -11,7 +11,7 @@
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/not_embedded.inc
--source include/have_perfschema.inc
diff --git a/mysql-test/suite/sys_vars/t/pfs_max_digest_length_basic.test b/mysql-test/suite/sys_vars/t/pfs_max_digest_length_basic.test
index 5c89dbda07f..cf87c1a7c68 100644
--- a/mysql-test/suite/sys_vars/t/pfs_max_digest_length_basic.test
+++ b/mysql-test/suite/sys_vars/t/pfs_max_digest_length_basic.test
@@ -11,7 +11,7 @@
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/not_embedded.inc
--source include/have_perfschema.inc
diff --git a/mysql-test/suite/sys_vars/t/secure_file_priv.test b/mysql-test/suite/sys_vars/t/secure_file_priv.test
index 5c53da58275..a5a465d8c98 100644
--- a/mysql-test/suite/sys_vars/t/secure_file_priv.test
+++ b/mysql-test/suite/sys_vars/t/secure_file_priv.test
@@ -21,6 +21,9 @@ SHOW VARIABLES LIKE 'secure_file_priv';
--perl
use File::Basename;
my $protected_file= dirname($ENV{MYSQLTEST_VARDIR}).'/bug50373.txt';
+# Ensure bug50373.txt does not exist (e.g. leftover from previous
+# test runs).
+unlink $protected_file;
open(FILE, ">", "$ENV{MYSQL_TMP_DIR}/bug50373.inc") or die;
print FILE "SELECT * FROM t1 INTO OUTFILE '".$protected_file."';\n";
print FILE "DELETE FROM t1;\n";
diff --git a/mysql-test/suite/vcol/r/vcol_select_myisam.result b/mysql-test/suite/vcol/r/vcol_select_myisam.result
index 88a9e608c9d..be3ea8109cc 100644
--- a/mysql-test/suite/vcol/r/vcol_select_myisam.result
+++ b/mysql-test/suite/vcol/r/vcol_select_myisam.result
@@ -298,6 +298,115 @@ DROP TABLE t1,t2;
create table t1 (
pk integer auto_increment,
bi integer not null,
+vi integer generated always as (bi) persistent,
+bc varchar(1) not null,
+vc varchar(2) generated always as (concat(bc, bc)) persistent,
+primary key (pk),
+key (vi, vc));
+insert t1 (bi, bc) values (0, 'x'), (0, 'n'), (1, 'w'), (7, 's'), (0, 'a'), (4, 'd'), (1, 'w'), (1, 'j'), (1, 'm'), (4, 'k'), (7, 't'), (4, 'k'), (2, 'e'), (0, 'i'), (1, 't'), (6, 'z'), (3, 'c'), (6, 'i'), (8, 'v');
+create table t2 (
+pk integer auto_increment,
+bi integer not null,
+vi integer generated always as (bi) persistent,
+bc varchar(257) not null,
+vc varchar(2) generated always as (concat(bc, bc)) persistent,
+primary key (pk),
+key (vi, vc));
+insert t2 (bi, bc) values (1, 'c'), (8, 'm'), (9, 'd'), (6, 'y'), (1, 't'), (6, 'd'), (2, 's'), (4, 'r'), (8, 'm'), (4, 'b'), (4, 'x'), (7, 'g'), (4, 'p'), (1, 'q'), (9, 'w'), (4, 'd'), (8, 'e'), (4, 'b'), (8, 'y');
+explain # should be using join buffer
+select t2.vi from (t2 as t3 right join (t2 left join t1 on (t1.bi = t2.vi)) on (t1.vc = t2.vc));
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 index NULL vi 10 NULL 19 Using index
+1 SIMPLE t1 ALL NULL NULL NULL NULL 19 Using where; Using join buffer (flat, BNL join)
+1 SIMPLE t3 index NULL PRIMARY 4 NULL 19 Using where; Using index; Using join buffer (incremental, BNL join)
+select t2.vi from (t2 as t3 right join (t2 left join t1 on (t1.bi = t2.vi)) on (t1.vc = t2.vc));
+vi
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+2
+4
+4
+4
+4
+4
+4
+4
+4
+4
+4
+4
+4
+4
+4
+4
+4
+4
+4
+4
+4
+4
+4
+4
+4
+4
+4
+4
+4
+4
+4
+4
+4
+4
+4
+4
+4
+6
+6
+6
+6
+7
+7
+8
+8
+8
+8
+9
+9
+drop table t2,t1;
+create table t1 (
+pk integer auto_increment,
+bi integer not null,
vi integer generated always as (bi) virtual,
bc varchar(1) not null,
vc varchar(2) generated always as (concat(bc, bc)),
diff --git a/mysql-test/suite/vcol/t/vcol_select_myisam.test b/mysql-test/suite/vcol/t/vcol_select_myisam.test
index 5dd08894fea..2570526af71 100644
--- a/mysql-test/suite/vcol/t/vcol_select_myisam.test
+++ b/mysql-test/suite/vcol/t/vcol_select_myisam.test
@@ -70,7 +70,40 @@ SELECT * FROM t1 NATURAL JOIN t2;
DROP TABLE t1,t2;
#
+# MDEV-11525 Assertion `cp + len <= buff + buff_size' failed in JOIN_CACHE::write_record_data
+#
+
+create table t1 (
+ pk integer auto_increment,
+ bi integer not null,
+ vi integer generated always as (bi) persistent,
+ bc varchar(1) not null,
+ vc varchar(2) generated always as (concat(bc, bc)) persistent,
+ primary key (pk),
+ key (vi, vc));
+insert t1 (bi, bc) values (0, 'x'), (0, 'n'), (1, 'w'), (7, 's'), (0, 'a'), (4, 'd'), (1, 'w'), (1, 'j'), (1, 'm'), (4, 'k'), (7, 't'), (4, 'k'), (2, 'e'), (0, 'i'), (1, 't'), (6, 'z'), (3, 'c'), (6, 'i'), (8, 'v');
+create table t2 (
+ pk integer auto_increment,
+ bi integer not null,
+ vi integer generated always as (bi) persistent,
+ bc varchar(257) not null,
+ vc varchar(2) generated always as (concat(bc, bc)) persistent,
+ primary key (pk),
+ key (vi, vc));
+insert t2 (bi, bc) values (1, 'c'), (8, 'm'), (9, 'd'), (6, 'y'), (1, 't'), (6, 'd'), (2, 's'), (4, 'r'), (8, 'm'), (4, 'b'), (4, 'x'), (7, 'g'), (4, 'p'), (1, 'q'), (9, 'w'), (4, 'd'), (8, 'e'), (4, 'b'), (8, 'y');
+explain # should be using join buffer
+select t2.vi from (t2 as t3 right join (t2 left join t1 on (t1.bi = t2.vi)) on (t1.vc = t2.vc));
+--sorted_result
+select t2.vi from (t2 as t3 right join (t2 left join t1 on (t1.bi = t2.vi)) on (t1.vc = t2.vc));
+drop table t2,t1;
+
+#
+# End of 5.5 tests
+#
+
+#
# MDEV-11640 gcol.gcol_select_myisam fails in buildbot on Power
+# (same as MDEV-11525 above, but for virtual columns)
#
create table t1 (
diff --git a/mysql-test/t/alter_table.test b/mysql-test/t/alter_table.test
index bf16757efd6..143ba80c53b 100644
--- a/mysql-test/t/alter_table.test
+++ b/mysql-test/t/alter_table.test
@@ -1755,6 +1755,17 @@ DROP TABLE t2;
DROP TABLE t1;
--echo #
+--echo # MDEV-6390 CONVERT TO CHARACTER SET utf8 doesn't change DEFAULT CHARSET.
+--echo #
+
+CREATE TABLE t1 (id int(11) NOT NULL, a int(11) NOT NULL, b int(11))
+ ENGINE=InnoDB DEFAULT CHARSET=latin1;
+SHOW CREATE TABLE t1;
+ALTER TABLE t1 CONVERT TO CHARACTER SET utf8;
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+
+--echo #
--echo # Start of 10.1 tests
--echo #
diff --git a/mysql-test/t/ctype_upgrade.test b/mysql-test/t/ctype_upgrade.test
index cc59d1e4401..62567c5afe4 100644
--- a/mysql-test/t/ctype_upgrade.test
+++ b/mysql-test/t/ctype_upgrade.test
@@ -191,6 +191,7 @@ SELECT GROUP_CONCAT(a ORDER BY BINARY a) FROM maria100004_xxx_croatian_ci GROUP
SHOW CREATE TABLE mysql050614_xxx_croatian_ci;
SELECT GROUP_CONCAT(a ORDER BY BINARY a) FROM mysql050614_xxx_croatian_ci GROUP BY a;
+remove_file $MYSQLD_DATADIR/mysql_upgrade_info;
DROP TABLE maria050313_ucs2_croatian_ci_def;
DROP TABLE maria050313_utf8_croatian_ci;
DROP TABLE maria050533_xxx_croatian_ci;
diff --git a/mysql-test/t/derived.test b/mysql-test/t/derived.test
index 121e274ceeb..d30a6d7fd9e 100644
--- a/mysql-test/t/derived.test
+++ b/mysql-test/t/derived.test
@@ -875,6 +875,29 @@ SELECT Customer, Success, SUM(OrderSize)
DROP TABLE example1463;
set sql_mode= @save_sql_mode;
+--echo #
+--echo # MDEV-9028: SELECT DISTINCT constant column of derived table
+--echo # used as the second operand of LEFT JOIN
+--echo #
+
+create table t1 (id int, data varchar(255));
+insert into t1 values (1,'yes'),(2,'yes');
+
+select distinct t1.id, tt.id, tt.data
+ from t1
+ left join
+ (select t1.id, 'yes' as data from t1) as tt
+ on t1.id = tt.id;
+
+select distinct t1.id, tt.id, tt.data
+ from t1
+ left join
+ (select t1.id, 'yes' as data from t1 where id > 1) as tt
+ on t1.id = tt.id;
+
+drop table t1;
+
+
--echo # end of 5.5
--echo #
diff --git a/mysql-test/t/drop_bad_db_type.test b/mysql-test/t/drop_bad_db_type.test
index 69e1a889b18..00b79dabddf 100644
--- a/mysql-test/t/drop_bad_db_type.test
+++ b/mysql-test/t/drop_bad_db_type.test
@@ -15,6 +15,12 @@ insert t1 values (1),(2),(3);
flush tables;
uninstall soname 'ha_archive';
+--vertical_results
+select table_schema, table_name from information_schema.tables where table_name like 't1';
+select table_schema, table_name, engine, version from information_schema.tables where table_name like 't1';
+select table_schema, table_name, engine, row_format from information_schema.tables where table_name like 't1';
+--horizontal_results
+
install soname 'ha_archive';
--list_files $mysqld_datadir/test
drop table t1;
diff --git a/mysql-test/t/gis.test b/mysql-test/t/gis.test
index 09d7a29744f..3bb0044c7fb 100644
--- a/mysql-test/t/gis.test
+++ b/mysql-test/t/gis.test
@@ -1460,12 +1460,12 @@ SHOW CREATE TABLE information_schema.spatial_ref_sys;
create table t1(g GEOMETRY, pt POINT);
create table t2(g LINESTRING, pl POLYGON);
-select * from information_schema.geometry_columns;
+select * from information_schema.geometry_columns where f_table_schema='test';
drop table t1, t2;
--echo 10.1 tests
create table t1(g GEOMETRY(9,4) REF_SYSTEM_ID=101, pt POINT(8,2), pg GEOMETRY REF_SYSTEM_ID=102);
-SELECT SRID from information_schema.geometry_columns WHERE G_TABLE_NAME='t1';
+SELECT SRID from information_schema.geometry_columns WHERE f_table_schema='test' and G_TABLE_NAME='t1';
drop table t1;
-- echo # Expect an int(1) column to be created
diff --git a/mysql-test/t/grant.test b/mysql-test/t/grant.test
index b816afed851..c945e818181 100644
--- a/mysql-test/t/grant.test
+++ b/mysql-test/t/grant.test
@@ -2116,6 +2116,68 @@ DROP USER mysqltest_u1@localhost;
--echo # End of Bug#38347.
--echo
+
+--echo #
+--echo # BUG#11759114 - '51401: GRANT TREATS NONEXISTENT FUNCTIONS/PRIVILEGES
+--echo # DIFFERENTLY'.
+--echo #
+--disable_warnings
+drop database if exists mysqltest_db1;
+--enable_warnings
+create database mysqltest_db1;
+create user mysqltest_u1;
+--echo # Both GRANT statements below should fail with the same error.
+--error ER_SP_DOES_NOT_EXIST
+grant execute on function mysqltest_db1.f1 to mysqltest_u1;
+--error ER_SP_DOES_NOT_EXIST
+grant execute on procedure mysqltest_db1.p1 to mysqltest_u1;
+--echo # Let us show that GRANT behaviour for routines is consistent
+--echo # with GRANT behaviour for tables. Attempt to grant privilege
+--echo # on non-existent table also results in an error.
+--error ER_NO_SUCH_TABLE
+grant select on mysqltest_db1.t1 to mysqltest_u1;
+show grants for mysqltest_u1;
+drop database mysqltest_db1;
+drop user mysqltest_u1;
+
+
+--echo #
+--echo # Bug#12766319 - 61865: RENAME USER DOES NOT WORK CORRECTLY -
+--echo # REQUIRES FLUSH PRIVILEGES
+--echo #
+
+CREATE USER foo@'127.0.0.1';
+GRANT ALL ON *.* TO foo@'127.0.0.1';
+
+--echo # First attempt, should connect successfully
+connect (conn1, '127.0.0.1', foo,,test);
+SELECT user(), current_user();
+
+--echo # Rename the user
+RENAME USER foo@'127.0.0.1' to foo@'127.0.0.0/255.0.0.0';
+
+--echo # Second attempt, should connect successfully as its valid mask
+--echo # This was failing without fix
+connect (conn2, '127.0.0.1', foo,,test);
+SELECT user(), current_user();
+
+--echo # Rename the user back to original
+RENAME USER foo@'127.0.0.0/255.0.0.0' to foo@'127.0.0.1';
+
+--echo # Third attempt, should connect successfully
+connect (conn3, '127.0.0.1', foo,,test);
+SELECT user(), current_user();
+
+--echo # Clean-up
+connection default;
+disconnect conn1;
+disconnect conn2;
+disconnect conn3;
+DROP USER foo@'127.0.0.1';
+
+--echo # End of Bug#12766319
+
+
--echo #
--echo # Bug#11756966 - 48958: STORED PROCEDURES CAN BE LEVERAGED TO BYPASS
--echo # DATABASE SECURITY
@@ -2146,29 +2208,6 @@ disconnect con1;
DROP USER untrusted@localhost;
DROP DATABASE secret;
---echo #
---echo # BUG#11759114 - '51401: GRANT TREATS NONEXISTENT FUNCTIONS/PRIVILEGES
---echo # DIFFERENTLY'.
---echo #
---disable_warnings
-drop database if exists mysqltest_db1;
---enable_warnings
-create database mysqltest_db1;
-create user mysqltest_u1;
---echo # Both GRANT statements below should fail with the same error.
---error ER_SP_DOES_NOT_EXIST
-grant execute on function mysqltest_db1.f1 to mysqltest_u1;
---error ER_SP_DOES_NOT_EXIST
-grant execute on procedure mysqltest_db1.p1 to mysqltest_u1;
---echo # Let us show that GRANT behaviour for routines is consistent
---echo # with GRANT behaviour for tables. Attempt to grant privilege
---echo # on non-existent table also results in an error.
---error ER_NO_SUCH_TABLE
-grant select on mysqltest_db1.t1 to mysqltest_u1;
-show grants for mysqltest_u1;
-drop database mysqltest_db1;
-drop user mysqltest_u1;
-
set GLOBAL sql_mode=default;
# Wait till we reached the initial number of concurrent sessions
--source include/wait_until_count_sessions.inc
diff --git a/mysql-test/t/join_nested.test b/mysql-test/t/join_nested.test
index 7b7d9236835..e60b7827f75 100644
--- a/mysql-test/t/join_nested.test
+++ b/mysql-test/t/join_nested.test
@@ -1309,5 +1309,74 @@ LEFT JOIN t4 AS alias5
JOIN t5 ON alias5.f5
ON alias2.f3 ON alias1.f2;
DROP TABLE t1,t2,t3,t4,t5;
-set optimizer_search_depth= @tmp_mdev621;
+--echo #
+--echo # MDEV-7992: Nested left joins + 'not exists' optimization
+--echo #
+
+CREATE TABLE t1(
+ K1 INT PRIMARY KEY,
+ Name VARCHAR(15)
+);
+
+INSERT INTO t1 VALUES
+ (1,'T1Row1'), (2,'T1Row2');
+
+
+CREATE TABLE t2(
+ K2 INT PRIMARY KEY,
+ K1r INT,
+ rowTimestamp DATETIME,
+ Event VARCHAR(15)
+);
+
+INSERT INTO t2 VALUES
+ (1, 1, '2015-04-13 10:42:11' ,'T1Row1Event1'),
+ (2, 1, '2015-04-13 10:42:12' ,'T1Row1Event2'),
+ (3, 1, '2015-04-13 10:42:12' ,'T1Row1Event3');
+
+let $q1=
+SELECT t1a.*, t2a.*,
+ t2i.K2 AS K2B, t2i.K1r AS K1rB,
+ t2i.rowTimestamp AS rowTimestampB, t2i.Event AS EventB
+FROM
+ t1 t1a JOIN t2 t2a ON t2a.K1r = t1a.K1
+ LEFT JOIN
+ ( t1 t1i LEFT JOIN t2 t2i ON t2i.K1r = t1i.K1)
+ ON (t1i.K1 = 1) AND
+ (((t2i.K1r = t1a.K1 AND t2i.rowTimestamp > t2a.rowTimestamp ) OR
+ (t2i.rowTimestamp = t2a.rowTimestamp AND t2i.K2 > t2a.K2))
+ OR (t2i.K2 IS NULL))
+WHERE
+t2a.K1r = 1 AND t2i.K2 IS NULL;
+
+eval $q1;
+eval EXPLAIN EXTENDED $q1;
+
+CREATE VIEW v1 AS
+ SELECT t2i.*
+ FROM t1 as t1i LEFT JOIN t2 as t2i ON t2i.K1r = t1i.K1
+ WHERE t1i.K1 = 1 ;
+
+let $q2=
+SELECT
+ t1a.*, t2a.*, t2b.K2 as K2B, t2b.K1r as K1rB,
+ t2b.rowTimestamp as rowTimestampB, t2b.Event as EventB
+FROM
+ t1 as t1a JOIN t2 as t2a ON t2a.K1r = t1a.K1
+ LEFT JOIN
+ v1 as t2b
+ ON ((t2b.K1r = t1a.K1 AND t2b.rowTimestamp > t2a.rowTimestamp) OR
+ (t2b.rowTimestamp = t2a.rowTimestamp AND t2b.K2 > t2a.K2))
+ OR (t2b.K2 IS NULL)
+WHERE
+ t1a.K1 = 1 AND
+ t2b.K2 IS NULL;
+
+eval $q2;
+eval EXPLAIN EXTENDED $q2;
+
+DROP VIEW v1;
+DROP TABLE t1,t2;
+
+set optimizer_search_depth= @tmp_mdev621;
diff --git a/mysql-test/t/log_tables_upgrade.test b/mysql-test/t/log_tables_upgrade.test
index d08d74174db..36802fb38ad 100644
--- a/mysql-test/t/log_tables_upgrade.test
+++ b/mysql-test/t/log_tables_upgrade.test
@@ -24,4 +24,5 @@ RENAME TABLE test.bug49823 TO general_log;
DROP TABLE general_log;
RENAME TABLE renamed_general_log TO general_log;
SET GLOBAL general_log = @saved_general_log;
+remove_file $MYSQLD_DATADIR/mysql_upgrade_info;
USE test;
diff --git a/mysql-test/t/long_tmpdir-master.sh b/mysql-test/t/long_tmpdir-master.sh
index 7bcbee26105..318955fbcca 100755..100644
--- a/mysql-test/t/long_tmpdir-master.sh
+++ b/mysql-test/t/long_tmpdir-master.sh
@@ -1,4 +1,3 @@
-#!/bin/sh
d="$MYSQLTEST_VARDIR/tmp/long_temporary_directory_path_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789"
test -d "$d" || mkdir "$d"
rm -f "$d"/*
diff --git a/mysql-test/t/lowercase_mixed_tmpdir-master.sh b/mysql-test/t/lowercase_mixed_tmpdir-master.sh
index 9330d0581ee..95c26e3aa02 100755..100644
--- a/mysql-test/t/lowercase_mixed_tmpdir-master.sh
+++ b/mysql-test/t/lowercase_mixed_tmpdir-master.sh
@@ -1,4 +1,3 @@
-#!/bin/sh
# This test requires a non-lowercase tmpdir directory on a case-sensitive
# filesystem.
diff --git a/mysql-test/t/lowercase_mixed_tmpdir_innodb-master.sh b/mysql-test/t/lowercase_mixed_tmpdir_innodb-master.sh
index 95c26e3aa02..95c26e3aa02 100755..100644
--- a/mysql-test/t/lowercase_mixed_tmpdir_innodb-master.sh
+++ b/mysql-test/t/lowercase_mixed_tmpdir_innodb-master.sh
diff --git a/mysql-test/t/mysql_upgrade_noengine.test b/mysql-test/t/mysql_upgrade_noengine.test
new file mode 100644
index 00000000000..cfc3a1dc406
--- /dev/null
+++ b/mysql-test/t/mysql_upgrade_noengine.test
@@ -0,0 +1,57 @@
+#
+# MDEV-11942 BLACKHOLE is no longer active in 10.1 by default, mysql_upgrade not handling the situation
+#
+source include/have_innodb.inc;
+source include/not_embedded.inc;
+
+if (!$HA_BLACKHOLE_SO) {
+ skip Need blackhole plugin;
+}
+if (!$HA_ARCHIVE_SO) {
+ skip Need Archive plugin;
+}
+
+let $datadir= `select @@datadir`;
+
+install soname 'ha_blackhole';
+install soname 'ha_archive';
+
+vertical_results;
+create table t1 (a int) engine=blackhole;
+create table t2 (a int) engine=archive;
+select table_catalog, table_schema, table_name, table_type, engine, row_format, table_rows, data_length, table_comment from information_schema.tables where table_schema='test';
+
+flush tables;
+uninstall plugin blackhole;
+uninstall plugin archive;
+select table_catalog, table_schema, table_name, table_type, engine, row_format, table_rows, data_length, table_comment from information_schema.tables where table_schema='test';
+
+# upgrade from 10.1 - engines aren't enabled
+exec $MYSQL_UPGRADE 2>&1;
+select table_catalog, table_schema, table_name, table_type, engine, row_format, table_rows, data_length, table_comment from information_schema.tables where table_schema='test';
+
+# pretend it's an upgrade from 10.0
+alter table mysql.user drop column default_role, drop column max_statement_time;
+
+# but mysql_upgrade_info tells otherwise
+remove_file $datadir/mysql_upgrade_info;
+write_file $datadir/mysql_upgrade_info;
+10.1.10-MariaDB
+EOF
+
+# still upgrade from 10.1
+exec $MYSQL_UPGRADE 2>&1;
+select table_catalog, table_schema, table_name, table_type, engine, row_format, table_rows, data_length, table_comment from information_schema.tables where table_schema='test';
+
+alter table mysql.user drop column default_role, drop column max_statement_time;
+remove_file $datadir/mysql_upgrade_info;
+
+# upgrade from 10.0 - engines are enabled
+exec $MYSQL_UPGRADE 2>&1;
+select table_catalog, table_schema, table_name, table_type, engine, row_format, table_rows, data_length, table_comment from information_schema.tables where table_schema='test';
+
+drop table t1, t2;
+
+remove_file $datadir/mysql_upgrade_info;
+uninstall plugin blackhole;
+uninstall plugin archive;
diff --git a/mysql-test/t/mysql_upgrade_ssl.test b/mysql-test/t/mysql_upgrade_ssl.test
index 9049bf73821..daf5fad3df7 100644
--- a/mysql-test/t/mysql_upgrade_ssl.test
+++ b/mysql-test/t/mysql_upgrade_ssl.test
@@ -8,4 +8,5 @@
--echo # Bug#55672 mysql_upgrade dies with internal error
--echo #
--exec $MYSQL_UPGRADE --skip-verbose --skip-silent --ssl --force 2>&1
---exit
+--let $datadir= `select @@datadir`
+--remove_file $datadir/mysql_upgrade_info
diff --git a/mysql-test/t/mysql_upgrade_view.test b/mysql-test/t/mysql_upgrade_view.test
index 7afe1ad250d..6a496858d22 100644
--- a/mysql-test/t/mysql_upgrade_view.test
+++ b/mysql-test/t/mysql_upgrade_view.test
@@ -183,5 +183,6 @@ flush tables;
# back to mariadb default
drop table mysql.event;
rename table mysql.ev_bk to mysql.event;
+remove_file $MYSQLD_DATADIR/mysql_upgrade_info;
drop view v1,v2,v3;
drop table t1;
diff --git a/mysql-test/t/mysqldump.test b/mysql-test/t/mysqldump.test
index 090ed45c9f9..ea08f540cf3 100644
--- a/mysql-test/t/mysqldump.test
+++ b/mysql-test/t/mysqldump.test
@@ -2518,6 +2518,7 @@ if (`select convert(@@version_compile_os using latin1) IN ("Win32","Win64","Wind
}
--exec $MYSQL_DUMP --routines --compact $shell_ready_db_name
DROP DATABASE `a\"'``b`;
+
#"
use test;
@@ -2573,3 +2574,11 @@ CREATE VIEW nonunique_table_view_name AS SELECT 1;
DROP DATABASE db1;
DROP DATABASE db2;
+
+#"
+# MDEV-11505 wrong databasename in mysqldump comment
+#
+let SEARCH_FILE=$MYSQLTEST_VARDIR/tmp/bug11505.sql;
+let SEARCH_PATTERN=Database: mysql;
+exec $MYSQL_DUMP mysql func > $SEARCH_FILE;
+source include/search_pattern_in_file.inc;
diff --git a/mysql-test/t/partition_column.test b/mysql-test/t/partition_column.test
index 95a2be36395..be34e4eac63 100644
--- a/mysql-test/t/partition_column.test
+++ b/mysql-test/t/partition_column.test
@@ -398,7 +398,7 @@ drop table t1;
create table t1 as select to_seconds(null) as to_seconds;
select data_type from information_schema.columns
-where column_name='to_seconds';
+where table_schema='test' and column_name='to_seconds';
drop table t1;
--error ER_PARSE_ERROR
diff --git a/mysql-test/t/partition_innodb.test b/mysql-test/t/partition_innodb.test
index a05e086d79b..300121e88fd 100644
--- a/mysql-test/t/partition_innodb.test
+++ b/mysql-test/t/partition_innodb.test
@@ -819,6 +819,104 @@ INSERT INTO t1 (d) VALUES ('1991-01-01');
SELECT * FROM t1 WHERE d = '1991-01-01';
DROP TABLE t1;
+set global default_storage_engine=default;
+
+--echo #
+--echo # MDEV-9455: [ERROR] mysqld got signal 11
+--echo #
+
+CREATE TABLE `t1` (
+ `DIARY_TOTAL_DAY_SEQ` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
+ `IMORY_ID` bigint(20) NOT NULL,
+ `NAME` varchar(75) DEFAULT NULL,
+ `DATETIME` varchar(10) NOT NULL DEFAULT '',
+ `DAILY_CALL_CNT` int(11) DEFAULT NULL,
+ `DAILY_SMS_CNT` int(11) DEFAULT NULL,
+ `NUMBER` varchar(64) DEFAULT NULL,
+ `DURATION` varchar(16) DEFAULT NULL,
+ PRIMARY KEY (`DIARY_TOTAL_DAY_SEQ`,`DATETIME`),
+ KEY `IDX_t1_01` (`IMORY_ID`,`DATETIME`)
+) AUTO_INCREMENT=328702514 DEFAULT CHARSET=utf8mb4
+PARTITION BY RANGE COLUMNS(`DATETIME`)
+(PARTITION p0 VALUES LESS THAN ('2015-10-01') ENGINE = InnoDB,
+ PARTITION p1 VALUES LESS THAN ('2015-11-01') ENGINE = InnoDB,
+ PARTITION p2 VALUES LESS THAN ('2015-12-01') ENGINE = InnoDB,
+ PARTITION p3 VALUES LESS THAN ('2016-01-01') ENGINE = InnoDB,
+ PARTITION p4 VALUES LESS THAN ('2016-02-01') ENGINE = InnoDB,
+ PARTITION p5 VALUES LESS THAN ('2016-03-01') ENGINE = InnoDB,
+ PARTITION p6 VALUES LESS THAN ('2016-04-01') ENGINE = InnoDB,
+ PARTITION p7 VALUES LESS THAN ('2016-05-01') ENGINE = InnoDB,
+ PARTITION p8 VALUES LESS THAN ('2016-06-01') ENGINE = InnoDB,
+ PARTITION p9 VALUES LESS THAN ('2016-07-01') ENGINE = InnoDB,
+ PARTITION p10 VALUES LESS THAN ('2016-08-01') ENGINE = InnoDB)
+;
+
+CREATE TABLE `t2` (
+ `DIARY_SEQ` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
+ `IMORY_ID` bigint(20) NOT NULL,
+ `CALL_TYPE` varchar(1) DEFAULT NULL,
+ `DATA_TYPE` varchar(1) DEFAULT NULL,
+ `FEATURES` varchar(1) DEFAULT NULL,
+ `NAME` varchar(75) DEFAULT NULL,
+ `NUMBER` varchar(64) DEFAULT NULL,
+ `DATETIME` datetime NOT NULL,
+ `REG_DATE` datetime NOT NULL,
+ `TITLE` varchar(50) DEFAULT NULL,
+ `BODY` varchar(4200) DEFAULT NULL,
+ `MIME_TYPE` varchar(32) DEFAULT NULL,
+ `DURATION` varchar(16) DEFAULT NULL,
+ `DEVICE_ID` varchar(64) DEFAULT NULL,
+ `DEVICE_NAME` varchar(32) DEFAULT NULL,
+ PRIMARY KEY (`DIARY_SEQ`,`DATETIME`,`REG_DATE`),
+ KEY `IDX_TB_DIARY_01` (`IMORY_ID`,`DATETIME`,`CALL_TYPE`,`NUMBER`),
+ KEY `IDX_TB_DIARY_02` (`REG_DATE`)
+) AUTO_INCREMENT=688799006 DEFAULT CHARSET=utf8mb4
+PARTITION BY RANGE COLUMNS(REG_DATE)
+(PARTITION p0 VALUES LESS THAN ('2015-10-01') ENGINE = InnoDB,
+ PARTITION p1 VALUES LESS THAN ('2015-11-01') ENGINE = InnoDB,
+ PARTITION p2 VALUES LESS THAN ('2015-12-01') ENGINE = InnoDB,
+ PARTITION p3 VALUES LESS THAN ('2016-01-01') ENGINE = InnoDB,
+ PARTITION p4 VALUES LESS THAN ('2016-02-01') ENGINE = InnoDB,
+ PARTITION p5 VALUES LESS THAN ('2016-03-01') ENGINE = InnoDB,
+ PARTITION p6 VALUES LESS THAN ('2016-04-01') ENGINE = InnoDB,
+ PARTITION p7 VALUES LESS THAN ('2016-05-01') ENGINE = InnoDB,
+ PARTITION p8 VALUES LESS THAN ('2016-06-01') ENGINE = InnoDB,
+ PARTITION p9 VALUES LESS THAN ('2016-07-01') ENGINE = InnoDB,
+ PARTITION p10 VALUES LESS THAN ('2016-08-01') ENGINE = InnoDB)
+;
+
+SELECT
+ A.IMORY_ID,
+ A.NUMBER,
+ A.NAME,
+ DATE_FORMAT(A.DATETIME, '%Y-%m-%d') AS TARGET_DATE,
+ SUM( CASE WHEN A.DATA_TYPE='1' THEN 1 ELSE 0 END) AS CALL_CNT,
+ SUM( CASE WHEN A.DATA_TYPE IN ('2', '3') THEN 1 ELSE 0 END) AS SMS_CNT,
+ SUM(CAST(A.DURATION AS INT)) AS DURATION,
+ ( SELECT COUNT(*)
+ FROM t1
+ WHERE IMORY_ID=A.IMORY_ID
+ AND NUMBER=A.NUMBER
+ AND NAME=A.NAME
+ AND DATETIME = DATE_FORMAT(A.DATETIME, '%Y-%m-%d')
+ ) STATS_COUNT
+FROM t2 A
+WHERE A.IMORY_ID = 55094102
+ AND A.DATETIME LIKE (
+ SELECT CONCAT (DATE_FORMAT(DATETIME, '%Y-%m-%d') ,'%')
+ FROM t2
+ WHERE IMORY_ID=55094102
+ AND DIARY_SEQ IN ( 608351221, 608351225, 608351229 )
+ group by DATE_FORMAT(DATETIME, '%Y-%m-%d')
+ )
+GROUP BY A.IMORY_ID, A.NUMBER, A.NAME, DATE_FORMAT(A.DATETIME, '%Y-%m-%d')
+;
+
+drop table t2, t1;
+
+
+set global default_storage_engine='innodb';
+
--echo #
--echo # MDEV-5963: InnoDB: Assertion failure in file row0sel.cc line 2503,
--echo # Failing assertion: 0 with "key ptr now exceeds key end by 762 bytes"
diff --git a/mysql-test/t/partition_myisam.test b/mysql-test/t/partition_myisam.test
index d07637057e0..4d083c37b68 100644
--- a/mysql-test/t/partition_myisam.test
+++ b/mysql-test/t/partition_myisam.test
@@ -216,6 +216,28 @@ PARTITION BY RANGE (a)
PARTITION pMax VALUES LESS THAN MAXVALUE);
INSERT INTO t1 VALUES (1, "Partition p1, first row");
DROP TABLE t1;
+
+--echo #
+--echo # MDEV-10418 Assertion `m_extra_cache' failed
+--echo # in ha_partition::late_extra_cache(uint)
+--echo #
+
+CREATE TABLE t1 (f1 INT) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (1),(2);
+
+CREATE TABLE t2 (f2 INT) ENGINE=MyISAM PARTITION BY RANGE(f2) (PARTITION pmax VALUES LESS THAN MAXVALUE);
+INSERT INTO t2 VALUES (8);
+
+CREATE ALGORITHM = MERGE VIEW v AS SELECT f2 FROM t2, t1;
+
+UPDATE v SET f2 = 1;
+
+SELECT * FROM t2;
+
+DROP VIEW v;
+DROP TABLE t2;
+DROP TABLE t1;
+
--echo #
--echo # bug#11760213-52599: ALTER TABLE REMOVE PARTITIONING ON NON-PARTITIONED
--echo # TABLE CORRUPTS MYISAM
diff --git a/mysql-test/t/plugin_auth.test b/mysql-test/t/plugin_auth.test
index 81b8ba6e0a3..c3c18b7e427 100644
--- a/mysql-test/t/plugin_auth.test
+++ b/mysql-test/t/plugin_auth.test
@@ -522,6 +522,8 @@ SELECT IS_NULLABLE, COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_SCHEMA= 'mysql' AND TABLE_NAME= 'user' AND
COLUMN_NAME IN ('plugin', 'authentication_string')
ORDER BY COLUMN_NAME;
+let $datadir= `select @@datadir`;
+remove_file $datadir/mysql_upgrade_info;
--echo #
diff --git a/mysql-test/t/ps.test b/mysql-test/t/ps.test
index 549814724d2..b6d1b4862a6 100644
--- a/mysql-test/t/ps.test
+++ b/mysql-test/t/ps.test
@@ -3548,9 +3548,6 @@ EXECUTE s1;
DEALLOCATE PREPARE s1;
---echo #
---echo # End of 5.5 tests.
-
###########################################################################
#
# restoring of the Item tree in BETWEEN with dates
@@ -3697,6 +3694,40 @@ EXECUTE stmt;
deallocate prepare stmt;
drop table t1,t2,t3,t4;
+--echo #
+--echo # MDEV-11859: the plans for the first and the second executions
+--echo # of PS are not the same
+--echo #
+
+create table t1 (id int, c varchar(3), key idx(c))engine=myisam;
+insert into t1 values (3,'bar'), (1,'xxx'), (2,'foo'), (5,'yyy');
+
+prepare stmt1 from
+"explain extended
+ select * from t1 where (1, 2) in ( select 3, 4 ) or c = 'foo'";
+execute stmt1;
+execute stmt1;
+deallocate prepare stmt1;
+
+prepare stmt1 from
+"select * from t1 where (1, 2) in ( select 3, 4 ) or c = 'foo'";
+flush status;
+execute stmt1;
+show status like '%Handler_read%';
+flush status;
+execute stmt1;
+show status like '%Handler_read%';
+deallocate prepare stmt1;
+
+prepare stmt2 from
+"explain extended
+ select * from t1 where (1, 2) in ( select 3, 4 )";
+execute stmt2;
+execute stmt2;
+deallocate prepare stmt2;
+
+drop table t1;
+
--echo # End of 5.5 tests
--echo #
diff --git a/mysql-test/t/range_vs_index_merge.test b/mysql-test/t/range_vs_index_merge.test
index 7ecca454f4c..5d12d46c9e9 100644
--- a/mysql-test/t/range_vs_index_merge.test
+++ b/mysql-test/t/range_vs_index_merge.test
@@ -57,9 +57,9 @@ SELECT * FROM City
EXPLAIN
SELECT * FROM City
WHERE Population > 100000 AND Name LIKE 'Aba%' OR
- Country IN ('CAN', 'ARG') AND ID < 3800 OR
- Country < 'U' AND Name LIKE 'Zhu%' OR
- ID BETWEEN 3800 AND 3810;
+ Country IN ('CAN', 'ARG') AND ID BETWEEN 120 AND 130 OR
+ Country <= 'ALB' AND Name LIKE 'L%' OR
+ ID BETWEEN 3807 AND 3810;
# The output of the next 3 commands tells us about selectivities
# of the conditions utilized in 2 queries following after them
@@ -1206,6 +1206,41 @@ SELECT * FROM t1
DROP TABLE t1;
+
+--echo #
+--echo # MDEV-8603: Wrong result OR/AND condition over index fields
+--echo #
+
+CREATE TABLE t1 (
+ id INT NOT NULL,
+ state VARCHAR(64),
+ capital VARCHAR(64),
+ UNIQUE KEY (id),
+ KEY state (state,id),
+ KEY capital (capital, id)
+);
+
+INSERT INTO t1 VALUES
+ (1,'Arizona','Phoenix'),
+ (2,'Hawaii','Honolulu'),
+ (3,'Georgia','Atlanta'),
+ (4,'Florida','Tallahassee'),
+ (5,'Alaska','Juneau'),
+ (6,'Michigan','Lansing'),
+ (7,'Pennsylvania','Harrisburg'),
+ (8,'Virginia','Richmond')
+;
+
+EXPLAIN
+SELECT * FROM t1 FORCE KEY (state,capital)
+WHERE ( state = 'Alabama' OR state >= 'Colorado' ) AND id != 9
+ OR ( capital >= 'Topeka' OR state = 'Kansas' ) AND state != 'Texas';
+SELECT * FROM t1 FORCE KEY (state,capital)
+WHERE ( state = 'Alabama' OR state >= 'Colorado' ) AND id != 9
+ OR ( capital >= 'Topeka' OR state = 'Kansas' ) AND state != 'Texas';
+
+DROP TABLE t1;
+
#the following command must be the last one in the file
set session optimizer_switch='index_merge_sort_intersection=default';
diff --git a/mysql-test/t/repair_symlink-5543.test b/mysql-test/t/repair_symlink-5543.test
index 58cc810b1a9..4c120334d05 100644
--- a/mysql-test/t/repair_symlink-5543.test
+++ b/mysql-test/t/repair_symlink-5543.test
@@ -9,7 +9,9 @@
eval create table t1 (a int) engine=myisam data directory='$MYSQL_TMP_DIR';
insert t1 values (1);
--system ln -s $MYSQL_TMP_DIR/foobar5543 $MYSQL_TMP_DIR/t1.TMD
---replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
+--echo # Some systems fail with errcode 40, when doing openat, while others
+--echo # don't have openat and fail with errcode 20.
+--replace_regex / '.*\/t1/ 'MYSQL_TMP_DIR\/t1/ /40/20/ /".*"/"<errmsg>"/
repair table t1;
drop table t1;
@@ -17,7 +19,7 @@ drop table t1;
eval create table t2 (a int) engine=aria data directory='$MYSQL_TMP_DIR';
insert t2 values (1);
--system ln -s $MYSQL_TMP_DIR/foobar5543 $MYSQL_TMP_DIR/t2.TMD
---replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
+--replace_regex / '.*\/t2/ 'MYSQL_TMP_DIR\/t2/ /40/20/ /".*"/"<errmsg>"/
repair table t2;
drop table t2;
diff --git a/mysql-test/t/sp.test b/mysql-test/t/sp.test
index 08f7fa5035b..3ca210d9904 100644
--- a/mysql-test/t/sp.test
+++ b/mysql-test/t/sp.test
@@ -9411,6 +9411,46 @@ drop procedure p1;
drop table t1,t2,t3,t4,t5,t6;
+--echo #
+--echo # MDEV-11935: Queries in stored procedures with and
+--echo # EXISTS(SELECT * FROM VIEW) crashes and closes hte conneciton.
+--echo #
+
+CREATE TABLE ANY_TABLE (
+ ENTITY_UID BIGINT NOT NULL
+);
+CREATE TABLE SECURITY_PATH(
+origid BIGINT UNSIGNED NOT NULL,
+destid BIGINT UNSIGNED NOT NULL,
+KEY (destid)
+);
+CREATE VIEW ENTITY_ACCESS (
+ENTITY_UID,
+OWNER_UID
+) AS
+SELECT SP1.origid,
+ SP2.destid
+FROM SECURITY_PATH SP1
+JOIN SECURITY_PATH SP2 ON SP1.destid = SP2.origid
+;
+--delimiter //
+CREATE PROCEDURE SP_EXAMPLE_SELECT ()
+BEGIN
+ SELECT *
+ FROM ANY_TABLE AT1
+ WHERE EXISTS ( SELECT *
+ FROM ENTITY_ACCESS EA
+ WHERE AT1.ENTITY_UID = EA.ENTITY_UID
+ AND EA.OWNER_UID IS NULL );
+END
+//
+--delimiter ;
+CALL SP_EXAMPLE_SELECT ();
+CALL SP_EXAMPLE_SELECT ();
+
+drop procedure SP_EXAMPLE_SELECT;
+drop view ENTITY_ACCESS;
+drop table ANY_TABLE, SECURITY_PATH;
--echo # End of 10.0 test
DELIMITER |;
diff --git a/mysql-test/t/stat_tables_par.test b/mysql-test/t/stat_tables_par.test
index 7305d1453a8..1866eb71d3b 100644
--- a/mysql-test/t/stat_tables_par.test
+++ b/mysql-test/t/stat_tables_par.test
@@ -44,7 +44,7 @@ select * from mysql.index_stats;
#
let $Q6=
-select sum(l_extendedprice*l_discount) as revenue
+select round(sum(l_extendedprice*l_discount),4) as revenue
from lineitem
where l_shipdate >= date '1994-01-01'
and l_shipdate < date '1994-01-01' + interval '1' year
diff --git a/mysql-test/t/subselect4.test b/mysql-test/t/subselect4.test
index 253160c46ac..d4ccbcf6f66 100644
--- a/mysql-test/t/subselect4.test
+++ b/mysql-test/t/subselect4.test
@@ -1997,6 +1997,41 @@ EXECUTE stmt;
drop table t1, t2, t3;
+--echo #
+--echo # MDEV-11078: NULL NOT IN (non-empty subquery) should never return results
+--echo #
+
+create table t1(a int,b int);
+create table t2(a int,b int);
+insert into t1 value (1,2);
+select (NULL) in (select 1 from t1);
+select (null) in (select 1 from t2);
+select 1 in (select 1 from t1);
+select 1 in (select 1 from t2);
+select 1 from dual where null in (select 1 from t1);
+select 1 from dual where null in (select 1 from t2);
+select (null,null) in (select * from t1);
+select (null,null) in (select * from t2);
+select 1 from dual where null not in (select 1 from t1);
+select 1 from dual where null not in (select 1 from t2);
+drop table t1,t2;
+
+
+--echo #
+--echo # MDEV-6486: Assertion `!table || (!table->read_set || bitmap_is_set(table->read_set, field_index))'
+--echo # failed with SELECT SQ, TEXT field
+--echo #
+
+CREATE TABLE t1 (a VARCHAR(8), KEY(a)) ENGINE=MyISAM;
+INSERT INTO t1 VALUES ('foo'),( 'bar');
+
+CREATE TABLE t2 (b VARCHAR(8), c TINYTEXT, KEY(b)) ENGINE=MyISAM;
+INSERT INTO t2 VALUES ('baz','baz'),('qux', 'qux');
+
+SELECT ( SELECT COUNT(*) FROM t1 WHERE a = c ) AS field, COUNT(DISTINCT c)
+FROM t2 WHERE b <= 'quux' GROUP BY field;
+drop table t1,t2;
+
SET optimizer_switch= @@global.optimizer_switch;
set @@tmp_table_size= @@global.tmp_table_size;
diff --git a/mysql-test/t/subselect_innodb.test b/mysql-test/t/subselect_innodb.test
index af6ec90ba74..b26c5036f3f 100644
--- a/mysql-test/t/subselect_innodb.test
+++ b/mysql-test/t/subselect_innodb.test
@@ -483,6 +483,26 @@ drop table t1;
set optimizer_switch=@subselect_innodb_tmp;
--echo #
+--echo # MDEV-9635:Server crashes in part_of_refkey or assertion
+--echo # `!created && key_to_save < (int)s->keys' failed in
+--echo # TABLE::use_index(int) or with join_cache_level>2
+--echo #
+
+SET join_cache_level=3;
+
+CREATE TABLE t1 (f1 VARCHAR(1024)) ENGINE=InnoDB;
+CREATE ALGORITHM=TEMPTABLE VIEW v1 AS SELECT * FROM t1;
+
+CREATE TABLE t2 (f2 VARCHAR(4)) ENGINE=InnoDB;
+INSERT INTO t2 VALUES ('foo'),('bar');
+
+SELECT * FROM v1, t2 WHERE ( f1, f2 ) IN ( SELECT f1, f1 FROM t1 );
+
+set join_cache_level = default;
+drop view v1;
+drop table t1,t2;
+
+--echo #
--echo # MDEV-6041: ORDER BY+subqueries: subquery_table.key=outer_table.col is not recongized as binding
--echo #
create table t1(a int) engine=innodb;
@@ -535,4 +555,3 @@ from
t1;
drop table t1,t2;
-
diff --git a/mysql-test/t/symlink-aria-11902.test b/mysql-test/t/symlink-aria-11902.test
new file mode 100644
index 00000000000..a2a266cbb25
--- /dev/null
+++ b/mysql-test/t/symlink-aria-11902.test
@@ -0,0 +1,6 @@
+#
+# MDEV-11902 mi_open race condition
+#
+source include/have_maria.inc;
+set default_storage_engine=Aria;
+source symlink-myisam-11902.test;
diff --git a/mysql-test/t/symlink-myisam-11902.test b/mysql-test/t/symlink-myisam-11902.test
new file mode 100644
index 00000000000..8fd4961d1fb
--- /dev/null
+++ b/mysql-test/t/symlink-myisam-11902.test
@@ -0,0 +1,60 @@
+#
+# MDEV-11902 mi_open race condition
+#
+source include/have_debug_sync.inc;
+source include/have_symlink.inc;
+source include/not_windows.inc;
+call mtr.add_suppression("File.*t1.* not found");
+
+create table mysql.t1 (a int, b char(16), index(a));
+insert mysql.t1 values (100, 'test'),(101,'test');
+let $datadir=`select @@datadir`;
+
+exec mkdir $MYSQLTEST_VARDIR/tmp/foo;
+replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR;
+eval create table t1 (a int, b char(16), index(a))
+ data directory="$MYSQLTEST_VARDIR/tmp/foo";
+insert t1 values (200, 'some'),(201,'some');
+select * from t1;
+flush tables;
+set debug_sync='mi_open_datafile SIGNAL ok WAIT_FOR go';
+send select * from t1;
+connect con1, localhost, root;
+set debug_sync='now WAIT_FOR ok';
+exec rm -r $MYSQLTEST_VARDIR/tmp/foo;
+exec ln -s $datadir/mysql $MYSQLTEST_VARDIR/tmp/foo;
+set debug_sync='now SIGNAL go';
+connection default;
+replace_regex / '.*\/tmp\// 'MYSQLTEST_VARDIR\/tmp\// /31/20/ /40/20/ /20.*/20 <errmsg>)/;
+error 29;
+reap;
+flush tables;
+drop table if exists t1;
+exec rm -r $MYSQLTEST_VARDIR/tmp/foo;
+
+# same with INDEX DIRECTORY
+exec mkdir $MYSQLTEST_VARDIR/tmp/foo;
+replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR;
+eval create table t1 (a int, b char(16), index (a))
+ index directory="$MYSQLTEST_VARDIR/tmp/foo";
+insert t1 values (200, 'some'),(201,'some');
+explain select a from t1;
+select a from t1;
+flush tables;
+set debug_sync='mi_open_kfile SIGNAL waiting WAIT_FOR run';
+send select a from t1;
+connection con1;
+set debug_sync='now WAIT_FOR waiting';
+exec rm -r $MYSQLTEST_VARDIR/tmp/foo;
+exec ln -s $datadir/mysql $MYSQLTEST_VARDIR/tmp/foo;
+set debug_sync='now SIGNAL run';
+connection default;
+replace_regex / '.*\/test\// '.\/test\// /31/20/ /40/20/ /20.*/20 <errmsg>)/;
+error ER_FILE_NOT_FOUND;
+reap;
+flush tables;
+drop table if exists t1;
+exec rm -r $MYSQLTEST_VARDIR/tmp/foo;
+
+drop table mysql.t1;
+set debug_sync='RESET';
diff --git a/mysql-test/t/table_elim.test b/mysql-test/t/table_elim.test
index 52857f9169f..8de4743b9fd 100644
--- a/mysql-test/t/table_elim.test
+++ b/mysql-test/t/table_elim.test
@@ -534,12 +534,12 @@ INSERT IGNORE INTO t1 VALUES (0,'g');
CREATE TABLE t3 ( a varchar(1)) ;
INSERT IGNORE INTO t3 VALUES ('g');
-CREATE TABLE t2 ( a int(11) NOT NULL, PRIMARY KEY (a)) ;
+CREATE TABLE t2 ( a int(11) NOT NULL, PRIMARY KEY (a));
+INSERT INTO t2 VALUES (9), (10);
create view v1 as SELECT t1.* FROM t1 LEFT JOIN t2 ON ( t1.a = t2.a ) WHERE t2.a <> 0;
SELECT alias1.* FROM t3 LEFT JOIN v1 as alias1 ON ( t3.a = alias1.b );
EXPLAIN SELECT alias1.* FROM t3 LEFT JOIN v1 as alias1 ON ( t3.a = alias1.b );
-
drop view v1;
DROP TABLE t1,t2,t3;
diff --git a/mysql-test/t/trigger_no_defaults-11698.test b/mysql-test/t/trigger_no_defaults-11698.test
index fab7845ad7d..c10bec68314 100644
--- a/mysql-test/t/trigger_no_defaults-11698.test
+++ b/mysql-test/t/trigger_no_defaults-11698.test
@@ -23,3 +23,20 @@ insert t1 (b) values (20);
insert t1 (b) values (30);
select * from t1;
drop table t1;
+set sql_mode=default;
+
+#
+# MDEV-11842 Fail to insert on a table where a field has no default
+#
+set sql_mode='';
+create table t1 (
+ id int(11) not null auto_increment primary key,
+ data1 varchar(10) not null,
+ data2 varchar(10) not null
+);
+insert into t1 (data2) values ('x');
+create trigger test_trigger before insert on t1 for each row begin end;
+insert into t1 (data2) values ('y');
+select * from t1;
+drop table t1;
+set sql_mode=default;
diff --git a/mysql-test/t/type_newdecimal.test b/mysql-test/t/type_newdecimal.test
index eb0fac57150..dd5311e4be3 100644
--- a/mysql-test/t/type_newdecimal.test
+++ b/mysql-test/t/type_newdecimal.test
@@ -1738,12 +1738,39 @@ SHOW CREATE TABLE t1;
DROP TABLE t1;
--echo #
+--echo # Bug#18408499 UNSIGNED BIGINT HIGH VALUES
+--echo # WRONG NUMERICAL COMPARISON RESULTS
+--echo #
+
+CREATE TABLE t1(value DECIMAL(24,0) NOT NULL);
+INSERT INTO t1(value)
+VALUES('100000000000000000000001'),
+ ('100000000000000000000002'),
+ ('100000000000000000000003');
+SELECT * FROM t1 WHERE value = '100000000000000000000002';
+SELECT * FROM t1 WHERE '100000000000000000000002' = value;
+SELECT * FROM t1 WHERE value + 0 = '100000000000000000000002';
+SELECT * FROM t1 WHERE value = 100000000000000000000002;
+SELECT * FROM t1 WHERE value + 0 = 100000000000000000000002;
+
+PREPARE stmt FROM 'SELECT * FROM t1 WHERE value = ?';
+set @a="100000000000000000000002";
+EXECUTE stmt using @a;
+set @a=100000000000000000000002;
+EXECUTE stmt using @a;
+DEALLOCATE PREPARE stmt;
+
+ALTER TABLE t1 ADD INDEX value (value);
+SELECT * FROM t1 WHERE value = '100000000000000000000002';
+DROP TABLE t1;
+
+--echo #
--echo # End of 10.1 tests
--echo #
--echo #
--echo # Test CREATE .. SELECT
---echo
+--echo #
create or replace table t1 as select 1.000000000000000000000000000000000 as a;
show create table t1;
diff --git a/mysql-test/t/update_innodb.test b/mysql-test/t/update_innodb.test
index 67c356c4e2e..0e93e7d9593 100644
--- a/mysql-test/t/update_innodb.test
+++ b/mysql-test/t/update_innodb.test
@@ -37,3 +37,29 @@ UPDATE t1 a JOIN t2 b ON a.c1 = b.c1 JOIN v1 vw ON b.c2 = vw.c1 JOIN t3 del ON v
drop view v1;
drop table t1,t2,t3,t4;
+
+--echo #
+--echo # MDEV-10232 Scalar result of subquery changes after adding an outer select stmt
+--echo #
+
+CREATE TABLE t1 (
+ a_id INT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
+ b_id INT(20) UNSIGNED NULL DEFAULT NULL,
+ c_id VARCHAR(255) NULL DEFAULT NULL,
+ PRIMARY KEY (a_id))COLLATE = 'utf8_general_ci' ENGINE = InnoDB;
+
+CREATE TABLE t2 (
+ b_id INT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
+ c_id VARCHAR(255) NULL DEFAULT NULL,
+ PRIMARY KEY (b_id),
+ INDEX idx_c_id (c_id))COLLATE = 'utf8_general_ci' ENGINE = InnoDB;
+
+INSERT INTO t1 (b_id, c_id) VALUES (NULL, NULL);
+INSERT INTO t2 (c_id) VALUES (NULL);
+INSERT INTO t2 (c_id) VALUES (NULL);
+
+SELECT * FROM t1;
+SELECT t2.b_id FROM t1,t2 WHERE t2.c_id = t1.c_id;
+UPDATE t1 SET b_id = (SELECT t2.b_id FROM t2 t2 WHERE t2.c_id = t1.c_id);
+SELECT * FROM t1;
+drop table t1,t2;
diff --git a/mysql-test/t/view.test b/mysql-test/t/view.test
index e5dd22c64c3..eaaebba166c 100644
--- a/mysql-test/t/view.test
+++ b/mysql-test/t/view.test
@@ -5508,6 +5508,66 @@ SHOW CREATE VIEW v1;
drop view v1;
drop table t1,t2;
+
+--echo #
+--echo # MDEV-12099: usage of mergeable view with LEFT JOIN
+--echo # that can be converted to INNER JOIN
+--echo #
+
+create table t1 (a int, b int, key(a)) engine=myisam;
+insert into t1 values
+ (3,20), (7,10), (2,10), (4,30), (8,70),
+ (7,70), (9,100), (9,60), (8,80), (7,60);
+
+create table t2 (c int, d int, key (c)) engine=myisam;
+insert into t2 values
+ (50,100), (20, 200), (10,300),
+ (150,100), (120, 200), (110,300),
+ (250,100), (220, 200), (210,300);
+
+create table t3(e int, f int not null, key(e), unique (f)) engine=myisam;
+insert into t3 values
+ (100, 3), (300, 5), (400, 4), (300,7),
+ (300,2), (600, 13), (800, 15), (700, 14),
+ (600, 23), (800, 25), (700, 24);
+
+create view v1 as
+ select * from t2 left join t3 on t3.e=t2.d where t3.f is not null;
+
+select *
+ from t1 left join v1 on v1.c=t1.b
+ where t1.a < 5;
+
+select *
+ from t1 left join ( t2 left join t3 on t3.e=t2.d )
+ on t2.c=t1.b and t3.f is not null
+ where t1.a < 5;
+
+explain extended
+select *
+ from t1 left join v1 on v1.c=t1.b
+ where t1.a < 5;
+
+explain extended
+select *
+ from t1 left join ( t2 left join t3 on t3.e=t2.d )
+ on t2.c=t1.b and t3.f is not null
+ where t1.a < 5;
+
+explain extended
+select *
+ from t1 left join v1 on v1.c=t1.b and v1.f=t1.a
+ where t1.a < 5;
+
+explain extended
+select *
+ from t1 left join ( t2 left join t3 on t3.e=t2.d )
+ on t2.c=t1.b and t3.f=t1.a and t3.f is not null
+ where t1.a < 5;
+
+drop view v1;
+drop table t1,t2,t3;
+
--echo # -----------------------------------------------------------------
--echo # -- End of 5.5 tests.
--echo # -----------------------------------------------------------------
diff --git a/mysql-test/unstable-tests b/mysql-test/unstable-tests
index 42985e1d66d..4812456839d 100644
--- a/mysql-test/unstable-tests
+++ b/mysql-test/unstable-tests
@@ -1,17 +1,17 @@
##############################################################################
#
# List the test cases which, unlike tests from disabled.def files,
-# can still be run on the current tree meaningfully, but are known
+# can still be run on the current tree meaningfully, but are known
# or suspected to fail sporadically on different reasons.
#
# Most common reasons are either test failures observed in buildbot,
-# or recent modifications to the tests which make their stability
-# unknown.
+# or recent modifications to the tests which make their stability
+# unknown.
#
-# Tests included due to recent modifications are later removed from the
-# list, if during a certain period they do not fail (and are not
-# modified again). Tests included due to intermittent failures are
-# removed when corresponding bug reports are closed.
+# Tests included due to recent modifications are later removed from the
+# list, if during a certain period they do not fail (and are not
+# modified again). Tests included due to intermittent failures are
+# removed when corresponding bug reports are closed.
#
# Separate the test case name and the comment with ':'.
#
@@ -19,17 +19,18 @@
#
# '*' wildcard in testcase names is supported.
#
-# To use the list, run MTR with --skip-test-list=unstable-tests option.
+# To use the list, run MTR with --skip-test-list=unstable-tests option.
#
##############################################################################
-main.alter_table : Modified in 10.1.21
+main.alter_table : Modified in 10.1.22
main.alter_table_trans : MDEV-11805 - timeout
-main.analyze_stmt_slow_query_log : Modified in 10.1.21
+main.analyze_format_json : MDEV-11866 - Wrong result; also uses analyze-format.inc modified in 10.1.22
+main.analyze_stmt_orderby : MDEV-11866 - Wrong result; also uses analyze-format.inc modified in 10.1.22
+main.analyze_stmt_slow_query_log : MDEV-12237 - Wrong result; also 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.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
@@ -37,64 +38,68 @@ 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.events_restart : MDEV-11221: assertion failure
+main.derived : Modified in 10.1.22
+main.drop_bad_db_type : Modified in 10.1.22
+main.events_restart : MDEV-12236 - Server shutdown problem
main.events_slowlog : Added in 10.1.21
-main.fulltext_charsets : Added in 10.1.20
+main.explain_json : Uses analyze-format.inc modified in 10.1.22
+main.explain_json_format_partitions : Uses analyze-format.inc modified in 10.1.22
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.gis : Modified in 10.1.22
+main.grant : Modified in 10.1.22
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, 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.join_nested : MOdified in 10.1.22
main.kill_processlist-6619 : MDEV-10793 - wrong result in processlist
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.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 : Modified in 10.1.22
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.mysql_upgrade_noengine : MDEV-12233 - Wrong result; added in 10.1.22
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.partition_column : Modified in 10.1.22
+main.partition_innodb : Modified in 10.1.22
+main.partition_myisam : Modified in 10.1.22
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.ps : MDEV-11017 - sporadic wrong Prepared_stmt_count; also modified in 10.1.22
+main.range_vs_index_merge : Modified in 10.1.22
+main.repair_symlink-5543 : MDEV-12215 - Wrong error codes; also modified in 10.1.22
main.show_explain : MDEV-10674 - sporadic failure
main.signal_demo3 : MDEV-11720 - Thread stack overrun on labrador
-main.sp : Modified in 10.1.21
+main.sp : Modified in 10.1.22
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.stat_tables_par : Modified in 10.1.22
main.status : MDEV-8510 - sporadic wrong result
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.subselect4 : Modified in 10.1.22
+main.subselect_cache : Modified in 10.1.22
+main.subselect_innodb : MDEV-10614 - sporadic wrong results; also modified in 10.1.22
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.symlink-aria-11902 : MDEV-12215 - Unexpected errors; also added in 10.1.22
+main.symlink-myisam-11902 : MDEV-12215 - Unexpected errors; also added in 10.1.22
+main.table_elim : Modified in 10.1.22
main.trigger_null-8605 : Modified in 10.1.21
+main.trigger_no_defaults-11698 : Modified in 10.1.22
main.type_datetime_hires : MDEV-10687 - timeout
-main.type_decimal : Modified in 10.1.20
+main.type_newdecimal : Modified in 10.1.22
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
+main.update_innodb : Modified in 10.1.22
+main.view : Modified in 10.1.22
#----------------------------------------------------------------
@@ -104,50 +109,49 @@ archive.discover : MDEV-10510 - table is marked as crashed; modified in 10.1.
#----------------------------------------------------------------
binlog.binlog_commit_wait : MDEV-10150 - Error: too much time elapsed
-binlog.binlog_incident : Uses binlog_start_pos.inc modified in 10.1.20
-binlog.binlog_killed : Uses binlog_start_pos.inc modified in 10.1.20
-binlog.binlog_killed_simulate : Uses binlog_start_pos.inc modified in 10.1.20
-binlog.binlog_mysqlbinlog2 : Uses binlog_start_pos.inc modified in 10.1.20
-binlog.mix_innodb_myisam_binlog : Uses binlog_start_pos.inc modified in 10.1.20
-binlog.binlog_row_annotate : Uses binlog_start_pos.inc modified in 10.1.20
+binlog.binlog_max_binlog_stmt_cache_size : Added in 10.1.22
binlog.binlog_xa_recover : MDEV-8517 - Extra checkpoint
#----------------------------------------------------------------
-binlog_encryption.* : Added in 10.1.20
+binlog_encryption.* : Added in 10.1.20, still unstable (valgrind errors and such)
+
+binlog_encryption.rpl_parallel : MDEV-10653 - Timeout
+binlog_encryption.rpl_semi_sync : MDEV-11220 - Wrong result
+binlog_encryption.rpl_ssl : MDEV-11542 - Server crash
#----------------------------------------------------------------
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
+connect.xml_zip : Added in 10.1.22
+connect.zip : Added in 10.1.22
#----------------------------------------------------------------
encryption.create_or_replace : MDEV-9359 - Assertion failure
-encryption.encrypt_and_grep : MDEV-11222 - InnoDB error; also uses search_pattern_in_file.inc modified in 10.1.20
-encryption.filekeys_emptyfile : Uses search_pattern_in_file.inc modified in 10.1.20
-encryption.filekeys_encfile_bad : Uses search_pattern_in_file.inc modified in 10.1.20
-encryption.filekeys_encfile_badfile : Uses search_pattern_in_file.inc modified in 10.1.20
-encryption.filekeys_encfile_no : Uses search_pattern_in_file.inc modified in 10.1.20
-encryption.filekeys_nofile : Uses search_pattern_in_file.inc modified in 10.1.20
-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.encrypt_and_grep : MDEV-11222 - InnoDB error
+encryption.innodb-bad-key-change : Modified in 10.1.22
+encryption.innodb-bad-key-change2 : Modified in 10.1.22
encryption.innodb-bad-key-change3 : Modified in 10.1.21
-encryption.innodb-bad-key-shutdown : MDEV-9105 - valgrind warnings, assertion failures
+encryption.innodb-bad-key-change4 : Modified in 10.1.22
+encryption.innodb-bad-key-change5 : Modified in 10.1.22
+encryption.innodb-bad-key-shutdown : MDEV-9105 - valgrind warnings, assertion failures; also modified in 10.1.22
encryption.innodb-discard-import : Modified in 10.1.21
encryption.innodb-discard-import-change : Modified in 10.1.21
+encryption.innodb-encryption-disable : Modified in 10.1.22
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_encryption_tables : MDEV-9359 - Assertion failure
encryption.innodb_first_page : MDEV-10689 - crashes
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-missing-key : MDEV-9359 - assertion failure; also modified in 10.1.22
+encryption.innodb_onlinealter_encryption : MDEV-10099 - wrong results
encryption.innodb-page_encryption : MDEV-10641 - mutex problem
+encryption.innodb-read-only : Added in 10.1.22
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
@@ -159,13 +163,15 @@ engines/funcs.* : Not maintained in timely manner
#----------------------------------------------------------------
-federated.federatedx : MDEV-10617 - Wrong checksum, timeouts
+federated.federated_bug_35333 : Modified in 10.1.22
federated.federated_innodb : MDEV-10617, MDEV-10417 - Wrong checksum, timeouts, fails on Mips
federated.federated_partition : MDEV-10417 - Fails on Mips
federated.federated_transactions : MDEV-10617, MDEV-10417 - Wrong checksum, timeouts, fails on Mips
+federated.federatedx : MDEV-10617 - Wrong checksum, timeouts
#----------------------------------------------------------------
+funcs_1.is_columns_mysql : Modified in 10.1.22
funcs_1.processlist_val_no_prot : MDEV-11223 - Wrong result
funcs_2.innodb_charset : Modified in 10.1.21
@@ -174,51 +180,58 @@ funcs_2.myisam_charset : MDEV-11535 - Timeout
#----------------------------------------------------------------
+galera.* : suite.pm modified in 10.1.22
+
+galera.galera_mdev_10812 : Added in 10.1.22
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.galera_split_brain : Modified in 10.1.21
+galera.galera_var_certify_nonPK_off : Modified in 10.1.22
+galera.galera_var_max_ws_rows : Modified in 10.1.22
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.101_compatibility : Modified in 10.1.22
+innodb.alter_key_block_size-11757 : Added in 10.1.22
+innodb.binlog_consistent : MDEV-10618 - Server fails to start
+innodb.doublewrite : Modified in 10.1.22
innodb.group_commit_crash : Modified in 10.1.21
innodb.group_commit_crash_no_optimize_thread : Modified in 10.1.21
+innodb.innodb-32k-crash : Modified in 10.1.22
+innodb.innodb-64k-crash : Modified in 10.1.22
innodb.innodb-alter-table : MDEV-10619 - Testcase timeout
+innodb.innodb-blob : MDEV-12053 - Client crash; also modified in 10.1.22
+innodb.innodb_blob_unrecoverable_crash : Modified in 10.1.22
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_bug11754376 : Modified in 10.1.22
+innodb.innodb_bug14147491 : MDEV-11808, also modified in 10.1.22
+innodb.innodb_bug14676111 : MDEV-11802 - wrong result; also modified in 10.1.22
innodb.innodb_bug30423 : MDEV-7311 - Wrong number of rows in the plan
+innodb.innodb_bug53756 : Modified in 10.1.22
+innodb.innodb_bug56947 : Modified in 10.1.22
+innodb.innodb_bug59641 : Modified in 10.1.22
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-get-fk : Modified in 10.1.22
+innodb.innodb-page_compression_default : Added in 10.1.22
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
innodb.innodb-wl5522-1 : MDEV-9105 - valgrind warnings, assertion failures
-innodb.innodb-wl5522-debug-zip : Modified in 10.1.21
+innodb.innodb-wl5522-debug : Modified in 10.1.22
+innodb.innodb-wl5522-debug-zip : Modified in 10.1.22
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.21
-
-#----------------------------------------------------------------
+innodb.log_file_size : Added in 10.1.22
+innodb.read_only_recovery : Added in 10.1.22
+innodb.xa_recovery : Modified in 10.1.22
-innodb_fts.create : Added in 10.1.20
-
-#----------------------------------------------------------------
-
-maria.collations : Added in 10.1.20
-maria.maria-connect : Uses binlog_start_pos.inc modified in 10.1.20
+innodb_fts.crash_recovery : Added in 10.1.22
+innodb_fts.innodb_fts_result_cache_limit : Modified in 10.1.22
+innodb_fts.misc_debug : Added in 10.1.22
#----------------------------------------------------------------
@@ -233,29 +246,61 @@ mroonga/storage.repair_table_no_index_file : MDEV-9364 -
#----------------------------------------------------------------
-multi_source.gtid : MDEV-10620, MDEV-10417 - Timeout in wait condition, fails on Mips
+multi_source.gtid : MDEV-10417 - Fails on Mips
multi_source.info_logs : MDEV-10042 - wrong result
-multi_source.multisource : MDEV-10417 - Fails on Mips; also uses binlog_start_pos.inc modified in 10.1.20
-multi_source.reset_slave : MDEV-10690 - wrong result; also uses binlog_start_pos.inc modified in 10.1.20
-multi_source.simple : MDEV-4633 - Wrong slave status output; also uses binlog_start_pos.inc modified in 10.1.20
+multi_source.multisource : MDEV-10417 - Fails on Mips
+multi_source.reset_slave : MDEV-10690 - wrong result
+multi_source.simple : MDEV-4633 - Wrong slave status output
multi_source.status_vars : MDEV-4632 - failed while waiting for Slave_received_heartbeats
#----------------------------------------------------------------
-parts.partition_float_myisam : MDEV-10621 - Testcase timeout
-parts.partition_int_myisam : MDEV-10621 - Testcase timeout
+oqgraph.regression_mdev6282 : Modified in 10.1.22
+oqgraph.regression_mdev6345 : Modified in 10.1.22
#----------------------------------------------------------------
+parts.partition_bigint_innodb : Added in 10.1.22
+parts.partition_bigint_myisam : Added in 10.1.22
+parts.partition_double_innodb : Added in 10.1.22
+parts.partition_double_myisam : Added in 10.1.22
+parts.partition_float_innodb : Modified in 10.1.22
+parts.partition_float_myisam : Modified in 10.1.22
+parts.partition_int_innodb : Modified in 10.1.22
+parts.partition_int_myisam : Modified in 10.1.22
+parts.partition_mediumint_innodb : Added in 10.1.22
+parts.partition_mediumint_myisam : Added in 10.1.22
+parts.partition_smallint_innodb : Added in 10.1.22
+parts.partition_smallint_myisam : Added in 10.1.22
+parts.partition_tinyint_innodb : Added in 10.1.22
+parts.partition_tinyint_myisam : Added in 10.1.22
+
+#----------------------------------------------------------------
+
+perfschema.csv_table_io : Uses table_io_result_helper.inc modified in 10.1.22
perfschema.func_file_io : MDEV-5708 - fails for s390x
perfschema.func_mutex : MDEV-5708 - fails for s390x
+perfschema.indexed_table_io : Uses table_io_result_helper.inc modified in 10.1.22
+perfschema.innodb_table_io : Uses table_io_result_helper.inc modified in 10.1.22
+perfschema.memory_table_io : Uses table_io_result_helper.inc modified in 10.1.22
+perfschema.merge_table_io : Uses table_io_result_helper.inc modified in 10.1.22
+perfschema.multi_table_io : Uses table_io_result_helper.inc modified in 10.1.22
+perfschema.myisam_table_io : Uses table_io_result_helper.inc modified in 10.1.22
+perfschema.part_table_io : Uses table_io_result_helper.inc modified in 10.1.22
+perfschema.privilege_table_io : Uses table_io_result_helper.inc modified in 10.1.22
+perfschema.rollback_table_io : Uses table_io_result_helper.inc modified in 10.1.22
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
+perfschema.table_name : Modified in 10.1.22
+perfschema.temp_table_io : Uses table_io_result_helper.inc modified in 10.1.22
+perfschema.threads_mysql : MDEV-10677 - sporadic wrong result; also modified in 10.1.22
+perfschema.trigger_table_io : Uses table_io_result_helper.inc modified in 10.1.22
+perfschema.view_table_io : Uses table_io_result_helper.inc modified in 10.1.22
#----------------------------------------------------------------
+plugins.auth_ed25519 : Added in 10.1.22
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
@@ -264,47 +309,34 @@ 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
-
-#----------------------------------------------------------------
-
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
rpl.rpl_binlog_index : MDEV-9501 - Warning: failed registering on master
-rpl.rpl_checksum : Uses search_pattern_in_file.inc modified in 10.1.20
-rpl.rpl_checksum_cache : MDEV-10626 - Testcase timeout
-rpl.rpl_circular_for_4_hosts : MDEV-10627 - Testcase timeout
+rpl.rpl_checksum_cache : MDEV-12173 - Unexpected error
rpl.rpl_ddl : MDEV-10417 - Fails on Mips
rpl.rpl_domain_id_filter_restart : MDEV-10684 - Wrong result
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
-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_heartbeat_basic : Modified in 10.1.22
rpl.rpl_innodb_bug30888 : MDEV-10417 - Fails on Mips
rpl.rpl_insert : MDEV-9329 - Fails on Ubuntu/s390x
rpl.rpl_insert_delayed : MDEV-9329 - Fails on Ubuntu/s390x
rpl.rpl_invoked_features : MDEV-10417 - Fails on Mips
rpl.rpl_mariadb_slave_capability : MDEV-11018 - sporadic wrong events in binlog
-rpl.rpl_mdev10863 : Added in 10.1.20
rpl.rpl_mdev6020 : MDEV-10630, MDEV-10417 - Timeouts, fails on Mips
-rpl.rpl_mdev6386 : MDEV-10631 - Wrong result on slave
-rpl.rpl_parallel : MDEV-10632, MDEV-10653 - Failures to sync, timeouts
+rpl.rpl_mdev6386 : Modified in 10.1.22
+rpl.rpl_parallel : MDEV-10653 - Timeouts
rpl.rpl_parallel_optimistic : MDEV-10511 - timeout
rpl.rpl_parallel_retry : MDEV-11119 - Server crash
rpl.rpl_parallel_temptable : MDEV-10356 - Crash in close_thread_tables
rpl.rpl_partition_innodb : MDEV-10417 - Fails on Mips
-rpl.rpl_row_annotate : Uses binlog_start_pos.inc modified in 10.1.20
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
@@ -316,8 +348,6 @@ 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 : Modified in 10.1.21
@@ -353,16 +383,12 @@ sys_vars.autocommit_func2 : MDEV-9329 - Fails on Ubuntu/s39
sys_vars.keep_files_on_create_basic : MDEV-10676 - timeout
sys_vars.innodb_buffer_pool_dump_pct_basic : MDEV-10651 - sporadic failure on file_exists
sys_vars.innodb_fatal_semaphore_wait_threshold : MDEV-10513 - crashes
-sys_vars.replicate_do_db_basic : Modified in 10.1.20
-sys_vars.replicate_do_table_basic : Modified in 10.1.20
-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.innodb_stats_include_delete_marked_basic : Added in 10.1.22
+sys_vars.log_slow_admin_statements_func : MDEV-12235 - Server crash
sys_vars.rpl_init_slave_func : MDEV-10149 - wrong results
+sys_vars.secure_file_priv : Modified in 10.1.22
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
#----------------------------------------------------------------
@@ -370,15 +396,17 @@ tokudb.cluster_filter : MDEV-10678 - Wrong execution plan
tokudb.cluster_filter_hidden : MDEV-10678 - Wrong execution plan
tokudb.cluster_filter_unpack_varchar : MDEV-10636 - Wrong execution plan
tokudb.dir_per_db : MDEV-11537 - Wrong result
-tokudb.table_index_statistics : Added in 10.1.20
+tokudb.dir_per_db_rename_to_nonexisting_schema : Added in 10.1.22
+tokudb.gap_lock_error : Added in 10.1.22
+tokudb.locks-select-update-3 : Modified in 10.1.22
+tokudb.percona_kill_idle_trx_tokudb : Modified in 10.1.22
+
+tokudb_backup.* : suite.opt modified in 10.1.22
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
-
#----------------------------------------------------------------
unit.ma_test_loghandler : MDEV-10638 - record read not ok
@@ -387,11 +415,12 @@ unit.ma_test_loghandler : MDEV-10638 - record read not ok
vcol.not_supported : MDEV-10639 - Testcase timeout
vcol.vcol_keys_innodb : MDEV-10639 - Testcase timeout
+vcol.vcol_select_myisam : Modified in 10.1.22
#----------------------------------------------------------------
-wsrep.binlog_format : MDEV-11532 - WSREP has not yet prepared node
-
-#----------------------------------------------------------------
+wsrep.binlog_format : MDEV-11532 - WSREP has not yet prepared node
+wsrep.pool_of_threads : MDEV-12234 - Library problem on Power
-wsrep_info.plugin : MDEV-11530 - Warnings; also modified in 10.1.20
+wsrep_info.* : suite.pm changed in 10.1.22
+wsrep_info.plugin : MDEV-12232 - Crash on Power
diff --git a/mysql-test/valgrind.supp b/mysql-test/valgrind.supp
index 6bdbcab4530..eb03eae6045 100644
--- a/mysql-test/valgrind.supp
+++ b/mysql-test/valgrind.supp
@@ -1072,6 +1072,15 @@
fun:SSL_library_init
}
+{
+ OpenSSL still reachable.
+ Memcheck:Leak
+ fun:*alloc
+ fun:CRYPTO_malloc
+ fun:sk_new
+ fun:SSL_COMP_get_compression_methods
+ fun:SSL_library_init
+}
{
OpenSSL still reachable.
@@ -1130,6 +1139,16 @@
}
{
+ Memory Leak in loader and valgrind malloc
+ Memcheck:Leak
+ match-leak-kinds:reachable
+ obj:*/vgpreload_memcheck*.so
+ ...
+ obj:*/ld-*.so
+ ...
+}
+
+{
ConnectSE: unixODBC SQLAllocEnv leaves some "still reachable" pointers
Memcheck:Leak
fun:malloc
diff --git a/mysys/CMakeLists.txt b/mysys/CMakeLists.txt
index 13ea8dd9f35..b9f92124cc3 100644
--- a/mysys/CMakeLists.txt
+++ b/mysys/CMakeLists.txt
@@ -43,7 +43,7 @@ SET(MYSYS_SOURCES array.c charset-def.c charset.c checksum.c my_default.c
my_uuid.c wqueue.c waiting_threads.c ma_dyncol.c ../sql-common/my_time.c
my_rdtsc.c my_context.c psi_noop.c
my_atomic_writes.c
- file_logger.c)
+ file_logger.c my_dlerror.c)
IF (WIN32)
SET (MYSYS_SOURCES ${MYSYS_SOURCES} my_winthread.c my_wincond.c my_winerr.c my_winfile.c my_windac.c my_conio.c)
diff --git a/mysys/array.c b/mysys/array.c
index 35a41f2222c..5548ca1b694 100644
--- a/mysys/array.c
+++ b/mysys/array.c
@@ -90,7 +90,7 @@ my_bool insert_dynamic(DYNAMIC_ARRAY *array, const void * element)
{
void *buffer;
if (array->elements == array->max_element)
- { /* Call only when nessesary */
+ { /* Call only when necessary */
if (!(buffer=alloc_dynamic(array)))
return TRUE;
}
diff --git a/mysys/base64.c b/mysys/base64.c
index 67a9a13120b..b156406474d 100644
--- a/mysys/base64.c
+++ b/mysys/base64.c
@@ -17,7 +17,6 @@
#include <my_global.h>
#include <m_string.h> /* strchr() */
#include <m_ctype.h> /* my_isspace() */
-#include <base64.h>
#ifndef MAIN
diff --git a/mysys/file_logger.c b/mysys/file_logger.c
index b94cb705d3f..078286cd7d0 100644
--- a/mysys/file_logger.c
+++ b/mysys/file_logger.c
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#ifndef FLOGGER_SKIP_INCLUDES
diff --git a/mysys/hash.c b/mysys/hash.c
index 1d6b3d5daaa..ad01afba29e 100644
--- a/mysys/hash.c
+++ b/mysys/hash.c
@@ -62,7 +62,7 @@ my_hash_value_type my_hash_sort(CHARSET_INFO *cs, const uchar *key,
@param[in,out] hash The hash that is initialized
@param[in[ growth_size size incrememnt for the underlying dynarray
- @param[in] charset The charater set information
+ @param[in] charset The character set information
@param[in] size The hash size
@param[in] key_offest The key offset for the hash
@param[in] key_length The length of the key used in
@@ -115,14 +115,19 @@ my_hash_init2(HASH *hash, uint growth_size, CHARSET_INFO *charset,
static inline void my_hash_free_elements(HASH *hash)
{
+ uint records= hash->records;
+ /*
+ Set records to 0 early to guard against anyone looking at the structure
+ during the free process
+ */
+ hash->records= 0;
if (hash->free)
{
HASH_LINK *data=dynamic_element(&hash->array,0,HASH_LINK*);
- HASH_LINK *end= data + hash->records;
+ HASH_LINK *end= data + records;
while (data < end)
(*hash->free)((data++)->data);
}
- hash->records=0;
}
@@ -531,6 +536,9 @@ my_bool my_hash_insert(HASH *info, const uchar *record)
The record with the same record ptr is removed.
If there is a free-function it's called if record was found.
+ hash->free() is guarantee to be called only after the row has been
+ deleted from the hash and the hash can be reused by other threads.
+
@return
@retval 0 ok
@retval 1 Record not found
@@ -622,7 +630,7 @@ exit:
/**
Update keys when record has changed.
- This is much more efficent than using a delete & insert.
+ This is much more efficient than using a delete & insert.
*/
my_bool my_hash_update(HASH *hash, uchar *record, uchar *old_key,
diff --git a/mysys/lf_alloc-pin.c b/mysys/lf_alloc-pin.c
index 932dfe0f254..6c813333d09 100644
--- a/mysys/lf_alloc-pin.c
+++ b/mysys/lf_alloc-pin.c
@@ -138,7 +138,7 @@ void lf_pinbox_destroy(LF_PINBOX *pinbox)
Get pins from a pinbox. Usually called via lf_alloc_get_pins() or
lf_hash_get_pins().
- SYNOPSYS
+ SYNOPSIS
pinbox -
DESCRIPTION
@@ -442,7 +442,7 @@ static void alloc_free(uchar *first,
/*
initialize lock-free allocator
- SYNOPSYS
+ SYNOPSIS
allocator -
size a size of an object to allocate
free_ptr_offset an offset inside the object to a sizeof(void *)
diff --git a/mysys/lf_hash.c b/mysys/lf_hash.c
index 98a34647844..41174a66ced 100644
--- a/mysys/lf_hash.c
+++ b/mysys/lf_hash.c
@@ -201,7 +201,7 @@ static LF_SLIST *l_insert(LF_SLIST * volatile *head, CHARSET_INFO *cs,
lf_unpin(pins, 2);
/*
Note that cursor.curr is not pinned here and the pointer is unreliable,
- the object may dissapear anytime. But if it points to a dummy node, the
+ the object may disappear anytime. But if it points to a dummy node, the
pointer is safe, because dummy nodes are never freed - initialize_bucket()
uses this fact.
*/
@@ -333,7 +333,7 @@ static void default_initializer(LF_HASH *hash, void *dst, const void *src)
lf_alloc and a size of memcpy'ed block size in lf_hash_insert. Typically
they are the same, indeed. But LF_HASH::element_size can be decreased
after lf_hash_init, and then lf_alloc will allocate larger block that
- lf_hash_insert will copy over. It is desireable if part of the element
+ lf_hash_insert will copy over. It is desirable if part of the element
is expensive to initialize - for example if there is a mutex or
DYNAMIC_ARRAY. In this case they should be initialize in the
LF_ALLOCATOR::constructor, and lf_hash_insert should not overwrite them.
@@ -442,7 +442,7 @@ int lf_hash_delete(LF_HASH *hash, LF_PINS *pins, const void *key, uint keylen)
hashnr= hash->hash_function(hash->charset, (uchar *)key, keylen) & INT_MAX32;
- /* hide OOM errors - if we cannot initalize a bucket, try the previous one */
+ /* hide OOM errors - if we cannot initialize a bucket, try the previous one */
for (bucket= hashnr % hash->size; ;bucket= my_clear_highest_bit(bucket))
{
el= lf_dynarray_lvalue(&hash->array, bucket);
@@ -476,7 +476,7 @@ void *lf_hash_search_using_hash_value(LF_HASH *hash, LF_PINS *pins,
LF_SLIST * volatile *el, *found;
uint bucket;
- /* hide OOM errors - if we cannot initalize a bucket, try the previous one */
+ /* hide OOM errors - if we cannot initialize a bucket, try the previous one */
for (bucket= hashnr % hash->size; ;bucket= my_clear_highest_bit(bucket))
{
el= lf_dynarray_lvalue(&hash->array, bucket);
diff --git a/mysys/ma_dyncol.c b/mysys/ma_dyncol.c
index c0622cd2cbf..155a4367345 100644
--- a/mysys/ma_dyncol.c
+++ b/mysys/ma_dyncol.c
@@ -2136,7 +2136,7 @@ find_column(DYN_HEADER *hdr, uint numkey, LEX_STRING *strkey)
hdr->length= hdr_interval_length(hdr, hdr->entry + hdr->entry_size);
hdr->data= hdr->dtpool + hdr->offset;
/*
- Check that the found data is withing the ranges. This can happen if
+ Check that the found data is within the ranges. This can happen if
we get data with wrong offsets.
*/
if (hdr->length == DYNCOL_OFFSET_ERROR ||
@@ -3480,7 +3480,7 @@ dynamic_column_update_many_fmt(DYNAMIC_COLUMN *str,
if (plan[i].val->type == DYN_COL_NULL)
{
- plan[i].act= PLAN_NOP; /* Mark entry to be skiped */
+ plan[i].act= PLAN_NOP; /* Mark entry to be skipped */
}
else
{
@@ -4129,7 +4129,7 @@ mariadb_dyncol_json_internal(DYNAMIC_COLUMN *str, DYNAMIC_STRING *json,
hdr_interval_length(&header, header.entry + header.entry_size);
header.data= header.dtpool + header.offset;
/*
- Check that the found data is withing the ranges. This can happen if
+ Check that the found data is within the ranges. This can happen if
we get data with wrong offsets.
*/
if (header.length == DYNCOL_OFFSET_ERROR ||
@@ -4269,7 +4269,7 @@ mariadb_dyncol_unpack(DYNAMIC_COLUMN *str,
hdr_interval_length(&header, header.entry + header.entry_size);
header.data= header.dtpool + header.offset;
/*
- Check that the found data is withing the ranges. This can happen if
+ Check that the found data is within the ranges. This can happen if
we get data with wrong offsets.
*/
if (header.length == DYNCOL_OFFSET_ERROR ||
diff --git a/mysys/mf_fn_ext.c b/mysys/mf_fn_ext.c
index b78d73074da..debed8afed3 100644
--- a/mysys/mf_fn_ext.c
+++ b/mysys/mf_fn_ext.c
@@ -86,7 +86,7 @@ char *fn_ext2(const char *name)
if (!(gpos= strrchr(name, FN_LIBCHAR)))
gpos= name;
#endif
- // locate the last occurence of FN_EXTCHAR
+ // locate the last occurrence of FN_EXTCHAR
pos= strrchr(gpos, FN_EXTCHAR);
DBUG_RETURN((char*) (pos ? pos : strend(gpos)));
} /* fn_ext2 */
diff --git a/mysys/mf_format.c b/mysys/mf_format.c
index 91354db0b64..6672a4386e4 100644
--- a/mysys/mf_format.c
+++ b/mysys/mf_format.c
@@ -97,13 +97,8 @@ char * fn_format(char * to, const char *name, const char *dir,
pos=strmake(strmov(to,dev),name,length);
(void) strmov(pos,ext); /* Don't convert extension */
}
- /*
- If MY_RETURN_REAL_PATH and MY_RESOLVE_SYMLINK is given, only do
- realpath if the file is a symbolic link
- */
if (flag & MY_RETURN_REAL_PATH)
- (void) my_realpath(to, to, MYF(flag & MY_RESOLVE_SYMLINKS ?
- MY_RESOLVE_LINK: 0));
+ (void) my_realpath(to, to, MYF(0));
else if (flag & MY_RESOLVE_SYMLINKS)
{
strmov(buff,to);
diff --git a/mysys/mf_iocache.c b/mysys/mf_iocache.c
index 72385daef42..23f2d7984d3 100644
--- a/mysys/mf_iocache.c
+++ b/mysys/mf_iocache.c
@@ -82,7 +82,7 @@ int (*_my_b_encr_write)(IO_CACHE *info,const uchar *Buffer,size_t Count)= 0;
info IO_CACHE handler
NOTES
- This is called on automaticly on init or reinit of IO_CACHE
+ This is called on automatically on init or reinit of IO_CACHE
It must be called externally if one moves or copies an IO_CACHE
object.
*/
@@ -166,7 +166,7 @@ init_functions(IO_CACHE* info)
If == 0 then use my_default_record_cache_size
type Type of cache
seek_offset Where cache should start reading/writing
- use_async_io Set to 1 of we should use async_io (if avaiable)
+ use_async_io Set to 1 of we should use async_io (if available)
cache_myflags Bitmap of different flags
MY_WME | MY_FAE | MY_NABP | MY_FNABP |
MY_DONT_CHECK_FILESIZE
@@ -446,7 +446,7 @@ static void my_aiowait(my_aio_result *result)
if (errno == EINTR)
continue;
DBUG_PRINT("error",("No aio request, error: %d",errno));
- result->pending=0; /* Assume everythings is ok */
+ result->pending=0; /* Assume everything is ok */
break;
}
((my_aio_result*) tmp)->pending=0;
@@ -2003,6 +2003,7 @@ int my_b_flush_io_cache(IO_CACHE *info, int need_append_buffer_lock)
It's currently safe to call this if one has called init_io_cache()
on the 'info' object, even if init_io_cache() failed.
This function is also safe to call twice with the same handle.
+ Note that info->file is not reset as the caller may still use ut for my_close()
RETURN
0 ok
@@ -2032,10 +2033,12 @@ int end_io_cache(IO_CACHE *info)
if (info->type == SEQ_READ_APPEND)
{
/* Destroy allocated mutex */
- info->type= TYPE_NOT_SET;
mysql_mutex_destroy(&info->append_buffer_lock);
}
info->share= 0;
+ info->type= TYPE_NOT_SET; /* Ensure that flush_io_cache() does nothing */
+ info->write_end= 0; /* Ensure that my_b_write() fails */
+ info->write_function= 0; /* my_b_write will crash if used */
DBUG_RETURN(error);
} /* end_io_cache */
@@ -2123,7 +2126,7 @@ int main(int argc, char** argv)
/* check correctness of tests */
if (total_bytes != status.st_size)
{
- fprintf(stderr,"Not the same number of bytes acutally in file as bytes \
+ fprintf(stderr,"Not the same number of bytes actually in file as bytes \
supposedly written\n");
error=1;
}
diff --git a/mysys/mf_keycache.c b/mysys/mf_keycache.c
index 74eaa12f19d..34aeb569faf 100644
--- a/mysys/mf_keycache.c
+++ b/mysys/mf_keycache.c
@@ -59,11 +59,11 @@
When a new block is required it is first tried to pop one from the stack.
If the stack is empty, it is tried to get a never-used block from the pool.
If this is empty too, then a block is taken from the LRU ring, flushing it
- to disk, if neccessary. This is handled in find_key_block().
+ to disk, if necessary. This is handled in find_key_block().
With the new free list, the blocks can have three temperatures:
hot, warm and cold (which is free). This is remembered in the block header
by the enum BLOCK_TEMPERATURE temperature variable. Remembering the
- temperature is neccessary to correctly count the number of warm blocks,
+ temperature is necessary to correctly count the number of warm blocks,
which is required to decide when blocks are allowed to become hot. Whenever
a block is inserted to another (sub-)chain, we take the old and new
temperature into account to decide if we got one more or less warm block.
@@ -451,7 +451,7 @@ static inline uint next_power(uint value)
structure of the type SIMPLE_KEY_CACHE_CB that is used for this key cache.
The parameter keycache is supposed to point to this structure.
The parameter key_cache_block_size specifies the size of the blocks in
- the key cache to be built. The parameters division_limit and age_threshhold
+ the key cache to be built. The parameters division_limit and age_threshold
determine the initial values of those characteristics of the key cache
that are used for midpoint insertion strategy. The parameter use_mem
specifies the total amount of memory to be allocated for key cache blocks
diff --git a/mysys/my_access.c b/mysys/my_access.c
index 91a536d214e..75774240406 100644
--- a/mysys/my_access.c
+++ b/mysys/my_access.c
@@ -223,7 +223,7 @@ my_bool is_filename_allowed(const char *name __attribute__((unused)),
/*
- Check if a path will access a reserverd file name that may cause problems
+ Check if a path will access a reserved file name that may cause problems
SYNOPSIS
check_if_legal_filename
diff --git a/mysys/my_alloc.c b/mysys/my_alloc.c
index 664a7380ca4..7275f602525 100644
--- a/mysys/my_alloc.c
+++ b/mysys/my_alloc.c
@@ -43,7 +43,7 @@
DESCRIPTION
This function prepares memory root for further use, sets initial size of
chunk for memory allocation and pre-allocates first block if specified.
- Altough error can happen during execution of this function if
+ Although error can happen during execution of this function if
pre_alloc_size is non-0 it won't be reported. Instead it will be
reported as error in first alloc_root() on this memory root.
diff --git a/mysys/my_chmod.c b/mysys/my_chmod.c
index 91fd51b47d2..095ac858834 100644
--- a/mysys/my_chmod.c
+++ b/mysys/my_chmod.c
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#include "mysys_priv.h"
#include "mysys_err.h"
diff --git a/mysys/my_compare.c b/mysys/my_compare.c
index 3c21d74a8a4..5ba1b409abb 100644
--- a/mysys/my_compare.c
+++ b/mysys/my_compare.c
@@ -98,12 +98,12 @@ static int compare_bin(const uchar *a, uint a_length,
Example1: if the function is called for tuples
('aaa','bbb') and ('eee','fff'), then
diff_pos[0] = 1 (as 'aaa' != 'eee')
- diff_pos[1] = 0 (offset from beggining of tuple b to 'eee' keypart).
+ diff_pos[1] = 0 (offset from beginning of tuple b to 'eee' keypart).
Example2: if the index function is called for tuples
('aaa','bbb') and ('aaa','fff'),
diff_pos[0] = 2 (as 'aaa' != 'eee')
- diff_pos[1] = 3 (offset from beggining of tuple b to 'fff' keypart,
+ diff_pos[1] = 3 (offset from beginning of tuple b to 'fff' keypart,
here we assume that first key part is CHAR(3) NOT NULL)
NOTES
diff --git a/mysys/my_compress.c b/mysys/my_compress.c
index 78d09bb5f36..0e4db5c3b17 100644
--- a/mysys/my_compress.c
+++ b/mysys/my_compress.c
@@ -162,7 +162,7 @@ uchar *my_compress_alloc(const uchar *packet, size_t *len, size_t *complen)
SYNOPSIS
my_uncompress()
- packet Compressed data. This is is replaced with the orignal data.
+ packet Compressed data. This is is replaced with the original data.
len Length of compressed data
complen Length of the packet buffer (must be enough for the original
data)
diff --git a/mysys/my_context.c b/mysys/my_context.c
index 1368739ac35..cf10738bdbd 100644
--- a/mysys/my_context.c
+++ b/mysys/my_context.c
@@ -206,7 +206,8 @@ my_context_spawn(struct my_context *c, void (*f)(void *), void *d)
(
"movq %%rsp, (%[save])\n\t"
"movq %[stack], %%rsp\n\t"
-#if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) && !defined(__INTEL_COMPILER)
+#if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4) || __clang__) && \
+ !defined(__INTEL_COMPILER)
/*
This emits a DWARF DW_CFA_undefined directive to make the return address
undefined. This indicates that this is the top of the stack frame, and
diff --git a/mysys/my_create.c b/mysys/my_create.c
index 6a3bcd63557..014b65c4e14 100644
--- a/mysys/my_create.c
+++ b/mysys/my_create.c
@@ -36,7 +36,7 @@
File my_create(const char *FileName, int CreateFlags, int access_flags,
myf MyFlags)
{
- int fd, rc;
+ int fd;
DBUG_ENTER("my_create");
DBUG_PRINT("my",("Name: '%s' CreateFlags: %d AccessFlags: %d MyFlags: %lu",
FileName, CreateFlags, access_flags, MyFlags));
@@ -54,21 +54,7 @@ File my_create(const char *FileName, int CreateFlags, int access_flags,
fd= -1;
}
- rc= my_register_filename(fd, FileName, FILE_BY_CREATE,
+ fd= my_register_filename(fd, FileName, FILE_BY_CREATE,
EE_CANTCREATEFILE, MyFlags);
- /*
- my_register_filename() may fail on some platforms even if the call to
- *open() above succeeds. In this case, don't leave the stale file because
- callers assume the file to not exist if my_create() fails, so they don't
- do any cleanups.
- */
- if (unlikely(fd >= 0 && rc < 0))
- {
- int tmp= my_errno;
- my_close(fd, MyFlags);
- my_delete(FileName, MyFlags);
- my_errno= tmp;
- }
-
- DBUG_RETURN(rc);
+ DBUG_RETURN(fd);
} /* my_create */
diff --git a/mysys/my_default.c b/mysys/my_default.c
index 6324c19bdda..e7d661b33e5 100644
--- a/mysys/my_default.c
+++ b/mysys/my_default.c
@@ -24,7 +24,7 @@
pre- and end 'blank space' are removed from options and values. The
following escape sequences are recognized in values: \b \t \n \r \\
- The following arguments are handled automaticly; If used, they must be
+ The following arguments are handled automatically; If used, they must be
first argument on the command line!
--no-defaults ; no options are read.
--defaults-file=full-path-to-default-file ; Only this file will be read.
@@ -62,7 +62,7 @@
check the pointer, use "----args-separator----" here to ease debug
if someone misused it.
- The args seprator will only be added when
+ The args separator will only be added when
my_getopt_use_args_seprator is set to TRUE before calling
load_defaults();
@@ -597,7 +597,7 @@ int my_load_defaults(const char *conf_file, const char **groups,
(*argv)+= args_used;
/*
- Check if we wan't to see the new argument list
+ Check if we want to see the new argument list
This options must always be the last of the default options
*/
if (*argc >= 2 && !strcmp(argv[0][1],"--print-defaults"))
diff --git a/mysys/my_delete.c b/mysys/my_delete.c
index 3dfe290dabe..0faf6079d98 100644
--- a/mysys/my_delete.c
+++ b/mysys/my_delete.c
@@ -21,6 +21,12 @@
static int my_win_unlink(const char *name);
#endif
+CREATE_NOSYMLINK_FUNCTION(
+ unlink_nosymlinks(const char *pathname),
+ unlinkat(dfd, filename, 0),
+ unlink(pathname)
+);
+
int my_delete(const char *name, myf MyFlags)
{
int err;
@@ -30,7 +36,10 @@ int my_delete(const char *name, myf MyFlags)
#ifdef _WIN32
err = my_win_unlink(name);
#else
- err = unlink(name);
+ if (MyFlags & MY_NOSYMLINKS)
+ err= unlink_nosymlinks(name);
+ else
+ err= unlink(name);
#endif
if(err)
diff --git a/mysys/my_div.c b/mysys/my_div.c
index 660b87e5ab4..44eb5392421 100644
--- a/mysys/my_div.c
+++ b/mysys/my_div.c
@@ -27,7 +27,7 @@
char * my_filename(File fd)
{
DBUG_ENTER("my_filename");
- if ((uint) fd >= (uint) my_file_limit)
+ if ((uint) fd >= (uint) my_file_limit || !my_file_info[fd].name)
DBUG_RETURN((char*) "UNKNOWN");
if (fd >= 0 && my_file_info[fd].type != UNOPEN)
{
diff --git a/mysys/my_dlerror.c b/mysys/my_dlerror.c
new file mode 100644
index 00000000000..db21b7fc274
--- /dev/null
+++ b/mysys/my_dlerror.c
@@ -0,0 +1,31 @@
+/*
+ Copyright (c) 2017, MariaDB
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#include <my_global.h>
+#include <string.h>
+
+const char *my_dlerror(const char *dlpath)
+{
+ const char *errmsg=dlerror();
+ size_t dlpathlen= strlen(dlpath);
+ if (!strncmp(dlpath, errmsg, dlpathlen))
+ { /* if errmsg starts from dlpath, trim this prefix */
+ errmsg+=dlpathlen;
+ if (*errmsg == ':') errmsg++;
+ if (*errmsg == ' ') errmsg++;
+ }
+ return errmsg;
+}
diff --git a/mysys/my_fopen.c b/mysys/my_fopen.c
index 2ac033c8264..0bb431dd560 100644
--- a/mysys/my_fopen.c
+++ b/mysys/my_fopen.c
@@ -69,19 +69,13 @@ FILE *my_fopen(const char *filename, int flags, myf MyFlags)
DBUG_RETURN(fd); /* safeguard */
}
mysql_mutex_lock(&THR_LOCK_open);
- if ((my_file_info[filedesc].name= (char*)
- my_strdup(filename,MyFlags)))
- {
- my_stream_opened++;
- my_file_total_opened++;
- my_file_info[filedesc].type= STREAM_BY_FOPEN;
- mysql_mutex_unlock(&THR_LOCK_open);
- DBUG_PRINT("exit",("stream: 0x%lx", (long) fd));
- DBUG_RETURN(fd);
- }
+ my_file_info[filedesc].name= (char*) my_strdup(filename,MyFlags);
+ my_stream_opened++;
+ my_file_total_opened++;
+ my_file_info[filedesc].type= STREAM_BY_FOPEN;
mysql_mutex_unlock(&THR_LOCK_open);
- (void) my_fclose(fd,MyFlags);
- my_errno=ENOMEM;
+ DBUG_PRINT("exit",("stream: 0x%lx", (long) fd));
+ DBUG_RETURN(fd);
}
else
my_errno=errno;
diff --git a/mysys/my_getwd.c b/mysys/my_getwd.c
index fbdcef88bda..bfa28f1d372 100644
--- a/mysys/my_getwd.c
+++ b/mysys/my_getwd.c
@@ -37,7 +37,7 @@
MyFlags Flags
NOTES
- Directory is allways ended with FN_LIBCHAR
+ Directory is always ended with FN_LIBCHAR
RESULT
0 ok
diff --git a/mysys/my_init.c b/mysys/my_init.c
index 32289dbed7a..7f0f7a8cc44 100644
--- a/mysys/my_init.c
+++ b/mysys/my_init.c
@@ -99,7 +99,7 @@ my_bool my_init(void)
if (my_progname)
my_progname_short= my_progname + dirname_length(my_progname);
- /* Initalize our mutex handling */
+ /* Initialize our mutex handling */
my_mutex_init();
if (my_thread_global_init())
@@ -227,7 +227,7 @@ Voluntary context switches %ld, Involuntary context switches %ld\n",
/* At very last, delete mysys key, it is used everywhere including DBUG */
pthread_key_delete(THR_KEY_mysys);
- my_init_done=0;
+ my_init_done= my_thr_key_mysys_exists= 0;
} /* my_end */
#ifndef DBUG_OFF
@@ -415,7 +415,7 @@ static my_bool win32_init_tcp_ip()
WORD wVersionRequested = MAKEWORD( 2, 2 );
WSADATA wsaData;
/* Be a good citizen: maybe another lib has already initialised
- sockets, so dont clobber them unless necessary */
+ sockets, so don't clobber them unless necessary */
if (WSAStartup( wVersionRequested, &wsaData ))
{
/* Load failed, maybe because of previously loaded
diff --git a/mysys/my_lib.c b/mysys/my_lib.c
index a8f7c02ab63..abc7b8a3161 100644
--- a/mysys/my_lib.c
+++ b/mysys/my_lib.c
@@ -14,7 +14,7 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-/* TODO: check for overun of memory for names. */
+/* TODO: check for overrun of memory for names. */
#include "mysys_priv.h"
#include <m_string.h>
diff --git a/mysys/my_open.c b/mysys/my_open.c
index b6d8f08bfc1..3999810eb2e 100644
--- a/mysys/my_open.c
+++ b/mysys/my_open.c
@@ -15,9 +15,14 @@
#include "mysys_priv.h"
#include "mysys_err.h"
-#include <my_dir.h>
+#include <m_string.h>
#include <errno.h>
+CREATE_NOSYMLINK_FUNCTION(
+ open_nosymlinks(const char *pathname, int flags, int mode),
+ openat(dfd, filename, O_NOFOLLOW | flags, mode),
+ open(pathname, O_NOFOLLOW | flags, mode)
+);
/*
Open a file
@@ -45,10 +50,11 @@ File my_open(const char *FileName, int Flags, myf MyFlags)
MyFlags|= my_global_flags;
#if defined(_WIN32)
fd= my_win_open(FileName, Flags);
-#elif !defined(NO_OPEN_3)
- fd = open(FileName, Flags | O_CLOEXEC, my_umask); /* Normal unix */
#else
- fd = open((char *) FileName, Flags | O_CLOEXEC);
+ if (MyFlags & MY_NOSYMLINKS)
+ fd = open_nosymlinks(FileName, Flags | O_CLOEXEC, my_umask);
+ else
+ fd = open(FileName, Flags | O_CLOEXEC, my_umask);
#endif
fd= my_register_filename(fd, FileName, FILE_BY_OPEN,
@@ -131,25 +137,16 @@ File my_register_filename(File fd, const char *FileName, enum file_type
thread_safe_increment(my_file_opened,&THR_LOCK_open);
DBUG_RETURN(fd); /* safeguard */
}
- else
- {
- mysql_mutex_lock(&THR_LOCK_open);
- if ((my_file_info[fd].name = (char*) my_strdup(FileName,MyFlags)))
- {
- my_file_opened++;
- my_file_total_opened++;
- my_file_info[fd].type = type_of_file;
- mysql_mutex_unlock(&THR_LOCK_open);
- DBUG_PRINT("exit",("fd: %d",fd));
- DBUG_RETURN(fd);
- }
- mysql_mutex_unlock(&THR_LOCK_open);
- my_errno= ENOMEM;
- }
- (void) my_close(fd, MyFlags);
+ mysql_mutex_lock(&THR_LOCK_open);
+ my_file_info[fd].name = (char*) my_strdup(FileName, MyFlags);
+ my_file_opened++;
+ my_file_total_opened++;
+ my_file_info[fd].type = type_of_file;
+ mysql_mutex_unlock(&THR_LOCK_open);
+ DBUG_PRINT("exit",("fd: %d",fd));
+ DBUG_RETURN(fd);
}
- else
- my_errno= errno;
+ my_errno= errno;
DBUG_PRINT("error",("Got error %d on open", my_errno));
if (MyFlags & (MY_FFNF | MY_FAE | MY_WME))
diff --git a/mysys/my_port.c b/mysys/my_port.c
index 96dbe10b1bd..75a07b03efe 100644
--- a/mysys/my_port.c
+++ b/mysys/my_port.c
@@ -12,8 +12,8 @@
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
- MA 02111-1307, USA */
+ Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ MA 02111-1301, USA */
/*
Small functions to make code portable
diff --git a/mysys/my_pread.c b/mysys/my_pread.c
index 745cde9ec41..d3524279ea9 100644
--- a/mysys/my_pread.c
+++ b/mysys/my_pread.c
@@ -28,7 +28,7 @@
SYNOPSIOS
my_pread()
- Filedes File decsriptor
+ Filedes File descriptor
Buffer Buffer to read data into
Count Number of bytes to read
offset Position to read from
@@ -108,7 +108,7 @@ size_t my_pread(File Filedes, uchar *Buffer, size_t Count, my_off_t offset,
SYNOPSIOS
my_pwrite()
- Filedes File decsriptor
+ Filedes File descriptor
Buffer Buffer to write data from
Count Number of bytes to write
offset Position to write to
diff --git a/mysys/my_redel.c b/mysys/my_redel.c
index 976fc5a18c3..9091c74e6b5 100644
--- a/mysys/my_redel.c
+++ b/mysys/my_redel.c
@@ -32,10 +32,10 @@ struct utimbuf {
/*
Rename with copy stat form old file
- Copy stats from old file to new file, deletes orginal and
+ Copy stats from old file to new file, deletes original and
changes new file name to old file name
- if MY_REDEL_MAKE_COPY is given, then the orginal file
+ if MY_REDEL_MAKE_COPY is given, then the original file
is renamed to org_name-'current_time'.BAK
*/
diff --git a/mysys/my_rnd.c b/mysys/my_rnd.c
index ad7bda0b42b..fc38d5586ce 100644
--- a/mysys/my_rnd.c
+++ b/mysys/my_rnd.c
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#include "mysys_priv.h"
#include <my_rnd.h>
diff --git a/mysys/my_safehash.c b/mysys/my_safehash.c
index 1417b8ea94e..c34f3c456cd 100644
--- a/mysys/my_safehash.c
+++ b/mysys/my_safehash.c
@@ -12,7 +12,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
/*
Handling of multiple key caches
diff --git a/mysys/my_safehash.h b/mysys/my_safehash.h
index e52fee68b57..3d3aa1e6006 100644
--- a/mysys/my_safehash.h
+++ b/mysys/my_safehash.h
@@ -12,7 +12,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
/*
Handling of multiple key caches
diff --git a/mysys/my_symlink.c b/mysys/my_symlink.c
index b0e910f7ba0..72648d4c9a8 100644
--- a/mysys/my_symlink.c
+++ b/mysys/my_symlink.c
@@ -1,5 +1,6 @@
/*
Copyright (c) 2001, 2011, Oracle and/or its affiliates
+ Copyright (c) 2010, 2017, MariaDB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -23,6 +24,14 @@
#include <sys/stat.h>
#endif
+static int always_valid(const char *filename __attribute__((unused)))
+{
+ return 0;
+}
+
+int (*mysys_test_invalid_symlink)(const char *filename)= always_valid;
+
+
/*
Reads the content of a symbolic link
If the file is not a symbolic link, return the original file name in to.
@@ -120,6 +129,11 @@ int my_is_symlink(const char *filename __attribute__((unused)))
to is guaranteed to never set to a string longer than FN_REFLEN
(including the end \0)
+
+ On error returns -1, unless error is file not found, in which case it
+ is 1.
+
+ Sets my_errno to specific error number.
*/
int my_realpath(char *to, const char *filename, myf MyFlags)
@@ -145,7 +159,10 @@ int my_realpath(char *to, const char *filename, myf MyFlags)
if (MyFlags & MY_WME)
my_error(EE_REALPATH, MYF(0), filename, my_errno);
my_load_path(to, filename, NullS);
- result= -1;
+ if (my_errno == ENOENT)
+ result= 1;
+ else
+ result= -1;
}
DBUG_RETURN(result);
#elif defined(_WIN32)
@@ -168,3 +185,78 @@ int my_realpath(char *to, const char *filename, myf MyFlags)
#endif
return 0;
}
+
+#ifdef HAVE_OPEN_PARENT_DIR_NOSYMLINKS
+/** opens the parent dir. walks the path, and does not resolve symlinks
+
+ returns the pointer to the file name (basename) within the pathname
+ or NULL in case of an error
+
+ stores the parent dir (dirname) file descriptor in pdfd.
+ It can be -1 even if there was no error!
+
+ This is used for symlinked tables for DATA/INDEX DIRECTORY.
+ The paths there have been realpath()-ed. So, we can assume here that
+
+ * `pathname` is an absolute path
+ * no '.', '..', and '//' in the path
+ * file exists
+*/
+
+const char *my_open_parent_dir_nosymlinks(const char *pathname, int *pdfd)
+{
+ char buf[PATH_MAX+1];
+ char *s= buf, *e= buf+1, *end= strnmov(buf, pathname, sizeof(buf));
+ int fd, dfd= -1;
+
+ if (*end)
+ {
+ errno= ENAMETOOLONG;
+ return NULL;
+ }
+
+ if (*s != '/') /* not an absolute path */
+ {
+ errno= ENOENT;
+ return NULL;
+ }
+
+ for (;;)
+ {
+ if (*e == '/') /* '//' in the path */
+ {
+ errno= ENOENT;
+ goto err;
+ }
+ while (*e && *e != '/')
+ e++;
+ *e= 0;
+
+ if (!memcmp(s, ".", 2) || !memcmp(s, "..", 3))
+ {
+ errno= ENOENT;
+ goto err;
+ }
+
+ if (++e >= end)
+ {
+ *pdfd= dfd;
+ return pathname + (s - buf);
+ }
+
+ fd = openat(dfd, s, O_NOFOLLOW | O_PATH);
+ if (fd < 0)
+ goto err;
+
+ if (dfd >= 0)
+ close(dfd);
+
+ dfd= fd;
+ s= e;
+ }
+err:
+ if (dfd >= 0)
+ close(dfd);
+ return NULL;
+}
+#endif
diff --git a/mysys/my_symlink2.c b/mysys/my_symlink2.c
index fcaf78ccff6..f1ace5dcd77 100644
--- a/mysys/my_symlink2.c
+++ b/mysys/my_symlink2.c
@@ -17,7 +17,7 @@
/*
Advanced symlink handling.
This is used in MyISAM to let users symlinks tables to different disk.
- The main idea with these functions is to automaticly create, delete and
+ The main idea with these functions is to automatically create, delete and
rename files and symlinks like they would be one unit.
*/
@@ -92,27 +92,6 @@ File my_create_with_symlink(const char *linkname, const char *filename,
}
/*
- If the file was a symlink, delete both symlink and the file which the
- symlink pointed to.
-*/
-
-int my_delete_with_symlink(const char *name, myf MyFlags)
-{
- char link_name[FN_REFLEN];
- int was_symlink= (!my_disable_symlinks &&
- !my_readlink(link_name, name, MYF(0)));
- int result;
- DBUG_ENTER("my_delete_with_symlink");
-
- if (!(result=my_delete(name, MyFlags)))
- {
- if (was_symlink)
- result=my_delete(link_name, MyFlags);
- }
- DBUG_RETURN(result);
-}
-
-/*
If the file is a normal file, just rename it.
If the file is a symlink:
- Create a new file with the name 'to' that points at
@@ -182,3 +161,29 @@ int my_rename_with_symlink(const char *from, const char *to, myf MyFlags)
DBUG_RETURN(result);
#endif /* HAVE_READLINK */
}
+
+/** delete a - possibly symlinked - table file
+
+ This is used to delete a file that is part of a table (e.g. MYI or MYD
+ file of MyISAM) when dropping a table. A file might be a symlink -
+ if the table was created with DATA DIRECTORY or INDEX DIRECTORY -
+ in this case both the symlink and the symlinked file are deleted,
+ but only if the symlinked file is not in the datadir.
+*/
+int my_handler_delete_with_symlink(const char *filename, myf sync_dir)
+{
+ char real[FN_REFLEN];
+ int res= 0;
+ DBUG_ENTER("my_handler_delete_with_symlink");
+
+ if (my_is_symlink(filename))
+ {
+ /*
+ Delete the symlinked file only if the symlink is not
+ pointing into datadir.
+ */
+ if (!(my_realpath(real, filename, MYF(0)) || mysys_test_invalid_symlink(real)))
+ res= my_delete(real, MYF(MY_NOSYMLINKS | sync_dir));
+ }
+ DBUG_RETURN(my_delete(filename, MYF(sync_dir)) || res);
+}
diff --git a/mysys/my_sync.c b/mysys/my_sync.c
index c0afd587ada..d1e239692f1 100644
--- a/mysys/my_sync.c
+++ b/mysys/my_sync.c
@@ -196,7 +196,7 @@ int my_sync_dir_by_file(const char *file_name __attribute__((unused)),
char dir_name[FN_REFLEN];
size_t dir_name_length;
dirname_part(dir_name, file_name, &dir_name_length);
- return my_sync_dir(dir_name, my_flags);
+ return my_sync_dir(dir_name, my_flags & ~MY_NOSYMLINKS);
#else
return 0;
#endif
diff --git a/mysys/my_thr_init.c b/mysys/my_thr_init.c
index 60a46997901..678bfc459c7 100644
--- a/mysys/my_thr_init.c
+++ b/mysys/my_thr_init.c
@@ -44,6 +44,8 @@ static uint get_thread_lib(void);
/** True if @c my_thread_global_init() has been called. */
static my_bool my_thread_global_init_done= 0;
+/* True if THR_KEY_mysys is created */
+my_bool my_thr_key_mysys_exists= 0;
/*
@@ -167,11 +169,20 @@ my_bool my_thread_global_init(void)
return 0;
my_thread_global_init_done= 1;
- if ((pth_ret= pthread_key_create(&THR_KEY_mysys, NULL)) != 0)
+ /*
+ THR_KEY_mysys is deleted in my_end() as DBUG libraries are using it even
+ after my_thread_global_end() is called.
+ my_thr_key_mysys_exist is used to protect against application like QT
+ that calls my_thread_global_init() + my_thread_global_end() multiple times
+ without calling my_init() + my_end().
+ */
+ if (!my_thr_key_mysys_exists &&
+ (pth_ret= pthread_key_create(&THR_KEY_mysys, NULL)) != 0)
{
fprintf(stderr, "Can't initialize threads: error %d\n", pth_ret);
return 1;
}
+ my_thr_key_mysys_exists= 1;
/* Mutex used by my_thread_init() and after my_thread_destroy_mutex() */
my_thread_init_internal_mutex();
@@ -262,7 +273,7 @@ my_bool my_thread_init(void)
my_bool error=0;
if (!my_thread_global_init_done)
- return 1; /* cannot proceed with unintialized library */
+ return 1; /* cannot proceed with uninitialized library */
#ifdef EXTRA_DEBUG_THREADS
fprintf(stderr,"my_thread_init(): pthread_self: %p\n", pthread_self());
diff --git a/mysys/my_uuid.c b/mysys/my_uuid.c
index a8614afef2c..f167ebe1d6e 100644
--- a/mysys/my_uuid.c
+++ b/mysys/my_uuid.c
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
/*
implements Universal Unique Identifiers (UUIDs), as in
diff --git a/mysys/my_windac.c b/mysys/my_windac.c
index 51fe22e8f59..9b489759625 100644
--- a/mysys/my_windac.c
+++ b/mysys/my_windac.c
@@ -33,7 +33,7 @@ static my_bool is_nt()
}
/*
- Auxilary structure to store pointers to the data which we need to keep
+ Auxiliary structure to store pointers to the data which we need to keep
around while SECURITY_ATTRIBUTES is in use.
*/
diff --git a/mysys/my_winerr.c b/mysys/my_winerr.c
index 15f52dd7f37..92e1fa83d78 100644
--- a/mysys/my_winerr.c
+++ b/mysys/my_winerr.c
@@ -117,7 +117,7 @@ static int get_errno_from_oserr(unsigned long oserrno)
return EINVAL;
}
-/* Set errno corresponsing to GetLastError() value */
+/* Set errno corresponding to GetLastError() value */
void my_osmaperr ( unsigned long oserrno)
{
errno= get_errno_from_oserr(oserrno);
diff --git a/mysys/mysys_priv.h b/mysys/mysys_priv.h
index d080aca7404..471862a6d0b 100644
--- a/mysys/mysys_priv.h
+++ b/mysys/mysys_priv.h
@@ -108,6 +108,34 @@ size_t sf_malloc_usable_size(void *ptr, my_bool *is_thread_specific);
void my_error_unregister_all(void);
+#if !defined(O_PATH) && defined(O_EXEC) /* FreeBSD */
+#define O_PATH O_EXEC
+#endif
+
+#ifdef O_PATH
+#define HAVE_OPEN_PARENT_DIR_NOSYMLINKS
+const char *my_open_parent_dir_nosymlinks(const char *pathname, int *pdfd);
+#define NOSYMLINK_FUNCTION_BODY(AT,NOAT) \
+ int dfd, res; \
+ const char *filename= my_open_parent_dir_nosymlinks(pathname, &dfd); \
+ if (filename == NULL) return -1; \
+ res= AT; \
+ if (dfd >= 0) close(dfd); \
+ return res;
+#elif defined(HAVE_REALPATH)
+#define NOSYMLINK_FUNCTION_BODY(AT,NOAT) \
+ char buf[PATH_MAX+1]; \
+ if (realpath(pathname, buf) == NULL) return -1; \
+ if (strcmp(pathname, buf)) { errno= ENOTDIR; return -1; } \
+ return NOAT;
+#else
+#define NOSYMLINK_FUNCTION_BODY(AT,NOAT) \
+ return NOAT;
+#endif
+
+#define CREATE_NOSYMLINK_FUNCTION(PROTO,AT,NOAT) \
+static int PROTO { NOSYMLINK_FUNCTION_BODY(AT,NOAT) }
+
#ifdef _WIN32
#include <sys/stat.h>
/* my_winfile.c exports, should not be used outside mysys */
diff --git a/mysys/queues.c b/mysys/queues.c
index 418163d7c58..5d09ce2063f 100644
--- a/mysys/queues.c
+++ b/mysys/queues.c
@@ -27,7 +27,7 @@
This code originates from the Unireg project.
Code for generell handling of priority Queues.
- Implemention of queues from "Algoritms in C" by Robert Sedgewick.
+ Implementation of queues from "Algorithms in C" by Robert Sedgewick.
The queue can optionally store the position in queue in the element
that is in the queue. This allows one to remove any element from the queue
diff --git a/mysys/test_thr_mutex.c b/mysys/test_thr_mutex.c
index 0bd14a0d31b..fa5b6f74ba3 100644
--- a/mysys/test_thr_mutex.c
+++ b/mysys/test_thr_mutex.c
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
/* Testing of deadlock detector */
diff --git a/mysys/thr_lock.c b/mysys/thr_lock.c
index a77db04acef..c168957097f 100644
--- a/mysys/thr_lock.c
+++ b/mysys/thr_lock.c
@@ -517,8 +517,8 @@ wait_for_lock(struct st_lock_list *wait, THR_LOCK_DATA *data,
One can use this to signal when a thread is going to wait for a lock.
See debug_sync.cc.
- Beware of waiting for a signal here. The lock has aquired its mutex.
- While waiting on a signal here, the locking thread could not aquire
+ Beware of waiting for a signal here. The lock has acquired its mutex.
+ While waiting on a signal here, the locking thread could not acquire
the mutex to release the lock. One could lock up the table
completely.
@@ -788,8 +788,8 @@ thr_lock(THR_LOCK_DATA *data, THR_LOCK_INFO *owner, ulong lock_wait_timeout)
\ = READ
- + = Request can be satisified.
- - = Request cannot be satisified.
+ + = Request can be satisfied.
+ - = Request cannot be satisfied.
READ_NO_INSERT and WRITE_ALLOW_WRITE should in principle
be incompatible. However this will cause starvation of
@@ -1248,7 +1248,7 @@ end:
/*
Get all locks in a specific order to avoid dead-locks
- Sort acording to lock position and put write_locks before read_locks if
+ Sort according to lock position and put write_locks before read_locks if
lock on same lock. Locks on MERGE tables has lower priority than other
locks of the same type. See comment for lock_priority.
*/
diff --git a/mysys/tree.c b/mysys/tree.c
index ab810c64c67..5eaeb30037d 100644
--- a/mysys/tree.c
+++ b/mysys/tree.c
@@ -30,8 +30,8 @@
3) if key_size is given to init_tree then each node will continue the
key and calls to insert_key may increase length of key.
if key_size > sizeof(pointer) and key_size is a multiple of 8 (double
- allign) then key will be put on a 8 alligned adress. Else
- the key will be on adress (element+1). This is transparent for user
+ align) then key will be put on a 8 aligned address. Else
+ the key will be on address (element+1). This is transparent for user
compare and search functions uses a pointer to given key-argument.
- If you use a free function for tree-elements and you are freeing
diff --git a/mysys/typelib.c b/mysys/typelib.c
index 75744a65ec8..96842b1a3ad 100644
--- a/mysys/typelib.c
+++ b/mysys/typelib.c
@@ -182,7 +182,7 @@ const char *get_type(TYPELIB *typelib, uint nr)
/**
- Create an integer value to represent the supplied comma-seperated
+ Create an integer value to represent the supplied comma-separated
string where each string in the TYPELIB denotes a bit position.
@param x string to decompose
diff --git a/mysys/waiting_threads.c b/mysys/waiting_threads.c
index ae0ffe7f7eb..7d8aae032ea 100644
--- a/mysys/waiting_threads.c
+++ b/mysys/waiting_threads.c
@@ -12,7 +12,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
/**
@file
@@ -136,7 +136,7 @@
Status
^^^^^^
- We calculate the number of successfull waits (WT_OK returned from
+ We calculate the number of successful waits (WT_OK returned from
wt_thd_cond_timedwait()), a number of timeouts, a deadlock cycle
length distribution - number of deadlocks with every length from
1 to WT_CYCLE_STATS, and a wait time distribution - number
diff --git a/mysys/wqueue.c b/mysys/wqueue.c
index 2fcced14f77..1dafc03b935 100644
--- a/mysys/wqueue.c
+++ b/mysys/wqueue.c
@@ -13,7 +13,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#include <wqueue.h>
@@ -211,7 +211,7 @@ void wqueue_release_one_locktype_from_queue(WQUEUE *wqueue)
/*
Add thread and wait
- SYNOPSYS
+ SYNOPSIS
wqueue_add_and_wait()
wqueue queue to add to
thread thread which is waiting
diff --git a/mysys_ssl/CMakeLists.txt b/mysys_ssl/CMakeLists.txt
index 8a8f81d70ae..4f6f7458c5b 100644
--- a/mysys_ssl/CMakeLists.txt
+++ b/mysys_ssl/CMakeLists.txt
@@ -21,25 +21,29 @@ IF(SSL_DEFINES)
ADD_DEFINITIONS(${SSL_DEFINES})
ENDIF()
+SET(MYSYS_SSL_HIDDEN_SOURCES
+ my_sha1.cc
+ my_sha224.cc
+ my_sha256.cc
+ my_sha384.cc
+ my_sha512.cc
+ my_md5.cc
+ )
+
+SET(MYSYS_SSL_SOURCES
+ ${MYSYS_SSL_HIDDEN_SOURCES}
+ my_crypt.cc
+ )
+
# We do RESTRICT_SYMBOL_EXPORTS(yassl) elsewhere.
# In order to get correct symbol visibility, these files
# must be compiled with "-fvisibility=hidden"
IF(WITH_SSL STREQUAL "bundled" AND HAVE_VISIBILITY_HIDDEN)
SET_SOURCE_FILES_PROPERTIES(
- my_md5.cc
- my_sha1.cc
- my_sha2.cc
+ ${MYSYS_SSL_HIDDEN_SOURCES}
PROPERTIES COMPILE_FLAGS "-fvisibility=hidden")
ENDIF()
-SET(MYSYS_SSL_SOURCES
- my_sha1.cc
- my_sha2.cc
- my_md5.cc
- my_rnd.cc
- my_crypt.cc
- )
-
ADD_CONVENIENCE_LIBRARY(mysys_ssl ${MYSYS_SSL_SOURCES})
TARGET_LINK_LIBRARIES(mysys_ssl dbug strings ${SSL_LIBRARIES})
DTRACE_INSTRUMENT(mysys_ssl)
diff --git a/mysys_ssl/my_rnd.cc b/mysys_ssl/my_rnd.cc
deleted file mode 100644
index aa8fb63cd4d..00000000000
--- a/mysys_ssl/my_rnd.cc
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; version 2 of the License.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
-
-#include <my_global.h>
-#include <my_rnd.h>
-#include <m_string.h>
-
-#if defined(HAVE_YASSL)
-#if defined(YASSL_PREFIX)
-#define RAND_bytes yaRAND_bytes
-#endif /* YASSL_PREFIX */
-
-#include <openssl/ssl.h>
-
-#elif defined(HAVE_OPENSSL)
-#include <openssl/rand.h>
-#endif /* HAVE_YASSL */
-
-
-/*
- A wrapper to use OpenSSL/yaSSL PRNGs.
-*/
-
-extern "C" {
-
-/*
- Initialize random generator
-
- NOTES
- MySQL's password checks depends on this, so don't do any changes
- that changes the random numbers that are generated!
-*/
-
-void my_rnd_init(struct my_rnd_struct *rand_st, ulong seed1, ulong seed2)
-{
-#ifdef HAVE_valgrind
- bzero((char*) rand_st,sizeof(*rand_st)); /* Avoid UMC varnings */
-#endif
- rand_st->max_value= 0x3FFFFFFFL;
- rand_st->max_value_dbl=(double) rand_st->max_value;
- rand_st->seed1=seed1%rand_st->max_value ;
- rand_st->seed2=seed2%rand_st->max_value;
-}
-
-/**
- Generate random number.
-
- @param rand_st [INOUT] Structure used for number generation.
-
- @retval Generated pseudo random number.
-*/
-
-double my_rnd(struct my_rnd_struct *rand_st)
-{
- rand_st->seed1= (rand_st->seed1*3+rand_st->seed2) % rand_st->max_value;
- rand_st->seed2= (rand_st->seed1+rand_st->seed2+33) % rand_st->max_value;
- return (((double) rand_st->seed1) / rand_st->max_value_dbl);
-}
-
-/**
- Generate a random number using the OpenSSL/yaSSL supplied
- random number generator if available.
-
- @param rand_st [INOUT] Structure used for number generation
- only if none of the SSL libraries are
- available.
-
- @retval Generated random number.
-*/
-
-double my_rnd_ssl(struct my_rnd_struct *rand_st)
-{
-
-#if defined(HAVE_YASSL) || defined(HAVE_OPENSSL)
- int rc;
- unsigned int res;
-
-#if defined(HAVE_YASSL)
- rc= yaSSL::RAND_bytes((unsigned char *) &res, sizeof (unsigned int));
-#else
- rc= RAND_bytes((unsigned char *) &res, sizeof (unsigned int));
-#endif /* HAVE_YASSL */
- if (rc)
- return (double)res / (double)UINT_MAX;
-
-#endif /* defined(HAVE_YASSL) || defined(HAVE_OPENSSL) */
- return my_rnd(rand_st);
-}
-
-}
diff --git a/mysys_ssl/my_sha.ic b/mysys_ssl/my_sha.ic
new file mode 100644
index 00000000000..a7ec8bad593
--- /dev/null
+++ b/mysys_ssl/my_sha.ic
@@ -0,0 +1,188 @@
+/* Copyright (c) 2012, Oracle and/or its affiliates.
+ Copyright (c) 2014, 2017, MariaDB
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software Foundation,
+ 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */
+
+
+/**
+ @file
+
+ @brief
+ Wrapper functions for OpenSSL, YaSSL implementations. Also provides a
+ Compatibility layer to make available YaSSL's SHAn implementation.
+*/
+
+#include <my_global.h>
+#include <stdarg.h>
+
+#define HASH_SIZE (NUM > 1 ? NUM/8 : 20)
+
+#if defined(HAVE_YASSL)
+#include "sha.hpp"
+
+#define xCONTEXT(x) TaoCrypt::SHA ## x
+#define yCONTEXT(y) xCONTEXT(y)
+#define CONTEXT yCONTEXT(NUM)
+#define SHA1 SHA
+
+static void sha_init(CONTEXT *context)
+{
+ context->Init();
+}
+
+/*
+ this is a variant of sha_init to be used in this file only.
+ does nothing for yassl, because the context's constructor was called automatically.
+*/
+static void sha_init_fast(CONTEXT *context)
+{
+}
+
+static void sha_input(CONTEXT *context, const uchar *buf, unsigned len)
+{
+ context->Update((const TaoCrypt::byte *) buf, len);
+}
+
+static void sha_result(CONTEXT *context, uchar digest[HASH_SIZE])
+{
+ context->Final((TaoCrypt::byte *) digest);
+}
+
+#elif defined(HAVE_OPENSSL)
+#include <openssl/sha.h>
+
+#define xCONTEXT(x) SHA ## x ## _CTX
+#define yCONTEXT(y) xCONTEXT(y)
+#define CONTEXT yCONTEXT(NUM)
+#define SHA1_CTX SHA_CTX
+#define SHA224_CTX SHA256_CTX
+#define SHA384_CTX SHA512_CTX
+
+#define xSHA_Init(x) SHA ## x ## _Init
+#define xSHA_Update(x) SHA ## x ## _Update
+#define xSHA_Final(x) SHA ## x ## _Final
+#define ySHA_Init(y) xSHA_Init(y)
+#define ySHA_Update(y) xSHA_Update(y)
+#define ySHA_Final(y) xSHA_Final(y)
+#define SHA_Init ySHA_Init(NUM)
+#define SHA_Update ySHA_Update(NUM)
+#define SHA_Final ySHA_Final(NUM)
+
+static void sha_init(CONTEXT *context)
+{
+ SHA_Init(context);
+}
+
+static void sha_init_fast(CONTEXT *context)
+{
+ sha_init(context);
+}
+
+static void sha_input(CONTEXT *context, const uchar *buf, unsigned len)
+{
+ SHA_Update(context, buf, len);
+}
+
+static void sha_result(CONTEXT *context, uchar digest[HASH_SIZE])
+{
+ SHA_Final(digest, context);
+}
+
+#endif /* HAVE_YASSL */
+
+#define xmy_sha_multi(x) my_sha ## x ## _multi
+#define xmy_sha_context_size(x) my_sha ## x ## _context_size
+#define xmy_sha_init(x) my_sha ## x ## _init
+#define xmy_sha_input(x) my_sha ## x ## _input
+#define xmy_sha_result(x) my_sha ## x ## _result
+#define xmy_sha(x) my_sha ## x
+#define ymy_sha_multi(y) xmy_sha_multi(y)
+#define ymy_sha_context_size(y) xmy_sha_context_size(y)
+#define ymy_sha_init(y) xmy_sha_init(y)
+#define ymy_sha_input(y) xmy_sha_input(y)
+#define ymy_sha_result(y) xmy_sha_result(y)
+#define ymy_sha(y) xmy_sha(y)
+#define my_sha_multi ymy_sha_multi(NUM)
+#define my_sha_context_size ymy_sha_context_size(NUM)
+#define my_sha_init ymy_sha_init(NUM)
+#define my_sha_input ymy_sha_input(NUM)
+#define my_sha_result ymy_sha_result(NUM)
+#define my_sha ymy_sha(NUM)
+
+/**
+ Wrapper function to compute SHAn message digest.
+
+ @param digest [out] Computed SHAn digest
+ @param buf [in] Message to be computed
+ @param len [in] Length of the message
+
+ @return void
+*/
+void my_sha(uchar *digest, const char *buf, size_t len)
+{
+ CONTEXT context;
+
+ sha_init_fast(&context);
+ sha_input(&context, (const uchar *)buf, len);
+ sha_result(&context, digest);
+}
+
+
+/**
+ Wrapper function to compute SHAn message digest for
+ two messages in order to emulate shaN(msg1, msg2).
+
+ @param digest [out] Computed SHAn digest
+ @param buf1 [in] First message
+ @param len1 [in] Length of first message
+ @param buf2 [in] Second message
+ @param len2 [in] Length of second message
+
+ @return void
+*/
+void my_sha_multi(uchar *digest, ...)
+{
+ va_list args;
+ va_start(args, digest);
+
+ CONTEXT context;
+ const uchar *str;
+
+ sha_init_fast(&context);
+ for (str= va_arg(args, const uchar*); str; str= va_arg(args, const uchar*))
+ sha_input(&context, str, va_arg(args, size_t));
+
+ sha_result(&context, digest);
+ va_end(args);
+}
+
+size_t my_sha_context_size()
+{
+ return sizeof(CONTEXT);
+}
+
+void my_sha_init(void *context)
+{
+ sha_init((CONTEXT *)context);
+}
+
+void my_sha_input(void *context, const uchar *buf, size_t len)
+{
+ sha_input((CONTEXT *)context, buf, len);
+}
+
+void my_sha_result(void *context, uchar *digest)
+{
+ sha_result((CONTEXT *)context, digest);
+}
diff --git a/mysys_ssl/my_sha1.cc b/mysys_ssl/my_sha1.cc
index 9b12d1f1ae8..dc6a7a46179 100644
--- a/mysys_ssl/my_sha1.cc
+++ b/mysys_ssl/my_sha1.cc
@@ -1,5 +1,4 @@
-/* Copyright (c) 2012, Oracle and/or its affiliates.
- Copyright (c) 2014, SkySQL Ab.
+/* Copyright (c) 2017, MariaDB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -14,135 +13,6 @@
along with this program; if not, write to the Free Software Foundation,
51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */
+#define NUM 1
-/**
- @file
-
- @brief
- Wrapper functions for OpenSSL, YaSSL implementations. Also provides a
- Compatibility layer to make available YaSSL's SHA1 implementation.
-*/
-
-#include <my_global.h>
-#include <sha1.h>
-#include <stdarg.h>
-
-#if defined(HAVE_YASSL)
-#include "sha.hpp"
-
-typedef TaoCrypt::SHA SHA_CTX;
-
-static void sha1_init(SHA_CTX *context)
-{
- context->Init();
-}
-
-/*
- this is a variant of sha1_init to be used in this file only.
- does nothing for yassl, because the context's constructor was called automatically.
-*/
-static void sha1_init_fast(SHA_CTX *context)
-{
-}
-
-static void sha1_input(SHA_CTX *context, const uchar *buf, unsigned len)
-{
- context->Update((const TaoCrypt::byte *) buf, len);
-}
-
-static void sha1_result(SHA_CTX *context, uchar digest[SHA1_HASH_SIZE])
-{
- context->Final((TaoCrypt::byte *) digest);
-}
-
-#elif defined(HAVE_OPENSSL)
-#include <openssl/sha.h>
-
-static void sha1_init(SHA_CTX *context)
-{
- SHA1_Init(context);
-}
-
-static void sha1_init_fast(SHA_CTX *context)
-{
- sha1_init(context);
-}
-
-static void sha1_input(SHA_CTX *context, const uchar *buf, unsigned len)
-{
- SHA1_Update(context, buf, len);
-}
-
-static void sha1_result(SHA_CTX *context, uchar digest[SHA1_HASH_SIZE])
-{
- SHA1_Final(digest, context);
-}
-
-#endif /* HAVE_YASSL */
-
-/**
- Wrapper function to compute SHA1 message digest.
-
- @param digest [out] Computed SHA1 digest
- @param buf [in] Message to be computed
- @param len [in] Length of the message
-
- @return void
-*/
-void my_sha1(uchar *digest, const char *buf, size_t len)
-{
- SHA_CTX sha1_context;
-
- sha1_init_fast(&sha1_context);
- sha1_input(&sha1_context, (const uchar *)buf, len);
- sha1_result(&sha1_context, digest);
-}
-
-
-/**
- Wrapper function to compute SHA1 message digest for
- two messages in order to emulate sha1(msg1, msg2).
-
- @param digest [out] Computed SHA1 digest
- @param buf1 [in] First message
- @param len1 [in] Length of first message
- @param buf2 [in] Second message
- @param len2 [in] Length of second message
-
- @return void
-*/
-void my_sha1_multi(uchar *digest, ...)
-{
- va_list args;
- va_start(args, digest);
-
- SHA_CTX sha1_context;
- const uchar *str;
-
- sha1_init_fast(&sha1_context);
- for (str= va_arg(args, const uchar*); str; str= va_arg(args, const uchar*))
- sha1_input(&sha1_context, str, va_arg(args, size_t));
-
- sha1_result(&sha1_context, digest);
- va_end(args);
-}
-
-size_t my_sha1_context_size()
-{
- return sizeof(SHA_CTX);
-}
-
-void my_sha1_init(void *context)
-{
- sha1_init((SHA_CTX *)context);
-}
-
-void my_sha1_input(void *context, const uchar *buf, size_t len)
-{
- sha1_input((SHA_CTX *)context, buf, len);
-}
-
-void my_sha1_result(void *context, uchar *digest)
-{
- sha1_result((SHA_CTX *)context, digest);
-}
+#include "my_sha.ic"
diff --git a/mysys_ssl/my_sha2.cc b/mysys_ssl/my_sha2.cc
deleted file mode 100644
index 00200337f08..00000000000
--- a/mysys_ssl/my_sha2.cc
+++ /dev/null
@@ -1,68 +0,0 @@
-/* Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; version 2 of the License.
-
- 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,
- 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */
-
-
-/**
- @file
- A compatibility layer to our built-in SSL implementation, to mimic the
- oft-used external library, OpenSSL.
-*/
-
-#include <my_global.h>
-#include <sha2.h>
-
-#ifdef HAVE_YASSL
-
-/*
- If TaoCrypt::SHA512 or ::SHA384 are not defined (but ::SHA256 is), it's
- probably that neither of config.h's SIZEOF_LONG or SIZEOF_LONG_LONG are
- 64 bits long. At present, both OpenSSL and YaSSL require 64-bit integers
- for SHA-512. (The SIZEOF_* definitions come from autoconf's config.h .)
-*/
-
-# define GEN_YASSL_SHA2_BRIDGE(size) \
-unsigned char* SHA##size(const unsigned char *input_ptr, size_t input_length, \
- char unsigned *output_ptr) { \
- TaoCrypt::SHA##size hasher; \
- \
- hasher.Update(input_ptr, input_length); \
- hasher.Final(output_ptr); \
- return(output_ptr); \
-}
-
-
-/**
- @fn SHA512
- @fn SHA384
- @fn SHA256
- @fn SHA224
-
- Instantiate an hash object, fill in the cleartext value, compute the digest,
- and extract the result from the object.
-
- (Generate the functions. See similar .h code for the prototypes.)
-*/
-# ifndef OPENSSL_NO_SHA512
-GEN_YASSL_SHA2_BRIDGE(512);
-GEN_YASSL_SHA2_BRIDGE(384);
-# else
-# warning Some SHA2 functionality is missing. See OPENSSL_NO_SHA512.
-# endif
-GEN_YASSL_SHA2_BRIDGE(256);
-GEN_YASSL_SHA2_BRIDGE(224);
-
-# undef GEN_YASSL_SHA2_BRIDGE
-
-#endif /* HAVE_YASSL */
diff --git a/mysys_ssl/my_sha224.cc b/mysys_ssl/my_sha224.cc
new file mode 100644
index 00000000000..7e8b481256b
--- /dev/null
+++ b/mysys_ssl/my_sha224.cc
@@ -0,0 +1,18 @@
+/* Copyright (c) 2017, MariaDB
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software Foundation,
+ 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */
+
+#define NUM 224
+
+#include "my_sha.ic"
diff --git a/mysys_ssl/my_sha256.cc b/mysys_ssl/my_sha256.cc
new file mode 100644
index 00000000000..8c1a4662009
--- /dev/null
+++ b/mysys_ssl/my_sha256.cc
@@ -0,0 +1,18 @@
+/* Copyright (c) 2017, MariaDB
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software Foundation,
+ 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */
+
+#define NUM 256
+
+#include "my_sha.ic"
diff --git a/mysys_ssl/my_sha384.cc b/mysys_ssl/my_sha384.cc
new file mode 100644
index 00000000000..3bad6b39248
--- /dev/null
+++ b/mysys_ssl/my_sha384.cc
@@ -0,0 +1,18 @@
+/* Copyright (c) 2017, MariaDB
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software Foundation,
+ 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */
+
+#define NUM 384
+
+#include "my_sha.ic"
diff --git a/mysys_ssl/my_sha512.cc b/mysys_ssl/my_sha512.cc
new file mode 100644
index 00000000000..8077efd3b57
--- /dev/null
+++ b/mysys_ssl/my_sha512.cc
@@ -0,0 +1,18 @@
+/* Copyright (c) 2017, MariaDB
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software Foundation,
+ 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */
+
+#define NUM 512
+
+#include "my_sha.ic"
diff --git a/pcre/AUTHORS b/pcre/AUTHORS
index 342417a8a19..291657caef1 100644
--- a/pcre/AUTHORS
+++ b/pcre/AUTHORS
@@ -8,7 +8,7 @@ Email domain: cam.ac.uk
University of Cambridge Computing Service,
Cambridge, England.
-Copyright (c) 1997-2016 University of Cambridge
+Copyright (c) 1997-2017 University of Cambridge
All rights reserved
@@ -19,7 +19,7 @@ Written by: Zoltan Herczeg
Email local part: hzmester
Emain domain: freemail.hu
-Copyright(c) 2010-2016 Zoltan Herczeg
+Copyright(c) 2010-2017 Zoltan Herczeg
All rights reserved.
@@ -30,7 +30,7 @@ Written by: Zoltan Herczeg
Email local part: hzmester
Emain domain: freemail.hu
-Copyright(c) 2009-2016 Zoltan Herczeg
+Copyright(c) 2009-2017 Zoltan Herczeg
All rights reserved.
diff --git a/pcre/CMakeLists.txt b/pcre/CMakeLists.txt
index 91e2e781fc2..30b06a46fef 100644
--- a/pcre/CMakeLists.txt
+++ b/pcre/CMakeLists.txt
@@ -66,6 +66,7 @@
# 2013-10-08 PH got rid of the "source" command, which is a bash-ism (use ".")
# 2013-11-05 PH added support for PARENS_NEST_LIMIT
# 2016-03-01 PH applied Chris Wilson's patch for MSVC static build
+# 2016-06-24 PH applied Chris Wilson's revised patch (adds a separate option)
PROJECT(PCRE C CXX)
diff --git a/pcre/ChangeLog b/pcre/ChangeLog
index a34f845f8a1..01511b1327c 100644
--- a/pcre/ChangeLog
+++ b/pcre/ChangeLog
@@ -4,6 +4,53 @@ ChangeLog for PCRE
Note that the PCRE 8.xx series (PCRE1) is now in a bugfix-only state. All
development is happening in the PCRE2 10.xx series.
+Version 8.40 11-January-2017
+----------------------------
+
+1. Using -o with -M in pcregrep could cause unnecessary repeated output when
+ the match extended over a line boundary.
+
+2. Applied Chris Wilson's second patch (Bugzilla #1681) to CMakeLists.txt for
+ MSVC static compilation, putting the first patch under a new option.
+
+3. Fix register overwite in JIT when SSE2 acceleration is enabled.
+
+4. Ignore "show all captures" (/=) for DFA matching.
+
+5. Fix JIT unaligned accesses on x86. Patch by Marc Mutz.
+
+6. In any wide-character mode (8-bit UTF or any 16-bit or 32-bit mode),
+ without PCRE_UCP set, a negative character type such as \D in a positive
+ class should cause all characters greater than 255 to match, whatever else
+ is in the class. There was a bug that caused this not to happen if a
+ Unicode property item was added to such a class, for example [\D\P{Nd}] or
+ [\W\pL].
+
+7. When pcretest was outputing information from a callout, the caret indicator
+ for the current position in the subject line was incorrect if it was after
+ an escape sequence for a character whose code point was greater than
+ \x{ff}.
+
+8. A pattern such as (?<RA>abc)(?(R)xyz) was incorrectly compiled such that
+ the conditional was interpreted as a reference to capturing group 1 instead
+ of a test for recursion. Any group whose name began with R was
+ misinterpreted in this way. (The reference interpretation should only
+ happen if the group's name is precisely "R".)
+
+9. A number of bugs have been mended relating to match start-up optimizations
+ when the first thing in a pattern is a positive lookahead. These all
+ applied only when PCRE_NO_START_OPTIMIZE was *not* set:
+
+ (a) A pattern such as (?=.*X)X$ was incorrectly optimized as if it needed
+ both an initial 'X' and a following 'X'.
+ (b) Some patterns starting with an assertion that started with .* were
+ incorrectly optimized as having to match at the start of the subject or
+ after a newline. There are cases where this is not true, for example,
+ (?=.*[A-Z])(?=.{8,16})(?!.*[\s]) matches after the start in lines that
+ start with spaces. Starting .* in an assertion is no longer taken as an
+ indication of matching at the start (or after a newline).
+
+
Version 8.39 14-June-2016
-------------------------
diff --git a/pcre/LICENCE b/pcre/LICENCE
index dd977af971b..dd9071a8dd8 100644
--- a/pcre/LICENCE
+++ b/pcre/LICENCE
@@ -25,7 +25,7 @@ Email domain: cam.ac.uk
University of Cambridge Computing Service,
Cambridge, England.
-Copyright (c) 1997-2016 University of Cambridge
+Copyright (c) 1997-2017 University of Cambridge
All rights reserved.
@@ -36,7 +36,7 @@ Written by: Zoltan Herczeg
Email local part: hzmester
Emain domain: freemail.hu
-Copyright(c) 2010-2016 Zoltan Herczeg
+Copyright(c) 2010-2017 Zoltan Herczeg
All rights reserved.
@@ -47,7 +47,7 @@ Written by: Zoltan Herczeg
Email local part: hzmester
Emain domain: freemail.hu
-Copyright(c) 2009-2016 Zoltan Herczeg
+Copyright(c) 2009-2017 Zoltan Herczeg
All rights reserved.
diff --git a/pcre/NEWS b/pcre/NEWS
index 0ca1bab2a4c..b92c4f9605e 100644
--- a/pcre/NEWS
+++ b/pcre/NEWS
@@ -1,6 +1,12 @@
News about PCRE releases
------------------------
+Release 8.40 11-January-2017
+----------------------------
+
+This is a bug-fix release.
+
+
Release 8.39 14-June-2016
-------------------------
diff --git a/pcre/configure.ac b/pcre/configure.ac
index 3cefaf100f9..24ef7271e05 100644
--- a/pcre/configure.ac
+++ b/pcre/configure.ac
@@ -9,17 +9,17 @@ dnl The PCRE_PRERELEASE feature is for identifying release candidates. It might
dnl be defined as -RC2, for example. For real releases, it should be empty.
m4_define(pcre_major, [8])
-m4_define(pcre_minor, [39])
+m4_define(pcre_minor, [40])
m4_define(pcre_prerelease, [])
-m4_define(pcre_date, [2016-06-14])
+m4_define(pcre_date, [2017-01-11])
# NOTE: The CMakeLists.txt file searches for the above variables in the first
# 50 lines of this file. Please update that if the variables above are moved.
# Libtool shared library interface versions (current:revision:age)
-m4_define(libpcre_version, [3:7:2])
-m4_define(libpcre16_version, [2:7:2])
-m4_define(libpcre32_version, [0:7:0])
+m4_define(libpcre_version, [3:8:2])
+m4_define(libpcre16_version, [2:8:2])
+m4_define(libpcre32_version, [0:8:0])
m4_define(libpcreposix_version, [0:4:0])
m4_define(libpcrecpp_version, [0:1:0])
diff --git a/pcre/doc/html/pcrecompat.html b/pcre/doc/html/pcrecompat.html
index 3e6226692ee..d95570ef179 100644
--- a/pcre/doc/html/pcrecompat.html
+++ b/pcre/doc/html/pcrecompat.html
@@ -128,7 +128,7 @@ the pattern /^(a(b)?)+$/ in Perl leaves $2 unset, but in PCRE it is set to "b".
14. PCRE's handling of duplicate subpattern numbers and duplicate subpattern
names is not as general as Perl's. This is a consequence of the fact the PCRE
works internally just with numbers, using an external table to translate
-between numbers and names. In particular, a pattern such as (?|(?&#60;a&#62;A)|(?&#60;b)B),
+between numbers and names. In particular, a pattern such as (?|(?&#60;a&#62;A)|(?&#60;b&#62;B),
where the two capturing parentheses have the same number but different names,
is not supported, and causes an error at compile time. If it were allowed, it
would not be possible to distinguish which parentheses matched, because both
diff --git a/pcre/doc/html/pcrepattern.html b/pcre/doc/html/pcrepattern.html
index 55034a7edf6..96fc72986f6 100644
--- a/pcre/doc/html/pcrepattern.html
+++ b/pcre/doc/html/pcrepattern.html
@@ -358,24 +358,24 @@ When PCRE is compiled in EBCDIC mode, \a, \e, \f, \n, \r, and \t
generate the appropriate EBCDIC code values. The \c escape is processed
as specified for Perl in the <b>perlebcdic</b> document. The only characters
that are allowed after \c are A-Z, a-z, or one of @, [, \, ], ^, _, or ?. Any
-other character provokes a compile-time error. The sequence \@ encodes
-character code 0; the letters (in either case) encode characters 1-26 (hex 01
-to hex 1A); [, \, ], ^, and _ encode characters 27-31 (hex 1B to hex 1F), and
-\? becomes either 255 (hex FF) or 95 (hex 5F).
+other character provokes a compile-time error. The sequence \c@ encodes
+character code 0; after \c the letters (in either case) encode characters 1-26
+(hex 01 to hex 1A); [, \, ], ^, and _ encode characters 27-31 (hex 1B to hex
+1F), and \c? becomes either 255 (hex FF) or 95 (hex 5F).
</P>
<P>
-Thus, apart from \?, these escapes generate the same character code values as
+Thus, apart from \c?, these escapes generate the same character code values as
they do in an ASCII environment, though the meanings of the values mostly
-differ. For example, \G always generates code value 7, which is BEL in ASCII
+differ. For example, \cG always generates code value 7, which is BEL in ASCII
but DEL in EBCDIC.
</P>
<P>
-The sequence \? generates DEL (127, hex 7F) in an ASCII environment, but
+The sequence \c? generates DEL (127, hex 7F) in an ASCII environment, but
because 127 is not a control character in EBCDIC, Perl makes it generate the
APC character. Unfortunately, there are several variants of EBCDIC. In most of
them the APC character has the value 255 (hex FF), but in the one Perl calls
POSIX-BC its value is 95 (hex 5F). If certain other characters have POSIX-BC
-values, PCRE makes \? generate 95; otherwise it generates 255.
+values, PCRE makes \c? generate 95; otherwise it generates 255.
</P>
<P>
After \0 up to two further octal digits are read. If there are fewer than two
@@ -1512,13 +1512,8 @@ J, U and X respectively.
<P>
When one of these option changes occurs at top level (that is, not inside
subpattern parentheses), the change applies to the remainder of the pattern
-that follows. If the change is placed right at the start of a pattern, PCRE
-extracts it into the global options (and it will therefore show up in data
-extracted by the <b>pcre_fullinfo()</b> function).
-</P>
-<P>
-An option change within a subpattern (see below for a description of
-subpatterns) affects only that part of the subpattern that follows it, so
+that follows. An option change within a subpattern (see below for a description
+of subpatterns) affects only that part of the subpattern that follows it, so
<pre>
(a(?i)b)c
</pre>
@@ -2160,6 +2155,14 @@ capturing is carried out only for positive assertions. (Perl sometimes, but not
always, does do capturing in negative assertions.)
</P>
<P>
+WARNING: If a positive assertion containing one or more capturing subpatterns
+succeeds, but failure to match later in the pattern causes backtracking over
+this assertion, the captures within the assertion are reset only if no higher
+numbered captures are already set. This is, unfortunately, a fundamental
+limitation of the current implementation, and as PCRE1 is now in
+maintenance-only status, it is unlikely ever to change.
+</P>
+<P>
For compatibility with Perl, assertion subpatterns may be repeated; though
it makes no sense to assert the same thing several times, the side effect of
capturing parentheses may occasionally be useful. In practice, there only three
@@ -3264,9 +3267,9 @@ Cambridge CB2 3QH, England.
</P>
<br><a name="SEC30" href="#TOC1">REVISION</a><br>
<P>
-Last updated: 14 June 2015
+Last updated: 23 October 2016
<br>
-Copyright &copy; 1997-2015 University of Cambridge.
+Copyright &copy; 1997-2016 University of Cambridge.
<br>
<p>
Return to the <a href="index.html">PCRE index page</a>.
diff --git a/pcre/doc/pcre.txt b/pcre/doc/pcre.txt
index f5eb347e18a..d68d5033ceb 100644
--- a/pcre/doc/pcre.txt
+++ b/pcre/doc/pcre.txt
@@ -4640,7 +4640,7 @@ DIFFERENCES BETWEEN PCRE AND PERL
pattern names is not as general as Perl's. This is a consequence of the
fact the PCRE works internally just with numbers, using an external ta-
ble to translate between numbers and names. In particular, a pattern
- such as (?|(?<a>A)|(?<b)B), where the two capturing parentheses have
+ such as (?|(?<a>A)|(?<b>B), where the two capturing parentheses have
the same number but different names, is not supported, and causes an
error at compile time. If it were allowed, it would not be possible to
distinguish which parentheses matched, because both names map to cap-
@@ -5028,55 +5028,56 @@ BACKSLASH
ate the appropriate EBCDIC code values. The \c escape is processed as
specified for Perl in the perlebcdic document. The only characters that
are allowed after \c are A-Z, a-z, or one of @, [, \, ], ^, _, or ?.
- Any other character provokes a compile-time error. The sequence \@
- encodes character code 0; the letters (in either case) encode charac-
- ters 1-26 (hex 01 to hex 1A); [, \, ], ^, and _ encode characters 27-31
- (hex 1B to hex 1F), and \? becomes either 255 (hex FF) or 95 (hex 5F).
-
- Thus, apart from \?, these escapes generate the same character code
- values as they do in an ASCII environment, though the meanings of the
- values mostly differ. For example, \G always generates code value 7,
+ Any other character provokes a compile-time error. The sequence \c@
+ encodes character code 0; after \c the letters (in either case) encode
+ characters 1-26 (hex 01 to hex 1A); [, \, ], ^, and _ encode characters
+ 27-31 (hex 1B to hex 1F), and \c? becomes either 255 (hex FF) or 95
+ (hex 5F).
+
+ Thus, apart from \c?, these escapes generate the same character code
+ values as they do in an ASCII environment, though the meanings of the
+ values mostly differ. For example, \cG always generates code value 7,
which is BEL in ASCII but DEL in EBCDIC.
- The sequence \? generates DEL (127, hex 7F) in an ASCII environment,
- but because 127 is not a control character in EBCDIC, Perl makes it
- generate the APC character. Unfortunately, there are several variants
- of EBCDIC. In most of them the APC character has the value 255 (hex
- FF), but in the one Perl calls POSIX-BC its value is 95 (hex 5F). If
- certain other characters have POSIX-BC values, PCRE makes \? generate
+ The sequence \c? generates DEL (127, hex 7F) in an ASCII environment,
+ but because 127 is not a control character in EBCDIC, Perl makes it
+ generate the APC character. Unfortunately, there are several variants
+ of EBCDIC. In most of them the APC character has the value 255 (hex
+ FF), but in the one Perl calls POSIX-BC its value is 95 (hex 5F). If
+ certain other characters have POSIX-BC values, PCRE makes \c? generate
95; otherwise it generates 255.
- After \0 up to two further octal digits are read. If there are fewer
- than two digits, just those that are present are used. Thus the
+ After \0 up to two further octal digits are read. If there are fewer
+ than two digits, just those that are present are used. Thus the
sequence \0\x\015 specifies two binary zeros followed by a CR character
(code value 13). Make sure you supply two digits after the initial zero
if the pattern character that follows is itself an octal digit.
- The escape \o must be followed by a sequence of octal digits, enclosed
- in braces. An error occurs if this is not the case. This escape is a
- recent addition to Perl; it provides way of specifying character code
- points as octal numbers greater than 0777, and it also allows octal
+ The escape \o must be followed by a sequence of octal digits, enclosed
+ in braces. An error occurs if this is not the case. This escape is a
+ recent addition to Perl; it provides way of specifying character code
+ points as octal numbers greater than 0777, and it also allows octal
numbers and back references to be unambiguously specified.
For greater clarity and unambiguity, it is best to avoid following \ by
a digit greater than zero. Instead, use \o{} or \x{} to specify charac-
- ter numbers, and \g{} to specify back references. The following para-
+ ter numbers, and \g{} to specify back references. The following para-
graphs describe the old, ambiguous syntax.
The handling of a backslash followed by a digit other than 0 is compli-
- cated, and Perl has changed in recent releases, causing PCRE also to
+ cated, and Perl has changed in recent releases, causing PCRE also to
change. Outside a character class, PCRE reads the digit and any follow-
- ing digits as a decimal number. If the number is less than 8, or if
- there have been at least that many previous capturing left parentheses
- in the expression, the entire sequence is taken as a back reference. A
- description of how this works is given later, following the discussion
+ ing digits as a decimal number. If the number is less than 8, or if
+ there have been at least that many previous capturing left parentheses
+ in the expression, the entire sequence is taken as a back reference. A
+ description of how this works is given later, following the discussion
of parenthesized subpatterns.
- Inside a character class, or if the decimal number following \ is
+ Inside a character class, or if the decimal number following \ is
greater than 7 and there have not been that many capturing subpatterns,
- PCRE handles \8 and \9 as the literal characters "8" and "9", and oth-
+ PCRE handles \8 and \9 as the literal characters "8" and "9", and oth-
erwise re-reads up to three octal digits following the backslash, using
- them to generate a data character. Any subsequent digits stand for
+ them to generate a data character. Any subsequent digits stand for
themselves. For example:
\040 is another way of writing an ASCII space
@@ -5094,31 +5095,31 @@ BACKSLASH
\81 is either a back reference, or the two
characters "8" and "1"
- Note that octal values of 100 or greater that are specified using this
- syntax must not be introduced by a leading zero, because no more than
+ Note that octal values of 100 or greater that are specified using this
+ syntax must not be introduced by a leading zero, because no more than
three octal digits are ever read.
- By default, after \x that is not followed by {, from zero to two hexa-
- decimal digits are read (letters can be in upper or lower case). Any
+ By default, after \x that is not followed by {, from zero to two hexa-
+ decimal digits are read (letters can be in upper or lower case). Any
number of hexadecimal digits may appear between \x{ and }. If a charac-
- ter other than a hexadecimal digit appears between \x{ and }, or if
+ ter other than a hexadecimal digit appears between \x{ and }, or if
there is no terminating }, an error occurs.
- If the PCRE_JAVASCRIPT_COMPAT option is set, the interpretation of \x
- is as just described only when it is followed by two hexadecimal dig-
- its. Otherwise, it matches a literal "x" character. In JavaScript
+ If the PCRE_JAVASCRIPT_COMPAT option is set, the interpretation of \x
+ is as just described only when it is followed by two hexadecimal dig-
+ its. Otherwise, it matches a literal "x" character. In JavaScript
mode, support for code points greater than 256 is provided by \u, which
- must be followed by four hexadecimal digits; otherwise it matches a
+ must be followed by four hexadecimal digits; otherwise it matches a
literal "u" character.
Characters whose value is less than 256 can be defined by either of the
- two syntaxes for \x (or by \u in JavaScript mode). There is no differ-
+ two syntaxes for \x (or by \u in JavaScript mode). There is no differ-
ence in the way they are handled. For example, \xdc is exactly the same
as \x{dc} (or \u00dc in JavaScript mode).
Constraints on character values
- Characters that are specified using octal or hexadecimal numbers are
+ Characters that are specified using octal or hexadecimal numbers are
limited to certain values, as follows:
8-bit non-UTF mode less than 0x100
@@ -5128,44 +5129,44 @@ BACKSLASH
32-bit non-UTF mode less than 0x100000000
32-bit UTF-32 mode less than 0x10ffff and a valid codepoint
- Invalid Unicode codepoints are the range 0xd800 to 0xdfff (the so-
+ Invalid Unicode codepoints are the range 0xd800 to 0xdfff (the so-
called "surrogate" codepoints), and 0xffef.
Escape sequences in character classes
All the sequences that define a single character value can be used both
- inside and outside character classes. In addition, inside a character
+ inside and outside character classes. In addition, inside a character
class, \b is interpreted as the backspace character (hex 08).
- \N is not allowed in a character class. \B, \R, and \X are not special
- inside a character class. Like other unrecognized escape sequences,
- they are treated as the literal characters "B", "R", and "X" by
- default, but cause an error if the PCRE_EXTRA option is set. Outside a
+ \N is not allowed in a character class. \B, \R, and \X are not special
+ inside a character class. Like other unrecognized escape sequences,
+ they are treated as the literal characters "B", "R", and "X" by
+ default, but cause an error if the PCRE_EXTRA option is set. Outside a
character class, these sequences have different meanings.
Unsupported escape sequences
- In Perl, the sequences \l, \L, \u, and \U are recognized by its string
- handler and used to modify the case of following characters. By
- default, PCRE does not support these escape sequences. However, if the
- PCRE_JAVASCRIPT_COMPAT option is set, \U matches a "U" character, and
+ In Perl, the sequences \l, \L, \u, and \U are recognized by its string
+ handler and used to modify the case of following characters. By
+ default, PCRE does not support these escape sequences. However, if the
+ PCRE_JAVASCRIPT_COMPAT option is set, \U matches a "U" character, and
\u can be used to define a character by code point, as described in the
previous section.
Absolute and relative back references
- The sequence \g followed by an unsigned or a negative number, option-
- ally enclosed in braces, is an absolute or relative back reference. A
+ The sequence \g followed by an unsigned or a negative number, option-
+ ally enclosed in braces, is an absolute or relative back reference. A
named back reference can be coded as \g{name}. Back references are dis-
cussed later, following the discussion of parenthesized subpatterns.
Absolute and relative subroutine calls
- For compatibility with Oniguruma, the non-Perl syntax \g followed by a
+ For compatibility with Oniguruma, the non-Perl syntax \g followed by a
name or a number enclosed either in angle brackets or single quotes, is
- an alternative syntax for referencing a subpattern as a "subroutine".
- Details are discussed later. Note that \g{...} (Perl syntax) and
- \g<...> (Oniguruma syntax) are not synonymous. The former is a back
+ an alternative syntax for referencing a subpattern as a "subroutine".
+ Details are discussed later. Note that \g{...} (Perl syntax) and
+ \g<...> (Oniguruma syntax) are not synonymous. The former is a back
reference; the latter is a subroutine call.
Generic character types
@@ -5184,59 +5185,59 @@ BACKSLASH
\W any "non-word" character
There is also the single sequence \N, which matches a non-newline char-
- acter. This is the same as the "." metacharacter when PCRE_DOTALL is
- not set. Perl also uses \N to match characters by name; PCRE does not
+ acter. This is the same as the "." metacharacter when PCRE_DOTALL is
+ not set. Perl also uses \N to match characters by name; PCRE does not
support this.
- Each pair of lower and upper case escape sequences partitions the com-
- plete set of characters into two disjoint sets. Any given character
- matches one, and only one, of each pair. The sequences can appear both
- inside and outside character classes. They each match one character of
- the appropriate type. If the current matching point is at the end of
- the subject string, all of them fail, because there is no character to
+ Each pair of lower and upper case escape sequences partitions the com-
+ plete set of characters into two disjoint sets. Any given character
+ matches one, and only one, of each pair. The sequences can appear both
+ inside and outside character classes. They each match one character of
+ the appropriate type. If the current matching point is at the end of
+ the subject string, all of them fail, because there is no character to
match.
- For compatibility with Perl, \s did not used to match the VT character
- (code 11), which made it different from the the POSIX "space" class.
- However, Perl added VT at release 5.18, and PCRE followed suit at
- release 8.34. The default \s characters are now HT (9), LF (10), VT
- (11), FF (12), CR (13), and space (32), which are defined as white
+ For compatibility with Perl, \s did not used to match the VT character
+ (code 11), which made it different from the the POSIX "space" class.
+ However, Perl added VT at release 5.18, and PCRE followed suit at
+ release 8.34. The default \s characters are now HT (9), LF (10), VT
+ (11), FF (12), CR (13), and space (32), which are defined as white
space in the "C" locale. This list may vary if locale-specific matching
- is taking place. For example, in some locales the "non-breaking space"
- character (\xA0) is recognized as white space, and in others the VT
+ is taking place. For example, in some locales the "non-breaking space"
+ character (\xA0) is recognized as white space, and in others the VT
character is not.
- A "word" character is an underscore or any character that is a letter
- or digit. By default, the definition of letters and digits is con-
- trolled by PCRE's low-valued character tables, and may vary if locale-
- specific matching is taking place (see "Locale support" in the pcreapi
- page). For example, in a French locale such as "fr_FR" in Unix-like
- systems, or "french" in Windows, some character codes greater than 127
- are used for accented letters, and these are then matched by \w. The
+ A "word" character is an underscore or any character that is a letter
+ or digit. By default, the definition of letters and digits is con-
+ trolled by PCRE's low-valued character tables, and may vary if locale-
+ specific matching is taking place (see "Locale support" in the pcreapi
+ page). For example, in a French locale such as "fr_FR" in Unix-like
+ systems, or "french" in Windows, some character codes greater than 127
+ are used for accented letters, and these are then matched by \w. The
use of locales with Unicode is discouraged.
- By default, characters whose code points are greater than 127 never
+ By default, characters whose code points are greater than 127 never
match \d, \s, or \w, and always match \D, \S, and \W, although this may
- vary for characters in the range 128-255 when locale-specific matching
- is happening. These escape sequences retain their original meanings
- from before Unicode support was available, mainly for efficiency rea-
- sons. If PCRE is compiled with Unicode property support, and the
- PCRE_UCP option is set, the behaviour is changed so that Unicode prop-
+ vary for characters in the range 128-255 when locale-specific matching
+ is happening. These escape sequences retain their original meanings
+ from before Unicode support was available, mainly for efficiency rea-
+ sons. If PCRE is compiled with Unicode property support, and the
+ PCRE_UCP option is set, the behaviour is changed so that Unicode prop-
erties are used to determine character types, as follows:
\d any character that matches \p{Nd} (decimal digit)
\s any character that matches \p{Z} or \h or \v
\w any character that matches \p{L} or \p{N}, plus underscore
- The upper case escapes match the inverse sets of characters. Note that
- \d matches only decimal digits, whereas \w matches any Unicode digit,
- as well as any Unicode letter, and underscore. Note also that PCRE_UCP
- affects \b, and \B because they are defined in terms of \w and \W.
+ The upper case escapes match the inverse sets of characters. Note that
+ \d matches only decimal digits, whereas \w matches any Unicode digit,
+ as well as any Unicode letter, and underscore. Note also that PCRE_UCP
+ affects \b, and \B because they are defined in terms of \w and \W.
Matching these sequences is noticeably slower when PCRE_UCP is set.
- The sequences \h, \H, \v, and \V are features that were added to Perl
- at release 5.10. In contrast to the other sequences, which match only
- ASCII characters by default, these always match certain high-valued
+ The sequences \h, \H, \v, and \V are features that were added to Perl
+ at release 5.10. In contrast to the other sequences, which match only
+ ASCII characters by default, these always match certain high-valued
code points, whether or not PCRE_UCP is set. The horizontal space char-
acters are:
@@ -5275,110 +5276,110 @@ BACKSLASH
Newline sequences
- Outside a character class, by default, the escape sequence \R matches
- any Unicode newline sequence. In 8-bit non-UTF-8 mode \R is equivalent
+ Outside a character class, by default, the escape sequence \R matches
+ any Unicode newline sequence. In 8-bit non-UTF-8 mode \R is equivalent
to the following:
(?>\r\n|\n|\x0b|\f|\r|\x85)
- This is an example of an "atomic group", details of which are given
+ This is an example of an "atomic group", details of which are given
below. This particular group matches either the two-character sequence
- CR followed by LF, or one of the single characters LF (linefeed,
- U+000A), VT (vertical tab, U+000B), FF (form feed, U+000C), CR (car-
- riage return, U+000D), or NEL (next line, U+0085). The two-character
+ CR followed by LF, or one of the single characters LF (linefeed,
+ U+000A), VT (vertical tab, U+000B), FF (form feed, U+000C), CR (car-
+ riage return, U+000D), or NEL (next line, U+0085). The two-character
sequence is treated as a single unit that cannot be split.
- In other modes, two additional characters whose codepoints are greater
+ In other modes, two additional characters whose codepoints are greater
than 255 are added: LS (line separator, U+2028) and PS (paragraph sepa-
- rator, U+2029). Unicode character property support is not needed for
+ rator, U+2029). Unicode character property support is not needed for
these characters to be recognized.
It is possible to restrict \R to match only CR, LF, or CRLF (instead of
- the complete set of Unicode line endings) by setting the option
+ the complete set of Unicode line endings) by setting the option
PCRE_BSR_ANYCRLF either at compile time or when the pattern is matched.
(BSR is an abbrevation for "backslash R".) This can be made the default
- when PCRE is built; if this is the case, the other behaviour can be
- requested via the PCRE_BSR_UNICODE option. It is also possible to
- specify these settings by starting a pattern string with one of the
+ when PCRE is built; if this is the case, the other behaviour can be
+ requested via the PCRE_BSR_UNICODE option. It is also possible to
+ specify these settings by starting a pattern string with one of the
following sequences:
(*BSR_ANYCRLF) CR, LF, or CRLF only
(*BSR_UNICODE) any Unicode newline sequence
These override the default and the options given to the compiling func-
- tion, but they can themselves be overridden by options given to a
- matching function. Note that these special settings, which are not
- Perl-compatible, are recognized only at the very start of a pattern,
- and that they must be in upper case. If more than one of them is
- present, the last one is used. They can be combined with a change of
+ tion, but they can themselves be overridden by options given to a
+ matching function. Note that these special settings, which are not
+ Perl-compatible, are recognized only at the very start of a pattern,
+ and that they must be in upper case. If more than one of them is
+ present, the last one is used. They can be combined with a change of
newline convention; for example, a pattern can start with:
(*ANY)(*BSR_ANYCRLF)
- They can also be combined with the (*UTF8), (*UTF16), (*UTF32), (*UTF)
+ They can also be combined with the (*UTF8), (*UTF16), (*UTF32), (*UTF)
or (*UCP) special sequences. Inside a character class, \R is treated as
- an unrecognized escape sequence, and so matches the letter "R" by
+ an unrecognized escape sequence, and so matches the letter "R" by
default, but causes an error if PCRE_EXTRA is set.
Unicode character properties
When PCRE is built with Unicode character property support, three addi-
- tional escape sequences that match characters with specific properties
- are available. When in 8-bit non-UTF-8 mode, these sequences are of
- course limited to testing characters whose codepoints are less than
+ tional escape sequences that match characters with specific properties
+ are available. When in 8-bit non-UTF-8 mode, these sequences are of
+ course limited to testing characters whose codepoints are less than
256, but they do work in this mode. The extra escape sequences are:
\p{xx} a character with the xx property
\P{xx} a character without the xx property
\X a Unicode extended grapheme cluster
- The property names represented by xx above are limited to the Unicode
+ The property names represented by xx above are limited to the Unicode
script names, the general category properties, "Any", which matches any
- character (including newline), and some special PCRE properties
- (described in the next section). Other Perl properties such as "InMu-
- sicalSymbols" are not currently supported by PCRE. Note that \P{Any}
+ character (including newline), and some special PCRE properties
+ (described in the next section). Other Perl properties such as "InMu-
+ sicalSymbols" are not currently supported by PCRE. Note that \P{Any}
does not match any characters, so always causes a match failure.
Sets of Unicode characters are defined as belonging to certain scripts.
- A character from one of these sets can be matched using a script name.
+ A character from one of these sets can be matched using a script name.
For example:
\p{Greek}
\P{Han}
- Those that are not part of an identified script are lumped together as
+ Those that are not part of an identified script are lumped together as
"Common". The current list of scripts is:
- Arabic, Armenian, Avestan, Balinese, Bamum, Bassa_Vah, Batak, Bengali,
- Bopomofo, Brahmi, Braille, Buginese, Buhid, Canadian_Aboriginal, Car-
+ Arabic, Armenian, Avestan, Balinese, Bamum, Bassa_Vah, Batak, Bengali,
+ Bopomofo, Brahmi, Braille, Buginese, Buhid, Canadian_Aboriginal, Car-
ian, Caucasian_Albanian, Chakma, Cham, Cherokee, Common, Coptic, Cunei-
form, Cypriot, Cyrillic, Deseret, Devanagari, Duployan, Egyptian_Hiero-
glyphs, Elbasan, Ethiopic, Georgian, Glagolitic, Gothic, Grantha,
- Greek, Gujarati, Gurmukhi, Han, Hangul, Hanunoo, Hebrew, Hiragana,
- Imperial_Aramaic, Inherited, Inscriptional_Pahlavi, Inscrip-
- tional_Parthian, Javanese, Kaithi, Kannada, Katakana, Kayah_Li,
- Kharoshthi, Khmer, Khojki, Khudawadi, Lao, Latin, Lepcha, Limbu, Lin-
- ear_A, Linear_B, Lisu, Lycian, Lydian, Mahajani, Malayalam, Mandaic,
- Manichaean, Meetei_Mayek, Mende_Kikakui, Meroitic_Cursive,
- Meroitic_Hieroglyphs, Miao, Modi, Mongolian, Mro, Myanmar, Nabataean,
- New_Tai_Lue, Nko, Ogham, Ol_Chiki, Old_Italic, Old_North_Arabian,
+ Greek, Gujarati, Gurmukhi, Han, Hangul, Hanunoo, Hebrew, Hiragana,
+ Imperial_Aramaic, Inherited, Inscriptional_Pahlavi, Inscrip-
+ tional_Parthian, Javanese, Kaithi, Kannada, Katakana, Kayah_Li,
+ Kharoshthi, Khmer, Khojki, Khudawadi, Lao, Latin, Lepcha, Limbu, Lin-
+ ear_A, Linear_B, Lisu, Lycian, Lydian, Mahajani, Malayalam, Mandaic,
+ Manichaean, Meetei_Mayek, Mende_Kikakui, Meroitic_Cursive,
+ Meroitic_Hieroglyphs, Miao, Modi, Mongolian, Mro, Myanmar, Nabataean,
+ New_Tai_Lue, Nko, Ogham, Ol_Chiki, Old_Italic, Old_North_Arabian,
Old_Permic, Old_Persian, Old_South_Arabian, Old_Turkic, Oriya, Osmanya,
Pahawh_Hmong, Palmyrene, Pau_Cin_Hau, Phags_Pa, Phoenician,
- Psalter_Pahlavi, Rejang, Runic, Samaritan, Saurashtra, Sharada, Sha-
- vian, Siddham, Sinhala, Sora_Sompeng, Sundanese, Syloti_Nagri, Syriac,
- Tagalog, Tagbanwa, Tai_Le, Tai_Tham, Tai_Viet, Takri, Tamil, Telugu,
- Thaana, Thai, Tibetan, Tifinagh, Tirhuta, Ugaritic, Vai, Warang_Citi,
+ Psalter_Pahlavi, Rejang, Runic, Samaritan, Saurashtra, Sharada, Sha-
+ vian, Siddham, Sinhala, Sora_Sompeng, Sundanese, Syloti_Nagri, Syriac,
+ Tagalog, Tagbanwa, Tai_Le, Tai_Tham, Tai_Viet, Takri, Tamil, Telugu,
+ Thaana, Thai, Tibetan, Tifinagh, Tirhuta, Ugaritic, Vai, Warang_Citi,
Yi.
Each character has exactly one Unicode general category property, spec-
- ified by a two-letter abbreviation. For compatibility with Perl, nega-
- tion can be specified by including a circumflex between the opening
- brace and the property name. For example, \p{^Lu} is the same as
+ ified by a two-letter abbreviation. For compatibility with Perl, nega-
+ tion can be specified by including a circumflex between the opening
+ brace and the property name. For example, \p{^Lu} is the same as
\P{Lu}.
If only one letter is specified with \p or \P, it includes all the gen-
- eral category properties that start with that letter. In this case, in
- the absence of negation, the curly brackets in the escape sequence are
+ eral category properties that start with that letter. In this case, in
+ the absence of negation, the curly brackets in the escape sequence are
optional; these two examples have the same effect:
\p{L}
@@ -5430,73 +5431,73 @@ BACKSLASH
Zp Paragraph separator
Zs Space separator
- The special property L& is also supported: it matches a character that
- has the Lu, Ll, or Lt property, in other words, a letter that is not
+ The special property L& is also supported: it matches a character that
+ has the Lu, Ll, or Lt property, in other words, a letter that is not
classified as a modifier or "other".
- The Cs (Surrogate) property applies only to characters in the range
- U+D800 to U+DFFF. Such characters are not valid in Unicode strings and
- so cannot be tested by PCRE, unless UTF validity checking has been
+ The Cs (Surrogate) property applies only to characters in the range
+ U+D800 to U+DFFF. Such characters are not valid in Unicode strings and
+ so cannot be tested by PCRE, unless UTF validity checking has been
turned off (see the discussion of PCRE_NO_UTF8_CHECK,
- PCRE_NO_UTF16_CHECK and PCRE_NO_UTF32_CHECK in the pcreapi page). Perl
+ PCRE_NO_UTF16_CHECK and PCRE_NO_UTF32_CHECK in the pcreapi page). Perl
does not support the Cs property.
- The long synonyms for property names that Perl supports (such as
- \p{Letter}) are not supported by PCRE, nor is it permitted to prefix
+ The long synonyms for property names that Perl supports (such as
+ \p{Letter}) are not supported by PCRE, nor is it permitted to prefix
any of these properties with "Is".
No character that is in the Unicode table has the Cn (unassigned) prop-
erty. Instead, this property is assumed for any code point that is not
in the Unicode table.
- Specifying caseless matching does not affect these escape sequences.
- For example, \p{Lu} always matches only upper case letters. This is
+ Specifying caseless matching does not affect these escape sequences.
+ For example, \p{Lu} always matches only upper case letters. This is
different from the behaviour of current versions of Perl.
- Matching characters by Unicode property is not fast, because PCRE has
- to do a multistage table lookup in order to find a character's prop-
+ Matching characters by Unicode property is not fast, because PCRE has
+ to do a multistage table lookup in order to find a character's prop-
erty. That is why the traditional escape sequences such as \d and \w do
not use Unicode properties in PCRE by default, though you can make them
- do so by setting the PCRE_UCP option or by starting the pattern with
+ do so by setting the PCRE_UCP option or by starting the pattern with
(*UCP).
Extended grapheme clusters
- The \X escape matches any number of Unicode characters that form an
+ The \X escape matches any number of Unicode characters that form an
"extended grapheme cluster", and treats the sequence as an atomic group
- (see below). Up to and including release 8.31, PCRE matched an ear-
+ (see below). Up to and including release 8.31, PCRE matched an ear-
lier, simpler definition that was equivalent to
(?>\PM\pM*)
- That is, it matched a character without the "mark" property, followed
- by zero or more characters with the "mark" property. Characters with
- the "mark" property are typically non-spacing accents that affect the
+ That is, it matched a character without the "mark" property, followed
+ by zero or more characters with the "mark" property. Characters with
+ the "mark" property are typically non-spacing accents that affect the
preceding character.
- This simple definition was extended in Unicode to include more compli-
- cated kinds of composite character by giving each character a grapheme
- breaking property, and creating rules that use these properties to
- define the boundaries of extended grapheme clusters. In releases of
+ This simple definition was extended in Unicode to include more compli-
+ cated kinds of composite character by giving each character a grapheme
+ breaking property, and creating rules that use these properties to
+ define the boundaries of extended grapheme clusters. In releases of
PCRE later than 8.31, \X matches one of these clusters.
- \X always matches at least one character. Then it decides whether to
+ \X always matches at least one character. Then it decides whether to
add additional characters according to the following rules for ending a
cluster:
1. End at the end of the subject string.
- 2. Do not end between CR and LF; otherwise end after any control char-
+ 2. Do not end between CR and LF; otherwise end after any control char-
acter.
- 3. Do not break Hangul (a Korean script) syllable sequences. Hangul
- characters are of five types: L, V, T, LV, and LVT. An L character may
- be followed by an L, V, LV, or LVT character; an LV or V character may
+ 3. Do not break Hangul (a Korean script) syllable sequences. Hangul
+ characters are of five types: L, V, T, LV, and LVT. An L character may
+ be followed by an L, V, LV, or LVT character; an LV or V character may
be followed by a V or T character; an LVT or T character may be follwed
only by a T character.
- 4. Do not end before extending characters or spacing marks. Characters
- with the "mark" property always have the "extend" grapheme breaking
+ 4. Do not end before extending characters or spacing marks. Characters
+ with the "mark" property always have the "extend" grapheme breaking
property.
5. Do not end after prepend characters.
@@ -5505,9 +5506,9 @@ BACKSLASH
PCRE's additional properties
- As well as the standard Unicode properties described above, PCRE sup-
- ports four more that make it possible to convert traditional escape
- sequences such as \w and \s to use Unicode properties. PCRE uses these
+ As well as the standard Unicode properties described above, PCRE sup-
+ ports four more that make it possible to convert traditional escape
+ sequences such as \w and \s to use Unicode properties. PCRE uses these
non-standard, non-Perl properties internally when PCRE_UCP is set. How-
ever, they may also be used explicitly. These properties are:
@@ -5516,54 +5517,54 @@ BACKSLASH
Xsp Any Perl space character
Xwd Any Perl "word" character
- Xan matches characters that have either the L (letter) or the N (num-
- ber) property. Xps matches the characters tab, linefeed, vertical tab,
- form feed, or carriage return, and any other character that has the Z
- (separator) property. Xsp is the same as Xps; it used to exclude ver-
- tical tab, for Perl compatibility, but Perl changed, and so PCRE fol-
- lowed at release 8.34. Xwd matches the same characters as Xan, plus
+ Xan matches characters that have either the L (letter) or the N (num-
+ ber) property. Xps matches the characters tab, linefeed, vertical tab,
+ form feed, or carriage return, and any other character that has the Z
+ (separator) property. Xsp is the same as Xps; it used to exclude ver-
+ tical tab, for Perl compatibility, but Perl changed, and so PCRE fol-
+ lowed at release 8.34. Xwd matches the same characters as Xan, plus
underscore.
- There is another non-standard property, Xuc, which matches any charac-
- ter that can be represented by a Universal Character Name in C++ and
- other programming languages. These are the characters $, @, ` (grave
- accent), and all characters with Unicode code points greater than or
- equal to U+00A0, except for the surrogates U+D800 to U+DFFF. Note that
- most base (ASCII) characters are excluded. (Universal Character Names
- are of the form \uHHHH or \UHHHHHHHH where H is a hexadecimal digit.
+ There is another non-standard property, Xuc, which matches any charac-
+ ter that can be represented by a Universal Character Name in C++ and
+ other programming languages. These are the characters $, @, ` (grave
+ accent), and all characters with Unicode code points greater than or
+ equal to U+00A0, except for the surrogates U+D800 to U+DFFF. Note that
+ most base (ASCII) characters are excluded. (Universal Character Names
+ are of the form \uHHHH or \UHHHHHHHH where H is a hexadecimal digit.
Note that the Xuc property does not match these sequences but the char-
acters that they represent.)
Resetting the match start
- The escape sequence \K causes any previously matched characters not to
+ The escape sequence \K causes any previously matched characters not to
be included in the final matched sequence. For example, the pattern:
foo\Kbar
- matches "foobar", but reports that it has matched "bar". This feature
- is similar to a lookbehind assertion (described below). However, in
- this case, the part of the subject before the real match does not have
- to be of fixed length, as lookbehind assertions do. The use of \K does
- not interfere with the setting of captured substrings. For example,
+ matches "foobar", but reports that it has matched "bar". This feature
+ is similar to a lookbehind assertion (described below). However, in
+ this case, the part of the subject before the real match does not have
+ to be of fixed length, as lookbehind assertions do. The use of \K does
+ not interfere with the setting of captured substrings. For example,
when the pattern
(foo)\Kbar
matches "foobar", the first substring is still set to "foo".
- Perl documents that the use of \K within assertions is "not well
- defined". In PCRE, \K is acted upon when it occurs inside positive
- assertions, but is ignored in negative assertions. Note that when a
- pattern such as (?=ab\K) matches, the reported start of the match can
+ Perl documents that the use of \K within assertions is "not well
+ defined". In PCRE, \K is acted upon when it occurs inside positive
+ assertions, but is ignored in negative assertions. Note that when a
+ pattern such as (?=ab\K) matches, the reported start of the match can
be greater than the end of the match.
Simple assertions
- The final use of backslash is for certain simple assertions. An asser-
- tion specifies a condition that has to be met at a particular point in
- a match, without consuming any characters from the subject string. The
- use of subpatterns for more complicated assertions is described below.
+ The final use of backslash is for certain simple assertions. An asser-
+ tion specifies a condition that has to be met at a particular point in
+ a match, without consuming any characters from the subject string. The
+ use of subpatterns for more complicated assertions is described below.
The backslashed assertions are:
\b matches at a word boundary
@@ -5574,161 +5575,161 @@ BACKSLASH
\z matches only at the end of the subject
\G matches at the first matching position in the subject
- Inside a character class, \b has a different meaning; it matches the
- backspace character. If any other of these assertions appears in a
- character class, by default it matches the corresponding literal char-
+ Inside a character class, \b has a different meaning; it matches the
+ backspace character. If any other of these assertions appears in a
+ character class, by default it matches the corresponding literal char-
acter (for example, \B matches the letter B). However, if the
- PCRE_EXTRA option is set, an "invalid escape sequence" error is gener-
+ PCRE_EXTRA option is set, an "invalid escape sequence" error is gener-
ated instead.
- A word boundary is a position in the subject string where the current
- character and the previous character do not both match \w or \W (i.e.
- one matches \w and the other matches \W), or the start or end of the
- string if the first or last character matches \w, respectively. In a
- UTF mode, the meanings of \w and \W can be changed by setting the
- PCRE_UCP option. When this is done, it also affects \b and \B. Neither
- PCRE nor Perl has a separate "start of word" or "end of word" metase-
- quence. However, whatever follows \b normally determines which it is.
+ A word boundary is a position in the subject string where the current
+ character and the previous character do not both match \w or \W (i.e.
+ one matches \w and the other matches \W), or the start or end of the
+ string if the first or last character matches \w, respectively. In a
+ UTF mode, the meanings of \w and \W can be changed by setting the
+ PCRE_UCP option. When this is done, it also affects \b and \B. Neither
+ PCRE nor Perl has a separate "start of word" or "end of word" metase-
+ quence. However, whatever follows \b normally determines which it is.
For example, the fragment \ba matches "a" at the start of a word.
- The \A, \Z, and \z assertions differ from the traditional circumflex
+ The \A, \Z, and \z assertions differ from the traditional circumflex
and dollar (described in the next section) in that they only ever match
- at the very start and end of the subject string, whatever options are
- set. Thus, they are independent of multiline mode. These three asser-
+ at the very start and end of the subject string, whatever options are
+ set. Thus, they are independent of multiline mode. These three asser-
tions are not affected by the PCRE_NOTBOL or PCRE_NOTEOL options, which
- affect only the behaviour of the circumflex and dollar metacharacters.
- However, if the startoffset argument of pcre_exec() is non-zero, indi-
+ affect only the behaviour of the circumflex and dollar metacharacters.
+ However, if the startoffset argument of pcre_exec() is non-zero, indi-
cating that matching is to start at a point other than the beginning of
- the subject, \A can never match. The difference between \Z and \z is
+ the subject, \A can never match. The difference between \Z and \z is
that \Z matches before a newline at the end of the string as well as at
the very end, whereas \z matches only at the end.
- The \G assertion is true only when the current matching position is at
- the start point of the match, as specified by the startoffset argument
- of pcre_exec(). It differs from \A when the value of startoffset is
- non-zero. By calling pcre_exec() multiple times with appropriate argu-
+ The \G assertion is true only when the current matching position is at
+ the start point of the match, as specified by the startoffset argument
+ of pcre_exec(). It differs from \A when the value of startoffset is
+ non-zero. By calling pcre_exec() multiple times with appropriate argu-
ments, you can mimic Perl's /g option, and it is in this kind of imple-
mentation where \G can be useful.
- Note, however, that PCRE's interpretation of \G, as the start of the
+ Note, however, that PCRE's interpretation of \G, as the start of the
current match, is subtly different from Perl's, which defines it as the
- end of the previous match. In Perl, these can be different when the
- previously matched string was empty. Because PCRE does just one match
+ end of the previous match. In Perl, these can be different when the
+ previously matched string was empty. Because PCRE does just one match
at a time, it cannot reproduce this behaviour.
- If all the alternatives of a pattern begin with \G, the expression is
+ If all the alternatives of a pattern begin with \G, the expression is
anchored to the starting match position, and the "anchored" flag is set
in the compiled regular expression.
CIRCUMFLEX AND DOLLAR
- The circumflex and dollar metacharacters are zero-width assertions.
- That is, they test for a particular condition being true without con-
+ The circumflex and dollar metacharacters are zero-width assertions.
+ That is, they test for a particular condition being true without con-
suming any characters from the subject string.
Outside a character class, in the default matching mode, the circumflex
- character is an assertion that is true only if the current matching
- point is at the start of the subject string. If the startoffset argu-
- ment of pcre_exec() is non-zero, circumflex can never match if the
- PCRE_MULTILINE option is unset. Inside a character class, circumflex
+ character is an assertion that is true only if the current matching
+ point is at the start of the subject string. If the startoffset argu-
+ ment of pcre_exec() is non-zero, circumflex can never match if the
+ PCRE_MULTILINE option is unset. Inside a character class, circumflex
has an entirely different meaning (see below).
- Circumflex need not be the first character of the pattern if a number
- of alternatives are involved, but it should be the first thing in each
- alternative in which it appears if the pattern is ever to match that
- branch. If all possible alternatives start with a circumflex, that is,
- if the pattern is constrained to match only at the start of the sub-
- ject, it is said to be an "anchored" pattern. (There are also other
+ Circumflex need not be the first character of the pattern if a number
+ of alternatives are involved, but it should be the first thing in each
+ alternative in which it appears if the pattern is ever to match that
+ branch. If all possible alternatives start with a circumflex, that is,
+ if the pattern is constrained to match only at the start of the sub-
+ ject, it is said to be an "anchored" pattern. (There are also other
constructs that can cause a pattern to be anchored.)
- The dollar character is an assertion that is true only if the current
- matching point is at the end of the subject string, or immediately
- before a newline at the end of the string (by default). Note, however,
- that it does not actually match the newline. Dollar need not be the
+ The dollar character is an assertion that is true only if the current
+ matching point is at the end of the subject string, or immediately
+ before a newline at the end of the string (by default). Note, however,
+ that it does not actually match the newline. Dollar need not be the
last character of the pattern if a number of alternatives are involved,
- but it should be the last item in any branch in which it appears. Dol-
+ but it should be the last item in any branch in which it appears. Dol-
lar has no special meaning in a character class.
- The meaning of dollar can be changed so that it matches only at the
- very end of the string, by setting the PCRE_DOLLAR_ENDONLY option at
+ The meaning of dollar can be changed so that it matches only at the
+ very end of the string, by setting the PCRE_DOLLAR_ENDONLY option at
compile time. This does not affect the \Z assertion.
The meanings of the circumflex and dollar characters are changed if the
- PCRE_MULTILINE option is set. When this is the case, a circumflex
- matches immediately after internal newlines as well as at the start of
- the subject string. It does not match after a newline that ends the
- string. A dollar matches before any newlines in the string, as well as
- at the very end, when PCRE_MULTILINE is set. When newline is specified
- as the two-character sequence CRLF, isolated CR and LF characters do
+ PCRE_MULTILINE option is set. When this is the case, a circumflex
+ matches immediately after internal newlines as well as at the start of
+ the subject string. It does not match after a newline that ends the
+ string. A dollar matches before any newlines in the string, as well as
+ at the very end, when PCRE_MULTILINE is set. When newline is specified
+ as the two-character sequence CRLF, isolated CR and LF characters do
not indicate newlines.
- For example, the pattern /^abc$/ matches the subject string "def\nabc"
- (where \n represents a newline) in multiline mode, but not otherwise.
- Consequently, patterns that are anchored in single line mode because
- all branches start with ^ are not anchored in multiline mode, and a
- match for circumflex is possible when the startoffset argument of
- pcre_exec() is non-zero. The PCRE_DOLLAR_ENDONLY option is ignored if
+ For example, the pattern /^abc$/ matches the subject string "def\nabc"
+ (where \n represents a newline) in multiline mode, but not otherwise.
+ Consequently, patterns that are anchored in single line mode because
+ all branches start with ^ are not anchored in multiline mode, and a
+ match for circumflex is possible when the startoffset argument of
+ pcre_exec() is non-zero. The PCRE_DOLLAR_ENDONLY option is ignored if
PCRE_MULTILINE is set.
- Note that the sequences \A, \Z, and \z can be used to match the start
- and end of the subject in both modes, and if all branches of a pattern
- start with \A it is always anchored, whether or not PCRE_MULTILINE is
+ Note that the sequences \A, \Z, and \z can be used to match the start
+ and end of the subject in both modes, and if all branches of a pattern
+ start with \A it is always anchored, whether or not PCRE_MULTILINE is
set.
FULL STOP (PERIOD, DOT) AND \N
Outside a character class, a dot in the pattern matches any one charac-
- ter in the subject string except (by default) a character that signi-
+ ter in the subject string except (by default) a character that signi-
fies the end of a line.
- When a line ending is defined as a single character, dot never matches
- that character; when the two-character sequence CRLF is used, dot does
- not match CR if it is immediately followed by LF, but otherwise it
- matches all characters (including isolated CRs and LFs). When any Uni-
- code line endings are being recognized, dot does not match CR or LF or
+ When a line ending is defined as a single character, dot never matches
+ that character; when the two-character sequence CRLF is used, dot does
+ not match CR if it is immediately followed by LF, but otherwise it
+ matches all characters (including isolated CRs and LFs). When any Uni-
+ code line endings are being recognized, dot does not match CR or LF or
any of the other line ending characters.
- The behaviour of dot with regard to newlines can be changed. If the
- PCRE_DOTALL option is set, a dot matches any one character, without
+ The behaviour of dot with regard to newlines can be changed. If the
+ PCRE_DOTALL option is set, a dot matches any one character, without
exception. If the two-character sequence CRLF is present in the subject
string, it takes two dots to match it.
- The handling of dot is entirely independent of the handling of circum-
- flex and dollar, the only relationship being that they both involve
+ The handling of dot is entirely independent of the handling of circum-
+ flex and dollar, the only relationship being that they both involve
newlines. Dot has no special meaning in a character class.
- The escape sequence \N behaves like a dot, except that it is not
- affected by the PCRE_DOTALL option. In other words, it matches any
- character except one that signifies the end of a line. Perl also uses
+ The escape sequence \N behaves like a dot, except that it is not
+ affected by the PCRE_DOTALL option. In other words, it matches any
+ character except one that signifies the end of a line. Perl also uses
\N to match characters by name; PCRE does not support this.
MATCHING A SINGLE DATA UNIT
- Outside a character class, the escape sequence \C matches any one data
- unit, whether or not a UTF mode is set. In the 8-bit library, one data
- unit is one byte; in the 16-bit library it is a 16-bit unit; in the
- 32-bit library it is a 32-bit unit. Unlike a dot, \C always matches
- line-ending characters. The feature is provided in Perl in order to
+ Outside a character class, the escape sequence \C matches any one data
+ unit, whether or not a UTF mode is set. In the 8-bit library, one data
+ unit is one byte; in the 16-bit library it is a 16-bit unit; in the
+ 32-bit library it is a 32-bit unit. Unlike a dot, \C always matches
+ line-ending characters. The feature is provided in Perl in order to
match individual bytes in UTF-8 mode, but it is unclear how it can use-
- fully be used. Because \C breaks up characters into individual data
- units, matching one unit with \C in a UTF mode means that the rest of
+ fully be used. Because \C breaks up characters into individual data
+ units, matching one unit with \C in a UTF mode means that the rest of
the string may start with a malformed UTF character. This has undefined
results, because PCRE assumes that it is dealing with valid UTF strings
- (and by default it checks this at the start of processing unless the
- PCRE_NO_UTF8_CHECK, PCRE_NO_UTF16_CHECK or PCRE_NO_UTF32_CHECK option
+ (and by default it checks this at the start of processing unless the
+ PCRE_NO_UTF8_CHECK, PCRE_NO_UTF16_CHECK or PCRE_NO_UTF32_CHECK option
is used).
- PCRE does not allow \C to appear in lookbehind assertions (described
- below) in a UTF mode, because this would make it impossible to calcu-
+ PCRE does not allow \C to appear in lookbehind assertions (described
+ below) in a UTF mode, because this would make it impossible to calcu-
late the length of the lookbehind.
In general, the \C escape sequence is best avoided. However, one way of
- using it that avoids the problem of malformed UTF characters is to use
- a lookahead to check the length of the next character, as in this pat-
- tern, which could be used with a UTF-8 string (ignore white space and
+ using it that avoids the problem of malformed UTF characters is to use
+ a lookahead to check the length of the next character, as in this pat-
+ tern, which could be used with a UTF-8 string (ignore white space and
line breaks):
(?| (?=[\x00-\x7f])(\C) |
@@ -5736,11 +5737,11 @@ MATCHING A SINGLE DATA UNIT
(?=[\x{800}-\x{ffff}])(\C)(\C)(\C) |
(?=[\x{10000}-\x{1fffff}])(\C)(\C)(\C)(\C))
- A group that starts with (?| resets the capturing parentheses numbers
- in each alternative (see "Duplicate Subpattern Numbers" below). The
- assertions at the start of each branch check the next UTF-8 character
- for values whose encoding uses 1, 2, 3, or 4 bytes, respectively. The
- character's individual bytes are then captured by the appropriate num-
+ A group that starts with (?| resets the capturing parentheses numbers
+ in each alternative (see "Duplicate Subpattern Numbers" below). The
+ assertions at the start of each branch check the next UTF-8 character
+ for values whose encoding uses 1, 2, 3, or 4 bytes, respectively. The
+ character's individual bytes are then captured by the appropriate num-
ber of groups.
@@ -5750,109 +5751,109 @@ SQUARE BRACKETS AND CHARACTER CLASSES
closing square bracket. A closing square bracket on its own is not spe-
cial by default. However, if the PCRE_JAVASCRIPT_COMPAT option is set,
a lone closing square bracket causes a compile-time error. If a closing
- square bracket is required as a member of the class, it should be the
- first data character in the class (after an initial circumflex, if
+ square bracket is required as a member of the class, it should be the
+ first data character in the class (after an initial circumflex, if
present) or escaped with a backslash.
- A character class matches a single character in the subject. In a UTF
- mode, the character may be more than one data unit long. A matched
+ A character class matches a single character in the subject. In a UTF
+ mode, the character may be more than one data unit long. A matched
character must be in the set of characters defined by the class, unless
- the first character in the class definition is a circumflex, in which
+ the first character in the class definition is a circumflex, in which
case the subject character must not be in the set defined by the class.
- If a circumflex is actually required as a member of the class, ensure
+ If a circumflex is actually required as a member of the class, ensure
it is not the first character, or escape it with a backslash.
- For example, the character class [aeiou] matches any lower case vowel,
- while [^aeiou] matches any character that is not a lower case vowel.
+ For example, the character class [aeiou] matches any lower case vowel,
+ while [^aeiou] matches any character that is not a lower case vowel.
Note that a circumflex is just a convenient notation for specifying the
- characters that are in the class by enumerating those that are not. A
- class that starts with a circumflex is not an assertion; it still con-
- sumes a character from the subject string, and therefore it fails if
+ characters that are in the class by enumerating those that are not. A
+ class that starts with a circumflex is not an assertion; it still con-
+ sumes a character from the subject string, and therefore it fails if
the current pointer is at the end of the string.
In UTF-8 (UTF-16, UTF-32) mode, characters with values greater than 255
- (0xffff) can be included in a class as a literal string of data units,
+ (0xffff) can be included in a class as a literal string of data units,
or by using the \x{ escaping mechanism.
- When caseless matching is set, any letters in a class represent both
- their upper case and lower case versions, so for example, a caseless
- [aeiou] matches "A" as well as "a", and a caseless [^aeiou] does not
- match "A", whereas a caseful version would. In a UTF mode, PCRE always
- understands the concept of case for characters whose values are less
- than 128, so caseless matching is always possible. For characters with
- higher values, the concept of case is supported if PCRE is compiled
- with Unicode property support, but not otherwise. If you want to use
- caseless matching in a UTF mode for characters 128 and above, you must
- ensure that PCRE is compiled with Unicode property support as well as
+ When caseless matching is set, any letters in a class represent both
+ their upper case and lower case versions, so for example, a caseless
+ [aeiou] matches "A" as well as "a", and a caseless [^aeiou] does not
+ match "A", whereas a caseful version would. In a UTF mode, PCRE always
+ understands the concept of case for characters whose values are less
+ than 128, so caseless matching is always possible. For characters with
+ higher values, the concept of case is supported if PCRE is compiled
+ with Unicode property support, but not otherwise. If you want to use
+ caseless matching in a UTF mode for characters 128 and above, you must
+ ensure that PCRE is compiled with Unicode property support as well as
with UTF support.
- Characters that might indicate line breaks are never treated in any
- special way when matching character classes, whatever line-ending
- sequence is in use, and whatever setting of the PCRE_DOTALL and
+ Characters that might indicate line breaks are never treated in any
+ special way when matching character classes, whatever line-ending
+ sequence is in use, and whatever setting of the PCRE_DOTALL and
PCRE_MULTILINE options is used. A class such as [^a] always matches one
of these characters.
- The minus (hyphen) character can be used to specify a range of charac-
- ters in a character class. For example, [d-m] matches any letter
- between d and m, inclusive. If a minus character is required in a
- class, it must be escaped with a backslash or appear in a position
- where it cannot be interpreted as indicating a range, typically as the
+ The minus (hyphen) character can be used to specify a range of charac-
+ ters in a character class. For example, [d-m] matches any letter
+ between d and m, inclusive. If a minus character is required in a
+ class, it must be escaped with a backslash or appear in a position
+ where it cannot be interpreted as indicating a range, typically as the
first or last character in the class, or immediately after a range. For
- example, [b-d-z] matches letters in the range b to d, a hyphen charac-
+ example, [b-d-z] matches letters in the range b to d, a hyphen charac-
ter, or z.
It is not possible to have the literal character "]" as the end charac-
- ter of a range. A pattern such as [W-]46] is interpreted as a class of
- two characters ("W" and "-") followed by a literal string "46]", so it
- would match "W46]" or "-46]". However, if the "]" is escaped with a
- backslash it is interpreted as the end of range, so [W-\]46] is inter-
- preted as a class containing a range followed by two other characters.
- The octal or hexadecimal representation of "]" can also be used to end
+ ter of a range. A pattern such as [W-]46] is interpreted as a class of
+ two characters ("W" and "-") followed by a literal string "46]", so it
+ would match "W46]" or "-46]". However, if the "]" is escaped with a
+ backslash it is interpreted as the end of range, so [W-\]46] is inter-
+ preted as a class containing a range followed by two other characters.
+ The octal or hexadecimal representation of "]" can also be used to end
a range.
- An error is generated if a POSIX character class (see below) or an
- escape sequence other than one that defines a single character appears
- at a point where a range ending character is expected. For example,
+ An error is generated if a POSIX character class (see below) or an
+ escape sequence other than one that defines a single character appears
+ at a point where a range ending character is expected. For example,
[z-\xff] is valid, but [A-\d] and [A-[:digit:]] are not.
- Ranges operate in the collating sequence of character values. They can
- also be used for characters specified numerically, for example
- [\000-\037]. Ranges can include any characters that are valid for the
+ Ranges operate in the collating sequence of character values. They can
+ also be used for characters specified numerically, for example
+ [\000-\037]. Ranges can include any characters that are valid for the
current mode.
If a range that includes letters is used when caseless matching is set,
it matches the letters in either case. For example, [W-c] is equivalent
- to [][\\^_`wxyzabc], matched caselessly, and in a non-UTF mode, if
- character tables for a French locale are in use, [\xc8-\xcb] matches
- accented E characters in both cases. In UTF modes, PCRE supports the
- concept of case for characters with values greater than 128 only when
+ to [][\\^_`wxyzabc], matched caselessly, and in a non-UTF mode, if
+ character tables for a French locale are in use, [\xc8-\xcb] matches
+ accented E characters in both cases. In UTF modes, PCRE supports the
+ concept of case for characters with values greater than 128 only when
it is compiled with Unicode property support.
- The character escape sequences \d, \D, \h, \H, \p, \P, \s, \S, \v, \V,
+ The character escape sequences \d, \D, \h, \H, \p, \P, \s, \S, \v, \V,
\w, and \W may appear in a character class, and add the characters that
- they match to the class. For example, [\dABCDEF] matches any hexadeci-
- mal digit. In UTF modes, the PCRE_UCP option affects the meanings of
- \d, \s, \w and their upper case partners, just as it does when they
- appear outside a character class, as described in the section entitled
+ they match to the class. For example, [\dABCDEF] matches any hexadeci-
+ mal digit. In UTF modes, the PCRE_UCP option affects the meanings of
+ \d, \s, \w and their upper case partners, just as it does when they
+ appear outside a character class, as described in the section entitled
"Generic character types" above. The escape sequence \b has a different
- meaning inside a character class; it matches the backspace character.
- The sequences \B, \N, \R, and \X are not special inside a character
- class. Like any other unrecognized escape sequences, they are treated
- as the literal characters "B", "N", "R", and "X" by default, but cause
+ meaning inside a character class; it matches the backspace character.
+ The sequences \B, \N, \R, and \X are not special inside a character
+ class. Like any other unrecognized escape sequences, they are treated
+ as the literal characters "B", "N", "R", and "X" by default, but cause
an error if the PCRE_EXTRA option is set.
- A circumflex can conveniently be used with the upper case character
- types to specify a more restricted set of characters than the matching
- lower case type. For example, the class [^\W_] matches any letter or
+ A circumflex can conveniently be used with the upper case character
+ types to specify a more restricted set of characters than the matching
+ lower case type. For example, the class [^\W_] matches any letter or
digit, but not underscore, whereas [\w] includes underscore. A positive
character class should be read as "something OR something OR ..." and a
negative class as "NOT something AND NOT something AND NOT ...".
- The only metacharacters that are recognized in character classes are
- backslash, hyphen (only where it can be interpreted as specifying a
- range), circumflex (only at the start), opening square bracket (only
- when it can be interpreted as introducing a POSIX class name, or for a
- special compatibility feature - see the next two sections), and the
+ The only metacharacters that are recognized in character classes are
+ backslash, hyphen (only where it can be interpreted as specifying a
+ range), circumflex (only at the start), opening square bracket (only
+ when it can be interpreted as introducing a POSIX class name, or for a
+ special compatibility feature - see the next two sections), and the
terminating closing square bracket. However, escaping other non-
alphanumeric characters does no harm.
@@ -5860,7 +5861,7 @@ SQUARE BRACKETS AND CHARACTER CLASSES
POSIX CHARACTER CLASSES
Perl supports the POSIX notation for character classes. This uses names
- enclosed by [: and :] within the enclosing square brackets. PCRE also
+ enclosed by [: and :] within the enclosing square brackets. PCRE also
supports this notation. For example,
[01[:alpha:]%]
@@ -5883,28 +5884,28 @@ POSIX CHARACTER CLASSES
word "word" characters (same as \w)
xdigit hexadecimal digits
- The default "space" characters are HT (9), LF (10), VT (11), FF (12),
- CR (13), and space (32). If locale-specific matching is taking place,
- the list of space characters may be different; there may be fewer or
+ The default "space" characters are HT (9), LF (10), VT (11), FF (12),
+ CR (13), and space (32). If locale-specific matching is taking place,
+ the list of space characters may be different; there may be fewer or
more of them. "Space" used to be different to \s, which did not include
VT, for Perl compatibility. However, Perl changed at release 5.18, and
- PCRE followed at release 8.34. "Space" and \s now match the same set
+ PCRE followed at release 8.34. "Space" and \s now match the same set
of characters.
- The name "word" is a Perl extension, and "blank" is a GNU extension
- from Perl 5.8. Another Perl extension is negation, which is indicated
+ The name "word" is a Perl extension, and "blank" is a GNU extension
+ from Perl 5.8. Another Perl extension is negation, which is indicated
by a ^ character after the colon. For example,
[12[:^digit:]]
- matches "1", "2", or any non-digit. PCRE (and Perl) also recognize the
+ matches "1", "2", or any non-digit. PCRE (and Perl) also recognize the
POSIX syntax [.ch.] and [=ch=] where "ch" is a "collating element", but
these are not supported, and an error is given if they are encountered.
By default, characters with values greater than 128 do not match any of
- the POSIX character classes. However, if the PCRE_UCP option is passed
- to pcre_compile(), some of the classes are changed so that Unicode
- character properties are used. This is achieved by replacing certain
+ the POSIX character classes. However, if the PCRE_UCP option is passed
+ to pcre_compile(), some of the classes are changed so that Unicode
+ character properties are used. This is achieved by replacing certain
POSIX classes by other sequences, as follows:
[:alnum:] becomes \p{Xan}
@@ -5916,10 +5917,10 @@ POSIX CHARACTER CLASSES
[:upper:] becomes \p{Lu}
[:word:] becomes \p{Xwd}
- Negated versions, such as [:^alpha:] use \P instead of \p. Three other
+ Negated versions, such as [:^alpha:] use \P instead of \p. Three other
POSIX classes are handled specially in UCP mode:
- [:graph:] This matches characters that have glyphs that mark the page
+ [:graph:] This matches characters that have glyphs that mark the page
when printed. In Unicode property terms, it matches all char-
acters with the L, M, N, P, S, or Cf properties, except for:
@@ -5928,58 +5929,58 @@ POSIX CHARACTER CLASSES
U+2066 - U+2069 Various "isolate"s
- [:print:] This matches the same characters as [:graph:] plus space
- characters that are not controls, that is, characters with
+ [:print:] This matches the same characters as [:graph:] plus space
+ characters that are not controls, that is, characters with
the Zs property.
[:punct:] This matches all characters that have the Unicode P (punctua-
- tion) property, plus those characters whose code points are
+ tion) property, plus those characters whose code points are
less than 128 that have the S (Symbol) property.
- The other POSIX classes are unchanged, and match only characters with
+ The other POSIX classes are unchanged, and match only characters with
code points less than 128.
COMPATIBILITY FEATURE FOR WORD BOUNDARIES
- In the POSIX.2 compliant library that was included in 4.4BSD Unix, the
- ugly syntax [[:<:]] and [[:>:]] is used for matching "start of word"
+ In the POSIX.2 compliant library that was included in 4.4BSD Unix, the
+ ugly syntax [[:<:]] and [[:>:]] is used for matching "start of word"
and "end of word". PCRE treats these items as follows:
[[:<:]] is converted to \b(?=\w)
[[:>:]] is converted to \b(?<=\w)
Only these exact character sequences are recognized. A sequence such as
- [a[:<:]b] provokes error for an unrecognized POSIX class name. This
- support is not compatible with Perl. It is provided to help migrations
+ [a[:<:]b] provokes error for an unrecognized POSIX class name. This
+ support is not compatible with Perl. It is provided to help migrations
from other environments, and is best not used in any new patterns. Note
- that \b matches at the start and the end of a word (see "Simple asser-
- tions" above), and in a Perl-style pattern the preceding or following
- character normally shows which is wanted, without the need for the
- assertions that are used above in order to give exactly the POSIX be-
+ that \b matches at the start and the end of a word (see "Simple asser-
+ tions" above), and in a Perl-style pattern the preceding or following
+ character normally shows which is wanted, without the need for the
+ assertions that are used above in order to give exactly the POSIX be-
haviour.
VERTICAL BAR
- Vertical bar characters are used to separate alternative patterns. For
+ Vertical bar characters are used to separate alternative patterns. For
example, the pattern
gilbert|sullivan
- matches either "gilbert" or "sullivan". Any number of alternatives may
- appear, and an empty alternative is permitted (matching the empty
+ matches either "gilbert" or "sullivan". Any number of alternatives may
+ appear, and an empty alternative is permitted (matching the empty
string). The matching process tries each alternative in turn, from left
- to right, and the first one that succeeds is used. If the alternatives
- are within a subpattern (defined below), "succeeds" means matching the
+ to right, and the first one that succeeds is used. If the alternatives
+ are within a subpattern (defined below), "succeeds" means matching the
rest of the main pattern as well as the alternative in the subpattern.
INTERNAL OPTION SETTING
- The settings of the PCRE_CASELESS, PCRE_MULTILINE, PCRE_DOTALL, and
- PCRE_EXTENDED options (which are Perl-compatible) can be changed from
- within the pattern by a sequence of Perl option letters enclosed
+ The settings of the PCRE_CASELESS, PCRE_MULTILINE, PCRE_DOTALL, and
+ PCRE_EXTENDED options (which are Perl-compatible) can be changed from
+ within the pattern by a sequence of Perl option letters enclosed
between "(?" and ")". The option letters are
i for PCRE_CASELESS
@@ -5989,51 +5990,47 @@ INTERNAL OPTION SETTING
For example, (?im) sets caseless, multiline matching. It is also possi-
ble to unset these options by preceding the letter with a hyphen, and a
- combined setting and unsetting such as (?im-sx), which sets PCRE_CASE-
- LESS and PCRE_MULTILINE while unsetting PCRE_DOTALL and PCRE_EXTENDED,
- is also permitted. If a letter appears both before and after the
+ combined setting and unsetting such as (?im-sx), which sets PCRE_CASE-
+ LESS and PCRE_MULTILINE while unsetting PCRE_DOTALL and PCRE_EXTENDED,
+ is also permitted. If a letter appears both before and after the
hyphen, the option is unset.
- The PCRE-specific options PCRE_DUPNAMES, PCRE_UNGREEDY, and PCRE_EXTRA
- can be changed in the same way as the Perl-compatible options by using
+ The PCRE-specific options PCRE_DUPNAMES, PCRE_UNGREEDY, and PCRE_EXTRA
+ can be changed in the same way as the Perl-compatible options by using
the characters J, U and X respectively.
- When one of these option changes occurs at top level (that is, not
- inside subpattern parentheses), the change applies to the remainder of
- the pattern that follows. If the change is placed right at the start of
- a pattern, PCRE extracts it into the global options (and it will there-
- fore show up in data extracted by the pcre_fullinfo() function).
-
- An option change within a subpattern (see below for a description of
- subpatterns) affects only that part of the subpattern that follows it,
- so
+ When one of these option changes occurs at top level (that is, not
+ inside subpattern parentheses), the change applies to the remainder of
+ the pattern that follows. An option change within a subpattern (see
+ below for a description of subpatterns) affects only that part of the
+ subpattern that follows it, so
(a(?i)b)c
matches abc and aBc and no other strings (assuming PCRE_CASELESS is not
- used). By this means, options can be made to have different settings
- in different parts of the pattern. Any changes made in one alternative
- do carry on into subsequent branches within the same subpattern. For
+ used). By this means, options can be made to have different settings
+ in different parts of the pattern. Any changes made in one alternative
+ do carry on into subsequent branches within the same subpattern. For
example,
(a(?i)b|c)
- matches "ab", "aB", "c", and "C", even though when matching "C" the
- first branch is abandoned before the option setting. This is because
- the effects of option settings happen at compile time. There would be
+ matches "ab", "aB", "c", and "C", even though when matching "C" the
+ first branch is abandoned before the option setting. This is because
+ the effects of option settings happen at compile time. There would be
some very weird behaviour otherwise.
- Note: There are other PCRE-specific options that can be set by the
- application when the compiling or matching functions are called. In
- some cases the pattern can contain special leading sequences such as
- (*CRLF) to override what the application has set or what has been
- defaulted. Details are given in the section entitled "Newline
- sequences" above. There are also the (*UTF8), (*UTF16),(*UTF32), and
- (*UCP) leading sequences that can be used to set UTF and Unicode prop-
- erty modes; they are equivalent to setting the PCRE_UTF8, PCRE_UTF16,
- PCRE_UTF32 and the PCRE_UCP options, respectively. The (*UTF) sequence
- is a generic version that can be used with any of the libraries. How-
- ever, the application can set the PCRE_NEVER_UTF option, which locks
+ Note: There are other PCRE-specific options that can be set by the
+ application when the compiling or matching functions are called. In
+ some cases the pattern can contain special leading sequences such as
+ (*CRLF) to override what the application has set or what has been
+ defaulted. Details are given in the section entitled "Newline
+ sequences" above. There are also the (*UTF8), (*UTF16),(*UTF32), and
+ (*UCP) leading sequences that can be used to set UTF and Unicode prop-
+ erty modes; they are equivalent to setting the PCRE_UTF8, PCRE_UTF16,
+ PCRE_UTF32 and the PCRE_UCP options, respectively. The (*UTF) sequence
+ is a generic version that can be used with any of the libraries. How-
+ ever, the application can set the PCRE_NEVER_UTF option, which locks
out the use of the (*UTF) sequences.
@@ -6046,18 +6043,18 @@ SUBPATTERNS
cat(aract|erpillar|)
- matches "cataract", "caterpillar", or "cat". Without the parentheses,
+ matches "cataract", "caterpillar", or "cat". Without the parentheses,
it would match "cataract", "erpillar" or an empty string.
- 2. It sets up the subpattern as a capturing subpattern. This means
- that, when the whole pattern matches, that portion of the subject
+ 2. It sets up the subpattern as a capturing subpattern. This means
+ that, when the whole pattern matches, that portion of the subject
string that matched the subpattern is passed back to the caller via the
- ovector argument of the matching function. (This applies only to the
- traditional matching functions; the DFA matching functions do not sup-
+ ovector argument of the matching function. (This applies only to the
+ traditional matching functions; the DFA matching functions do not sup-
port capturing.)
Opening parentheses are counted from left to right (starting from 1) to
- obtain numbers for the capturing subpatterns. For example, if the
+ obtain numbers for the capturing subpatterns. For example, if the
string "the red king" is matched against the pattern
the ((red|white) (king|queen))
@@ -6065,12 +6062,12 @@ SUBPATTERNS
the captured substrings are "red king", "red", and "king", and are num-
bered 1, 2, and 3, respectively.
- The fact that plain parentheses fulfil two functions is not always
- helpful. There are often times when a grouping subpattern is required
- without a capturing requirement. If an opening parenthesis is followed
- by a question mark and a colon, the subpattern does not do any captur-
- ing, and is not counted when computing the number of any subsequent
- capturing subpatterns. For example, if the string "the white queen" is
+ The fact that plain parentheses fulfil two functions is not always
+ helpful. There are often times when a grouping subpattern is required
+ without a capturing requirement. If an opening parenthesis is followed
+ by a question mark and a colon, the subpattern does not do any captur-
+ ing, and is not counted when computing the number of any subsequent
+ capturing subpatterns. For example, if the string "the white queen" is
matched against the pattern
the ((?:red|white) (king|queen))
@@ -6078,37 +6075,37 @@ SUBPATTERNS
the captured substrings are "white queen" and "queen", and are numbered
1 and 2. The maximum number of capturing subpatterns is 65535.
- As a convenient shorthand, if any option settings are required at the
- start of a non-capturing subpattern, the option letters may appear
+ As a convenient shorthand, if any option settings are required at the
+ start of a non-capturing subpattern, the option letters may appear
between the "?" and the ":". Thus the two patterns
(?i:saturday|sunday)
(?:(?i)saturday|sunday)
match exactly the same set of strings. Because alternative branches are
- tried from left to right, and options are not reset until the end of
- the subpattern is reached, an option setting in one branch does affect
- subsequent branches, so the above patterns match "SUNDAY" as well as
+ tried from left to right, and options are not reset until the end of
+ the subpattern is reached, an option setting in one branch does affect
+ subsequent branches, so the above patterns match "SUNDAY" as well as
"Saturday".
DUPLICATE SUBPATTERN NUMBERS
Perl 5.10 introduced a feature whereby each alternative in a subpattern
- uses the same numbers for its capturing parentheses. Such a subpattern
- starts with (?| and is itself a non-capturing subpattern. For example,
+ uses the same numbers for its capturing parentheses. Such a subpattern
+ starts with (?| and is itself a non-capturing subpattern. For example,
consider this pattern:
(?|(Sat)ur|(Sun))day
- Because the two alternatives are inside a (?| group, both sets of cap-
- turing parentheses are numbered one. Thus, when the pattern matches,
- you can look at captured substring number one, whichever alternative
- matched. This construct is useful when you want to capture part, but
+ Because the two alternatives are inside a (?| group, both sets of cap-
+ turing parentheses are numbered one. Thus, when the pattern matches,
+ you can look at captured substring number one, whichever alternative
+ matched. This construct is useful when you want to capture part, but
not all, of one of a number of alternatives. Inside a (?| group, paren-
- theses are numbered as usual, but the number is reset at the start of
- each branch. The numbers of any capturing parentheses that follow the
- subpattern start after the highest number used in any branch. The fol-
+ theses are numbered as usual, but the number is reset at the start of
+ each branch. The numbers of any capturing parentheses that follow the
+ subpattern start after the highest number used in any branch. The fol-
lowing example is taken from the Perl documentation. The numbers under-
neath show in which buffer the captured content will be stored.
@@ -6116,58 +6113,58 @@ DUPLICATE SUBPATTERN NUMBERS
/ ( a ) (?| x ( y ) z | (p (q) r) | (t) u (v) ) ( z ) /x
# 1 2 2 3 2 3 4
- A back reference to a numbered subpattern uses the most recent value
- that is set for that number by any subpattern. The following pattern
+ A back reference to a numbered subpattern uses the most recent value
+ that is set for that number by any subpattern. The following pattern
matches "abcabc" or "defdef":
/(?|(abc)|(def))\1/
- In contrast, a subroutine call to a numbered subpattern always refers
- to the first one in the pattern with the given number. The following
+ In contrast, a subroutine call to a numbered subpattern always refers
+ to the first one in the pattern with the given number. The following
pattern matches "abcabc" or "defabc":
/(?|(abc)|(def))(?1)/
- If a condition test for a subpattern's having matched refers to a non-
- unique number, the test is true if any of the subpatterns of that num-
+ If a condition test for a subpattern's having matched refers to a non-
+ unique number, the test is true if any of the subpatterns of that num-
ber have matched.
- An alternative approach to using this "branch reset" feature is to use
+ An alternative approach to using this "branch reset" feature is to use
duplicate named subpatterns, as described in the next section.
NAMED SUBPATTERNS
- Identifying capturing parentheses by number is simple, but it can be
- very hard to keep track of the numbers in complicated regular expres-
- sions. Furthermore, if an expression is modified, the numbers may
- change. To help with this difficulty, PCRE supports the naming of sub-
+ Identifying capturing parentheses by number is simple, but it can be
+ very hard to keep track of the numbers in complicated regular expres-
+ sions. Furthermore, if an expression is modified, the numbers may
+ change. To help with this difficulty, PCRE supports the naming of sub-
patterns. This feature was not added to Perl until release 5.10. Python
- had the feature earlier, and PCRE introduced it at release 4.0, using
- the Python syntax. PCRE now supports both the Perl and the Python syn-
- tax. Perl allows identically numbered subpatterns to have different
+ had the feature earlier, and PCRE introduced it at release 4.0, using
+ the Python syntax. PCRE now supports both the Perl and the Python syn-
+ tax. Perl allows identically numbered subpatterns to have different
names, but PCRE does not.
- In PCRE, a subpattern can be named in one of three ways: (?<name>...)
- or (?'name'...) as in Perl, or (?P<name>...) as in Python. References
- to capturing parentheses from other parts of the pattern, such as back
- references, recursion, and conditions, can be made by name as well as
+ In PCRE, a subpattern can be named in one of three ways: (?<name>...)
+ or (?'name'...) as in Perl, or (?P<name>...) as in Python. References
+ to capturing parentheses from other parts of the pattern, such as back
+ references, recursion, and conditions, can be made by name as well as
by number.
- Names consist of up to 32 alphanumeric characters and underscores, but
- must start with a non-digit. Named capturing parentheses are still
- allocated numbers as well as names, exactly as if the names were not
- present. The PCRE API provides function calls for extracting the name-
- to-number translation table from a compiled pattern. There is also a
+ Names consist of up to 32 alphanumeric characters and underscores, but
+ must start with a non-digit. Named capturing parentheses are still
+ allocated numbers as well as names, exactly as if the names were not
+ present. The PCRE API provides function calls for extracting the name-
+ to-number translation table from a compiled pattern. There is also a
convenience function for extracting a captured substring by name.
- By default, a name must be unique within a pattern, but it is possible
+ By default, a name must be unique within a pattern, but it is possible
to relax this constraint by setting the PCRE_DUPNAMES option at compile
- time. (Duplicate names are also always permitted for subpatterns with
- the same number, set up as described in the previous section.) Dupli-
- cate names can be useful for patterns where only one instance of the
- named parentheses can match. Suppose you want to match the name of a
- weekday, either as a 3-letter abbreviation or as the full name, and in
+ time. (Duplicate names are also always permitted for subpatterns with
+ the same number, set up as described in the previous section.) Dupli-
+ cate names can be useful for patterns where only one instance of the
+ named parentheses can match. Suppose you want to match the name of a
+ weekday, either as a 3-letter abbreviation or as the full name, and in
both cases you want to extract the abbreviation. This pattern (ignoring
the line breaks) does the job:
@@ -6177,18 +6174,18 @@ NAMED SUBPATTERNS
(?<DN>Thu)(?:rsday)?|
(?<DN>Sat)(?:urday)?
- There are five capturing substrings, but only one is ever set after a
+ There are five capturing substrings, but only one is ever set after a
match. (An alternative way of solving this problem is to use a "branch
reset" subpattern, as described in the previous section.)
- The convenience function for extracting the data by name returns the
- substring for the first (and in this example, the only) subpattern of
- that name that matched. This saves searching to find which numbered
+ The convenience function for extracting the data by name returns the
+ substring for the first (and in this example, the only) subpattern of
+ that name that matched. This saves searching to find which numbered
subpattern it was.
- If you make a back reference to a non-unique named subpattern from
- elsewhere in the pattern, the subpatterns to which the name refers are
- checked in the order in which they appear in the overall pattern. The
+ If you make a back reference to a non-unique named subpattern from
+ elsewhere in the pattern, the subpatterns to which the name refers are
+ checked in the order in which they appear in the overall pattern. The
first one that is set is used for the reference. For example, this pat-
tern matches both "foofoo" and "barbar" but not "foobar" or "barfoo":
@@ -6196,29 +6193,29 @@ NAMED SUBPATTERNS
If you make a subroutine call to a non-unique named subpattern, the one
- that corresponds to the first occurrence of the name is used. In the
+ that corresponds to the first occurrence of the name is used. In the
absence of duplicate numbers (see the previous section) this is the one
with the lowest number.
If you use a named reference in a condition test (see the section about
conditions below), either to check whether a subpattern has matched, or
- to check for recursion, all subpatterns with the same name are tested.
- If the condition is true for any one of them, the overall condition is
- true. This is the same behaviour as testing by number. For further
- details of the interfaces for handling named subpatterns, see the
+ to check for recursion, all subpatterns with the same name are tested.
+ If the condition is true for any one of them, the overall condition is
+ true. This is the same behaviour as testing by number. For further
+ details of the interfaces for handling named subpatterns, see the
pcreapi documentation.
Warning: You cannot use different names to distinguish between two sub-
- patterns with the same number because PCRE uses only the numbers when
+ patterns with the same number because PCRE uses only the numbers when
matching. For this reason, an error is given at compile time if differ-
- ent names are given to subpatterns with the same number. However, you
+ ent names are given to subpatterns with the same number. However, you
can always give the same name to subpatterns with the same number, even
when PCRE_DUPNAMES is not set.
REPETITION
- Repetition is specified by quantifiers, which can follow any of the
+ Repetition is specified by quantifiers, which can follow any of the
following items:
a literal data character
@@ -6232,17 +6229,17 @@ REPETITION
a parenthesized subpattern (including assertions)
a subroutine call to a subpattern (recursive or otherwise)
- The general repetition quantifier specifies a minimum and maximum num-
- ber of permitted matches, by giving the two numbers in curly brackets
- (braces), separated by a comma. The numbers must be less than 65536,
+ The general repetition quantifier specifies a minimum and maximum num-
+ ber of permitted matches, by giving the two numbers in curly brackets
+ (braces), separated by a comma. The numbers must be less than 65536,
and the first must be less than or equal to the second. For example:
z{2,4}
- matches "zz", "zzz", or "zzzz". A closing brace on its own is not a
- special character. If the second number is omitted, but the comma is
- present, there is no upper limit; if the second number and the comma
- are both omitted, the quantifier specifies an exact number of required
+ matches "zz", "zzz", or "zzzz". A closing brace on its own is not a
+ special character. If the second number is omitted, but the comma is
+ present, there is no upper limit; if the second number and the comma
+ are both omitted, the quantifier specifies an exact number of required
matches. Thus
[aeiou]{3,}
@@ -6251,50 +6248,50 @@ REPETITION
\d{8}
- matches exactly 8 digits. An opening curly bracket that appears in a
- position where a quantifier is not allowed, or one that does not match
- the syntax of a quantifier, is taken as a literal character. For exam-
+ matches exactly 8 digits. An opening curly bracket that appears in a
+ position where a quantifier is not allowed, or one that does not match
+ the syntax of a quantifier, is taken as a literal character. For exam-
ple, {,6} is not a quantifier, but a literal string of four characters.
In UTF modes, quantifiers apply to characters rather than to individual
- data units. Thus, for example, \x{100}{2} matches two characters, each
+ data units. Thus, for example, \x{100}{2} matches two characters, each
of which is represented by a two-byte sequence in a UTF-8 string. Simi-
- larly, \X{3} matches three Unicode extended grapheme clusters, each of
- which may be several data units long (and they may be of different
+ larly, \X{3} matches three Unicode extended grapheme clusters, each of
+ which may be several data units long (and they may be of different
lengths).
The quantifier {0} is permitted, causing the expression to behave as if
the previous item and the quantifier were not present. This may be use-
- ful for subpatterns that are referenced as subroutines from elsewhere
+ ful for subpatterns that are referenced as subroutines from elsewhere
in the pattern (but see also the section entitled "Defining subpatterns
- for use by reference only" below). Items other than subpatterns that
+ for use by reference only" below). Items other than subpatterns that
have a {0} quantifier are omitted from the compiled pattern.
- For convenience, the three most common quantifiers have single-charac-
+ For convenience, the three most common quantifiers have single-charac-
ter abbreviations:
* is equivalent to {0,}
+ is equivalent to {1,}
? is equivalent to {0,1}
- It is possible to construct infinite loops by following a subpattern
+ It is possible to construct infinite loops by following a subpattern
that can match no characters with a quantifier that has no upper limit,
for example:
(a?)*
Earlier versions of Perl and PCRE used to give an error at compile time
- for such patterns. However, because there are cases where this can be
- useful, such patterns are now accepted, but if any repetition of the
- subpattern does in fact match no characters, the loop is forcibly bro-
+ for such patterns. However, because there are cases where this can be
+ useful, such patterns are now accepted, but if any repetition of the
+ subpattern does in fact match no characters, the loop is forcibly bro-
ken.
- By default, the quantifiers are "greedy", that is, they match as much
- as possible (up to the maximum number of permitted times), without
- causing the rest of the pattern to fail. The classic example of where
+ By default, the quantifiers are "greedy", that is, they match as much
+ as possible (up to the maximum number of permitted times), without
+ causing the rest of the pattern to fail. The classic example of where
this gives problems is in trying to match comments in C programs. These
- appear between /* and */ and within the comment, individual * and /
- characters may appear. An attempt to match C comments by applying the
+ appear between /* and */ and within the comment, individual * and /
+ characters may appear. An attempt to match C comments by applying the
pattern
/\*.*\*/
@@ -6303,19 +6300,19 @@ REPETITION
/* first comment */ not comment /* second comment */
- fails, because it matches the entire string owing to the greediness of
+ fails, because it matches the entire string owing to the greediness of
the .* item.
- However, if a quantifier is followed by a question mark, it ceases to
+ However, if a quantifier is followed by a question mark, it ceases to
be greedy, and instead matches the minimum number of times possible, so
the pattern
/\*.*?\*/
- does the right thing with the C comments. The meaning of the various
- quantifiers is not otherwise changed, just the preferred number of
- matches. Do not confuse this use of question mark with its use as a
- quantifier in its own right. Because it has two uses, it can sometimes
+ does the right thing with the C comments. The meaning of the various
+ quantifiers is not otherwise changed, just the preferred number of
+ matches. Do not confuse this use of question mark with its use as a
+ quantifier in its own right. Because it has two uses, it can sometimes
appear doubled, as in
\d??\d
@@ -6323,45 +6320,45 @@ REPETITION
which matches one digit by preference, but can match two if that is the
only way the rest of the pattern matches.
- If the PCRE_UNGREEDY option is set (an option that is not available in
- Perl), the quantifiers are not greedy by default, but individual ones
- can be made greedy by following them with a question mark. In other
+ If the PCRE_UNGREEDY option is set (an option that is not available in
+ Perl), the quantifiers are not greedy by default, but individual ones
+ can be made greedy by following them with a question mark. In other
words, it inverts the default behaviour.
- When a parenthesized subpattern is quantified with a minimum repeat
- count that is greater than 1 or with a limited maximum, more memory is
- required for the compiled pattern, in proportion to the size of the
+ When a parenthesized subpattern is quantified with a minimum repeat
+ count that is greater than 1 or with a limited maximum, more memory is
+ required for the compiled pattern, in proportion to the size of the
minimum or maximum.
If a pattern starts with .* or .{0,} and the PCRE_DOTALL option (equiv-
- alent to Perl's /s) is set, thus allowing the dot to match newlines,
- the pattern is implicitly anchored, because whatever follows will be
- tried against every character position in the subject string, so there
- is no point in retrying the overall match at any position after the
- first. PCRE normally treats such a pattern as though it were preceded
+ alent to Perl's /s) is set, thus allowing the dot to match newlines,
+ the pattern is implicitly anchored, because whatever follows will be
+ tried against every character position in the subject string, so there
+ is no point in retrying the overall match at any position after the
+ first. PCRE normally treats such a pattern as though it were preceded
by \A.
- In cases where it is known that the subject string contains no new-
- lines, it is worth setting PCRE_DOTALL in order to obtain this opti-
+ In cases where it is known that the subject string contains no new-
+ lines, it is worth setting PCRE_DOTALL in order to obtain this opti-
mization, or alternatively using ^ to indicate anchoring explicitly.
- However, there are some cases where the optimization cannot be used.
+ However, there are some cases where the optimization cannot be used.
When .* is inside capturing parentheses that are the subject of a back
reference elsewhere in the pattern, a match at the start may fail where
a later one succeeds. Consider, for example:
(.*)abc\1
- If the subject is "xyz123abc123" the match point is the fourth charac-
+ If the subject is "xyz123abc123" the match point is the fourth charac-
ter. For this reason, such a pattern is not implicitly anchored.
- Another case where implicit anchoring is not applied is when the lead-
- ing .* is inside an atomic group. Once again, a match at the start may
+ Another case where implicit anchoring is not applied is when the lead-
+ ing .* is inside an atomic group. Once again, a match at the start may
fail where a later one succeeds. Consider this pattern:
(?>.*?a)b
- It matches "ab" in the subject "aab". The use of the backtracking con-
+ It matches "ab" in the subject "aab". The use of the backtracking con-
trol verbs (*PRUNE) and (*SKIP) also disable this optimization.
When a capturing subpattern is repeated, the value captured is the sub-
@@ -6370,8 +6367,8 @@ REPETITION
(tweedle[dume]{3}\s*)+
has matched "tweedledum tweedledee" the value of the captured substring
- is "tweedledee". However, if there are nested capturing subpatterns,
- the corresponding captured values may have been set in previous itera-
+ is "tweedledee". However, if there are nested capturing subpatterns,
+ the corresponding captured values may have been set in previous itera-
tions. For example, after
/(a|(b))+/
@@ -6381,53 +6378,53 @@ REPETITION
ATOMIC GROUPING AND POSSESSIVE QUANTIFIERS
- With both maximizing ("greedy") and minimizing ("ungreedy" or "lazy")
- repetition, failure of what follows normally causes the repeated item
- to be re-evaluated to see if a different number of repeats allows the
- rest of the pattern to match. Sometimes it is useful to prevent this,
- either to change the nature of the match, or to cause it fail earlier
- than it otherwise might, when the author of the pattern knows there is
+ With both maximizing ("greedy") and minimizing ("ungreedy" or "lazy")
+ repetition, failure of what follows normally causes the repeated item
+ to be re-evaluated to see if a different number of repeats allows the
+ rest of the pattern to match. Sometimes it is useful to prevent this,
+ either to change the nature of the match, or to cause it fail earlier
+ than it otherwise might, when the author of the pattern knows there is
no point in carrying on.
- Consider, for example, the pattern \d+foo when applied to the subject
+ Consider, for example, the pattern \d+foo when applied to the subject
line
123456bar
After matching all 6 digits and then failing to match "foo", the normal
- action of the matcher is to try again with only 5 digits matching the
- \d+ item, and then with 4, and so on, before ultimately failing.
- "Atomic grouping" (a term taken from Jeffrey Friedl's book) provides
- the means for specifying that once a subpattern has matched, it is not
+ action of the matcher is to try again with only 5 digits matching the
+ \d+ item, and then with 4, and so on, before ultimately failing.
+ "Atomic grouping" (a term taken from Jeffrey Friedl's book) provides
+ the means for specifying that once a subpattern has matched, it is not
to be re-evaluated in this way.
- If we use atomic grouping for the previous example, the matcher gives
- up immediately on failing to match "foo" the first time. The notation
+ If we use atomic grouping for the previous example, the matcher gives
+ up immediately on failing to match "foo" the first time. The notation
is a kind of special parenthesis, starting with (?> as in this example:
(?>\d+)foo
- This kind of parenthesis "locks up" the part of the pattern it con-
- tains once it has matched, and a failure further into the pattern is
- prevented from backtracking into it. Backtracking past it to previous
+ This kind of parenthesis "locks up" the part of the pattern it con-
+ tains once it has matched, and a failure further into the pattern is
+ prevented from backtracking into it. Backtracking past it to previous
items, however, works as normal.
- An alternative description is that a subpattern of this type matches
- the string of characters that an identical standalone pattern would
+ An alternative description is that a subpattern of this type matches
+ the string of characters that an identical standalone pattern would
match, if anchored at the current point in the subject string.
Atomic grouping subpatterns are not capturing subpatterns. Simple cases
such as the above example can be thought of as a maximizing repeat that
- must swallow everything it can. So, while both \d+ and \d+? are pre-
- pared to adjust the number of digits they match in order to make the
+ must swallow everything it can. So, while both \d+ and \d+? are pre-
+ pared to adjust the number of digits they match in order to make the
rest of the pattern match, (?>\d+) can only match an entire sequence of
digits.
- Atomic groups in general can of course contain arbitrarily complicated
- subpatterns, and can be nested. However, when the subpattern for an
+ Atomic groups in general can of course contain arbitrarily complicated
+ subpatterns, and can be nested. However, when the subpattern for an
atomic group is just a single repeated item, as in the example above, a
- simpler notation, called a "possessive quantifier" can be used. This
- consists of an additional + character following a quantifier. Using
+ simpler notation, called a "possessive quantifier" can be used. This
+ consists of an additional + character following a quantifier. Using
this notation, the previous example can be rewritten as
\d++foo
@@ -6437,45 +6434,45 @@ ATOMIC GROUPING AND POSSESSIVE QUANTIFIERS
(abc|xyz){2,3}+
- Possessive quantifiers are always greedy; the setting of the
+ Possessive quantifiers are always greedy; the setting of the
PCRE_UNGREEDY option is ignored. They are a convenient notation for the
- simpler forms of atomic group. However, there is no difference in the
- meaning of a possessive quantifier and the equivalent atomic group,
- though there may be a performance difference; possessive quantifiers
+ simpler forms of atomic group. However, there is no difference in the
+ meaning of a possessive quantifier and the equivalent atomic group,
+ though there may be a performance difference; possessive quantifiers
should be slightly faster.
- The possessive quantifier syntax is an extension to the Perl 5.8 syn-
- tax. Jeffrey Friedl originated the idea (and the name) in the first
+ The possessive quantifier syntax is an extension to the Perl 5.8 syn-
+ tax. Jeffrey Friedl originated the idea (and the name) in the first
edition of his book. Mike McCloskey liked it, so implemented it when he
- built Sun's Java package, and PCRE copied it from there. It ultimately
+ built Sun's Java package, and PCRE copied it from there. It ultimately
found its way into Perl at release 5.10.
PCRE has an optimization that automatically "possessifies" certain sim-
- ple pattern constructs. For example, the sequence A+B is treated as
- A++B because there is no point in backtracking into a sequence of A's
+ ple pattern constructs. For example, the sequence A+B is treated as
+ A++B because there is no point in backtracking into a sequence of A's
when B must follow.
- When a pattern contains an unlimited repeat inside a subpattern that
- can itself be repeated an unlimited number of times, the use of an
- atomic group is the only way to avoid some failing matches taking a
+ When a pattern contains an unlimited repeat inside a subpattern that
+ can itself be repeated an unlimited number of times, the use of an
+ atomic group is the only way to avoid some failing matches taking a
very long time indeed. The pattern
(\D+|<\d+>)*[!?]
- matches an unlimited number of substrings that either consist of non-
- digits, or digits enclosed in <>, followed by either ! or ?. When it
+ matches an unlimited number of substrings that either consist of non-
+ digits, or digits enclosed in <>, followed by either ! or ?. When it
matches, it runs quickly. However, if it is applied to
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
- it takes a long time before reporting failure. This is because the
- string can be divided between the internal \D+ repeat and the external
- * repeat in a large number of ways, and all have to be tried. (The
- example uses [!?] rather than a single character at the end, because
- both PCRE and Perl have an optimization that allows for fast failure
- when a single character is used. They remember the last single charac-
- ter that is required for a match, and fail early if it is not present
- in the string.) If the pattern is changed so that it uses an atomic
+ it takes a long time before reporting failure. This is because the
+ string can be divided between the internal \D+ repeat and the external
+ * repeat in a large number of ways, and all have to be tried. (The
+ example uses [!?] rather than a single character at the end, because
+ both PCRE and Perl have an optimization that allows for fast failure
+ when a single character is used. They remember the last single charac-
+ ter that is required for a match, and fail early if it is not present
+ in the string.) If the pattern is changed so that it uses an atomic
group, like this:
((?>\D+)|<\d+>)*[!?]
@@ -6487,28 +6484,28 @@ BACK REFERENCES
Outside a character class, a backslash followed by a digit greater than
0 (and possibly further digits) is a back reference to a capturing sub-
- pattern earlier (that is, to its left) in the pattern, provided there
+ pattern earlier (that is, to its left) in the pattern, provided there
have been that many previous capturing left parentheses.
However, if the decimal number following the backslash is less than 10,
- it is always taken as a back reference, and causes an error only if
- there are not that many capturing left parentheses in the entire pat-
- tern. In other words, the parentheses that are referenced need not be
- to the left of the reference for numbers less than 10. A "forward back
- reference" of this type can make sense when a repetition is involved
- and the subpattern to the right has participated in an earlier itera-
+ it is always taken as a back reference, and causes an error only if
+ there are not that many capturing left parentheses in the entire pat-
+ tern. In other words, the parentheses that are referenced need not be
+ to the left of the reference for numbers less than 10. A "forward back
+ reference" of this type can make sense when a repetition is involved
+ and the subpattern to the right has participated in an earlier itera-
tion.
- It is not possible to have a numerical "forward back reference" to a
- subpattern whose number is 10 or more using this syntax because a
- sequence such as \50 is interpreted as a character defined in octal.
+ It is not possible to have a numerical "forward back reference" to a
+ subpattern whose number is 10 or more using this syntax because a
+ sequence such as \50 is interpreted as a character defined in octal.
See the subsection entitled "Non-printing characters" above for further
- details of the handling of digits following a backslash. There is no
- such problem when named parentheses are used. A back reference to any
+ details of the handling of digits following a backslash. There is no
+ such problem when named parentheses are used. A back reference to any
subpattern is possible using named parentheses (see below).
- Another way of avoiding the ambiguity inherent in the use of digits
- following a backslash is to use the \g escape sequence. This escape
+ Another way of avoiding the ambiguity inherent in the use of digits
+ following a backslash is to use the \g escape sequence. This escape
must be followed by an unsigned number or a negative number, optionally
enclosed in braces. These examples are all identical:
@@ -6516,7 +6513,7 @@ BACK REFERENCES
(ring), \g1
(ring), \g{1}
- An unsigned number specifies an absolute reference without the ambigu-
+ An unsigned number specifies an absolute reference without the ambigu-
ity that is present in the older syntax. It is also useful when literal
digits follow the reference. A negative number is a relative reference.
Consider this example:
@@ -6525,33 +6522,33 @@ BACK REFERENCES
The sequence \g{-1} is a reference to the most recently started captur-
ing subpattern before \g, that is, is it equivalent to \2 in this exam-
- ple. Similarly, \g{-2} would be equivalent to \1. The use of relative
- references can be helpful in long patterns, and also in patterns that
- are created by joining together fragments that contain references
+ ple. Similarly, \g{-2} would be equivalent to \1. The use of relative
+ references can be helpful in long patterns, and also in patterns that
+ are created by joining together fragments that contain references
within themselves.
- A back reference matches whatever actually matched the capturing sub-
- pattern in the current subject string, rather than anything matching
+ A back reference matches whatever actually matched the capturing sub-
+ pattern in the current subject string, rather than anything matching
the subpattern itself (see "Subpatterns as subroutines" below for a way
of doing that). So the pattern
(sens|respons)e and \1ibility
- matches "sense and sensibility" and "response and responsibility", but
- not "sense and responsibility". If caseful matching is in force at the
- time of the back reference, the case of letters is relevant. For exam-
+ matches "sense and sensibility" and "response and responsibility", but
+ not "sense and responsibility". If caseful matching is in force at the
+ time of the back reference, the case of letters is relevant. For exam-
ple,
((?i)rah)\s+\1
- matches "rah rah" and "RAH RAH", but not "RAH rah", even though the
+ matches "rah rah" and "RAH RAH", but not "RAH rah", even though the
original capturing subpattern is matched caselessly.
- There are several different ways of writing back references to named
- subpatterns. The .NET syntax \k{name} and the Perl syntax \k<name> or
- \k'name' are supported, as is the Python syntax (?P=name). Perl 5.10's
+ There are several different ways of writing back references to named
+ subpatterns. The .NET syntax \k{name} and the Perl syntax \k<name> or
+ \k'name' are supported, as is the Python syntax (?P=name). Perl 5.10's
unified back reference syntax, in which \g can be used for both numeric
- and named references, is also supported. We could rewrite the above
+ and named references, is also supported. We could rewrite the above
example in any of the following ways:
(?<p1>(?i)rah)\s+\k<p1>
@@ -6559,84 +6556,92 @@ BACK REFERENCES
(?P<p1>(?i)rah)\s+(?P=p1)
(?<p1>(?i)rah)\s+\g{p1}
- A subpattern that is referenced by name may appear in the pattern
+ A subpattern that is referenced by name may appear in the pattern
before or after the reference.
- There may be more than one back reference to the same subpattern. If a
- subpattern has not actually been used in a particular match, any back
+ There may be more than one back reference to the same subpattern. If a
+ subpattern has not actually been used in a particular match, any back
references to it always fail by default. For example, the pattern
(a|(bc))\2
- always fails if it starts to match "a" rather than "bc". However, if
+ always fails if it starts to match "a" rather than "bc". However, if
the PCRE_JAVASCRIPT_COMPAT option is set at compile time, a back refer-
ence to an unset value matches an empty string.
- Because there may be many capturing parentheses in a pattern, all dig-
- its following a backslash are taken as part of a potential back refer-
- ence number. If the pattern continues with a digit character, some
- delimiter must be used to terminate the back reference. If the
- PCRE_EXTENDED option is set, this can be white space. Otherwise, the
+ Because there may be many capturing parentheses in a pattern, all dig-
+ its following a backslash are taken as part of a potential back refer-
+ ence number. If the pattern continues with a digit character, some
+ delimiter must be used to terminate the back reference. If the
+ PCRE_EXTENDED option is set, this can be white space. Otherwise, the
\g{ syntax or an empty comment (see "Comments" below) can be used.
Recursive back references
- A back reference that occurs inside the parentheses to which it refers
- fails when the subpattern is first used, so, for example, (a\1) never
- matches. However, such references can be useful inside repeated sub-
+ A back reference that occurs inside the parentheses to which it refers
+ fails when the subpattern is first used, so, for example, (a\1) never
+ matches. However, such references can be useful inside repeated sub-
patterns. For example, the pattern
(a|b\1)+
matches any number of "a"s and also "aba", "ababbaa" etc. At each iter-
- ation of the subpattern, the back reference matches the character
- string corresponding to the previous iteration. In order for this to
- work, the pattern must be such that the first iteration does not need
- to match the back reference. This can be done using alternation, as in
+ ation of the subpattern, the back reference matches the character
+ string corresponding to the previous iteration. In order for this to
+ work, the pattern must be such that the first iteration does not need
+ to match the back reference. This can be done using alternation, as in
the example above, or by a quantifier with a minimum of zero.
- Back references of this type cause the group that they reference to be
- treated as an atomic group. Once the whole group has been matched, a
- subsequent matching failure cannot cause backtracking into the middle
+ Back references of this type cause the group that they reference to be
+ treated as an atomic group. Once the whole group has been matched, a
+ subsequent matching failure cannot cause backtracking into the middle
of the group.
ASSERTIONS
- An assertion is a test on the characters following or preceding the
- current matching point that does not actually consume any characters.
- The simple assertions coded as \b, \B, \A, \G, \Z, \z, ^ and $ are
+ An assertion is a test on the characters following or preceding the
+ current matching point that does not actually consume any characters.
+ The simple assertions coded as \b, \B, \A, \G, \Z, \z, ^ and $ are
described above.
- More complicated assertions are coded as subpatterns. There are two
- kinds: those that look ahead of the current position in the subject
- string, and those that look behind it. An assertion subpattern is
- matched in the normal way, except that it does not cause the current
+ More complicated assertions are coded as subpatterns. There are two
+ kinds: those that look ahead of the current position in the subject
+ string, and those that look behind it. An assertion subpattern is
+ matched in the normal way, except that it does not cause the current
matching position to be changed.
- Assertion subpatterns are not capturing subpatterns. If such an asser-
- tion contains capturing subpatterns within it, these are counted for
- the purposes of numbering the capturing subpatterns in the whole pat-
- tern. However, substring capturing is carried out only for positive
+ Assertion subpatterns are not capturing subpatterns. If such an asser-
+ tion contains capturing subpatterns within it, these are counted for
+ the purposes of numbering the capturing subpatterns in the whole pat-
+ tern. However, substring capturing is carried out only for positive
assertions. (Perl sometimes, but not always, does do capturing in nega-
tive assertions.)
- For compatibility with Perl, assertion subpatterns may be repeated;
- though it makes no sense to assert the same thing several times, the
- side effect of capturing parentheses may occasionally be useful. In
+ WARNING: If a positive assertion containing one or more capturing sub-
+ patterns succeeds, but failure to match later in the pattern causes
+ backtracking over this assertion, the captures within the assertion are
+ reset only if no higher numbered captures are already set. This is,
+ unfortunately, a fundamental limitation of the current implementation,
+ and as PCRE1 is now in maintenance-only status, it is unlikely ever to
+ change.
+
+ For compatibility with Perl, assertion subpatterns may be repeated;
+ though it makes no sense to assert the same thing several times, the
+ side effect of capturing parentheses may occasionally be useful. In
practice, there only three cases:
- (1) If the quantifier is {0}, the assertion is never obeyed during
- matching. However, it may contain internal capturing parenthesized
+ (1) If the quantifier is {0}, the assertion is never obeyed during
+ matching. However, it may contain internal capturing parenthesized
groups that are called from elsewhere via the subroutine mechanism.
- (2) If quantifier is {0,n} where n is greater than zero, it is treated
- as if it were {0,1}. At run time, the rest of the pattern match is
+ (2) If quantifier is {0,n} where n is greater than zero, it is treated
+ as if it were {0,1}. At run time, the rest of the pattern match is
tried with and without the assertion, the order depending on the greed-
iness of the quantifier.
- (3) If the minimum repetition is greater than zero, the quantifier is
- ignored. The assertion is obeyed just once when encountered during
+ (3) If the minimum repetition is greater than zero, the quantifier is
+ ignored. The assertion is obeyed just once when encountered during
matching.
Lookahead assertions
@@ -6646,38 +6651,38 @@ ASSERTIONS
\w+(?=;)
- matches a word followed by a semicolon, but does not include the semi-
+ matches a word followed by a semicolon, but does not include the semi-
colon in the match, and
foo(?!bar)
- matches any occurrence of "foo" that is not followed by "bar". Note
+ matches any occurrence of "foo" that is not followed by "bar". Note
that the apparently similar pattern
(?!foo)bar
- does not find an occurrence of "bar" that is preceded by something
- other than "foo"; it finds any occurrence of "bar" whatsoever, because
+ does not find an occurrence of "bar" that is preceded by something
+ other than "foo"; it finds any occurrence of "bar" whatsoever, because
the assertion (?!foo) is always true when the next three characters are
"bar". A lookbehind assertion is needed to achieve the other effect.
If you want to force a matching failure at some point in a pattern, the
- most convenient way to do it is with (?!) because an empty string
- always matches, so an assertion that requires there not to be an empty
+ most convenient way to do it is with (?!) because an empty string
+ always matches, so an assertion that requires there not to be an empty
string must always fail. The backtracking control verb (*FAIL) or (*F)
is a synonym for (?!).
Lookbehind assertions
- Lookbehind assertions start with (?<= for positive assertions and (?<!
+ Lookbehind assertions start with (?<= for positive assertions and (?<!
for negative assertions. For example,
(?<!foo)bar
- does find an occurrence of "bar" that is not preceded by "foo". The
- contents of a lookbehind assertion are restricted such that all the
+ does find an occurrence of "bar" that is not preceded by "foo". The
+ contents of a lookbehind assertion are restricted such that all the
strings it matches must have a fixed length. However, if there are sev-
- eral top-level alternatives, they do not all have to have the same
+ eral top-level alternatives, they do not all have to have the same
fixed length. Thus
(?<=bullock|donkey)
@@ -6686,62 +6691,62 @@ ASSERTIONS
(?<!dogs?|cats?)
- causes an error at compile time. Branches that match different length
- strings are permitted only at the top level of a lookbehind assertion.
+ causes an error at compile time. Branches that match different length
+ strings are permitted only at the top level of a lookbehind assertion.
This is an extension compared with Perl, which requires all branches to
match the same length of string. An assertion such as
(?<=ab(c|de))
- is not permitted, because its single top-level branch can match two
+ is not permitted, because its single top-level branch can match two
different lengths, but it is acceptable to PCRE if rewritten to use two
top-level branches:
(?<=abc|abde)
- In some cases, the escape sequence \K (see above) can be used instead
+ In some cases, the escape sequence \K (see above) can be used instead
of a lookbehind assertion to get round the fixed-length restriction.
- The implementation of lookbehind assertions is, for each alternative,
- to temporarily move the current position back by the fixed length and
+ The implementation of lookbehind assertions is, for each alternative,
+ to temporarily move the current position back by the fixed length and
then try to match. If there are insufficient characters before the cur-
rent position, the assertion fails.
- In a UTF mode, PCRE does not allow the \C escape (which matches a sin-
- gle data unit even in a UTF mode) to appear in lookbehind assertions,
- because it makes it impossible to calculate the length of the lookbe-
- hind. The \X and \R escapes, which can match different numbers of data
+ In a UTF mode, PCRE does not allow the \C escape (which matches a sin-
+ gle data unit even in a UTF mode) to appear in lookbehind assertions,
+ because it makes it impossible to calculate the length of the lookbe-
+ hind. The \X and \R escapes, which can match different numbers of data
units, are also not permitted.
- "Subroutine" calls (see below) such as (?2) or (?&X) are permitted in
- lookbehinds, as long as the subpattern matches a fixed-length string.
+ "Subroutine" calls (see below) such as (?2) or (?&X) are permitted in
+ lookbehinds, as long as the subpattern matches a fixed-length string.
Recursion, however, is not supported.
- Possessive quantifiers can be used in conjunction with lookbehind
+ Possessive quantifiers can be used in conjunction with lookbehind
assertions to specify efficient matching of fixed-length strings at the
end of subject strings. Consider a simple pattern such as
abcd$
- when applied to a long string that does not match. Because matching
+ when applied to a long string that does not match. Because matching
proceeds from left to right, PCRE will look for each "a" in the subject
- and then see if what follows matches the rest of the pattern. If the
+ and then see if what follows matches the rest of the pattern. If the
pattern is specified as
^.*abcd$
- the initial .* matches the entire string at first, but when this fails
+ the initial .* matches the entire string at first, but when this fails
(because there is no following "a"), it backtracks to match all but the
- last character, then all but the last two characters, and so on. Once
- again the search for "a" covers the entire string, from right to left,
+ last character, then all but the last two characters, and so on. Once
+ again the search for "a" covers the entire string, from right to left,
so we are no better off. However, if the pattern is written as
^.*+(?<=abcd)
- there can be no backtracking for the .*+ item; it can match only the
- entire string. The subsequent lookbehind assertion does a single test
- on the last four characters. If it fails, the match fails immediately.
- For long strings, this approach makes a significant difference to the
+ there can be no backtracking for the .*+ item; it can match only the
+ entire string. The subsequent lookbehind assertion does a single test
+ on the last four characters. If it fails, the match fails immediately.
+ For long strings, this approach makes a significant difference to the
processing time.
Using multiple assertions
@@ -6750,18 +6755,18 @@ ASSERTIONS
(?<=\d{3})(?<!999)foo
- matches "foo" preceded by three digits that are not "999". Notice that
- each of the assertions is applied independently at the same point in
- the subject string. First there is a check that the previous three
- characters are all digits, and then there is a check that the same
+ matches "foo" preceded by three digits that are not "999". Notice that
+ each of the assertions is applied independently at the same point in
+ the subject string. First there is a check that the previous three
+ characters are all digits, and then there is a check that the same
three characters are not "999". This pattern does not match "foo" pre-
- ceded by six characters, the first of which are digits and the last
- three of which are not "999". For example, it doesn't match "123abc-
+ ceded by six characters, the first of which are digits and the last
+ three of which are not "999". For example, it doesn't match "123abc-
foo". A pattern to do that is
(?<=\d{3}...)(?<!999)foo
- This time the first assertion looks at the preceding six characters,
+ This time the first assertion looks at the preceding six characters,
checking that the first three are digits, and then the second assertion
checks that the preceding three characters are not "999".
@@ -6769,29 +6774,29 @@ ASSERTIONS
(?<=(?<!foo)bar)baz
- matches an occurrence of "baz" that is preceded by "bar" which in turn
+ matches an occurrence of "baz" that is preceded by "bar" which in turn
is not preceded by "foo", while
(?<=\d{3}(?!999)...)foo
- is another pattern that matches "foo" preceded by three digits and any
+ is another pattern that matches "foo" preceded by three digits and any
three characters that are not "999".
CONDITIONAL SUBPATTERNS
- It is possible to cause the matching process to obey a subpattern con-
- ditionally or to choose between two alternative subpatterns, depending
- on the result of an assertion, or whether a specific capturing subpat-
- tern has already been matched. The two possible forms of conditional
+ It is possible to cause the matching process to obey a subpattern con-
+ ditionally or to choose between two alternative subpatterns, depending
+ on the result of an assertion, or whether a specific capturing subpat-
+ tern has already been matched. The two possible forms of conditional
subpattern are:
(?(condition)yes-pattern)
(?(condition)yes-pattern|no-pattern)
- If the condition is satisfied, the yes-pattern is used; otherwise the
- no-pattern (if present) is used. If there are more than two alterna-
- tives in the subpattern, a compile-time error occurs. Each of the two
+ If the condition is satisfied, the yes-pattern is used; otherwise the
+ no-pattern (if present) is used. If there are more than two alterna-
+ tives in the subpattern, a compile-time error occurs. Each of the two
alternatives may itself contain nested subpatterns of any form, includ-
ing conditional subpatterns; the restriction to two alternatives
applies only at the level of the condition. This pattern fragment is an
@@ -6800,68 +6805,68 @@ CONDITIONAL SUBPATTERNS
(?(1) (A|B|C) | (D | (?(2)E|F) | E) )
- There are four kinds of condition: references to subpatterns, refer-
+ There are four kinds of condition: references to subpatterns, refer-
ences to recursion, a pseudo-condition called DEFINE, and assertions.
Checking for a used subpattern by number
- If the text between the parentheses consists of a sequence of digits,
+ If the text between the parentheses consists of a sequence of digits,
the condition is true if a capturing subpattern of that number has pre-
- viously matched. If there is more than one capturing subpattern with
- the same number (see the earlier section about duplicate subpattern
- numbers), the condition is true if any of them have matched. An alter-
- native notation is to precede the digits with a plus or minus sign. In
- this case, the subpattern number is relative rather than absolute. The
- most recently opened parentheses can be referenced by (?(-1), the next
- most recent by (?(-2), and so on. Inside loops it can also make sense
+ viously matched. If there is more than one capturing subpattern with
+ the same number (see the earlier section about duplicate subpattern
+ numbers), the condition is true if any of them have matched. An alter-
+ native notation is to precede the digits with a plus or minus sign. In
+ this case, the subpattern number is relative rather than absolute. The
+ most recently opened parentheses can be referenced by (?(-1), the next
+ most recent by (?(-2), and so on. Inside loops it can also make sense
to refer to subsequent groups. The next parentheses to be opened can be
- referenced as (?(+1), and so on. (The value zero in any of these forms
+ referenced as (?(+1), and so on. (The value zero in any of these forms
is not used; it provokes a compile-time error.)
- Consider the following pattern, which contains non-significant white
+ Consider the following pattern, which contains non-significant white
space to make it more readable (assume the PCRE_EXTENDED option) and to
divide it into three parts for ease of discussion:
( \( )? [^()]+ (?(1) \) )
- The first part matches an optional opening parenthesis, and if that
+ The first part matches an optional opening parenthesis, and if that
character is present, sets it as the first captured substring. The sec-
- ond part matches one or more characters that are not parentheses. The
- third part is a conditional subpattern that tests whether or not the
- first set of parentheses matched. If they did, that is, if subject
- started with an opening parenthesis, the condition is true, and so the
- yes-pattern is executed and a closing parenthesis is required. Other-
- wise, since no-pattern is not present, the subpattern matches nothing.
- In other words, this pattern matches a sequence of non-parentheses,
+ ond part matches one or more characters that are not parentheses. The
+ third part is a conditional subpattern that tests whether or not the
+ first set of parentheses matched. If they did, that is, if subject
+ started with an opening parenthesis, the condition is true, and so the
+ yes-pattern is executed and a closing parenthesis is required. Other-
+ wise, since no-pattern is not present, the subpattern matches nothing.
+ In other words, this pattern matches a sequence of non-parentheses,
optionally enclosed in parentheses.
- If you were embedding this pattern in a larger one, you could use a
+ If you were embedding this pattern in a larger one, you could use a
relative reference:
...other stuff... ( \( )? [^()]+ (?(-1) \) ) ...
- This makes the fragment independent of the parentheses in the larger
+ This makes the fragment independent of the parentheses in the larger
pattern.
Checking for a used subpattern by name
- Perl uses the syntax (?(<name>)...) or (?('name')...) to test for a
- used subpattern by name. For compatibility with earlier versions of
- PCRE, which had this facility before Perl, the syntax (?(name)...) is
+ Perl uses the syntax (?(<name>)...) or (?('name')...) to test for a
+ used subpattern by name. For compatibility with earlier versions of
+ PCRE, which had this facility before Perl, the syntax (?(name)...) is
also recognized.
Rewriting the above example to use a named subpattern gives this:
(?<OPEN> \( )? [^()]+ (?(<OPEN>) \) )
- If the name used in a condition of this kind is a duplicate, the test
- is applied to all subpatterns of the same name, and is true if any one
+ If the name used in a condition of this kind is a duplicate, the test
+ is applied to all subpatterns of the same name, and is true if any one
of them has matched.
Checking for pattern recursion
If the condition is the string (R), and there is no subpattern with the
- name R, the condition is true if a recursive call to the whole pattern
+ name R, the condition is true if a recursive call to the whole pattern
or any subpattern has been made. If digits or a name preceded by amper-
sand follow the letter R, for example:
@@ -6869,51 +6874,51 @@ CONDITIONAL SUBPATTERNS
the condition is true if the most recent recursion is into a subpattern
whose number or name is given. This condition does not check the entire
- recursion stack. If the name used in a condition of this kind is a
+ recursion stack. If the name used in a condition of this kind is a
duplicate, the test is applied to all subpatterns of the same name, and
is true if any one of them is the most recent recursion.
- At "top level", all these recursion test conditions are false. The
+ At "top level", all these recursion test conditions are false. The
syntax for recursive patterns is described below.
Defining subpatterns for use by reference only
- If the condition is the string (DEFINE), and there is no subpattern
- with the name DEFINE, the condition is always false. In this case,
- there may be only one alternative in the subpattern. It is always
- skipped if control reaches this point in the pattern; the idea of
- DEFINE is that it can be used to define subroutines that can be refer-
- enced from elsewhere. (The use of subroutines is described below.) For
- example, a pattern to match an IPv4 address such as "192.168.23.245"
+ If the condition is the string (DEFINE), and there is no subpattern
+ with the name DEFINE, the condition is always false. In this case,
+ there may be only one alternative in the subpattern. It is always
+ skipped if control reaches this point in the pattern; the idea of
+ DEFINE is that it can be used to define subroutines that can be refer-
+ enced from elsewhere. (The use of subroutines is described below.) For
+ example, a pattern to match an IPv4 address such as "192.168.23.245"
could be written like this (ignore white space and line breaks):
(?(DEFINE) (?<byte> 2[0-4]\d | 25[0-5] | 1\d\d | [1-9]?\d) )
\b (?&byte) (\.(?&byte)){3} \b
- The first part of the pattern is a DEFINE group inside which a another
- group named "byte" is defined. This matches an individual component of
- an IPv4 address (a number less than 256). When matching takes place,
- this part of the pattern is skipped because DEFINE acts like a false
- condition. The rest of the pattern uses references to the named group
- to match the four dot-separated components of an IPv4 address, insist-
+ The first part of the pattern is a DEFINE group inside which a another
+ group named "byte" is defined. This matches an individual component of
+ an IPv4 address (a number less than 256). When matching takes place,
+ this part of the pattern is skipped because DEFINE acts like a false
+ condition. The rest of the pattern uses references to the named group
+ to match the four dot-separated components of an IPv4 address, insist-
ing on a word boundary at each end.
Assertion conditions
- If the condition is not in any of the above formats, it must be an
- assertion. This may be a positive or negative lookahead or lookbehind
- assertion. Consider this pattern, again containing non-significant
+ If the condition is not in any of the above formats, it must be an
+ assertion. This may be a positive or negative lookahead or lookbehind
+ assertion. Consider this pattern, again containing non-significant
white space, and with the two alternatives on the second line:
(?(?=[^a-z]*[a-z])
\d{2}-[a-z]{3}-\d{2} | \d{2}-\d{2}-\d{2} )
- The condition is a positive lookahead assertion that matches an
- optional sequence of non-letters followed by a letter. In other words,
- it tests for the presence of at least one letter in the subject. If a
- letter is found, the subject is matched against the first alternative;
- otherwise it is matched against the second. This pattern matches
- strings in one of the two forms dd-aaa-dd or dd-dd-dd, where aaa are
+ The condition is a positive lookahead assertion that matches an
+ optional sequence of non-letters followed by a letter. In other words,
+ it tests for the presence of at least one letter in the subject. If a
+ letter is found, the subject is matched against the first alternative;
+ otherwise it is matched against the second. This pattern matches
+ strings in one of the two forms dd-aaa-dd or dd-dd-dd, where aaa are
letters and dd are digits.
@@ -6922,41 +6927,41 @@ COMMENTS
There are two ways of including comments in patterns that are processed
by PCRE. In both cases, the start of the comment must not be in a char-
acter class, nor in the middle of any other sequence of related charac-
- ters such as (?: or a subpattern name or number. The characters that
+ ters such as (?: or a subpattern name or number. The characters that
make up a comment play no part in the pattern matching.
- The sequence (?# marks the start of a comment that continues up to the
- next closing parenthesis. Nested parentheses are not permitted. If the
+ The sequence (?# marks the start of a comment that continues up to the
+ next closing parenthesis. Nested parentheses are not permitted. If the
PCRE_EXTENDED option is set, an unescaped # character also introduces a
- comment, which in this case continues to immediately after the next
- newline character or character sequence in the pattern. Which charac-
+ comment, which in this case continues to immediately after the next
+ newline character or character sequence in the pattern. Which charac-
ters are interpreted as newlines is controlled by the options passed to
- a compiling function or by a special sequence at the start of the pat-
+ a compiling function or by a special sequence at the start of the pat-
tern, as described in the section entitled "Newline conventions" above.
Note that the end of this type of comment is a literal newline sequence
- in the pattern; escape sequences that happen to represent a newline do
- not count. For example, consider this pattern when PCRE_EXTENDED is
+ in the pattern; escape sequences that happen to represent a newline do
+ not count. For example, consider this pattern when PCRE_EXTENDED is
set, and the default newline convention is in force:
abc #comment \n still comment
- On encountering the # character, pcre_compile() skips along, looking
- for a newline in the pattern. The sequence \n is still literal at this
- stage, so it does not terminate the comment. Only an actual character
+ On encountering the # character, pcre_compile() skips along, looking
+ for a newline in the pattern. The sequence \n is still literal at this
+ stage, so it does not terminate the comment. Only an actual character
with the code value 0x0a (the default newline) does so.
RECURSIVE PATTERNS
- Consider the problem of matching a string in parentheses, allowing for
- unlimited nested parentheses. Without the use of recursion, the best
- that can be done is to use a pattern that matches up to some fixed
- depth of nesting. It is not possible to handle an arbitrary nesting
+ Consider the problem of matching a string in parentheses, allowing for
+ unlimited nested parentheses. Without the use of recursion, the best
+ that can be done is to use a pattern that matches up to some fixed
+ depth of nesting. It is not possible to handle an arbitrary nesting
depth.
For some time, Perl has provided a facility that allows regular expres-
- sions to recurse (amongst other things). It does this by interpolating
- Perl code in the expression at run time, and the code can refer to the
+ sions to recurse (amongst other things). It does this by interpolating
+ Perl code in the expression at run time, and the code can refer to the
expression itself. A Perl pattern using code interpolation to solve the
parentheses problem can be created like this:
@@ -6966,201 +6971,201 @@ RECURSIVE PATTERNS
refers recursively to the pattern in which it appears.
Obviously, PCRE cannot support the interpolation of Perl code. Instead,
- it supports special syntax for recursion of the entire pattern, and
- also for individual subpattern recursion. After its introduction in
- PCRE and Python, this kind of recursion was subsequently introduced
+ it supports special syntax for recursion of the entire pattern, and
+ also for individual subpattern recursion. After its introduction in
+ PCRE and Python, this kind of recursion was subsequently introduced
into Perl at release 5.10.
- A special item that consists of (? followed by a number greater than
- zero and a closing parenthesis is a recursive subroutine call of the
- subpattern of the given number, provided that it occurs inside that
- subpattern. (If not, it is a non-recursive subroutine call, which is
- described in the next section.) The special item (?R) or (?0) is a
+ A special item that consists of (? followed by a number greater than
+ zero and a closing parenthesis is a recursive subroutine call of the
+ subpattern of the given number, provided that it occurs inside that
+ subpattern. (If not, it is a non-recursive subroutine call, which is
+ described in the next section.) The special item (?R) or (?0) is a
recursive call of the entire regular expression.
- This PCRE pattern solves the nested parentheses problem (assume the
+ This PCRE pattern solves the nested parentheses problem (assume the
PCRE_EXTENDED option is set so that white space is ignored):
\( ( [^()]++ | (?R) )* \)
- First it matches an opening parenthesis. Then it matches any number of
- substrings which can either be a sequence of non-parentheses, or a
- recursive match of the pattern itself (that is, a correctly parenthe-
+ First it matches an opening parenthesis. Then it matches any number of
+ substrings which can either be a sequence of non-parentheses, or a
+ recursive match of the pattern itself (that is, a correctly parenthe-
sized substring). Finally there is a closing parenthesis. Note the use
of a possessive quantifier to avoid backtracking into sequences of non-
parentheses.
- If this were part of a larger pattern, you would not want to recurse
+ If this were part of a larger pattern, you would not want to recurse
the entire pattern, so instead you could use this:
( \( ( [^()]++ | (?1) )* \) )
- We have put the pattern into parentheses, and caused the recursion to
+ We have put the pattern into parentheses, and caused the recursion to
refer to them instead of the whole pattern.
- In a larger pattern, keeping track of parenthesis numbers can be
- tricky. This is made easier by the use of relative references. Instead
+ In a larger pattern, keeping track of parenthesis numbers can be
+ tricky. This is made easier by the use of relative references. Instead
of (?1) in the pattern above you can write (?-2) to refer to the second
- most recently opened parentheses preceding the recursion. In other
- words, a negative number counts capturing parentheses leftwards from
+ most recently opened parentheses preceding the recursion. In other
+ words, a negative number counts capturing parentheses leftwards from
the point at which it is encountered.
- It is also possible to refer to subsequently opened parentheses, by
- writing references such as (?+2). However, these cannot be recursive
- because the reference is not inside the parentheses that are refer-
- enced. They are always non-recursive subroutine calls, as described in
+ It is also possible to refer to subsequently opened parentheses, by
+ writing references such as (?+2). However, these cannot be recursive
+ because the reference is not inside the parentheses that are refer-
+ enced. They are always non-recursive subroutine calls, as described in
the next section.
- An alternative approach is to use named parentheses instead. The Perl
- syntax for this is (?&name); PCRE's earlier syntax (?P>name) is also
+ An alternative approach is to use named parentheses instead. The Perl
+ syntax for this is (?&name); PCRE's earlier syntax (?P>name) is also
supported. We could rewrite the above example as follows:
(?<pn> \( ( [^()]++ | (?&pn) )* \) )
- If there is more than one subpattern with the same name, the earliest
+ If there is more than one subpattern with the same name, the earliest
one is used.
- This particular example pattern that we have been looking at contains
+ This particular example pattern that we have been looking at contains
nested unlimited repeats, and so the use of a possessive quantifier for
matching strings of non-parentheses is important when applying the pat-
- tern to strings that do not match. For example, when this pattern is
+ tern to strings that do not match. For example, when this pattern is
applied to
(aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa()
- it yields "no match" quickly. However, if a possessive quantifier is
- not used, the match runs for a very long time indeed because there are
- so many different ways the + and * repeats can carve up the subject,
+ it yields "no match" quickly. However, if a possessive quantifier is
+ not used, the match runs for a very long time indeed because there are
+ so many different ways the + and * repeats can carve up the subject,
and all have to be tested before failure can be reported.
- At the end of a match, the values of capturing parentheses are those
- from the outermost level. If you want to obtain intermediate values, a
- callout function can be used (see below and the pcrecallout documenta-
+ At the end of a match, the values of capturing parentheses are those
+ from the outermost level. If you want to obtain intermediate values, a
+ callout function can be used (see below and the pcrecallout documenta-
tion). If the pattern above is matched against
(ab(cd)ef)
- the value for the inner capturing parentheses (numbered 2) is "ef",
- which is the last value taken on at the top level. If a capturing sub-
- pattern is not matched at the top level, its final captured value is
- unset, even if it was (temporarily) set at a deeper level during the
+ the value for the inner capturing parentheses (numbered 2) is "ef",
+ which is the last value taken on at the top level. If a capturing sub-
+ pattern is not matched at the top level, its final captured value is
+ unset, even if it was (temporarily) set at a deeper level during the
matching process.
- If there are more than 15 capturing parentheses in a pattern, PCRE has
- to obtain extra memory to store data during a recursion, which it does
+ If there are more than 15 capturing parentheses in a pattern, PCRE has
+ to obtain extra memory to store data during a recursion, which it does
by using pcre_malloc, freeing it via pcre_free afterwards. If no memory
can be obtained, the match fails with the PCRE_ERROR_NOMEMORY error.
- Do not confuse the (?R) item with the condition (R), which tests for
- recursion. Consider this pattern, which matches text in angle brack-
- ets, allowing for arbitrary nesting. Only digits are allowed in nested
- brackets (that is, when recursing), whereas any characters are permit-
+ Do not confuse the (?R) item with the condition (R), which tests for
+ recursion. Consider this pattern, which matches text in angle brack-
+ ets, allowing for arbitrary nesting. Only digits are allowed in nested
+ brackets (that is, when recursing), whereas any characters are permit-
ted at the outer level.
< (?: (?(R) \d++ | [^<>]*+) | (?R)) * >
- In this pattern, (?(R) is the start of a conditional subpattern, with
- two different alternatives for the recursive and non-recursive cases.
+ In this pattern, (?(R) is the start of a conditional subpattern, with
+ two different alternatives for the recursive and non-recursive cases.
The (?R) item is the actual recursive call.
Differences in recursion processing between PCRE and Perl
- Recursion processing in PCRE differs from Perl in two important ways.
- In PCRE (like Python, but unlike Perl), a recursive subpattern call is
+ Recursion processing in PCRE differs from Perl in two important ways.
+ In PCRE (like Python, but unlike Perl), a recursive subpattern call is
always treated as an atomic group. That is, once it has matched some of
the subject string, it is never re-entered, even if it contains untried
- alternatives and there is a subsequent matching failure. This can be
- illustrated by the following pattern, which purports to match a palin-
- dromic string that contains an odd number of characters (for example,
+ alternatives and there is a subsequent matching failure. This can be
+ illustrated by the following pattern, which purports to match a palin-
+ dromic string that contains an odd number of characters (for example,
"a", "aba", "abcba", "abcdcba"):
^(.|(.)(?1)\2)$
The idea is that it either matches a single character, or two identical
- characters surrounding a sub-palindrome. In Perl, this pattern works;
- in PCRE it does not if the pattern is longer than three characters.
+ characters surrounding a sub-palindrome. In Perl, this pattern works;
+ in PCRE it does not if the pattern is longer than three characters.
Consider the subject string "abcba":
- At the top level, the first character is matched, but as it is not at
+ At the top level, the first character is matched, but as it is not at
the end of the string, the first alternative fails; the second alterna-
tive is taken and the recursion kicks in. The recursive call to subpat-
- tern 1 successfully matches the next character ("b"). (Note that the
+ tern 1 successfully matches the next character ("b"). (Note that the
beginning and end of line tests are not part of the recursion).
- Back at the top level, the next character ("c") is compared with what
- subpattern 2 matched, which was "a". This fails. Because the recursion
- is treated as an atomic group, there are now no backtracking points,
- and so the entire match fails. (Perl is able, at this point, to re-
- enter the recursion and try the second alternative.) However, if the
+ Back at the top level, the next character ("c") is compared with what
+ subpattern 2 matched, which was "a". This fails. Because the recursion
+ is treated as an atomic group, there are now no backtracking points,
+ and so the entire match fails. (Perl is able, at this point, to re-
+ enter the recursion and try the second alternative.) However, if the
pattern is written with the alternatives in the other order, things are
different:
^((.)(?1)\2|.)$
- This time, the recursing alternative is tried first, and continues to
- recurse until it runs out of characters, at which point the recursion
- fails. But this time we do have another alternative to try at the
- higher level. That is the big difference: in the previous case the
+ This time, the recursing alternative is tried first, and continues to
+ recurse until it runs out of characters, at which point the recursion
+ fails. But this time we do have another alternative to try at the
+ higher level. That is the big difference: in the previous case the
remaining alternative is at a deeper recursion level, which PCRE cannot
use.
- To change the pattern so that it matches all palindromic strings, not
- just those with an odd number of characters, it is tempting to change
+ To change the pattern so that it matches all palindromic strings, not
+ just those with an odd number of characters, it is tempting to change
the pattern to this:
^((.)(?1)\2|.?)$
- Again, this works in Perl, but not in PCRE, and for the same reason.
- When a deeper recursion has matched a single character, it cannot be
- entered again in order to match an empty string. The solution is to
- separate the two cases, and write out the odd and even cases as alter-
+ Again, this works in Perl, but not in PCRE, and for the same reason.
+ When a deeper recursion has matched a single character, it cannot be
+ entered again in order to match an empty string. The solution is to
+ separate the two cases, and write out the odd and even cases as alter-
natives at the higher level:
^(?:((.)(?1)\2|)|((.)(?3)\4|.))
- If you want to match typical palindromic phrases, the pattern has to
+ If you want to match typical palindromic phrases, the pattern has to
ignore all non-word characters, which can be done like this:
^\W*+(?:((.)\W*+(?1)\W*+\2|)|((.)\W*+(?3)\W*+\4|\W*+.\W*+))\W*+$
If run with the PCRE_CASELESS option, this pattern matches phrases such
as "A man, a plan, a canal: Panama!" and it works well in both PCRE and
- Perl. Note the use of the possessive quantifier *+ to avoid backtrack-
- ing into sequences of non-word characters. Without this, PCRE takes a
- great deal longer (ten times or more) to match typical phrases, and
+ Perl. Note the use of the possessive quantifier *+ to avoid backtrack-
+ ing into sequences of non-word characters. Without this, PCRE takes a
+ great deal longer (ten times or more) to match typical phrases, and
Perl takes so long that you think it has gone into a loop.
- WARNING: The palindrome-matching patterns above work only if the sub-
- ject string does not start with a palindrome that is shorter than the
- entire string. For example, although "abcba" is correctly matched, if
- the subject is "ababa", PCRE finds the palindrome "aba" at the start,
- then fails at top level because the end of the string does not follow.
- Once again, it cannot jump back into the recursion to try other alter-
+ WARNING: The palindrome-matching patterns above work only if the sub-
+ ject string does not start with a palindrome that is shorter than the
+ entire string. For example, although "abcba" is correctly matched, if
+ the subject is "ababa", PCRE finds the palindrome "aba" at the start,
+ then fails at top level because the end of the string does not follow.
+ Once again, it cannot jump back into the recursion to try other alter-
natives, so the entire match fails.
- The second way in which PCRE and Perl differ in their recursion pro-
- cessing is in the handling of captured values. In Perl, when a subpat-
- tern is called recursively or as a subpattern (see the next section),
- it has no access to any values that were captured outside the recur-
- sion, whereas in PCRE these values can be referenced. Consider this
+ The second way in which PCRE and Perl differ in their recursion pro-
+ cessing is in the handling of captured values. In Perl, when a subpat-
+ tern is called recursively or as a subpattern (see the next section),
+ it has no access to any values that were captured outside the recur-
+ sion, whereas in PCRE these values can be referenced. Consider this
pattern:
^(.)(\1|a(?2))
- In PCRE, this pattern matches "bab". The first capturing parentheses
- match "b", then in the second group, when the back reference \1 fails
- to match "b", the second alternative matches "a" and then recurses. In
- the recursion, \1 does now match "b" and so the whole match succeeds.
- In Perl, the pattern fails to match because inside the recursive call
+ In PCRE, this pattern matches "bab". The first capturing parentheses
+ match "b", then in the second group, when the back reference \1 fails
+ to match "b", the second alternative matches "a" and then recurses. In
+ the recursion, \1 does now match "b" and so the whole match succeeds.
+ In Perl, the pattern fails to match because inside the recursive call
\1 cannot access the externally set value.
SUBPATTERNS AS SUBROUTINES
- If the syntax for a recursive subpattern call (either by number or by
- name) is used outside the parentheses to which it refers, it operates
- like a subroutine in a programming language. The called subpattern may
- be defined before or after the reference. A numbered reference can be
+ If the syntax for a recursive subpattern call (either by number or by
+ name) is used outside the parentheses to which it refers, it operates
+ like a subroutine in a programming language. The called subpattern may
+ be defined before or after the reference. A numbered reference can be
absolute or relative, as in these examples:
(...(absolute)...)...(?2)...
@@ -7171,79 +7176,79 @@ SUBPATTERNS AS SUBROUTINES
(sens|respons)e and \1ibility
- matches "sense and sensibility" and "response and responsibility", but
+ matches "sense and sensibility" and "response and responsibility", but
not "sense and responsibility". If instead the pattern
(sens|respons)e and (?1)ibility
- is used, it does match "sense and responsibility" as well as the other
- two strings. Another example is given in the discussion of DEFINE
+ is used, it does match "sense and responsibility" as well as the other
+ two strings. Another example is given in the discussion of DEFINE
above.
- All subroutine calls, whether recursive or not, are always treated as
- atomic groups. That is, once a subroutine has matched some of the sub-
+ All subroutine calls, whether recursive or not, are always treated as
+ atomic groups. That is, once a subroutine has matched some of the sub-
ject string, it is never re-entered, even if it contains untried alter-
- natives and there is a subsequent matching failure. Any capturing
- parentheses that are set during the subroutine call revert to their
+ natives and there is a subsequent matching failure. Any capturing
+ parentheses that are set during the subroutine call revert to their
previous values afterwards.
- Processing options such as case-independence are fixed when a subpat-
- tern is defined, so if it is used as a subroutine, such options cannot
+ Processing options such as case-independence are fixed when a subpat-
+ tern is defined, so if it is used as a subroutine, such options cannot
be changed for different calls. For example, consider this pattern:
(abc)(?i:(?-1))
- It matches "abcabc". It does not match "abcABC" because the change of
+ It matches "abcabc". It does not match "abcABC" because the change of
processing option does not affect the called subpattern.
ONIGURUMA SUBROUTINE SYNTAX
- For compatibility with Oniguruma, the non-Perl syntax \g followed by a
+ For compatibility with Oniguruma, the non-Perl syntax \g followed by a
name or a number enclosed either in angle brackets or single quotes, is
- an alternative syntax for referencing a subpattern as a subroutine,
- possibly recursively. Here are two of the examples used above, rewrit-
+ an alternative syntax for referencing a subpattern as a subroutine,
+ possibly recursively. Here are two of the examples used above, rewrit-
ten using this syntax:
(?<pn> \( ( (?>[^()]+) | \g<pn> )* \) )
(sens|respons)e and \g'1'ibility
- PCRE supports an extension to Oniguruma: if a number is preceded by a
+ PCRE supports an extension to Oniguruma: if a number is preceded by a
plus or a minus sign it is taken as a relative reference. For example:
(abc)(?i:\g<-1>)
- Note that \g{...} (Perl syntax) and \g<...> (Oniguruma syntax) are not
- synonymous. The former is a back reference; the latter is a subroutine
+ Note that \g{...} (Perl syntax) and \g<...> (Oniguruma syntax) are not
+ synonymous. The former is a back reference; the latter is a subroutine
call.
CALLOUTS
Perl has a feature whereby using the sequence (?{...}) causes arbitrary
- Perl code to be obeyed in the middle of matching a regular expression.
+ Perl code to be obeyed in the middle of matching a regular expression.
This makes it possible, amongst other things, to extract different sub-
strings that match the same pair of parentheses when there is a repeti-
tion.
PCRE provides a similar feature, but of course it cannot obey arbitrary
Perl code. The feature is called "callout". The caller of PCRE provides
- an external function by putting its entry point in the global variable
- pcre_callout (8-bit library) or pcre[16|32]_callout (16-bit or 32-bit
- library). By default, this variable contains NULL, which disables all
+ an external function by putting its entry point in the global variable
+ pcre_callout (8-bit library) or pcre[16|32]_callout (16-bit or 32-bit
+ library). By default, this variable contains NULL, which disables all
calling out.
- Within a regular expression, (?C) indicates the points at which the
- external function is to be called. If you want to identify different
- callout points, you can put a number less than 256 after the letter C.
- The default value is zero. For example, this pattern has two callout
+ Within a regular expression, (?C) indicates the points at which the
+ external function is to be called. If you want to identify different
+ callout points, you can put a number less than 256 after the letter C.
+ The default value is zero. For example, this pattern has two callout
points:
(?C1)abc(?C2)def
- If the PCRE_AUTO_CALLOUT flag is passed to a compiling function, call-
- outs are automatically installed before each item in the pattern. They
- are all numbered 255. If there is a conditional group in the pattern
+ If the PCRE_AUTO_CALLOUT flag is passed to a compiling function, call-
+ outs are automatically installed before each item in the pattern. They
+ are all numbered 255. If there is a conditional group in the pattern
whose condition is an assertion, an additional callout is inserted just
before the condition. An explicit callout may also be set at this posi-
tion, as in this example:
@@ -7253,120 +7258,120 @@ CALLOUTS
Note that this applies only to assertion conditions, not to other types
of condition.
- During matching, when PCRE reaches a callout point, the external func-
- tion is called. It is provided with the number of the callout, the
- position in the pattern, and, optionally, one item of data originally
- supplied by the caller of the matching function. The callout function
+ During matching, when PCRE reaches a callout point, the external func-
+ tion is called. It is provided with the number of the callout, the
+ position in the pattern, and, optionally, one item of data originally
+ supplied by the caller of the matching function. The callout function
may cause matching to proceed, to backtrack, or to fail altogether.
- By default, PCRE implements a number of optimizations at compile time
- and matching time, and one side-effect is that sometimes callouts are
- skipped. If you need all possible callouts to happen, you need to set
- options that disable the relevant optimizations. More details, and a
- complete description of the interface to the callout function, are
+ By default, PCRE implements a number of optimizations at compile time
+ and matching time, and one side-effect is that sometimes callouts are
+ skipped. If you need all possible callouts to happen, you need to set
+ options that disable the relevant optimizations. More details, and a
+ complete description of the interface to the callout function, are
given in the pcrecallout documentation.
BACKTRACKING CONTROL
- Perl 5.10 introduced a number of "Special Backtracking Control Verbs",
- which are still described in the Perl documentation as "experimental
- and subject to change or removal in a future version of Perl". It goes
- on to say: "Their usage in production code should be noted to avoid
- problems during upgrades." The same remarks apply to the PCRE features
+ Perl 5.10 introduced a number of "Special Backtracking Control Verbs",
+ which are still described in the Perl documentation as "experimental
+ and subject to change or removal in a future version of Perl". It goes
+ on to say: "Their usage in production code should be noted to avoid
+ problems during upgrades." The same remarks apply to the PCRE features
described in this section.
- The new verbs make use of what was previously invalid syntax: an open-
+ The new verbs make use of what was previously invalid syntax: an open-
ing parenthesis followed by an asterisk. They are generally of the form
- (*VERB) or (*VERB:NAME). Some may take either form, possibly behaving
- differently depending on whether or not a name is present. A name is
+ (*VERB) or (*VERB:NAME). Some may take either form, possibly behaving
+ differently depending on whether or not a name is present. A name is
any sequence of characters that does not include a closing parenthesis.
The maximum length of name is 255 in the 8-bit library and 65535 in the
- 16-bit and 32-bit libraries. If the name is empty, that is, if the
- closing parenthesis immediately follows the colon, the effect is as if
- the colon were not there. Any number of these verbs may occur in a
+ 16-bit and 32-bit libraries. If the name is empty, that is, if the
+ closing parenthesis immediately follows the colon, the effect is as if
+ the colon were not there. Any number of these verbs may occur in a
pattern.
- Since these verbs are specifically related to backtracking, most of
- them can be used only when the pattern is to be matched using one of
- the traditional matching functions, because these use a backtracking
- algorithm. With the exception of (*FAIL), which behaves like a failing
- negative assertion, the backtracking control verbs cause an error if
+ Since these verbs are specifically related to backtracking, most of
+ them can be used only when the pattern is to be matched using one of
+ the traditional matching functions, because these use a backtracking
+ algorithm. With the exception of (*FAIL), which behaves like a failing
+ negative assertion, the backtracking control verbs cause an error if
encountered by a DFA matching function.
- The behaviour of these verbs in repeated groups, assertions, and in
+ The behaviour of these verbs in repeated groups, assertions, and in
subpatterns called as subroutines (whether or not recursively) is docu-
mented below.
Optimizations that affect backtracking verbs
- PCRE contains some optimizations that are used to speed up matching by
+ PCRE contains some optimizations that are used to speed up matching by
running some checks at the start of each match attempt. For example, it
- may know the minimum length of matching subject, or that a particular
+ may know the minimum length of matching subject, or that a particular
character must be present. When one of these optimizations bypasses the
- running of a match, any included backtracking verbs will not, of
+ running of a match, any included backtracking verbs will not, of
course, be processed. You can suppress the start-of-match optimizations
- by setting the PCRE_NO_START_OPTIMIZE option when calling pcre_com-
+ by setting the PCRE_NO_START_OPTIMIZE option when calling pcre_com-
pile() or pcre_exec(), or by starting the pattern with (*NO_START_OPT).
There is more discussion of this option in the section entitled "Option
bits for pcre_exec()" in the pcreapi documentation.
- Experiments with Perl suggest that it too has similar optimizations,
+ Experiments with Perl suggest that it too has similar optimizations,
sometimes leading to anomalous results.
Verbs that act immediately
- The following verbs act as soon as they are encountered. They may not
+ The following verbs act as soon as they are encountered. They may not
be followed by a name.
(*ACCEPT)
- This verb causes the match to end successfully, skipping the remainder
- of the pattern. However, when it is inside a subpattern that is called
- as a subroutine, only that subpattern is ended successfully. Matching
+ This verb causes the match to end successfully, skipping the remainder
+ of the pattern. However, when it is inside a subpattern that is called
+ as a subroutine, only that subpattern is ended successfully. Matching
then continues at the outer level. If (*ACCEPT) in triggered in a posi-
- tive assertion, the assertion succeeds; in a negative assertion, the
+ tive assertion, the assertion succeeds; in a negative assertion, the
assertion fails.
- If (*ACCEPT) is inside capturing parentheses, the data so far is cap-
+ If (*ACCEPT) is inside capturing parentheses, the data so far is cap-
tured. For example:
A((?:A|B(*ACCEPT)|C)D)
- This matches "AB", "AAD", or "ACD"; when it matches "AB", "B" is cap-
+ This matches "AB", "AAD", or "ACD"; when it matches "AB", "B" is cap-
tured by the outer parentheses.
(*FAIL) or (*F)
- This verb causes a matching failure, forcing backtracking to occur. It
- is equivalent to (?!) but easier to read. The Perl documentation notes
- that it is probably useful only when combined with (?{}) or (??{}).
- Those are, of course, Perl features that are not present in PCRE. The
- nearest equivalent is the callout feature, as for example in this pat-
+ This verb causes a matching failure, forcing backtracking to occur. It
+ is equivalent to (?!) but easier to read. The Perl documentation notes
+ that it is probably useful only when combined with (?{}) or (??{}).
+ Those are, of course, Perl features that are not present in PCRE. The
+ nearest equivalent is the callout feature, as for example in this pat-
tern:
a+(?C)(*FAIL)
- A match with the string "aaaa" always fails, but the callout is taken
+ A match with the string "aaaa" always fails, but the callout is taken
before each backtrack happens (in this example, 10 times).
Recording which path was taken
- There is one verb whose main purpose is to track how a match was
- arrived at, though it also has a secondary use in conjunction with
+ There is one verb whose main purpose is to track how a match was
+ arrived at, though it also has a secondary use in conjunction with
advancing the match starting point (see (*SKIP) below).
(*MARK:NAME) or (*:NAME)
- A name is always required with this verb. There may be as many
- instances of (*MARK) as you like in a pattern, and their names do not
+ A name is always required with this verb. There may be as many
+ instances of (*MARK) as you like in a pattern, and their names do not
have to be unique.
- When a match succeeds, the name of the last-encountered (*MARK:NAME),
- (*PRUNE:NAME), or (*THEN:NAME) on the matching path is passed back to
- the caller as described in the section entitled "Extra data for
- pcre_exec()" in the pcreapi documentation. Here is an example of
- pcretest output, where the /K modifier requests the retrieval and out-
+ When a match succeeds, the name of the last-encountered (*MARK:NAME),
+ (*PRUNE:NAME), or (*THEN:NAME) on the matching path is passed back to
+ the caller as described in the section entitled "Extra data for
+ pcre_exec()" in the pcreapi documentation. Here is an example of
+ pcretest output, where the /K modifier requests the retrieval and out-
putting of (*MARK) data:
re> /X(*MARK:A)Y|X(*MARK:B)Z/K
@@ -7378,73 +7383,73 @@ BACKTRACKING CONTROL
MK: B
The (*MARK) name is tagged with "MK:" in this output, and in this exam-
- ple it indicates which of the two alternatives matched. This is a more
- efficient way of obtaining this information than putting each alterna-
+ ple it indicates which of the two alternatives matched. This is a more
+ efficient way of obtaining this information than putting each alterna-
tive in its own capturing parentheses.
- If a verb with a name is encountered in a positive assertion that is
- true, the name is recorded and passed back if it is the last-encoun-
+ If a verb with a name is encountered in a positive assertion that is
+ true, the name is recorded and passed back if it is the last-encoun-
tered. This does not happen for negative assertions or failing positive
assertions.
- After a partial match or a failed match, the last encountered name in
+ After a partial match or a failed match, the last encountered name in
the entire match process is returned. For example:
re> /X(*MARK:A)Y|X(*MARK:B)Z/K
data> XP
No match, mark = B
- Note that in this unanchored example the mark is retained from the
+ Note that in this unanchored example the mark is retained from the
match attempt that started at the letter "X" in the subject. Subsequent
match attempts starting at "P" and then with an empty string do not get
as far as the (*MARK) item, but nevertheless do not reset it.
- If you are interested in (*MARK) values after failed matches, you
- should probably set the PCRE_NO_START_OPTIMIZE option (see above) to
+ If you are interested in (*MARK) values after failed matches, you
+ should probably set the PCRE_NO_START_OPTIMIZE option (see above) to
ensure that the match is always attempted.
Verbs that act after backtracking
The following verbs do nothing when they are encountered. Matching con-
- tinues with what follows, but if there is no subsequent match, causing
- a backtrack to the verb, a failure is forced. That is, backtracking
- cannot pass to the left of the verb. However, when one of these verbs
+ tinues with what follows, but if there is no subsequent match, causing
+ a backtrack to the verb, a failure is forced. That is, backtracking
+ cannot pass to the left of the verb. However, when one of these verbs
appears inside an atomic group or an assertion that is true, its effect
- is confined to that group, because once the group has been matched,
- there is never any backtracking into it. In this situation, backtrack-
- ing can "jump back" to the left of the entire atomic group or asser-
- tion. (Remember also, as stated above, that this localization also
+ is confined to that group, because once the group has been matched,
+ there is never any backtracking into it. In this situation, backtrack-
+ ing can "jump back" to the left of the entire atomic group or asser-
+ tion. (Remember also, as stated above, that this localization also
applies in subroutine calls.)
- These verbs differ in exactly what kind of failure occurs when back-
- tracking reaches them. The behaviour described below is what happens
- when the verb is not in a subroutine or an assertion. Subsequent sec-
+ These verbs differ in exactly what kind of failure occurs when back-
+ tracking reaches them. The behaviour described below is what happens
+ when the verb is not in a subroutine or an assertion. Subsequent sec-
tions cover these special cases.
(*COMMIT)
- This verb, which may not be followed by a name, causes the whole match
+ This verb, which may not be followed by a name, causes the whole match
to fail outright if there is a later matching failure that causes back-
- tracking to reach it. Even if the pattern is unanchored, no further
+ tracking to reach it. Even if the pattern is unanchored, no further
attempts to find a match by advancing the starting point take place. If
- (*COMMIT) is the only backtracking verb that is encountered, once it
+ (*COMMIT) is the only backtracking verb that is encountered, once it
has been passed pcre_exec() is committed to finding a match at the cur-
rent starting point, or not at all. For example:
a+(*COMMIT)b
- This matches "xxaab" but not "aacaab". It can be thought of as a kind
+ This matches "xxaab" but not "aacaab". It can be thought of as a kind
of dynamic anchor, or "I've started, so I must finish." The name of the
- most recently passed (*MARK) in the path is passed back when (*COMMIT)
+ most recently passed (*MARK) in the path is passed back when (*COMMIT)
forces a match failure.
- If there is more than one backtracking verb in a pattern, a different
- one that follows (*COMMIT) may be triggered first, so merely passing
+ If there is more than one backtracking verb in a pattern, a different
+ one that follows (*COMMIT) may be triggered first, so merely passing
(*COMMIT) during a match does not always guarantee that a match must be
at this starting point.
- Note that (*COMMIT) at the start of a pattern is not the same as an
- anchor, unless PCRE's start-of-match optimizations are turned off, as
+ Note that (*COMMIT) at the start of a pattern is not the same as an
+ anchor, unless PCRE's start-of-match optimizations are turned off, as
shown in this output from pcretest:
re> /(*COMMIT)abc/
@@ -7455,207 +7460,207 @@ BACKTRACKING CONTROL
For this pattern, PCRE knows that any match must start with "a", so the
optimization skips along the subject to "a" before applying the pattern
- to the first set of data. The match attempt then succeeds. In the sec-
- ond set of data, the escape sequence \Y is interpreted by the pcretest
- program. It causes the PCRE_NO_START_OPTIMIZE option to be set when
+ to the first set of data. The match attempt then succeeds. In the sec-
+ ond set of data, the escape sequence \Y is interpreted by the pcretest
+ program. It causes the PCRE_NO_START_OPTIMIZE option to be set when
pcre_exec() is called. This disables the optimization that skips along
to the first character. The pattern is now applied starting at "x", and
- so the (*COMMIT) causes the match to fail without trying any other
+ so the (*COMMIT) causes the match to fail without trying any other
starting points.
(*PRUNE) or (*PRUNE:NAME)
- This verb causes the match to fail at the current starting position in
+ This verb causes the match to fail at the current starting position in
the subject if there is a later matching failure that causes backtrack-
- ing to reach it. If the pattern is unanchored, the normal "bumpalong"
- advance to the next starting character then happens. Backtracking can
- occur as usual to the left of (*PRUNE), before it is reached, or when
- matching to the right of (*PRUNE), but if there is no match to the
- right, backtracking cannot cross (*PRUNE). In simple cases, the use of
- (*PRUNE) is just an alternative to an atomic group or possessive quan-
+ ing to reach it. If the pattern is unanchored, the normal "bumpalong"
+ advance to the next starting character then happens. Backtracking can
+ occur as usual to the left of (*PRUNE), before it is reached, or when
+ matching to the right of (*PRUNE), but if there is no match to the
+ right, backtracking cannot cross (*PRUNE). In simple cases, the use of
+ (*PRUNE) is just an alternative to an atomic group or possessive quan-
tifier, but there are some uses of (*PRUNE) that cannot be expressed in
- any other way. In an anchored pattern (*PRUNE) has the same effect as
+ any other way. In an anchored pattern (*PRUNE) has the same effect as
(*COMMIT).
The behaviour of (*PRUNE:NAME) is the not the same as
- (*MARK:NAME)(*PRUNE). It is like (*MARK:NAME) in that the name is
- remembered for passing back to the caller. However, (*SKIP:NAME)
+ (*MARK:NAME)(*PRUNE). It is like (*MARK:NAME) in that the name is
+ remembered for passing back to the caller. However, (*SKIP:NAME)
searches only for names set with (*MARK).
(*SKIP)
- This verb, when given without a name, is like (*PRUNE), except that if
- the pattern is unanchored, the "bumpalong" advance is not to the next
+ This verb, when given without a name, is like (*PRUNE), except that if
+ the pattern is unanchored, the "bumpalong" advance is not to the next
character, but to the position in the subject where (*SKIP) was encoun-
- tered. (*SKIP) signifies that whatever text was matched leading up to
+ tered. (*SKIP) signifies that whatever text was matched leading up to
it cannot be part of a successful match. Consider:
a+(*SKIP)b
- If the subject is "aaaac...", after the first match attempt fails
- (starting at the first character in the string), the starting point
+ If the subject is "aaaac...", after the first match attempt fails
+ (starting at the first character in the string), the starting point
skips on to start the next attempt at "c". Note that a possessive quan-
- tifer does not have the same effect as this example; although it would
- suppress backtracking during the first match attempt, the second
- attempt would start at the second character instead of skipping on to
+ tifer does not have the same effect as this example; although it would
+ suppress backtracking during the first match attempt, the second
+ attempt would start at the second character instead of skipping on to
"c".
(*SKIP:NAME)
When (*SKIP) has an associated name, its behaviour is modified. When it
is triggered, the previous path through the pattern is searched for the
- most recent (*MARK) that has the same name. If one is found, the
+ most recent (*MARK) that has the same name. If one is found, the
"bumpalong" advance is to the subject position that corresponds to that
(*MARK) instead of to where (*SKIP) was encountered. If no (*MARK) with
a matching name is found, the (*SKIP) is ignored.
- Note that (*SKIP:NAME) searches only for names set by (*MARK:NAME). It
+ Note that (*SKIP:NAME) searches only for names set by (*MARK:NAME). It
ignores names that are set by (*PRUNE:NAME) or (*THEN:NAME).
(*THEN) or (*THEN:NAME)
- This verb causes a skip to the next innermost alternative when back-
- tracking reaches it. That is, it cancels any further backtracking
- within the current alternative. Its name comes from the observation
+ This verb causes a skip to the next innermost alternative when back-
+ tracking reaches it. That is, it cancels any further backtracking
+ within the current alternative. Its name comes from the observation
that it can be used for a pattern-based if-then-else block:
( COND1 (*THEN) FOO | COND2 (*THEN) BAR | COND3 (*THEN) BAZ ) ...
- If the COND1 pattern matches, FOO is tried (and possibly further items
- after the end of the group if FOO succeeds); on failure, the matcher
- skips to the second alternative and tries COND2, without backtracking
- into COND1. If that succeeds and BAR fails, COND3 is tried. If subse-
- quently BAZ fails, there are no more alternatives, so there is a back-
- track to whatever came before the entire group. If (*THEN) is not
+ If the COND1 pattern matches, FOO is tried (and possibly further items
+ after the end of the group if FOO succeeds); on failure, the matcher
+ skips to the second alternative and tries COND2, without backtracking
+ into COND1. If that succeeds and BAR fails, COND3 is tried. If subse-
+ quently BAZ fails, there are no more alternatives, so there is a back-
+ track to whatever came before the entire group. If (*THEN) is not
inside an alternation, it acts like (*PRUNE).
- The behaviour of (*THEN:NAME) is the not the same as
- (*MARK:NAME)(*THEN). It is like (*MARK:NAME) in that the name is
- remembered for passing back to the caller. However, (*SKIP:NAME)
+ The behaviour of (*THEN:NAME) is the not the same as
+ (*MARK:NAME)(*THEN). It is like (*MARK:NAME) in that the name is
+ remembered for passing back to the caller. However, (*SKIP:NAME)
searches only for names set with (*MARK).
- A subpattern that does not contain a | character is just a part of the
- enclosing alternative; it is not a nested alternation with only one
- alternative. The effect of (*THEN) extends beyond such a subpattern to
- the enclosing alternative. Consider this pattern, where A, B, etc. are
- complex pattern fragments that do not contain any | characters at this
+ A subpattern that does not contain a | character is just a part of the
+ enclosing alternative; it is not a nested alternation with only one
+ alternative. The effect of (*THEN) extends beyond such a subpattern to
+ the enclosing alternative. Consider this pattern, where A, B, etc. are
+ complex pattern fragments that do not contain any | characters at this
level:
A (B(*THEN)C) | D
- If A and B are matched, but there is a failure in C, matching does not
+ If A and B are matched, but there is a failure in C, matching does not
backtrack into A; instead it moves to the next alternative, that is, D.
- However, if the subpattern containing (*THEN) is given an alternative,
+ However, if the subpattern containing (*THEN) is given an alternative,
it behaves differently:
A (B(*THEN)C | (*FAIL)) | D
- The effect of (*THEN) is now confined to the inner subpattern. After a
+ The effect of (*THEN) is now confined to the inner subpattern. After a
failure in C, matching moves to (*FAIL), which causes the whole subpat-
- tern to fail because there are no more alternatives to try. In this
+ tern to fail because there are no more alternatives to try. In this
case, matching does now backtrack into A.
- Note that a conditional subpattern is not considered as having two
- alternatives, because only one is ever used. In other words, the |
+ Note that a conditional subpattern is not considered as having two
+ alternatives, because only one is ever used. In other words, the |
character in a conditional subpattern has a different meaning. Ignoring
white space, consider:
^.*? (?(?=a) a | b(*THEN)c )
- If the subject is "ba", this pattern does not match. Because .*? is
- ungreedy, it initially matches zero characters. The condition (?=a)
- then fails, the character "b" is matched, but "c" is not. At this
- point, matching does not backtrack to .*? as might perhaps be expected
- from the presence of the | character. The conditional subpattern is
+ If the subject is "ba", this pattern does not match. Because .*? is
+ ungreedy, it initially matches zero characters. The condition (?=a)
+ then fails, the character "b" is matched, but "c" is not. At this
+ point, matching does not backtrack to .*? as might perhaps be expected
+ from the presence of the | character. The conditional subpattern is
part of the single alternative that comprises the whole pattern, and so
- the match fails. (If there was a backtrack into .*?, allowing it to
+ the match fails. (If there was a backtrack into .*?, allowing it to
match "b", the match would succeed.)
- The verbs just described provide four different "strengths" of control
+ The verbs just described provide four different "strengths" of control
when subsequent matching fails. (*THEN) is the weakest, carrying on the
- match at the next alternative. (*PRUNE) comes next, failing the match
- at the current starting position, but allowing an advance to the next
- character (for an unanchored pattern). (*SKIP) is similar, except that
+ match at the next alternative. (*PRUNE) comes next, failing the match
+ at the current starting position, but allowing an advance to the next
+ character (for an unanchored pattern). (*SKIP) is similar, except that
the advance may be more than one character. (*COMMIT) is the strongest,
causing the entire match to fail.
More than one backtracking verb
- If more than one backtracking verb is present in a pattern, the one
- that is backtracked onto first acts. For example, consider this pat-
+ If more than one backtracking verb is present in a pattern, the one
+ that is backtracked onto first acts. For example, consider this pat-
tern, where A, B, etc. are complex pattern fragments:
(A(*COMMIT)B(*THEN)C|ABD)
- If A matches but B fails, the backtrack to (*COMMIT) causes the entire
+ If A matches but B fails, the backtrack to (*COMMIT) causes the entire
match to fail. However, if A and B match, but C fails, the backtrack to
- (*THEN) causes the next alternative (ABD) to be tried. This behaviour
- is consistent, but is not always the same as Perl's. It means that if
- two or more backtracking verbs appear in succession, all the the last
+ (*THEN) causes the next alternative (ABD) to be tried. This behaviour
+ is consistent, but is not always the same as Perl's. It means that if
+ two or more backtracking verbs appear in succession, all the the last
of them has no effect. Consider this example:
...(*COMMIT)(*PRUNE)...
If there is a matching failure to the right, backtracking onto (*PRUNE)
- causes it to be triggered, and its action is taken. There can never be
+ causes it to be triggered, and its action is taken. There can never be
a backtrack onto (*COMMIT).
Backtracking verbs in repeated groups
- PCRE differs from Perl in its handling of backtracking verbs in
+ PCRE differs from Perl in its handling of backtracking verbs in
repeated groups. For example, consider:
/(a(*COMMIT)b)+ac/
- If the subject is "abac", Perl matches, but PCRE fails because the
+ If the subject is "abac", Perl matches, but PCRE fails because the
(*COMMIT) in the second repeat of the group acts.
Backtracking verbs in assertions
- (*FAIL) in an assertion has its normal effect: it forces an immediate
+ (*FAIL) in an assertion has its normal effect: it forces an immediate
backtrack.
(*ACCEPT) in a positive assertion causes the assertion to succeed with-
- out any further processing. In a negative assertion, (*ACCEPT) causes
+ out any further processing. In a negative assertion, (*ACCEPT) causes
the assertion to fail without any further processing.
- The other backtracking verbs are not treated specially if they appear
- in a positive assertion. In particular, (*THEN) skips to the next
- alternative in the innermost enclosing group that has alternations,
+ The other backtracking verbs are not treated specially if they appear
+ in a positive assertion. In particular, (*THEN) skips to the next
+ alternative in the innermost enclosing group that has alternations,
whether or not this is within the assertion.
- Negative assertions are, however, different, in order to ensure that
- changing a positive assertion into a negative assertion changes its
+ Negative assertions are, however, different, in order to ensure that
+ changing a positive assertion into a negative assertion changes its
result. Backtracking into (*COMMIT), (*SKIP), or (*PRUNE) causes a neg-
ative assertion to be true, without considering any further alternative
branches in the assertion. Backtracking into (*THEN) causes it to skip
- to the next enclosing alternative within the assertion (the normal be-
- haviour), but if the assertion does not have such an alternative,
+ to the next enclosing alternative within the assertion (the normal be-
+ haviour), but if the assertion does not have such an alternative,
(*THEN) behaves like (*PRUNE).
Backtracking verbs in subroutines
- These behaviours occur whether or not the subpattern is called recur-
+ These behaviours occur whether or not the subpattern is called recur-
sively. Perl's treatment of subroutines is different in some cases.
- (*FAIL) in a subpattern called as a subroutine has its normal effect:
+ (*FAIL) in a subpattern called as a subroutine has its normal effect:
it forces an immediate backtrack.
- (*ACCEPT) in a subpattern called as a subroutine causes the subroutine
- match to succeed without any further processing. Matching then contin-
+ (*ACCEPT) in a subpattern called as a subroutine causes the subroutine
+ match to succeed without any further processing. Matching then contin-
ues after the subroutine call.
(*COMMIT), (*SKIP), and (*PRUNE) in a subpattern called as a subroutine
cause the subroutine match to fail.
- (*THEN) skips to the next alternative in the innermost enclosing group
- within the subpattern that has alternatives. If there is no such group
+ (*THEN) skips to the next alternative in the innermost enclosing group
+ within the subpattern that has alternatives. If there is no such group
within the subpattern, (*THEN) causes the subroutine match to fail.
SEE ALSO
- pcreapi(3), pcrecallout(3), pcrematching(3), pcresyntax(3), pcre(3),
+ pcreapi(3), pcrecallout(3), pcrematching(3), pcresyntax(3), pcre(3),
pcre16(3), pcre32(3).
@@ -7668,8 +7673,8 @@ AUTHOR
REVISION
- Last updated: 14 June 2015
- Copyright (c) 1997-2015 University of Cambridge.
+ Last updated: 23 October 2016
+ Copyright (c) 1997-2016 University of Cambridge.
------------------------------------------------------------------------------
diff --git a/pcre/doc/pcrecompat.3 b/pcre/doc/pcrecompat.3
index 0cc40198235..6156e776f53 100644
--- a/pcre/doc/pcrecompat.3
+++ b/pcre/doc/pcrecompat.3
@@ -113,7 +113,7 @@ the pattern /^(a(b)?)+$/ in Perl leaves $2 unset, but in PCRE it is set to "b".
14. PCRE's handling of duplicate subpattern numbers and duplicate subpattern
names is not as general as Perl's. This is a consequence of the fact the PCRE
works internally just with numbers, using an external table to translate
-between numbers and names. In particular, a pattern such as (?|(?<a>A)|(?<b)B),
+between numbers and names. In particular, a pattern such as (?|(?<a>A)|(?<b>B),
where the two capturing parentheses have the same number but different names,
is not supported, and causes an error at compile time. If it were allowed, it
would not be possible to distinguish which parentheses matched, because both
diff --git a/pcre/doc/pcrepattern.3 b/pcre/doc/pcrepattern.3
index 3b8c6393d21..97df217fdb2 100644
--- a/pcre/doc/pcrepattern.3
+++ b/pcre/doc/pcrepattern.3
@@ -1,4 +1,4 @@
-.TH PCREPATTERN 3 "14 June 2015" "PCRE 8.38"
+.TH PCREPATTERN 3 "23 October 2016" "PCRE 8.40"
.SH NAME
PCRE - Perl-compatible regular expressions
.SH "PCRE REGULAR EXPRESSION DETAILS"
@@ -336,22 +336,22 @@ When PCRE is compiled in EBCDIC mode, \ea, \ee, \ef, \en, \er, and \et
generate the appropriate EBCDIC code values. The \ec escape is processed
as specified for Perl in the \fBperlebcdic\fP document. The only characters
that are allowed after \ec are A-Z, a-z, or one of @, [, \e, ], ^, _, or ?. Any
-other character provokes a compile-time error. The sequence \e@ encodes
-character code 0; the letters (in either case) encode characters 1-26 (hex 01
-to hex 1A); [, \e, ], ^, and _ encode characters 27-31 (hex 1B to hex 1F), and
-\e? becomes either 255 (hex FF) or 95 (hex 5F).
+other character provokes a compile-time error. The sequence \ec@ encodes
+character code 0; after \ec the letters (in either case) encode characters 1-26
+(hex 01 to hex 1A); [, \e, ], ^, and _ encode characters 27-31 (hex 1B to hex
+1F), and \ec? becomes either 255 (hex FF) or 95 (hex 5F).
.P
-Thus, apart from \e?, these escapes generate the same character code values as
+Thus, apart from \ec?, these escapes generate the same character code values as
they do in an ASCII environment, though the meanings of the values mostly
-differ. For example, \eG always generates code value 7, which is BEL in ASCII
+differ. For example, \ecG always generates code value 7, which is BEL in ASCII
but DEL in EBCDIC.
.P
-The sequence \e? generates DEL (127, hex 7F) in an ASCII environment, but
+The sequence \ec? generates DEL (127, hex 7F) in an ASCII environment, but
because 127 is not a control character in EBCDIC, Perl makes it generate the
APC character. Unfortunately, there are several variants of EBCDIC. In most of
them the APC character has the value 255 (hex FF), but in the one Perl calls
POSIX-BC its value is 95 (hex 5F). If certain other characters have POSIX-BC
-values, PCRE makes \e? generate 95; otherwise it generates 255.
+values, PCRE makes \ec? generate 95; otherwise it generates 255.
.P
After \e0 up to two further octal digits are read. If there are fewer than two
digits, just those that are present are used. Thus the sequence \e0\ex\e015
@@ -1511,12 +1511,8 @@ J, U and X respectively.
.P
When one of these option changes occurs at top level (that is, not inside
subpattern parentheses), the change applies to the remainder of the pattern
-that follows. If the change is placed right at the start of a pattern, PCRE
-extracts it into the global options (and it will therefore show up in data
-extracted by the \fBpcre_fullinfo()\fP function).
-.P
-An option change within a subpattern (see below for a description of
-subpatterns) affects only that part of the subpattern that follows it, so
+that follows. An option change within a subpattern (see below for a description
+of subpatterns) affects only that part of the subpattern that follows it, so
.sp
(a(?i)b)c
.sp
@@ -2171,6 +2167,13 @@ numbering the capturing subpatterns in the whole pattern. However, substring
capturing is carried out only for positive assertions. (Perl sometimes, but not
always, does do capturing in negative assertions.)
.P
+WARNING: If a positive assertion containing one or more capturing subpatterns
+succeeds, but failure to match later in the pattern causes backtracking over
+this assertion, the captures within the assertion are reset only if no higher
+numbered captures are already set. This is, unfortunately, a fundamental
+limitation of the current implementation, and as PCRE1 is now in
+maintenance-only status, it is unlikely ever to change.
+.P
For compatibility with Perl, assertion subpatterns may be repeated; though
it makes no sense to assert the same thing several times, the side effect of
capturing parentheses may occasionally be useful. In practice, there only three
@@ -3296,6 +3299,6 @@ Cambridge CB2 3QH, England.
.rs
.sp
.nf
-Last updated: 14 June 2015
-Copyright (c) 1997-2015 University of Cambridge.
+Last updated: 23 October 2016
+Copyright (c) 1997-2016 University of Cambridge.
.fi
diff --git a/pcre/pcre_compile.c b/pcre/pcre_compile.c
index 7cd39501230..de92313e2f8 100644
--- a/pcre/pcre_compile.c
+++ b/pcre/pcre_compile.c
@@ -5579,6 +5579,34 @@ for (;; ptr++)
#endif
#if defined SUPPORT_UTF || !defined COMPILE_PCRE8
{
+ /* For non-UCP wide characters, in a non-negative class containing \S or
+ similar (should_flip_negation is set), all characters greater than 255
+ must be in the class. */
+
+ if (
+#if defined COMPILE_PCRE8
+ utf &&
+#endif
+ should_flip_negation && !negate_class && (options & PCRE_UCP) == 0)
+ {
+ *class_uchardata++ = XCL_RANGE;
+ if (utf) /* Will always be utf in the 8-bit library */
+ {
+ class_uchardata += PRIV(ord2utf)(0x100, class_uchardata);
+ class_uchardata += PRIV(ord2utf)(0x10ffff, class_uchardata);
+ }
+ else /* Can only happen for the 16-bit & 32-bit libraries */
+ {
+#if defined COMPILE_PCRE16
+ *class_uchardata++ = 0x100;
+ *class_uchardata++ = 0xffffu;
+#elif defined COMPILE_PCRE32
+ *class_uchardata++ = 0x100;
+ *class_uchardata++ = 0xffffffffu;
+#endif
+ }
+ }
+
*class_uchardata++ = XCL_END; /* Marks the end of extra data */
*code++ = OP_XCLASS;
code += LINK_SIZE;
@@ -6923,7 +6951,8 @@ for (;; ptr++)
slot = cd->name_table;
for (i = 0; i < cd->names_found; i++)
{
- if (STRNCMP_UC_UC(name, slot+IMM2_SIZE, namelen) == 0) break;
+ if (STRNCMP_UC_UC(name, slot+IMM2_SIZE, namelen) == 0 &&
+ slot[IMM2_SIZE+namelen] == 0) break;
slot += cd->name_entry_size;
}
@@ -7889,15 +7918,17 @@ for (;; ptr++)
}
}
- /* For a forward assertion, we take the reqchar, if set. This can be
- helpful if the pattern that follows the assertion doesn't set a different
- char. For example, it's useful for /(?=abcde).+/. We can't set firstchar
- for an assertion, however because it leads to incorrect effect for patterns
- such as /(?=a)a.+/ when the "real" "a" would then become a reqchar instead
- of a firstchar. This is overcome by a scan at the end if there's no
- firstchar, looking for an asserted first char. */
-
- else if (bravalue == OP_ASSERT && subreqcharflags >= 0)
+ /* For a forward assertion, we take the reqchar, if set, provided that the
+ group has also set a first char. This can be helpful if the pattern that
+ follows the assertion doesn't set a different char. For example, it's
+ useful for /(?=abcde).+/. We can't set firstchar for an assertion, however
+ because it leads to incorrect effect for patterns such as /(?=a)a.+/ when
+ the "real" "a" would then become a reqchar instead of a firstchar. This is
+ overcome by a scan at the end if there's no firstchar, looking for an
+ asserted first char. */
+
+ else if (bravalue == OP_ASSERT && subreqcharflags >= 0 &&
+ subfirstcharflags >= 0)
{
reqchar = subreqchar;
reqcharflags = subreqcharflags;
@@ -8686,8 +8717,8 @@ matching and for non-DOTALL patterns that start with .* (which must start at
the beginning or after \n). As in the case of is_anchored() (see above), we
have to take account of back references to capturing brackets that contain .*
because in that case we can't make the assumption. Also, the appearance of .*
-inside atomic brackets or in a pattern that contains *PRUNE or *SKIP does not
-count, because once again the assumption no longer holds.
+inside atomic brackets or in an assertion, or in a pattern that contains *PRUNE
+or *SKIP does not count, because once again the assumption no longer holds.
Arguments:
code points to start of expression (the bracket)
@@ -8696,13 +8727,14 @@ Arguments:
the less precise approach
cd points to the compile data
atomcount atomic group level
+ inassert TRUE if in an assertion
Returns: TRUE or FALSE
*/
static BOOL
is_startline(const pcre_uchar *code, unsigned int bracket_map,
- compile_data *cd, int atomcount)
+ compile_data *cd, int atomcount, BOOL inassert)
{
do {
const pcre_uchar *scode = first_significant_code(
@@ -8729,7 +8761,7 @@ do {
return FALSE;
default: /* Assertion */
- if (!is_startline(scode, bracket_map, cd, atomcount)) return FALSE;
+ if (!is_startline(scode, bracket_map, cd, atomcount, TRUE)) return FALSE;
do scode += GET(scode, 1); while (*scode == OP_ALT);
scode += 1 + LINK_SIZE;
break;
@@ -8743,7 +8775,7 @@ do {
if (op == OP_BRA || op == OP_BRAPOS ||
op == OP_SBRA || op == OP_SBRAPOS)
{
- if (!is_startline(scode, bracket_map, cd, atomcount)) return FALSE;
+ if (!is_startline(scode, bracket_map, cd, atomcount, inassert)) return FALSE;
}
/* Capturing brackets */
@@ -8753,33 +8785,33 @@ do {
{
int n = GET2(scode, 1+LINK_SIZE);
int new_map = bracket_map | ((n < 32)? (1 << n) : 1);
- if (!is_startline(scode, new_map, cd, atomcount)) return FALSE;
+ if (!is_startline(scode, new_map, cd, atomcount, inassert)) return FALSE;
}
/* Positive forward assertions */
else if (op == OP_ASSERT)
{
- if (!is_startline(scode, bracket_map, cd, atomcount)) return FALSE;
+ if (!is_startline(scode, bracket_map, cd, atomcount, TRUE)) return FALSE;
}
/* Atomic brackets */
else if (op == OP_ONCE || op == OP_ONCE_NC)
{
- if (!is_startline(scode, bracket_map, cd, atomcount + 1)) return FALSE;
+ if (!is_startline(scode, bracket_map, cd, atomcount + 1, inassert)) return FALSE;
}
/* .* means "start at start or after \n" if it isn't in atomic brackets or
- brackets that may be referenced, as long as the pattern does not contain
- *PRUNE or *SKIP, because these break the feature. Consider, for example,
- /.*?a(*PRUNE)b/ with the subject "aab", which matches "ab", i.e. not at the
- start of a line. */
+ brackets that may be referenced or an assertion, as long as the pattern does
+ not contain *PRUNE or *SKIP, because these break the feature. Consider, for
+ example, /.*?a(*PRUNE)b/ with the subject "aab", which matches "ab", i.e.
+ not at the start of a line. */
else if (op == OP_TYPESTAR || op == OP_TYPEMINSTAR || op == OP_TYPEPOSSTAR)
{
if (scode[1] != OP_ANY || (bracket_map & cd->backref_map) != 0 ||
- atomcount > 0 || cd->had_pruneorskip)
+ atomcount > 0 || cd->had_pruneorskip || inassert)
return FALSE;
}
@@ -9634,7 +9666,7 @@ if ((re->options & PCRE_ANCHORED) == 0)
re->flags |= PCRE_FIRSTSET;
}
- else if (is_startline(codestart, 0, cd, 0)) re->flags |= PCRE_STARTLINE;
+ else if (is_startline(codestart, 0, cd, 0, FALSE)) re->flags |= PCRE_STARTLINE;
}
}
diff --git a/pcre/pcre_jit_compile.c b/pcre/pcre_jit_compile.c
index 4f15a27ac28..46ce6c65d54 100644
--- a/pcre/pcre_jit_compile.c
+++ b/pcre/pcre_jit_compile.c
@@ -4004,12 +4004,12 @@ sljit_emit_op_custom(compiler, instruction, 4);
if (load_twice)
{
- OP1(SLJIT_MOV, TMP3, 0, TMP2, 0);
+ OP1(SLJIT_MOV, RETURN_ADDR, 0, TMP2, 0);
instruction[3] = 0xc0 | (tmp2_ind << 3) | 1;
sljit_emit_op_custom(compiler, instruction, 4);
OP2(SLJIT_OR, TMP1, 0, TMP1, 0, TMP2, 0);
- OP1(SLJIT_MOV, TMP2, 0, TMP3, 0);
+ OP1(SLJIT_MOV, TMP2, 0, RETURN_ADDR, 0);
}
OP2(SLJIT_ASHR, TMP1, 0, TMP1, 0, TMP2, 0);
diff --git a/pcre/pcre_jit_test.c b/pcre/pcre_jit_test.c
index 9b61ec000fa..034cb52697f 100644
--- a/pcre/pcre_jit_test.c
+++ b/pcre/pcre_jit_test.c
@@ -687,6 +687,7 @@ static struct regression_test_case regression_test_cases[] = {
{ PCRE_FIRSTLINE | PCRE_NEWLINE_LF | PCRE_DOTALL, 0 | F_NOMATCH, "ab.", "ab" },
{ MUA | PCRE_FIRSTLINE, 1 | F_NOMATCH, "^[a-d0-9]", "\nxx\nd" },
{ PCRE_NEWLINE_ANY | PCRE_FIRSTLINE | PCRE_DOTALL, 0, "....a", "012\n0a" },
+ { MUA | PCRE_FIRSTLINE, 0, "[aC]", "a" },
/* Recurse. */
{ MUA, 0, "(a)(?1)", "aa" },
diff --git a/pcre/pcregrep.c b/pcre/pcregrep.c
index cd53c648da2..fd2a67622ba 100644
--- a/pcre/pcregrep.c
+++ b/pcre/pcregrep.c
@@ -1803,6 +1803,12 @@ while (ptr < endptr)
match = FALSE;
if (line_buffered) fflush(stdout);
rc = 0; /* Had some success */
+
+ /* If the current match ended past the end of the line (only possible
+ in multiline mode), we are done with this line. */
+
+ if ((unsigned int)offsets[1] > linelength) goto END_ONE_MATCH;
+
startoffset = offsets[1]; /* Restart after the match */
if (startoffset <= oldstartoffset)
{
diff --git a/pcre/pcretest.c b/pcre/pcretest.c
index 78ef5177df7..5b73a918075 100644
--- a/pcre/pcretest.c
+++ b/pcre/pcretest.c
@@ -1982,6 +1982,7 @@ return(result);
static int pchar(pcre_uint32 c, FILE *f)
{
int n = 0;
+char tempbuffer[16];
if (PRINTOK(c))
{
if (f != NULL) fprintf(f, "%c", c);
@@ -2003,6 +2004,8 @@ if (c < 0x100)
}
if (f != NULL) n = fprintf(f, "\\x{%02x}", c);
+ else n = sprintf(tempbuffer, "\\x{%02x}", c);
+
return n >= 0 ? n : 0;
}
@@ -5042,7 +5045,7 @@ while (!done)
if ((all_use_dfa || use_dfa) && find_match_limit)
{
- printf("**Match limit not relevant for DFA matching: ignored\n");
+ printf("** Match limit not relevant for DFA matching: ignored\n");
find_match_limit = 0;
}
@@ -5255,10 +5258,17 @@ while (!done)
if (do_allcaps)
{
- if (new_info(re, NULL, PCRE_INFO_CAPTURECOUNT, &count) < 0)
- goto SKIP_DATA;
- count++; /* Allow for full match */
- if (count * 2 > use_size_offsets) count = use_size_offsets/2;
+ if (all_use_dfa || use_dfa)
+ {
+ fprintf(outfile, "** Show all captures ignored after DFA matching\n");
+ }
+ else
+ {
+ if (new_info(re, NULL, PCRE_INFO_CAPTURECOUNT, &count) < 0)
+ goto SKIP_DATA;
+ count++; /* Allow for full match */
+ if (count * 2 > use_size_offsets) count = use_size_offsets/2;
+ }
}
/* Output the captured substrings. Note that, for the matched string,
diff --git a/pcre/testdata/testinput1 b/pcre/testdata/testinput1
index 8379ce04d5b..93abab3c851 100644
--- a/pcre/testdata/testinput1
+++ b/pcre/testdata/testinput1
@@ -5733,4 +5733,10 @@ AbcdCBefgBhiBqz
"(?|(\k'Pm')|(?'Pm'))"
abcd
+/(?=.*[A-Z])(?=.*[a-z])(?=.*[0-9])(?=.*[,;:])(?=.{8,16})(?!.*[\s])/
+ \ Fred:099
+
+/(?=.*X)X$/
+ \ X
+
/-- End of testinput1 --/
diff --git a/pcre/testdata/testinput16 b/pcre/testdata/testinput16
index 15419e63fa6..7ccde0a8c80 100644
--- a/pcre/testdata/testinput16
+++ b/pcre/testdata/testinput16
@@ -38,4 +38,30 @@
/s+/i8SI
SSss\x{17f}
+/[\W\p{Any}]/BZ
+ abc
+ 123
+
+/[\W\pL]/BZ
+ abc
+ ** Failers
+ 123
+
+/[\D]/8
+ \x{1d7cf}
+
+/[\D\P{Nd}]/8
+ \x{1d7cf}
+
+/[^\D]/8
+ a9b
+ ** Failers
+ \x{1d7cf}
+
+/[^\D\P{Nd}]/8
+ a9b
+ \x{1d7cf}
+ ** Failers
+ \x{10000}
+
/-- End of testinput16 --/
diff --git a/pcre/testdata/testinput19 b/pcre/testdata/testinput19
index ce45afcb595..dfe8c7befb6 100644
--- a/pcre/testdata/testinput19
+++ b/pcre/testdata/testinput19
@@ -25,4 +25,21 @@
/s+/i8SI
SSss\x{17f}
+/[\D]/8
+ \x{1d7cf}
+
+/[\D\P{Nd}]/8
+ \x{1d7cf}
+
+/[^\D]/8
+ a9b
+ ** Failers
+ \x{1d7cf}
+
+/[^\D\P{Nd}]/8
+ a9b
+ \x{1d7cf}
+ ** Failers
+ \x{10000}
+
/-- End of testinput19 --/
diff --git a/pcre/testdata/testinput2 b/pcre/testdata/testinput2
index 75e402ee9b3..08c6f39a565 100644
--- a/pcre/testdata/testinput2
+++ b/pcre/testdata/testinput2
@@ -4243,4 +4243,10 @@ backtracking verbs. --/
/\N(?(?C)0?!.)*/
+/(?<RA>abc)(?(R)xyz)/BZ
+
+/(?<R>abc)(?(R)xyz)/BZ
+
+/(?=.*[A-Z])/I
+
/-- End of testinput2 --/
diff --git a/pcre/testdata/testinput6 b/pcre/testdata/testinput6
index a178d3d67b4..22ed1e64d57 100644
--- a/pcre/testdata/testinput6
+++ b/pcre/testdata/testinput6
@@ -1562,4 +1562,10 @@
\x{389}
\x{20ac}
+/(?=.*b)\pL/
+ 11bb
+
+/(?(?=.*b)(?=.*b)\pL|.*c)/
+ 11bb
+
/-- End of testinput6 --/
diff --git a/pcre/testdata/testinput7 b/pcre/testdata/testinput7
index 00b9738a371..f44a810f0f2 100644
--- a/pcre/testdata/testinput7
+++ b/pcre/testdata/testinput7
@@ -838,15 +838,6 @@ of case for anything other than the ASCII letters. --/
/^s?c/mi8I
scat
-/[\W\p{Any}]/BZ
- abc
- 123
-
-/[\W\pL]/BZ
- abc
- ** Failers
- 123
-
/a[[:punct:]b]/WBZ
/a[[:punct:]b]/8WBZ
diff --git a/pcre/testdata/testinput8 b/pcre/testdata/testinput8
index 931dd717e74..7f8fa8292c5 100644
--- a/pcre/testdata/testinput8
+++ b/pcre/testdata/testinput8
@@ -4841,4 +4841,8 @@
bbb
aaa
+/()()a+/O=
+ aaa\D
+ a\D
+
/-- End of testinput8 --/
diff --git a/pcre/testdata/testoutput1 b/pcre/testdata/testoutput1
index e852ab9544c..a2b3cffe9d4 100644
--- a/pcre/testdata/testoutput1
+++ b/pcre/testdata/testoutput1
@@ -9434,4 +9434,12 @@ No match
0:
1:
+/(?=.*[A-Z])(?=.*[a-z])(?=.*[0-9])(?=.*[,;:])(?=.{8,16})(?!.*[\s])/
+ \ Fred:099
+ 0:
+
+/(?=.*X)X$/
+ \ X
+ 0: X
+
/-- End of testinput1 --/
diff --git a/pcre/testdata/testoutput16 b/pcre/testdata/testoutput16
index fd184cdbeee..e6ba26acfd4 100644
--- a/pcre/testdata/testoutput16
+++ b/pcre/testdata/testoutput16
@@ -138,4 +138,56 @@ Starting chars: S s \xc5
SSss\x{17f}
0: SSss\x{17f}
+/[\W\p{Any}]/BZ
+------------------------------------------------------------------
+ Bra
+ [\x00-/:-@[-^`{-\xff\p{Any}]
+ Ket
+ End
+------------------------------------------------------------------
+ abc
+ 0: a
+ 123
+ 0: 1
+
+/[\W\pL]/BZ
+------------------------------------------------------------------
+ Bra
+ [\x00-/:-@[-^`{-\xff\p{L}]
+ Ket
+ End
+------------------------------------------------------------------
+ abc
+ 0: a
+ ** Failers
+ 0: *
+ 123
+No match
+
+/[\D]/8
+ \x{1d7cf}
+ 0: \x{1d7cf}
+
+/[\D\P{Nd}]/8
+ \x{1d7cf}
+ 0: \x{1d7cf}
+
+/[^\D]/8
+ a9b
+ 0: 9
+ ** Failers
+No match
+ \x{1d7cf}
+No match
+
+/[^\D\P{Nd}]/8
+ a9b
+ 0: 9
+ \x{1d7cf}
+ 0: \x{1d7cf}
+ ** Failers
+No match
+ \x{10000}
+No match
+
/-- End of testinput16 --/
diff --git a/pcre/testdata/testoutput19 b/pcre/testdata/testoutput19
index eb8a8f6cd34..982bea4c136 100644
--- a/pcre/testdata/testoutput19
+++ b/pcre/testdata/testoutput19
@@ -105,4 +105,30 @@ Starting chars: S s \xff
SSss\x{17f}
0: SSss\x{17f}
+/[\D]/8
+ \x{1d7cf}
+ 0: \x{1d7cf}
+
+/[\D\P{Nd}]/8
+ \x{1d7cf}
+ 0: \x{1d7cf}
+
+/[^\D]/8
+ a9b
+ 0: 9
+ ** Failers
+No match
+ \x{1d7cf}
+No match
+
+/[^\D\P{Nd}]/8
+ a9b
+ 0: 9
+ \x{1d7cf}
+ 0: \x{1d7cf}
+ ** Failers
+No match
+ \x{10000}
+No match
+
/-- End of testinput19 --/
diff --git a/pcre/testdata/testoutput2 b/pcre/testdata/testoutput2
index 5e88d1a7091..811bbefc84c 100644
--- a/pcre/testdata/testoutput2
+++ b/pcre/testdata/testoutput2
@@ -9380,7 +9380,7 @@ No need char
/(?(?=.*b).*b|^d)/I
Capturing subpattern count = 0
No options
-First char at start or follows newline
+No first char
No need char
/xyz/C
@@ -14670,4 +14670,39 @@ No match
/\N(?(?C)0?!.)*/
Failed: assertion expected after (?( or (?(?C) at offset 4
+/(?<RA>abc)(?(R)xyz)/BZ
+------------------------------------------------------------------
+ Bra
+ CBra 1
+ abc
+ Ket
+ Cond
+ Cond recurse any
+ xyz
+ Ket
+ Ket
+ End
+------------------------------------------------------------------
+
+/(?<R>abc)(?(R)xyz)/BZ
+------------------------------------------------------------------
+ Bra
+ CBra 1
+ abc
+ Ket
+ Cond
+ 1 Cond ref
+ xyz
+ Ket
+ Ket
+ End
+------------------------------------------------------------------
+
+/(?=.*[A-Z])/I
+Capturing subpattern count = 0
+May match empty string
+No options
+No first char
+No need char
+
/-- End of testinput2 --/
diff --git a/pcre/testdata/testoutput6 b/pcre/testdata/testoutput6
index b64dc0dc366..422d3833578 100644
--- a/pcre/testdata/testoutput6
+++ b/pcre/testdata/testoutput6
@@ -2573,4 +2573,12 @@ No match
\x{20ac}
No match
+/(?=.*b)\pL/
+ 11bb
+ 0: b
+
+/(?(?=.*b)(?=.*b)\pL|.*c)/
+ 11bb
+ 0: b
+
/-- End of testinput6 --/
diff --git a/pcre/testdata/testoutput7 b/pcre/testdata/testoutput7
index fdfff646d3e..2b167b28d1c 100644
--- a/pcre/testdata/testoutput7
+++ b/pcre/testdata/testoutput7
@@ -2295,32 +2295,6 @@ Need char = 'c' (caseless)
scat
0: sc
-/[\W\p{Any}]/BZ
-------------------------------------------------------------------
- Bra
- [\x00-/:-@[-^`{-\xff\p{Any}]
- Ket
- End
-------------------------------------------------------------------
- abc
- 0: a
- 123
- 0: 1
-
-/[\W\pL]/BZ
-------------------------------------------------------------------
- Bra
- [\x00-/:-@[-^`{-\xff\p{L}]
- Ket
- End
-------------------------------------------------------------------
- abc
- 0: a
- ** Failers
- 0: *
- 123
-No match
-
/a[[:punct:]b]/WBZ
------------------------------------------------------------------
Bra
diff --git a/pcre/testdata/testoutput8 b/pcre/testdata/testoutput8
index e4fa4977561..17b667a980c 100644
--- a/pcre/testdata/testoutput8
+++ b/pcre/testdata/testoutput8
@@ -7791,4 +7791,14 @@ Matched, but offsets vector is too small to show all matches
aaa
No match
+/()()a+/O=
+ aaa\D
+** Show all captures ignored after DFA matching
+ 0: aaa
+ 1: aa
+ 2: a
+ a\D
+** Show all captures ignored after DFA matching
+ 0: a
+
/-- End of testinput8 --/
diff --git a/plugin/auth_ed25519/CMakeLists.txt b/plugin/auth_ed25519/CMakeLists.txt
new file mode 100644
index 00000000000..73d8eeb208b
--- /dev/null
+++ b/plugin/auth_ed25519/CMakeLists.txt
@@ -0,0 +1,32 @@
+SET(REF10_SOURCES
+ ref10/fe_0.c ref10/fe_1.c ref10/fe_add.c ref10/fe_cmov.c ref10/fe_copy.c
+ ref10/fe_frombytes.c ref10/fe_invert.c ref10/fe_isnegative.c
+ ref10/fe_isnonzero.c ref10/fe_mul.c ref10/fe_neg.c ref10/fe_pow22523.c
+ ref10/fe_sq.c ref10/fe_sq2.c ref10/fe_sub.c ref10/fe_tobytes.c
+ ref10/ge_add.c ref10/ge_double_scalarmult.c ref10/ge_frombytes.c
+ ref10/ge_madd.c ref10/ge_msub.c ref10/ge_p1p1_to_p2.c
+ ref10/ge_p1p1_to_p3.c ref10/ge_p2_0.c ref10/ge_p2_dbl.c ref10/ge_p3_0.c
+ ref10/ge_p3_dbl.c ref10/ge_p3_to_cached.c ref10/ge_p3_to_p2.c
+ ref10/ge_p3_tobytes.c ref10/ge_precomp_0.c ref10/ge_scalarmult_base.c
+ ref10/ge_sub.c ref10/ge_tobytes.c ref10/keypair.c ref10/open.c
+ ref10/sc_muladd.c ref10/sc_reduce.c ref10/sign.c ref10/verify.c)
+
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
+
+ADD_CONVENIENCE_LIBRARY(ref10 ${REF10_SOURCES})
+IF(MSVC)
+ # Silence conversion (integer truncantion) warnings from reference code
+ SET_SOURCE_FILES_PROPERTIES(${REF10_SOURCES} PROPERTY COMPILE_FLAGS "/wd4244 /wd4146")
+ENDIF()
+
+# server plugin *cannot* link with the library, it needs all sources to be
+# compiled with MYSQL_DYNAMIC_PLUGIN
+MYSQL_ADD_PLUGIN(auth_ed25519 server_ed25519.c ${REF10_SOURCES} MODULE_ONLY)
+
+# client plugin and unit test ed25519-t can use the library
+MYSQL_ADD_PLUGIN(client_ed25519 client_ed25519.c MODULE_ONLY
+ CLIENT LINK_LIBRARIES mysys_ssl ref10 COMPONENT ClientPlugins)
+
+IF(WITH_UNIT_TESTS)
+ MY_ADD_TESTS(ed25519 LINK_LIBRARIES mysys ref10)
+ENDIF()
diff --git a/plugin/auth_ed25519/README b/plugin/auth_ed25519/README
new file mode 100644
index 00000000000..e65a33e6019
--- /dev/null
+++ b/plugin/auth_ed25519/README
@@ -0,0 +1,27 @@
+This plugin uses public domain ed25519 code
+by Daniel J. Bernstein, Niels Duif, Tanja Lange, Peter Schwabe, Bo-Yin Yang.
+
+It is "ref10" implementation from the SUPERCOP:
+https://bench.cr.yp.to/supercop.html
+
+OpenSSH also uses ed25519 from SUPERCOP, but "ref" implementation.
+
+There are four ed25519 implementations in SUPERCOP, ref10 is faster then ref,
+and there are two that are even faster, written in amd64 assembler.
+Benchmarks are here: https://bench.cr.yp.to/impl-sign/ed25519.html
+
+==============================
+MariaDB changes:
+
+API functions were simplified to better fit our use case:
+* crypto_sign_open() does not return the verified message, only the
+ result of the verification (passed/failed)
+* no secret key is generated explicitly, user specified password is used
+ as a source of randomness instead (SHA512("user password")).
+* lengths are not returned, where they're known in advance
+ (e.g. from crypto_sign()).
+* crypto_sign() does not take the public key as an argument, but
+ generates it on the fly (we used to generate public key before
+ crypto_sign(), doing it internally avoids double work).
+
+See the changes done in this commit.
diff --git a/plugin/auth_ed25519/client_ed25519.c b/plugin/auth_ed25519/client_ed25519.c
new file mode 100644
index 00000000000..16267a156c7
--- /dev/null
+++ b/plugin/auth_ed25519/client_ed25519.c
@@ -0,0 +1,68 @@
+/*
+ Copyright (c) 2017, MariaDB
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
+
+/************************** CLIENT *************************************/
+
+#include <stdlib.h>
+#include "common.h"
+#include <mysql/client_plugin.h>
+#include <errmsg.h>
+
+#if !defined(__attribute__) && !defined(__GNUC__)
+#define __attribute__(A)
+#endif
+
+static int do_auth(MYSQL_PLUGIN_VIO *vio, MYSQL *mysql)
+{
+ unsigned char reply[CRYPTO_BYTES + NONCE_BYTES], *pkt;
+ int pkt_len;
+
+ /* read the nonce */
+ if ((pkt_len= vio->read_packet(vio, &pkt)) != NONCE_BYTES)
+ return CR_SERVER_HANDSHAKE_ERR;
+
+ /* sign the nonce */
+ crypto_sign(reply, pkt, NONCE_BYTES,
+ (unsigned char*)mysql->passwd, strlen(mysql->passwd));
+
+ /* send the signature */
+ if (vio->write_packet(vio, reply, CRYPTO_BYTES))
+ return CR_ERROR;
+
+ return CR_OK;
+}
+
+static int init_client(char *unused1 __attribute__((unused)),
+ size_t unused2 __attribute__((unused)),
+ int unused3 __attribute__((unused)),
+ va_list unused4 __attribute__((unused)))
+{
+ return 0;
+}
+
+mysql_declare_client_plugin(AUTHENTICATION)
+ "client_ed25519",
+ "Sergei Golubchik",
+ "Elliptic curve ED25519 based authentication",
+ {0,1,0},
+ "GPL",
+ NULL,
+ init_client,
+ NULL,
+ NULL,
+ do_auth,
+mysql_end_client_plugin;
+
diff --git a/plugin/auth_ed25519/common.h b/plugin/auth_ed25519/common.h
new file mode 100644
index 00000000000..4a52f7742f5
--- /dev/null
+++ b/plugin/auth_ed25519/common.h
@@ -0,0 +1,23 @@
+/*
+ Copyright (c) 2017, MariaDB
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
+
+#include <mysql.h>
+#include <string.h>
+
+#include "ref10/api.h"
+#include "crypto_sign.h"
+
+#define NONCE_BYTES 32
diff --git a/plugin/auth_ed25519/crypto_hash_sha512.h b/plugin/auth_ed25519/crypto_hash_sha512.h
new file mode 100644
index 00000000000..a1be896f911
--- /dev/null
+++ b/plugin/auth_ed25519/crypto_hash_sha512.h
@@ -0,0 +1,2 @@
+#include <mysql/service_sha2.h>
+#define crypto_hash_sha512(DST,SRC,SLEN) my_sha512(DST,(char*)(SRC),SLEN)
diff --git a/plugin/auth_ed25519/crypto_int32.h b/plugin/auth_ed25519/crypto_int32.h
new file mode 100644
index 00000000000..642fca05767
--- /dev/null
+++ b/plugin/auth_ed25519/crypto_int32.h
@@ -0,0 +1,5 @@
+#include <stdint.h>
+#include <sys/types.h>
+typedef int32_t crypto_int32;
+
+#define select ed25519_select
diff --git a/plugin/auth_ed25519/crypto_int64.h b/plugin/auth_ed25519/crypto_int64.h
new file mode 100644
index 00000000000..a308e406721
--- /dev/null
+++ b/plugin/auth_ed25519/crypto_int64.h
@@ -0,0 +1,5 @@
+#include <stdint.h>
+#include <sys/types.h>
+typedef int64_t crypto_int64;
+
+#define select ed25519_select
diff --git a/plugin/auth_ed25519/crypto_sign.h b/plugin/auth_ed25519/crypto_sign.h
new file mode 100644
index 00000000000..e12a8c71f6e
--- /dev/null
+++ b/plugin/auth_ed25519/crypto_sign.h
@@ -0,0 +1,13 @@
+int crypto_sign_keypair(
+ unsigned char *pk,
+ unsigned char *pw, unsigned long long pwlen
+);
+int crypto_sign(
+ unsigned char *sm,
+ const unsigned char *m, unsigned long long mlen,
+ const unsigned char *pw, unsigned long long pwlen
+);
+int crypto_sign_open(
+ unsigned char *sm, unsigned long long smlen,
+ const unsigned char *pk
+);
diff --git a/plugin/auth_ed25519/crypto_uint32.h b/plugin/auth_ed25519/crypto_uint32.h
new file mode 100644
index 00000000000..ab2977caac2
--- /dev/null
+++ b/plugin/auth_ed25519/crypto_uint32.h
@@ -0,0 +1,5 @@
+#include <stdint.h>
+#include <sys/types.h>
+typedef uint32_t crypto_uint32;
+
+#define select ed25519_select
diff --git a/plugin/auth_ed25519/crypto_uint64.h b/plugin/auth_ed25519/crypto_uint64.h
new file mode 100644
index 00000000000..029c68191ab
--- /dev/null
+++ b/plugin/auth_ed25519/crypto_uint64.h
@@ -0,0 +1,5 @@
+#include <stdint.h>
+#include <sys/types.h>
+typedef uint64_t crypto_uint64;
+
+#define select ed25519_select
diff --git a/plugin/auth_ed25519/crypto_verify.h b/plugin/auth_ed25519/crypto_verify.h
new file mode 100644
index 00000000000..33e11b1edb0
--- /dev/null
+++ b/plugin/auth_ed25519/crypto_verify.h
@@ -0,0 +1 @@
+int crypto_verify(const unsigned char *x,const unsigned char *y);
diff --git a/plugin/auth_ed25519/crypto_verify_32.h b/plugin/auth_ed25519/crypto_verify_32.h
new file mode 100644
index 00000000000..d8235b75c79
--- /dev/null
+++ b/plugin/auth_ed25519/crypto_verify_32.h
@@ -0,0 +1,2 @@
+#define crypto_verify_32 crypto_verify
+int crypto_verify(const unsigned char *x,const unsigned char *y);
diff --git a/plugin/auth_ed25519/ed25519-t.c b/plugin/auth_ed25519/ed25519-t.c
new file mode 100644
index 00000000000..f7d58c48d7c
--- /dev/null
+++ b/plugin/auth_ed25519/ed25519-t.c
@@ -0,0 +1,55 @@
+/*
+ Copyright (c) 2017, MariaDB
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+
+#include <tap.h>
+#include <m_string.h>
+#include "common.h"
+
+int main()
+{
+ uchar pk[CRYPTO_PUBLICKEYBYTES];
+ uchar foobar_pk[CRYPTO_PUBLICKEYBYTES]= {170, 253, 166, 27, 161, 214, 10,
+ 236, 183, 217, 41, 91, 231, 24, 85, 225, 49, 210, 181, 236, 13, 207, 101,
+ 72, 53, 83, 219, 130, 79, 151, 0, 159};
+ uchar foobar_sign[CRYPTO_BYTES]= {232, 61, 201, 63, 67, 63, 51, 53, 86, 73,
+ 238, 35, 170, 117, 146, 214, 26, 17, 35, 9, 8, 132, 245, 141, 48, 99, 66,
+ 58, 36, 228, 48, 84, 115, 254, 187, 168, 88, 162, 249, 57, 35, 85, 79, 238,
+ 167, 106, 68, 117, 56, 135, 171, 47, 20, 14, 133, 79, 15, 229, 124, 160,
+ 176, 100, 138, 14};
+
+ uchar nonce[NONCE_BYTES];
+ uchar reply[NONCE_BYTES+CRYPTO_BYTES];
+ int r;
+
+ plan(4);
+
+ crypto_sign_keypair(pk, USTRING_WITH_LEN("foobar"));
+ ok(!memcmp(pk, foobar_pk, CRYPTO_PUBLICKEYBYTES), "foobar pk");
+
+ memset(nonce, 'A', sizeof(nonce));
+ crypto_sign(reply, nonce, sizeof(nonce), USTRING_WITH_LEN("foobar"));
+ ok(!memcmp(reply, foobar_sign, CRYPTO_BYTES), "foobar sign");
+
+ r= crypto_sign_open(reply, sizeof(reply), pk);
+ ok(!r, "good nonce");
+
+ crypto_sign(reply, nonce, sizeof(nonce), USTRING_WITH_LEN("foobar"));
+ reply[CRYPTO_BYTES + 10]='B';
+ r= crypto_sign_open(reply, sizeof(reply), pk);
+ ok(r, "bad nonce");
+
+ return exit_status();
+}
diff --git a/plugin/auth_ed25519/ref10/api.h b/plugin/auth_ed25519/ref10/api.h
new file mode 100644
index 00000000000..9f1db7e566a
--- /dev/null
+++ b/plugin/auth_ed25519/ref10/api.h
@@ -0,0 +1,3 @@
+#define CRYPTO_PUBLICKEYBYTES 32
+#define CRYPTO_BYTES 64
+#define CRYPTO_DETERMINISTIC 1
diff --git a/plugin/auth_ed25519/ref10/base.h b/plugin/auth_ed25519/ref10/base.h
new file mode 100644
index 00000000000..573bd8a05c6
--- /dev/null
+++ b/plugin/auth_ed25519/ref10/base.h
@@ -0,0 +1,1344 @@
+{
+ {
+ { 25967493,-14356035,29566456,3660896,-12694345,4014787,27544626,-11754271,-6079156,2047605 },
+ { -12545711,934262,-2722910,3049990,-727428,9406986,12720692,5043384,19500929,-15469378 },
+ { -8738181,4489570,9688441,-14785194,10184609,-12363380,29287919,11864899,-24514362,-4438546 },
+ },
+ {
+ { -12815894,-12976347,-21581243,11784320,-25355658,-2750717,-11717903,-3814571,-358445,-10211303 },
+ { -21703237,6903825,27185491,6451973,-29577724,-9554005,-15616551,11189268,-26829678,-5319081 },
+ { 26966642,11152617,32442495,15396054,14353839,-12752335,-3128826,-9541118,-15472047,-4166697 },
+ },
+ {
+ { 15636291,-9688557,24204773,-7912398,616977,-16685262,27787600,-14772189,28944400,-1550024 },
+ { 16568933,4717097,-11556148,-1102322,15682896,-11807043,16354577,-11775962,7689662,11199574 },
+ { 30464156,-5976125,-11779434,-15670865,23220365,15915852,7512774,10017326,-17749093,-9920357 },
+ },
+ {
+ { -17036878,13921892,10945806,-6033431,27105052,-16084379,-28926210,15006023,3284568,-6276540 },
+ { 23599295,-8306047,-11193664,-7687416,13236774,10506355,7464579,9656445,13059162,10374397 },
+ { 7798556,16710257,3033922,2874086,28997861,2835604,32406664,-3839045,-641708,-101325 },
+ },
+ {
+ { 10861363,11473154,27284546,1981175,-30064349,12577861,32867885,14515107,-15438304,10819380 },
+ { 4708026,6336745,20377586,9066809,-11272109,6594696,-25653668,12483688,-12668491,5581306 },
+ { 19563160,16186464,-29386857,4097519,10237984,-4348115,28542350,13850243,-23678021,-15815942 },
+ },
+ {
+ { -15371964,-12862754,32573250,4720197,-26436522,5875511,-19188627,-15224819,-9818940,-12085777 },
+ { -8549212,109983,15149363,2178705,22900618,4543417,3044240,-15689887,1762328,14866737 },
+ { -18199695,-15951423,-10473290,1707278,-17185920,3916101,-28236412,3959421,27914454,4383652 },
+ },
+ {
+ { 5153746,9909285,1723747,-2777874,30523605,5516873,19480852,5230134,-23952439,-15175766 },
+ { -30269007,-3463509,7665486,10083793,28475525,1649722,20654025,16520125,30598449,7715701 },
+ { 28881845,14381568,9657904,3680757,-20181635,7843316,-31400660,1370708,29794553,-1409300 },
+ },
+ {
+ { 14499471,-2729599,-33191113,-4254652,28494862,14271267,30290735,10876454,-33154098,2381726 },
+ { -7195431,-2655363,-14730155,462251,-27724326,3941372,-6236617,3696005,-32300832,15351955 },
+ { 27431194,8222322,16448760,-3907995,-18707002,11938355,-32961401,-2970515,29551813,10109425 },
+ },
+},
+{
+ {
+ { -13657040,-13155431,-31283750,11777098,21447386,6519384,-2378284,-1627556,10092783,-4764171 },
+ { 27939166,14210322,4677035,16277044,-22964462,-12398139,-32508754,12005538,-17810127,12803510 },
+ { 17228999,-15661624,-1233527,300140,-1224870,-11714777,30364213,-9038194,18016357,4397660 },
+ },
+ {
+ { -10958843,-7690207,4776341,-14954238,27850028,-15602212,-26619106,14544525,-17477504,982639 },
+ { 29253598,15796703,-2863982,-9908884,10057023,3163536,7332899,-4120128,-21047696,9934963 },
+ { 5793303,16271923,-24131614,-10116404,29188560,1206517,-14747930,4559895,-30123922,-10897950 },
+ },
+ {
+ { -27643952,-11493006,16282657,-11036493,28414021,-15012264,24191034,4541697,-13338309,5500568 },
+ { 12650548,-1497113,9052871,11355358,-17680037,-8400164,-17430592,12264343,10874051,13524335 },
+ { 25556948,-3045990,714651,2510400,23394682,-10415330,33119038,5080568,-22528059,5376628 },
+ },
+ {
+ { -26088264,-4011052,-17013699,-3537628,-6726793,1920897,-22321305,-9447443,4535768,1569007 },
+ { -2255422,14606630,-21692440,-8039818,28430649,8775819,-30494562,3044290,31848280,12543772 },
+ { -22028579,2943893,-31857513,6777306,13784462,-4292203,-27377195,-2062731,7718482,14474653 },
+ },
+ {
+ { 2385315,2454213,-22631320,46603,-4437935,-15680415,656965,-7236665,24316168,-5253567 },
+ { 13741529,10911568,-33233417,-8603737,-20177830,-1033297,33040651,-13424532,-20729456,8321686 },
+ { 21060490,-2212744,15712757,-4336099,1639040,10656336,23845965,-11874838,-9984458,608372 },
+ },
+ {
+ { -13672732,-15087586,-10889693,-7557059,-6036909,11305547,1123968,-6780577,27229399,23887 },
+ { -23244140,-294205,-11744728,14712571,-29465699,-2029617,12797024,-6440308,-1633405,16678954 },
+ { -29500620,4770662,-16054387,14001338,7830047,9564805,-1508144,-4795045,-17169265,4904953 },
+ },
+ {
+ { 24059557,14617003,19037157,-15039908,19766093,-14906429,5169211,16191880,2128236,-4326833 },
+ { -16981152,4124966,-8540610,-10653797,30336522,-14105247,-29806336,916033,-6882542,-2986532 },
+ { -22630907,12419372,-7134229,-7473371,-16478904,16739175,285431,2763829,15736322,4143876 },
+ },
+ {
+ { 2379352,11839345,-4110402,-5988665,11274298,794957,212801,-14594663,23527084,-16458268 },
+ { 33431127,-11130478,-17838966,-15626900,8909499,8376530,-32625340,4087881,-15188911,-14416214 },
+ { 1767683,7197987,-13205226,-2022635,-13091350,448826,5799055,4357868,-4774191,-16323038 },
+ },
+},
+{
+ {
+ { 6721966,13833823,-23523388,-1551314,26354293,-11863321,23365147,-3949732,7390890,2759800 },
+ { 4409041,2052381,23373853,10530217,7676779,-12885954,21302353,-4264057,1244380,-12919645 },
+ { -4421239,7169619,4982368,-2957590,30256825,-2777540,14086413,9208236,15886429,16489664 },
+ },
+ {
+ { 1996075,10375649,14346367,13311202,-6874135,-16438411,-13693198,398369,-30606455,-712933 },
+ { -25307465,9795880,-2777414,14878809,-33531835,14780363,13348553,12076947,-30836462,5113182 },
+ { -17770784,11797796,31950843,13929123,-25888302,12288344,-30341101,-7336386,13847711,5387222 },
+ },
+ {
+ { -18582163,-3416217,17824843,-2340966,22744343,-10442611,8763061,3617786,-19600662,10370991 },
+ { 20246567,-14369378,22358229,-543712,18507283,-10413996,14554437,-8746092,32232924,16763880 },
+ { 9648505,10094563,26416693,14745928,-30374318,-6472621,11094161,15689506,3140038,-16510092 },
+ },
+ {
+ { -16160072,5472695,31895588,4744994,8823515,10365685,-27224800,9448613,-28774454,366295 },
+ { 19153450,11523972,-11096490,-6503142,-24647631,5420647,28344573,8041113,719605,11671788 },
+ { 8678025,2694440,-6808014,2517372,4964326,11152271,-15432916,-15266516,27000813,-10195553 },
+ },
+ {
+ { -15157904,7134312,8639287,-2814877,-7235688,10421742,564065,5336097,6750977,-14521026 },
+ { 11836410,-3979488,26297894,16080799,23455045,15735944,1695823,-8819122,8169720,16220347 },
+ { -18115838,8653647,17578566,-6092619,-8025777,-16012763,-11144307,-2627664,-5990708,-14166033 },
+ },
+ {
+ { -23308498,-10968312,15213228,-10081214,-30853605,-11050004,27884329,2847284,2655861,1738395 },
+ { -27537433,-14253021,-25336301,-8002780,-9370762,8129821,21651608,-3239336,-19087449,-11005278 },
+ { 1533110,3437855,23735889,459276,29970501,11335377,26030092,5821408,10478196,8544890 },
+ },
+ {
+ { 32173121,-16129311,24896207,3921497,22579056,-3410854,19270449,12217473,17789017,-3395995 },
+ { -30552961,-2228401,-15578829,-10147201,13243889,517024,15479401,-3853233,30460520,1052596 },
+ { -11614875,13323618,32618793,8175907,-15230173,12596687,27491595,-4612359,3179268,-9478891 },
+ },
+ {
+ { 31947069,-14366651,-4640583,-15339921,-15125977,-6039709,-14756777,-16411740,19072640,-9511060 },
+ { 11685058,11822410,3158003,-13952594,33402194,-4165066,5977896,-5215017,473099,5040608 },
+ { -20290863,8198642,-27410132,11602123,1290375,-2799760,28326862,1721092,-19558642,-3131606 },
+ },
+},
+{
+ {
+ { 7881532,10687937,7578723,7738378,-18951012,-2553952,21820786,8076149,-27868496,11538389 },
+ { -19935666,3899861,18283497,-6801568,-15728660,-11249211,8754525,7446702,-5676054,5797016 },
+ { -11295600,-3793569,-15782110,-7964573,12708869,-8456199,2014099,-9050574,-2369172,-5877341 },
+ },
+ {
+ { -22472376,-11568741,-27682020,1146375,18956691,16640559,1192730,-3714199,15123619,10811505 },
+ { 14352098,-3419715,-18942044,10822655,32750596,4699007,-70363,15776356,-28886779,-11974553 },
+ { -28241164,-8072475,-4978962,-5315317,29416931,1847569,-20654173,-16484855,4714547,-9600655 },
+ },
+ {
+ { 15200332,8368572,19679101,15970074,-31872674,1959451,24611599,-4543832,-11745876,12340220 },
+ { 12876937,-10480056,33134381,6590940,-6307776,14872440,9613953,8241152,15370987,9608631 },
+ { -4143277,-12014408,8446281,-391603,4407738,13629032,-7724868,15866074,-28210621,-8814099 },
+ },
+ {
+ { 26660628,-15677655,8393734,358047,-7401291,992988,-23904233,858697,20571223,8420556 },
+ { 14620715,13067227,-15447274,8264467,14106269,15080814,33531827,12516406,-21574435,-12476749 },
+ { 236881,10476226,57258,-14677024,6472998,2466984,17258519,7256740,8791136,15069930 },
+ },
+ {
+ { 1276410,-9371918,22949635,-16322807,-23493039,-5702186,14711875,4874229,-30663140,-2331391 },
+ { 5855666,4990204,-13711848,7294284,-7804282,1924647,-1423175,-7912378,-33069337,9234253 },
+ { 20590503,-9018988,31529744,-7352666,-2706834,10650548,31559055,-11609587,18979186,13396066 },
+ },
+ {
+ { 24474287,4968103,22267082,4407354,24063882,-8325180,-18816887,13594782,33514650,7021958 },
+ { -11566906,-6565505,-21365085,15928892,-26158305,4315421,-25948728,-3916677,-21480480,12868082 },
+ { -28635013,13504661,19988037,-2132761,21078225,6443208,-21446107,2244500,-12455797,-8089383 },
+ },
+ {
+ { -30595528,13793479,-5852820,319136,-25723172,-6263899,33086546,8957937,-15233648,5540521 },
+ { -11630176,-11503902,-8119500,-7643073,2620056,1022908,-23710744,-1568984,-16128528,-14962807 },
+ { 23152971,775386,27395463,14006635,-9701118,4649512,1689819,892185,-11513277,-15205948 },
+ },
+ {
+ { 9770129,9586738,26496094,4324120,1556511,-3550024,27453819,4763127,-19179614,5867134 },
+ { -32765025,1927590,31726409,-4753295,23962434,-16019500,27846559,5931263,-29749703,-16108455 },
+ { 27461885,-2977536,22380810,1815854,-23033753,-3031938,7283490,-15148073,-19526700,7734629 },
+ },
+},
+{
+ {
+ { -8010264,-9590817,-11120403,6196038,29344158,-13430885,7585295,-3176626,18549497,15302069 },
+ { -32658337,-6171222,-7672793,-11051681,6258878,13504381,10458790,-6418461,-8872242,8424746 },
+ { 24687205,8613276,-30667046,-3233545,1863892,-1830544,19206234,7134917,-11284482,-828919 },
+ },
+ {
+ { 11334899,-9218022,8025293,12707519,17523892,-10476071,10243738,-14685461,-5066034,16498837 },
+ { 8911542,6887158,-9584260,-6958590,11145641,-9543680,17303925,-14124238,6536641,10543906 },
+ { -28946384,15479763,-17466835,568876,-1497683,11223454,-2669190,-16625574,-27235709,8876771 },
+ },
+ {
+ { -25742899,-12566864,-15649966,-846607,-33026686,-796288,-33481822,15824474,-604426,-9039817 },
+ { 10330056,70051,7957388,-9002667,9764902,15609756,27698697,-4890037,1657394,3084098 },
+ { 10477963,-7470260,12119566,-13250805,29016247,-5365589,31280319,14396151,-30233575,15272409 },
+ },
+ {
+ { -12288309,3169463,28813183,16658753,25116432,-5630466,-25173957,-12636138,-25014757,1950504 },
+ { -26180358,9489187,11053416,-14746161,-31053720,5825630,-8384306,-8767532,15341279,8373727 },
+ { 28685821,7759505,-14378516,-12002860,-31971820,4079242,298136,-10232602,-2878207,15190420 },
+ },
+ {
+ { -32932876,13806336,-14337485,-15794431,-24004620,10940928,8669718,2742393,-26033313,-6875003 },
+ { -1580388,-11729417,-25979658,-11445023,-17411874,-10912854,9291594,-16247779,-12154742,6048605 },
+ { -30305315,14843444,1539301,11864366,20201677,1900163,13934231,5128323,11213262,9168384 },
+ },
+ {
+ { -26280513,11007847,19408960,-940758,-18592965,-4328580,-5088060,-11105150,20470157,-16398701 },
+ { -23136053,9282192,14855179,-15390078,-7362815,-14408560,-22783952,14461608,14042978,5230683 },
+ { 29969567,-2741594,-16711867,-8552442,9175486,-2468974,21556951,3506042,-5933891,-12449708 },
+ },
+ {
+ { -3144746,8744661,19704003,4581278,-20430686,6830683,-21284170,8971513,-28539189,15326563 },
+ { -19464629,10110288,-17262528,-3503892,-23500387,1355669,-15523050,15300988,-20514118,9168260 },
+ { -5353335,4488613,-23803248,16314347,7780487,-15638939,-28948358,9601605,33087103,-9011387 },
+ },
+ {
+ { -19443170,-15512900,-20797467,-12445323,-29824447,10229461,-27444329,-15000531,-5996870,15664672 },
+ { 23294591,-16632613,-22650781,-8470978,27844204,11461195,13099750,-2460356,18151676,13417686 },
+ { -24722913,-4176517,-31150679,5988919,-26858785,6685065,1661597,-12551441,15271676,-15452665 },
+ },
+},
+{
+ {
+ { 11433042,-13228665,8239631,-5279517,-1985436,-725718,-18698764,2167544,-6921301,-13440182 },
+ { -31436171,15575146,30436815,12192228,-22463353,9395379,-9917708,-8638997,12215110,12028277 },
+ { 14098400,6555944,23007258,5757252,-15427832,-12950502,30123440,4617780,-16900089,-655628 },
+ },
+ {
+ { -4026201,-15240835,11893168,13718664,-14809462,1847385,-15819999,10154009,23973261,-12684474 },
+ { -26531820,-3695990,-1908898,2534301,-31870557,-16550355,18341390,-11419951,32013174,-10103539 },
+ { -25479301,10876443,-11771086,-14625140,-12369567,1838104,21911214,6354752,4425632,-837822 },
+ },
+ {
+ { -10433389,-14612966,22229858,-3091047,-13191166,776729,-17415375,-12020462,4725005,14044970 },
+ { 19268650,-7304421,1555349,8692754,-21474059,-9910664,6347390,-1411784,-19522291,-16109756 },
+ { -24864089,12986008,-10898878,-5558584,-11312371,-148526,19541418,8180106,9282262,10282508 },
+ },
+ {
+ { -26205082,4428547,-8661196,-13194263,4098402,-14165257,15522535,8372215,5542595,-10702683 },
+ { -10562541,14895633,26814552,-16673850,-17480754,-2489360,-2781891,6993761,-18093885,10114655 },
+ { -20107055,-929418,31422704,10427861,-7110749,6150669,-29091755,-11529146,25953725,-106158 },
+ },
+ {
+ { -4234397,-8039292,-9119125,3046000,2101609,-12607294,19390020,6094296,-3315279,12831125 },
+ { -15998678,7578152,5310217,14408357,-33548620,-224739,31575954,6326196,7381791,-2421839 },
+ { -20902779,3296811,24736065,-16328389,18374254,7318640,6295303,8082724,-15362489,12339664 },
+ },
+ {
+ { 27724736,2291157,6088201,-14184798,1792727,5857634,13848414,15768922,25091167,14856294 },
+ { -18866652,8331043,24373479,8541013,-701998,-9269457,12927300,-12695493,-22182473,-9012899 },
+ { -11423429,-5421590,11632845,3405020,30536730,-11674039,-27260765,13866390,30146206,9142070 },
+ },
+ {
+ { 3924129,-15307516,-13817122,-10054960,12291820,-668366,-27702774,9326384,-8237858,4171294 },
+ { -15921940,16037937,6713787,16606682,-21612135,2790944,26396185,3731949,345228,-5462949 },
+ { -21327538,13448259,25284571,1143661,20614966,-8849387,2031539,-12391231,-16253183,-13582083 },
+ },
+ {
+ { 31016211,-16722429,26371392,-14451233,-5027349,14854137,17477601,3842657,28012650,-16405420 },
+ { -5075835,9368966,-8562079,-4600902,-15249953,6970560,-9189873,16292057,-8867157,3507940 },
+ { 29439664,3537914,23333589,6997794,-17555561,-11018068,-15209202,-15051267,-9164929,6580396 },
+ },
+},
+{
+ {
+ { -12185861,-7679788,16438269,10826160,-8696817,-6235611,17860444,-9273846,-2095802,9304567 },
+ { 20714564,-4336911,29088195,7406487,11426967,-5095705,14792667,-14608617,5289421,-477127 },
+ { -16665533,-10650790,-6160345,-13305760,9192020,-1802462,17271490,12349094,26939669,-3752294 },
+ },
+ {
+ { -12889898,9373458,31595848,16374215,21471720,13221525,-27283495,-12348559,-3698806,117887 },
+ { 22263325,-6560050,3984570,-11174646,-15114008,-566785,28311253,5358056,-23319780,541964 },
+ { 16259219,3261970,2309254,-15534474,-16885711,-4581916,24134070,-16705829,-13337066,-13552195 },
+ },
+ {
+ { 9378160,-13140186,-22845982,-12745264,28198281,-7244098,-2399684,-717351,690426,14876244 },
+ { 24977353,-314384,-8223969,-13465086,28432343,-1176353,-13068804,-12297348,-22380984,6618999 },
+ { -1538174,11685646,12944378,13682314,-24389511,-14413193,8044829,-13817328,32239829,-5652762 },
+ },
+ {
+ { -18603066,4762990,-926250,8885304,-28412480,-3187315,9781647,-10350059,32779359,5095274 },
+ { -33008130,-5214506,-32264887,-3685216,9460461,-9327423,-24601656,14506724,21639561,-2630236 },
+ { -16400943,-13112215,25239338,15531969,3987758,-4499318,-1289502,-6863535,17874574,558605 },
+ },
+ {
+ { -13600129,10240081,9171883,16131053,-20869254,9599700,33499487,5080151,2085892,5119761 },
+ { -22205145,-2519528,-16381601,414691,-25019550,2170430,30634760,-8363614,-31999993,-5759884 },
+ { -6845704,15791202,8550074,-1312654,29928809,-12092256,27534430,-7192145,-22351378,12961482 },
+ },
+ {
+ { -24492060,-9570771,10368194,11582341,-23397293,-2245287,16533930,8206996,-30194652,-5159638 },
+ { -11121496,-3382234,2307366,6362031,-135455,8868177,-16835630,7031275,7589640,8945490 },
+ { -32152748,8917967,6661220,-11677616,-1192060,-15793393,7251489,-11182180,24099109,-14456170 },
+ },
+ {
+ { 5019558,-7907470,4244127,-14714356,-26933272,6453165,-19118182,-13289025,-6231896,-10280736 },
+ { 10853594,10721687,26480089,5861829,-22995819,1972175,-1866647,-10557898,-3363451,-6441124 },
+ { -17002408,5906790,221599,-6563147,7828208,-13248918,24362661,-2008168,-13866408,7421392 },
+ },
+ {
+ { 8139927,-6546497,32257646,-5890546,30375719,1886181,-21175108,15441252,28826358,-4123029 },
+ { 6267086,9695052,7709135,-16603597,-32869068,-1886135,14795160,-7840124,13746021,-1742048 },
+ { 28584902,7787108,-6732942,-15050729,22846041,-7571236,-3181936,-363524,4771362,-8419958 },
+ },
+},
+{
+ {
+ { 24949256,6376279,-27466481,-8174608,-18646154,-9930606,33543569,-12141695,3569627,11342593 },
+ { 26514989,4740088,27912651,3697550,19331575,-11472339,6809886,4608608,7325975,-14801071 },
+ { -11618399,-14554430,-24321212,7655128,-1369274,5214312,-27400540,10258390,-17646694,-8186692 },
+ },
+ {
+ { 11431204,15823007,26570245,14329124,18029990,4796082,-31446179,15580664,9280358,-3973687 },
+ { -160783,-10326257,-22855316,-4304997,-20861367,-13621002,-32810901,-11181622,-15545091,4387441 },
+ { -20799378,12194512,3937617,-5805892,-27154820,9340370,-24513992,8548137,20617071,-7482001 },
+ },
+ {
+ { -938825,-3930586,-8714311,16124718,24603125,-6225393,-13775352,-11875822,24345683,10325460 },
+ { -19855277,-1568885,-22202708,8714034,14007766,6928528,16318175,-1010689,4766743,3552007 },
+ { -21751364,-16730916,1351763,-803421,-4009670,3950935,3217514,14481909,10988822,-3994762 },
+ },
+ {
+ { 15564307,-14311570,3101243,5684148,30446780,-8051356,12677127,-6505343,-8295852,13296005 },
+ { -9442290,6624296,-30298964,-11913677,-4670981,-2057379,31521204,9614054,-30000824,12074674 },
+ { 4771191,-135239,14290749,-13089852,27992298,14998318,-1413936,-1556716,29832613,-16391035 },
+ },
+ {
+ { 7064884,-7541174,-19161962,-5067537,-18891269,-2912736,25825242,5293297,-27122660,13101590 },
+ { -2298563,2439670,-7466610,1719965,-27267541,-16328445,32512469,-5317593,-30356070,-4190957 },
+ { -30006540,10162316,-33180176,3981723,-16482138,-13070044,14413974,9515896,19568978,9628812 },
+ },
+ {
+ { 33053803,199357,15894591,1583059,27380243,-4580435,-17838894,-6106839,-6291786,3437740 },
+ { -18978877,3884493,19469877,12726490,15913552,13614290,-22961733,70104,7463304,4176122 },
+ { -27124001,10659917,11482427,-16070381,12771467,-6635117,-32719404,-5322751,24216882,5944158 },
+ },
+ {
+ { 8894125,7450974,-2664149,-9765752,-28080517,-12389115,19345746,14680796,11632993,5847885 },
+ { 26942781,-2315317,9129564,-4906607,26024105,11769399,-11518837,6367194,-9727230,4782140 },
+ { 19916461,-4828410,-22910704,-11414391,25606324,-5972441,33253853,8220911,6358847,-1873857 },
+ },
+ {
+ { 801428,-2081702,16569428,11065167,29875704,96627,7908388,-4480480,-13538503,1387155 },
+ { 19646058,5720633,-11416706,12814209,11607948,12749789,14147075,15156355,-21866831,11835260 },
+ { 19299512,1155910,28703737,14890794,2925026,7269399,26121523,15467869,-26560550,5052483 },
+ },
+},
+{
+ {
+ { -3017432,10058206,1980837,3964243,22160966,12322533,-6431123,-12618185,12228557,-7003677 },
+ { 32944382,14922211,-22844894,5188528,21913450,-8719943,4001465,13238564,-6114803,8653815 },
+ { 22865569,-4652735,27603668,-12545395,14348958,8234005,24808405,5719875,28483275,2841751 },
+ },
+ {
+ { -16420968,-1113305,-327719,-12107856,21886282,-15552774,-1887966,-315658,19932058,-12739203 },
+ { -11656086,10087521,-8864888,-5536143,-19278573,-3055912,3999228,13239134,-4777469,-13910208 },
+ { 1382174,-11694719,17266790,9194690,-13324356,9720081,20403944,11284705,-14013818,3093230 },
+ },
+ {
+ { 16650921,-11037932,-1064178,1570629,-8329746,7352753,-302424,16271225,-24049421,-6691850 },
+ { -21911077,-5927941,-4611316,-5560156,-31744103,-10785293,24123614,15193618,-21652117,-16739389 },
+ { -9935934,-4289447,-25279823,4372842,2087473,10399484,31870908,14690798,17361620,11864968 },
+ },
+ {
+ { -11307610,6210372,13206574,5806320,-29017692,-13967200,-12331205,-7486601,-25578460,-16240689 },
+ { 14668462,-12270235,26039039,15305210,25515617,4542480,10453892,6577524,9145645,-6443880 },
+ { 5974874,3053895,-9433049,-10385191,-31865124,3225009,-7972642,3936128,-5652273,-3050304 },
+ },
+ {
+ { 30625386,-4729400,-25555961,-12792866,-20484575,7695099,17097188,-16303496,-27999779,1803632 },
+ { -3553091,9865099,-5228566,4272701,-5673832,-16689700,14911344,12196514,-21405489,7047412 },
+ { 20093277,9920966,-11138194,-5343857,13161587,12044805,-32856851,4124601,-32343828,-10257566 },
+ },
+ {
+ { -20788824,14084654,-13531713,7842147,19119038,-13822605,4752377,-8714640,-21679658,2288038 },
+ { -26819236,-3283715,29965059,3039786,-14473765,2540457,29457502,14625692,-24819617,12570232 },
+ { -1063558,-11551823,16920318,12494842,1278292,-5869109,-21159943,-3498680,-11974704,4724943 },
+ },
+ {
+ { 17960970,-11775534,-4140968,-9702530,-8876562,-1410617,-12907383,-8659932,-29576300,1903856 },
+ { 23134274,-14279132,-10681997,-1611936,20684485,15770816,-12989750,3190296,26955097,14109738 },
+ { 15308788,5320727,-30113809,-14318877,22902008,7767164,29425325,-11277562,31960942,11934971 },
+ },
+ {
+ { -27395711,8435796,4109644,12222639,-24627868,14818669,20638173,4875028,10491392,1379718 },
+ { -13159415,9197841,3875503,-8936108,-1383712,-5879801,33518459,16176658,21432314,12180697 },
+ { -11787308,11500838,13787581,-13832590,-22430679,10140205,1465425,12689540,-10301319,-13872883 },
+ },
+},
+{
+ {
+ { 5414091,-15386041,-21007664,9643570,12834970,1186149,-2622916,-1342231,26128231,6032912 },
+ { -26337395,-13766162,32496025,-13653919,17847801,-12669156,3604025,8316894,-25875034,-10437358 },
+ { 3296484,6223048,24680646,-12246460,-23052020,5903205,-8862297,-4639164,12376617,3188849 },
+ },
+ {
+ { 29190488,-14659046,27549113,-1183516,3520066,-10697301,32049515,-7309113,-16109234,-9852307 },
+ { -14744486,-9309156,735818,-598978,-20407687,-5057904,25246078,-15795669,18640741,-960977 },
+ { -6928835,-16430795,10361374,5642961,4910474,12345252,-31638386,-494430,10530747,1053335 },
+ },
+ {
+ { -29265967,-14186805,-13538216,-12117373,-19457059,-10655384,-31462369,-2948985,24018831,15026644 },
+ { -22592535,-3145277,-2289276,5953843,-13440189,9425631,25310643,13003497,-2314791,-15145616 },
+ { -27419985,-603321,-8043984,-1669117,-26092265,13987819,-27297622,187899,-23166419,-2531735 },
+ },
+ {
+ { -21744398,-13810475,1844840,5021428,-10434399,-15911473,9716667,16266922,-5070217,726099 },
+ { 29370922,-6053998,7334071,-15342259,9385287,2247707,-13661962,-4839461,30007388,-15823341 },
+ { -936379,16086691,23751945,-543318,-1167538,-5189036,9137109,730663,9835848,4555336 },
+ },
+ {
+ { -23376435,1410446,-22253753,-12899614,30867635,15826977,17693930,544696,-11985298,12422646 },
+ { 31117226,-12215734,-13502838,6561947,-9876867,-12757670,-5118685,-4096706,29120153,13924425 },
+ { -17400879,-14233209,19675799,-2734756,-11006962,-5858820,-9383939,-11317700,7240931,-237388 },
+ },
+ {
+ { -31361739,-11346780,-15007447,-5856218,-22453340,-12152771,1222336,4389483,3293637,-15551743 },
+ { -16684801,-14444245,11038544,11054958,-13801175,-3338533,-24319580,7733547,12796905,-6335822 },
+ { -8759414,-10817836,-25418864,10783769,-30615557,-9746811,-28253339,3647836,3222231,-11160462 },
+ },
+ {
+ { 18606113,1693100,-25448386,-15170272,4112353,10045021,23603893,-2048234,-7550776,2484985 },
+ { 9255317,-3131197,-12156162,-1004256,13098013,-9214866,16377220,-2102812,-19802075,-3034702 },
+ { -22729289,7496160,-5742199,11329249,19991973,-3347502,-31718148,9936966,-30097688,-10618797 },
+ },
+ {
+ { 21878590,-5001297,4338336,13643897,-3036865,13160960,19708896,5415497,-7360503,-4109293 },
+ { 27736861,10103576,12500508,8502413,-3413016,-9633558,10436918,-1550276,-23659143,-8132100 },
+ { 19492550,-12104365,-29681976,-852630,-3208171,12403437,30066266,8367329,13243957,8709688 },
+ },
+},
+{
+ {
+ { 12015105,2801261,28198131,10151021,24818120,-4743133,-11194191,-5645734,5150968,7274186 },
+ { 2831366,-12492146,1478975,6122054,23825128,-12733586,31097299,6083058,31021603,-9793610 },
+ { -2529932,-2229646,445613,10720828,-13849527,-11505937,-23507731,16354465,15067285,-14147707 },
+ },
+ {
+ { 7840942,14037873,-33364863,15934016,-728213,-3642706,21403988,1057586,-19379462,-12403220 },
+ { 915865,-16469274,15608285,-8789130,-24357026,6060030,-17371319,8410997,-7220461,16527025 },
+ { 32922597,-556987,20336074,-16184568,10903705,-5384487,16957574,52992,23834301,6588044 },
+ },
+ {
+ { 32752030,11232950,3381995,-8714866,22652988,-10744103,17159699,16689107,-20314580,-1305992 },
+ { -4689649,9166776,-25710296,-10847306,11576752,12733943,7924251,-2752281,1976123,-7249027 },
+ { 21251222,16309901,-2983015,-6783122,30810597,12967303,156041,-3371252,12331345,-8237197 },
+ },
+ {
+ { 8651614,-4477032,-16085636,-4996994,13002507,2950805,29054427,-5106970,10008136,-4667901 },
+ { 31486080,15114593,-14261250,12951354,14369431,-7387845,16347321,-13662089,8684155,-10532952 },
+ { 19443825,11385320,24468943,-9659068,-23919258,2187569,-26263207,-6086921,31316348,14219878 },
+ },
+ {
+ { -28594490,1193785,32245219,11392485,31092169,15722801,27146014,6992409,29126555,9207390 },
+ { 32382935,1110093,18477781,11028262,-27411763,-7548111,-4980517,10843782,-7957600,-14435730 },
+ { 2814918,7836403,27519878,-7868156,-20894015,-11553689,-21494559,8550130,28346258,1994730 },
+ },
+ {
+ { -19578299,8085545,-14000519,-3948622,2785838,-16231307,-19516951,7174894,22628102,8115180 },
+ { -30405132,955511,-11133838,-15078069,-32447087,-13278079,-25651578,3317160,-9943017,930272 },
+ { -15303681,-6833769,28856490,1357446,23421993,1057177,24091212,-1388970,-22765376,-10650715 },
+ },
+ {
+ { -22751231,-5303997,-12907607,-12768866,-15811511,-7797053,-14839018,-16554220,-1867018,8398970 },
+ { -31969310,2106403,-4736360,1362501,12813763,16200670,22981545,-6291273,18009408,-15772772 },
+ { -17220923,-9545221,-27784654,14166835,29815394,7444469,29551787,-3727419,19288549,1325865 },
+ },
+ {
+ { 15100157,-15835752,-23923978,-1005098,-26450192,15509408,12376730,-3479146,33166107,-8042750 },
+ { 20909231,13023121,-9209752,16251778,-5778415,-8094914,12412151,10018715,2213263,-13878373 },
+ { 32529814,-11074689,30361439,-16689753,-9135940,1513226,22922121,6382134,-5766928,8371348 },
+ },
+},
+{
+ {
+ { 9923462,11271500,12616794,3544722,-29998368,-1721626,12891687,-8193132,-26442943,10486144 },
+ { -22597207,-7012665,8587003,-8257861,4084309,-12970062,361726,2610596,-23921530,-11455195 },
+ { 5408411,-1136691,-4969122,10561668,24145918,14240566,31319731,-4235541,19985175,-3436086 },
+ },
+ {
+ { -13994457,16616821,14549246,3341099,32155958,13648976,-17577068,8849297,65030,8370684 },
+ { -8320926,-12049626,31204563,5839400,-20627288,-1057277,-19442942,6922164,12743482,-9800518 },
+ { -2361371,12678785,28815050,4759974,-23893047,4884717,23783145,11038569,18800704,255233 },
+ },
+ {
+ { -5269658,-1773886,13957886,7990715,23132995,728773,13393847,9066957,19258688,-14753793 },
+ { -2936654,-10827535,-10432089,14516793,-3640786,4372541,-31934921,2209390,-1524053,2055794 },
+ { 580882,16705327,5468415,-2683018,-30926419,-14696000,-7203346,-8994389,-30021019,7394435 },
+ },
+ {
+ { 23838809,1822728,-15738443,15242727,8318092,-3733104,-21672180,-3492205,-4821741,14799921 },
+ { 13345610,9759151,3371034,-16137791,16353039,8577942,31129804,13496856,-9056018,7402518 },
+ { 2286874,-4435931,-20042458,-2008336,-13696227,5038122,11006906,-15760352,8205061,1607563 },
+ },
+ {
+ { 14414086,-8002132,3331830,-3208217,22249151,-5594188,18364661,-2906958,30019587,-9029278 },
+ { -27688051,1585953,-10775053,931069,-29120221,-11002319,-14410829,12029093,9944378,8024 },
+ { 4368715,-3709630,29874200,-15022983,-20230386,-11410704,-16114594,-999085,-8142388,5640030 },
+ },
+ {
+ { 10299610,13746483,11661824,16234854,7630238,5998374,9809887,-16694564,15219798,-14327783 },
+ { 27425505,-5719081,3055006,10660664,23458024,595578,-15398605,-1173195,-18342183,9742717 },
+ { 6744077,2427284,26042789,2720740,-847906,1118974,32324614,7406442,12420155,1994844 },
+ },
+ {
+ { 14012521,-5024720,-18384453,-9578469,-26485342,-3936439,-13033478,-10909803,24319929,-6446333 },
+ { 16412690,-4507367,10772641,15929391,-17068788,-4658621,10555945,-10484049,-30102368,-4739048 },
+ { 22397382,-7767684,-9293161,-12792868,17166287,-9755136,-27333065,6199366,21880021,-12250760 },
+ },
+ {
+ { -4283307,5368523,-31117018,8163389,-30323063,3209128,16557151,8890729,8840445,4957760 },
+ { -15447727,709327,-6919446,-10870178,-29777922,6522332,-21720181,12130072,-14796503,5005757 },
+ { -2114751,-14308128,23019042,15765735,-25269683,6002752,10183197,-13239326,-16395286,-2176112 },
+ },
+},
+{
+ {
+ { -19025756,1632005,13466291,-7995100,-23640451,16573537,-32013908,-3057104,22208662,2000468 },
+ { 3065073,-1412761,-25598674,-361432,-17683065,-5703415,-8164212,11248527,-3691214,-7414184 },
+ { 10379208,-6045554,8877319,1473647,-29291284,-12507580,16690915,2553332,-3132688,16400289 },
+ },
+ {
+ { 15716668,1254266,-18472690,7446274,-8448918,6344164,-22097271,-7285580,26894937,9132066 },
+ { 24158887,12938817,11085297,-8177598,-28063478,-4457083,-30576463,64452,-6817084,-2692882 },
+ { 13488534,7794716,22236231,5989356,25426474,-12578208,2350710,-3418511,-4688006,2364226 },
+ },
+ {
+ { 16335052,9132434,25640582,6678888,1725628,8517937,-11807024,-11697457,15445875,-7798101 },
+ { 29004207,-7867081,28661402,-640412,-12794003,-7943086,31863255,-4135540,-278050,-15759279 },
+ { -6122061,-14866665,-28614905,14569919,-10857999,-3591829,10343412,-6976290,-29828287,-10815811 },
+ },
+ {
+ { 27081650,3463984,14099042,-4517604,1616303,-6205604,29542636,15372179,17293797,960709 },
+ { 20263915,11434237,-5765435,11236810,13505955,-10857102,-16111345,6493122,-19384511,7639714 },
+ { -2830798,-14839232,25403038,-8215196,-8317012,-16173699,18006287,-16043750,29994677,-15808121 },
+ },
+ {
+ { 9769828,5202651,-24157398,-13631392,-28051003,-11561624,-24613141,-13860782,-31184575,709464 },
+ { 12286395,13076066,-21775189,-1176622,-25003198,4057652,-32018128,-8890874,16102007,13205847 },
+ { 13733362,5599946,10557076,3195751,-5557991,8536970,-25540170,8525972,10151379,10394400 },
+ },
+ {
+ { 4024660,-16137551,22436262,12276534,-9099015,-2686099,19698229,11743039,-33302334,8934414 },
+ { -15879800,-4525240,-8580747,-2934061,14634845,-698278,-9449077,3137094,-11536886,11721158 },
+ { 17555939,-5013938,8268606,2331751,-22738815,9761013,9319229,8835153,-9205489,-1280045 },
+ },
+ {
+ { -461409,-7830014,20614118,16688288,-7514766,-4807119,22300304,505429,6108462,-6183415 },
+ { -5070281,12367917,-30663534,3234473,32617080,-8422642,29880583,-13483331,-26898490,-7867459 },
+ { -31975283,5726539,26934134,10237677,-3173717,-605053,24199304,3795095,7592688,-14992079 },
+ },
+ {
+ { 21594432,-14964228,17466408,-4077222,32537084,2739898,6407723,12018833,-28256052,4298412 },
+ { -20650503,-11961496,-27236275,570498,3767144,-1717540,13891942,-1569194,13717174,10805743 },
+ { -14676630,-15644296,15287174,11927123,24177847,-8175568,-796431,14860609,-26938930,-5863836 },
+ },
+},
+{
+ {
+ { 12962541,5311799,-10060768,11658280,18855286,-7954201,13286263,-12808704,-4381056,9882022 },
+ { 18512079,11319350,-20123124,15090309,18818594,5271736,-22727904,3666879,-23967430,-3299429 },
+ { -6789020,-3146043,16192429,13241070,15898607,-14206114,-10084880,-6661110,-2403099,5276065 },
+ },
+ {
+ { 30169808,-5317648,26306206,-11750859,27814964,7069267,7152851,3684982,1449224,13082861 },
+ { 10342826,3098505,2119311,193222,25702612,12233820,23697382,15056736,-21016438,-8202000 },
+ { -33150110,3261608,22745853,7948688,19370557,-15177665,-26171976,6482814,-10300080,-11060101 },
+ },
+ {
+ { 32869458,-5408545,25609743,15678670,-10687769,-15471071,26112421,2521008,-22664288,6904815 },
+ { 29506923,4457497,3377935,-9796444,-30510046,12935080,1561737,3841096,-29003639,-6657642 },
+ { 10340844,-6630377,-18656632,-2278430,12621151,-13339055,30878497,-11824370,-25584551,5181966 },
+ },
+ {
+ { 25940115,-12658025,17324188,-10307374,-8671468,15029094,24396252,-16450922,-2322852,-12388574 },
+ { -21765684,9916823,-1300409,4079498,-1028346,11909559,1782390,12641087,20603771,-6561742 },
+ { -18882287,-11673380,24849422,11501709,13161720,-4768874,1925523,11914390,4662781,7820689 },
+ },
+ {
+ { 12241050,-425982,8132691,9393934,32846760,-1599620,29749456,12172924,16136752,15264020 },
+ { -10349955,-14680563,-8211979,2330220,-17662549,-14545780,10658213,6671822,19012087,3772772 },
+ { 3753511,-3421066,10617074,2028709,14841030,-6721664,28718732,-15762884,20527771,12988982 },
+ },
+ {
+ { -14822485,-5797269,-3707987,12689773,-898983,-10914866,-24183046,-10564943,3299665,-12424953 },
+ { -16777703,-15253301,-9642417,4978983,3308785,8755439,6943197,6461331,-25583147,8991218 },
+ { -17226263,1816362,-1673288,-6086439,31783888,-8175991,-32948145,7417950,-30242287,1507265 },
+ },
+ {
+ { 29692663,6829891,-10498800,4334896,20945975,-11906496,-28887608,8209391,14606362,-10647073 },
+ { -3481570,8707081,32188102,5672294,22096700,1711240,-33020695,9761487,4170404,-2085325 },
+ { -11587470,14855945,-4127778,-1531857,-26649089,15084046,22186522,16002000,-14276837,-8400798 },
+ },
+ {
+ { -4811456,13761029,-31703877,-2483919,-3312471,7869047,-7113572,-9620092,13240845,10965870 },
+ { -7742563,-8256762,-14768334,-13656260,-23232383,12387166,4498947,14147411,29514390,4302863 },
+ { -13413405,-12407859,20757302,-13801832,14785143,8976368,-5061276,-2144373,17846988,-13971927 },
+ },
+},
+{
+ {
+ { -2244452,-754728,-4597030,-1066309,-6247172,1455299,-21647728,-9214789,-5222701,12650267 },
+ { -9906797,-16070310,21134160,12198166,-27064575,708126,387813,13770293,-19134326,10958663 },
+ { 22470984,12369526,23446014,-5441109,-21520802,-9698723,-11772496,-11574455,-25083830,4271862 },
+ },
+ {
+ { -25169565,-10053642,-19909332,15361595,-5984358,2159192,75375,-4278529,-32526221,8469673 },
+ { 15854970,4148314,-8893890,7259002,11666551,13824734,-30531198,2697372,24154791,-9460943 },
+ { 15446137,-15806644,29759747,14019369,30811221,-9610191,-31582008,12840104,24913809,9815020 },
+ },
+ {
+ { -4709286,-5614269,-31841498,-12288893,-14443537,10799414,-9103676,13438769,18735128,9466238 },
+ { 11933045,9281483,5081055,-5183824,-2628162,-4905629,-7727821,-10896103,-22728655,16199064 },
+ { 14576810,379472,-26786533,-8317236,-29426508,-10812974,-102766,1876699,30801119,2164795 },
+ },
+ {
+ { 15995086,3199873,13672555,13712240,-19378835,-4647646,-13081610,-15496269,-13492807,1268052 },
+ { -10290614,-3659039,-3286592,10948818,23037027,3794475,-3470338,-12600221,-17055369,3565904 },
+ { 29210088,-9419337,-5919792,-4952785,10834811,-13327726,-16512102,-10820713,-27162222,-14030531 },
+ },
+ {
+ { -13161890,15508588,16663704,-8156150,-28349942,9019123,-29183421,-3769423,2244111,-14001979 },
+ { -5152875,-3800936,-9306475,-6071583,16243069,14684434,-25673088,-16180800,13491506,4641841 },
+ { 10813417,643330,-19188515,-728916,30292062,-16600078,27548447,-7721242,14476989,-12767431 },
+ },
+ {
+ { 10292079,9984945,6481436,8279905,-7251514,7032743,27282937,-1644259,-27912810,12651324 },
+ { -31185513,-813383,22271204,11835308,10201545,15351028,17099662,3988035,21721536,-3148940 },
+ { 10202177,-6545839,-31373232,-9574638,-32150642,-8119683,-12906320,3852694,13216206,14842320 },
+ },
+ {
+ { -15815640,-10601066,-6538952,-7258995,-6984659,-6581778,-31500847,13765824,-27434397,9900184 },
+ { 14465505,-13833331,-32133984,-14738873,-27443187,12990492,33046193,15796406,-7051866,-8040114 },
+ { 30924417,-8279620,6359016,-12816335,16508377,9071735,-25488601,15413635,9524356,-7018878 },
+ },
+ {
+ { 12274201,-13175547,32627641,-1785326,6736625,13267305,5237659,-5109483,15663516,4035784 },
+ { -2951309,8903985,17349946,601635,-16432815,-4612556,-13732739,-15889334,-22258478,4659091 },
+ { -16916263,-4952973,-30393711,-15158821,20774812,15897498,5736189,15026997,-2178256,-13455585 },
+ },
+},
+{
+ {
+ { -8858980,-2219056,28571666,-10155518,-474467,-10105698,-3801496,278095,23440562,-290208 },
+ { 10226241,-5928702,15139956,120818,-14867693,5218603,32937275,11551483,-16571960,-7442864 },
+ { 17932739,-12437276,-24039557,10749060,11316803,7535897,22503767,5561594,-3646624,3898661 },
+ },
+ {
+ { 7749907,-969567,-16339731,-16464,-25018111,15122143,-1573531,7152530,21831162,1245233 },
+ { 26958459,-14658026,4314586,8346991,-5677764,11960072,-32589295,-620035,-30402091,-16716212 },
+ { -12165896,9166947,33491384,13673479,29787085,13096535,6280834,14587357,-22338025,13987525 },
+ },
+ {
+ { -24349909,7778775,21116000,15572597,-4833266,-5357778,-4300898,-5124639,-7469781,-2858068 },
+ { 9681908,-6737123,-31951644,13591838,-6883821,386950,31622781,6439245,-14581012,4091397 },
+ { -8426427,1470727,-28109679,-1596990,3978627,-5123623,-19622683,12092163,29077877,-14741988 },
+ },
+ {
+ { 5269168,-6859726,-13230211,-8020715,25932563,1763552,-5606110,-5505881,-20017847,2357889 },
+ { 32264008,-15407652,-5387735,-1160093,-2091322,-3946900,23104804,-12869908,5727338,189038 },
+ { 14609123,-8954470,-6000566,-16622781,-14577387,-7743898,-26745169,10942115,-25888931,-14884697 },
+ },
+ {
+ { 20513500,5557931,-15604613,7829531,26413943,-2019404,-21378968,7471781,13913677,-5137875 },
+ { -25574376,11967826,29233242,12948236,-6754465,4713227,-8940970,14059180,12878652,8511905 },
+ { -25656801,3393631,-2955415,-7075526,-2250709,9366908,-30223418,6812974,5568676,-3127656 },
+ },
+ {
+ { 11630004,12144454,2116339,13606037,27378885,15676917,-17408753,-13504373,-14395196,8070818 },
+ { 27117696,-10007378,-31282771,-5570088,1127282,12772488,-29845906,10483306,-11552749,-1028714 },
+ { 10637467,-5688064,5674781,1072708,-26343588,-6982302,-1683975,9177853,-27493162,15431203 },
+ },
+ {
+ { 20525145,10892566,-12742472,12779443,-29493034,16150075,-28240519,14943142,-15056790,-7935931 },
+ { -30024462,5626926,-551567,-9981087,753598,11981191,25244767,-3239766,-3356550,9594024 },
+ { -23752644,2636870,-5163910,-10103818,585134,7877383,11345683,-6492290,13352335,-10977084 },
+ },
+ {
+ { -1931799,-5407458,3304649,-12884869,17015806,-4877091,-29783850,-7752482,-13215537,-319204 },
+ { 20239939,6607058,6203985,3483793,-18386976,-779229,-20723742,15077870,-22750759,14523817 },
+ { 27406042,-6041657,27423596,-4497394,4996214,10002360,-28842031,-4545494,-30172742,-4805667 },
+ },
+},
+{
+ {
+ { 11374242,12660715,17861383,-12540833,10935568,1099227,-13886076,-9091740,-27727044,11358504 },
+ { -12730809,10311867,1510375,10778093,-2119455,-9145702,32676003,11149336,-26123651,4985768 },
+ { -19096303,341147,-6197485,-239033,15756973,-8796662,-983043,13794114,-19414307,-15621255 },
+ },
+ {
+ { 6490081,11940286,25495923,-7726360,8668373,-8751316,3367603,6970005,-1691065,-9004790 },
+ { 1656497,13457317,15370807,6364910,13605745,8362338,-19174622,-5475723,-16796596,-5031438 },
+ { -22273315,-13524424,-64685,-4334223,-18605636,-10921968,-20571065,-7007978,-99853,-10237333 },
+ },
+ {
+ { 17747465,10039260,19368299,-4050591,-20630635,-16041286,31992683,-15857976,-29260363,-5511971 },
+ { 31932027,-4986141,-19612382,16366580,22023614,88450,11371999,-3744247,4882242,-10626905 },
+ { 29796507,37186,19818052,10115756,-11829032,3352736,18551198,3272828,-5190932,-4162409 },
+ },
+ {
+ { 12501286,4044383,-8612957,-13392385,-32430052,5136599,-19230378,-3529697,330070,-3659409 },
+ { 6384877,2899513,17807477,7663917,-2358888,12363165,25366522,-8573892,-271295,12071499 },
+ { -8365515,-4042521,25133448,-4517355,-6211027,2265927,-32769618,1936675,-5159697,3829363 },
+ },
+ {
+ { 28425966,-5835433,-577090,-4697198,-14217555,6870930,7921550,-6567787,26333140,14267664 },
+ { -11067219,11871231,27385719,-10559544,-4585914,-11189312,10004786,-8709488,-21761224,8930324 },
+ { -21197785,-16396035,25654216,-1725397,12282012,11008919,1541940,4757911,-26491501,-16408940 },
+ },
+ {
+ { 13537262,-7759490,-20604840,10961927,-5922820,-13218065,-13156584,6217254,-15943699,13814990 },
+ { -17422573,15157790,18705543,29619,24409717,-260476,27361681,9257833,-1956526,-1776914 },
+ { -25045300,-10191966,15366585,15166509,-13105086,8423556,-29171540,12361135,-18685978,4578290 },
+ },
+ {
+ { 24579768,3711570,1342322,-11180126,-27005135,14124956,-22544529,14074919,21964432,8235257 },
+ { -6528613,-2411497,9442966,-5925588,12025640,-1487420,-2981514,-1669206,13006806,2355433 },
+ { -16304899,-13605259,-6632427,-5142349,16974359,-10911083,27202044,1719366,1141648,-12796236 },
+ },
+ {
+ { -12863944,-13219986,-8318266,-11018091,-6810145,-4843894,13475066,-3133972,32674895,13715045 },
+ { 11423335,-5468059,32344216,8962751,24989809,9241752,-13265253,16086212,-28740881,-15642093 },
+ { -1409668,12530728,-6368726,10847387,19531186,-14132160,-11709148,7791794,-27245943,4383347 },
+ },
+},
+{
+ {
+ { -28970898,5271447,-1266009,-9736989,-12455236,16732599,-4862407,-4906449,27193557,6245191 },
+ { -15193956,5362278,-1783893,2695834,4960227,12840725,23061898,3260492,22510453,8577507 },
+ { -12632451,11257346,-32692994,13548177,-721004,10879011,31168030,13952092,-29571492,-3635906 },
+ },
+ {
+ { 3877321,-9572739,32416692,5405324,-11004407,-13656635,3759769,11935320,5611860,8164018 },
+ { -16275802,14667797,15906460,12155291,-22111149,-9039718,32003002,-8832289,5773085,-8422109 },
+ { -23788118,-8254300,1950875,8937633,18686727,16459170,-905725,12376320,31632953,190926 },
+ },
+ {
+ { -24593607,-16138885,-8423991,13378746,14162407,6901328,-8288749,4508564,-25341555,-3627528 },
+ { 8884438,-5884009,6023974,10104341,-6881569,-4941533,18722941,-14786005,-1672488,827625 },
+ { -32720583,-16289296,-32503547,7101210,13354605,2659080,-1800575,-14108036,-24878478,1541286 },
+ },
+ {
+ { 2901347,-1117687,3880376,-10059388,-17620940,-3612781,-21802117,-3567481,20456845,-1885033 },
+ { 27019610,12299467,-13658288,-1603234,-12861660,-4861471,-19540150,-5016058,29439641,15138866 },
+ { 21536104,-6626420,-32447818,-10690208,-22408077,5175814,-5420040,-16361163,7779328,109896 },
+ },
+ {
+ { 30279744,14648750,-8044871,6425558,13639621,-743509,28698390,12180118,23177719,-554075 },
+ { 26572847,3405927,-31701700,12890905,-19265668,5335866,-6493768,2378492,4439158,-13279347 },
+ { -22716706,3489070,-9225266,-332753,18875722,-1140095,14819434,-12731527,-17717757,-5461437 },
+ },
+ {
+ { -5056483,16566551,15953661,3767752,-10436499,15627060,-820954,2177225,8550082,-15114165 },
+ { -18473302,16596775,-381660,15663611,22860960,15585581,-27844109,-3582739,-23260460,-8428588 },
+ { -32480551,15707275,-8205912,-5652081,29464558,2713815,-22725137,15860482,-21902570,1494193 },
+ },
+ {
+ { -19562091,-14087393,-25583872,-9299552,13127842,759709,21923482,16529112,8742704,12967017 },
+ { -28464899,1553205,32536856,-10473729,-24691605,-406174,-8914625,-2933896,-29903758,15553883 },
+ { 21877909,3230008,9881174,10539357,-4797115,2841332,11543572,14513274,19375923,-12647961 },
+ },
+ {
+ { 8832269,-14495485,13253511,5137575,5037871,4078777,24880818,-6222716,2862653,9455043 },
+ { 29306751,5123106,20245049,-14149889,9592566,8447059,-2077124,-2990080,15511449,4789663 },
+ { -20679756,7004547,8824831,-9434977,-4045704,-3750736,-5754762,108893,23513200,16652362 },
+ },
+},
+{
+ {
+ { -33256173,4144782,-4476029,-6579123,10770039,-7155542,-6650416,-12936300,-18319198,10212860 },
+ { 2756081,8598110,7383731,-6859892,22312759,-1105012,21179801,2600940,-9988298,-12506466 },
+ { -24645692,13317462,-30449259,-15653928,21365574,-10869657,11344424,864440,-2499677,-16710063 },
+ },
+ {
+ { -26432803,6148329,-17184412,-14474154,18782929,-275997,-22561534,211300,2719757,4940997 },
+ { -1323882,3911313,-6948744,14759765,-30027150,7851207,21690126,8518463,26699843,5276295 },
+ { -13149873,-6429067,9396249,365013,24703301,-10488939,1321586,149635,-15452774,7159369 },
+ },
+ {
+ { 9987780,-3404759,17507962,9505530,9731535,-2165514,22356009,8312176,22477218,-8403385 },
+ { 18155857,-16504990,19744716,9006923,15154154,-10538976,24256460,-4864995,-22548173,9334109 },
+ { 2986088,-4911893,10776628,-3473844,10620590,-7083203,-21413845,14253545,-22587149,536906 },
+ },
+ {
+ { 4377756,8115836,24567078,15495314,11625074,13064599,7390551,10589625,10838060,-15420424 },
+ { -19342404,867880,9277171,-3218459,-14431572,-1986443,19295826,-15796950,6378260,699185 },
+ { 7895026,4057113,-7081772,-13077756,-17886831,-323126,-716039,15693155,-5045064,-13373962 },
+ },
+ {
+ { -7737563,-5869402,-14566319,-7406919,11385654,13201616,31730678,-10962840,-3918636,-9669325 },
+ { 10188286,-15770834,-7336361,13427543,22223443,14896287,30743455,7116568,-21786507,5427593 },
+ { 696102,13206899,27047647,-10632082,15285305,-9853179,10798490,-4578720,19236243,12477404 },
+ },
+ {
+ { -11229439,11243796,-17054270,-8040865,-788228,-8167967,-3897669,11180504,-23169516,7733644 },
+ { 17800790,-14036179,-27000429,-11766671,23887827,3149671,23466177,-10538171,10322027,15313801 },
+ { 26246234,11968874,32263343,-5468728,6830755,-13323031,-15794704,-101982,-24449242,10890804 },
+ },
+ {
+ { -31365647,10271363,-12660625,-6267268,16690207,-13062544,-14982212,16484931,25180797,-5334884 },
+ { -586574,10376444,-32586414,-11286356,19801893,10997610,2276632,9482883,316878,13820577 },
+ { -9882808,-4510367,-2115506,16457136,-11100081,11674996,30756178,-7515054,30696930,-3712849 },
+ },
+ {
+ { 32988917,-9603412,12499366,7910787,-10617257,-11931514,-7342816,-9985397,-32349517,7392473 },
+ { -8855661,15927861,9866406,-3649411,-2396914,-16655781,-30409476,-9134995,25112947,-2926644 },
+ { -2504044,-436966,25621774,-5678772,15085042,-5479877,-24884878,-13526194,5537438,-13914319 },
+ },
+},
+{
+ {
+ { -11225584,2320285,-9584280,10149187,-33444663,5808648,-14876251,-1729667,31234590,6090599 },
+ { -9633316,116426,26083934,2897444,-6364437,-2688086,609721,15878753,-6970405,-9034768 },
+ { -27757857,247744,-15194774,-9002551,23288161,-10011936,-23869595,6503646,20650474,1804084 },
+ },
+ {
+ { -27589786,15456424,8972517,8469608,15640622,4439847,3121995,-10329713,27842616,-202328 },
+ { -15306973,2839644,22530074,10026331,4602058,5048462,28248656,5031932,-11375082,12714369 },
+ { 20807691,-7270825,29286141,11421711,-27876523,-13868230,-21227475,1035546,-19733229,12796920 },
+ },
+ {
+ { 12076899,-14301286,-8785001,-11848922,-25012791,16400684,-17591495,-12899438,3480665,-15182815 },
+ { -32361549,5457597,28548107,7833186,7303070,-11953545,-24363064,-15921875,-33374054,2771025 },
+ { -21389266,421932,26597266,6860826,22486084,-6737172,-17137485,-4210226,-24552282,15673397 },
+ },
+ {
+ { -20184622,2338216,19788685,-9620956,-4001265,-8740893,-20271184,4733254,3727144,-12934448 },
+ { 6120119,814863,-11794402,-622716,6812205,-15747771,2019594,7975683,31123697,-10958981 },
+ { 30069250,-11435332,30434654,2958439,18399564,-976289,12296869,9204260,-16432438,9648165 },
+ },
+ {
+ { 32705432,-1550977,30705658,7451065,-11805606,9631813,3305266,5248604,-26008332,-11377501 },
+ { 17219865,2375039,-31570947,-5575615,-19459679,9219903,294711,15298639,2662509,-16297073 },
+ { -1172927,-7558695,-4366770,-4287744,-21346413,-8434326,32087529,-1222777,32247248,-14389861 },
+ },
+ {
+ { 14312628,1221556,17395390,-8700143,-4945741,-8684635,-28197744,-9637817,-16027623,-13378845 },
+ { -1428825,-9678990,-9235681,6549687,-7383069,-468664,23046502,9803137,17597934,2346211 },
+ { 18510800,15337574,26171504,981392,-22241552,7827556,-23491134,-11323352,3059833,-11782870 },
+ },
+ {
+ { 10141598,6082907,17829293,-1947643,9830092,13613136,-25556636,-5544586,-33502212,3592096 },
+ { 33114168,-15889352,-26525686,-13343397,33076705,8716171,1151462,1521897,-982665,-6837803 },
+ { -32939165,-4255815,23947181,-324178,-33072974,-12305637,-16637686,3891704,26353178,693168 },
+ },
+ {
+ { 30374239,1595580,-16884039,13186931,4600344,406904,9585294,-400668,31375464,14369965 },
+ { -14370654,-7772529,1510301,6434173,-18784789,-6262728,32732230,-13108839,17901441,16011505 },
+ { 18171223,-11934626,-12500402,15197122,-11038147,-15230035,-19172240,-16046376,8764035,12309598 },
+ },
+},
+{
+ {
+ { 5975908,-5243188,-19459362,-9681747,-11541277,14015782,-23665757,1228319,17544096,-10593782 },
+ { 5811932,-1715293,3442887,-2269310,-18367348,-8359541,-18044043,-15410127,-5565381,12348900 },
+ { -31399660,11407555,25755363,6891399,-3256938,14872274,-24849353,8141295,-10632534,-585479 },
+ },
+ {
+ { -12675304,694026,-5076145,13300344,14015258,-14451394,-9698672,-11329050,30944593,1130208 },
+ { 8247766,-6710942,-26562381,-7709309,-14401939,-14648910,4652152,2488540,23550156,-271232 },
+ { 17294316,-3788438,7026748,15626851,22990044,113481,2267737,-5908146,-408818,-137719 },
+ },
+ {
+ { 16091085,-16253926,18599252,7340678,2137637,-1221657,-3364161,14550936,3260525,-7166271 },
+ { -4910104,-13332887,18550887,10864893,-16459325,-7291596,-23028869,-13204905,-12748722,2701326 },
+ { -8574695,16099415,4629974,-16340524,-20786213,-6005432,-10018363,9276971,11329923,1862132 },
+ },
+ {
+ { 14763076,-15903608,-30918270,3689867,3511892,10313526,-21951088,12219231,-9037963,-940300 },
+ { 8894987,-3446094,6150753,3013931,301220,15693451,-31981216,-2909717,-15438168,11595570 },
+ { 15214962,3537601,-26238722,-14058872,4418657,-15230761,13947276,10730794,-13489462,-4363670 },
+ },
+ {
+ { -2538306,7682793,32759013,263109,-29984731,-7955452,-22332124,-10188635,977108,699994 },
+ { -12466472,4195084,-9211532,550904,-15565337,12917920,19118110,-439841,-30534533,-14337913 },
+ { 31788461,-14507657,4799989,7372237,8808585,-14747943,9408237,-10051775,12493932,-5409317 },
+ },
+ {
+ { -25680606,5260744,-19235809,-6284470,-3695942,16566087,27218280,2607121,29375955,6024730 },
+ { 842132,-2794693,-4763381,-8722815,26332018,-12405641,11831880,6985184,-9940361,2854096 },
+ { -4847262,-7969331,2516242,-5847713,9695691,-7221186,16512645,960770,12121869,16648078 },
+ },
+ {
+ { -15218652,14667096,-13336229,2013717,30598287,-464137,-31504922,-7882064,20237806,2838411 },
+ { -19288047,4453152,15298546,-16178388,22115043,-15972604,12544294,-13470457,1068881,-12499905 },
+ { -9558883,-16518835,33238498,13506958,30505848,-1114596,-8486907,-2630053,12521378,4845654 },
+ },
+ {
+ { -28198521,10744108,-2958380,10199664,7759311,-13088600,3409348,-873400,-6482306,-12885870 },
+ { -23561822,6230156,-20382013,10655314,-24040585,-11621172,10477734,-1240216,-3113227,13974498 },
+ { 12966261,15550616,-32038948,-1615346,21025980,-629444,5642325,7188737,18895762,12629579 },
+ },
+},
+{
+ {
+ { 14741879,-14946887,22177208,-11721237,1279741,8058600,11758140,789443,32195181,3895677 },
+ { 10758205,15755439,-4509950,9243698,-4879422,6879879,-2204575,-3566119,-8982069,4429647 },
+ { -2453894,15725973,-20436342,-10410672,-5803908,-11040220,-7135870,-11642895,18047436,-15281743 },
+ },
+ {
+ { -25173001,-11307165,29759956,11776784,-22262383,-15820455,10993114,-12850837,-17620701,-9408468 },
+ { 21987233,700364,-24505048,14972008,-7774265,-5718395,32155026,2581431,-29958985,8773375 },
+ { -25568350,454463,-13211935,16126715,25240068,8594567,20656846,12017935,-7874389,-13920155 },
+ },
+ {
+ { 6028182,6263078,-31011806,-11301710,-818919,2461772,-31841174,-5468042,-1721788,-2776725 },
+ { -12278994,16624277,987579,-5922598,32908203,1248608,7719845,-4166698,28408820,6816612 },
+ { -10358094,-8237829,19549651,-12169222,22082623,16147817,20613181,13982702,-10339570,5067943 },
+ },
+ {
+ { -30505967,-3821767,12074681,13582412,-19877972,2443951,-19719286,12746132,5331210,-10105944 },
+ { 30528811,3601899,-1957090,4619785,-27361822,-15436388,24180793,-12570394,27679908,-1648928 },
+ { 9402404,-13957065,32834043,10838634,-26580150,-13237195,26653274,-8685565,22611444,-12715406 },
+ },
+ {
+ { 22190590,1118029,22736441,15130463,-30460692,-5991321,19189625,-4648942,4854859,6622139 },
+ { -8310738,-2953450,-8262579,-3388049,-10401731,-271929,13424426,-3567227,26404409,13001963 },
+ { -31241838,-15415700,-2994250,8939346,11562230,-12840670,-26064365,-11621720,-15405155,11020693 },
+ },
+ {
+ { 1866042,-7949489,-7898649,-10301010,12483315,13477547,3175636,-12424163,28761762,1406734 },
+ { -448555,-1777666,13018551,3194501,-9580420,-11161737,24760585,-4347088,25577411,-13378680 },
+ { -24290378,4759345,-690653,-1852816,2066747,10693769,-29595790,9884936,-9368926,4745410 },
+ },
+ {
+ { -9141284,6049714,-19531061,-4341411,-31260798,9944276,-15462008,-11311852,10931924,-11931931 },
+ { -16561513,14112680,-8012645,4817318,-8040464,-11414606,-22853429,10856641,-20470770,13434654 },
+ { 22759489,-10073434,-16766264,-1871422,13637442,-10168091,1765144,-12654326,28445307,-5364710 },
+ },
+ {
+ { 29875063,12493613,2795536,-3786330,1710620,15181182,-10195717,-8788675,9074234,1167180 },
+ { -26205683,11014233,-9842651,-2635485,-26908120,7532294,-18716888,-9535498,3843903,9367684 },
+ { -10969595,-6403711,9591134,9582310,11349256,108879,16235123,8601684,-139197,4242895 },
+ },
+},
+{
+ {
+ { 22092954,-13191123,-2042793,-11968512,32186753,-11517388,-6574341,2470660,-27417366,16625501 },
+ { -11057722,3042016,13770083,-9257922,584236,-544855,-7770857,2602725,-27351616,14247413 },
+ { 6314175,-10264892,-32772502,15957557,-10157730,168750,-8618807,14290061,27108877,-1180880 },
+ },
+ {
+ { -8586597,-7170966,13241782,10960156,-32991015,-13794596,33547976,-11058889,-27148451,981874 },
+ { 22833440,9293594,-32649448,-13618667,-9136966,14756819,-22928859,-13970780,-10479804,-16197962 },
+ { -7768587,3326786,-28111797,10783824,19178761,14905060,22680049,13906969,-15933690,3797899 },
+ },
+ {
+ { 21721356,-4212746,-12206123,9310182,-3882239,-13653110,23740224,-2709232,20491983,-8042152 },
+ { 9209270,-15135055,-13256557,-6167798,-731016,15289673,25947805,15286587,30997318,-6703063 },
+ { 7392032,16618386,23946583,-8039892,-13265164,-1533858,-14197445,-2321576,17649998,-250080 },
+ },
+ {
+ { -9301088,-14193827,30609526,-3049543,-25175069,-1283752,-15241566,-9525724,-2233253,7662146 },
+ { -17558673,1763594,-33114336,15908610,-30040870,-12174295,7335080,-8472199,-3174674,3440183 },
+ { -19889700,-5977008,-24111293,-9688870,10799743,-16571957,40450,-4431835,4862400,1133 },
+ },
+ {
+ { -32856209,-7873957,-5422389,14860950,-16319031,7956142,7258061,311861,-30594991,-7379421 },
+ { -3773428,-1565936,28985340,7499440,24445838,9325937,29727763,16527196,18278453,15405622 },
+ { -4381906,8508652,-19898366,-3674424,-5984453,15149970,-13313598,843523,-21875062,13626197 },
+ },
+ {
+ { 2281448,-13487055,-10915418,-2609910,1879358,16164207,-10783882,3953792,13340839,15928663 },
+ { 31727126,-7179855,-18437503,-8283652,2875793,-16390330,-25269894,-7014826,-23452306,5964753 },
+ { 4100420,-5959452,-17179337,6017714,-18705837,12227141,-26684835,11344144,2538215,-7570755 },
+ },
+ {
+ { -9433605,6123113,11159803,-2156608,30016280,14966241,-20474983,1485421,-629256,-15958862 },
+ { -26804558,4260919,11851389,9658551,-32017107,16367492,-20205425,-13191288,11659922,-11115118 },
+ { 26180396,10015009,-30844224,-8581293,5418197,9480663,2231568,-10170080,33100372,-1306171 },
+ },
+ {
+ { 15121113,-5201871,-10389905,15427821,-27509937,-15992507,21670947,4486675,-5931810,-14466380 },
+ { 16166486,-9483733,-11104130,6023908,-31926798,-1364923,2340060,-16254968,-10735770,-10039824 },
+ { 28042865,-3557089,-12126526,12259706,-3717498,-6945899,6766453,-8689599,18036436,5803270 },
+ },
+},
+{
+ {
+ { -817581,6763912,11803561,1585585,10958447,-2671165,23855391,4598332,-6159431,-14117438 },
+ { -31031306,-14256194,17332029,-2383520,31312682,-5967183,696309,50292,-20095739,11763584 },
+ { -594563,-2514283,-32234153,12643980,12650761,14811489,665117,-12613632,-19773211,-10713562 },
+ },
+ {
+ { 30464590,-11262872,-4127476,-12734478,19835327,-7105613,-24396175,2075773,-17020157,992471 },
+ { 18357185,-6994433,7766382,16342475,-29324918,411174,14578841,8080033,-11574335,-10601610 },
+ { 19598397,10334610,12555054,2555664,18821899,-10339780,21873263,16014234,26224780,16452269 },
+ },
+ {
+ { -30223925,5145196,5944548,16385966,3976735,2009897,-11377804,-7618186,-20533829,3698650 },
+ { 14187449,3448569,-10636236,-10810935,-22663880,-3433596,7268410,-10890444,27394301,12015369 },
+ { 19695761,16087646,28032085,12999827,6817792,11427614,20244189,-1312777,-13259127,-3402461 },
+ },
+ {
+ { 30860103,12735208,-1888245,-4699734,-16974906,2256940,-8166013,12298312,-8550524,-10393462 },
+ { -5719826,-11245325,-1910649,15569035,26642876,-7587760,-5789354,-15118654,-4976164,12651793 },
+ { -2848395,9953421,11531313,-5282879,26895123,-12697089,-13118820,-16517902,9768698,-2533218 },
+ },
+ {
+ { -24719459,1894651,-287698,-4704085,15348719,-8156530,32767513,12765450,4940095,10678226 },
+ { 18860224,15980149,-18987240,-1562570,-26233012,-11071856,-7843882,13944024,-24372348,16582019 },
+ { -15504260,4970268,-29893044,4175593,-20993212,-2199756,-11704054,15444560,-11003761,7989037 },
+ },
+ {
+ { 31490452,5568061,-2412803,2182383,-32336847,4531686,-32078269,6200206,-19686113,-14800171 },
+ { -17308668,-15879940,-31522777,-2831,-32887382,16375549,8680158,-16371713,28550068,-6857132 },
+ { -28126887,-5688091,16837845,-1820458,-6850681,12700016,-30039981,4364038,1155602,5988841 },
+ },
+ {
+ { 21890435,-13272907,-12624011,12154349,-7831873,15300496,23148983,-4470481,24618407,8283181 },
+ { -33136107,-10512751,9975416,6841041,-31559793,16356536,3070187,-7025928,1466169,10740210 },
+ { -1509399,-15488185,-13503385,-10655916,32799044,909394,-13938903,-5779719,-32164649,-15327040 },
+ },
+ {
+ { 3960823,-14267803,-28026090,-15918051,-19404858,13146868,15567327,951507,-3260321,-573935 },
+ { 24740841,5052253,-30094131,8961361,25877428,6165135,-24368180,14397372,-7380369,-6144105 },
+ { -28888365,3510803,-28103278,-1158478,-11238128,-10631454,-15441463,-14453128,-1625486,-6494814 },
+ },
+},
+{
+ {
+ { 793299,-9230478,8836302,-6235707,-27360908,-2369593,33152843,-4885251,-9906200,-621852 },
+ { 5666233,525582,20782575,-8038419,-24538499,14657740,16099374,1468826,-6171428,-15186581 },
+ { -4859255,-3779343,-2917758,-6748019,7778750,11688288,-30404353,-9871238,-1558923,-9863646 },
+ },
+ {
+ { 10896332,-7719704,824275,472601,-19460308,3009587,25248958,14783338,-30581476,-15757844 },
+ { 10566929,12612572,-31944212,11118703,-12633376,12362879,21752402,8822496,24003793,14264025 },
+ { 27713862,-7355973,-11008240,9227530,27050101,2504721,23886875,-13117525,13958495,-5732453 },
+ },
+ {
+ { -23481610,4867226,-27247128,3900521,29838369,-8212291,-31889399,-10041781,7340521,-15410068 },
+ { 4646514,-8011124,-22766023,-11532654,23184553,8566613,31366726,-1381061,-15066784,-10375192 },
+ { -17270517,12723032,-16993061,14878794,21619651,-6197576,27584817,3093888,-8843694,3849921 },
+ },
+ {
+ { -9064912,2103172,25561640,-15125738,-5239824,9582958,32477045,-9017955,5002294,-15550259 },
+ { -12057553,-11177906,21115585,-13365155,8808712,-12030708,16489530,13378448,-25845716,12741426 },
+ { -5946367,10645103,-30911586,15390284,-3286982,-7118677,24306472,15852464,28834118,-7646072 },
+ },
+ {
+ { -17335748,-9107057,-24531279,9434953,-8472084,-583362,-13090771,455841,20461858,5491305 },
+ { 13669248,-16095482,-12481974,-10203039,-14569770,-11893198,-24995986,11293807,-28588204,-9421832 },
+ { 28497928,6272777,-33022994,14470570,8906179,-1225630,18504674,-14165166,29867745,-8795943 },
+ },
+ {
+ { -16207023,13517196,-27799630,-13697798,24009064,-6373891,-6367600,-13175392,22853429,-4012011 },
+ { 24191378,16712145,-13931797,15217831,14542237,1646131,18603514,-11037887,12876623,-2112447 },
+ { 17902668,4518229,-411702,-2829247,26878217,5258055,-12860753,608397,16031844,3723494 },
+ },
+ {
+ { -28632773,12763728,-20446446,7577504,33001348,-13017745,17558842,-7872890,23896954,-4314245 },
+ { -20005381,-12011952,31520464,605201,2543521,5991821,-2945064,7229064,-9919646,-8826859 },
+ { 28816045,298879,-28165016,-15920938,19000928,-1665890,-12680833,-2949325,-18051778,-2082915 },
+ },
+ {
+ { 16000882,-344896,3493092,-11447198,-29504595,-13159789,12577740,16041268,-19715240,7847707 },
+ { 10151868,10572098,27312476,7922682,14825339,4723128,-32855931,-6519018,-10020567,3852848 },
+ { -11430470,15697596,-21121557,-4420647,5386314,15063598,16514493,-15932110,29330899,-15076224 },
+ },
+},
+{
+ {
+ { -25499735,-4378794,-15222908,-6901211,16615731,2051784,3303702,15490,-27548796,12314391 },
+ { 15683520,-6003043,18109120,-9980648,15337968,-5997823,-16717435,15921866,16103996,-3731215 },
+ { -23169824,-10781249,13588192,-1628807,-3798557,-1074929,-19273607,5402699,-29815713,-9841101 },
+ },
+ {
+ { 23190676,2384583,-32714340,3462154,-29903655,-1529132,-11266856,8911517,-25205859,2739713 },
+ { 21374101,-3554250,-33524649,9874411,15377179,11831242,-33529904,6134907,4931255,11987849 },
+ { -7732,-2978858,-16223486,7277597,105524,-322051,-31480539,13861388,-30076310,10117930 },
+ },
+ {
+ { -29501170,-10744872,-26163768,13051539,-25625564,5089643,-6325503,6704079,12890019,15728940 },
+ { -21972360,-11771379,-951059,-4418840,14704840,2695116,903376,-10428139,12885167,8311031 },
+ { -17516482,5352194,10384213,-13811658,7506451,13453191,26423267,4384730,1888765,-5435404 },
+ },
+ {
+ { -25817338,-3107312,-13494599,-3182506,30896459,-13921729,-32251644,-12707869,-19464434,-3340243 },
+ { -23607977,-2665774,-526091,4651136,5765089,4618330,6092245,14845197,17151279,-9854116 },
+ { -24830458,-12733720,-15165978,10367250,-29530908,-265356,22825805,-7087279,-16866484,16176525 },
+ },
+ {
+ { -23583256,6564961,20063689,3798228,-4740178,7359225,2006182,-10363426,-28746253,-10197509 },
+ { -10626600,-4486402,-13320562,-5125317,3432136,-6393229,23632037,-1940610,32808310,1099883 },
+ { 15030977,5768825,-27451236,-2887299,-6427378,-15361371,-15277896,-6809350,2051441,-15225865 },
+ },
+ {
+ { -3362323,-7239372,7517890,9824992,23555850,295369,5148398,-14154188,-22686354,16633660 },
+ { 4577086,-16752288,13249841,-15304328,19958763,-14537274,18559670,-10759549,8402478,-9864273 },
+ { -28406330,-1051581,-26790155,-907698,-17212414,-11030789,9453451,-14980072,17983010,9967138 },
+ },
+ {
+ { -25762494,6524722,26585488,9969270,24709298,1220360,-1677990,7806337,17507396,3651560 },
+ { -10420457,-4118111,14584639,15971087,-15768321,8861010,26556809,-5574557,-18553322,-11357135 },
+ { 2839101,14284142,4029895,3472686,14402957,12689363,-26642121,8459447,-5605463,-7621941 },
+ },
+ {
+ { -4839289,-3535444,9744961,2871048,25113978,3187018,-25110813,-849066,17258084,-7977739 },
+ { 18164541,-10595176,-17154882,-1542417,19237078,-9745295,23357533,-15217008,26908270,12150756 },
+ { -30264870,-7647865,5112249,-7036672,-1499807,-6974257,43168,-5537701,-32302074,16215819 },
+ },
+},
+{
+ {
+ { -6898905,9824394,-12304779,-4401089,-31397141,-6276835,32574489,12532905,-7503072,-8675347 },
+ { -27343522,-16515468,-27151524,-10722951,946346,16291093,254968,7168080,21676107,-1943028 },
+ { 21260961,-8424752,-16831886,-11920822,-23677961,3968121,-3651949,-6215466,-3556191,-7913075 },
+ },
+ {
+ { 16544754,13250366,-16804428,15546242,-4583003,12757258,-2462308,-8680336,-18907032,-9662799 },
+ { -2415239,-15577728,18312303,4964443,-15272530,-12653564,26820651,16690659,25459437,-4564609 },
+ { -25144690,11425020,28423002,-11020557,-6144921,-15826224,9142795,-2391602,-6432418,-1644817 },
+ },
+ {
+ { -23104652,6253476,16964147,-3768872,-25113972,-12296437,-27457225,-16344658,6335692,7249989 },
+ { -30333227,13979675,7503222,-12368314,-11956721,-4621693,-30272269,2682242,25993170,-12478523 },
+ { 4364628,5930691,32304656,-10044554,-8054781,15091131,22857016,-10598955,31820368,15075278 },
+ },
+ {
+ { 31879134,-8918693,17258761,90626,-8041836,-4917709,24162788,-9650886,-17970238,12833045 },
+ { 19073683,14851414,-24403169,-11860168,7625278,11091125,-19619190,2074449,-9413939,14905377 },
+ { 24483667,-11935567,-2518866,-11547418,-1553130,15355506,-25282080,9253129,27628530,-7555480 },
+ },
+ {
+ { 17597607,8340603,19355617,552187,26198470,-3176583,4593324,-9157582,-14110875,15297016 },
+ { 510886,14337390,-31785257,16638632,6328095,2713355,-20217417,-11864220,8683221,2921426 },
+ { 18606791,11874196,27155355,-5281482,-24031742,6265446,-25178240,-1278924,4674690,13890525 },
+ },
+ {
+ { 13609624,13069022,-27372361,-13055908,24360586,9592974,14977157,9835105,4389687,288396 },
+ { 9922506,-519394,13613107,5883594,-18758345,-434263,-12304062,8317628,23388070,16052080 },
+ { 12720016,11937594,-31970060,-5028689,26900120,8561328,-20155687,-11632979,-14754271,-10812892 },
+ },
+ {
+ { 15961858,14150409,26716931,-665832,-22794328,13603569,11829573,7467844,-28822128,929275 },
+ { 11038231,-11582396,-27310482,-7316562,-10498527,-16307831,-23479533,-9371869,-21393143,2465074 },
+ { 20017163,-4323226,27915242,1529148,12396362,15675764,13817261,-9658066,2463391,-4622140 },
+ },
+ {
+ { -16358878,-12663911,-12065183,4996454,-1256422,1073572,9583558,12851107,4003896,12673717 },
+ { -1731589,-15155870,-3262930,16143082,19294135,13385325,14741514,-9103726,7903886,2348101 },
+ { 24536016,-16515207,12715592,-3862155,1511293,10047386,-3842346,-7129159,-28377538,10048127 },
+ },
+},
+{
+ {
+ { -12622226,-6204820,30718825,2591312,-10617028,12192840,18873298,-7297090,-32297756,15221632 },
+ { -26478122,-11103864,11546244,-1852483,9180880,7656409,-21343950,2095755,29769758,6593415 },
+ { -31994208,-2907461,4176912,3264766,12538965,-868111,26312345,-6118678,30958054,8292160 },
+ },
+ {
+ { 31429822,-13959116,29173532,15632448,12174511,-2760094,32808831,3977186,26143136,-3148876 },
+ { 22648901,1402143,-22799984,13746059,7936347,365344,-8668633,-1674433,-3758243,-2304625 },
+ { -15491917,8012313,-2514730,-12702462,-23965846,-10254029,-1612713,-1535569,-16664475,8194478 },
+ },
+ {
+ { 27338066,-7507420,-7414224,10140405,-19026427,-6589889,27277191,8855376,28572286,3005164 },
+ { 26287124,4821776,25476601,-4145903,-3764513,-15788984,-18008582,1182479,-26094821,-13079595 },
+ { -7171154,3178080,23970071,6201893,-17195577,-4489192,-21876275,-13982627,32208683,-1198248 },
+ },
+ {
+ { -16657702,2817643,-10286362,14811298,6024667,13349505,-27315504,-10497842,-27672585,-11539858 },
+ { 15941029,-9405932,-21367050,8062055,31876073,-238629,-15278393,-1444429,15397331,-4130193 },
+ { 8934485,-13485467,-23286397,-13423241,-32446090,14047986,31170398,-1441021,-27505566,15087184 },
+ },
+ {
+ { -18357243,-2156491,24524913,-16677868,15520427,-6360776,-15502406,11461896,16788528,-5868942 },
+ { -1947386,16013773,21750665,3714552,-17401782,-16055433,-3770287,-10323320,31322514,-11615635 },
+ { 21426655,-5650218,-13648287,-5347537,-28812189,-4920970,-18275391,-14621414,13040862,-12112948 },
+ },
+ {
+ { 11293895,12478086,-27136401,15083750,-29307421,14748872,14555558,-13417103,1613711,4896935 },
+ { -25894883,15323294,-8489791,-8057900,25967126,-13425460,2825960,-4897045,-23971776,-11267415 },
+ { -15924766,-5229880,-17443532,6410664,3622847,10243618,20615400,12405433,-23753030,-8436416 },
+ },
+ {
+ { -7091295,12556208,-20191352,9025187,-17072479,4333801,4378436,2432030,23097949,-566018 },
+ { 4565804,-16025654,20084412,-7842817,1724999,189254,24767264,10103221,-18512313,2424778 },
+ { 366633,-11976806,8173090,-6890119,30788634,5745705,-7168678,1344109,-3642553,12412659 },
+ },
+ {
+ { -24001791,7690286,14929416,-168257,-32210835,-13412986,24162697,-15326504,-3141501,11179385 },
+ { 18289522,-14724954,8056945,16430056,-21729724,7842514,-6001441,-1486897,-18684645,-11443503 },
+ { 476239,6601091,-6152790,-9723375,17503545,-4863900,27672959,13403813,11052904,5219329 },
+ },
+},
+{
+ {
+ { 20678546,-8375738,-32671898,8849123,-5009758,14574752,31186971,-3973730,9014762,-8579056 },
+ { -13644050,-10350239,-15962508,5075808,-1514661,-11534600,-33102500,9160280,8473550,-3256838 },
+ { 24900749,14435722,17209120,-15292541,-22592275,9878983,-7689309,-16335821,-24568481,11788948 },
+ },
+ {
+ { -3118155,-11395194,-13802089,14797441,9652448,-6845904,-20037437,10410733,-24568470,-1458691 },
+ { -15659161,16736706,-22467150,10215878,-9097177,7563911,11871841,-12505194,-18513325,8464118 },
+ { -23400612,8348507,-14585951,-861714,-3950205,-6373419,14325289,8628612,33313881,-8370517 },
+ },
+ {
+ { -20186973,-4967935,22367356,5271547,-1097117,-4788838,-24805667,-10236854,-8940735,-5818269 },
+ { -6948785,-1795212,-32625683,-16021179,32635414,-7374245,15989197,-12838188,28358192,-4253904 },
+ { -23561781,-2799059,-32351682,-1661963,-9147719,10429267,-16637684,4072016,-5351664,5596589 },
+ },
+ {
+ { -28236598,-3390048,12312896,6213178,3117142,16078565,29266239,2557221,1768301,15373193 },
+ { -7243358,-3246960,-4593467,-7553353,-127927,-912245,-1090902,-4504991,-24660491,3442910 },
+ { -30210571,5124043,14181784,8197961,18964734,-11939093,22597931,7176455,-18585478,13365930 },
+ },
+ {
+ { -7877390,-1499958,8324673,4690079,6261860,890446,24538107,-8570186,-9689599,-3031667 },
+ { 25008904,-10771599,-4305031,-9638010,16265036,15721635,683793,-11823784,15723479,-15163481 },
+ { -9660625,12374379,-27006999,-7026148,-7724114,-12314514,11879682,5400171,519526,-1235876 },
+ },
+ {
+ { 22258397,-16332233,-7869817,14613016,-22520255,-2950923,-20353881,7315967,16648397,7605640 },
+ { -8081308,-8464597,-8223311,9719710,19259459,-15348212,23994942,-5281555,-9468848,4763278 },
+ { -21699244,9220969,-15730624,1084137,-25476107,-2852390,31088447,-7764523,-11356529,728112 },
+ },
+ {
+ { 26047220,-11751471,-6900323,-16521798,24092068,9158119,-4273545,-12555558,-29365436,-5498272 },
+ { 17510331,-322857,5854289,8403524,17133918,-3112612,-28111007,12327945,10750447,10014012 },
+ { -10312768,3936952,9156313,-8897683,16498692,-994647,-27481051,-666732,3424691,7540221 },
+ },
+ {
+ { 30322361,-6964110,11361005,-4143317,7433304,4989748,-7071422,-16317219,-9244265,15258046 },
+ { 13054562,-2779497,19155474,469045,-12482797,4566042,5631406,2711395,1062915,-5136345 },
+ { -19240248,-11254599,-29509029,-7499965,-5835763,13005411,-6066489,12194497,32960380,1459310 },
+ },
+},
+{
+ {
+ { 19852034,7027924,23669353,10020366,8586503,-6657907,394197,-6101885,18638003,-11174937 },
+ { 31395534,15098109,26581030,8030562,-16527914,-5007134,9012486,-7584354,-6643087,-5442636 },
+ { -9192165,-2347377,-1997099,4529534,25766844,607986,-13222,9677543,-32294889,-6456008 },
+ },
+ {
+ { -2444496,-149937,29348902,8186665,1873760,12489863,-30934579,-7839692,-7852844,-8138429 },
+ { -15236356,-15433509,7766470,746860,26346930,-10221762,-27333451,10754588,-9431476,5203576 },
+ { 31834314,14135496,-770007,5159118,20917671,-16768096,-7467973,-7337524,31809243,7347066 },
+ },
+ {
+ { -9606723,-11874240,20414459,13033986,13716524,-11691881,19797970,-12211255,15192876,-2087490 },
+ { -12663563,-2181719,1168162,-3804809,26747877,-14138091,10609330,12694420,33473243,-13382104 },
+ { 33184999,11180355,15832085,-11385430,-1633671,225884,15089336,-11023903,-6135662,14480053 },
+ },
+ {
+ { 31308717,-5619998,31030840,-1897099,15674547,-6582883,5496208,13685227,27595050,8737275 },
+ { -20318852,-15150239,10933843,-16178022,8335352,-7546022,-31008351,-12610604,26498114,66511 },
+ { 22644454,-8761729,-16671776,4884562,-3105614,-13559366,30540766,-4286747,-13327787,-7515095 },
+ },
+ {
+ { -28017847,9834845,18617207,-2681312,-3401956,-13307506,8205540,13585437,-17127465,15115439 },
+ { 23711543,-672915,31206561,-8362711,6164647,-9709987,-33535882,-1426096,8236921,16492939 },
+ { -23910559,-13515526,-26299483,-4503841,25005590,-7687270,19574902,10071562,6708380,-6222424 },
+ },
+ {
+ { 2101391,-4930054,19702731,2367575,-15427167,1047675,5301017,9328700,29955601,-11678310 },
+ { 3096359,9271816,-21620864,-15521844,-14847996,-7592937,-25892142,-12635595,-9917575,6216608 },
+ { -32615849,338663,-25195611,2510422,-29213566,-13820213,24822830,-6146567,-26767480,7525079 },
+ },
+ {
+ { -23066649,-13985623,16133487,-7896178,-3389565,778788,-910336,-2782495,-19386633,11994101 },
+ { 21691500,-13624626,-641331,-14367021,3285881,-3483596,-25064666,9718258,-7477437,13381418 },
+ { 18445390,-4202236,14979846,11622458,-1727110,-3582980,23111648,-6375247,28535282,15779576 },
+ },
+ {
+ { 30098053,3089662,-9234387,16662135,-21306940,11308411,-14068454,12021730,9955285,-16303356 },
+ { 9734894,-14576830,-7473633,-9138735,2060392,11313496,-18426029,9924399,20194861,13380996 },
+ { -26378102,-7965207,-22167821,15789297,-18055342,-6168792,-1984914,15707771,26342023,10146099 },
+ },
+},
+{
+ {
+ { -26016874,-219943,21339191,-41388,19745256,-2878700,-29637280,2227040,21612326,-545728 },
+ { -13077387,1184228,23562814,-5970442,-20351244,-6348714,25764461,12243797,-20856566,11649658 },
+ { -10031494,11262626,27384172,2271902,26947504,-15997771,39944,6114064,33514190,2333242 },
+ },
+ {
+ { -21433588,-12421821,8119782,7219913,-21830522,-9016134,-6679750,-12670638,24350578,-13450001 },
+ { -4116307,-11271533,-23886186,4843615,-30088339,690623,-31536088,-10406836,8317860,12352766 },
+ { 18200138,-14475911,-33087759,-2696619,-23702521,-9102511,-23552096,-2287550,20712163,6719373 },
+ },
+ {
+ { 26656208,6075253,-7858556,1886072,-28344043,4262326,11117530,-3763210,26224235,-3297458 },
+ { -17168938,-14854097,-3395676,-16369877,-19954045,14050420,21728352,9493610,18620611,-16428628 },
+ { -13323321,13325349,11432106,5964811,18609221,6062965,-5269471,-9725556,-30701573,-16479657 },
+ },
+ {
+ { -23860538,-11233159,26961357,1640861,-32413112,-16737940,12248509,-5240639,13735342,1934062 },
+ { 25089769,6742589,17081145,-13406266,21909293,-16067981,-15136294,-3765346,-21277997,5473616 },
+ { 31883677,-7961101,1083432,-11572403,22828471,13290673,-7125085,12469656,29111212,-5451014 },
+ },
+ {
+ { 24244947,-15050407,-26262976,2791540,-14997599,16666678,24367466,6388839,-10295587,452383 },
+ { -25640782,-3417841,5217916,16224624,19987036,-4082269,-24236251,-5915248,15766062,8407814 },
+ { -20406999,13990231,15495425,16395525,5377168,15166495,-8917023,-4388953,-8067909,2276718 },
+ },
+ {
+ { 30157918,12924066,-17712050,9245753,19895028,3368142,-23827587,5096219,22740376,-7303417 },
+ { 2041139,-14256350,7783687,13876377,-25946985,-13352459,24051124,13742383,-15637599,13295222 },
+ { 33338237,-8505733,12532113,7977527,9106186,-1715251,-17720195,-4612972,-4451357,-14669444 },
+ },
+ {
+ { -20045281,5454097,-14346548,6447146,28862071,1883651,-2469266,-4141880,7770569,9620597 },
+ { 23208068,7979712,33071466,8149229,1758231,-10834995,30945528,-1694323,-33502340,-14767970 },
+ { 1439958,-16270480,-1079989,-793782,4625402,10647766,-5043801,1220118,30494170,-11440799 },
+ },
+ {
+ { -5037580,-13028295,-2970559,-3061767,15640974,-6701666,-26739026,926050,-1684339,-13333647 },
+ { 13908495,-3549272,30919928,-6273825,-21521863,7989039,9021034,9078865,3353509,4033511 },
+ { -29663431,-15113610,32259991,-344482,24295849,-12912123,23161163,8839127,27485041,7356032 },
+ },
+},
+{
+ {
+ { 9661027,705443,11980065,-5370154,-1628543,14661173,-6346142,2625015,28431036,-16771834 },
+ { -23839233,-8311415,-25945511,7480958,-17681669,-8354183,-22545972,14150565,15970762,4099461 },
+ { 29262576,16756590,26350592,-8793563,8529671,-11208050,13617293,-9937143,11465739,8317062 },
+ },
+ {
+ { -25493081,-6962928,32500200,-9419051,-23038724,-2302222,14898637,3848455,20969334,-5157516 },
+ { -20384450,-14347713,-18336405,13884722,-33039454,2842114,-21610826,-3649888,11177095,14989547 },
+ { -24496721,-11716016,16959896,2278463,12066309,10137771,13515641,2581286,-28487508,9930240 },
+ },
+ {
+ { -17751622,-2097826,16544300,-13009300,-15914807,-14949081,18345767,-13403753,16291481,-5314038 },
+ { -33229194,2553288,32678213,9875984,8534129,6889387,-9676774,6957617,4368891,9788741 },
+ { 16660756,7281060,-10830758,12911820,20108584,-8101676,-21722536,-8613148,16250552,-11111103 },
+ },
+ {
+ { -19765507,2390526,-16551031,14161980,1905286,6414907,4689584,10604807,-30190403,4782747 },
+ { -1354539,14736941,-7367442,-13292886,7710542,-14155590,-9981571,4383045,22546403,437323 },
+ { 31665577,-12180464,-16186830,1491339,-18368625,3294682,27343084,2786261,-30633590,-14097016 },
+ },
+ {
+ { -14467279,-683715,-33374107,7448552,19294360,14334329,-19690631,2355319,-19284671,-6114373 },
+ { 15121312,-15796162,6377020,-6031361,-10798111,-12957845,18952177,15496498,-29380133,11754228 },
+ { -2637277,-13483075,8488727,-14303896,12728761,-1622493,7141596,11724556,22761615,-10134141 },
+ },
+ {
+ { 16918416,11729663,-18083579,3022987,-31015732,-13339659,-28741185,-12227393,32851222,11717399 },
+ { 11166634,7338049,-6722523,4531520,-29468672,-7302055,31474879,3483633,-1193175,-4030831 },
+ { -185635,9921305,31456609,-13536438,-12013818,13348923,33142652,6546660,-19985279,-3948376 },
+ },
+ {
+ { -32460596,11266712,-11197107,-7899103,31703694,3855903,-8537131,-12833048,-30772034,-15486313 },
+ { -18006477,12709068,3991746,-6479188,-21491523,-10550425,-31135347,-16049879,10928917,3011958 },
+ { -6957757,-15594337,31696059,334240,29576716,14796075,-30831056,-12805180,18008031,10258577 },
+ },
+ {
+ { -22448644,15655569,7018479,-4410003,-30314266,-1201591,-1853465,1367120,25127874,6671743 },
+ { 29701166,-14373934,-10878120,9279288,-17568,13127210,21382910,11042292,25838796,4642684 },
+ { -20430234,14955537,-24126347,8124619,-5369288,-5990470,30468147,-13900640,18423289,4177476 },
+ },
+},
diff --git a/plugin/auth_ed25519/ref10/base2.h b/plugin/auth_ed25519/ref10/base2.h
new file mode 100644
index 00000000000..8c538440fff
--- /dev/null
+++ b/plugin/auth_ed25519/ref10/base2.h
@@ -0,0 +1,40 @@
+ {
+ { 25967493,-14356035,29566456,3660896,-12694345,4014787,27544626,-11754271,-6079156,2047605 },
+ { -12545711,934262,-2722910,3049990,-727428,9406986,12720692,5043384,19500929,-15469378 },
+ { -8738181,4489570,9688441,-14785194,10184609,-12363380,29287919,11864899,-24514362,-4438546 },
+ },
+ {
+ { 15636291,-9688557,24204773,-7912398,616977,-16685262,27787600,-14772189,28944400,-1550024 },
+ { 16568933,4717097,-11556148,-1102322,15682896,-11807043,16354577,-11775962,7689662,11199574 },
+ { 30464156,-5976125,-11779434,-15670865,23220365,15915852,7512774,10017326,-17749093,-9920357 },
+ },
+ {
+ { 10861363,11473154,27284546,1981175,-30064349,12577861,32867885,14515107,-15438304,10819380 },
+ { 4708026,6336745,20377586,9066809,-11272109,6594696,-25653668,12483688,-12668491,5581306 },
+ { 19563160,16186464,-29386857,4097519,10237984,-4348115,28542350,13850243,-23678021,-15815942 },
+ },
+ {
+ { 5153746,9909285,1723747,-2777874,30523605,5516873,19480852,5230134,-23952439,-15175766 },
+ { -30269007,-3463509,7665486,10083793,28475525,1649722,20654025,16520125,30598449,7715701 },
+ { 28881845,14381568,9657904,3680757,-20181635,7843316,-31400660,1370708,29794553,-1409300 },
+ },
+ {
+ { -22518993,-6692182,14201702,-8745502,-23510406,8844726,18474211,-1361450,-13062696,13821877 },
+ { -6455177,-7839871,3374702,-4740862,-27098617,-10571707,31655028,-7212327,18853322,-14220951 },
+ { 4566830,-12963868,-28974889,-12240689,-7602672,-2830569,-8514358,-10431137,2207753,-3209784 },
+ },
+ {
+ { -25154831,-4185821,29681144,7868801,-6854661,-9423865,-12437364,-663000,-31111463,-16132436 },
+ { 25576264,-2703214,7349804,-11814844,16472782,9300885,3844789,15725684,171356,6466918 },
+ { 23103977,13316479,9739013,-16149481,817875,-15038942,8965339,-14088058,-30714912,16193877 },
+ },
+ {
+ { -33521811,3180713,-2394130,14003687,-16903474,-16270840,17238398,4729455,-18074513,9256800 },
+ { -25182317,-4174131,32336398,5036987,-21236817,11360617,22616405,9761698,-19827198,630305 },
+ { -13720693,2639453,-24237460,-7406481,9494427,-5774029,-6554551,-15960994,-2449256,-14291300 },
+ },
+ {
+ { -3151181,-5046075,9282714,6866145,-31907062,-863023,-18940575,15033784,25105118,-7894876 },
+ { -24326370,15950226,-31801215,-14592823,-11662737,-5090925,1573892,-2625887,2198790,-15804619 },
+ { -3099351,10324967,-2241613,7453183,-5446979,-2735503,-13812022,-16236442,-32461234,-12290683 },
+ },
diff --git a/plugin/auth_ed25519/ref10/d.h b/plugin/auth_ed25519/ref10/d.h
new file mode 100644
index 00000000000..e25f5783507
--- /dev/null
+++ b/plugin/auth_ed25519/ref10/d.h
@@ -0,0 +1 @@
+-10913610,13857413,-15372611,6949391,114729,-8787816,-6275908,-3247719,-18696448,-12055116
diff --git a/plugin/auth_ed25519/ref10/d2.h b/plugin/auth_ed25519/ref10/d2.h
new file mode 100644
index 00000000000..01aaec75127
--- /dev/null
+++ b/plugin/auth_ed25519/ref10/d2.h
@@ -0,0 +1 @@
+-21827239,-5839606,-30745221,13898782,229458,15978800,-12551817,-6495438,29715968,9444199
diff --git a/plugin/auth_ed25519/ref10/fe.h b/plugin/auth_ed25519/ref10/fe.h
new file mode 100644
index 00000000000..60c308ba463
--- /dev/null
+++ b/plugin/auth_ed25519/ref10/fe.h
@@ -0,0 +1,56 @@
+#ifndef FE_H
+#define FE_H
+
+#include "crypto_int32.h"
+
+typedef crypto_int32 fe[10];
+
+/*
+fe means field element.
+Here the field is \Z/(2^255-19).
+An element t, entries t[0]...t[9], represents the integer
+t[0]+2^26 t[1]+2^51 t[2]+2^77 t[3]+2^102 t[4]+...+2^230 t[9].
+Bounds on each t[i] vary depending on context.
+*/
+
+#define fe_frombytes crypto_sign_ed25519_ref10_fe_frombytes
+#define fe_tobytes crypto_sign_ed25519_ref10_fe_tobytes
+#define fe_copy crypto_sign_ed25519_ref10_fe_copy
+#define fe_isnonzero crypto_sign_ed25519_ref10_fe_isnonzero
+#define fe_isnegative crypto_sign_ed25519_ref10_fe_isnegative
+#define fe_0 crypto_sign_ed25519_ref10_fe_0
+#define fe_1 crypto_sign_ed25519_ref10_fe_1
+#define fe_cswap crypto_sign_ed25519_ref10_fe_cswap
+#define fe_cmov crypto_sign_ed25519_ref10_fe_cmov
+#define fe_add crypto_sign_ed25519_ref10_fe_add
+#define fe_sub crypto_sign_ed25519_ref10_fe_sub
+#define fe_neg crypto_sign_ed25519_ref10_fe_neg
+#define fe_mul crypto_sign_ed25519_ref10_fe_mul
+#define fe_sq crypto_sign_ed25519_ref10_fe_sq
+#define fe_sq2 crypto_sign_ed25519_ref10_fe_sq2
+#define fe_mul121666 crypto_sign_ed25519_ref10_fe_mul121666
+#define fe_invert crypto_sign_ed25519_ref10_fe_invert
+#define fe_pow22523 crypto_sign_ed25519_ref10_fe_pow22523
+
+extern void fe_frombytes(fe,const unsigned char *);
+extern void fe_tobytes(unsigned char *,const fe);
+
+extern void fe_copy(fe,const fe);
+extern int fe_isnonzero(const fe);
+extern int fe_isnegative(const fe);
+extern void fe_0(fe);
+extern void fe_1(fe);
+extern void fe_cswap(fe,fe,unsigned int);
+extern void fe_cmov(fe,const fe,unsigned int);
+
+extern void fe_add(fe,const fe,const fe);
+extern void fe_sub(fe,const fe,const fe);
+extern void fe_neg(fe,const fe);
+extern void fe_mul(fe,const fe,const fe);
+extern void fe_sq(fe,const fe);
+extern void fe_sq2(fe,const fe);
+extern void fe_mul121666(fe,const fe);
+extern void fe_invert(fe,const fe);
+extern void fe_pow22523(fe,const fe);
+
+#endif
diff --git a/plugin/auth_ed25519/ref10/fe_0.c b/plugin/auth_ed25519/ref10/fe_0.c
new file mode 100644
index 00000000000..ec879d7337f
--- /dev/null
+++ b/plugin/auth_ed25519/ref10/fe_0.c
@@ -0,0 +1,19 @@
+#include "fe.h"
+
+/*
+h = 0
+*/
+
+void fe_0(fe h)
+{
+ h[0] = 0;
+ h[1] = 0;
+ h[2] = 0;
+ h[3] = 0;
+ h[4] = 0;
+ h[5] = 0;
+ h[6] = 0;
+ h[7] = 0;
+ h[8] = 0;
+ h[9] = 0;
+}
diff --git a/plugin/auth_ed25519/ref10/fe_1.c b/plugin/auth_ed25519/ref10/fe_1.c
new file mode 100644
index 00000000000..8cf77848447
--- /dev/null
+++ b/plugin/auth_ed25519/ref10/fe_1.c
@@ -0,0 +1,19 @@
+#include "fe.h"
+
+/*
+h = 1
+*/
+
+void fe_1(fe h)
+{
+ h[0] = 1;
+ h[1] = 0;
+ h[2] = 0;
+ h[3] = 0;
+ h[4] = 0;
+ h[5] = 0;
+ h[6] = 0;
+ h[7] = 0;
+ h[8] = 0;
+ h[9] = 0;
+}
diff --git a/plugin/auth_ed25519/ref10/fe_add.c b/plugin/auth_ed25519/ref10/fe_add.c
new file mode 100644
index 00000000000..e6a81da2021
--- /dev/null
+++ b/plugin/auth_ed25519/ref10/fe_add.c
@@ -0,0 +1,57 @@
+#include "fe.h"
+
+/*
+h = f + g
+Can overlap h with f or g.
+
+Preconditions:
+ |f| bounded by 1.1*2^25,1.1*2^24,1.1*2^25,1.1*2^24,etc.
+ |g| bounded by 1.1*2^25,1.1*2^24,1.1*2^25,1.1*2^24,etc.
+
+Postconditions:
+ |h| bounded by 1.1*2^26,1.1*2^25,1.1*2^26,1.1*2^25,etc.
+*/
+
+void fe_add(fe h,const fe f,const fe g)
+{
+ crypto_int32 f0 = f[0];
+ crypto_int32 f1 = f[1];
+ crypto_int32 f2 = f[2];
+ crypto_int32 f3 = f[3];
+ crypto_int32 f4 = f[4];
+ crypto_int32 f5 = f[5];
+ crypto_int32 f6 = f[6];
+ crypto_int32 f7 = f[7];
+ crypto_int32 f8 = f[8];
+ crypto_int32 f9 = f[9];
+ crypto_int32 g0 = g[0];
+ crypto_int32 g1 = g[1];
+ crypto_int32 g2 = g[2];
+ crypto_int32 g3 = g[3];
+ crypto_int32 g4 = g[4];
+ crypto_int32 g5 = g[5];
+ crypto_int32 g6 = g[6];
+ crypto_int32 g7 = g[7];
+ crypto_int32 g8 = g[8];
+ crypto_int32 g9 = g[9];
+ crypto_int32 h0 = f0 + g0;
+ crypto_int32 h1 = f1 + g1;
+ crypto_int32 h2 = f2 + g2;
+ crypto_int32 h3 = f3 + g3;
+ crypto_int32 h4 = f4 + g4;
+ crypto_int32 h5 = f5 + g5;
+ crypto_int32 h6 = f6 + g6;
+ crypto_int32 h7 = f7 + g7;
+ crypto_int32 h8 = f8 + g8;
+ crypto_int32 h9 = f9 + g9;
+ h[0] = h0;
+ h[1] = h1;
+ h[2] = h2;
+ h[3] = h3;
+ h[4] = h4;
+ h[5] = h5;
+ h[6] = h6;
+ h[7] = h7;
+ h[8] = h8;
+ h[9] = h9;
+}
diff --git a/plugin/auth_ed25519/ref10/fe_cmov.c b/plugin/auth_ed25519/ref10/fe_cmov.c
new file mode 100644
index 00000000000..8ca584fb19a
--- /dev/null
+++ b/plugin/auth_ed25519/ref10/fe_cmov.c
@@ -0,0 +1,63 @@
+#include "fe.h"
+
+/*
+Replace (f,g) with (g,g) if b == 1;
+replace (f,g) with (f,g) if b == 0.
+
+Preconditions: b in {0,1}.
+*/
+
+void fe_cmov(fe f,const fe g,unsigned int b)
+{
+ crypto_int32 f0 = f[0];
+ crypto_int32 f1 = f[1];
+ crypto_int32 f2 = f[2];
+ crypto_int32 f3 = f[3];
+ crypto_int32 f4 = f[4];
+ crypto_int32 f5 = f[5];
+ crypto_int32 f6 = f[6];
+ crypto_int32 f7 = f[7];
+ crypto_int32 f8 = f[8];
+ crypto_int32 f9 = f[9];
+ crypto_int32 g0 = g[0];
+ crypto_int32 g1 = g[1];
+ crypto_int32 g2 = g[2];
+ crypto_int32 g3 = g[3];
+ crypto_int32 g4 = g[4];
+ crypto_int32 g5 = g[5];
+ crypto_int32 g6 = g[6];
+ crypto_int32 g7 = g[7];
+ crypto_int32 g8 = g[8];
+ crypto_int32 g9 = g[9];
+ crypto_int32 x0 = f0 ^ g0;
+ crypto_int32 x1 = f1 ^ g1;
+ crypto_int32 x2 = f2 ^ g2;
+ crypto_int32 x3 = f3 ^ g3;
+ crypto_int32 x4 = f4 ^ g4;
+ crypto_int32 x5 = f5 ^ g5;
+ crypto_int32 x6 = f6 ^ g6;
+ crypto_int32 x7 = f7 ^ g7;
+ crypto_int32 x8 = f8 ^ g8;
+ crypto_int32 x9 = f9 ^ g9;
+ b = -b;
+ x0 &= b;
+ x1 &= b;
+ x2 &= b;
+ x3 &= b;
+ x4 &= b;
+ x5 &= b;
+ x6 &= b;
+ x7 &= b;
+ x8 &= b;
+ x9 &= b;
+ f[0] = f0 ^ x0;
+ f[1] = f1 ^ x1;
+ f[2] = f2 ^ x2;
+ f[3] = f3 ^ x3;
+ f[4] = f4 ^ x4;
+ f[5] = f5 ^ x5;
+ f[6] = f6 ^ x6;
+ f[7] = f7 ^ x7;
+ f[8] = f8 ^ x8;
+ f[9] = f9 ^ x9;
+}
diff --git a/plugin/auth_ed25519/ref10/fe_copy.c b/plugin/auth_ed25519/ref10/fe_copy.c
new file mode 100644
index 00000000000..9c5bf865a24
--- /dev/null
+++ b/plugin/auth_ed25519/ref10/fe_copy.c
@@ -0,0 +1,29 @@
+#include "fe.h"
+
+/*
+h = f
+*/
+
+void fe_copy(fe h,const fe f)
+{
+ crypto_int32 f0 = f[0];
+ crypto_int32 f1 = f[1];
+ crypto_int32 f2 = f[2];
+ crypto_int32 f3 = f[3];
+ crypto_int32 f4 = f[4];
+ crypto_int32 f5 = f[5];
+ crypto_int32 f6 = f[6];
+ crypto_int32 f7 = f[7];
+ crypto_int32 f8 = f[8];
+ crypto_int32 f9 = f[9];
+ h[0] = f0;
+ h[1] = f1;
+ h[2] = f2;
+ h[3] = f3;
+ h[4] = f4;
+ h[5] = f5;
+ h[6] = f6;
+ h[7] = f7;
+ h[8] = f8;
+ h[9] = f9;
+}
diff --git a/plugin/auth_ed25519/ref10/fe_frombytes.c b/plugin/auth_ed25519/ref10/fe_frombytes.c
new file mode 100644
index 00000000000..5c179174877
--- /dev/null
+++ b/plugin/auth_ed25519/ref10/fe_frombytes.c
@@ -0,0 +1,73 @@
+#include "fe.h"
+#include "crypto_int64.h"
+#include "crypto_uint64.h"
+
+static crypto_uint64 load_3(const unsigned char *in)
+{
+ crypto_uint64 result;
+ result = (crypto_uint64) in[0];
+ result |= ((crypto_uint64) in[1]) << 8;
+ result |= ((crypto_uint64) in[2]) << 16;
+ return result;
+}
+
+static crypto_uint64 load_4(const unsigned char *in)
+{
+ crypto_uint64 result;
+ result = (crypto_uint64) in[0];
+ result |= ((crypto_uint64) in[1]) << 8;
+ result |= ((crypto_uint64) in[2]) << 16;
+ result |= ((crypto_uint64) in[3]) << 24;
+ return result;
+}
+
+/*
+Ignores top bit of h.
+*/
+
+void fe_frombytes(fe h,const unsigned char *s)
+{
+ crypto_int64 h0 = load_4(s);
+ crypto_int64 h1 = load_3(s + 4) << 6;
+ crypto_int64 h2 = load_3(s + 7) << 5;
+ crypto_int64 h3 = load_3(s + 10) << 3;
+ crypto_int64 h4 = load_3(s + 13) << 2;
+ crypto_int64 h5 = load_4(s + 16);
+ crypto_int64 h6 = load_3(s + 20) << 7;
+ crypto_int64 h7 = load_3(s + 23) << 5;
+ crypto_int64 h8 = load_3(s + 26) << 4;
+ crypto_int64 h9 = (load_3(s + 29) & 8388607) << 2;
+ crypto_int64 carry0;
+ crypto_int64 carry1;
+ crypto_int64 carry2;
+ crypto_int64 carry3;
+ crypto_int64 carry4;
+ crypto_int64 carry5;
+ crypto_int64 carry6;
+ crypto_int64 carry7;
+ crypto_int64 carry8;
+ crypto_int64 carry9;
+
+ carry9 = (h9 + (crypto_int64) (1<<24)) >> 25; h0 += carry9 * 19; h9 -= carry9 << 25;
+ carry1 = (h1 + (crypto_int64) (1<<24)) >> 25; h2 += carry1; h1 -= carry1 << 25;
+ carry3 = (h3 + (crypto_int64) (1<<24)) >> 25; h4 += carry3; h3 -= carry3 << 25;
+ carry5 = (h5 + (crypto_int64) (1<<24)) >> 25; h6 += carry5; h5 -= carry5 << 25;
+ carry7 = (h7 + (crypto_int64) (1<<24)) >> 25; h8 += carry7; h7 -= carry7 << 25;
+
+ carry0 = (h0 + (crypto_int64) (1<<25)) >> 26; h1 += carry0; h0 -= carry0 << 26;
+ carry2 = (h2 + (crypto_int64) (1<<25)) >> 26; h3 += carry2; h2 -= carry2 << 26;
+ carry4 = (h4 + (crypto_int64) (1<<25)) >> 26; h5 += carry4; h4 -= carry4 << 26;
+ carry6 = (h6 + (crypto_int64) (1<<25)) >> 26; h7 += carry6; h6 -= carry6 << 26;
+ carry8 = (h8 + (crypto_int64) (1<<25)) >> 26; h9 += carry8; h8 -= carry8 << 26;
+
+ h[0] = h0;
+ h[1] = h1;
+ h[2] = h2;
+ h[3] = h3;
+ h[4] = h4;
+ h[5] = h5;
+ h[6] = h6;
+ h[7] = h7;
+ h[8] = h8;
+ h[9] = h9;
+}
diff --git a/plugin/auth_ed25519/ref10/fe_invert.c b/plugin/auth_ed25519/ref10/fe_invert.c
new file mode 100644
index 00000000000..bcfdb8ff87e
--- /dev/null
+++ b/plugin/auth_ed25519/ref10/fe_invert.c
@@ -0,0 +1,14 @@
+#include "fe.h"
+
+void fe_invert(fe out,const fe z)
+{
+ fe t0;
+ fe t1;
+ fe t2;
+ fe t3;
+ int i;
+
+#include "pow225521.h"
+
+ return;
+}
diff --git a/plugin/auth_ed25519/ref10/fe_isnegative.c b/plugin/auth_ed25519/ref10/fe_isnegative.c
new file mode 100644
index 00000000000..3b2c8b8d523
--- /dev/null
+++ b/plugin/auth_ed25519/ref10/fe_isnegative.c
@@ -0,0 +1,16 @@
+#include "fe.h"
+
+/*
+return 1 if f is in {1,3,5,...,q-2}
+return 0 if f is in {0,2,4,...,q-1}
+
+Preconditions:
+ |f| bounded by 1.1*2^26,1.1*2^25,1.1*2^26,1.1*2^25,etc.
+*/
+
+int fe_isnegative(const fe f)
+{
+ unsigned char s[32];
+ fe_tobytes(s,f);
+ return s[0] & 1;
+}
diff --git a/plugin/auth_ed25519/ref10/fe_isnonzero.c b/plugin/auth_ed25519/ref10/fe_isnonzero.c
new file mode 100644
index 00000000000..47568001ce5
--- /dev/null
+++ b/plugin/auth_ed25519/ref10/fe_isnonzero.c
@@ -0,0 +1,19 @@
+#include "fe.h"
+#include "crypto_verify_32.h"
+
+/*
+return 1 if f == 0
+return 0 if f != 0
+
+Preconditions:
+ |f| bounded by 1.1*2^26,1.1*2^25,1.1*2^26,1.1*2^25,etc.
+*/
+
+static const unsigned char zero[32];
+
+int fe_isnonzero(const fe f)
+{
+ unsigned char s[32];
+ fe_tobytes(s,f);
+ return crypto_verify_32(s,zero);
+}
diff --git a/plugin/auth_ed25519/ref10/fe_mul.c b/plugin/auth_ed25519/ref10/fe_mul.c
new file mode 100644
index 00000000000..26ca8b3682d
--- /dev/null
+++ b/plugin/auth_ed25519/ref10/fe_mul.c
@@ -0,0 +1,253 @@
+#include "fe.h"
+#include "crypto_int64.h"
+
+/*
+h = f * g
+Can overlap h with f or g.
+
+Preconditions:
+ |f| bounded by 1.65*2^26,1.65*2^25,1.65*2^26,1.65*2^25,etc.
+ |g| bounded by 1.65*2^26,1.65*2^25,1.65*2^26,1.65*2^25,etc.
+
+Postconditions:
+ |h| bounded by 1.01*2^25,1.01*2^24,1.01*2^25,1.01*2^24,etc.
+*/
+
+/*
+Notes on implementation strategy:
+
+Using schoolbook multiplication.
+Karatsuba would save a little in some cost models.
+
+Most multiplications by 2 and 19 are 32-bit precomputations;
+cheaper than 64-bit postcomputations.
+
+There is one remaining multiplication by 19 in the carry chain;
+one *19 precomputation can be merged into this,
+but the resulting data flow is considerably less clean.
+
+There are 12 carries below.
+10 of them are 2-way parallelizable and vectorizable.
+Can get away with 11 carries, but then data flow is much deeper.
+
+With tighter constraints on inputs can squeeze carries into int32.
+*/
+
+void fe_mul(fe h,const fe f,const fe g)
+{
+ crypto_int32 f0 = f[0];
+ crypto_int32 f1 = f[1];
+ crypto_int32 f2 = f[2];
+ crypto_int32 f3 = f[3];
+ crypto_int32 f4 = f[4];
+ crypto_int32 f5 = f[5];
+ crypto_int32 f6 = f[6];
+ crypto_int32 f7 = f[7];
+ crypto_int32 f8 = f[8];
+ crypto_int32 f9 = f[9];
+ crypto_int32 g0 = g[0];
+ crypto_int32 g1 = g[1];
+ crypto_int32 g2 = g[2];
+ crypto_int32 g3 = g[3];
+ crypto_int32 g4 = g[4];
+ crypto_int32 g5 = g[5];
+ crypto_int32 g6 = g[6];
+ crypto_int32 g7 = g[7];
+ crypto_int32 g8 = g[8];
+ crypto_int32 g9 = g[9];
+ crypto_int32 g1_19 = 19 * g1; /* 1.959375*2^29 */
+ crypto_int32 g2_19 = 19 * g2; /* 1.959375*2^30; still ok */
+ crypto_int32 g3_19 = 19 * g3;
+ crypto_int32 g4_19 = 19 * g4;
+ crypto_int32 g5_19 = 19 * g5;
+ crypto_int32 g6_19 = 19 * g6;
+ crypto_int32 g7_19 = 19 * g7;
+ crypto_int32 g8_19 = 19 * g8;
+ crypto_int32 g9_19 = 19 * g9;
+ crypto_int32 f1_2 = 2 * f1;
+ crypto_int32 f3_2 = 2 * f3;
+ crypto_int32 f5_2 = 2 * f5;
+ crypto_int32 f7_2 = 2 * f7;
+ crypto_int32 f9_2 = 2 * f9;
+ crypto_int64 f0g0 = f0 * (crypto_int64) g0;
+ crypto_int64 f0g1 = f0 * (crypto_int64) g1;
+ crypto_int64 f0g2 = f0 * (crypto_int64) g2;
+ crypto_int64 f0g3 = f0 * (crypto_int64) g3;
+ crypto_int64 f0g4 = f0 * (crypto_int64) g4;
+ crypto_int64 f0g5 = f0 * (crypto_int64) g5;
+ crypto_int64 f0g6 = f0 * (crypto_int64) g6;
+ crypto_int64 f0g7 = f0 * (crypto_int64) g7;
+ crypto_int64 f0g8 = f0 * (crypto_int64) g8;
+ crypto_int64 f0g9 = f0 * (crypto_int64) g9;
+ crypto_int64 f1g0 = f1 * (crypto_int64) g0;
+ crypto_int64 f1g1_2 = f1_2 * (crypto_int64) g1;
+ crypto_int64 f1g2 = f1 * (crypto_int64) g2;
+ crypto_int64 f1g3_2 = f1_2 * (crypto_int64) g3;
+ crypto_int64 f1g4 = f1 * (crypto_int64) g4;
+ crypto_int64 f1g5_2 = f1_2 * (crypto_int64) g5;
+ crypto_int64 f1g6 = f1 * (crypto_int64) g6;
+ crypto_int64 f1g7_2 = f1_2 * (crypto_int64) g7;
+ crypto_int64 f1g8 = f1 * (crypto_int64) g8;
+ crypto_int64 f1g9_38 = f1_2 * (crypto_int64) g9_19;
+ crypto_int64 f2g0 = f2 * (crypto_int64) g0;
+ crypto_int64 f2g1 = f2 * (crypto_int64) g1;
+ crypto_int64 f2g2 = f2 * (crypto_int64) g2;
+ crypto_int64 f2g3 = f2 * (crypto_int64) g3;
+ crypto_int64 f2g4 = f2 * (crypto_int64) g4;
+ crypto_int64 f2g5 = f2 * (crypto_int64) g5;
+ crypto_int64 f2g6 = f2 * (crypto_int64) g6;
+ crypto_int64 f2g7 = f2 * (crypto_int64) g7;
+ crypto_int64 f2g8_19 = f2 * (crypto_int64) g8_19;
+ crypto_int64 f2g9_19 = f2 * (crypto_int64) g9_19;
+ crypto_int64 f3g0 = f3 * (crypto_int64) g0;
+ crypto_int64 f3g1_2 = f3_2 * (crypto_int64) g1;
+ crypto_int64 f3g2 = f3 * (crypto_int64) g2;
+ crypto_int64 f3g3_2 = f3_2 * (crypto_int64) g3;
+ crypto_int64 f3g4 = f3 * (crypto_int64) g4;
+ crypto_int64 f3g5_2 = f3_2 * (crypto_int64) g5;
+ crypto_int64 f3g6 = f3 * (crypto_int64) g6;
+ crypto_int64 f3g7_38 = f3_2 * (crypto_int64) g7_19;
+ crypto_int64 f3g8_19 = f3 * (crypto_int64) g8_19;
+ crypto_int64 f3g9_38 = f3_2 * (crypto_int64) g9_19;
+ crypto_int64 f4g0 = f4 * (crypto_int64) g0;
+ crypto_int64 f4g1 = f4 * (crypto_int64) g1;
+ crypto_int64 f4g2 = f4 * (crypto_int64) g2;
+ crypto_int64 f4g3 = f4 * (crypto_int64) g3;
+ crypto_int64 f4g4 = f4 * (crypto_int64) g4;
+ crypto_int64 f4g5 = f4 * (crypto_int64) g5;
+ crypto_int64 f4g6_19 = f4 * (crypto_int64) g6_19;
+ crypto_int64 f4g7_19 = f4 * (crypto_int64) g7_19;
+ crypto_int64 f4g8_19 = f4 * (crypto_int64) g8_19;
+ crypto_int64 f4g9_19 = f4 * (crypto_int64) g9_19;
+ crypto_int64 f5g0 = f5 * (crypto_int64) g0;
+ crypto_int64 f5g1_2 = f5_2 * (crypto_int64) g1;
+ crypto_int64 f5g2 = f5 * (crypto_int64) g2;
+ crypto_int64 f5g3_2 = f5_2 * (crypto_int64) g3;
+ crypto_int64 f5g4 = f5 * (crypto_int64) g4;
+ crypto_int64 f5g5_38 = f5_2 * (crypto_int64) g5_19;
+ crypto_int64 f5g6_19 = f5 * (crypto_int64) g6_19;
+ crypto_int64 f5g7_38 = f5_2 * (crypto_int64) g7_19;
+ crypto_int64 f5g8_19 = f5 * (crypto_int64) g8_19;
+ crypto_int64 f5g9_38 = f5_2 * (crypto_int64) g9_19;
+ crypto_int64 f6g0 = f6 * (crypto_int64) g0;
+ crypto_int64 f6g1 = f6 * (crypto_int64) g1;
+ crypto_int64 f6g2 = f6 * (crypto_int64) g2;
+ crypto_int64 f6g3 = f6 * (crypto_int64) g3;
+ crypto_int64 f6g4_19 = f6 * (crypto_int64) g4_19;
+ crypto_int64 f6g5_19 = f6 * (crypto_int64) g5_19;
+ crypto_int64 f6g6_19 = f6 * (crypto_int64) g6_19;
+ crypto_int64 f6g7_19 = f6 * (crypto_int64) g7_19;
+ crypto_int64 f6g8_19 = f6 * (crypto_int64) g8_19;
+ crypto_int64 f6g9_19 = f6 * (crypto_int64) g9_19;
+ crypto_int64 f7g0 = f7 * (crypto_int64) g0;
+ crypto_int64 f7g1_2 = f7_2 * (crypto_int64) g1;
+ crypto_int64 f7g2 = f7 * (crypto_int64) g2;
+ crypto_int64 f7g3_38 = f7_2 * (crypto_int64) g3_19;
+ crypto_int64 f7g4_19 = f7 * (crypto_int64) g4_19;
+ crypto_int64 f7g5_38 = f7_2 * (crypto_int64) g5_19;
+ crypto_int64 f7g6_19 = f7 * (crypto_int64) g6_19;
+ crypto_int64 f7g7_38 = f7_2 * (crypto_int64) g7_19;
+ crypto_int64 f7g8_19 = f7 * (crypto_int64) g8_19;
+ crypto_int64 f7g9_38 = f7_2 * (crypto_int64) g9_19;
+ crypto_int64 f8g0 = f8 * (crypto_int64) g0;
+ crypto_int64 f8g1 = f8 * (crypto_int64) g1;
+ crypto_int64 f8g2_19 = f8 * (crypto_int64) g2_19;
+ crypto_int64 f8g3_19 = f8 * (crypto_int64) g3_19;
+ crypto_int64 f8g4_19 = f8 * (crypto_int64) g4_19;
+ crypto_int64 f8g5_19 = f8 * (crypto_int64) g5_19;
+ crypto_int64 f8g6_19 = f8 * (crypto_int64) g6_19;
+ crypto_int64 f8g7_19 = f8 * (crypto_int64) g7_19;
+ crypto_int64 f8g8_19 = f8 * (crypto_int64) g8_19;
+ crypto_int64 f8g9_19 = f8 * (crypto_int64) g9_19;
+ crypto_int64 f9g0 = f9 * (crypto_int64) g0;
+ crypto_int64 f9g1_38 = f9_2 * (crypto_int64) g1_19;
+ crypto_int64 f9g2_19 = f9 * (crypto_int64) g2_19;
+ crypto_int64 f9g3_38 = f9_2 * (crypto_int64) g3_19;
+ crypto_int64 f9g4_19 = f9 * (crypto_int64) g4_19;
+ crypto_int64 f9g5_38 = f9_2 * (crypto_int64) g5_19;
+ crypto_int64 f9g6_19 = f9 * (crypto_int64) g6_19;
+ crypto_int64 f9g7_38 = f9_2 * (crypto_int64) g7_19;
+ crypto_int64 f9g8_19 = f9 * (crypto_int64) g8_19;
+ crypto_int64 f9g9_38 = f9_2 * (crypto_int64) g9_19;
+ crypto_int64 h0 = f0g0+f1g9_38+f2g8_19+f3g7_38+f4g6_19+f5g5_38+f6g4_19+f7g3_38+f8g2_19+f9g1_38;
+ crypto_int64 h1 = f0g1+f1g0 +f2g9_19+f3g8_19+f4g7_19+f5g6_19+f6g5_19+f7g4_19+f8g3_19+f9g2_19;
+ crypto_int64 h2 = f0g2+f1g1_2 +f2g0 +f3g9_38+f4g8_19+f5g7_38+f6g6_19+f7g5_38+f8g4_19+f9g3_38;
+ crypto_int64 h3 = f0g3+f1g2 +f2g1 +f3g0 +f4g9_19+f5g8_19+f6g7_19+f7g6_19+f8g5_19+f9g4_19;
+ crypto_int64 h4 = f0g4+f1g3_2 +f2g2 +f3g1_2 +f4g0 +f5g9_38+f6g8_19+f7g7_38+f8g6_19+f9g5_38;
+ crypto_int64 h5 = f0g5+f1g4 +f2g3 +f3g2 +f4g1 +f5g0 +f6g9_19+f7g8_19+f8g7_19+f9g6_19;
+ crypto_int64 h6 = f0g6+f1g5_2 +f2g4 +f3g3_2 +f4g2 +f5g1_2 +f6g0 +f7g9_38+f8g8_19+f9g7_38;
+ crypto_int64 h7 = f0g7+f1g6 +f2g5 +f3g4 +f4g3 +f5g2 +f6g1 +f7g0 +f8g9_19+f9g8_19;
+ crypto_int64 h8 = f0g8+f1g7_2 +f2g6 +f3g5_2 +f4g4 +f5g3_2 +f6g2 +f7g1_2 +f8g0 +f9g9_38;
+ crypto_int64 h9 = f0g9+f1g8 +f2g7 +f3g6 +f4g5 +f5g4 +f6g3 +f7g2 +f8g1 +f9g0 ;
+ crypto_int64 carry0;
+ crypto_int64 carry1;
+ crypto_int64 carry2;
+ crypto_int64 carry3;
+ crypto_int64 carry4;
+ crypto_int64 carry5;
+ crypto_int64 carry6;
+ crypto_int64 carry7;
+ crypto_int64 carry8;
+ crypto_int64 carry9;
+
+ /*
+ |h0| <= (1.65*1.65*2^52*(1+19+19+19+19)+1.65*1.65*2^50*(38+38+38+38+38))
+ i.e. |h0| <= 1.4*2^60; narrower ranges for h2, h4, h6, h8
+ |h1| <= (1.65*1.65*2^51*(1+1+19+19+19+19+19+19+19+19))
+ i.e. |h1| <= 1.7*2^59; narrower ranges for h3, h5, h7, h9
+ */
+
+ carry0 = (h0 + (crypto_int64) (1<<25)) >> 26; h1 += carry0; h0 -= carry0 << 26;
+ carry4 = (h4 + (crypto_int64) (1<<25)) >> 26; h5 += carry4; h4 -= carry4 << 26;
+ /* |h0| <= 2^25 */
+ /* |h4| <= 2^25 */
+ /* |h1| <= 1.71*2^59 */
+ /* |h5| <= 1.71*2^59 */
+
+ carry1 = (h1 + (crypto_int64) (1<<24)) >> 25; h2 += carry1; h1 -= carry1 << 25;
+ carry5 = (h5 + (crypto_int64) (1<<24)) >> 25; h6 += carry5; h5 -= carry5 << 25;
+ /* |h1| <= 2^24; from now on fits into int32 */
+ /* |h5| <= 2^24; from now on fits into int32 */
+ /* |h2| <= 1.41*2^60 */
+ /* |h6| <= 1.41*2^60 */
+
+ carry2 = (h2 + (crypto_int64) (1<<25)) >> 26; h3 += carry2; h2 -= carry2 << 26;
+ carry6 = (h6 + (crypto_int64) (1<<25)) >> 26; h7 += carry6; h6 -= carry6 << 26;
+ /* |h2| <= 2^25; from now on fits into int32 unchanged */
+ /* |h6| <= 2^25; from now on fits into int32 unchanged */
+ /* |h3| <= 1.71*2^59 */
+ /* |h7| <= 1.71*2^59 */
+
+ carry3 = (h3 + (crypto_int64) (1<<24)) >> 25; h4 += carry3; h3 -= carry3 << 25;
+ carry7 = (h7 + (crypto_int64) (1<<24)) >> 25; h8 += carry7; h7 -= carry7 << 25;
+ /* |h3| <= 2^24; from now on fits into int32 unchanged */
+ /* |h7| <= 2^24; from now on fits into int32 unchanged */
+ /* |h4| <= 1.72*2^34 */
+ /* |h8| <= 1.41*2^60 */
+
+ carry4 = (h4 + (crypto_int64) (1<<25)) >> 26; h5 += carry4; h4 -= carry4 << 26;
+ carry8 = (h8 + (crypto_int64) (1<<25)) >> 26; h9 += carry8; h8 -= carry8 << 26;
+ /* |h4| <= 2^25; from now on fits into int32 unchanged */
+ /* |h8| <= 2^25; from now on fits into int32 unchanged */
+ /* |h5| <= 1.01*2^24 */
+ /* |h9| <= 1.71*2^59 */
+
+ carry9 = (h9 + (crypto_int64) (1<<24)) >> 25; h0 += carry9 * 19; h9 -= carry9 << 25;
+ /* |h9| <= 2^24; from now on fits into int32 unchanged */
+ /* |h0| <= 1.1*2^39 */
+
+ carry0 = (h0 + (crypto_int64) (1<<25)) >> 26; h1 += carry0; h0 -= carry0 << 26;
+ /* |h0| <= 2^25; from now on fits into int32 unchanged */
+ /* |h1| <= 1.01*2^24 */
+
+ h[0] = h0;
+ h[1] = h1;
+ h[2] = h2;
+ h[3] = h3;
+ h[4] = h4;
+ h[5] = h5;
+ h[6] = h6;
+ h[7] = h7;
+ h[8] = h8;
+ h[9] = h9;
+}
diff --git a/plugin/auth_ed25519/ref10/fe_neg.c b/plugin/auth_ed25519/ref10/fe_neg.c
new file mode 100644
index 00000000000..2078ce5284a
--- /dev/null
+++ b/plugin/auth_ed25519/ref10/fe_neg.c
@@ -0,0 +1,45 @@
+#include "fe.h"
+
+/*
+h = -f
+
+Preconditions:
+ |f| bounded by 1.1*2^25,1.1*2^24,1.1*2^25,1.1*2^24,etc.
+
+Postconditions:
+ |h| bounded by 1.1*2^25,1.1*2^24,1.1*2^25,1.1*2^24,etc.
+*/
+
+void fe_neg(fe h,const fe f)
+{
+ crypto_int32 f0 = f[0];
+ crypto_int32 f1 = f[1];
+ crypto_int32 f2 = f[2];
+ crypto_int32 f3 = f[3];
+ crypto_int32 f4 = f[4];
+ crypto_int32 f5 = f[5];
+ crypto_int32 f6 = f[6];
+ crypto_int32 f7 = f[7];
+ crypto_int32 f8 = f[8];
+ crypto_int32 f9 = f[9];
+ crypto_int32 h0 = -f0;
+ crypto_int32 h1 = -f1;
+ crypto_int32 h2 = -f2;
+ crypto_int32 h3 = -f3;
+ crypto_int32 h4 = -f4;
+ crypto_int32 h5 = -f5;
+ crypto_int32 h6 = -f6;
+ crypto_int32 h7 = -f7;
+ crypto_int32 h8 = -f8;
+ crypto_int32 h9 = -f9;
+ h[0] = h0;
+ h[1] = h1;
+ h[2] = h2;
+ h[3] = h3;
+ h[4] = h4;
+ h[5] = h5;
+ h[6] = h6;
+ h[7] = h7;
+ h[8] = h8;
+ h[9] = h9;
+}
diff --git a/plugin/auth_ed25519/ref10/fe_pow22523.c b/plugin/auth_ed25519/ref10/fe_pow22523.c
new file mode 100644
index 00000000000..56675a5902f
--- /dev/null
+++ b/plugin/auth_ed25519/ref10/fe_pow22523.c
@@ -0,0 +1,13 @@
+#include "fe.h"
+
+void fe_pow22523(fe out,const fe z)
+{
+ fe t0;
+ fe t1;
+ fe t2;
+ int i;
+
+#include "pow22523.h"
+
+ return;
+}
diff --git a/plugin/auth_ed25519/ref10/fe_sq.c b/plugin/auth_ed25519/ref10/fe_sq.c
new file mode 100644
index 00000000000..8dd119841c6
--- /dev/null
+++ b/plugin/auth_ed25519/ref10/fe_sq.c
@@ -0,0 +1,149 @@
+#include "fe.h"
+#include "crypto_int64.h"
+
+/*
+h = f * f
+Can overlap h with f.
+
+Preconditions:
+ |f| bounded by 1.65*2^26,1.65*2^25,1.65*2^26,1.65*2^25,etc.
+
+Postconditions:
+ |h| bounded by 1.01*2^25,1.01*2^24,1.01*2^25,1.01*2^24,etc.
+*/
+
+/*
+See fe_mul.c for discussion of implementation strategy.
+*/
+
+void fe_sq(fe h,const fe f)
+{
+ crypto_int32 f0 = f[0];
+ crypto_int32 f1 = f[1];
+ crypto_int32 f2 = f[2];
+ crypto_int32 f3 = f[3];
+ crypto_int32 f4 = f[4];
+ crypto_int32 f5 = f[5];
+ crypto_int32 f6 = f[6];
+ crypto_int32 f7 = f[7];
+ crypto_int32 f8 = f[8];
+ crypto_int32 f9 = f[9];
+ crypto_int32 f0_2 = 2 * f0;
+ crypto_int32 f1_2 = 2 * f1;
+ crypto_int32 f2_2 = 2 * f2;
+ crypto_int32 f3_2 = 2 * f3;
+ crypto_int32 f4_2 = 2 * f4;
+ crypto_int32 f5_2 = 2 * f5;
+ crypto_int32 f6_2 = 2 * f6;
+ crypto_int32 f7_2 = 2 * f7;
+ crypto_int32 f5_38 = 38 * f5; /* 1.959375*2^30 */
+ crypto_int32 f6_19 = 19 * f6; /* 1.959375*2^30 */
+ crypto_int32 f7_38 = 38 * f7; /* 1.959375*2^30 */
+ crypto_int32 f8_19 = 19 * f8; /* 1.959375*2^30 */
+ crypto_int32 f9_38 = 38 * f9; /* 1.959375*2^30 */
+ crypto_int64 f0f0 = f0 * (crypto_int64) f0;
+ crypto_int64 f0f1_2 = f0_2 * (crypto_int64) f1;
+ crypto_int64 f0f2_2 = f0_2 * (crypto_int64) f2;
+ crypto_int64 f0f3_2 = f0_2 * (crypto_int64) f3;
+ crypto_int64 f0f4_2 = f0_2 * (crypto_int64) f4;
+ crypto_int64 f0f5_2 = f0_2 * (crypto_int64) f5;
+ crypto_int64 f0f6_2 = f0_2 * (crypto_int64) f6;
+ crypto_int64 f0f7_2 = f0_2 * (crypto_int64) f7;
+ crypto_int64 f0f8_2 = f0_2 * (crypto_int64) f8;
+ crypto_int64 f0f9_2 = f0_2 * (crypto_int64) f9;
+ crypto_int64 f1f1_2 = f1_2 * (crypto_int64) f1;
+ crypto_int64 f1f2_2 = f1_2 * (crypto_int64) f2;
+ crypto_int64 f1f3_4 = f1_2 * (crypto_int64) f3_2;
+ crypto_int64 f1f4_2 = f1_2 * (crypto_int64) f4;
+ crypto_int64 f1f5_4 = f1_2 * (crypto_int64) f5_2;
+ crypto_int64 f1f6_2 = f1_2 * (crypto_int64) f6;
+ crypto_int64 f1f7_4 = f1_2 * (crypto_int64) f7_2;
+ crypto_int64 f1f8_2 = f1_2 * (crypto_int64) f8;
+ crypto_int64 f1f9_76 = f1_2 * (crypto_int64) f9_38;
+ crypto_int64 f2f2 = f2 * (crypto_int64) f2;
+ crypto_int64 f2f3_2 = f2_2 * (crypto_int64) f3;
+ crypto_int64 f2f4_2 = f2_2 * (crypto_int64) f4;
+ crypto_int64 f2f5_2 = f2_2 * (crypto_int64) f5;
+ crypto_int64 f2f6_2 = f2_2 * (crypto_int64) f6;
+ crypto_int64 f2f7_2 = f2_2 * (crypto_int64) f7;
+ crypto_int64 f2f8_38 = f2_2 * (crypto_int64) f8_19;
+ crypto_int64 f2f9_38 = f2 * (crypto_int64) f9_38;
+ crypto_int64 f3f3_2 = f3_2 * (crypto_int64) f3;
+ crypto_int64 f3f4_2 = f3_2 * (crypto_int64) f4;
+ crypto_int64 f3f5_4 = f3_2 * (crypto_int64) f5_2;
+ crypto_int64 f3f6_2 = f3_2 * (crypto_int64) f6;
+ crypto_int64 f3f7_76 = f3_2 * (crypto_int64) f7_38;
+ crypto_int64 f3f8_38 = f3_2 * (crypto_int64) f8_19;
+ crypto_int64 f3f9_76 = f3_2 * (crypto_int64) f9_38;
+ crypto_int64 f4f4 = f4 * (crypto_int64) f4;
+ crypto_int64 f4f5_2 = f4_2 * (crypto_int64) f5;
+ crypto_int64 f4f6_38 = f4_2 * (crypto_int64) f6_19;
+ crypto_int64 f4f7_38 = f4 * (crypto_int64) f7_38;
+ crypto_int64 f4f8_38 = f4_2 * (crypto_int64) f8_19;
+ crypto_int64 f4f9_38 = f4 * (crypto_int64) f9_38;
+ crypto_int64 f5f5_38 = f5 * (crypto_int64) f5_38;
+ crypto_int64 f5f6_38 = f5_2 * (crypto_int64) f6_19;
+ crypto_int64 f5f7_76 = f5_2 * (crypto_int64) f7_38;
+ crypto_int64 f5f8_38 = f5_2 * (crypto_int64) f8_19;
+ crypto_int64 f5f9_76 = f5_2 * (crypto_int64) f9_38;
+ crypto_int64 f6f6_19 = f6 * (crypto_int64) f6_19;
+ crypto_int64 f6f7_38 = f6 * (crypto_int64) f7_38;
+ crypto_int64 f6f8_38 = f6_2 * (crypto_int64) f8_19;
+ crypto_int64 f6f9_38 = f6 * (crypto_int64) f9_38;
+ crypto_int64 f7f7_38 = f7 * (crypto_int64) f7_38;
+ crypto_int64 f7f8_38 = f7_2 * (crypto_int64) f8_19;
+ crypto_int64 f7f9_76 = f7_2 * (crypto_int64) f9_38;
+ crypto_int64 f8f8_19 = f8 * (crypto_int64) f8_19;
+ crypto_int64 f8f9_38 = f8 * (crypto_int64) f9_38;
+ crypto_int64 f9f9_38 = f9 * (crypto_int64) f9_38;
+ crypto_int64 h0 = f0f0 +f1f9_76+f2f8_38+f3f7_76+f4f6_38+f5f5_38;
+ crypto_int64 h1 = f0f1_2+f2f9_38+f3f8_38+f4f7_38+f5f6_38;
+ crypto_int64 h2 = f0f2_2+f1f1_2 +f3f9_76+f4f8_38+f5f7_76+f6f6_19;
+ crypto_int64 h3 = f0f3_2+f1f2_2 +f4f9_38+f5f8_38+f6f7_38;
+ crypto_int64 h4 = f0f4_2+f1f3_4 +f2f2 +f5f9_76+f6f8_38+f7f7_38;
+ crypto_int64 h5 = f0f5_2+f1f4_2 +f2f3_2 +f6f9_38+f7f8_38;
+ crypto_int64 h6 = f0f6_2+f1f5_4 +f2f4_2 +f3f3_2 +f7f9_76+f8f8_19;
+ crypto_int64 h7 = f0f7_2+f1f6_2 +f2f5_2 +f3f4_2 +f8f9_38;
+ crypto_int64 h8 = f0f8_2+f1f7_4 +f2f6_2 +f3f5_4 +f4f4 +f9f9_38;
+ crypto_int64 h9 = f0f9_2+f1f8_2 +f2f7_2 +f3f6_2 +f4f5_2;
+ crypto_int64 carry0;
+ crypto_int64 carry1;
+ crypto_int64 carry2;
+ crypto_int64 carry3;
+ crypto_int64 carry4;
+ crypto_int64 carry5;
+ crypto_int64 carry6;
+ crypto_int64 carry7;
+ crypto_int64 carry8;
+ crypto_int64 carry9;
+
+ carry0 = (h0 + (crypto_int64) (1<<25)) >> 26; h1 += carry0; h0 -= carry0 << 26;
+ carry4 = (h4 + (crypto_int64) (1<<25)) >> 26; h5 += carry4; h4 -= carry4 << 26;
+
+ carry1 = (h1 + (crypto_int64) (1<<24)) >> 25; h2 += carry1; h1 -= carry1 << 25;
+ carry5 = (h5 + (crypto_int64) (1<<24)) >> 25; h6 += carry5; h5 -= carry5 << 25;
+
+ carry2 = (h2 + (crypto_int64) (1<<25)) >> 26; h3 += carry2; h2 -= carry2 << 26;
+ carry6 = (h6 + (crypto_int64) (1<<25)) >> 26; h7 += carry6; h6 -= carry6 << 26;
+
+ carry3 = (h3 + (crypto_int64) (1<<24)) >> 25; h4 += carry3; h3 -= carry3 << 25;
+ carry7 = (h7 + (crypto_int64) (1<<24)) >> 25; h8 += carry7; h7 -= carry7 << 25;
+
+ carry4 = (h4 + (crypto_int64) (1<<25)) >> 26; h5 += carry4; h4 -= carry4 << 26;
+ carry8 = (h8 + (crypto_int64) (1<<25)) >> 26; h9 += carry8; h8 -= carry8 << 26;
+
+ carry9 = (h9 + (crypto_int64) (1<<24)) >> 25; h0 += carry9 * 19; h9 -= carry9 << 25;
+
+ carry0 = (h0 + (crypto_int64) (1<<25)) >> 26; h1 += carry0; h0 -= carry0 << 26;
+
+ h[0] = h0;
+ h[1] = h1;
+ h[2] = h2;
+ h[3] = h3;
+ h[4] = h4;
+ h[5] = h5;
+ h[6] = h6;
+ h[7] = h7;
+ h[8] = h8;
+ h[9] = h9;
+}
diff --git a/plugin/auth_ed25519/ref10/fe_sq2.c b/plugin/auth_ed25519/ref10/fe_sq2.c
new file mode 100644
index 00000000000..026ed3aacf5
--- /dev/null
+++ b/plugin/auth_ed25519/ref10/fe_sq2.c
@@ -0,0 +1,160 @@
+#include "fe.h"
+#include "crypto_int64.h"
+
+/*
+h = 2 * f * f
+Can overlap h with f.
+
+Preconditions:
+ |f| bounded by 1.65*2^26,1.65*2^25,1.65*2^26,1.65*2^25,etc.
+
+Postconditions:
+ |h| bounded by 1.01*2^25,1.01*2^24,1.01*2^25,1.01*2^24,etc.
+*/
+
+/*
+See fe_mul.c for discussion of implementation strategy.
+*/
+
+void fe_sq2(fe h,const fe f)
+{
+ crypto_int32 f0 = f[0];
+ crypto_int32 f1 = f[1];
+ crypto_int32 f2 = f[2];
+ crypto_int32 f3 = f[3];
+ crypto_int32 f4 = f[4];
+ crypto_int32 f5 = f[5];
+ crypto_int32 f6 = f[6];
+ crypto_int32 f7 = f[7];
+ crypto_int32 f8 = f[8];
+ crypto_int32 f9 = f[9];
+ crypto_int32 f0_2 = 2 * f0;
+ crypto_int32 f1_2 = 2 * f1;
+ crypto_int32 f2_2 = 2 * f2;
+ crypto_int32 f3_2 = 2 * f3;
+ crypto_int32 f4_2 = 2 * f4;
+ crypto_int32 f5_2 = 2 * f5;
+ crypto_int32 f6_2 = 2 * f6;
+ crypto_int32 f7_2 = 2 * f7;
+ crypto_int32 f5_38 = 38 * f5; /* 1.959375*2^30 */
+ crypto_int32 f6_19 = 19 * f6; /* 1.959375*2^30 */
+ crypto_int32 f7_38 = 38 * f7; /* 1.959375*2^30 */
+ crypto_int32 f8_19 = 19 * f8; /* 1.959375*2^30 */
+ crypto_int32 f9_38 = 38 * f9; /* 1.959375*2^30 */
+ crypto_int64 f0f0 = f0 * (crypto_int64) f0;
+ crypto_int64 f0f1_2 = f0_2 * (crypto_int64) f1;
+ crypto_int64 f0f2_2 = f0_2 * (crypto_int64) f2;
+ crypto_int64 f0f3_2 = f0_2 * (crypto_int64) f3;
+ crypto_int64 f0f4_2 = f0_2 * (crypto_int64) f4;
+ crypto_int64 f0f5_2 = f0_2 * (crypto_int64) f5;
+ crypto_int64 f0f6_2 = f0_2 * (crypto_int64) f6;
+ crypto_int64 f0f7_2 = f0_2 * (crypto_int64) f7;
+ crypto_int64 f0f8_2 = f0_2 * (crypto_int64) f8;
+ crypto_int64 f0f9_2 = f0_2 * (crypto_int64) f9;
+ crypto_int64 f1f1_2 = f1_2 * (crypto_int64) f1;
+ crypto_int64 f1f2_2 = f1_2 * (crypto_int64) f2;
+ crypto_int64 f1f3_4 = f1_2 * (crypto_int64) f3_2;
+ crypto_int64 f1f4_2 = f1_2 * (crypto_int64) f4;
+ crypto_int64 f1f5_4 = f1_2 * (crypto_int64) f5_2;
+ crypto_int64 f1f6_2 = f1_2 * (crypto_int64) f6;
+ crypto_int64 f1f7_4 = f1_2 * (crypto_int64) f7_2;
+ crypto_int64 f1f8_2 = f1_2 * (crypto_int64) f8;
+ crypto_int64 f1f9_76 = f1_2 * (crypto_int64) f9_38;
+ crypto_int64 f2f2 = f2 * (crypto_int64) f2;
+ crypto_int64 f2f3_2 = f2_2 * (crypto_int64) f3;
+ crypto_int64 f2f4_2 = f2_2 * (crypto_int64) f4;
+ crypto_int64 f2f5_2 = f2_2 * (crypto_int64) f5;
+ crypto_int64 f2f6_2 = f2_2 * (crypto_int64) f6;
+ crypto_int64 f2f7_2 = f2_2 * (crypto_int64) f7;
+ crypto_int64 f2f8_38 = f2_2 * (crypto_int64) f8_19;
+ crypto_int64 f2f9_38 = f2 * (crypto_int64) f9_38;
+ crypto_int64 f3f3_2 = f3_2 * (crypto_int64) f3;
+ crypto_int64 f3f4_2 = f3_2 * (crypto_int64) f4;
+ crypto_int64 f3f5_4 = f3_2 * (crypto_int64) f5_2;
+ crypto_int64 f3f6_2 = f3_2 * (crypto_int64) f6;
+ crypto_int64 f3f7_76 = f3_2 * (crypto_int64) f7_38;
+ crypto_int64 f3f8_38 = f3_2 * (crypto_int64) f8_19;
+ crypto_int64 f3f9_76 = f3_2 * (crypto_int64) f9_38;
+ crypto_int64 f4f4 = f4 * (crypto_int64) f4;
+ crypto_int64 f4f5_2 = f4_2 * (crypto_int64) f5;
+ crypto_int64 f4f6_38 = f4_2 * (crypto_int64) f6_19;
+ crypto_int64 f4f7_38 = f4 * (crypto_int64) f7_38;
+ crypto_int64 f4f8_38 = f4_2 * (crypto_int64) f8_19;
+ crypto_int64 f4f9_38 = f4 * (crypto_int64) f9_38;
+ crypto_int64 f5f5_38 = f5 * (crypto_int64) f5_38;
+ crypto_int64 f5f6_38 = f5_2 * (crypto_int64) f6_19;
+ crypto_int64 f5f7_76 = f5_2 * (crypto_int64) f7_38;
+ crypto_int64 f5f8_38 = f5_2 * (crypto_int64) f8_19;
+ crypto_int64 f5f9_76 = f5_2 * (crypto_int64) f9_38;
+ crypto_int64 f6f6_19 = f6 * (crypto_int64) f6_19;
+ crypto_int64 f6f7_38 = f6 * (crypto_int64) f7_38;
+ crypto_int64 f6f8_38 = f6_2 * (crypto_int64) f8_19;
+ crypto_int64 f6f9_38 = f6 * (crypto_int64) f9_38;
+ crypto_int64 f7f7_38 = f7 * (crypto_int64) f7_38;
+ crypto_int64 f7f8_38 = f7_2 * (crypto_int64) f8_19;
+ crypto_int64 f7f9_76 = f7_2 * (crypto_int64) f9_38;
+ crypto_int64 f8f8_19 = f8 * (crypto_int64) f8_19;
+ crypto_int64 f8f9_38 = f8 * (crypto_int64) f9_38;
+ crypto_int64 f9f9_38 = f9 * (crypto_int64) f9_38;
+ crypto_int64 h0 = f0f0 +f1f9_76+f2f8_38+f3f7_76+f4f6_38+f5f5_38;
+ crypto_int64 h1 = f0f1_2+f2f9_38+f3f8_38+f4f7_38+f5f6_38;
+ crypto_int64 h2 = f0f2_2+f1f1_2 +f3f9_76+f4f8_38+f5f7_76+f6f6_19;
+ crypto_int64 h3 = f0f3_2+f1f2_2 +f4f9_38+f5f8_38+f6f7_38;
+ crypto_int64 h4 = f0f4_2+f1f3_4 +f2f2 +f5f9_76+f6f8_38+f7f7_38;
+ crypto_int64 h5 = f0f5_2+f1f4_2 +f2f3_2 +f6f9_38+f7f8_38;
+ crypto_int64 h6 = f0f6_2+f1f5_4 +f2f4_2 +f3f3_2 +f7f9_76+f8f8_19;
+ crypto_int64 h7 = f0f7_2+f1f6_2 +f2f5_2 +f3f4_2 +f8f9_38;
+ crypto_int64 h8 = f0f8_2+f1f7_4 +f2f6_2 +f3f5_4 +f4f4 +f9f9_38;
+ crypto_int64 h9 = f0f9_2+f1f8_2 +f2f7_2 +f3f6_2 +f4f5_2;
+ crypto_int64 carry0;
+ crypto_int64 carry1;
+ crypto_int64 carry2;
+ crypto_int64 carry3;
+ crypto_int64 carry4;
+ crypto_int64 carry5;
+ crypto_int64 carry6;
+ crypto_int64 carry7;
+ crypto_int64 carry8;
+ crypto_int64 carry9;
+
+ h0 += h0;
+ h1 += h1;
+ h2 += h2;
+ h3 += h3;
+ h4 += h4;
+ h5 += h5;
+ h6 += h6;
+ h7 += h7;
+ h8 += h8;
+ h9 += h9;
+
+ carry0 = (h0 + (crypto_int64) (1<<25)) >> 26; h1 += carry0; h0 -= carry0 << 26;
+ carry4 = (h4 + (crypto_int64) (1<<25)) >> 26; h5 += carry4; h4 -= carry4 << 26;
+
+ carry1 = (h1 + (crypto_int64) (1<<24)) >> 25; h2 += carry1; h1 -= carry1 << 25;
+ carry5 = (h5 + (crypto_int64) (1<<24)) >> 25; h6 += carry5; h5 -= carry5 << 25;
+
+ carry2 = (h2 + (crypto_int64) (1<<25)) >> 26; h3 += carry2; h2 -= carry2 << 26;
+ carry6 = (h6 + (crypto_int64) (1<<25)) >> 26; h7 += carry6; h6 -= carry6 << 26;
+
+ carry3 = (h3 + (crypto_int64) (1<<24)) >> 25; h4 += carry3; h3 -= carry3 << 25;
+ carry7 = (h7 + (crypto_int64) (1<<24)) >> 25; h8 += carry7; h7 -= carry7 << 25;
+
+ carry4 = (h4 + (crypto_int64) (1<<25)) >> 26; h5 += carry4; h4 -= carry4 << 26;
+ carry8 = (h8 + (crypto_int64) (1<<25)) >> 26; h9 += carry8; h8 -= carry8 << 26;
+
+ carry9 = (h9 + (crypto_int64) (1<<24)) >> 25; h0 += carry9 * 19; h9 -= carry9 << 25;
+
+ carry0 = (h0 + (crypto_int64) (1<<25)) >> 26; h1 += carry0; h0 -= carry0 << 26;
+
+ h[0] = h0;
+ h[1] = h1;
+ h[2] = h2;
+ h[3] = h3;
+ h[4] = h4;
+ h[5] = h5;
+ h[6] = h6;
+ h[7] = h7;
+ h[8] = h8;
+ h[9] = h9;
+}
diff --git a/plugin/auth_ed25519/ref10/fe_sub.c b/plugin/auth_ed25519/ref10/fe_sub.c
new file mode 100644
index 00000000000..6e26b7df8f5
--- /dev/null
+++ b/plugin/auth_ed25519/ref10/fe_sub.c
@@ -0,0 +1,57 @@
+#include "fe.h"
+
+/*
+h = f - g
+Can overlap h with f or g.
+
+Preconditions:
+ |f| bounded by 1.1*2^25,1.1*2^24,1.1*2^25,1.1*2^24,etc.
+ |g| bounded by 1.1*2^25,1.1*2^24,1.1*2^25,1.1*2^24,etc.
+
+Postconditions:
+ |h| bounded by 1.1*2^26,1.1*2^25,1.1*2^26,1.1*2^25,etc.
+*/
+
+void fe_sub(fe h,const fe f,const fe g)
+{
+ crypto_int32 f0 = f[0];
+ crypto_int32 f1 = f[1];
+ crypto_int32 f2 = f[2];
+ crypto_int32 f3 = f[3];
+ crypto_int32 f4 = f[4];
+ crypto_int32 f5 = f[5];
+ crypto_int32 f6 = f[6];
+ crypto_int32 f7 = f[7];
+ crypto_int32 f8 = f[8];
+ crypto_int32 f9 = f[9];
+ crypto_int32 g0 = g[0];
+ crypto_int32 g1 = g[1];
+ crypto_int32 g2 = g[2];
+ crypto_int32 g3 = g[3];
+ crypto_int32 g4 = g[4];
+ crypto_int32 g5 = g[5];
+ crypto_int32 g6 = g[6];
+ crypto_int32 g7 = g[7];
+ crypto_int32 g8 = g[8];
+ crypto_int32 g9 = g[9];
+ crypto_int32 h0 = f0 - g0;
+ crypto_int32 h1 = f1 - g1;
+ crypto_int32 h2 = f2 - g2;
+ crypto_int32 h3 = f3 - g3;
+ crypto_int32 h4 = f4 - g4;
+ crypto_int32 h5 = f5 - g5;
+ crypto_int32 h6 = f6 - g6;
+ crypto_int32 h7 = f7 - g7;
+ crypto_int32 h8 = f8 - g8;
+ crypto_int32 h9 = f9 - g9;
+ h[0] = h0;
+ h[1] = h1;
+ h[2] = h2;
+ h[3] = h3;
+ h[4] = h4;
+ h[5] = h5;
+ h[6] = h6;
+ h[7] = h7;
+ h[8] = h8;
+ h[9] = h9;
+}
diff --git a/plugin/auth_ed25519/ref10/fe_tobytes.c b/plugin/auth_ed25519/ref10/fe_tobytes.c
new file mode 100644
index 00000000000..0a63baf9c17
--- /dev/null
+++ b/plugin/auth_ed25519/ref10/fe_tobytes.c
@@ -0,0 +1,119 @@
+#include "fe.h"
+
+/*
+Preconditions:
+ |h| bounded by 1.1*2^26,1.1*2^25,1.1*2^26,1.1*2^25,etc.
+
+Write p=2^255-19; q=floor(h/p).
+Basic claim: q = floor(2^(-255)(h + 19 2^(-25)h9 + 2^(-1))).
+
+Proof:
+ Have |h|<=p so |q|<=1 so |19^2 2^(-255) q|<1/4.
+ Also have |h-2^230 h9|<2^231 so |19 2^(-255)(h-2^230 h9)|<1/4.
+
+ Write y=2^(-1)-19^2 2^(-255)q-19 2^(-255)(h-2^230 h9).
+ Then 0<y<1.
+
+ Write r=h-pq.
+ Have 0<=r<=p-1=2^255-20.
+ Thus 0<=r+19(2^-255)r<r+19(2^-255)2^255<=2^255-1.
+
+ Write x=r+19(2^-255)r+y.
+ Then 0<x<2^255 so floor(2^(-255)x) = 0 so floor(q+2^(-255)x) = q.
+
+ Have q+2^(-255)x = 2^(-255)(h + 19 2^(-25) h9 + 2^(-1))
+ so floor(2^(-255)(h + 19 2^(-25) h9 + 2^(-1))) = q.
+*/
+
+void fe_tobytes(unsigned char *s,const fe h)
+{
+ crypto_int32 h0 = h[0];
+ crypto_int32 h1 = h[1];
+ crypto_int32 h2 = h[2];
+ crypto_int32 h3 = h[3];
+ crypto_int32 h4 = h[4];
+ crypto_int32 h5 = h[5];
+ crypto_int32 h6 = h[6];
+ crypto_int32 h7 = h[7];
+ crypto_int32 h8 = h[8];
+ crypto_int32 h9 = h[9];
+ crypto_int32 q;
+ crypto_int32 carry0;
+ crypto_int32 carry1;
+ crypto_int32 carry2;
+ crypto_int32 carry3;
+ crypto_int32 carry4;
+ crypto_int32 carry5;
+ crypto_int32 carry6;
+ crypto_int32 carry7;
+ crypto_int32 carry8;
+ crypto_int32 carry9;
+
+ q = (19 * h9 + (((crypto_int32) 1) << 24)) >> 25;
+ q = (h0 + q) >> 26;
+ q = (h1 + q) >> 25;
+ q = (h2 + q) >> 26;
+ q = (h3 + q) >> 25;
+ q = (h4 + q) >> 26;
+ q = (h5 + q) >> 25;
+ q = (h6 + q) >> 26;
+ q = (h7 + q) >> 25;
+ q = (h8 + q) >> 26;
+ q = (h9 + q) >> 25;
+
+ /* Goal: Output h-(2^255-19)q, which is between 0 and 2^255-20. */
+ h0 += 19 * q;
+ /* Goal: Output h-2^255 q, which is between 0 and 2^255-20. */
+
+ carry0 = h0 >> 26; h1 += carry0; h0 -= carry0 << 26;
+ carry1 = h1 >> 25; h2 += carry1; h1 -= carry1 << 25;
+ carry2 = h2 >> 26; h3 += carry2; h2 -= carry2 << 26;
+ carry3 = h3 >> 25; h4 += carry3; h3 -= carry3 << 25;
+ carry4 = h4 >> 26; h5 += carry4; h4 -= carry4 << 26;
+ carry5 = h5 >> 25; h6 += carry5; h5 -= carry5 << 25;
+ carry6 = h6 >> 26; h7 += carry6; h6 -= carry6 << 26;
+ carry7 = h7 >> 25; h8 += carry7; h7 -= carry7 << 25;
+ carry8 = h8 >> 26; h9 += carry8; h8 -= carry8 << 26;
+ carry9 = h9 >> 25; h9 -= carry9 << 25;
+ /* h10 = carry9 */
+
+ /*
+ Goal: Output h0+...+2^255 h10-2^255 q, which is between 0 and 2^255-20.
+ Have h0+...+2^230 h9 between 0 and 2^255-1;
+ evidently 2^255 h10-2^255 q = 0.
+ Goal: Output h0+...+2^230 h9.
+ */
+
+ s[0] = h0 >> 0;
+ s[1] = h0 >> 8;
+ s[2] = h0 >> 16;
+ s[3] = (h0 >> 24) | (h1 << 2);
+ s[4] = h1 >> 6;
+ s[5] = h1 >> 14;
+ s[6] = (h1 >> 22) | (h2 << 3);
+ s[7] = h2 >> 5;
+ s[8] = h2 >> 13;
+ s[9] = (h2 >> 21) | (h3 << 5);
+ s[10] = h3 >> 3;
+ s[11] = h3 >> 11;
+ s[12] = (h3 >> 19) | (h4 << 6);
+ s[13] = h4 >> 2;
+ s[14] = h4 >> 10;
+ s[15] = h4 >> 18;
+ s[16] = h5 >> 0;
+ s[17] = h5 >> 8;
+ s[18] = h5 >> 16;
+ s[19] = (h5 >> 24) | (h6 << 1);
+ s[20] = h6 >> 7;
+ s[21] = h6 >> 15;
+ s[22] = (h6 >> 23) | (h7 << 3);
+ s[23] = h7 >> 5;
+ s[24] = h7 >> 13;
+ s[25] = (h7 >> 21) | (h8 << 4);
+ s[26] = h8 >> 4;
+ s[27] = h8 >> 12;
+ s[28] = (h8 >> 20) | (h9 << 6);
+ s[29] = h9 >> 2;
+ s[30] = h9 >> 10;
+ s[31] = h9 >> 18;
+}
diff --git a/plugin/auth_ed25519/ref10/ge.h b/plugin/auth_ed25519/ref10/ge.h
new file mode 100644
index 00000000000..55e95f95b6e
--- /dev/null
+++ b/plugin/auth_ed25519/ref10/ge.h
@@ -0,0 +1,95 @@
+#ifndef GE_H
+#define GE_H
+
+/*
+ge means group element.
+
+Here the group is the set of pairs (x,y) of field elements (see fe.h)
+satisfying -x^2 + y^2 = 1 + d x^2y^2
+where d = -121665/121666.
+
+Representations:
+ ge_p2 (projective): (X:Y:Z) satisfying x=X/Z, y=Y/Z
+ ge_p3 (extended): (X:Y:Z:T) satisfying x=X/Z, y=Y/Z, XY=ZT
+ ge_p1p1 (completed): ((X:Z),(Y:T)) satisfying x=X/Z, y=Y/T
+ ge_precomp (Duif): (y+x,y-x,2dxy)
+*/
+
+#include "fe.h"
+
+typedef struct {
+ fe X;
+ fe Y;
+ fe Z;
+} ge_p2;
+
+typedef struct {
+ fe X;
+ fe Y;
+ fe Z;
+ fe T;
+} ge_p3;
+
+typedef struct {
+ fe X;
+ fe Y;
+ fe Z;
+ fe T;
+} ge_p1p1;
+
+typedef struct {
+ fe yplusx;
+ fe yminusx;
+ fe xy2d;
+} ge_precomp;
+
+typedef struct {
+ fe YplusX;
+ fe YminusX;
+ fe Z;
+ fe T2d;
+} ge_cached;
+
+#define ge_frombytes_negate_vartime crypto_sign_ed25519_ref10_ge_frombytes_negate_vartime
+#define ge_tobytes crypto_sign_ed25519_ref10_ge_tobytes
+#define ge_p3_tobytes crypto_sign_ed25519_ref10_ge_p3_tobytes
+
+#define ge_p2_0 crypto_sign_ed25519_ref10_ge_p2_0
+#define ge_p3_0 crypto_sign_ed25519_ref10_ge_p3_0
+#define ge_precomp_0 crypto_sign_ed25519_ref10_ge_precomp_0
+#define ge_p3_to_p2 crypto_sign_ed25519_ref10_ge_p3_to_p2
+#define ge_p3_to_cached crypto_sign_ed25519_ref10_ge_p3_to_cached
+#define ge_p1p1_to_p2 crypto_sign_ed25519_ref10_ge_p1p1_to_p2
+#define ge_p1p1_to_p3 crypto_sign_ed25519_ref10_ge_p1p1_to_p3
+#define ge_p2_dbl crypto_sign_ed25519_ref10_ge_p2_dbl
+#define ge_p3_dbl crypto_sign_ed25519_ref10_ge_p3_dbl
+
+#define ge_madd crypto_sign_ed25519_ref10_ge_madd
+#define ge_msub crypto_sign_ed25519_ref10_ge_msub
+#define ge_add crypto_sign_ed25519_ref10_ge_add
+#define ge_sub crypto_sign_ed25519_ref10_ge_sub
+#define ge_scalarmult_base crypto_sign_ed25519_ref10_ge_scalarmult_base
+#define ge_double_scalarmult_vartime crypto_sign_ed25519_ref10_ge_double_scalarmult_vartime
+
+extern void ge_tobytes(unsigned char *,const ge_p2 *);
+extern void ge_p3_tobytes(unsigned char *,const ge_p3 *);
+extern int ge_frombytes_negate_vartime(ge_p3 *,const unsigned char *);
+
+extern void ge_p2_0(ge_p2 *);
+extern void ge_p3_0(ge_p3 *);
+extern void ge_precomp_0(ge_precomp *);
+extern void ge_p3_to_p2(ge_p2 *,const ge_p3 *);
+extern void ge_p3_to_cached(ge_cached *,const ge_p3 *);
+extern void ge_p1p1_to_p2(ge_p2 *,const ge_p1p1 *);
+extern void ge_p1p1_to_p3(ge_p3 *,const ge_p1p1 *);
+extern void ge_p2_dbl(ge_p1p1 *,const ge_p2 *);
+extern void ge_p3_dbl(ge_p1p1 *,const ge_p3 *);
+
+extern void ge_madd(ge_p1p1 *,const ge_p3 *,const ge_precomp *);
+extern void ge_msub(ge_p1p1 *,const ge_p3 *,const ge_precomp *);
+extern void ge_add(ge_p1p1 *,const ge_p3 *,const ge_cached *);
+extern void ge_sub(ge_p1p1 *,const ge_p3 *,const ge_cached *);
+extern void ge_scalarmult_base(ge_p3 *,const unsigned char *);
+extern void ge_double_scalarmult_vartime(ge_p2 *,const unsigned char *,const ge_p3 *,const unsigned char *);
+
+#endif
diff --git a/plugin/auth_ed25519/ref10/ge_add.c b/plugin/auth_ed25519/ref10/ge_add.c
new file mode 100644
index 00000000000..da7ff5d2ebe
--- /dev/null
+++ b/plugin/auth_ed25519/ref10/ge_add.c
@@ -0,0 +1,11 @@
+#include "ge.h"
+
+/*
+r = p + q
+*/
+
+void ge_add(ge_p1p1 *r,const ge_p3 *p,const ge_cached *q)
+{
+ fe t0;
+#include "ge_add.h"
+}
diff --git a/plugin/auth_ed25519/ref10/ge_add.h b/plugin/auth_ed25519/ref10/ge_add.h
new file mode 100644
index 00000000000..7481f8ffbed
--- /dev/null
+++ b/plugin/auth_ed25519/ref10/ge_add.h
@@ -0,0 +1,97 @@
+
+/* qhasm: enter ge_add */
+
+/* qhasm: fe X1 */
+
+/* qhasm: fe Y1 */
+
+/* qhasm: fe Z1 */
+
+/* qhasm: fe Z2 */
+
+/* qhasm: fe T1 */
+
+/* qhasm: fe ZZ */
+
+/* qhasm: fe YpX2 */
+
+/* qhasm: fe YmX2 */
+
+/* qhasm: fe T2d2 */
+
+/* qhasm: fe X3 */
+
+/* qhasm: fe Y3 */
+
+/* qhasm: fe Z3 */
+
+/* qhasm: fe T3 */
+
+/* qhasm: fe YpX1 */
+
+/* qhasm: fe YmX1 */
+
+/* qhasm: fe A */
+
+/* qhasm: fe B */
+
+/* qhasm: fe C */
+
+/* qhasm: fe D */
+
+/* qhasm: YpX1 = Y1+X1 */
+/* asm 1: fe_add(>YpX1=fe#1,<Y1=fe#12,<X1=fe#11); */
+/* asm 2: fe_add(>YpX1=r->X,<Y1=p->Y,<X1=p->X); */
+fe_add(r->X,p->Y,p->X);
+
+/* qhasm: YmX1 = Y1-X1 */
+/* asm 1: fe_sub(>YmX1=fe#2,<Y1=fe#12,<X1=fe#11); */
+/* asm 2: fe_sub(>YmX1=r->Y,<Y1=p->Y,<X1=p->X); */
+fe_sub(r->Y,p->Y,p->X);
+
+/* qhasm: A = YpX1*YpX2 */
+/* asm 1: fe_mul(>A=fe#3,<YpX1=fe#1,<YpX2=fe#15); */
+/* asm 2: fe_mul(>A=r->Z,<YpX1=r->X,<YpX2=q->YplusX); */
+fe_mul(r->Z,r->X,q->YplusX);
+
+/* qhasm: B = YmX1*YmX2 */
+/* asm 1: fe_mul(>B=fe#2,<YmX1=fe#2,<YmX2=fe#16); */
+/* asm 2: fe_mul(>B=r->Y,<YmX1=r->Y,<YmX2=q->YminusX); */
+fe_mul(r->Y,r->Y,q->YminusX);
+
+/* qhasm: C = T2d2*T1 */
+/* asm 1: fe_mul(>C=fe#4,<T2d2=fe#18,<T1=fe#14); */
+/* asm 2: fe_mul(>C=r->T,<T2d2=q->T2d,<T1=p->T); */
+fe_mul(r->T,q->T2d,p->T);
+
+/* qhasm: ZZ = Z1*Z2 */
+/* asm 1: fe_mul(>ZZ=fe#1,<Z1=fe#13,<Z2=fe#17); */
+/* asm 2: fe_mul(>ZZ=r->X,<Z1=p->Z,<Z2=q->Z); */
+fe_mul(r->X,p->Z,q->Z);
+
+/* qhasm: D = 2*ZZ */
+/* asm 1: fe_add(>D=fe#5,<ZZ=fe#1,<ZZ=fe#1); */
+/* asm 2: fe_add(>D=t0,<ZZ=r->X,<ZZ=r->X); */
+fe_add(t0,r->X,r->X);
+
+/* qhasm: X3 = A-B */
+/* asm 1: fe_sub(>X3=fe#1,<A=fe#3,<B=fe#2); */
+/* asm 2: fe_sub(>X3=r->X,<A=r->Z,<B=r->Y); */
+fe_sub(r->X,r->Z,r->Y);
+
+/* qhasm: Y3 = A+B */
+/* asm 1: fe_add(>Y3=fe#2,<A=fe#3,<B=fe#2); */
+/* asm 2: fe_add(>Y3=r->Y,<A=r->Z,<B=r->Y); */
+fe_add(r->Y,r->Z,r->Y);
+
+/* qhasm: Z3 = D+C */
+/* asm 1: fe_add(>Z3=fe#3,<D=fe#5,<C=fe#4); */
+/* asm 2: fe_add(>Z3=r->Z,<D=t0,<C=r->T); */
+fe_add(r->Z,t0,r->T);
+
+/* qhasm: T3 = D-C */
+/* asm 1: fe_sub(>T3=fe#4,<D=fe#5,<C=fe#4); */
+/* asm 2: fe_sub(>T3=r->T,<D=t0,<C=r->T); */
+fe_sub(r->T,t0,r->T);
+
+/* qhasm: return */
diff --git a/plugin/auth_ed25519/ref10/ge_double_scalarmult.c b/plugin/auth_ed25519/ref10/ge_double_scalarmult.c
new file mode 100644
index 00000000000..f8bf4bf775b
--- /dev/null
+++ b/plugin/auth_ed25519/ref10/ge_double_scalarmult.c
@@ -0,0 +1,96 @@
+#include "ge.h"
+
+static void slide(signed char *r,const unsigned char *a)
+{
+ int i;
+ int b;
+ int k;
+
+ for (i = 0;i < 256;++i)
+ r[i] = 1 & (a[i >> 3] >> (i & 7));
+
+ for (i = 0;i < 256;++i)
+ if (r[i]) {
+ for (b = 1;b <= 6 && i + b < 256;++b) {
+ if (r[i + b]) {
+ if (r[i] + (r[i + b] << b) <= 15) {
+ r[i] += r[i + b] << b; r[i + b] = 0;
+ } else if (r[i] - (r[i + b] << b) >= -15) {
+ r[i] -= r[i + b] << b;
+ for (k = i + b;k < 256;++k) {
+ if (!r[k]) {
+ r[k] = 1;
+ break;
+ }
+ r[k] = 0;
+ }
+ } else
+ break;
+ }
+ }
+ }
+
+}
+
+static ge_precomp Bi[8] = {
+#include "base2.h"
+} ;
+
+/*
+r = a * A + b * B
+where a = a[0]+256*a[1]+...+256^31 a[31].
+and b = b[0]+256*b[1]+...+256^31 b[31].
+B is the Ed25519 base point (x,4/5) with x positive.
+*/
+
+void ge_double_scalarmult_vartime(ge_p2 *r,const unsigned char *a,const ge_p3 *A,const unsigned char *b)
+{
+ signed char aslide[256];
+ signed char bslide[256];
+ ge_cached Ai[8]; /* A,3A,5A,7A,9A,11A,13A,15A */
+ ge_p1p1 t;
+ ge_p3 u;
+ ge_p3 A2;
+ int i;
+
+ slide(aslide,a);
+ slide(bslide,b);
+
+ ge_p3_to_cached(&Ai[0],A);
+ ge_p3_dbl(&t,A); ge_p1p1_to_p3(&A2,&t);
+ ge_add(&t,&A2,&Ai[0]); ge_p1p1_to_p3(&u,&t); ge_p3_to_cached(&Ai[1],&u);
+ ge_add(&t,&A2,&Ai[1]); ge_p1p1_to_p3(&u,&t); ge_p3_to_cached(&Ai[2],&u);
+ ge_add(&t,&A2,&Ai[2]); ge_p1p1_to_p3(&u,&t); ge_p3_to_cached(&Ai[3],&u);
+ ge_add(&t,&A2,&Ai[3]); ge_p1p1_to_p3(&u,&t); ge_p3_to_cached(&Ai[4],&u);
+ ge_add(&t,&A2,&Ai[4]); ge_p1p1_to_p3(&u,&t); ge_p3_to_cached(&Ai[5],&u);
+ ge_add(&t,&A2,&Ai[5]); ge_p1p1_to_p3(&u,&t); ge_p3_to_cached(&Ai[6],&u);
+ ge_add(&t,&A2,&Ai[6]); ge_p1p1_to_p3(&u,&t); ge_p3_to_cached(&Ai[7],&u);
+
+ ge_p2_0(r);
+
+ for (i = 255;i >= 0;--i) {
+ if (aslide[i] || bslide[i]) break;
+ }
+
+ for (;i >= 0;--i) {
+ ge_p2_dbl(&t,r);
+
+ if (aslide[i] > 0) {
+ ge_p1p1_to_p3(&u,&t);
+ ge_add(&t,&u,&Ai[aslide[i]/2]);
+ } else if (aslide[i] < 0) {
+ ge_p1p1_to_p3(&u,&t);
+ ge_sub(&t,&u,&Ai[(-aslide[i])/2]);
+ }
+
+ if (bslide[i] > 0) {
+ ge_p1p1_to_p3(&u,&t);
+ ge_madd(&t,&u,&Bi[bslide[i]/2]);
+ } else if (bslide[i] < 0) {
+ ge_p1p1_to_p3(&u,&t);
+ ge_msub(&t,&u,&Bi[(-bslide[i])/2]);
+ }
+
+ ge_p1p1_to_p2(r,&t);
+ }
+}
diff --git a/plugin/auth_ed25519/ref10/ge_frombytes.c b/plugin/auth_ed25519/ref10/ge_frombytes.c
new file mode 100644
index 00000000000..1a059ee93fa
--- /dev/null
+++ b/plugin/auth_ed25519/ref10/ge_frombytes.c
@@ -0,0 +1,50 @@
+#include "ge.h"
+
+static const fe d = {
+#include "d.h"
+} ;
+
+static const fe sqrtm1 = {
+#include "sqrtm1.h"
+} ;
+
+int ge_frombytes_negate_vartime(ge_p3 *h,const unsigned char *s)
+{
+ fe u;
+ fe v;
+ fe v3;
+ fe vxx;
+ fe check;
+
+ fe_frombytes(h->Y,s);
+ fe_1(h->Z);
+ fe_sq(u,h->Y);
+ fe_mul(v,u,d);
+ fe_sub(u,u,h->Z); /* u = y^2-1 */
+ fe_add(v,v,h->Z); /* v = dy^2+1 */
+
+ fe_sq(v3,v);
+ fe_mul(v3,v3,v); /* v3 = v^3 */
+ fe_sq(h->X,v3);
+ fe_mul(h->X,h->X,v);
+ fe_mul(h->X,h->X,u); /* x = uv^7 */
+
+ fe_pow22523(h->X,h->X); /* x = (uv^7)^((q-5)/8) */
+ fe_mul(h->X,h->X,v3);
+ fe_mul(h->X,h->X,u); /* x = uv^3(uv^7)^((q-5)/8) */
+
+ fe_sq(vxx,h->X);
+ fe_mul(vxx,vxx,v);
+ fe_sub(check,vxx,u); /* vx^2-u */
+ if (fe_isnonzero(check)) {
+ fe_add(check,vxx,u); /* vx^2+u */
+ if (fe_isnonzero(check)) return -1;
+ fe_mul(h->X,h->X,sqrtm1);
+ }
+
+ if (fe_isnegative(h->X) == (s[31] >> 7))
+ fe_neg(h->X,h->X);
+
+ fe_mul(h->T,h->X,h->Y);
+ return 0;
+}
diff --git a/plugin/auth_ed25519/ref10/ge_madd.c b/plugin/auth_ed25519/ref10/ge_madd.c
new file mode 100644
index 00000000000..622571774b4
--- /dev/null
+++ b/plugin/auth_ed25519/ref10/ge_madd.c
@@ -0,0 +1,11 @@
+#include "ge.h"
+
+/*
+r = p + q
+*/
+
+void ge_madd(ge_p1p1 *r,const ge_p3 *p,const ge_precomp *q)
+{
+ fe t0;
+#include "ge_madd.h"
+}
diff --git a/plugin/auth_ed25519/ref10/ge_madd.h b/plugin/auth_ed25519/ref10/ge_madd.h
new file mode 100644
index 00000000000..ecae84952b3
--- /dev/null
+++ b/plugin/auth_ed25519/ref10/ge_madd.h
@@ -0,0 +1,88 @@
+
+/* qhasm: enter ge_madd */
+
+/* qhasm: fe X1 */
+
+/* qhasm: fe Y1 */
+
+/* qhasm: fe Z1 */
+
+/* qhasm: fe T1 */
+
+/* qhasm: fe ypx2 */
+
+/* qhasm: fe ymx2 */
+
+/* qhasm: fe xy2d2 */
+
+/* qhasm: fe X3 */
+
+/* qhasm: fe Y3 */
+
+/* qhasm: fe Z3 */
+
+/* qhasm: fe T3 */
+
+/* qhasm: fe YpX1 */
+
+/* qhasm: fe YmX1 */
+
+/* qhasm: fe A */
+
+/* qhasm: fe B */
+
+/* qhasm: fe C */
+
+/* qhasm: fe D */
+
+/* qhasm: YpX1 = Y1+X1 */
+/* asm 1: fe_add(>YpX1=fe#1,<Y1=fe#12,<X1=fe#11); */
+/* asm 2: fe_add(>YpX1=r->X,<Y1=p->Y,<X1=p->X); */
+fe_add(r->X,p->Y,p->X);
+
+/* qhasm: YmX1 = Y1-X1 */
+/* asm 1: fe_sub(>YmX1=fe#2,<Y1=fe#12,<X1=fe#11); */
+/* asm 2: fe_sub(>YmX1=r->Y,<Y1=p->Y,<X1=p->X); */
+fe_sub(r->Y,p->Y,p->X);
+
+/* qhasm: A = YpX1*ypx2 */
+/* asm 1: fe_mul(>A=fe#3,<YpX1=fe#1,<ypx2=fe#15); */
+/* asm 2: fe_mul(>A=r->Z,<YpX1=r->X,<ypx2=q->yplusx); */
+fe_mul(r->Z,r->X,q->yplusx);
+
+/* qhasm: B = YmX1*ymx2 */
+/* asm 1: fe_mul(>B=fe#2,<YmX1=fe#2,<ymx2=fe#16); */
+/* asm 2: fe_mul(>B=r->Y,<YmX1=r->Y,<ymx2=q->yminusx); */
+fe_mul(r->Y,r->Y,q->yminusx);
+
+/* qhasm: C = xy2d2*T1 */
+/* asm 1: fe_mul(>C=fe#4,<xy2d2=fe#17,<T1=fe#14); */
+/* asm 2: fe_mul(>C=r->T,<xy2d2=q->xy2d,<T1=p->T); */
+fe_mul(r->T,q->xy2d,p->T);
+
+/* qhasm: D = 2*Z1 */
+/* asm 1: fe_add(>D=fe#5,<Z1=fe#13,<Z1=fe#13); */
+/* asm 2: fe_add(>D=t0,<Z1=p->Z,<Z1=p->Z); */
+fe_add(t0,p->Z,p->Z);
+
+/* qhasm: X3 = A-B */
+/* asm 1: fe_sub(>X3=fe#1,<A=fe#3,<B=fe#2); */
+/* asm 2: fe_sub(>X3=r->X,<A=r->Z,<B=r->Y); */
+fe_sub(r->X,r->Z,r->Y);
+
+/* qhasm: Y3 = A+B */
+/* asm 1: fe_add(>Y3=fe#2,<A=fe#3,<B=fe#2); */
+/* asm 2: fe_add(>Y3=r->Y,<A=r->Z,<B=r->Y); */
+fe_add(r->Y,r->Z,r->Y);
+
+/* qhasm: Z3 = D+C */
+/* asm 1: fe_add(>Z3=fe#3,<D=fe#5,<C=fe#4); */
+/* asm 2: fe_add(>Z3=r->Z,<D=t0,<C=r->T); */
+fe_add(r->Z,t0,r->T);
+
+/* qhasm: T3 = D-C */
+/* asm 1: fe_sub(>T3=fe#4,<D=fe#5,<C=fe#4); */
+/* asm 2: fe_sub(>T3=r->T,<D=t0,<C=r->T); */
+fe_sub(r->T,t0,r->T);
+
+/* qhasm: return */
diff --git a/plugin/auth_ed25519/ref10/ge_msub.c b/plugin/auth_ed25519/ref10/ge_msub.c
new file mode 100644
index 00000000000..741ecbf1139
--- /dev/null
+++ b/plugin/auth_ed25519/ref10/ge_msub.c
@@ -0,0 +1,11 @@
+#include "ge.h"
+
+/*
+r = p - q
+*/
+
+void ge_msub(ge_p1p1 *r,const ge_p3 *p,const ge_precomp *q)
+{
+ fe t0;
+#include "ge_msub.h"
+}
diff --git a/plugin/auth_ed25519/ref10/ge_msub.h b/plugin/auth_ed25519/ref10/ge_msub.h
new file mode 100644
index 00000000000..500f986ba0d
--- /dev/null
+++ b/plugin/auth_ed25519/ref10/ge_msub.h
@@ -0,0 +1,88 @@
+
+/* qhasm: enter ge_msub */
+
+/* qhasm: fe X1 */
+
+/* qhasm: fe Y1 */
+
+/* qhasm: fe Z1 */
+
+/* qhasm: fe T1 */
+
+/* qhasm: fe ypx2 */
+
+/* qhasm: fe ymx2 */
+
+/* qhasm: fe xy2d2 */
+
+/* qhasm: fe X3 */
+
+/* qhasm: fe Y3 */
+
+/* qhasm: fe Z3 */
+
+/* qhasm: fe T3 */
+
+/* qhasm: fe YpX1 */
+
+/* qhasm: fe YmX1 */
+
+/* qhasm: fe A */
+
+/* qhasm: fe B */
+
+/* qhasm: fe C */
+
+/* qhasm: fe D */
+
+/* qhasm: YpX1 = Y1+X1 */
+/* asm 1: fe_add(>YpX1=fe#1,<Y1=fe#12,<X1=fe#11); */
+/* asm 2: fe_add(>YpX1=r->X,<Y1=p->Y,<X1=p->X); */
+fe_add(r->X,p->Y,p->X);
+
+/* qhasm: YmX1 = Y1-X1 */
+/* asm 1: fe_sub(>YmX1=fe#2,<Y1=fe#12,<X1=fe#11); */
+/* asm 2: fe_sub(>YmX1=r->Y,<Y1=p->Y,<X1=p->X); */
+fe_sub(r->Y,p->Y,p->X);
+
+/* qhasm: A = YpX1*ymx2 */
+/* asm 1: fe_mul(>A=fe#3,<YpX1=fe#1,<ymx2=fe#16); */
+/* asm 2: fe_mul(>A=r->Z,<YpX1=r->X,<ymx2=q->yminusx); */
+fe_mul(r->Z,r->X,q->yminusx);
+
+/* qhasm: B = YmX1*ypx2 */
+/* asm 1: fe_mul(>B=fe#2,<YmX1=fe#2,<ypx2=fe#15); */
+/* asm 2: fe_mul(>B=r->Y,<YmX1=r->Y,<ypx2=q->yplusx); */
+fe_mul(r->Y,r->Y,q->yplusx);
+
+/* qhasm: C = xy2d2*T1 */
+/* asm 1: fe_mul(>C=fe#4,<xy2d2=fe#17,<T1=fe#14); */
+/* asm 2: fe_mul(>C=r->T,<xy2d2=q->xy2d,<T1=p->T); */
+fe_mul(r->T,q->xy2d,p->T);
+
+/* qhasm: D = 2*Z1 */
+/* asm 1: fe_add(>D=fe#5,<Z1=fe#13,<Z1=fe#13); */
+/* asm 2: fe_add(>D=t0,<Z1=p->Z,<Z1=p->Z); */
+fe_add(t0,p->Z,p->Z);
+
+/* qhasm: X3 = A-B */
+/* asm 1: fe_sub(>X3=fe#1,<A=fe#3,<B=fe#2); */
+/* asm 2: fe_sub(>X3=r->X,<A=r->Z,<B=r->Y); */
+fe_sub(r->X,r->Z,r->Y);
+
+/* qhasm: Y3 = A+B */
+/* asm 1: fe_add(>Y3=fe#2,<A=fe#3,<B=fe#2); */
+/* asm 2: fe_add(>Y3=r->Y,<A=r->Z,<B=r->Y); */
+fe_add(r->Y,r->Z,r->Y);
+
+/* qhasm: Z3 = D-C */
+/* asm 1: fe_sub(>Z3=fe#3,<D=fe#5,<C=fe#4); */
+/* asm 2: fe_sub(>Z3=r->Z,<D=t0,<C=r->T); */
+fe_sub(r->Z,t0,r->T);
+
+/* qhasm: T3 = D+C */
+/* asm 1: fe_add(>T3=fe#4,<D=fe#5,<C=fe#4); */
+/* asm 2: fe_add(>T3=r->T,<D=t0,<C=r->T); */
+fe_add(r->T,t0,r->T);
+
+/* qhasm: return */
diff --git a/plugin/auth_ed25519/ref10/ge_p1p1_to_p2.c b/plugin/auth_ed25519/ref10/ge_p1p1_to_p2.c
new file mode 100644
index 00000000000..9bb5013d668
--- /dev/null
+++ b/plugin/auth_ed25519/ref10/ge_p1p1_to_p2.c
@@ -0,0 +1,12 @@
+#include "ge.h"
+
+/*
+r = p
+*/
+
+extern void ge_p1p1_to_p2(ge_p2 *r,const ge_p1p1 *p)
+{
+ fe_mul(r->X,p->X,p->T);
+ fe_mul(r->Y,p->Y,p->Z);
+ fe_mul(r->Z,p->Z,p->T);
+}
diff --git a/plugin/auth_ed25519/ref10/ge_p1p1_to_p3.c b/plugin/auth_ed25519/ref10/ge_p1p1_to_p3.c
new file mode 100644
index 00000000000..2f57b109685
--- /dev/null
+++ b/plugin/auth_ed25519/ref10/ge_p1p1_to_p3.c
@@ -0,0 +1,13 @@
+#include "ge.h"
+
+/*
+r = p
+*/
+
+extern void ge_p1p1_to_p3(ge_p3 *r,const ge_p1p1 *p)
+{
+ fe_mul(r->X,p->X,p->T);
+ fe_mul(r->Y,p->Y,p->Z);
+ fe_mul(r->Z,p->Z,p->T);
+ fe_mul(r->T,p->X,p->Y);
+}
diff --git a/plugin/auth_ed25519/ref10/ge_p2_0.c b/plugin/auth_ed25519/ref10/ge_p2_0.c
new file mode 100644
index 00000000000..6191d1e6e4e
--- /dev/null
+++ b/plugin/auth_ed25519/ref10/ge_p2_0.c
@@ -0,0 +1,8 @@
+#include "ge.h"
+
+void ge_p2_0(ge_p2 *h)
+{
+ fe_0(h->X);
+ fe_1(h->Y);
+ fe_1(h->Z);
+}
diff --git a/plugin/auth_ed25519/ref10/ge_p2_dbl.c b/plugin/auth_ed25519/ref10/ge_p2_dbl.c
new file mode 100644
index 00000000000..2e332b5cee4
--- /dev/null
+++ b/plugin/auth_ed25519/ref10/ge_p2_dbl.c
@@ -0,0 +1,11 @@
+#include "ge.h"
+
+/*
+r = 2 * p
+*/
+
+void ge_p2_dbl(ge_p1p1 *r,const ge_p2 *p)
+{
+ fe t0;
+#include "ge_p2_dbl.h"
+}
diff --git a/plugin/auth_ed25519/ref10/ge_p2_dbl.h b/plugin/auth_ed25519/ref10/ge_p2_dbl.h
new file mode 100644
index 00000000000..128efed9076
--- /dev/null
+++ b/plugin/auth_ed25519/ref10/ge_p2_dbl.h
@@ -0,0 +1,73 @@
+
+/* qhasm: enter ge_p2_dbl */
+
+/* qhasm: fe X1 */
+
+/* qhasm: fe Y1 */
+
+/* qhasm: fe Z1 */
+
+/* qhasm: fe A */
+
+/* qhasm: fe AA */
+
+/* qhasm: fe XX */
+
+/* qhasm: fe YY */
+
+/* qhasm: fe B */
+
+/* qhasm: fe X3 */
+
+/* qhasm: fe Y3 */
+
+/* qhasm: fe Z3 */
+
+/* qhasm: fe T3 */
+
+/* qhasm: XX=X1^2 */
+/* asm 1: fe_sq(>XX=fe#1,<X1=fe#11); */
+/* asm 2: fe_sq(>XX=r->X,<X1=p->X); */
+fe_sq(r->X,p->X);
+
+/* qhasm: YY=Y1^2 */
+/* asm 1: fe_sq(>YY=fe#3,<Y1=fe#12); */
+/* asm 2: fe_sq(>YY=r->Z,<Y1=p->Y); */
+fe_sq(r->Z,p->Y);
+
+/* qhasm: B=2*Z1^2 */
+/* asm 1: fe_sq2(>B=fe#4,<Z1=fe#13); */
+/* asm 2: fe_sq2(>B=r->T,<Z1=p->Z); */
+fe_sq2(r->T,p->Z);
+
+/* qhasm: A=X1+Y1 */
+/* asm 1: fe_add(>A=fe#2,<X1=fe#11,<Y1=fe#12); */
+/* asm 2: fe_add(>A=r->Y,<X1=p->X,<Y1=p->Y); */
+fe_add(r->Y,p->X,p->Y);
+
+/* qhasm: AA=A^2 */
+/* asm 1: fe_sq(>AA=fe#5,<A=fe#2); */
+/* asm 2: fe_sq(>AA=t0,<A=r->Y); */
+fe_sq(t0,r->Y);
+
+/* qhasm: Y3=YY+XX */
+/* asm 1: fe_add(>Y3=fe#2,<YY=fe#3,<XX=fe#1); */
+/* asm 2: fe_add(>Y3=r->Y,<YY=r->Z,<XX=r->X); */
+fe_add(r->Y,r->Z,r->X);
+
+/* qhasm: Z3=YY-XX */
+/* asm 1: fe_sub(>Z3=fe#3,<YY=fe#3,<XX=fe#1); */
+/* asm 2: fe_sub(>Z3=r->Z,<YY=r->Z,<XX=r->X); */
+fe_sub(r->Z,r->Z,r->X);
+
+/* qhasm: X3=AA-Y3 */
+/* asm 1: fe_sub(>X3=fe#1,<AA=fe#5,<Y3=fe#2); */
+/* asm 2: fe_sub(>X3=r->X,<AA=t0,<Y3=r->Y); */
+fe_sub(r->X,t0,r->Y);
+
+/* qhasm: T3=B-Z3 */
+/* asm 1: fe_sub(>T3=fe#4,<B=fe#4,<Z3=fe#3); */
+/* asm 2: fe_sub(>T3=r->T,<B=r->T,<Z3=r->Z); */
+fe_sub(r->T,r->T,r->Z);
+
+/* qhasm: return */
diff --git a/plugin/auth_ed25519/ref10/ge_p3_0.c b/plugin/auth_ed25519/ref10/ge_p3_0.c
new file mode 100644
index 00000000000..401b2935a11
--- /dev/null
+++ b/plugin/auth_ed25519/ref10/ge_p3_0.c
@@ -0,0 +1,9 @@
+#include "ge.h"
+
+void ge_p3_0(ge_p3 *h)
+{
+ fe_0(h->X);
+ fe_1(h->Y);
+ fe_1(h->Z);
+ fe_0(h->T);
+}
diff --git a/plugin/auth_ed25519/ref10/ge_p3_dbl.c b/plugin/auth_ed25519/ref10/ge_p3_dbl.c
new file mode 100644
index 00000000000..0d8a05915d3
--- /dev/null
+++ b/plugin/auth_ed25519/ref10/ge_p3_dbl.c
@@ -0,0 +1,12 @@
+#include "ge.h"
+
+/*
+r = 2 * p
+*/
+
+void ge_p3_dbl(ge_p1p1 *r,const ge_p3 *p)
+{
+ ge_p2 q;
+ ge_p3_to_p2(&q,p);
+ ge_p2_dbl(r,&q);
+}
diff --git a/plugin/auth_ed25519/ref10/ge_p3_to_cached.c b/plugin/auth_ed25519/ref10/ge_p3_to_cached.c
new file mode 100644
index 00000000000..bde64228cf1
--- /dev/null
+++ b/plugin/auth_ed25519/ref10/ge_p3_to_cached.c
@@ -0,0 +1,17 @@
+#include "ge.h"
+
+/*
+r = p
+*/
+
+static const fe d2 = {
+#include "d2.h"
+} ;
+
+extern void ge_p3_to_cached(ge_cached *r,const ge_p3 *p)
+{
+ fe_add(r->YplusX,p->Y,p->X);
+ fe_sub(r->YminusX,p->Y,p->X);
+ fe_copy(r->Z,p->Z);
+ fe_mul(r->T2d,p->T,d2);
+}
diff --git a/plugin/auth_ed25519/ref10/ge_p3_to_p2.c b/plugin/auth_ed25519/ref10/ge_p3_to_p2.c
new file mode 100644
index 00000000000..e532a9e4cbc
--- /dev/null
+++ b/plugin/auth_ed25519/ref10/ge_p3_to_p2.c
@@ -0,0 +1,12 @@
+#include "ge.h"
+
+/*
+r = p
+*/
+
+extern void ge_p3_to_p2(ge_p2 *r,const ge_p3 *p)
+{
+ fe_copy(r->X,p->X);
+ fe_copy(r->Y,p->Y);
+ fe_copy(r->Z,p->Z);
+}
diff --git a/plugin/auth_ed25519/ref10/ge_p3_tobytes.c b/plugin/auth_ed25519/ref10/ge_p3_tobytes.c
new file mode 100644
index 00000000000..21cb2fc656d
--- /dev/null
+++ b/plugin/auth_ed25519/ref10/ge_p3_tobytes.c
@@ -0,0 +1,14 @@
+#include "ge.h"
+
+void ge_p3_tobytes(unsigned char *s,const ge_p3 *h)
+{
+ fe recip;
+ fe x;
+ fe y;
+
+ fe_invert(recip,h->Z);
+ fe_mul(x,h->X,recip);
+ fe_mul(y,h->Y,recip);
+ fe_tobytes(s,y);
+ s[31] ^= fe_isnegative(x) << 7;
+}
diff --git a/plugin/auth_ed25519/ref10/ge_precomp_0.c b/plugin/auth_ed25519/ref10/ge_precomp_0.c
new file mode 100644
index 00000000000..2e218861d8b
--- /dev/null
+++ b/plugin/auth_ed25519/ref10/ge_precomp_0.c
@@ -0,0 +1,8 @@
+#include "ge.h"
+
+void ge_precomp_0(ge_precomp *h)
+{
+ fe_1(h->yplusx);
+ fe_1(h->yminusx);
+ fe_0(h->xy2d);
+}
diff --git a/plugin/auth_ed25519/ref10/ge_scalarmult_base.c b/plugin/auth_ed25519/ref10/ge_scalarmult_base.c
new file mode 100644
index 00000000000..421e4fa0fba
--- /dev/null
+++ b/plugin/auth_ed25519/ref10/ge_scalarmult_base.c
@@ -0,0 +1,105 @@
+#include "ge.h"
+#include "crypto_uint32.h"
+
+static unsigned char equal(signed char b,signed char c)
+{
+ unsigned char ub = b;
+ unsigned char uc = c;
+ unsigned char x = ub ^ uc; /* 0: yes; 1..255: no */
+ crypto_uint32 y = x; /* 0: yes; 1..255: no */
+ y -= 1; /* 4294967295: yes; 0..254: no */
+ y >>= 31; /* 1: yes; 0: no */
+ return y;
+}
+
+static unsigned char negative(signed char b)
+{
+ unsigned long long x = b; /* 18446744073709551361..18446744073709551615: yes; 0..255: no */
+ x >>= 63; /* 1: yes; 0: no */
+ return x;
+}
+
+static void cmov(ge_precomp *t,ge_precomp *u,unsigned char b)
+{
+ fe_cmov(t->yplusx,u->yplusx,b);
+ fe_cmov(t->yminusx,u->yminusx,b);
+ fe_cmov(t->xy2d,u->xy2d,b);
+}
+
+/* base[i][j] = (j+1)*256^i*B */
+static ge_precomp base[32][8] = {
+#include "base.h"
+} ;
+
+static void select(ge_precomp *t,int pos,signed char b)
+{
+ ge_precomp minust;
+ unsigned char bnegative = negative(b);
+ unsigned char babs = b - (((-bnegative) & b) << 1);
+
+ ge_precomp_0(t);
+ cmov(t,&base[pos][0],equal(babs,1));
+ cmov(t,&base[pos][1],equal(babs,2));
+ cmov(t,&base[pos][2],equal(babs,3));
+ cmov(t,&base[pos][3],equal(babs,4));
+ cmov(t,&base[pos][4],equal(babs,5));
+ cmov(t,&base[pos][5],equal(babs,6));
+ cmov(t,&base[pos][6],equal(babs,7));
+ cmov(t,&base[pos][7],equal(babs,8));
+ fe_copy(minust.yplusx,t->yminusx);
+ fe_copy(minust.yminusx,t->yplusx);
+ fe_neg(minust.xy2d,t->xy2d);
+ cmov(t,&minust,bnegative);
+}
+
+/*
+h = a * B
+where a = a[0]+256*a[1]+...+256^31 a[31]
+B is the Ed25519 base point (x,4/5) with x positive.
+
+Preconditions:
+ a[31] <= 127
+*/
+
+void ge_scalarmult_base(ge_p3 *h,const unsigned char *a)
+{
+ signed char e[64];
+ signed char carry;
+ ge_p1p1 r;
+ ge_p2 s;
+ ge_precomp t;
+ int i;
+
+ for (i = 0;i < 32;++i) {
+ e[2 * i + 0] = (a[i] >> 0) & 15;
+ e[2 * i + 1] = (a[i] >> 4) & 15;
+ }
+ /* each e[i] is between 0 and 15 */
+ /* e[63] is between 0 and 7 */
+
+ carry = 0;
+ for (i = 0;i < 63;++i) {
+ e[i] += carry;
+ carry = e[i] + 8;
+ carry >>= 4;
+ e[i] -= carry << 4;
+ }
+ e[63] += carry;
+ /* each e[i] is between -8 and 8 */
+
+ ge_p3_0(h);
+ for (i = 1;i < 64;i += 2) {
+ select(&t,i / 2,e[i]);
+ ge_madd(&r,h,&t); ge_p1p1_to_p3(h,&r);
+ }
+
+ ge_p3_dbl(&r,h); ge_p1p1_to_p2(&s,&r);
+ ge_p2_dbl(&r,&s); ge_p1p1_to_p2(&s,&r);
+ ge_p2_dbl(&r,&s); ge_p1p1_to_p2(&s,&r);
+ ge_p2_dbl(&r,&s); ge_p1p1_to_p3(h,&r);
+
+ for (i = 0;i < 64;i += 2) {
+ select(&t,i / 2,e[i]);
+ ge_madd(&r,h,&t); ge_p1p1_to_p3(h,&r);
+ }
+}
diff --git a/plugin/auth_ed25519/ref10/ge_sub.c b/plugin/auth_ed25519/ref10/ge_sub.c
new file mode 100644
index 00000000000..69f3d54062f
--- /dev/null
+++ b/plugin/auth_ed25519/ref10/ge_sub.c
@@ -0,0 +1,11 @@
+#include "ge.h"
+
+/*
+r = p - q
+*/
+
+void ge_sub(ge_p1p1 *r,const ge_p3 *p,const ge_cached *q)
+{
+ fe t0;
+#include "ge_sub.h"
+}
diff --git a/plugin/auth_ed25519/ref10/ge_sub.h b/plugin/auth_ed25519/ref10/ge_sub.h
new file mode 100644
index 00000000000..b4ef1f5dd04
--- /dev/null
+++ b/plugin/auth_ed25519/ref10/ge_sub.h
@@ -0,0 +1,97 @@
+
+/* qhasm: enter ge_sub */
+
+/* qhasm: fe X1 */
+
+/* qhasm: fe Y1 */
+
+/* qhasm: fe Z1 */
+
+/* qhasm: fe Z2 */
+
+/* qhasm: fe T1 */
+
+/* qhasm: fe ZZ */
+
+/* qhasm: fe YpX2 */
+
+/* qhasm: fe YmX2 */
+
+/* qhasm: fe T2d2 */
+
+/* qhasm: fe X3 */
+
+/* qhasm: fe Y3 */
+
+/* qhasm: fe Z3 */
+
+/* qhasm: fe T3 */
+
+/* qhasm: fe YpX1 */
+
+/* qhasm: fe YmX1 */
+
+/* qhasm: fe A */
+
+/* qhasm: fe B */
+
+/* qhasm: fe C */
+
+/* qhasm: fe D */
+
+/* qhasm: YpX1 = Y1+X1 */
+/* asm 1: fe_add(>YpX1=fe#1,<Y1=fe#12,<X1=fe#11); */
+/* asm 2: fe_add(>YpX1=r->X,<Y1=p->Y,<X1=p->X); */
+fe_add(r->X,p->Y,p->X);
+
+/* qhasm: YmX1 = Y1-X1 */
+/* asm 1: fe_sub(>YmX1=fe#2,<Y1=fe#12,<X1=fe#11); */
+/* asm 2: fe_sub(>YmX1=r->Y,<Y1=p->Y,<X1=p->X); */
+fe_sub(r->Y,p->Y,p->X);
+
+/* qhasm: A = YpX1*YmX2 */
+/* asm 1: fe_mul(>A=fe#3,<YpX1=fe#1,<YmX2=fe#16); */
+/* asm 2: fe_mul(>A=r->Z,<YpX1=r->X,<YmX2=q->YminusX); */
+fe_mul(r->Z,r->X,q->YminusX);
+
+/* qhasm: B = YmX1*YpX2 */
+/* asm 1: fe_mul(>B=fe#2,<YmX1=fe#2,<YpX2=fe#15); */
+/* asm 2: fe_mul(>B=r->Y,<YmX1=r->Y,<YpX2=q->YplusX); */
+fe_mul(r->Y,r->Y,q->YplusX);
+
+/* qhasm: C = T2d2*T1 */
+/* asm 1: fe_mul(>C=fe#4,<T2d2=fe#18,<T1=fe#14); */
+/* asm 2: fe_mul(>C=r->T,<T2d2=q->T2d,<T1=p->T); */
+fe_mul(r->T,q->T2d,p->T);
+
+/* qhasm: ZZ = Z1*Z2 */
+/* asm 1: fe_mul(>ZZ=fe#1,<Z1=fe#13,<Z2=fe#17); */
+/* asm 2: fe_mul(>ZZ=r->X,<Z1=p->Z,<Z2=q->Z); */
+fe_mul(r->X,p->Z,q->Z);
+
+/* qhasm: D = 2*ZZ */
+/* asm 1: fe_add(>D=fe#5,<ZZ=fe#1,<ZZ=fe#1); */
+/* asm 2: fe_add(>D=t0,<ZZ=r->X,<ZZ=r->X); */
+fe_add(t0,r->X,r->X);
+
+/* qhasm: X3 = A-B */
+/* asm 1: fe_sub(>X3=fe#1,<A=fe#3,<B=fe#2); */
+/* asm 2: fe_sub(>X3=r->X,<A=r->Z,<B=r->Y); */
+fe_sub(r->X,r->Z,r->Y);
+
+/* qhasm: Y3 = A+B */
+/* asm 1: fe_add(>Y3=fe#2,<A=fe#3,<B=fe#2); */
+/* asm 2: fe_add(>Y3=r->Y,<A=r->Z,<B=r->Y); */
+fe_add(r->Y,r->Z,r->Y);
+
+/* qhasm: Z3 = D-C */
+/* asm 1: fe_sub(>Z3=fe#3,<D=fe#5,<C=fe#4); */
+/* asm 2: fe_sub(>Z3=r->Z,<D=t0,<C=r->T); */
+fe_sub(r->Z,t0,r->T);
+
+/* qhasm: T3 = D+C */
+/* asm 1: fe_add(>T3=fe#4,<D=fe#5,<C=fe#4); */
+/* asm 2: fe_add(>T3=r->T,<D=t0,<C=r->T); */
+fe_add(r->T,t0,r->T);
+
+/* qhasm: return */
diff --git a/plugin/auth_ed25519/ref10/ge_tobytes.c b/plugin/auth_ed25519/ref10/ge_tobytes.c
new file mode 100644
index 00000000000..31b3d33e095
--- /dev/null
+++ b/plugin/auth_ed25519/ref10/ge_tobytes.c
@@ -0,0 +1,14 @@
+#include "ge.h"
+
+void ge_tobytes(unsigned char *s,const ge_p2 *h)
+{
+ fe recip;
+ fe x;
+ fe y;
+
+ fe_invert(recip,h->Z);
+ fe_mul(x,h->X,recip);
+ fe_mul(y,h->Y,recip);
+ fe_tobytes(s,y);
+ s[31] ^= fe_isnegative(x) << 7;
+}
diff --git a/plugin/auth_ed25519/ref10/keypair.c b/plugin/auth_ed25519/ref10/keypair.c
new file mode 100644
index 00000000000..64000838b5e
--- /dev/null
+++ b/plugin/auth_ed25519/ref10/keypair.c
@@ -0,0 +1,23 @@
+#include <string.h>
+#include "crypto_sign.h"
+#include "crypto_hash_sha512.h"
+#include "ge.h"
+
+int crypto_sign_keypair(
+ unsigned char *pk,
+ unsigned char *pw, unsigned long long pwlen
+)
+{
+ unsigned char az[64];
+ ge_p3 A;
+
+ crypto_hash_sha512(az,pw,pwlen);
+ az[0] &= 248;
+ az[31] &= 63;
+ az[31] |= 64;
+
+ ge_scalarmult_base(&A,az);
+ ge_p3_tobytes(pk,&A);
+
+ return 0;
+}
diff --git a/plugin/auth_ed25519/ref10/open.c b/plugin/auth_ed25519/ref10/open.c
new file mode 100644
index 00000000000..7362b681436
--- /dev/null
+++ b/plugin/auth_ed25519/ref10/open.c
@@ -0,0 +1,36 @@
+#include <string.h>
+#include "crypto_sign.h"
+#include "crypto_hash_sha512.h"
+#include "crypto_verify_32.h"
+#include "ge.h"
+#include "sc.h"
+
+int crypto_sign_open(
+ unsigned char *sm, unsigned long long smlen,
+ const unsigned char *pk
+)
+{
+ unsigned char scopy[32];
+ unsigned char h[64];
+ unsigned char rcheck[32];
+ ge_p3 A;
+ ge_p2 R;
+
+ if (smlen < 64) goto badsig;
+ if (sm[63] & 224) goto badsig;
+ if (ge_frombytes_negate_vartime(&A,pk) != 0) goto badsig;
+
+ memmove(scopy,sm + 32,32);
+
+ memmove(sm + 32,pk,32);
+ crypto_hash_sha512(h,sm,smlen);
+ sc_reduce(h);
+
+ ge_double_scalarmult_vartime(&R,h,&A,scopy);
+ ge_tobytes(rcheck,&R);
+ if (crypto_verify_32(rcheck,sm) == 0)
+ return 0;
+
+badsig:
+ return -1;
+}
diff --git a/plugin/auth_ed25519/ref10/pow22523.h b/plugin/auth_ed25519/ref10/pow22523.h
new file mode 100644
index 00000000000..60ffe0d34c8
--- /dev/null
+++ b/plugin/auth_ed25519/ref10/pow22523.h
@@ -0,0 +1,160 @@
+
+/* qhasm: fe z1 */
+
+/* qhasm: fe z2 */
+
+/* qhasm: fe z8 */
+
+/* qhasm: fe z9 */
+
+/* qhasm: fe z11 */
+
+/* qhasm: fe z22 */
+
+/* qhasm: fe z_5_0 */
+
+/* qhasm: fe z_10_5 */
+
+/* qhasm: fe z_10_0 */
+
+/* qhasm: fe z_20_10 */
+
+/* qhasm: fe z_20_0 */
+
+/* qhasm: fe z_40_20 */
+
+/* qhasm: fe z_40_0 */
+
+/* qhasm: fe z_50_10 */
+
+/* qhasm: fe z_50_0 */
+
+/* qhasm: fe z_100_50 */
+
+/* qhasm: fe z_100_0 */
+
+/* qhasm: fe z_200_100 */
+
+/* qhasm: fe z_200_0 */
+
+/* qhasm: fe z_250_50 */
+
+/* qhasm: fe z_250_0 */
+
+/* qhasm: fe z_252_2 */
+
+/* qhasm: fe z_252_3 */
+
+/* qhasm: enter pow22523 */
+
+/* qhasm: z2 = z1^2^1 */
+/* asm 1: fe_sq(>z2=fe#1,<z1=fe#11); for (i = 1;i < 1;++i) fe_sq(>z2=fe#1,>z2=fe#1); */
+/* asm 2: fe_sq(>z2=t0,<z1=z); for (i = 1;i < 1;++i) fe_sq(>z2=t0,>z2=t0); */
+fe_sq(t0,z); for (i = 1;i < 1;++i) fe_sq(t0,t0);
+
+/* qhasm: z8 = z2^2^2 */
+/* asm 1: fe_sq(>z8=fe#2,<z2=fe#1); for (i = 1;i < 2;++i) fe_sq(>z8=fe#2,>z8=fe#2); */
+/* asm 2: fe_sq(>z8=t1,<z2=t0); for (i = 1;i < 2;++i) fe_sq(>z8=t1,>z8=t1); */
+fe_sq(t1,t0); for (i = 1;i < 2;++i) fe_sq(t1,t1);
+
+/* qhasm: z9 = z1*z8 */
+/* asm 1: fe_mul(>z9=fe#2,<z1=fe#11,<z8=fe#2); */
+/* asm 2: fe_mul(>z9=t1,<z1=z,<z8=t1); */
+fe_mul(t1,z,t1);
+
+/* qhasm: z11 = z2*z9 */
+/* asm 1: fe_mul(>z11=fe#1,<z2=fe#1,<z9=fe#2); */
+/* asm 2: fe_mul(>z11=t0,<z2=t0,<z9=t1); */
+fe_mul(t0,t0,t1);
+
+/* qhasm: z22 = z11^2^1 */
+/* asm 1: fe_sq(>z22=fe#1,<z11=fe#1); for (i = 1;i < 1;++i) fe_sq(>z22=fe#1,>z22=fe#1); */
+/* asm 2: fe_sq(>z22=t0,<z11=t0); for (i = 1;i < 1;++i) fe_sq(>z22=t0,>z22=t0); */
+fe_sq(t0,t0); for (i = 1;i < 1;++i) fe_sq(t0,t0);
+
+/* qhasm: z_5_0 = z9*z22 */
+/* asm 1: fe_mul(>z_5_0=fe#1,<z9=fe#2,<z22=fe#1); */
+/* asm 2: fe_mul(>z_5_0=t0,<z9=t1,<z22=t0); */
+fe_mul(t0,t1,t0);
+
+/* qhasm: z_10_5 = z_5_0^2^5 */
+/* asm 1: fe_sq(>z_10_5=fe#2,<z_5_0=fe#1); for (i = 1;i < 5;++i) fe_sq(>z_10_5=fe#2,>z_10_5=fe#2); */
+/* asm 2: fe_sq(>z_10_5=t1,<z_5_0=t0); for (i = 1;i < 5;++i) fe_sq(>z_10_5=t1,>z_10_5=t1); */
+fe_sq(t1,t0); for (i = 1;i < 5;++i) fe_sq(t1,t1);
+
+/* qhasm: z_10_0 = z_10_5*z_5_0 */
+/* asm 1: fe_mul(>z_10_0=fe#1,<z_10_5=fe#2,<z_5_0=fe#1); */
+/* asm 2: fe_mul(>z_10_0=t0,<z_10_5=t1,<z_5_0=t0); */
+fe_mul(t0,t1,t0);
+
+/* qhasm: z_20_10 = z_10_0^2^10 */
+/* asm 1: fe_sq(>z_20_10=fe#2,<z_10_0=fe#1); for (i = 1;i < 10;++i) fe_sq(>z_20_10=fe#2,>z_20_10=fe#2); */
+/* asm 2: fe_sq(>z_20_10=t1,<z_10_0=t0); for (i = 1;i < 10;++i) fe_sq(>z_20_10=t1,>z_20_10=t1); */
+fe_sq(t1,t0); for (i = 1;i < 10;++i) fe_sq(t1,t1);
+
+/* qhasm: z_20_0 = z_20_10*z_10_0 */
+/* asm 1: fe_mul(>z_20_0=fe#2,<z_20_10=fe#2,<z_10_0=fe#1); */
+/* asm 2: fe_mul(>z_20_0=t1,<z_20_10=t1,<z_10_0=t0); */
+fe_mul(t1,t1,t0);
+
+/* qhasm: z_40_20 = z_20_0^2^20 */
+/* asm 1: fe_sq(>z_40_20=fe#3,<z_20_0=fe#2); for (i = 1;i < 20;++i) fe_sq(>z_40_20=fe#3,>z_40_20=fe#3); */
+/* asm 2: fe_sq(>z_40_20=t2,<z_20_0=t1); for (i = 1;i < 20;++i) fe_sq(>z_40_20=t2,>z_40_20=t2); */
+fe_sq(t2,t1); for (i = 1;i < 20;++i) fe_sq(t2,t2);
+
+/* qhasm: z_40_0 = z_40_20*z_20_0 */
+/* asm 1: fe_mul(>z_40_0=fe#2,<z_40_20=fe#3,<z_20_0=fe#2); */
+/* asm 2: fe_mul(>z_40_0=t1,<z_40_20=t2,<z_20_0=t1); */
+fe_mul(t1,t2,t1);
+
+/* qhasm: z_50_10 = z_40_0^2^10 */
+/* asm 1: fe_sq(>z_50_10=fe#2,<z_40_0=fe#2); for (i = 1;i < 10;++i) fe_sq(>z_50_10=fe#2,>z_50_10=fe#2); */
+/* asm 2: fe_sq(>z_50_10=t1,<z_40_0=t1); for (i = 1;i < 10;++i) fe_sq(>z_50_10=t1,>z_50_10=t1); */
+fe_sq(t1,t1); for (i = 1;i < 10;++i) fe_sq(t1,t1);
+
+/* qhasm: z_50_0 = z_50_10*z_10_0 */
+/* asm 1: fe_mul(>z_50_0=fe#1,<z_50_10=fe#2,<z_10_0=fe#1); */
+/* asm 2: fe_mul(>z_50_0=t0,<z_50_10=t1,<z_10_0=t0); */
+fe_mul(t0,t1,t0);
+
+/* qhasm: z_100_50 = z_50_0^2^50 */
+/* asm 1: fe_sq(>z_100_50=fe#2,<z_50_0=fe#1); for (i = 1;i < 50;++i) fe_sq(>z_100_50=fe#2,>z_100_50=fe#2); */
+/* asm 2: fe_sq(>z_100_50=t1,<z_50_0=t0); for (i = 1;i < 50;++i) fe_sq(>z_100_50=t1,>z_100_50=t1); */
+fe_sq(t1,t0); for (i = 1;i < 50;++i) fe_sq(t1,t1);
+
+/* qhasm: z_100_0 = z_100_50*z_50_0 */
+/* asm 1: fe_mul(>z_100_0=fe#2,<z_100_50=fe#2,<z_50_0=fe#1); */
+/* asm 2: fe_mul(>z_100_0=t1,<z_100_50=t1,<z_50_0=t0); */
+fe_mul(t1,t1,t0);
+
+/* qhasm: z_200_100 = z_100_0^2^100 */
+/* asm 1: fe_sq(>z_200_100=fe#3,<z_100_0=fe#2); for (i = 1;i < 100;++i) fe_sq(>z_200_100=fe#3,>z_200_100=fe#3); */
+/* asm 2: fe_sq(>z_200_100=t2,<z_100_0=t1); for (i = 1;i < 100;++i) fe_sq(>z_200_100=t2,>z_200_100=t2); */
+fe_sq(t2,t1); for (i = 1;i < 100;++i) fe_sq(t2,t2);
+
+/* qhasm: z_200_0 = z_200_100*z_100_0 */
+/* asm 1: fe_mul(>z_200_0=fe#2,<z_200_100=fe#3,<z_100_0=fe#2); */
+/* asm 2: fe_mul(>z_200_0=t1,<z_200_100=t2,<z_100_0=t1); */
+fe_mul(t1,t2,t1);
+
+/* qhasm: z_250_50 = z_200_0^2^50 */
+/* asm 1: fe_sq(>z_250_50=fe#2,<z_200_0=fe#2); for (i = 1;i < 50;++i) fe_sq(>z_250_50=fe#2,>z_250_50=fe#2); */
+/* asm 2: fe_sq(>z_250_50=t1,<z_200_0=t1); for (i = 1;i < 50;++i) fe_sq(>z_250_50=t1,>z_250_50=t1); */
+fe_sq(t1,t1); for (i = 1;i < 50;++i) fe_sq(t1,t1);
+
+/* qhasm: z_250_0 = z_250_50*z_50_0 */
+/* asm 1: fe_mul(>z_250_0=fe#1,<z_250_50=fe#2,<z_50_0=fe#1); */
+/* asm 2: fe_mul(>z_250_0=t0,<z_250_50=t1,<z_50_0=t0); */
+fe_mul(t0,t1,t0);
+
+/* qhasm: z_252_2 = z_250_0^2^2 */
+/* asm 1: fe_sq(>z_252_2=fe#1,<z_250_0=fe#1); for (i = 1;i < 2;++i) fe_sq(>z_252_2=fe#1,>z_252_2=fe#1); */
+/* asm 2: fe_sq(>z_252_2=t0,<z_250_0=t0); for (i = 1;i < 2;++i) fe_sq(>z_252_2=t0,>z_252_2=t0); */
+fe_sq(t0,t0); for (i = 1;i < 2;++i) fe_sq(t0,t0);
+
+/* qhasm: z_252_3 = z_252_2*z1 */
+/* asm 1: fe_mul(>z_252_3=fe#12,<z_252_2=fe#1,<z1=fe#11); */
+/* asm 2: fe_mul(>z_252_3=out,<z_252_2=t0,<z1=z); */
+fe_mul(out,t0,z);
+
+/* qhasm: return */
diff --git a/plugin/auth_ed25519/ref10/pow225521.h b/plugin/auth_ed25519/ref10/pow225521.h
new file mode 100644
index 00000000000..109df779a2d
--- /dev/null
+++ b/plugin/auth_ed25519/ref10/pow225521.h
@@ -0,0 +1,160 @@
+
+/* qhasm: fe z1 */
+
+/* qhasm: fe z2 */
+
+/* qhasm: fe z8 */
+
+/* qhasm: fe z9 */
+
+/* qhasm: fe z11 */
+
+/* qhasm: fe z22 */
+
+/* qhasm: fe z_5_0 */
+
+/* qhasm: fe z_10_5 */
+
+/* qhasm: fe z_10_0 */
+
+/* qhasm: fe z_20_10 */
+
+/* qhasm: fe z_20_0 */
+
+/* qhasm: fe z_40_20 */
+
+/* qhasm: fe z_40_0 */
+
+/* qhasm: fe z_50_10 */
+
+/* qhasm: fe z_50_0 */
+
+/* qhasm: fe z_100_50 */
+
+/* qhasm: fe z_100_0 */
+
+/* qhasm: fe z_200_100 */
+
+/* qhasm: fe z_200_0 */
+
+/* qhasm: fe z_250_50 */
+
+/* qhasm: fe z_250_0 */
+
+/* qhasm: fe z_255_5 */
+
+/* qhasm: fe z_255_21 */
+
+/* qhasm: enter pow225521 */
+
+/* qhasm: z2 = z1^2^1 */
+/* asm 1: fe_sq(>z2=fe#1,<z1=fe#11); for (i = 1;i < 1;++i) fe_sq(>z2=fe#1,>z2=fe#1); */
+/* asm 2: fe_sq(>z2=t0,<z1=z); for (i = 1;i < 1;++i) fe_sq(>z2=t0,>z2=t0); */
+fe_sq(t0,z); for (i = 1;i < 1;++i) fe_sq(t0,t0);
+
+/* qhasm: z8 = z2^2^2 */
+/* asm 1: fe_sq(>z8=fe#2,<z2=fe#1); for (i = 1;i < 2;++i) fe_sq(>z8=fe#2,>z8=fe#2); */
+/* asm 2: fe_sq(>z8=t1,<z2=t0); for (i = 1;i < 2;++i) fe_sq(>z8=t1,>z8=t1); */
+fe_sq(t1,t0); for (i = 1;i < 2;++i) fe_sq(t1,t1);
+
+/* qhasm: z9 = z1*z8 */
+/* asm 1: fe_mul(>z9=fe#2,<z1=fe#11,<z8=fe#2); */
+/* asm 2: fe_mul(>z9=t1,<z1=z,<z8=t1); */
+fe_mul(t1,z,t1);
+
+/* qhasm: z11 = z2*z9 */
+/* asm 1: fe_mul(>z11=fe#1,<z2=fe#1,<z9=fe#2); */
+/* asm 2: fe_mul(>z11=t0,<z2=t0,<z9=t1); */
+fe_mul(t0,t0,t1);
+
+/* qhasm: z22 = z11^2^1 */
+/* asm 1: fe_sq(>z22=fe#3,<z11=fe#1); for (i = 1;i < 1;++i) fe_sq(>z22=fe#3,>z22=fe#3); */
+/* asm 2: fe_sq(>z22=t2,<z11=t0); for (i = 1;i < 1;++i) fe_sq(>z22=t2,>z22=t2); */
+fe_sq(t2,t0); for (i = 1;i < 1;++i) fe_sq(t2,t2);
+
+/* qhasm: z_5_0 = z9*z22 */
+/* asm 1: fe_mul(>z_5_0=fe#2,<z9=fe#2,<z22=fe#3); */
+/* asm 2: fe_mul(>z_5_0=t1,<z9=t1,<z22=t2); */
+fe_mul(t1,t1,t2);
+
+/* qhasm: z_10_5 = z_5_0^2^5 */
+/* asm 1: fe_sq(>z_10_5=fe#3,<z_5_0=fe#2); for (i = 1;i < 5;++i) fe_sq(>z_10_5=fe#3,>z_10_5=fe#3); */
+/* asm 2: fe_sq(>z_10_5=t2,<z_5_0=t1); for (i = 1;i < 5;++i) fe_sq(>z_10_5=t2,>z_10_5=t2); */
+fe_sq(t2,t1); for (i = 1;i < 5;++i) fe_sq(t2,t2);
+
+/* qhasm: z_10_0 = z_10_5*z_5_0 */
+/* asm 1: fe_mul(>z_10_0=fe#2,<z_10_5=fe#3,<z_5_0=fe#2); */
+/* asm 2: fe_mul(>z_10_0=t1,<z_10_5=t2,<z_5_0=t1); */
+fe_mul(t1,t2,t1);
+
+/* qhasm: z_20_10 = z_10_0^2^10 */
+/* asm 1: fe_sq(>z_20_10=fe#3,<z_10_0=fe#2); for (i = 1;i < 10;++i) fe_sq(>z_20_10=fe#3,>z_20_10=fe#3); */
+/* asm 2: fe_sq(>z_20_10=t2,<z_10_0=t1); for (i = 1;i < 10;++i) fe_sq(>z_20_10=t2,>z_20_10=t2); */
+fe_sq(t2,t1); for (i = 1;i < 10;++i) fe_sq(t2,t2);
+
+/* qhasm: z_20_0 = z_20_10*z_10_0 */
+/* asm 1: fe_mul(>z_20_0=fe#3,<z_20_10=fe#3,<z_10_0=fe#2); */
+/* asm 2: fe_mul(>z_20_0=t2,<z_20_10=t2,<z_10_0=t1); */
+fe_mul(t2,t2,t1);
+
+/* qhasm: z_40_20 = z_20_0^2^20 */
+/* asm 1: fe_sq(>z_40_20=fe#4,<z_20_0=fe#3); for (i = 1;i < 20;++i) fe_sq(>z_40_20=fe#4,>z_40_20=fe#4); */
+/* asm 2: fe_sq(>z_40_20=t3,<z_20_0=t2); for (i = 1;i < 20;++i) fe_sq(>z_40_20=t3,>z_40_20=t3); */
+fe_sq(t3,t2); for (i = 1;i < 20;++i) fe_sq(t3,t3);
+
+/* qhasm: z_40_0 = z_40_20*z_20_0 */
+/* asm 1: fe_mul(>z_40_0=fe#3,<z_40_20=fe#4,<z_20_0=fe#3); */
+/* asm 2: fe_mul(>z_40_0=t2,<z_40_20=t3,<z_20_0=t2); */
+fe_mul(t2,t3,t2);
+
+/* qhasm: z_50_10 = z_40_0^2^10 */
+/* asm 1: fe_sq(>z_50_10=fe#3,<z_40_0=fe#3); for (i = 1;i < 10;++i) fe_sq(>z_50_10=fe#3,>z_50_10=fe#3); */
+/* asm 2: fe_sq(>z_50_10=t2,<z_40_0=t2); for (i = 1;i < 10;++i) fe_sq(>z_50_10=t2,>z_50_10=t2); */
+fe_sq(t2,t2); for (i = 1;i < 10;++i) fe_sq(t2,t2);
+
+/* qhasm: z_50_0 = z_50_10*z_10_0 */
+/* asm 1: fe_mul(>z_50_0=fe#2,<z_50_10=fe#3,<z_10_0=fe#2); */
+/* asm 2: fe_mul(>z_50_0=t1,<z_50_10=t2,<z_10_0=t1); */
+fe_mul(t1,t2,t1);
+
+/* qhasm: z_100_50 = z_50_0^2^50 */
+/* asm 1: fe_sq(>z_100_50=fe#3,<z_50_0=fe#2); for (i = 1;i < 50;++i) fe_sq(>z_100_50=fe#3,>z_100_50=fe#3); */
+/* asm 2: fe_sq(>z_100_50=t2,<z_50_0=t1); for (i = 1;i < 50;++i) fe_sq(>z_100_50=t2,>z_100_50=t2); */
+fe_sq(t2,t1); for (i = 1;i < 50;++i) fe_sq(t2,t2);
+
+/* qhasm: z_100_0 = z_100_50*z_50_0 */
+/* asm 1: fe_mul(>z_100_0=fe#3,<z_100_50=fe#3,<z_50_0=fe#2); */
+/* asm 2: fe_mul(>z_100_0=t2,<z_100_50=t2,<z_50_0=t1); */
+fe_mul(t2,t2,t1);
+
+/* qhasm: z_200_100 = z_100_0^2^100 */
+/* asm 1: fe_sq(>z_200_100=fe#4,<z_100_0=fe#3); for (i = 1;i < 100;++i) fe_sq(>z_200_100=fe#4,>z_200_100=fe#4); */
+/* asm 2: fe_sq(>z_200_100=t3,<z_100_0=t2); for (i = 1;i < 100;++i) fe_sq(>z_200_100=t3,>z_200_100=t3); */
+fe_sq(t3,t2); for (i = 1;i < 100;++i) fe_sq(t3,t3);
+
+/* qhasm: z_200_0 = z_200_100*z_100_0 */
+/* asm 1: fe_mul(>z_200_0=fe#3,<z_200_100=fe#4,<z_100_0=fe#3); */
+/* asm 2: fe_mul(>z_200_0=t2,<z_200_100=t3,<z_100_0=t2); */
+fe_mul(t2,t3,t2);
+
+/* qhasm: z_250_50 = z_200_0^2^50 */
+/* asm 1: fe_sq(>z_250_50=fe#3,<z_200_0=fe#3); for (i = 1;i < 50;++i) fe_sq(>z_250_50=fe#3,>z_250_50=fe#3); */
+/* asm 2: fe_sq(>z_250_50=t2,<z_200_0=t2); for (i = 1;i < 50;++i) fe_sq(>z_250_50=t2,>z_250_50=t2); */
+fe_sq(t2,t2); for (i = 1;i < 50;++i) fe_sq(t2,t2);
+
+/* qhasm: z_250_0 = z_250_50*z_50_0 */
+/* asm 1: fe_mul(>z_250_0=fe#2,<z_250_50=fe#3,<z_50_0=fe#2); */
+/* asm 2: fe_mul(>z_250_0=t1,<z_250_50=t2,<z_50_0=t1); */
+fe_mul(t1,t2,t1);
+
+/* qhasm: z_255_5 = z_250_0^2^5 */
+/* asm 1: fe_sq(>z_255_5=fe#2,<z_250_0=fe#2); for (i = 1;i < 5;++i) fe_sq(>z_255_5=fe#2,>z_255_5=fe#2); */
+/* asm 2: fe_sq(>z_255_5=t1,<z_250_0=t1); for (i = 1;i < 5;++i) fe_sq(>z_255_5=t1,>z_255_5=t1); */
+fe_sq(t1,t1); for (i = 1;i < 5;++i) fe_sq(t1,t1);
+
+/* qhasm: z_255_21 = z_255_5*z11 */
+/* asm 1: fe_mul(>z_255_21=fe#12,<z_255_5=fe#2,<z11=fe#1); */
+/* asm 2: fe_mul(>z_255_21=out,<z_255_5=t1,<z11=t0); */
+fe_mul(out,t1,t0);
+
+/* qhasm: return */
diff --git a/plugin/auth_ed25519/ref10/sc.h b/plugin/auth_ed25519/ref10/sc.h
new file mode 100644
index 00000000000..d32ed2e8ca8
--- /dev/null
+++ b/plugin/auth_ed25519/ref10/sc.h
@@ -0,0 +1,15 @@
+#ifndef SC_H
+#define SC_H
+
+/*
+The set of scalars is \Z/l
+where l = 2^252 + 27742317777372353535851937790883648493.
+*/
+
+#define sc_reduce crypto_sign_ed25519_ref10_sc_reduce
+#define sc_muladd crypto_sign_ed25519_ref10_sc_muladd
+
+extern void sc_reduce(unsigned char *);
+extern void sc_muladd(unsigned char *,const unsigned char *,const unsigned char *,const unsigned char *);
+
+#endif
diff --git a/plugin/auth_ed25519/ref10/sc_muladd.c b/plugin/auth_ed25519/ref10/sc_muladd.c
new file mode 100644
index 00000000000..6f1e9d02d60
--- /dev/null
+++ b/plugin/auth_ed25519/ref10/sc_muladd.c
@@ -0,0 +1,368 @@
+#include "sc.h"
+#include "crypto_int64.h"
+#include "crypto_uint32.h"
+#include "crypto_uint64.h"
+
+static crypto_uint64 load_3(const unsigned char *in)
+{
+ crypto_uint64 result;
+ result = (crypto_uint64) in[0];
+ result |= ((crypto_uint64) in[1]) << 8;
+ result |= ((crypto_uint64) in[2]) << 16;
+ return result;
+}
+
+static crypto_uint64 load_4(const unsigned char *in)
+{
+ crypto_uint64 result;
+ result = (crypto_uint64) in[0];
+ result |= ((crypto_uint64) in[1]) << 8;
+ result |= ((crypto_uint64) in[2]) << 16;
+ result |= ((crypto_uint64) in[3]) << 24;
+ return result;
+}
+
+/*
+Input:
+ a[0]+256*a[1]+...+256^31*a[31] = a
+ b[0]+256*b[1]+...+256^31*b[31] = b
+ c[0]+256*c[1]+...+256^31*c[31] = c
+
+Output:
+ s[0]+256*s[1]+...+256^31*s[31] = (ab+c) mod l
+ where l = 2^252 + 27742317777372353535851937790883648493.
+*/
+
+void sc_muladd(unsigned char *s,const unsigned char *a,const unsigned char *b,const unsigned char *c)
+{
+ crypto_int64 a0 = 2097151 & load_3(a);
+ crypto_int64 a1 = 2097151 & (load_4(a + 2) >> 5);
+ crypto_int64 a2 = 2097151 & (load_3(a + 5) >> 2);
+ crypto_int64 a3 = 2097151 & (load_4(a + 7) >> 7);
+ crypto_int64 a4 = 2097151 & (load_4(a + 10) >> 4);
+ crypto_int64 a5 = 2097151 & (load_3(a + 13) >> 1);
+ crypto_int64 a6 = 2097151 & (load_4(a + 15) >> 6);
+ crypto_int64 a7 = 2097151 & (load_3(a + 18) >> 3);
+ crypto_int64 a8 = 2097151 & load_3(a + 21);
+ crypto_int64 a9 = 2097151 & (load_4(a + 23) >> 5);
+ crypto_int64 a10 = 2097151 & (load_3(a + 26) >> 2);
+ crypto_int64 a11 = (load_4(a + 28) >> 7);
+ crypto_int64 b0 = 2097151 & load_3(b);
+ crypto_int64 b1 = 2097151 & (load_4(b + 2) >> 5);
+ crypto_int64 b2 = 2097151 & (load_3(b + 5) >> 2);
+ crypto_int64 b3 = 2097151 & (load_4(b + 7) >> 7);
+ crypto_int64 b4 = 2097151 & (load_4(b + 10) >> 4);
+ crypto_int64 b5 = 2097151 & (load_3(b + 13) >> 1);
+ crypto_int64 b6 = 2097151 & (load_4(b + 15) >> 6);
+ crypto_int64 b7 = 2097151 & (load_3(b + 18) >> 3);
+ crypto_int64 b8 = 2097151 & load_3(b + 21);
+ crypto_int64 b9 = 2097151 & (load_4(b + 23) >> 5);
+ crypto_int64 b10 = 2097151 & (load_3(b + 26) >> 2);
+ crypto_int64 b11 = (load_4(b + 28) >> 7);
+ crypto_int64 c0 = 2097151 & load_3(c);
+ crypto_int64 c1 = 2097151 & (load_4(c + 2) >> 5);
+ crypto_int64 c2 = 2097151 & (load_3(c + 5) >> 2);
+ crypto_int64 c3 = 2097151 & (load_4(c + 7) >> 7);
+ crypto_int64 c4 = 2097151 & (load_4(c + 10) >> 4);
+ crypto_int64 c5 = 2097151 & (load_3(c + 13) >> 1);
+ crypto_int64 c6 = 2097151 & (load_4(c + 15) >> 6);
+ crypto_int64 c7 = 2097151 & (load_3(c + 18) >> 3);
+ crypto_int64 c8 = 2097151 & load_3(c + 21);
+ crypto_int64 c9 = 2097151 & (load_4(c + 23) >> 5);
+ crypto_int64 c10 = 2097151 & (load_3(c + 26) >> 2);
+ crypto_int64 c11 = (load_4(c + 28) >> 7);
+ crypto_int64 s0;
+ crypto_int64 s1;
+ crypto_int64 s2;
+ crypto_int64 s3;
+ crypto_int64 s4;
+ crypto_int64 s5;
+ crypto_int64 s6;
+ crypto_int64 s7;
+ crypto_int64 s8;
+ crypto_int64 s9;
+ crypto_int64 s10;
+ crypto_int64 s11;
+ crypto_int64 s12;
+ crypto_int64 s13;
+ crypto_int64 s14;
+ crypto_int64 s15;
+ crypto_int64 s16;
+ crypto_int64 s17;
+ crypto_int64 s18;
+ crypto_int64 s19;
+ crypto_int64 s20;
+ crypto_int64 s21;
+ crypto_int64 s22;
+ crypto_int64 s23;
+ crypto_int64 carry0;
+ crypto_int64 carry1;
+ crypto_int64 carry2;
+ crypto_int64 carry3;
+ crypto_int64 carry4;
+ crypto_int64 carry5;
+ crypto_int64 carry6;
+ crypto_int64 carry7;
+ crypto_int64 carry8;
+ crypto_int64 carry9;
+ crypto_int64 carry10;
+ crypto_int64 carry11;
+ crypto_int64 carry12;
+ crypto_int64 carry13;
+ crypto_int64 carry14;
+ crypto_int64 carry15;
+ crypto_int64 carry16;
+ crypto_int64 carry17;
+ crypto_int64 carry18;
+ crypto_int64 carry19;
+ crypto_int64 carry20;
+ crypto_int64 carry21;
+ crypto_int64 carry22;
+
+ s0 = c0 + a0*b0;
+ s1 = c1 + a0*b1 + a1*b0;
+ s2 = c2 + a0*b2 + a1*b1 + a2*b0;
+ s3 = c3 + a0*b3 + a1*b2 + a2*b1 + a3*b0;
+ s4 = c4 + a0*b4 + a1*b3 + a2*b2 + a3*b1 + a4*b0;
+ s5 = c5 + a0*b5 + a1*b4 + a2*b3 + a3*b2 + a4*b1 + a5*b0;
+ s6 = c6 + a0*b6 + a1*b5 + a2*b4 + a3*b3 + a4*b2 + a5*b1 + a6*b0;
+ s7 = c7 + a0*b7 + a1*b6 + a2*b5 + a3*b4 + a4*b3 + a5*b2 + a6*b1 + a7*b0;
+ s8 = c8 + a0*b8 + a1*b7 + a2*b6 + a3*b5 + a4*b4 + a5*b3 + a6*b2 + a7*b1 + a8*b0;
+ s9 = c9 + a0*b9 + a1*b8 + a2*b7 + a3*b6 + a4*b5 + a5*b4 + a6*b3 + a7*b2 + a8*b1 + a9*b0;
+ s10 = c10 + a0*b10 + a1*b9 + a2*b8 + a3*b7 + a4*b6 + a5*b5 + a6*b4 + a7*b3 + a8*b2 + a9*b1 + a10*b0;
+ s11 = c11 + a0*b11 + a1*b10 + a2*b9 + a3*b8 + a4*b7 + a5*b6 + a6*b5 + a7*b4 + a8*b3 + a9*b2 + a10*b1 + a11*b0;
+ s12 = a1*b11 + a2*b10 + a3*b9 + a4*b8 + a5*b7 + a6*b6 + a7*b5 + a8*b4 + a9*b3 + a10*b2 + a11*b1;
+ s13 = a2*b11 + a3*b10 + a4*b9 + a5*b8 + a6*b7 + a7*b6 + a8*b5 + a9*b4 + a10*b3 + a11*b2;
+ s14 = a3*b11 + a4*b10 + a5*b9 + a6*b8 + a7*b7 + a8*b6 + a9*b5 + a10*b4 + a11*b3;
+ s15 = a4*b11 + a5*b10 + a6*b9 + a7*b8 + a8*b7 + a9*b6 + a10*b5 + a11*b4;
+ s16 = a5*b11 + a6*b10 + a7*b9 + a8*b8 + a9*b7 + a10*b6 + a11*b5;
+ s17 = a6*b11 + a7*b10 + a8*b9 + a9*b8 + a10*b7 + a11*b6;
+ s18 = a7*b11 + a8*b10 + a9*b9 + a10*b8 + a11*b7;
+ s19 = a8*b11 + a9*b10 + a10*b9 + a11*b8;
+ s20 = a9*b11 + a10*b10 + a11*b9;
+ s21 = a10*b11 + a11*b10;
+ s22 = a11*b11;
+ s23 = 0;
+
+ carry0 = (s0 + (1<<20)) >> 21; s1 += carry0; s0 -= carry0 << 21;
+ carry2 = (s2 + (1<<20)) >> 21; s3 += carry2; s2 -= carry2 << 21;
+ carry4 = (s4 + (1<<20)) >> 21; s5 += carry4; s4 -= carry4 << 21;
+ carry6 = (s6 + (1<<20)) >> 21; s7 += carry6; s6 -= carry6 << 21;
+ carry8 = (s8 + (1<<20)) >> 21; s9 += carry8; s8 -= carry8 << 21;
+ carry10 = (s10 + (1<<20)) >> 21; s11 += carry10; s10 -= carry10 << 21;
+ carry12 = (s12 + (1<<20)) >> 21; s13 += carry12; s12 -= carry12 << 21;
+ carry14 = (s14 + (1<<20)) >> 21; s15 += carry14; s14 -= carry14 << 21;
+ carry16 = (s16 + (1<<20)) >> 21; s17 += carry16; s16 -= carry16 << 21;
+ carry18 = (s18 + (1<<20)) >> 21; s19 += carry18; s18 -= carry18 << 21;
+ carry20 = (s20 + (1<<20)) >> 21; s21 += carry20; s20 -= carry20 << 21;
+ carry22 = (s22 + (1<<20)) >> 21; s23 += carry22; s22 -= carry22 << 21;
+
+ carry1 = (s1 + (1<<20)) >> 21; s2 += carry1; s1 -= carry1 << 21;
+ carry3 = (s3 + (1<<20)) >> 21; s4 += carry3; s3 -= carry3 << 21;
+ carry5 = (s5 + (1<<20)) >> 21; s6 += carry5; s5 -= carry5 << 21;
+ carry7 = (s7 + (1<<20)) >> 21; s8 += carry7; s7 -= carry7 << 21;
+ carry9 = (s9 + (1<<20)) >> 21; s10 += carry9; s9 -= carry9 << 21;
+ carry11 = (s11 + (1<<20)) >> 21; s12 += carry11; s11 -= carry11 << 21;
+ carry13 = (s13 + (1<<20)) >> 21; s14 += carry13; s13 -= carry13 << 21;
+ carry15 = (s15 + (1<<20)) >> 21; s16 += carry15; s15 -= carry15 << 21;
+ carry17 = (s17 + (1<<20)) >> 21; s18 += carry17; s17 -= carry17 << 21;
+ carry19 = (s19 + (1<<20)) >> 21; s20 += carry19; s19 -= carry19 << 21;
+ carry21 = (s21 + (1<<20)) >> 21; s22 += carry21; s21 -= carry21 << 21;
+
+ s11 += s23 * 666643;
+ s12 += s23 * 470296;
+ s13 += s23 * 654183;
+ s14 -= s23 * 997805;
+ s15 += s23 * 136657;
+ s16 -= s23 * 683901;
+ s23 = 0;
+
+ s10 += s22 * 666643;
+ s11 += s22 * 470296;
+ s12 += s22 * 654183;
+ s13 -= s22 * 997805;
+ s14 += s22 * 136657;
+ s15 -= s22 * 683901;
+ s22 = 0;
+
+ s9 += s21 * 666643;
+ s10 += s21 * 470296;
+ s11 += s21 * 654183;
+ s12 -= s21 * 997805;
+ s13 += s21 * 136657;
+ s14 -= s21 * 683901;
+ s21 = 0;
+
+ s8 += s20 * 666643;
+ s9 += s20 * 470296;
+ s10 += s20 * 654183;
+ s11 -= s20 * 997805;
+ s12 += s20 * 136657;
+ s13 -= s20 * 683901;
+ s20 = 0;
+
+ s7 += s19 * 666643;
+ s8 += s19 * 470296;
+ s9 += s19 * 654183;
+ s10 -= s19 * 997805;
+ s11 += s19 * 136657;
+ s12 -= s19 * 683901;
+ s19 = 0;
+
+ s6 += s18 * 666643;
+ s7 += s18 * 470296;
+ s8 += s18 * 654183;
+ s9 -= s18 * 997805;
+ s10 += s18 * 136657;
+ s11 -= s18 * 683901;
+ s18 = 0;
+
+ carry6 = (s6 + (1<<20)) >> 21; s7 += carry6; s6 -= carry6 << 21;
+ carry8 = (s8 + (1<<20)) >> 21; s9 += carry8; s8 -= carry8 << 21;
+ carry10 = (s10 + (1<<20)) >> 21; s11 += carry10; s10 -= carry10 << 21;
+ carry12 = (s12 + (1<<20)) >> 21; s13 += carry12; s12 -= carry12 << 21;
+ carry14 = (s14 + (1<<20)) >> 21; s15 += carry14; s14 -= carry14 << 21;
+ carry16 = (s16 + (1<<20)) >> 21; s17 += carry16; s16 -= carry16 << 21;
+
+ carry7 = (s7 + (1<<20)) >> 21; s8 += carry7; s7 -= carry7 << 21;
+ carry9 = (s9 + (1<<20)) >> 21; s10 += carry9; s9 -= carry9 << 21;
+ carry11 = (s11 + (1<<20)) >> 21; s12 += carry11; s11 -= carry11 << 21;
+ carry13 = (s13 + (1<<20)) >> 21; s14 += carry13; s13 -= carry13 << 21;
+ carry15 = (s15 + (1<<20)) >> 21; s16 += carry15; s15 -= carry15 << 21;
+
+ s5 += s17 * 666643;
+ s6 += s17 * 470296;
+ s7 += s17 * 654183;
+ s8 -= s17 * 997805;
+ s9 += s17 * 136657;
+ s10 -= s17 * 683901;
+ s17 = 0;
+
+ s4 += s16 * 666643;
+ s5 += s16 * 470296;
+ s6 += s16 * 654183;
+ s7 -= s16 * 997805;
+ s8 += s16 * 136657;
+ s9 -= s16 * 683901;
+ s16 = 0;
+
+ s3 += s15 * 666643;
+ s4 += s15 * 470296;
+ s5 += s15 * 654183;
+ s6 -= s15 * 997805;
+ s7 += s15 * 136657;
+ s8 -= s15 * 683901;
+ s15 = 0;
+
+ s2 += s14 * 666643;
+ s3 += s14 * 470296;
+ s4 += s14 * 654183;
+ s5 -= s14 * 997805;
+ s6 += s14 * 136657;
+ s7 -= s14 * 683901;
+ s14 = 0;
+
+ s1 += s13 * 666643;
+ s2 += s13 * 470296;
+ s3 += s13 * 654183;
+ s4 -= s13 * 997805;
+ s5 += s13 * 136657;
+ s6 -= s13 * 683901;
+ s13 = 0;
+
+ s0 += s12 * 666643;
+ s1 += s12 * 470296;
+ s2 += s12 * 654183;
+ s3 -= s12 * 997805;
+ s4 += s12 * 136657;
+ s5 -= s12 * 683901;
+ s12 = 0;
+
+ carry0 = (s0 + (1<<20)) >> 21; s1 += carry0; s0 -= carry0 << 21;
+ carry2 = (s2 + (1<<20)) >> 21; s3 += carry2; s2 -= carry2 << 21;
+ carry4 = (s4 + (1<<20)) >> 21; s5 += carry4; s4 -= carry4 << 21;
+ carry6 = (s6 + (1<<20)) >> 21; s7 += carry6; s6 -= carry6 << 21;
+ carry8 = (s8 + (1<<20)) >> 21; s9 += carry8; s8 -= carry8 << 21;
+ carry10 = (s10 + (1<<20)) >> 21; s11 += carry10; s10 -= carry10 << 21;
+
+ carry1 = (s1 + (1<<20)) >> 21; s2 += carry1; s1 -= carry1 << 21;
+ carry3 = (s3 + (1<<20)) >> 21; s4 += carry3; s3 -= carry3 << 21;
+ carry5 = (s5 + (1<<20)) >> 21; s6 += carry5; s5 -= carry5 << 21;
+ carry7 = (s7 + (1<<20)) >> 21; s8 += carry7; s7 -= carry7 << 21;
+ carry9 = (s9 + (1<<20)) >> 21; s10 += carry9; s9 -= carry9 << 21;
+ carry11 = (s11 + (1<<20)) >> 21; s12 += carry11; s11 -= carry11 << 21;
+
+ s0 += s12 * 666643;
+ s1 += s12 * 470296;
+ s2 += s12 * 654183;
+ s3 -= s12 * 997805;
+ s4 += s12 * 136657;
+ s5 -= s12 * 683901;
+ s12 = 0;
+
+ carry0 = s0 >> 21; s1 += carry0; s0 -= carry0 << 21;
+ carry1 = s1 >> 21; s2 += carry1; s1 -= carry1 << 21;
+ carry2 = s2 >> 21; s3 += carry2; s2 -= carry2 << 21;
+ carry3 = s3 >> 21; s4 += carry3; s3 -= carry3 << 21;
+ carry4 = s4 >> 21; s5 += carry4; s4 -= carry4 << 21;
+ carry5 = s5 >> 21; s6 += carry5; s5 -= carry5 << 21;
+ carry6 = s6 >> 21; s7 += carry6; s6 -= carry6 << 21;
+ carry7 = s7 >> 21; s8 += carry7; s7 -= carry7 << 21;
+ carry8 = s8 >> 21; s9 += carry8; s8 -= carry8 << 21;
+ carry9 = s9 >> 21; s10 += carry9; s9 -= carry9 << 21;
+ carry10 = s10 >> 21; s11 += carry10; s10 -= carry10 << 21;
+ carry11 = s11 >> 21; s12 += carry11; s11 -= carry11 << 21;
+
+ s0 += s12 * 666643;
+ s1 += s12 * 470296;
+ s2 += s12 * 654183;
+ s3 -= s12 * 997805;
+ s4 += s12 * 136657;
+ s5 -= s12 * 683901;
+ s12 = 0;
+
+ carry0 = s0 >> 21; s1 += carry0; s0 -= carry0 << 21;
+ carry1 = s1 >> 21; s2 += carry1; s1 -= carry1 << 21;
+ carry2 = s2 >> 21; s3 += carry2; s2 -= carry2 << 21;
+ carry3 = s3 >> 21; s4 += carry3; s3 -= carry3 << 21;
+ carry4 = s4 >> 21; s5 += carry4; s4 -= carry4 << 21;
+ carry5 = s5 >> 21; s6 += carry5; s5 -= carry5 << 21;
+ carry6 = s6 >> 21; s7 += carry6; s6 -= carry6 << 21;
+ carry7 = s7 >> 21; s8 += carry7; s7 -= carry7 << 21;
+ carry8 = s8 >> 21; s9 += carry8; s8 -= carry8 << 21;
+ carry9 = s9 >> 21; s10 += carry9; s9 -= carry9 << 21;
+ carry10 = s10 >> 21; s11 += carry10; s10 -= carry10 << 21;
+
+ s[0] = s0 >> 0;
+ s[1] = s0 >> 8;
+ s[2] = (s0 >> 16) | (s1 << 5);
+ s[3] = s1 >> 3;
+ s[4] = s1 >> 11;
+ s[5] = (s1 >> 19) | (s2 << 2);
+ s[6] = s2 >> 6;
+ s[7] = (s2 >> 14) | (s3 << 7);
+ s[8] = s3 >> 1;
+ s[9] = s3 >> 9;
+ s[10] = (s3 >> 17) | (s4 << 4);
+ s[11] = s4 >> 4;
+ s[12] = s4 >> 12;
+ s[13] = (s4 >> 20) | (s5 << 1);
+ s[14] = s5 >> 7;
+ s[15] = (s5 >> 15) | (s6 << 6);
+ s[16] = s6 >> 2;
+ s[17] = s6 >> 10;
+ s[18] = (s6 >> 18) | (s7 << 3);
+ s[19] = s7 >> 5;
+ s[20] = s7 >> 13;
+ s[21] = s8 >> 0;
+ s[22] = s8 >> 8;
+ s[23] = (s8 >> 16) | (s9 << 5);
+ s[24] = s9 >> 3;
+ s[25] = s9 >> 11;
+ s[26] = (s9 >> 19) | (s10 << 2);
+ s[27] = s10 >> 6;
+ s[28] = (s10 >> 14) | (s11 << 7);
+ s[29] = s11 >> 1;
+ s[30] = s11 >> 9;
+ s[31] = s11 >> 17;
+}
diff --git a/plugin/auth_ed25519/ref10/sc_reduce.c b/plugin/auth_ed25519/ref10/sc_reduce.c
new file mode 100644
index 00000000000..d01f5a5737e
--- /dev/null
+++ b/plugin/auth_ed25519/ref10/sc_reduce.c
@@ -0,0 +1,275 @@
+#include "sc.h"
+#include "crypto_int64.h"
+#include "crypto_uint32.h"
+#include "crypto_uint64.h"
+
+static crypto_uint64 load_3(const unsigned char *in)
+{
+ crypto_uint64 result;
+ result = (crypto_uint64) in[0];
+ result |= ((crypto_uint64) in[1]) << 8;
+ result |= ((crypto_uint64) in[2]) << 16;
+ return result;
+}
+
+static crypto_uint64 load_4(const unsigned char *in)
+{
+ crypto_uint64 result;
+ result = (crypto_uint64) in[0];
+ result |= ((crypto_uint64) in[1]) << 8;
+ result |= ((crypto_uint64) in[2]) << 16;
+ result |= ((crypto_uint64) in[3]) << 24;
+ return result;
+}
+
+/*
+Input:
+ s[0]+256*s[1]+...+256^63*s[63] = s
+
+Output:
+ s[0]+256*s[1]+...+256^31*s[31] = s mod l
+ where l = 2^252 + 27742317777372353535851937790883648493.
+ Overwrites s in place.
+*/
+
+void sc_reduce(unsigned char *s)
+{
+ crypto_int64 s0 = 2097151 & load_3(s);
+ crypto_int64 s1 = 2097151 & (load_4(s + 2) >> 5);
+ crypto_int64 s2 = 2097151 & (load_3(s + 5) >> 2);
+ crypto_int64 s3 = 2097151 & (load_4(s + 7) >> 7);
+ crypto_int64 s4 = 2097151 & (load_4(s + 10) >> 4);
+ crypto_int64 s5 = 2097151 & (load_3(s + 13) >> 1);
+ crypto_int64 s6 = 2097151 & (load_4(s + 15) >> 6);
+ crypto_int64 s7 = 2097151 & (load_3(s + 18) >> 3);
+ crypto_int64 s8 = 2097151 & load_3(s + 21);
+ crypto_int64 s9 = 2097151 & (load_4(s + 23) >> 5);
+ crypto_int64 s10 = 2097151 & (load_3(s + 26) >> 2);
+ crypto_int64 s11 = 2097151 & (load_4(s + 28) >> 7);
+ crypto_int64 s12 = 2097151 & (load_4(s + 31) >> 4);
+ crypto_int64 s13 = 2097151 & (load_3(s + 34) >> 1);
+ crypto_int64 s14 = 2097151 & (load_4(s + 36) >> 6);
+ crypto_int64 s15 = 2097151 & (load_3(s + 39) >> 3);
+ crypto_int64 s16 = 2097151 & load_3(s + 42);
+ crypto_int64 s17 = 2097151 & (load_4(s + 44) >> 5);
+ crypto_int64 s18 = 2097151 & (load_3(s + 47) >> 2);
+ crypto_int64 s19 = 2097151 & (load_4(s + 49) >> 7);
+ crypto_int64 s20 = 2097151 & (load_4(s + 52) >> 4);
+ crypto_int64 s21 = 2097151 & (load_3(s + 55) >> 1);
+ crypto_int64 s22 = 2097151 & (load_4(s + 57) >> 6);
+ crypto_int64 s23 = (load_4(s + 60) >> 3);
+ crypto_int64 carry0;
+ crypto_int64 carry1;
+ crypto_int64 carry2;
+ crypto_int64 carry3;
+ crypto_int64 carry4;
+ crypto_int64 carry5;
+ crypto_int64 carry6;
+ crypto_int64 carry7;
+ crypto_int64 carry8;
+ crypto_int64 carry9;
+ crypto_int64 carry10;
+ crypto_int64 carry11;
+ crypto_int64 carry12;
+ crypto_int64 carry13;
+ crypto_int64 carry14;
+ crypto_int64 carry15;
+ crypto_int64 carry16;
+
+ s11 += s23 * 666643;
+ s12 += s23 * 470296;
+ s13 += s23 * 654183;
+ s14 -= s23 * 997805;
+ s15 += s23 * 136657;
+ s16 -= s23 * 683901;
+ s23 = 0;
+
+ s10 += s22 * 666643;
+ s11 += s22 * 470296;
+ s12 += s22 * 654183;
+ s13 -= s22 * 997805;
+ s14 += s22 * 136657;
+ s15 -= s22 * 683901;
+ s22 = 0;
+
+ s9 += s21 * 666643;
+ s10 += s21 * 470296;
+ s11 += s21 * 654183;
+ s12 -= s21 * 997805;
+ s13 += s21 * 136657;
+ s14 -= s21 * 683901;
+ s21 = 0;
+
+ s8 += s20 * 666643;
+ s9 += s20 * 470296;
+ s10 += s20 * 654183;
+ s11 -= s20 * 997805;
+ s12 += s20 * 136657;
+ s13 -= s20 * 683901;
+ s20 = 0;
+
+ s7 += s19 * 666643;
+ s8 += s19 * 470296;
+ s9 += s19 * 654183;
+ s10 -= s19 * 997805;
+ s11 += s19 * 136657;
+ s12 -= s19 * 683901;
+ s19 = 0;
+
+ s6 += s18 * 666643;
+ s7 += s18 * 470296;
+ s8 += s18 * 654183;
+ s9 -= s18 * 997805;
+ s10 += s18 * 136657;
+ s11 -= s18 * 683901;
+ s18 = 0;
+
+ carry6 = (s6 + (1<<20)) >> 21; s7 += carry6; s6 -= carry6 << 21;
+ carry8 = (s8 + (1<<20)) >> 21; s9 += carry8; s8 -= carry8 << 21;
+ carry10 = (s10 + (1<<20)) >> 21; s11 += carry10; s10 -= carry10 << 21;
+ carry12 = (s12 + (1<<20)) >> 21; s13 += carry12; s12 -= carry12 << 21;
+ carry14 = (s14 + (1<<20)) >> 21; s15 += carry14; s14 -= carry14 << 21;
+ carry16 = (s16 + (1<<20)) >> 21; s17 += carry16; s16 -= carry16 << 21;
+
+ carry7 = (s7 + (1<<20)) >> 21; s8 += carry7; s7 -= carry7 << 21;
+ carry9 = (s9 + (1<<20)) >> 21; s10 += carry9; s9 -= carry9 << 21;
+ carry11 = (s11 + (1<<20)) >> 21; s12 += carry11; s11 -= carry11 << 21;
+ carry13 = (s13 + (1<<20)) >> 21; s14 += carry13; s13 -= carry13 << 21;
+ carry15 = (s15 + (1<<20)) >> 21; s16 += carry15; s15 -= carry15 << 21;
+
+ s5 += s17 * 666643;
+ s6 += s17 * 470296;
+ s7 += s17 * 654183;
+ s8 -= s17 * 997805;
+ s9 += s17 * 136657;
+ s10 -= s17 * 683901;
+ s17 = 0;
+
+ s4 += s16 * 666643;
+ s5 += s16 * 470296;
+ s6 += s16 * 654183;
+ s7 -= s16 * 997805;
+ s8 += s16 * 136657;
+ s9 -= s16 * 683901;
+ s16 = 0;
+
+ s3 += s15 * 666643;
+ s4 += s15 * 470296;
+ s5 += s15 * 654183;
+ s6 -= s15 * 997805;
+ s7 += s15 * 136657;
+ s8 -= s15 * 683901;
+ s15 = 0;
+
+ s2 += s14 * 666643;
+ s3 += s14 * 470296;
+ s4 += s14 * 654183;
+ s5 -= s14 * 997805;
+ s6 += s14 * 136657;
+ s7 -= s14 * 683901;
+ s14 = 0;
+
+ s1 += s13 * 666643;
+ s2 += s13 * 470296;
+ s3 += s13 * 654183;
+ s4 -= s13 * 997805;
+ s5 += s13 * 136657;
+ s6 -= s13 * 683901;
+ s13 = 0;
+
+ s0 += s12 * 666643;
+ s1 += s12 * 470296;
+ s2 += s12 * 654183;
+ s3 -= s12 * 997805;
+ s4 += s12 * 136657;
+ s5 -= s12 * 683901;
+ s12 = 0;
+
+ carry0 = (s0 + (1<<20)) >> 21; s1 += carry0; s0 -= carry0 << 21;
+ carry2 = (s2 + (1<<20)) >> 21; s3 += carry2; s2 -= carry2 << 21;
+ carry4 = (s4 + (1<<20)) >> 21; s5 += carry4; s4 -= carry4 << 21;
+ carry6 = (s6 + (1<<20)) >> 21; s7 += carry6; s6 -= carry6 << 21;
+ carry8 = (s8 + (1<<20)) >> 21; s9 += carry8; s8 -= carry8 << 21;
+ carry10 = (s10 + (1<<20)) >> 21; s11 += carry10; s10 -= carry10 << 21;
+
+ carry1 = (s1 + (1<<20)) >> 21; s2 += carry1; s1 -= carry1 << 21;
+ carry3 = (s3 + (1<<20)) >> 21; s4 += carry3; s3 -= carry3 << 21;
+ carry5 = (s5 + (1<<20)) >> 21; s6 += carry5; s5 -= carry5 << 21;
+ carry7 = (s7 + (1<<20)) >> 21; s8 += carry7; s7 -= carry7 << 21;
+ carry9 = (s9 + (1<<20)) >> 21; s10 += carry9; s9 -= carry9 << 21;
+ carry11 = (s11 + (1<<20)) >> 21; s12 += carry11; s11 -= carry11 << 21;
+
+ s0 += s12 * 666643;
+ s1 += s12 * 470296;
+ s2 += s12 * 654183;
+ s3 -= s12 * 997805;
+ s4 += s12 * 136657;
+ s5 -= s12 * 683901;
+ s12 = 0;
+
+ carry0 = s0 >> 21; s1 += carry0; s0 -= carry0 << 21;
+ carry1 = s1 >> 21; s2 += carry1; s1 -= carry1 << 21;
+ carry2 = s2 >> 21; s3 += carry2; s2 -= carry2 << 21;
+ carry3 = s3 >> 21; s4 += carry3; s3 -= carry3 << 21;
+ carry4 = s4 >> 21; s5 += carry4; s4 -= carry4 << 21;
+ carry5 = s5 >> 21; s6 += carry5; s5 -= carry5 << 21;
+ carry6 = s6 >> 21; s7 += carry6; s6 -= carry6 << 21;
+ carry7 = s7 >> 21; s8 += carry7; s7 -= carry7 << 21;
+ carry8 = s8 >> 21; s9 += carry8; s8 -= carry8 << 21;
+ carry9 = s9 >> 21; s10 += carry9; s9 -= carry9 << 21;
+ carry10 = s10 >> 21; s11 += carry10; s10 -= carry10 << 21;
+ carry11 = s11 >> 21; s12 += carry11; s11 -= carry11 << 21;
+
+ s0 += s12 * 666643;
+ s1 += s12 * 470296;
+ s2 += s12 * 654183;
+ s3 -= s12 * 997805;
+ s4 += s12 * 136657;
+ s5 -= s12 * 683901;
+ s12 = 0;
+
+ carry0 = s0 >> 21; s1 += carry0; s0 -= carry0 << 21;
+ carry1 = s1 >> 21; s2 += carry1; s1 -= carry1 << 21;
+ carry2 = s2 >> 21; s3 += carry2; s2 -= carry2 << 21;
+ carry3 = s3 >> 21; s4 += carry3; s3 -= carry3 << 21;
+ carry4 = s4 >> 21; s5 += carry4; s4 -= carry4 << 21;
+ carry5 = s5 >> 21; s6 += carry5; s5 -= carry5 << 21;
+ carry6 = s6 >> 21; s7 += carry6; s6 -= carry6 << 21;
+ carry7 = s7 >> 21; s8 += carry7; s7 -= carry7 << 21;
+ carry8 = s8 >> 21; s9 += carry8; s8 -= carry8 << 21;
+ carry9 = s9 >> 21; s10 += carry9; s9 -= carry9 << 21;
+ carry10 = s10 >> 21; s11 += carry10; s10 -= carry10 << 21;
+
+ s[0] = s0 >> 0;
+ s[1] = s0 >> 8;
+ s[2] = (s0 >> 16) | (s1 << 5);
+ s[3] = s1 >> 3;
+ s[4] = s1 >> 11;
+ s[5] = (s1 >> 19) | (s2 << 2);
+ s[6] = s2 >> 6;
+ s[7] = (s2 >> 14) | (s3 << 7);
+ s[8] = s3 >> 1;
+ s[9] = s3 >> 9;
+ s[10] = (s3 >> 17) | (s4 << 4);
+ s[11] = s4 >> 4;
+ s[12] = s4 >> 12;
+ s[13] = (s4 >> 20) | (s5 << 1);
+ s[14] = s5 >> 7;
+ s[15] = (s5 >> 15) | (s6 << 6);
+ s[16] = s6 >> 2;
+ s[17] = s6 >> 10;
+ s[18] = (s6 >> 18) | (s7 << 3);
+ s[19] = s7 >> 5;
+ s[20] = s7 >> 13;
+ s[21] = s8 >> 0;
+ s[22] = s8 >> 8;
+ s[23] = (s8 >> 16) | (s9 << 5);
+ s[24] = s9 >> 3;
+ s[25] = s9 >> 11;
+ s[26] = (s9 >> 19) | (s10 << 2);
+ s[27] = s10 >> 6;
+ s[28] = (s10 >> 14) | (s11 << 7);
+ s[29] = s11 >> 1;
+ s[30] = s11 >> 9;
+ s[31] = s11 >> 17;
+}
diff --git a/plugin/auth_ed25519/ref10/sign.c b/plugin/auth_ed25519/ref10/sign.c
new file mode 100644
index 00000000000..0cf1edd153d
--- /dev/null
+++ b/plugin/auth_ed25519/ref10/sign.c
@@ -0,0 +1,39 @@
+#include <string.h>
+#include "crypto_sign.h"
+#include "crypto_hash_sha512.h"
+#include "ge.h"
+#include "sc.h"
+
+int crypto_sign(
+ unsigned char *sm,
+ const unsigned char *m,unsigned long long mlen,
+ const unsigned char *pw,unsigned long long pwlen
+)
+{
+ unsigned char az[64];
+ unsigned char nonce[64];
+ unsigned char hram[64];
+ ge_p3 A, R;
+
+ crypto_hash_sha512(az,pw,pwlen);
+ az[0] &= 248;
+ az[31] &= 63;
+ az[31] |= 64;
+
+ memmove(sm + 64,m,mlen);
+ memmove(sm + 32,az + 32,32);
+ crypto_hash_sha512(nonce,sm + 32,mlen + 32);
+
+ ge_scalarmult_base(&A,az);
+ ge_p3_tobytes(sm + 32,&A);
+
+ sc_reduce(nonce);
+ ge_scalarmult_base(&R,nonce);
+ ge_p3_tobytes(sm,&R);
+
+ crypto_hash_sha512(hram,sm,mlen + 64);
+ sc_reduce(hram);
+ sc_muladd(sm + 32,hram,az,nonce);
+
+ return 0;
+}
diff --git a/plugin/auth_ed25519/ref10/sqrtm1.h b/plugin/auth_ed25519/ref10/sqrtm1.h
new file mode 100644
index 00000000000..d8caa23b6a6
--- /dev/null
+++ b/plugin/auth_ed25519/ref10/sqrtm1.h
@@ -0,0 +1 @@
+-32595792,-7943725,9377950,3500415,12389472,-272473,-25146209,-2005654,326686,11406482
diff --git a/plugin/auth_ed25519/ref10/verify.c b/plugin/auth_ed25519/ref10/verify.c
new file mode 100644
index 00000000000..a0e23afedeb
--- /dev/null
+++ b/plugin/auth_ed25519/ref10/verify.c
@@ -0,0 +1,40 @@
+#include "crypto_verify.h"
+
+int crypto_verify(const unsigned char *x,const unsigned char *y)
+{
+ unsigned int differentbits = 0;
+#define F(i) differentbits |= x[i] ^ y[i];
+ F(0)
+ F(1)
+ F(2)
+ F(3)
+ F(4)
+ F(5)
+ F(6)
+ F(7)
+ F(8)
+ F(9)
+ F(10)
+ F(11)
+ F(12)
+ F(13)
+ F(14)
+ F(15)
+ F(16)
+ F(17)
+ F(18)
+ F(19)
+ F(20)
+ F(21)
+ F(22)
+ F(23)
+ F(24)
+ F(25)
+ F(26)
+ F(27)
+ F(28)
+ F(29)
+ F(30)
+ F(31)
+ return (1 & ((differentbits - 1) >> 8)) - 1;
+}
diff --git a/plugin/auth_ed25519/server_ed25519.c b/plugin/auth_ed25519/server_ed25519.c
new file mode 100644
index 00000000000..88760275b9b
--- /dev/null
+++ b/plugin/auth_ed25519/server_ed25519.c
@@ -0,0 +1,146 @@
+/*
+ Copyright (c) 2017, MariaDB
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
+
+#include <mysql/plugin_auth.h>
+#include "common.h"
+
+#if !defined(__attribute__) && !defined(__GNUC__)
+#define __attribute__(A)
+#endif
+
+#define PASSWORD_LEN_BUF 44 /* base64 of 32 bytes */
+#define PASSWORD_LEN 43 /* we won't store the last byte, padding '=' */
+
+#define CRYPTO_LONGS (CRYPTO_BYTES/sizeof(long))
+#define NONCE_LONGS (NONCE_BYTES/sizeof(long))
+
+/************************** SERVER *************************************/
+
+static int loaded= 0;
+
+static int auth(MYSQL_PLUGIN_VIO *vio, MYSQL_SERVER_AUTH_INFO *info)
+{
+ unsigned int i;
+ int pkt_len;
+ unsigned long nonce[CRYPTO_LONGS + NONCE_LONGS];
+ unsigned char *pkt, *reply= (unsigned char*)nonce;
+ unsigned char pk[PASSWORD_LEN_BUF/4*3];
+ char pw[PASSWORD_LEN_BUF];
+
+ /* prepare the pk */
+ if (info->auth_string_length != PASSWORD_LEN)
+ return CR_AUTH_USER_CREDENTIALS;
+ memcpy(pw, info->auth_string, PASSWORD_LEN);
+ pw[PASSWORD_LEN]= '=';
+ if (my_base64_decode(pw, PASSWORD_LEN_BUF, pk, NULL, 0) != CRYPTO_PUBLICKEYBYTES)
+ return CR_AUTH_USER_CREDENTIALS;
+
+ info->password_used= PASSWORD_USED_YES;
+
+ /* prepare random nonce */
+ for (i=CRYPTO_LONGS; i < CRYPTO_LONGS + NONCE_LONGS; i++)
+ nonce[i]= thd_rnd(info->thd) * ~0UL;
+
+ /* send it */
+ if (vio->write_packet(vio, reply + CRYPTO_BYTES, NONCE_BYTES))
+ return CR_AUTH_HANDSHAKE;
+
+ /* read the signature */
+ if ((pkt_len= vio->read_packet(vio, &pkt)) != CRYPTO_BYTES)
+ return CR_AUTH_HANDSHAKE;
+ memcpy(reply, pkt, CRYPTO_BYTES);
+
+ if (crypto_sign_open(reply, CRYPTO_BYTES + NONCE_BYTES, pk))
+ return CR_ERROR;
+
+ return CR_OK;
+}
+
+static struct st_mysql_auth info =
+{
+ MYSQL_AUTHENTICATION_INTERFACE_VERSION,
+ "client_ed25519",
+ auth
+};
+
+static int init(void *p __attribute__((unused)))
+{
+ loaded= 1;
+ return 0;
+}
+
+static int deinit(void *p __attribute__((unused)))
+{
+ loaded= 0;
+ return 0;
+}
+
+maria_declare_plugin(ed25519)
+{
+ MYSQL_AUTHENTICATION_PLUGIN,
+ &info,
+ "ed25519",
+ "Sergei Golubchik",
+ "Elliptic curve ED25519 based authentication",
+ PLUGIN_LICENSE_GPL,
+ init,
+ deinit,
+ 0x0100,
+ NULL,
+ NULL,
+ "1.0-alpha",
+ MariaDB_PLUGIN_MATURITY_BETA
+}
+maria_declare_plugin_end;
+
+/************************** UDF ****************************************/
+MYSQL_PLUGIN_EXPORT
+char *ed25519_password(UDF_INIT *initid __attribute__((unused)),
+ UDF_ARGS *args, char *result, unsigned long *length,
+ char *is_null, char *error __attribute__((unused)))
+{
+ unsigned char pk[CRYPTO_PUBLICKEYBYTES];
+
+ if ((*is_null= !args->args[0]))
+ return NULL;
+
+ *length= PASSWORD_LEN;
+ crypto_sign_keypair(pk, (unsigned char*)args->args[0], args->lengths[0]);
+ my_base64_encode(pk, CRYPTO_PUBLICKEYBYTES, result);
+ return result;
+}
+
+/*
+ At least one of _init/_deinit is needed unless the server is started
+ with --allow_suspicious_udfs.
+*/
+MYSQL_PLUGIN_EXPORT
+my_bool ed25519_password_init(UDF_INIT *initid, UDF_ARGS *args, char *message)
+{
+ if (args->arg_count != 1 || args->arg_type[0] != STRING_RESULT)
+ {
+ strcpy(message,"Wrong arguments to ed25519_password()");
+ return 1;
+ }
+ if (!loaded)
+ {
+ /* cannot work unless the plugin is loaded, we need services. */
+ strcpy(message,"Authentication plugin ed25519 is not loaded");
+ return 1;
+ }
+ initid->max_length= PASSWORD_LEN_BUF;
+ return 0;
+}
diff --git a/plugin/auth_examples/clear_password_client.c b/plugin/auth_examples/clear_password_client.c
index 31be263b869..4e7dac61b25 100644
--- a/plugin/auth_examples/clear_password_client.c
+++ b/plugin/auth_examples/clear_password_client.c
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#include <mysql/client_plugin.h>
#include <mysql.h>
diff --git a/plugin/auth_gssapi/README.md b/plugin/auth_gssapi/README.md
index b2c17353fc5..ea8deaafa94 100644
--- a/plugin/auth_gssapi/README.md
+++ b/plugin/auth_gssapi/README.md
@@ -108,7 +108,7 @@ mysql --plugin-dir=/path/to/plugin-dir -u usr1
- **gssapi-mech-name** (Windows only) - Name of the SSPI package used by server. Can be either 'Kerberos' or 'Negotiate'.
Defaults to 'Negotiate' (both Kerberos and NTLM users can connect)
Set it to 'Kerberos', to prevent less secure NTLM in domain environments, but leave it as default(Negotiate)
- to allow non-domain environment (e.g if server does not run in domain enviroment).
+ to allow non-domain environment (e.g if server does not run in domain environment).
#Implementation
diff --git a/plugin/auth_pam/auth_pam.c b/plugin/auth_pam/auth_pam.c
index 8810a418cd3..1f25163b371 100644
--- a/plugin/auth_pam/auth_pam.c
+++ b/plugin/auth_pam/auth_pam.c
@@ -12,7 +12,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#define _GNU_SOURCE 1 /* for strndup */
diff --git a/plugin/auth_pam/mapper/pam_user_map.c b/plugin/auth_pam/mapper/pam_user_map.c
index 229a844d5c9..e62be946c4a 100644
--- a/plugin/auth_pam/mapper/pam_user_map.c
+++ b/plugin/auth_pam/mapper/pam_user_map.c
@@ -6,7 +6,7 @@
gcc pam_user_map.c -shared -lpam -fPIC -o pam_user_map.so
Install as appropriate (for example, in /lib/security/).
- Add to your /etc/pam.d/mysql (preferrably, at the end) this line:
+ Add to your /etc/pam.d/mysql (preferably, at the end) this line:
=========================================================
auth required pam_user_map.so
=========================================================
diff --git a/plugin/aws_key_management/CMakeLists.txt b/plugin/aws_key_management/CMakeLists.txt
index 26c74047b8b..9e012b64696 100644
--- a/plugin/aws_key_management/CMakeLists.txt
+++ b/plugin/aws_key_management/CMakeLists.txt
@@ -49,7 +49,7 @@ ENDIF()
FIND_LIBRARY(AWS_CPP_SDK_CORE NAMES aws-cpp-sdk-core PATH_SUFFIXES "${SDK_INSTALL_BINARY_PREFIX}")
-FIND_LIBRARY(AWS_CPP_SDK_KMS NAMES aws-cpp-sdk-core PATH_SUFFIXES "${SDK_INSTALL_BINARY_PREFIX}")
+FIND_LIBRARY(AWS_CPP_SDK_KMS NAMES aws-cpp-sdk-kms PATH_SUFFIXES "${SDK_INSTALL_BINARY_PREFIX}")
SET(CMAKE_REQUIRED_FLAGS ${CXX11_FLAGS})
CHECK_INCLUDE_FILE_CXX(aws/kms/KMSClient.h HAVE_AWS_HEADERS)
diff --git a/plugin/aws_key_management/aws_key_management_plugin.cc b/plugin/aws_key_management/aws_key_management_plugin.cc
index e94c551bebe..83966b97c17 100644
--- a/plugin/aws_key_management/aws_key_management_plugin.cc
+++ b/plugin/aws_key_management/aws_key_management_plugin.cc
@@ -25,7 +25,6 @@
#include <stdio.h>
#include <stdlib.h>
#include <mysqld_error.h>
-#include <base64.h>
#include <map>
#include <algorithm>
#include <string>
diff --git a/plugin/feedback/feedback.cc b/plugin/feedback/feedback.cc
index c7861d99004..bd433efa4d3 100644
--- a/plugin/feedback/feedback.cc
+++ b/plugin/feedback/feedback.cc
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#include "feedback.h"
diff --git a/plugin/feedback/feedback.h b/plugin/feedback/feedback.h
index bb3f896288d..5e7e7b1516e 100644
--- a/plugin/feedback/feedback.h
+++ b/plugin/feedback/feedback.h
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#define MYSQL_SERVER 1
#include <sql_class.h>
diff --git a/plugin/feedback/sender_thread.cc b/plugin/feedback/sender_thread.cc
index 16cdfe5574a..66f47e7302a 100644
--- a/plugin/feedback/sender_thread.cc
+++ b/plugin/feedback/sender_thread.cc
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#include "feedback.h"
#include <sql_acl.h>
diff --git a/plugin/feedback/url_base.cc b/plugin/feedback/url_base.cc
index 6afbcd7c8f4..44cb0b00c95 100644
--- a/plugin/feedback/url_base.cc
+++ b/plugin/feedback/url_base.cc
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#include "feedback.h"
diff --git a/plugin/feedback/url_http.cc b/plugin/feedback/url_http.cc
index cec3f60505c..4851097e63f 100644
--- a/plugin/feedback/url_http.cc
+++ b/plugin/feedback/url_http.cc
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#include "feedback.h"
diff --git a/plugin/feedback/utils.cc b/plugin/feedback/utils.cc
index 7530003182f..0805a6e1d76 100644
--- a/plugin/feedback/utils.cc
+++ b/plugin/feedback/utils.cc
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#include "feedback.h"
@@ -19,9 +19,6 @@
#include <unistd.h>
#endif
-#include <base64.h>
-#include <sha1.h>
-
#if defined (_WIN32)
#define HAVE_SYS_UTSNAME_H
@@ -420,7 +417,7 @@ int fill_collation_statistics(THD *thd, TABLE_LIST *tables)
int calculate_server_uid(char *dest)
{
uchar rawbuf[2 + 6];
- uchar shabuf[SHA1_HASH_SIZE];
+ uchar shabuf[MY_SHA1_HASH_SIZE];
int2store(rawbuf, mysqld_port);
if (my_gethwaddr(rawbuf + 2))
@@ -429,7 +426,7 @@ int calculate_server_uid(char *dest)
return 1;
}
- compute_sha1_hash((uint8*) shabuf, (char*) rawbuf, sizeof(rawbuf));
+ my_sha1((uint8*) shabuf, (char*) rawbuf, sizeof(rawbuf));
assert(my_base64_needed_encoded_length(sizeof(shabuf)) <= SERVER_UID_SIZE);
my_base64_encode(shabuf, sizeof(shabuf), dest);
diff --git a/plugin/metadata_lock_info/metadata_lock_info.cc b/plugin/metadata_lock_info/metadata_lock_info.cc
index d5308acb013..f2cdb99b82b 100644
--- a/plugin/metadata_lock_info/metadata_lock_info.cc
+++ b/plugin/metadata_lock_info/metadata_lock_info.cc
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#define MYSQL_SERVER 1
#include "my_config.h"
diff --git a/plugin/query_response_time/plugin.cc b/plugin/query_response_time/plugin.cc
index 17d0cfe4138..0ed8b88dc60 100644
--- a/plugin/query_response_time/plugin.cc
+++ b/plugin/query_response_time/plugin.cc
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#define MYSQL_SERVER
#include <sql_class.h>
diff --git a/plugin/server_audit/CMakeLists.txt b/plugin/server_audit/CMakeLists.txt
index 3de8c43c871..2c9964543bf 100644
--- a/plugin/server_audit/CMakeLists.txt
+++ b/plugin/server_audit/CMakeLists.txt
@@ -11,7 +11,7 @@
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
SET(SERVER_AUDIT_SOURCES
server_audit.c test_audit_v4.c plugin_audit_v4.h)
diff --git a/plugin/server_audit/plugin_audit_v4.h b/plugin/server_audit/plugin_audit_v4.h
index 5f8e43b3811..f8662c23e6b 100644
--- a/plugin/server_audit/plugin_audit_v4.h
+++ b/plugin/server_audit/plugin_audit_v4.h
@@ -232,7 +232,7 @@ struct mysql_event_parse
/** input: the original query text */
MYSQL_LEX_CSTRING query;
- /** output: returns the null-terminated rewriten query allocated by my_malloc() */
+ /** output: returns the null-terminated rewritten query allocated by my_malloc() */
MYSQL_LEX_CSTRING *rewritten_query;
};
diff --git a/plugin/server_audit/server_audit.c b/plugin/server_audit/server_audit.c
index 95b9586a1c5..c0ec9aa6b8d 100644
--- a/plugin/server_audit/server_audit.c
+++ b/plugin/server_audit/server_audit.c
@@ -11,11 +11,11 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#define PLUGIN_VERSION 0x104
-#define PLUGIN_STR_VERSION "1.4.0"
+#define PLUGIN_STR_VERSION "1.4.1"
#define _my_thread_var loc_thread_var
@@ -156,10 +156,8 @@ static File loc_open(const char *FileName, int Flags)
File fd;
#if defined(_WIN32)
fd= my_win_open(FileName, Flags);
-#elif !defined(NO_OPEN_3)
- fd = open(FileName, Flags, my_umask); /* Normal unix */
#else
- fd = open((char *) FileName, Flags);
+ fd = open(FileName, Flags, my_umask);
#endif
my_errno= errno;
return fd;
@@ -2295,10 +2293,10 @@ typedef struct loc_system_variables
} LOC_SV;
+static int init_done= 0;
+
static int server_audit_init(void *p __attribute__((unused)))
{
- const void *my_hash_init_ptr;
-
if (!serv_ver)
{
#ifdef _WIN32
@@ -2307,11 +2305,16 @@ static int server_audit_init(void *p __attribute__((unused)))
serv_ver= server_version;
#endif /*_WIN32*/
}
- my_hash_init_ptr= dlsym(RTLD_DEFAULT, "_my_hash_init");
- if (!my_hash_init_ptr)
+ if (!mysql_57_started)
{
- maria_above_5= 1;
- my_hash_init_ptr= dlsym(RTLD_DEFAULT, "my_hash_init2");
+ const void *my_hash_init_ptr= dlsym(RTLD_DEFAULT, "_my_hash_init");
+ if (!my_hash_init_ptr)
+ {
+ maria_above_5= 1;
+ my_hash_init_ptr= dlsym(RTLD_DEFAULT, "my_hash_init2");
+ }
+ if (!my_hash_init_ptr)
+ return 1;
}
if(!(int_mysql_data_home= dlsym(RTLD_DEFAULT, "mysql_data_home")))
@@ -2320,7 +2323,7 @@ static int server_audit_init(void *p __attribute__((unused)))
int_mysql_data_home= &default_home;
}
- if (!serv_ver || !my_hash_init_ptr)
+ if (!serv_ver)
return 1;
if (!started_mysql)
@@ -2400,6 +2403,7 @@ static int server_audit_init(void *p __attribute__((unused)))
if (logging)
start_logging();
+ init_done= 1;
return 0;
}
@@ -2415,6 +2419,10 @@ static int server_audit_init_mysql(void *p)
static int server_audit_deinit(void *p __attribute__((unused)))
{
+ if (!init_done)
+ return 0;
+
+ init_done= 0;
coll_free(&incl_user_coll);
coll_free(&excl_user_coll);
@@ -2837,13 +2845,15 @@ void __attribute__ ((constructor)) audit_plugin_so_init(void)
if (sc >= 24)
use_event_data_for_disconnect= 1;
}
- else if (serv_ver[0] == '5' && serv_ver[2] == '7')
+ else if ((serv_ver[0] == '5' && serv_ver[2] == '7') ||
+ (serv_ver[0] == '8' && serv_ver[2] == '0'))
{
mysql_57_started= 1;
_mysql_plugin_declarations_[0].info= mysql_v4_descriptor;
use_event_data_for_disconnect= 1;
}
- MYSQL_SYSVAR_NAME(loc_info).flags= PLUGIN_VAR_READONLY | PLUGIN_VAR_MEMALLOC;
+ MYSQL_SYSVAR_NAME(loc_info).flags= PLUGIN_VAR_STR | PLUGIN_VAR_THDLOCAL |
+ PLUGIN_VAR_READONLY | PLUGIN_VAR_MEMALLOC;
}
memset(locinfo_ini_value, 'O', sizeof(locinfo_ini_value)-1);
diff --git a/plugin/sql_errlog/sql_errlog.c b/plugin/sql_errlog/sql_errlog.c
index 6ec4659d407..c0e6b7255cf 100644
--- a/plugin/sql_errlog/sql_errlog.c
+++ b/plugin/sql_errlog/sql_errlog.c
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#include <mysql/plugin_audit.h>
#include <stdio.h>
diff --git a/plugin/win_auth_client/handshake_client.cc b/plugin/win_auth_client/handshake_client.cc
index e3435f19de6..856dda76217 100644
--- a/plugin/win_auth_client/handshake_client.cc
+++ b/plugin/win_auth_client/handshake_client.cc
@@ -216,7 +216,7 @@ int Handshake_client::write_packet(Blob &data)
an empty blob is returned and @c error() gives non-zero error code.
When invoked for the first time (in the first round of the handshake)
- there is no data from the server (data blob is null) and the intial
+ there is no data from the server (data blob is null) and the initial
packet is generated without an input.
@return Data to be sent to the server next or null blob if no more data
diff --git a/plugin/wsrep_info/mysql-test/wsrep_info/suite.pm b/plugin/wsrep_info/mysql-test/wsrep_info/suite.pm
index 7148a9cf057..9f684ae6b0c 100644
--- a/plugin/wsrep_info/mysql-test/wsrep_info/suite.pm
+++ b/plugin/wsrep_info/mysql-test/wsrep_info/suite.pm
@@ -33,6 +33,7 @@ push @::global_suppressions,
qr(WSREP: last inactive check more than .* skipping check),
qr(WSREP: Gap in state sequence. Need state transfer.),
qr(WSREP: Failed to prepare for incremental state transfer: .*),
+ qr(WSREP: SYNC message from member .* in non-primary configuration. Ignored.),
);
diff --git a/plugin/wsrep_info/plugin.cc b/plugin/wsrep_info/plugin.cc
index 023011f1d24..ed502d30f88 100644
--- a/plugin/wsrep_info/plugin.cc
+++ b/plugin/wsrep_info/plugin.cc
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#ifndef MYSQL_SERVER
#define MYSQL_SERVER
diff --git a/scripts/CMakeLists.txt b/scripts/CMakeLists.txt
index 2ef2a1758f7..eb15b884481 100644
--- a/scripts/CMakeLists.txt
+++ b/scripts/CMakeLists.txt
@@ -73,6 +73,23 @@ IF(UNIX)
)
ENDIF()
+# Configure two scripts from one 'in' file.
+# The maria_add_gis_sp.sql - to be sent to 'mysql' tool
+# and the maria_add_gis_sp_bootstrap.sql, that can be sent to
+# the server as a bootstrap command.
+
+SET(ADD_GIS_SP_SET_DELIMITER "delimiter |")
+SET(ADD_GIS_SP_RESET_DELIMITER "delimiter ;")
+SET(ADD_GIS_SP_EOL "|")
+CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/maria_add_gis_sp.sql.in
+ ${CMAKE_CURRENT_BINARY_DIR}/maria_add_gis_sp.sql ESCAPE_QUOTES @ONLY)
+
+SET(ADD_GIS_SP_SET_DELIMITER "")
+SET(ADD_GIS_SP_RESET_DELIMITER "")
+SET(ADD_GIS_SP_EOL ";")
+CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/maria_add_gis_sp.sql.in
+ ${CMAKE_CURRENT_BINARY_DIR}/maria_add_gis_sp_bootstrap.sql ESCAPE_QUOTES @ONLY)
+
INSTALL(FILES
${CMAKE_CURRENT_SOURCE_DIR}/mysql_system_tables.sql
${CMAKE_CURRENT_SOURCE_DIR}/mysql_system_tables_data.sql
@@ -80,6 +97,8 @@ INSTALL(FILES
${CMAKE_CURRENT_SOURCE_DIR}/fill_help_tables.sql
${CMAKE_CURRENT_SOURCE_DIR}/mysql_test_data_timezone.sql
${CMAKE_CURRENT_SOURCE_DIR}/mysql_to_mariadb.sql
+ ${CMAKE_CURRENT_BINARY_DIR}/maria_add_gis_sp.sql
+ ${CMAKE_CURRENT_BINARY_DIR}/maria_add_gis_sp_bootstrap.sql
${FIX_PRIVILEGES_SQL}
DESTINATION ${INSTALL_MYSQLSHAREDIR} COMPONENT Server
)
@@ -234,13 +253,14 @@ IF(WIN32)
ENDFOREACH()
ELSE()
IF(WITH_WSREP)
- SET(WSREP_BINARIES
- wsrep_sst_common
+ SET(WSREP_SCRIPTS
wsrep_sst_mysqldump
wsrep_sst_rsync
wsrep_sst_xtrabackup
wsrep_sst_xtrabackup-v2
)
+ INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/wsrep_sst_common
+ DESTINATION ${INSTALL_BINDIR} COMPONENT Server)
ENDIF()
IF (NOT WITHOUT_SERVER)
SET(SERVER_SCRIPTS
@@ -265,7 +285,7 @@ ELSE()
mytop
mysqlhotcopy
${SERVER_SCRIPTS}
- ${WSREP_BINARIES}
+ ${WSREP_SCRIPTS}
${SYSTEMD_SCRIPTS}
)
FOREACH(file ${BIN_SCRIPTS})
@@ -291,29 +311,6 @@ ELSE()
ENDFOREACH()
ENDIF()
-# Configure two scripts from one 'in' file.
-# The maria_add_gis_sp.sql - to be sent to 'mysql' tool
-# and the maria_add_gis_sp_bootstrap.sql, that can be sent to
-# the server as a bootstrap command.
-
-SET(ADD_GIS_SP_SET_DELIMITER "delimiter |")
-SET(ADD_GIS_SP_RESET_DELIMITER "delimiter ;")
-SET(ADD_GIS_SP_EOL "|")
-CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/maria_add_gis_sp.sql.in
- ${CMAKE_CURRENT_BINARY_DIR}/maria_add_gis_sp.sql ESCAPE_QUOTES @ONLY)
-
-SET(ADD_GIS_SP_SET_DELIMITER "")
-SET(ADD_GIS_SP_RESET_DELIMITER "")
-SET(ADD_GIS_SP_EOL ";")
-CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/maria_add_gis_sp.sql.in
- ${CMAKE_CURRENT_BINARY_DIR}/maria_add_gis_sp_bootstrap.sql ESCAPE_QUOTES @ONLY)
-
-INSTALL_SCRIPT(${CMAKE_CURRENT_BINARY_DIR}/maria_add_gis_sp.sql
- ${CMAKE_CURRENT_BINARY_DIR}/maria_add_gis_sp_bootstrap.sql
- DESTINATION ${INSTALL_MYSQLSHAREDIR}
- COMPONENT Server
- )
-
# Install libgcc as mylibgcc.a
IF(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_FLAGS MATCHES "-static")
EXECUTE_PROCESS (
diff --git a/scripts/wsrep_sst_common.sh b/scripts/wsrep_sst_common
index 466bb46b382..466bb46b382 100644
--- a/scripts/wsrep_sst_common.sh
+++ b/scripts/wsrep_sst_common
diff --git a/sql-common/client.c b/sql-common/client.c
index fc76fa976e0..24e6bcf92e9 100644
--- a/sql-common/client.c
+++ b/sql-common/client.c
@@ -1,5 +1,5 @@
/* Copyright (c) 2003, 2016, Oracle and/or its affiliates.
- Copyright (c) 2009, 2016, MariaDB
+ Copyright (c) 2009, 2017, MariaDB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -589,7 +589,7 @@ restart:
if (len == packet_error || len == 0)
{
DBUG_PRINT("error",("Wrong connection or packet. fd: %s len: %lu",
- vio_description(net->vio),len));
+ net->vio ? vio_description(net->vio) : NULL, len));
#ifdef MYSQL_SERVER
if (net->vio && (net->last_errno == ER_NET_READ_INTERRUPTED))
return (packet_error);
@@ -3866,8 +3866,6 @@ static void mysql_close_free(MYSQL *mysql)
static void mysql_prune_stmt_list(MYSQL *mysql)
{
LIST *element= mysql->stmts;
- LIST *pruned_list= 0;
-
for (; element; element= element->next)
{
MYSQL_STMT *stmt= (MYSQL_STMT *) element->data;
@@ -3877,14 +3875,9 @@ static void mysql_prune_stmt_list(MYSQL *mysql)
stmt->last_errno= CR_SERVER_LOST;
strmov(stmt->last_error, ER(CR_SERVER_LOST));
strmov(stmt->sqlstate, unknown_sqlstate);
- }
- else
- {
- pruned_list= list_add(pruned_list, element);
+ mysql->stmts= list_delete(mysql->stmts, element);
}
}
-
- mysql->stmts= pruned_list;
}
diff --git a/sql/CMakeLists.txt b/sql/CMakeLists.txt
index 243468e095a..fc41a31c3c4 100644
--- a/sql/CMakeLists.txt
+++ b/sql/CMakeLists.txt
@@ -81,7 +81,7 @@ SET (SQL_SOURCE
../sql-common/client.c compat56.cc derror.cc des_key_file.cc
discover.cc ../sql-common/errmsg.c field.cc field_conv.cc
filesort_utils.cc
- filesort.cc gstream.cc sha2.cc
+ filesort.cc gstream.cc
signal_handler.cc
handler.cc hash_filo.h
hostname.cc init.cc item.cc item_buff.cc item_cmpfunc.cc
diff --git a/sql/bounded_queue.h b/sql/bounded_queue.h
index 88c2bbc238d..3573c5ceb27 100644
--- a/sql/bounded_queue.h
+++ b/sql/bounded_queue.h
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#ifndef BOUNDED_QUEUE_INCLUDED
#define BOUNDED_QUEUE_INCLUDED
diff --git a/sql/contributors.h b/sql/contributors.h
index 0359ec54022..3a771e2b493 100644
--- a/sql/contributors.h
+++ b/sql/contributors.h
@@ -37,16 +37,18 @@ struct show_table_contributors_st {
struct show_table_contributors_st show_table_contributors[]= {
/* MariaDB foundation sponsors, in contribution, size , time order */
- {"Booking.com", "http://www.booking.com", "Founding member, Platinum Sponsor of the MariaDB Foundation"},
+ {"Booking.com", "https://www.booking.com", "Founding member, Platinum Sponsor of the MariaDB Foundation"},
+ {"Alibaba Cloud", "https://intl.aliyun.com", "Platinum Sponsor of the MariaDB Foundation"},
{"MariaDB Corporation", "https://mariadb.com", "Founding member, Gold Sponsor of the MariaDB Foundation"},
- {"Visma", "http://visma.com", "Gold Sponsor of the MariaDB Foundation"},
- {"DBS", "http://dbs.com", "Gold Sponsor of the MariaDB Foundation"},
+ {"Visma", "https://visma.com", "Gold Sponsor of the MariaDB Foundation"},
+ {"DBS", "https://dbs.com", "Gold Sponsor of the MariaDB Foundation"},
{"Nexedi", "https://www.nexedi.com", "Silver Sponsor of the MariaDB Foundation"},
{"Acronis", "http://www.acronis.com", "Silver Sponsor of the MariaDB Foundation"},
{"Auttomattic", "https://automattic.com", "Bronze Sponsor of the MariaDB Foundation"},
- {"Verkkokauppa.com", "https://virtuozzo.com", "Bronze Sponsor of the MariaDB Foundation"},
- {"Virtuozzo", "https://virtuozzo.com/", "Bronze Sponsor of the MariaDB Foundation"},
- {"Tencent Game DBA", "http://tencentdba.com/about/", "Bronze Sponsor of the MariaDB Foundation"},
+ {"Verkkokauppa.com", "https://www.verkkokauppa.com", "Bronze Sponsor of the MariaDB Foundation"},
+ {"Virtuozzo", "https://virtuozzo.com", "Bronze Sponsor of the MariaDB Foundation"},
+ {"Tencent Game DBA", "http://tencentdba.com/about", "Bronze Sponsor of the MariaDB Foundation"},
+ {"Tencent TDSQL", "http://tdsql.org", "Bronze Sponsor of the MariaDB Foundation"},
/* Sponsors of important features */
{"Google", "USA", "Sponsoring encryption, parallel replication and GTID"},
diff --git a/sql/create_options.cc b/sql/create_options.cc
index 7edc2cb95f2..99562faa077 100644
--- a/sql/create_options.cc
+++ b/sql/create_options.cc
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
/**
@file
diff --git a/sql/create_options.h b/sql/create_options.h
index 3e7f9ecfabf..191ec88750a 100644
--- a/sql/create_options.h
+++ b/sql/create_options.h
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
/**
@file
diff --git a/sql/datadict.cc b/sql/datadict.cc
index c1e1e85c377..103a33214ae 100644
--- a/sql/datadict.cc
+++ b/sql/datadict.cc
@@ -39,25 +39,27 @@ static int read_string(File file, uchar**to, size_t length)
/**
Check type of .frm if we are not going to parse it.
- @param[in] thd The current session.
- @param[in] path path to FRM file.
- @param[out] dbt db_type of the table if FRMTYPE_TABLE, otherwise undefined.
+ @param[in] thd The current session.
+ @param[in] path path to FRM file.
+ @param[in/out] engine_name table engine name (length < NAME_CHAR_LEN)
+
+ engine_name is a LEX_STRING, where engine_name->str must point to
+ a buffer of at least NAME_CHAR_LEN+1 bytes.
@retval FRMTYPE_ERROR error
@retval FRMTYPE_TABLE table
@retval FRMTYPE_VIEW view
*/
-frm_type_enum dd_frm_type(THD *thd, char *path, enum legacy_db_type *dbt)
+frm_type_enum dd_frm_type(THD *thd, char *path, LEX_STRING *engine_name)
{
File file;
uchar header[10]; //"TYPE=VIEW\n" it is 10 characters
size_t error;
frm_type_enum type= FRMTYPE_ERROR;
+ uchar dbt;
DBUG_ENTER("dd_frm_type");
- *dbt= DB_TYPE_UNKNOWN;
-
if ((file= mysql_file_open(key_file_frm, path, O_RDONLY | O_SHARE, MYF(0))) < 0)
DBUG_RETURN(FRMTYPE_ERROR);
error= mysql_file_read(file, (uchar*) header, sizeof(header), MYF(MY_NABP));
@@ -72,17 +74,24 @@ frm_type_enum dd_frm_type(THD *thd, char *path, enum legacy_db_type *dbt)
type= FRMTYPE_TABLE;
- /*
- This is just a check for DB_TYPE. We'll return default unknown type
- if the following test is true (arg #3). This should not have effect
- on return value from this function (default FRMTYPE_TABLE)
- */
- if (!is_binary_frm_header(header))
+ if (!is_binary_frm_header(header) || !engine_name)
goto err;
- *dbt= (enum legacy_db_type) (uint) *(header + 3);
+ engine_name->length= 0;
+ dbt= header[3];
+
+ /* cannot use ha_resolve_by_legacy_type without a THD */
+ if (thd && dbt < DB_TYPE_FIRST_DYNAMIC)
+ {
+ handlerton *ht= ha_resolve_by_legacy_type(thd, (enum legacy_db_type)dbt);
+ if (ht)
+ {
+ *engine_name= hton2plugin[ht->slot]->name;
+ goto err;
+ }
+ }
- if (*dbt >= DB_TYPE_FIRST_DYNAMIC) /* read the true engine name */
+ /* read the true engine name */
{
MY_STAT state;
uchar *frm_image= 0;
@@ -110,15 +119,10 @@ frm_type_enum dd_frm_type(THD *thd, char *path, enum legacy_db_type *dbt)
next_chunk+= connect_string_length + 2;
if (next_chunk + 2 < buff_end)
{
- uint str_db_type_length= uint2korr(next_chunk);
- LEX_STRING name;
- name.str= (char*) next_chunk + 2;
- name.length= str_db_type_length;
- plugin_ref tmp_plugin= ha_resolve_by_name(thd, &name, false);
- if (tmp_plugin)
- *dbt= plugin_data(tmp_plugin, handlerton *)->db_type;
- else
- *dbt= DB_TYPE_UNKNOWN;
+ uint len= uint2korr(next_chunk);
+ if (len <= NAME_CHAR_LEN)
+ strmake(engine_name->str, (char*)next_chunk + 2,
+ engine_name->length= len);
}
}
diff --git a/sql/datadict.h b/sql/datadict.h
index dd80942daca..9b180a882f9 100644
--- a/sql/datadict.h
+++ b/sql/datadict.h
@@ -35,12 +35,11 @@ enum frm_type_enum
Prefer to use ha_table_exists() instead.
To check whether it's an frm of a view, use dd_frm_is_view().
*/
-frm_type_enum dd_frm_type(THD *thd, char *path, enum legacy_db_type *dbt);
+frm_type_enum dd_frm_type(THD *thd, char *path, LEX_STRING *engine_name);
static inline bool dd_frm_is_view(THD *thd, char *path)
{
- enum legacy_db_type not_used;
- return dd_frm_type(thd, path, &not_used) == FRMTYPE_VIEW;
+ return dd_frm_type(thd, path, NULL) == FRMTYPE_VIEW;
}
bool dd_recreate_table(THD *thd, const char *db, const char *table_name,
diff --git a/sql/event_scheduler.cc b/sql/event_scheduler.cc
index 3450e60f85c..8ed5901b69a 100644
--- a/sql/event_scheduler.cc
+++ b/sql/event_scheduler.cc
@@ -133,9 +133,6 @@ post_init_event_thread(THD *thd)
thd->cleanup();
return TRUE;
}
-
- add_to_active_threads(thd);
- inc_thread_running();
return FALSE;
}
@@ -153,8 +150,8 @@ deinit_event_thread(THD *thd)
{
thd->proc_info= "Clearing";
DBUG_PRINT("exit", ("Event thread finishing"));
-
- delete_running_thd(thd);
+ unlink_not_visible_thd(thd);
+ delete thd;
}
@@ -188,6 +185,7 @@ pre_init_event_thread(THD* thd)
thd->net.read_timeout= slave_net_timeout;
thd->variables.option_bits|= OPTION_AUTO_IS_NULL;
thd->client_capabilities|= CLIENT_MULTI_RESULTS;
+ add_to_active_threads(thd);
/*
Guarantees that we will see the thread in SHOW PROCESSLIST though its
@@ -234,13 +232,8 @@ event_scheduler_thread(void *arg)
my_free(arg);
if (!res)
scheduler->run(thd);
- else
- {
- thd->proc_info= "Clearing";
- net_end(&thd->net);
- delete thd;
- }
+ deinit_event_thread(thd);
DBUG_LEAVE; // Against gcc warnings
my_thread_end();
return 0;
@@ -304,6 +297,7 @@ Event_worker_thread::run(THD *thd, Event_queue_element_for_exec *event)
DBUG_ENTER("Event_worker_thread::run");
DBUG_PRINT("info", ("Time is %ld, THD: 0x%lx", (long) my_time(0), (long) thd));
+ inc_thread_running();
if (res)
goto end;
@@ -332,6 +326,7 @@ end:
event->name.str));
delete event;
+ dec_thread_running();
deinit_event_thread(thd);
DBUG_VOID_RETURN;
@@ -436,13 +431,9 @@ Event_scheduler::start(int *err_no)
" Can not create thread for event scheduler (errno=%d)",
*err_no);
- new_thd->proc_info= "Clearing";
- DBUG_ASSERT(new_thd->net.buff != 0);
- net_end(&new_thd->net);
-
state= INITIALIZED;
scheduler_thd= NULL;
- delete new_thd;
+ deinit_event_thread(new_thd);
delete scheduler_param_value;
ret= true;
@@ -509,7 +500,6 @@ Event_scheduler::run(THD *thd)
}
LOCK_DATA();
- deinit_event_thread(thd);
scheduler_thd= NULL;
state= INITIALIZED;
DBUG_PRINT("info", ("Broadcasting COND_state back to the stoppers"));
@@ -569,10 +559,7 @@ Event_scheduler::execute_top(Event_queue_element_for_exec *event_name)
sql_print_error("Event_scheduler::execute_top: Can not create event worker"
" thread (errno=%d). Stopping event scheduler", res);
- new_thd->proc_info= "Clearing";
- DBUG_ASSERT(new_thd->net.buff != 0);
- net_end(&new_thd->net);
-
+ deinit_event_thread(new_thd);
goto error;
}
@@ -584,9 +571,6 @@ Event_scheduler::execute_top(Event_queue_element_for_exec *event_name)
error:
DBUG_PRINT("error", ("Event_scheduler::execute_top() res: %d", res));
- if (new_thd)
- delete new_thd;
-
delete event_name;
DBUG_RETURN(TRUE);
}
diff --git a/sql/filesort_utils.cc b/sql/filesort_utils.cc
index 34110dcfc1f..a0bc5ee6aa2 100644
--- a/sql/filesort_utils.cc
+++ b/sql/filesort_utils.cc
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#include "filesort_utils.h"
#include "sql_const.h"
diff --git a/sql/gcalc_slicescan.cc b/sql/gcalc_slicescan.cc
index f62c413fd35..ab48542add6 100644
--- a/sql/gcalc_slicescan.cc
+++ b/sql/gcalc_slicescan.cc
@@ -12,7 +12,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#include <my_global.h>
diff --git a/sql/gcalc_slicescan.h b/sql/gcalc_slicescan.h
index 4996287ca88..b9516fc8d8c 100644
--- a/sql/gcalc_slicescan.h
+++ b/sql/gcalc_slicescan.h
@@ -12,7 +12,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#ifndef GCALC_SLICESCAN_INCLUDED
diff --git a/sql/gcalc_tools.cc b/sql/gcalc_tools.cc
index da0252c6b67..71118ae1c9f 100644
--- a/sql/gcalc_tools.cc
+++ b/sql/gcalc_tools.cc
@@ -12,7 +12,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#include <my_global.h>
diff --git a/sql/gcalc_tools.h b/sql/gcalc_tools.h
index 9e9b580b359..8bda3c144a6 100644
--- a/sql/gcalc_tools.h
+++ b/sql/gcalc_tools.h
@@ -12,7 +12,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#ifndef GCALC_TOOLS_INCLUDED
diff --git a/sql/group_by_handler.cc b/sql/group_by_handler.cc
index e3420b8d48d..c1b5cfbe254 100644
--- a/sql/group_by_handler.cc
+++ b/sql/group_by_handler.cc
@@ -12,7 +12,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
/*
This file implements the group_by_handler code. This interface
diff --git a/sql/group_by_handler.h b/sql/group_by_handler.h
index b05b7fd39ae..d3f48a15c24 100644
--- a/sql/group_by_handler.h
+++ b/sql/group_by_handler.h
@@ -12,7 +12,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
/*
This file implements the group_by_handler interface. This interface
diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc
index d1a5a7bb0ea..7f156c80205 100644
--- a/sql/ha_partition.cc
+++ b/sql/ha_partition.cc
@@ -7275,6 +7275,7 @@ int ha_partition::reset(void)
result= tmp;
}
bitmap_clear_all(&m_partitions_to_reset);
+ m_extra_prepare_for_update= FALSE;
DBUG_RETURN(result);
}
diff --git a/sql/handler.cc b/sql/handler.cc
index fb5d1699419..e07d656c986 100644
--- a/sql/handler.cc
+++ b/sql/handler.cc
@@ -3385,6 +3385,8 @@ void handler::print_error(int error, myf errflag)
textno=ER_FILE_USED;
break;
case ENOENT:
+ case ENOTDIR:
+ case ELOOP:
textno=ER_FILE_NOT_FOUND;
break;
case ENOSPC:
@@ -3862,7 +3864,6 @@ int handler::delete_table(const char *name)
int saved_error= 0;
int error= 0;
int enoent_or_zero;
- char buff[FN_REFLEN];
if (ht->discover_table)
enoent_or_zero= 0; // the table may not exist in the engine, it's ok
@@ -3871,8 +3872,7 @@ int handler::delete_table(const char *name)
for (const char **ext=bas_ext(); *ext ; ext++)
{
- fn_format(buff, name, "", *ext, MY_UNPACK_FILENAME|MY_APPEND_EXT);
- if (mysql_file_delete_with_symlink(key_file_misc, buff, MYF(0)))
+ if (mysql_file_delete_with_symlink(key_file_misc, name, *ext, 0))
{
if (my_errno != ENOENT)
{
@@ -4229,7 +4229,7 @@ enum_alter_inplace_result
handler::check_if_supported_inplace_alter(TABLE *altered_table,
Alter_inplace_info *ha_alter_info)
{
- DBUG_ENTER("check_if_supported_alter");
+ DBUG_ENTER("handler::check_if_supported_inplace_alter");
HA_CREATE_INFO *create_info= ha_alter_info->create_info;
@@ -5056,14 +5056,16 @@ bool ha_table_exists(THD *thd, const char *db, const char *table_name,
bool exists= true;
if (hton)
{
- enum legacy_db_type db_type;
- if (dd_frm_type(thd, path, &db_type) != FRMTYPE_VIEW)
+ char engine_buf[NAME_CHAR_LEN + 1];
+ LEX_STRING engine= { engine_buf, 0 };
+
+ if (dd_frm_type(thd, path, &engine) != FRMTYPE_VIEW)
{
- handlerton *ht= ha_resolve_by_legacy_type(thd, db_type);
- if ((*hton= ht))
+ plugin_ref p= plugin_lock_by_name(thd, &engine, MYSQL_STORAGE_ENGINE_PLUGIN);
+ *hton= p ? plugin_hton(p) : NULL;
+ if (*hton)
// verify that the table really exists
- exists= discover_existence(thd,
- plugin_int_to_ref(hton2plugin[ht->slot]), &args);
+ exists= discover_existence(thd, p, &args);
}
else
*hton= view_pseudo_hton;
diff --git a/sql/item.h b/sql/item.h
index 67640ce5f4d..6d69e3b60de 100644
--- a/sql/item.h
+++ b/sql/item.h
@@ -4930,6 +4930,11 @@ public:
virtual double val_real() = 0;
virtual longlong val_int() = 0;
virtual int save_in_field(Field *field, bool no_conversions) = 0;
+ bool walk(Item_processor processor, bool walk_subquery, void *args)
+ {
+ return (item->walk(processor, walk_subquery, args)) ||
+ (this->*processor)(args);
+ }
};
/**
diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc
index a3b9041aed4..689ce656d60 100644
--- a/sql/item_cmpfunc.cc
+++ b/sql/item_cmpfunc.cc
@@ -645,6 +645,22 @@ int Arg_comparator::set_cmp_func(Item_func_or_sum *owner_arg,
return 0;
}
+ if (m_compare_type == REAL_RESULT &&
+ (((*a)->result_type() == DECIMAL_RESULT && !(*a)->const_item() &&
+ (*b)->result_type() == STRING_RESULT && (*b)->const_item()) ||
+ ((*b)->result_type() == DECIMAL_RESULT && !(*b)->const_item() &&
+ (*a)->result_type() == STRING_RESULT && (*a)->const_item())))
+ {
+ /*
+ <non-const decimal expression> <cmp> <const string expression>
+ or
+ <const string expression> <cmp> <non-const decimal expression>
+
+ Do comparison as decimal rather than float, in order not to lose precision.
+ */
+ m_compare_type= DECIMAL_RESULT;
+ }
+
if (m_compare_type == INT_RESULT &&
(*a)->field_type() == MYSQL_TYPE_YEAR &&
(*b)->field_type() == MYSQL_TYPE_YEAR)
@@ -5171,6 +5187,18 @@ bool Item_func_like::with_sargable_pattern() const
}
+SEL_TREE *Item_func_like::get_mm_tree(RANGE_OPT_PARAM *param, Item **cond_ptr)
+{
+ MEM_ROOT *tmp_root= param->mem_root;
+ param->thd->mem_root= param->old_root;
+ bool sargable_pattern= with_sargable_pattern();
+ param->thd->mem_root= tmp_root;
+ return sargable_pattern ?
+ Item_bool_func2::get_mm_tree(param, cond_ptr) :
+ Item_func::get_mm_tree(param, cond_ptr);
+}
+
+
bool fix_escape_item(THD *thd, Item *escape_item, String *tmp_str,
bool escape_used_in_parsing, CHARSET_INFO *cmp_cs,
int *escape)
diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h
index cb51b1dda82..1a2cc3a6c81 100644
--- a/sql/item_cmpfunc.h
+++ b/sql/item_cmpfunc.h
@@ -1948,12 +1948,7 @@ public:
}
void add_key_fields(JOIN *join, KEY_FIELD **key_fields, uint *and_level,
table_map usable_tables, SARGABLE_PARAM **sargables);
- SEL_TREE *get_mm_tree(RANGE_OPT_PARAM *param, Item **cond_ptr)
- {
- return with_sargable_pattern() ?
- Item_bool_func2::get_mm_tree(param, cond_ptr) :
- Item_func::get_mm_tree(param, cond_ptr);
- }
+ SEL_TREE *get_mm_tree(RANGE_OPT_PARAM *param, Item **cond_ptr);
Item* propagate_equal_fields(THD *thd, const Context &ctx, COND_EQUAL *cond)
{
/*
diff --git a/sql/item_func.cc b/sql/item_func.cc
index 2e0596da2d1..ed527cda218 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -3890,12 +3890,7 @@ longlong Item_master_pos_wait::val_int()
else
connection_name= thd->variables.default_master_connection;
- mysql_mutex_lock(&LOCK_active_mi);
- if (master_info_index) // master_info_index is set to NULL on shutdown.
- mi= master_info_index->get_master_info(&connection_name,
- Sql_condition::WARN_LEVEL_WARN);
- mysql_mutex_unlock(&LOCK_active_mi);
- if (!mi)
+ if (!(mi= get_master_info(&connection_name, Sql_condition::WARN_LEVEL_WARN)))
goto err;
if ((event_count = mi->rli.wait_for_pos(thd, log_name, pos, timeout)) == -2)
@@ -3903,6 +3898,7 @@ longlong Item_master_pos_wait::val_int()
null_value = 1;
event_count=0;
}
+ mi->release();
#endif
return event_count;
diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc
index 21f8ccb4348..b34f9fd1b58 100644
--- a/sql/item_strfunc.cc
+++ b/sql/item_strfunc.cc
@@ -33,9 +33,6 @@
#include <my_global.h> // HAVE_*
-/* May include caustic 3rd-party defs. Use early, so it can override nothing */
-#include "sha2.h"
-
#include "sql_priv.h"
/*
It is necessary to include set_var.h instead of item.h because there
@@ -51,9 +48,7 @@
#include "password.h" // my_make_scrambled_password,
// my_make_scrambled_password_323
#include <m_ctype.h>
-#include <base64.h>
#include <my_md5.h>
-#include "sha1.h"
C_MODE_START
#include "../mysys/my_static.h" // For soundex_map
C_MODE_END
@@ -171,14 +166,14 @@ String *Item_func_sha::val_str_ascii(String *str)
if (sptr) /* If we got value different from NULL */
{
/* Temporary buffer to store 160bit digest */
- uint8 digest[SHA1_HASH_SIZE];
- compute_sha1_hash(digest, (const char *) sptr->ptr(), sptr->length());
+ uint8 digest[MY_SHA1_HASH_SIZE];
+ my_sha1(digest, (const char *) sptr->ptr(), sptr->length());
/* Ensure that memory is free and we got result */
- if (!str->alloc(SHA1_HASH_SIZE*2))
+ if (!str->alloc(MY_SHA1_HASH_SIZE*2))
{
- array_to_hex((char *) str->ptr(), digest, SHA1_HASH_SIZE);
+ array_to_hex((char *) str->ptr(), digest, MY_SHA1_HASH_SIZE);
str->set_charset(&my_charset_numeric);
- str->length((uint) SHA1_HASH_SIZE*2);
+ str->length((uint) MY_SHA1_HASH_SIZE*2);
null_value=0;
return str;
}
@@ -190,18 +185,16 @@ String *Item_func_sha::val_str_ascii(String *str)
void Item_func_sha::fix_length_and_dec()
{
// size of hex representation of hash
- fix_length_and_charset(SHA1_HASH_SIZE * 2, default_charset());
+ fix_length_and_charset(MY_SHA1_HASH_SIZE * 2, default_charset());
}
String *Item_func_sha2::val_str_ascii(String *str)
{
DBUG_ASSERT(fixed == 1);
-#if defined(HAVE_OPENSSL) && !defined(EMBEDDED_LIBRARY)
- unsigned char digest_buf[SHA512_DIGEST_LENGTH];
+ unsigned char digest_buf[512/8]; // enough for SHA512
String *input_string;
- unsigned char *input_ptr;
+ const char *input_ptr;
size_t input_len;
- uint digest_length= 0;
str->set_charset(&my_charset_bin);
@@ -216,31 +209,26 @@ String *Item_func_sha2::val_str_ascii(String *str)
if (null_value)
return (String *) NULL;
- input_ptr= (unsigned char *) input_string->ptr();
+ input_ptr= input_string->ptr();
input_len= input_string->length();
- switch ((uint) args[1]->val_int()) {
-#ifndef OPENSSL_NO_SHA512
+ longlong digest_length= args[1]->val_int();
+ switch (digest_length) {
case 512:
- digest_length= SHA512_DIGEST_LENGTH;
- (void) SHA512(input_ptr, input_len, digest_buf);
+ my_sha512(digest_buf, input_ptr, input_len);
break;
case 384:
- digest_length= SHA384_DIGEST_LENGTH;
- (void) SHA384(input_ptr, input_len, digest_buf);
+ my_sha384(digest_buf, input_ptr, input_len);
break;
-#endif
-#ifndef OPENSSL_NO_SHA256
case 224:
- digest_length= SHA224_DIGEST_LENGTH;
- (void) SHA224(input_ptr, input_len, digest_buf);
+ my_sha224(digest_buf, input_ptr, input_len);
break;
- case 256:
case 0: // SHA-256 is the default
- digest_length= SHA256_DIGEST_LENGTH;
- (void) SHA256(input_ptr, input_len, digest_buf);
+ digest_length= 256;
+ /* fall trough */
+ case 256:
+ my_sha256(digest_buf, input_ptr, input_len);
break;
-#endif
default:
if (!args[1]->const_item())
{
@@ -254,6 +242,7 @@ String *Item_func_sha2::val_str_ascii(String *str)
null_value= TRUE;
return NULL;
}
+ digest_length/= 8; /* bits to bytes */
/*
Since we're subverting the usual String methods, we must make sure that
@@ -269,17 +258,6 @@ String *Item_func_sha2::val_str_ascii(String *str)
null_value= FALSE;
return str;
-
-#else
- THD *thd= current_thd;
- push_warning_printf(thd,
- Sql_condition::WARN_LEVEL_WARN,
- ER_FEATURE_DISABLED,
- ER_THD(thd, ER_FEATURE_DISABLED),
- "sha2", "--with-ssl");
- null_value= TRUE;
- return (String *) NULL;
-#endif /* defined(HAVE_OPENSSL) && !defined(EMBEDDED_LIBRARY) */
}
@@ -288,27 +266,18 @@ void Item_func_sha2::fix_length_and_dec()
maybe_null= 1;
max_length = 0;
-#if defined(HAVE_OPENSSL) && !defined(EMBEDDED_LIBRARY)
int sha_variant= args[1]->const_item() ? args[1]->val_int() : 512;
switch (sha_variant) {
-#ifndef OPENSSL_NO_SHA512
+ case 0: // SHA-256 is the default
+ sha_variant= 256;
+ /* fall trough */
case 512:
- fix_length_and_charset(SHA512_DIGEST_LENGTH * 2, default_charset());
- break;
case 384:
- fix_length_and_charset(SHA384_DIGEST_LENGTH * 2, default_charset());
- break;
-#endif
-#ifndef OPENSSL_NO_SHA256
case 256:
- case 0: // SHA-256 is the default
- fix_length_and_charset(SHA256_DIGEST_LENGTH * 2, default_charset());
- break;
case 224:
- fix_length_and_charset(SHA224_DIGEST_LENGTH * 2, default_charset());
+ fix_length_and_charset(sha_variant/8 * 2, default_charset());
break;
-#endif
default:
THD *thd= current_thd;
push_warning_printf(thd,
@@ -317,15 +286,6 @@ void Item_func_sha2::fix_length_and_dec()
ER_THD(thd, ER_WRONG_PARAMETERS_TO_NATIVE_FCT),
"sha2");
}
-
-#else
- THD *thd= current_thd;
- push_warning_printf(thd,
- Sql_condition::WARN_LEVEL_WARN,
- ER_FEATURE_DISABLED,
- ER_THD(thd, ER_FEATURE_DISABLED),
- "sha2", "--with-ssl");
-#endif /* defined(HAVE_OPENSSL) && !defined(EMBEDDED_LIBRARY) */
}
/* Implementation of AES encryption routines */
@@ -5203,4 +5163,3 @@ null:
my_free(names);
return NULL;
}
-
diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc
index 94bc71ca889..76c754d5627 100644
--- a/sql/item_subselect.cc
+++ b/sql/item_subselect.cc
@@ -934,7 +934,7 @@ void Item_subselect::update_used_tables()
if (!forced_const)
{
recalc_used_tables(parent_select, FALSE);
- if (!engine->uncacheable())
+ if (!(engine->uncacheable() & ~UNCACHEABLE_EXPLAIN))
{
// did all used tables become static?
if (!(used_tables_cache & ~engine->upper_select_const_tables()))
@@ -2113,6 +2113,7 @@ Item_in_subselect::create_single_in_to_exists_cond(JOIN *join,
We can encounter "NULL IN (SELECT ...)". Wrap the added condition
within a trig_cond.
*/
+ disable_cond_guard_for_const_null_left_expr(0);
item= new (thd->mem_root) Item_func_trig_cond(thd, item, get_cond_guard(0));
}
@@ -2137,6 +2138,7 @@ Item_in_subselect::create_single_in_to_exists_cond(JOIN *join,
having= new (thd->mem_root) Item_is_not_null_test(thd, this, having);
if (left_expr->maybe_null)
{
+ disable_cond_guard_for_const_null_left_expr(0);
if (!(having= new (thd->mem_root) Item_func_trig_cond(thd, having,
get_cond_guard(0))))
DBUG_RETURN(true);
@@ -2155,6 +2157,7 @@ Item_in_subselect::create_single_in_to_exists_cond(JOIN *join,
*/
if (!abort_on_null && left_expr->maybe_null)
{
+ disable_cond_guard_for_const_null_left_expr(0);
if (!(item= new (thd->mem_root) Item_func_trig_cond(thd, item,
get_cond_guard(0))))
DBUG_RETURN(true);
@@ -2184,6 +2187,7 @@ Item_in_subselect::create_single_in_to_exists_cond(JOIN *join,
(char *)"<result>"));
if (!abort_on_null && left_expr->maybe_null)
{
+ disable_cond_guard_for_const_null_left_expr(0);
if (!(new_having= new (thd->mem_root) Item_func_trig_cond(thd, new_having,
get_cond_guard(0))))
DBUG_RETURN(true);
@@ -2383,6 +2387,7 @@ Item_in_subselect::create_row_in_to_exists_cond(JOIN * join,
Item_cond_or(thd, item_eq, item_isnull);
if (!abort_on_null && left_expr->element_index(i)->maybe_null)
{
+ disable_cond_guard_for_const_null_left_expr(i);
if (!(col_item= new (thd->mem_root)
Item_func_trig_cond(thd, col_item, get_cond_guard(i))))
DBUG_RETURN(true);
@@ -2400,6 +2405,7 @@ Item_in_subselect::create_row_in_to_exists_cond(JOIN * join,
(char *)"<list ref>"));
if (!abort_on_null && left_expr->element_index(i)->maybe_null)
{
+ disable_cond_guard_for_const_null_left_expr(i);
if (!(item_nnull_test=
new (thd->mem_root)
Item_func_trig_cond(thd, item_nnull_test, get_cond_guard(i))))
@@ -2460,6 +2466,7 @@ Item_in_subselect::create_row_in_to_exists_cond(JOIN * join,
item= new (thd->mem_root) Item_cond_or(thd, item, item_isnull);
if (left_expr->element_index(i)->maybe_null)
{
+ disable_cond_guard_for_const_null_left_expr(i);
if (!(item= new (thd->mem_root)
Item_func_trig_cond(thd, item, get_cond_guard(i))))
DBUG_RETURN(true);
diff --git a/sql/item_subselect.h b/sql/item_subselect.h
index 805e8958246..aa01f571a3d 100644
--- a/sql/item_subselect.h
+++ b/sql/item_subselect.h
@@ -633,6 +633,15 @@ public:
bool expr_cache_is_needed(THD *thd);
inline bool left_expr_has_null();
+ void disable_cond_guard_for_const_null_left_expr(int i)
+ {
+ if (left_expr->const_item() && !left_expr->is_expensive())
+ {
+ if (left_expr->element_index(i)->is_null())
+ set_cond_guard_var(i,FALSE);
+ }
+ }
+
int optimize(double *out_rows, double *cost);
/*
Return the identifier that we could use to identify the subquery for the
diff --git a/sql/log.cc b/sql/log.cc
index 7ad9790bb13..64c7698e2a2 100644
--- a/sql/log.cc
+++ b/sql/log.cc
@@ -2793,16 +2793,16 @@ int MYSQL_LOG::generate_new_name(char *new_name, const char *log_name,
void MYSQL_QUERY_LOG::reopen_file()
{
char *save_name;
-
DBUG_ENTER("MYSQL_LOG::reopen_file");
+
+ mysql_mutex_lock(&LOCK_log);
if (!is_open())
{
DBUG_PRINT("info",("log is closed"));
+ mysql_mutex_unlock(&LOCK_log);
DBUG_VOID_RETURN;
}
- mysql_mutex_lock(&LOCK_log);
-
save_name= name;
name= 0; // Don't free name
close(LOG_CLOSE_TO_BE_OPENED);
@@ -2960,13 +2960,6 @@ bool MYSQL_QUERY_LOG::write(THD *thd, time_t current_time,
DBUG_ENTER("MYSQL_QUERY_LOG::write");
mysql_mutex_lock(&LOCK_log);
-
- if (!is_open())
- {
- mysql_mutex_unlock(&LOCK_log);
- DBUG_RETURN(0);
- }
-
if (is_open())
{ // Safety agains reopen
int tmp_errno= 0;
@@ -3216,7 +3209,9 @@ void MYSQL_BIN_LOG::cleanup()
stop_background_thread();
inited= 0;
+ mysql_mutex_lock(&LOCK_log);
close(LOG_CLOSE_INDEX|LOG_CLOSE_STOP_EVENT);
+ mysql_mutex_unlock(&LOCK_log);
delete description_event_for_queue;
delete description_event_for_exec;
@@ -3383,6 +3378,8 @@ bool MYSQL_BIN_LOG::open(const char *log_name,
DBUG_ENTER("MYSQL_BIN_LOG::open");
DBUG_PRINT("enter",("log_type: %d",(int) log_type_arg));
+ mysql_mutex_assert_owner(&LOCK_log);
+
if (!is_relay_log)
{
if (!binlog_state_recover_done)
@@ -4342,7 +4339,7 @@ void MYSQL_BIN_LOG::wait_for_last_checkpoint_event()
int MYSQL_BIN_LOG::purge_first_log(Relay_log_info* rli, bool included)
{
- int error;
+ int error, errcode;
char *to_purge_if_included= NULL;
inuse_relaylog *ir;
ulonglong log_space_reclaimed= 0;
@@ -4412,7 +4409,8 @@ int MYSQL_BIN_LOG::purge_first_log(Relay_log_info* rli, bool included)
}
/* Store where we are in the new file for the execution thread */
- rli->flush();
+ if (rli->flush())
+ error= LOG_INFO_IO;
DBUG_EXECUTE_IF("crash_before_purge_logs", DBUG_SUICIDE(););
@@ -4428,10 +4426,10 @@ int MYSQL_BIN_LOG::purge_first_log(Relay_log_info* rli, bool included)
* Need to update the log pos because purge logs has been called
* after fetching initially the log pos at the beginning of the method.
*/
- if((error=find_log_pos(&rli->linfo, rli->event_relay_log_name, 0)))
+ if ((errcode= find_log_pos(&rli->linfo, rli->event_relay_log_name, 0)))
{
sql_print_error("next log error: %d offset: %llu log: %s included: %d",
- error, rli->linfo.index_file_offset,
+ errcode, rli->linfo.index_file_offset,
rli->group_relay_log_name, included);
goto err;
}
@@ -5055,19 +5053,19 @@ int MYSQL_BIN_LOG::new_file_impl(bool need_lock)
File UNINIT_VAR(old_file);
DBUG_ENTER("MYSQL_BIN_LOG::new_file_impl");
+ if (need_lock)
+ mysql_mutex_lock(&LOCK_log);
+ mysql_mutex_assert_owner(&LOCK_log);
+
if (!is_open())
{
DBUG_PRINT("info",("log is closed"));
+ mysql_mutex_unlock(&LOCK_log);
DBUG_RETURN(error);
}
- if (need_lock)
- mysql_mutex_lock(&LOCK_log);
mysql_mutex_lock(&LOCK_index);
- mysql_mutex_assert_owner(&LOCK_log);
- mysql_mutex_assert_owner(&LOCK_index);
-
/* Reuse old name if not binlog and not update log */
new_name_ptr= name;
@@ -5202,9 +5200,9 @@ end:
new_name_ptr, errno);
}
+ mysql_mutex_unlock(&LOCK_index);
if (need_lock)
mysql_mutex_unlock(&LOCK_log);
- mysql_mutex_unlock(&LOCK_index);
DBUG_RETURN(error);
}
@@ -8145,9 +8143,11 @@ int MYSQL_BIN_LOG::wait_for_update_binlog_end_pos(THD* thd,
void MYSQL_BIN_LOG::close(uint exiting)
{ // One can't set log_type here!
bool failed_to_save_state= false;
-
DBUG_ENTER("MYSQL_BIN_LOG::close");
DBUG_PRINT("enter",("exiting: %d", (int) exiting));
+
+ mysql_mutex_assert_owner(&LOCK_log);
+
if (log_state == LOG_OPENED)
{
#ifdef HAVE_REPLICATION
diff --git a/sql/log_event.cc b/sql/log_event.cc
index 69d0f52d211..3aea3eaf2f1 100644
--- a/sql/log_event.cc
+++ b/sql/log_event.cc
@@ -46,7 +46,6 @@
#include "wsrep_mysqld.h"
#endif /* MYSQL_CLIENT */
-#include <base64.h>
#include <my_bitmap.h>
#include "rpl_utility.h"
#include "rpl_constants.h"
@@ -7219,9 +7218,11 @@ bool Rotate_log_event::write()
@retval
0 ok
+ 1 error
*/
int Rotate_log_event::do_update_pos(rpl_group_info *rgi)
{
+ int error= 0;
Relay_log_info *rli= rgi->rli;
DBUG_ENTER("Rotate_log_event::do_update_pos");
@@ -7270,7 +7271,7 @@ int Rotate_log_event::do_update_pos(rpl_group_info *rgi)
(ulong) rli->group_master_log_pos));
mysql_mutex_unlock(&rli->data_lock);
rpl_global_gtid_slave_state->record_and_update_gtid(thd, rgi);
- rli->flush();
+ error= rli->flush();
/*
Reset thd->variables.option_bits and sql_mode etc, because this could
@@ -7288,8 +7289,7 @@ int Rotate_log_event::do_update_pos(rpl_group_info *rgi)
else
rgi->inc_event_relay_log_pos();
-
- DBUG_RETURN(0);
+ DBUG_RETURN(error);
}
@@ -9053,6 +9053,7 @@ void Stop_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info)
int Stop_log_event::do_update_pos(rpl_group_info *rgi)
{
+ int error= 0;
Relay_log_info *rli= rgi->rli;
DBUG_ENTER("Stop_log_event::do_update_pos");
/*
@@ -9068,9 +9069,10 @@ int Stop_log_event::do_update_pos(rpl_group_info *rgi)
{
rpl_global_gtid_slave_state->record_and_update_gtid(thd, rgi);
rli->inc_group_relay_log_pos(0, rgi);
- rli->flush();
+ if (rli->flush())
+ error= 1;
}
- DBUG_RETURN(0);
+ DBUG_RETURN(error);
}
#endif /* !MYSQL_CLIENT */
@@ -11154,8 +11156,8 @@ int
Rows_log_event::do_update_pos(rpl_group_info *rgi)
{
Relay_log_info *rli= rgi->rli;
- DBUG_ENTER("Rows_log_event::do_update_pos");
int error= 0;
+ DBUG_ENTER("Rows_log_event::do_update_pos");
DBUG_PRINT("info", ("flags: %s",
get_flags(STMT_END_F) ? "STMT_END_F " : ""));
@@ -11167,7 +11169,7 @@ Rows_log_event::do_update_pos(rpl_group_info *rgi)
Step the group log position if we are not in a transaction,
otherwise increase the event log position.
*/
- rli->stmt_done(log_pos, thd, rgi);
+ error= rli->stmt_done(log_pos, thd, rgi);
/*
Clear any errors in thd->net.last_err*. It is not known if this is
needed or not. It is believed that any errors that may exist in
diff --git a/sql/log_event_old.cc b/sql/log_event_old.cc
index 552221ee68a..381f4129321 100644
--- a/sql/log_event_old.cc
+++ b/sql/log_event_old.cc
@@ -1745,8 +1745,8 @@ int
Old_rows_log_event::do_update_pos(rpl_group_info *rgi)
{
Relay_log_info *rli= rgi->rli;
- DBUG_ENTER("Old_rows_log_event::do_update_pos");
int error= 0;
+ DBUG_ENTER("Old_rows_log_event::do_update_pos");
DBUG_PRINT("info", ("flags: %s",
get_flags(STMT_END_F) ? "STMT_END_F " : ""));
@@ -1758,7 +1758,7 @@ Old_rows_log_event::do_update_pos(rpl_group_info *rgi)
Step the group log position if we are not in a transaction,
otherwise increase the event log position.
*/
- rli->stmt_done(log_pos, thd, rgi);
+ error= rli->stmt_done(log_pos, thd, rgi);
/*
Clear any errors in thd->net.last_err*. It is not known if this is
needed or not. It is believed that any errors that may exist in
diff --git a/sql/log_slow.h b/sql/log_slow.h
index c641d2be87d..c52722f0cd7 100644
--- a/sql/log_slow.h
+++ b/sql/log_slow.h
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
/* Defining what to log to slow log */
diff --git a/sql/mdl.cc b/sql/mdl.cc
index c05fdc0157b..f1a505f3d84 100644
--- a/sql/mdl.cc
+++ b/sql/mdl.cc
@@ -2126,7 +2126,8 @@ MDL_context::acquire_lock(MDL_request *mdl_request, double lock_wait_timeout)
find_deadlock();
struct timespec abs_timeout, abs_shortwait;
- set_timespec(abs_timeout, (ulonglong) lock_wait_timeout);
+ set_timespec_nsec(abs_timeout,
+ (ulonglong)(lock_wait_timeout * 1000000000ULL));
set_timespec(abs_shortwait, 1);
wait_status= MDL_wait::EMPTY;
diff --git a/sql/multi_range_read.cc b/sql/multi_range_read.cc
index 5de9b4a9eec..53d0c3204a1 100644
--- a/sql/multi_range_read.cc
+++ b/sql/multi_range_read.cc
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#include "sql_parse.h"
#include <my_bit.h>
diff --git a/sql/multi_range_read.h b/sql/multi_range_read.h
index ffae6d63124..b8234998f74 100644
--- a/sql/multi_range_read.h
+++ b/sql/multi_range_read.h
@@ -12,7 +12,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
/**
@defgroup DS-MRR declarations
diff --git a/sql/my_apc.cc b/sql/my_apc.cc
index dcb8503b880..b165a801ce5 100644
--- a/sql/my_apc.cc
+++ b/sql/my_apc.cc
@@ -12,7 +12,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#ifndef MY_APC_STANDALONE
diff --git a/sql/my_apc.h b/sql/my_apc.h
index 20b1ee4c4ec..46c6fbd549d 100644
--- a/sql/my_apc.h
+++ b/sql/my_apc.h
@@ -14,7 +14,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
/*
Interface
diff --git a/sql/my_json_writer.cc b/sql/my_json_writer.cc
index 135ce353552..390123fbba9 100644
--- a/sql/my_json_writer.cc
+++ b/sql/my_json_writer.cc
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#include <my_global.h>
#include "sql_priv.h"
diff --git a/sql/my_json_writer.h b/sql/my_json_writer.h
index 8ab20b10d73..c4b528ae10d 100644
--- a/sql/my_json_writer.h
+++ b/sql/my_json_writer.h
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
class Json_writer;
diff --git a/sql/mysql_install_db.cc b/sql/mysql_install_db.cc
index 58f19c427aa..5960346c60e 100644
--- a/sql/mysql_install_db.cc
+++ b/sql/mysql_install_db.cc
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
/*
mysql_install_db creates a new database instance (optionally as service)
@@ -393,8 +393,8 @@ static int register_service()
CloseServiceHandle(sc_manager);
die("CreateService failed (%u)", GetLastError());
}
-
- SERVICE_DESCRIPTION sd= { "MariaDB database server" };
+ char description[] = "MariaDB database server";
+ SERVICE_DESCRIPTION sd= { description };
ChangeServiceConfig2(sc_service, SERVICE_CONFIG_DESCRIPTION, &sd);
CloseServiceHandle(sc_service);
CloseServiceHandle(sc_manager);
diff --git a/sql/mysql_upgrade_service.cc b/sql/mysql_upgrade_service.cc
index db916101eb1..36de05e54e4 100644
--- a/sql/mysql_upgrade_service.cc
+++ b/sql/mysql_upgrade_service.cc
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
/*
mysql_upgrade_service upgrades mysql service on Windows.
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index 7b8e3ee0ee6..6108ed6ffd4 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -21,7 +21,7 @@
#ifndef __WIN__
#include <netdb.h> // getservbyname, servent
#endif
-#include "sql_parse.h" // test_if_data_home_dir
+#include "sql_parse.h" // path_starts_from_data_home_dir
#include "sql_cache.h" // query_cache, query_cache_*
#include "sql_locale.h" // MY_LOCALES, my_locales, my_locale_by_name
#include "sql_show.h" // free_status_vars, add_status_vars,
@@ -750,12 +750,15 @@ mysql_mutex_t
LOCK_delayed_insert, LOCK_delayed_status, LOCK_delayed_create,
LOCK_crypt,
LOCK_global_system_variables,
- LOCK_user_conn, LOCK_slave_list, LOCK_active_mi,
+ LOCK_user_conn, LOCK_slave_list,
LOCK_connection_count, LOCK_error_messages, LOCK_slave_background;
mysql_mutex_t LOCK_stats, LOCK_global_user_client_stats,
LOCK_global_table_stats, LOCK_global_index_stats;
+/* This protects against changes in master_info_index */
+mysql_mutex_t LOCK_active_mi;
+
/**
The below lock protects access to two global server variables:
max_prepared_stmt_count and prepared_stmt_count. These variables
@@ -913,7 +916,7 @@ PSI_mutex_key key_BINLOG_LOCK_index, key_BINLOG_LOCK_xid_list,
key_LOCK_system_variables_hash, key_LOCK_thd_data,
key_LOCK_user_conn, key_LOCK_uuid_short_generator, key_LOG_LOCK_log,
key_master_info_data_lock, key_master_info_run_lock,
- key_master_info_sleep_lock,
+ key_master_info_sleep_lock, key_master_info_start_stop_lock,
key_mutex_slave_reporting_capability_err_lock, key_relay_log_info_data_lock,
key_rpl_group_info_sleep_lock,
key_relay_log_info_log_space_lock, key_relay_log_info_run_lock,
@@ -986,6 +989,7 @@ static PSI_mutex_info all_server_mutexes[]=
{ &key_LOCK_uuid_short_generator, "LOCK_uuid_short_generator", PSI_FLAG_GLOBAL},
{ &key_LOG_LOCK_log, "LOG::LOCK_log", 0},
{ &key_master_info_data_lock, "Master_info::data_lock", 0},
+ { &key_master_info_start_stop_lock, "Master_info::start_stop_lock", 0},
{ &key_master_info_run_lock, "Master_info::run_lock", 0},
{ &key_master_info_sleep_lock, "Master_info::sleep_lock", 0},
{ &key_mutex_slave_reporting_capability_err_lock, "Slave_reporting_capability::err_lock", 0},
@@ -1478,7 +1482,7 @@ ulong query_cache_min_res_unit= QUERY_CACHE_MIN_RESULT_DATA_SIZE;
Query_cache query_cache;
#endif
#ifdef HAVE_SMEM
-char *shared_memory_base_name= default_shared_memory_base_name;
+const char *shared_memory_base_name= default_shared_memory_base_name;
my_bool opt_enable_shared_memory;
HANDLE smem_event_connect_request= 0;
#endif
@@ -1719,7 +1723,7 @@ static void close_connections(void)
mysql_mutex_unlock(&LOCK_thread_count); // For unlink from list
Events::deinit();
- end_slave();
+ slave_prepare_for_shutdown();
mysql_bin_log.stop_background_thread();
/*
@@ -1798,6 +1802,7 @@ static void close_connections(void)
DBUG_PRINT("quit",("Unlocking LOCK_thread_count"));
mysql_mutex_unlock(&LOCK_thread_count);
}
+ end_slave();
/* All threads has now been aborted */
DBUG_PRINT("quit",("Waiting for threads to die (count=%u)",thread_count));
mysql_mutex_lock(&LOCK_thread_count);
@@ -2605,6 +2610,12 @@ static MYSQL_SOCKET activate_tcp_port(uint port)
(char*)&arg, sizeof(arg));
}
#endif
+
+#ifdef IP_FREEBIND
+ arg= 1;
+ (void) mysql_socket_setsockopt(ip_sock, IPPROTO_IP, IP_FREEBIND, (char*) &arg,
+ sizeof(arg));
+#endif
/*
Sometimes the port is not released fast enough when stopping and
restarting the server. This happens quite often with the test suite
@@ -2836,31 +2847,8 @@ void dec_connection_count(scheduler_functions *scheduler)
/*
- Delete THD and decrement thread counters, including thread_running
-
- This is mainly used to delete event threads which are not increasing
- global counters.
-*/
-
-void delete_running_thd(THD *thd)
-{
- thd->add_status_to_global();
- unlink_not_visible_thd(thd);
-
- delete thd;
- dec_thread_running();
-}
-
-/*
- Decrease number of threads. Signal when it reaches 0
-
- SYNOPSIS
- dec_thread_count()
-*/
-
-/*
- Send a signal to unblock close_conneciton() / rpl_slave_init_thread()
- if there is no more threads running with a THD attached
+ Send a signal to unblock close_conneciton() if there is no more
+ threads running with a THD attached
It's safe to check for thread_count and service_thread_count outside
of a mutex as we are only interested to see if they where decremented
@@ -5404,15 +5392,13 @@ static int init_server_components()
if (opt_bin_log)
{
- /**
- * mutex lock is not needed here.
- * but to be able to have mysql_mutex_assert_owner() in code,
- * we do it anyway */
- mysql_mutex_lock(mysql_bin_log.get_log_lock());
- int r= mysql_bin_log.open(opt_bin_logname, LOG_BIN, 0, 0,
+ int error;
+ mysql_mutex_t *log_lock= mysql_bin_log.get_log_lock();
+ mysql_mutex_lock(log_lock);
+ error= mysql_bin_log.open(opt_bin_logname, LOG_BIN, 0, 0,
WRITE_CACHE, max_binlog_size, 0, TRUE);
- mysql_mutex_unlock(mysql_bin_log.get_log_lock());
- if (r)
+ mysql_mutex_unlock(log_lock);
+ if (error)
unireg_abort(1);
}
@@ -7722,17 +7708,14 @@ static int show_slave_running(THD *thd, SHOW_VAR *var, char *buff,
var->type= SHOW_MY_BOOL;
var->value= buff;
- mysql_mutex_lock(&LOCK_active_mi);
- if (master_info_index)
+
+ if ((mi= get_master_info(&thd->variables.default_master_connection,
+ Sql_condition::WARN_LEVEL_NOTE)))
{
- mi= master_info_index->
- get_master_info(&thd->variables.default_master_connection,
- Sql_condition::WARN_LEVEL_NOTE);
- if (mi)
- tmp= (my_bool) (mi->slave_running == MYSQL_SLAVE_RUN_READING &&
- mi->rli.slave_running != MYSQL_SLAVE_NOT_RUN);
+ tmp= (my_bool) (mi->slave_running == MYSQL_SLAVE_RUN_READING &&
+ mi->rli.slave_running != MYSQL_SLAVE_NOT_RUN);
+ mi->release();
}
- mysql_mutex_unlock(&LOCK_active_mi);
if (mi)
*((my_bool *)buff)= tmp;
else
@@ -7764,14 +7747,9 @@ static int show_slaves_running(THD *thd, SHOW_VAR *var, char *buff)
{
var->type= SHOW_LONGLONG;
var->value= buff;
- mysql_mutex_lock(&LOCK_active_mi);
- if (master_info_index)
- *((longlong *)buff)= master_info_index->any_slave_sql_running();
- else
- *((longlong *)buff)= 0;
+ *((longlong *)buff)= any_slave_sql_running();
- mysql_mutex_unlock(&LOCK_active_mi);
return 0;
}
@@ -7779,23 +7757,17 @@ static int show_slaves_running(THD *thd, SHOW_VAR *var, char *buff)
static int show_slave_received_heartbeats(THD *thd, SHOW_VAR *var, char *buff,
enum enum_var_type scope)
{
- Master_info *mi= NULL;
- longlong UNINIT_VAR(tmp);
+ Master_info *mi;
var->type= SHOW_LONGLONG;
var->value= buff;
- mysql_mutex_lock(&LOCK_active_mi);
- if (master_info_index)
+
+ if ((mi= get_master_info(&thd->variables.default_master_connection,
+ Sql_condition::WARN_LEVEL_NOTE)))
{
- mi= master_info_index->
- get_master_info(&thd->variables.default_master_connection,
- Sql_condition::WARN_LEVEL_NOTE);
- if (mi)
- tmp= mi->received_heartbeats;
+ *((longlong *)buff)= mi->received_heartbeats;
+ mi->release();
}
- mysql_mutex_unlock(&LOCK_active_mi);
- if (mi)
- *((longlong *)buff)= tmp;
else
var->type= SHOW_UNDEF;
return 0;
@@ -7805,23 +7777,17 @@ static int show_slave_received_heartbeats(THD *thd, SHOW_VAR *var, char *buff,
static int show_heartbeat_period(THD *thd, SHOW_VAR *var, char *buff,
enum enum_var_type scope)
{
- Master_info *mi= NULL;
- float UNINIT_VAR(tmp);
+ Master_info *mi;
var->type= SHOW_CHAR;
var->value= buff;
- mysql_mutex_lock(&LOCK_active_mi);
- if (master_info_index)
+
+ if ((mi= get_master_info(&thd->variables.default_master_connection,
+ Sql_condition::WARN_LEVEL_NOTE)))
{
- mi= master_info_index->
- get_master_info(&thd->variables.default_master_connection,
- Sql_condition::WARN_LEVEL_NOTE);
- if (mi)
- tmp= mi->heartbeat_period;
+ sprintf(buff, "%.3f", mi->heartbeat_period);
+ mi->release();
}
- mysql_mutex_unlock(&LOCK_active_mi);
- if (mi)
- sprintf(buff, "%.3f", tmp);
else
var->type= SHOW_UNDEF;
return 0;
@@ -8712,7 +8678,7 @@ static int mysql_init_variables(void)
mysql_home[0]= pidfile_name[0]= log_error_file[0]= 0;
#if defined(HAVE_REALPATH) && !defined(HAVE_valgrind) && !defined(HAVE_BROKEN_REALPATH)
/* We can only test for sub paths if my_symlink.c is using realpath */
- myisam_test_invalid_symlink= test_if_data_home_dir;
+ mysys_test_invalid_symlink= path_starts_from_data_home_dir;
#endif
opt_log= 0;
opt_bin_log= opt_bin_log_used= 0;
diff --git a/sql/mysqld.h b/sql/mysqld.h
index 8f74194181a..613b57b133d 100644
--- a/sql/mysqld.h
+++ b/sql/mysqld.h
@@ -85,7 +85,6 @@ void kill_mysql(THD *thd= 0);
void close_connection(THD *thd, uint sql_errno= 0);
void handle_connection_in_main_thread(CONNECT *thd);
void create_thread_to_handle_connection(CONNECT *connect);
-void delete_running_thd(THD *thd);
void signal_thd_deleted();
void unlink_thd(THD *thd);
bool one_thread_per_connection_end(THD *thd, bool put_in_cache);
@@ -146,7 +145,8 @@ extern my_bool sp_automatic_privileges, opt_noacl;
extern ulong use_stat_tables;
extern my_bool opt_old_style_user_limits, trust_function_creators;
extern uint opt_crash_binlog_innodb;
-extern char *shared_memory_base_name, *mysqld_unix_port;
+extern const char *shared_memory_base_name;
+extern char *mysqld_unix_port;
extern my_bool opt_enable_shared_memory;
extern ulong opt_replicate_events_marked_for_skip;
extern char *default_tz_name;
@@ -295,7 +295,7 @@ extern PSI_mutex_key key_BINLOG_LOCK_index, key_BINLOG_LOCK_xid_list,
key_LOCK_thd_data,
key_LOCK_user_conn, key_LOG_LOCK_log,
key_master_info_data_lock, key_master_info_run_lock,
- key_master_info_sleep_lock,
+ key_master_info_sleep_lock, key_master_info_start_stop_lock,
key_mutex_slave_reporting_capability_err_lock, key_relay_log_info_data_lock,
key_relay_log_info_log_space_lock, key_relay_log_info_run_lock,
key_rpl_group_info_sleep_lock,
diff --git a/sql/nt_servc.cc b/sql/nt_servc.cc
index d6a8eac7ed5..e05e43a0a59 100644
--- a/sql/nt_servc.cc
+++ b/sql/nt_servc.cc
@@ -508,7 +508,7 @@ BOOL NTService::IsService(LPCSTR ServiceName)
}
/* ------------------------------------------------------------------------
-------------------------------------------------------------------------- */
-BOOL NTService::got_service_option(char **argv, char *service_option)
+BOOL NTService::got_service_option(char **argv, const char *service_option)
{
char *option;
for (option= argv[1]; *option; option++)
diff --git a/sql/nt_servc.h b/sql/nt_servc.h
index 949499d8d7f..6781fe0ddfa 100644
--- a/sql/nt_servc.h
+++ b/sql/nt_servc.h
@@ -61,7 +61,7 @@ class NTService
BOOL SeekStatus(LPCSTR szInternName, int OperationType);
BOOL Remove(LPCSTR szInternName);
BOOL IsService(LPCSTR ServiceName);
- BOOL got_service_option(char **argv, char *service_option);
+ BOOL got_service_option(char **argv, const char *service_option);
BOOL is_super_user();
/*
diff --git a/sql/opt_index_cond_pushdown.cc b/sql/opt_index_cond_pushdown.cc
index a6707d458df..1dde5228263 100644
--- a/sql/opt_index_cond_pushdown.cc
+++ b/sql/opt_index_cond_pushdown.cc
@@ -12,7 +12,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#include "sql_select.h"
#include "sql_test.h"
diff --git a/sql/opt_range.cc b/sql/opt_range.cc
index 397ce6f7ecc..6d088cad91e 100644
--- a/sql/opt_range.cc
+++ b/sql/opt_range.cc
@@ -9297,6 +9297,13 @@ key_or(RANGE_OPT_PARAM *param, SEL_ARG *key1,SEL_ARG *key2)
if (!tmp->next_key_part)
{
+ if (key2->use_count)
+ {
+ SEL_ARG *key2_cpy= new SEL_ARG(*key2);
+ if (key2_cpy)
+ return 0;
+ key2= key2_cpy;
+ }
/*
tmp->next_key_part is empty: cut the range that is covered
by tmp from key2.
@@ -9328,13 +9335,6 @@ key_or(RANGE_OPT_PARAM *param, SEL_ARG *key1,SEL_ARG *key2)
key2: [---]
tmp: [---------]
*/
- if (key2->use_count)
- {
- SEL_ARG *key2_cpy= new SEL_ARG(*key2);
- if (key2_cpy)
- return 0;
- key2= key2_cpy;
- }
key2->copy_max_to_min(tmp);
continue;
}
diff --git a/sql/opt_range_mrr.cc b/sql/opt_range_mrr.cc
index fbccb7c4e1d..b3350191d13 100644
--- a/sql/opt_range_mrr.cc
+++ b/sql/opt_range_mrr.cc
@@ -12,7 +12,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
/****************************************************************************
MRR Range Sequence Interface implementation that walks a SEL_ARG* tree.
diff --git a/sql/opt_subselect.cc b/sql/opt_subselect.cc
index dc0caa32998..15b803ac49a 100644
--- a/sql/opt_subselect.cc
+++ b/sql/opt_subselect.cc
@@ -12,7 +12,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
/**
@file
diff --git a/sql/opt_subselect.h b/sql/opt_subselect.h
index 8daa973f825..7954becfad4 100644
--- a/sql/opt_subselect.h
+++ b/sql/opt_subselect.h
@@ -12,7 +12,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
/*
Semi-join subquery optimization code definitions
diff --git a/sql/opt_table_elimination.cc b/sql/opt_table_elimination.cc
index b4131093f0f..b7010d1f8ed 100644
--- a/sql/opt_table_elimination.cc
+++ b/sql/opt_table_elimination.cc
@@ -12,7 +12,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
/**
@file
diff --git a/sql/partition_info.cc b/sql/partition_info.cc
index 74c09b8a3c6..24506434a76 100644
--- a/sql/partition_info.cc
+++ b/sql/partition_info.cc
@@ -27,7 +27,7 @@
#include "sql_partition.h" // partition_info.h: LIST_PART_ENTRY
// NOT_A_PARTITION_ID
#include "partition_info.h"
-#include "sql_parse.h" // test_if_data_home_dir
+#include "sql_parse.h"
#include "sql_acl.h" // *_ACL
#include "sql_base.h" // fill_record
diff --git a/sql/password.c b/sql/password.c
index 37d06136d80..1f0a55a10fe 100644
--- a/sql/password.c
+++ b/sql/password.c
@@ -38,7 +38,7 @@
The new authentication is performed in following manner:
- SERVER: public_seed=create_random_string()
+ SERVER: public_seed=thd_create_random_password()
send(public_seed)
CLIENT: recv(public_seed)
@@ -66,7 +66,6 @@
#include <password.h>
#include <mysql.h>
#include <my_rnd.h>
-#include <sha1.h>
/************ MySQL 3.23-4.0 authentication routines: untouched ***********/
@@ -279,25 +278,6 @@ void make_password_from_salt_323(char *to, const ulong *salt)
**************** MySQL 4.1.1 authentication routines *************
*/
-/**
- Generate string of printable random characters of requested length.
-
- @param to[out] Buffer for generation; must be at least length+1 bytes
- long; result string is always null-terminated
- length[in] How many random characters to put in buffer
- rand_st Structure used for number generation
-*/
-
-void create_random_string(char *to, uint length,
- struct my_rnd_struct *rand_st)
-{
- char *end= to + length;
- /* Use pointer arithmetics as it is faster way to do so. */
- for (; to < end; to++)
- *to= (char) (my_rnd(rand_st)*94+33);
- *to= '\0';
-}
-
/* Character to use as version identifier for version 4.1 */
@@ -389,10 +369,10 @@ void compute_two_stage_sha1_hash(const char *password, size_t pass_len,
uint8 *hash_stage1, uint8 *hash_stage2)
{
/* Stage 1: hash password */
- compute_sha1_hash(hash_stage1, password, pass_len);
+ my_sha1(hash_stage1, password, pass_len);
/* Stage 2 : hash first stage's output. */
- compute_sha1_hash(hash_stage2, (const char *) hash_stage1, SHA1_HASH_SIZE);
+ my_sha1(hash_stage2, (const char *) hash_stage1, MY_SHA1_HASH_SIZE);
}
@@ -404,7 +384,7 @@ void compute_two_stage_sha1_hash(const char *password, size_t pass_len,
is stored in the database.
SYNOPSIS
my_make_scrambled_password()
- buf OUT buffer of size 2*SHA1_HASH_SIZE + 2 to store hex string
+ buf OUT buffer of size 2*MY_SHA1_HASH_SIZE + 2 to store hex string
password IN password string
pass_len IN length of password string
*/
@@ -412,14 +392,14 @@ void compute_two_stage_sha1_hash(const char *password, size_t pass_len,
void my_make_scrambled_password(char *to, const char *password,
size_t pass_len)
{
- uint8 hash_stage2[SHA1_HASH_SIZE];
+ uint8 hash_stage2[MY_SHA1_HASH_SIZE];
/* Two stage SHA1 hash of the password. */
compute_two_stage_sha1_hash(password, pass_len, (uint8 *) to, hash_stage2);
/* convert hash_stage2 to hex string */
*to++= PVERSION41_CHAR;
- octet2hex(to, (const char*) hash_stage2, SHA1_HASH_SIZE);
+ octet2hex(to, (const char*) hash_stage2, MY_SHA1_HASH_SIZE);
}
@@ -430,7 +410,7 @@ void my_make_scrambled_password(char *to, const char *password,
avoid strlen().
SYNOPSIS
make_scrambled_password()
- buf OUT buffer of size 2*SHA1_HASH_SIZE + 2 to store hex string
+ buf OUT buffer of size 2*MY_SHA1_HASH_SIZE + 2 to store hex string
password IN NULL-terminated password string
*/
@@ -451,7 +431,7 @@ void make_scrambled_password(char *to, const char *password)
SYNOPSIS
scramble()
buf OUT store scrambled string here. The buf must be at least
- SHA1_HASH_SIZE bytes long.
+ MY_SHA1_HASH_SIZE bytes long.
message IN random message, must be exactly SCRAMBLE_LENGTH long and
NULL-terminated.
password IN users' password
@@ -460,16 +440,16 @@ void make_scrambled_password(char *to, const char *password)
void
scramble(char *to, const char *message, const char *password)
{
- uint8 hash_stage1[SHA1_HASH_SIZE];
- uint8 hash_stage2[SHA1_HASH_SIZE];
+ uint8 hash_stage1[MY_SHA1_HASH_SIZE];
+ uint8 hash_stage2[MY_SHA1_HASH_SIZE];
/* Two stage SHA1 hash of the password. */
compute_two_stage_sha1_hash(password, strlen(password), hash_stage1,
hash_stage2);
/* create crypt string as sha1(message, hash_stage2) */;
- compute_sha1_hash_multi((uint8 *) to, message, SCRAMBLE_LENGTH,
- (const char *) hash_stage2, SHA1_HASH_SIZE);
+ my_sha1_multi((uint8 *) to, message, SCRAMBLE_LENGTH,
+ (const char *) hash_stage2, MY_SHA1_HASH_SIZE, NULL);
my_crypt(to, (const uchar *) to, hash_stage1, SCRAMBLE_LENGTH);
}
@@ -478,7 +458,7 @@ scramble(char *to, const char *message, const char *password)
Check that scrambled message corresponds to the password; the function
is used by server to check that received reply is authentic.
This function does not check lengths of given strings: message must be
- null-terminated, reply and hash_stage2 must be at least SHA1_HASH_SIZE
+ null-terminated, reply and hash_stage2 must be at least MY_SHA1_HASH_SIZE
long (if not, something fishy is going on).
SYNOPSIS
check_scramble()
@@ -498,19 +478,19 @@ my_bool
check_scramble(const uchar *scramble_arg, const char *message,
const uint8 *hash_stage2)
{
- uint8 buf[SHA1_HASH_SIZE];
- uint8 hash_stage2_reassured[SHA1_HASH_SIZE];
+ uint8 buf[MY_SHA1_HASH_SIZE];
+ uint8 hash_stage2_reassured[MY_SHA1_HASH_SIZE];
/* create key to encrypt scramble */
- compute_sha1_hash_multi(buf, message, SCRAMBLE_LENGTH,
- (const char *) hash_stage2, SHA1_HASH_SIZE);
+ my_sha1_multi(buf, message, SCRAMBLE_LENGTH,
+ (const char *) hash_stage2, MY_SHA1_HASH_SIZE, NULL);
/* encrypt scramble */
my_crypt((char *) buf, buf, scramble_arg, SCRAMBLE_LENGTH);
/* now buf supposedly contains hash_stage1: so we can get hash_stage2 */
- compute_sha1_hash(hash_stage2_reassured, (const char *) buf, SHA1_HASH_SIZE);
+ my_sha1(hash_stage2_reassured, (const char *) buf, MY_SHA1_HASH_SIZE);
- return MY_TEST(memcmp(hash_stage2, hash_stage2_reassured, SHA1_HASH_SIZE));
+ return MY_TEST(memcmp(hash_stage2, hash_stage2_reassured, MY_SHA1_HASH_SIZE));
}
/*
@@ -518,27 +498,27 @@ check_scramble(const uchar *scramble_arg, const char *message,
SYNOPSIS
get_salt_from_password()
- res OUT buf to hold password. Must be at least SHA1_HASH_SIZE
+ res OUT buf to hold password. Must be at least MY_SHA1_HASH_SIZE
bytes long.
password IN 4.1.1 version value of user.password
*/
void get_salt_from_password(uint8 *hash_stage2, const char *password)
{
- hex2octet(hash_stage2, password+1 /* skip '*' */, SHA1_HASH_SIZE * 2);
+ hex2octet(hash_stage2, password+1 /* skip '*' */, MY_SHA1_HASH_SIZE * 2);
}
/*
Convert scrambled password from binary form to asciiz hex string.
SYNOPSIS
make_password_from_salt()
- to OUT store resulting string here, 2*SHA1_HASH_SIZE+2 bytes
+ to OUT store resulting string here, 2*MY_SHA1_HASH_SIZE+2 bytes
salt IN password in salt format
*/
void make_password_from_salt(char *to, const uint8 *hash_stage2)
{
*to++= PVERSION41_CHAR;
- octet2hex(to, (const char*) hash_stage2, SHA1_HASH_SIZE);
+ octet2hex(to, (const char*) hash_stage2, MY_SHA1_HASH_SIZE);
}
diff --git a/sql/plistsort.c b/sql/plistsort.c
index 71d287e7b45..99657410fe0 100644
--- a/sql/plistsort.c
+++ b/sql/plistsort.c
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
/*
diff --git a/sql/rpl_mi.cc b/sql/rpl_mi.cc
index a141d238f78..f30b7e161f2 100644
--- a/sql/rpl_mi.cc
+++ b/sql/rpl_mi.cc
@@ -40,7 +40,9 @@ Master_info::Master_info(LEX_STRING *connection_name_arg,
sync_counter(0), heartbeat_period(0), received_heartbeats(0),
master_id(0), prev_master_id(0),
using_gtid(USE_GTID_NO), events_queued_since_last_gtid(0),
- gtid_reconnect_event_skip_count(0), gtid_event_seen(false)
+ gtid_reconnect_event_skip_count(0), gtid_event_seen(false),
+ in_start_all_slaves(0), in_stop_all_slaves(0),
+ users(0), killed(0)
{
host[0] = 0; user[0] = 0; password[0] = 0;
ssl_ca[0]= 0; ssl_capath[0]= 0; ssl_cert[0]= 0;
@@ -81,6 +83,8 @@ Master_info::Master_info(LEX_STRING *connection_name_arg,
bzero((char*) &file, sizeof(file));
mysql_mutex_init(key_master_info_run_lock, &run_lock, MY_MUTEX_INIT_FAST);
mysql_mutex_init(key_master_info_data_lock, &data_lock, MY_MUTEX_INIT_FAST);
+ mysql_mutex_init(key_master_info_start_stop_lock, &start_stop_lock,
+ MY_MUTEX_INIT_SLOW);
mysql_mutex_setflags(&run_lock, MYF_NO_DEADLOCK_DETECTION);
mysql_mutex_setflags(&data_lock, MYF_NO_DEADLOCK_DETECTION);
mysql_mutex_init(key_master_info_sleep_lock, &sleep_lock, MY_MUTEX_INIT_FAST);
@@ -90,8 +94,27 @@ Master_info::Master_info(LEX_STRING *connection_name_arg,
mysql_cond_init(key_master_info_sleep_cond, &sleep_cond, NULL);
}
+
+/**
+ Wait until no one is using Master_info
+*/
+
+void Master_info::wait_until_free()
+{
+ mysql_mutex_lock(&sleep_lock);
+ killed= 1;
+ while (users)
+ mysql_cond_wait(&sleep_cond, &sleep_lock);
+ mysql_mutex_unlock(&sleep_lock);
+}
+
+/**
+ Delete master_info
+*/
+
Master_info::~Master_info()
{
+ wait_until_free();
#ifdef WITH_WSREP
/*
Do not free "wsrep" rpl_filter. It will eventually be freed by
@@ -106,6 +129,7 @@ Master_info::~Master_info()
mysql_mutex_destroy(&run_lock);
mysql_mutex_destroy(&data_lock);
mysql_mutex_destroy(&sleep_lock);
+ mysql_mutex_destroy(&start_stop_lock);
mysql_cond_destroy(&data_cond);
mysql_cond_destroy(&start_cond);
mysql_cond_destroy(&stop_cond);
@@ -841,12 +865,28 @@ uchar *get_key_master_info(Master_info *mi, size_t *length,
return (uchar*) mi->cmp_connection_name.str;
}
+/*
+ Delete a master info
+
+ Called from my_hash_delete(&master_info_hash)
+ Stops associated slave threads and frees master_info
+*/
+
void free_key_master_info(Master_info *mi)
{
DBUG_ENTER("free_key_master_info");
+ mysql_mutex_unlock(&LOCK_active_mi);
+
+ /* Ensure that we are not in reset_slave while this is done */
+ mi->lock_slave_threads();
terminate_slave_threads(mi,SLAVE_FORCE_ALL);
+ /* We use 2 here instead of 1 just to make it easier when debugging */
+ mi->killed= 2;
end_master_info(mi);
+ mi->unlock_slave_threads();
delete mi;
+
+ mysql_mutex_lock(&LOCK_active_mi);
DBUG_VOID_RETURN;
}
@@ -1002,9 +1042,28 @@ Master_info_index::Master_info_index()
index_file.file= -1;
}
+
+/**
+ Free all connection threads
+
+ This is done during early stages of shutdown
+ to give connection threads and slave threads time
+ to die before ~Master_info_index is called
+*/
+
+void Master_info_index::free_connections()
+{
+ mysql_mutex_assert_owner(&LOCK_active_mi);
+ my_hash_reset(&master_info_hash);
+}
+
+
+/**
+ Free all connection threads and free structures
+*/
+
Master_info_index::~Master_info_index()
{
- /* This will close connection for all objects in the cache */
my_hash_free(&master_info_hash);
end_io_cache(&index_file);
if (index_file.file >= 0)
@@ -1025,9 +1084,9 @@ bool Master_info_index::init_all_master_info()
int err_num= 0, succ_num= 0; // The number of success read Master_info
char sign[MAX_CONNECTION_NAME+1];
File index_file_nr;
+ THD *thd;
DBUG_ENTER("init_all_master_info");
- mysql_mutex_assert_owner(&LOCK_active_mi);
DBUG_ASSERT(master_info_index);
if ((index_file_nr= my_open(index_file_name,
@@ -1057,6 +1116,10 @@ bool Master_info_index::init_all_master_info()
DBUG_RETURN(1);
}
+ thd= new THD(next_thread_id()); /* Needed by start_slave_threads */
+ thd->thread_stack= (char*) &thd;
+ thd->store_globals();
+
reinit_io_cache(&index_file, READ_CACHE, 0L,0,0);
while (!init_strvar_from_file(sign, sizeof(sign),
&index_file, NULL))
@@ -1072,10 +1135,9 @@ bool Master_info_index::init_all_master_info()
mi->error())
{
delete mi;
- DBUG_RETURN(1);
+ goto error;
}
- lock_slave_threads(mi);
init_thread_mask(&thread_mask,mi,0 /*not inverse*/);
create_logfile_name_with_suffix(buf_master_info_file,
@@ -1090,6 +1152,7 @@ bool Master_info_index::init_all_master_info()
sql_print_information("Reading Master_info: '%s' Relay_info:'%s'",
buf_master_info_file, buf_relay_log_info_file);
+ mi->lock_slave_threads();
if (init_master_info(mi, buf_master_info_file, buf_relay_log_info_file,
0, thread_mask))
{
@@ -1101,17 +1164,18 @@ bool Master_info_index::init_all_master_info()
{
/* Master_info is not in HASH; Add it */
if (master_info_index->add_master_info(mi, FALSE))
- DBUG_RETURN(1);
+ goto error;
succ_num++;
- unlock_slave_threads(mi);
+ mi->unlock_slave_threads();
}
else
{
/* Master_info already in HASH */
sql_print_error(ER_THD_OR_DEFAULT(current_thd,
ER_CONNECTION_ALREADY_EXISTS),
+ (int) connection_name.length, connection_name.str,
(int) connection_name.length, connection_name.str);
- unlock_slave_threads(mi);
+ mi->unlock_slave_threads();
delete mi;
}
continue;
@@ -1128,23 +1192,23 @@ bool Master_info_index::init_all_master_info()
/* Master_info was already registered */
sql_print_error(ER_THD_OR_DEFAULT(current_thd,
ER_CONNECTION_ALREADY_EXISTS),
+ (int) connection_name.length, connection_name.str,
(int) connection_name.length, connection_name.str);
- unlock_slave_threads(mi);
+ mi->unlock_slave_threads();
delete mi;
continue;
}
/* Master_info was not registered; add it */
if (master_info_index->add_master_info(mi, FALSE))
- DBUG_RETURN(1);
+ goto error;
succ_num++;
- unlock_slave_threads(mi);
if (!opt_skip_slave_start)
{
if (start_slave_threads(current_thd,
1 /* need mutex */,
- 0 /* no wait for start*/,
+ 1 /* wait for start*/,
mi,
buf_master_info_file,
buf_relay_log_info_file,
@@ -1160,8 +1224,11 @@ bool Master_info_index::init_all_master_info()
(int) connection_name.length,
connection_name.str);
}
+ mi->unlock_slave_threads();
}
}
+ thd->reset_globals();
+ delete thd;
if (!err_num) // No Error on read Master_info
{
@@ -1169,16 +1236,19 @@ bool Master_info_index::init_all_master_info()
sql_print_information("Reading of all Master_info entries succeded");
DBUG_RETURN(0);
}
- else if (succ_num) // Have some Error and some Success
+ if (succ_num) // Have some Error and some Success
{
sql_print_warning("Reading of some Master_info entries failed");
DBUG_RETURN(1);
}
- else // All failed
- {
- sql_print_error("Reading of all Master_info entries failed!");
- DBUG_RETURN(1);
- }
+
+ sql_print_error("Reading of all Master_info entries failed!");
+ DBUG_RETURN(1);
+
+error:
+ thd->reset_globals();
+ delete thd;
+ DBUG_RETURN(1);
}
@@ -1211,6 +1281,71 @@ bool Master_info_index::write_master_name_to_index_file(LEX_STRING *name,
/**
+ Get Master_info for a connection and lock the object from deletion
+
+ @param
+ connection_name Connection name
+ warning WARN_LEVEL_NOTE -> Don't print anything
+ WARN_LEVEL_WARN -> Issue warning if not exists
+ WARN_LEVEL_ERROR-> Issue error if not exists
+*/
+
+Master_info *get_master_info(const LEX_STRING *connection_name,
+ Sql_condition::enum_warning_level warning)
+{
+ Master_info *mi;
+ DBUG_ENTER("get_master_info");
+
+ /* Protect against inserts into hash */
+ mysql_mutex_lock(&LOCK_active_mi);
+ /*
+ The following can only be true during shutdown when slave has been killed
+ but some other threads are still trying to access slave statistics.
+ */
+ if (unlikely(!master_info_index))
+ {
+ if (warning != Sql_condition::WARN_LEVEL_NOTE)
+ my_error(WARN_NO_MASTER_INFO,
+ MYF(warning == Sql_condition::WARN_LEVEL_WARN ?
+ ME_JUST_WARNING : 0),
+ (int) connection_name->length, connection_name->str);
+ mysql_mutex_unlock(&LOCK_active_mi);
+ DBUG_RETURN(0);
+ }
+ if ((mi= master_info_index->get_master_info(connection_name, warning)))
+ {
+ /*
+ We have to use sleep_lock here. If we would use LOCK_active_mi
+ then we would take locks in wrong order in Master_info::release()
+ */
+ mysql_mutex_lock(&mi->sleep_lock);
+ mi->users++;
+ DBUG_PRINT("info",("users: %d", mi->users));
+ mysql_mutex_unlock(&mi->sleep_lock);
+ }
+ mysql_mutex_unlock(&LOCK_active_mi);
+ DBUG_RETURN(mi);
+}
+
+
+/**
+ Release master info.
+ Signals ~Master_info that it's now safe to delete it
+*/
+
+void Master_info::release()
+{
+ mysql_mutex_lock(&sleep_lock);
+ if (!--users && killed)
+ {
+ /* Signal ~Master_info that it's ok to now free it */
+ mysql_cond_signal(&sleep_cond);
+ }
+ mysql_mutex_unlock(&sleep_lock);
+}
+
+
+/**
Get Master_info for a connection
@param
@@ -1232,8 +1367,6 @@ Master_info_index::get_master_info(const LEX_STRING *connection_name,
("connection_name: '%.*s'", (int) connection_name->length,
connection_name->str));
- mysql_mutex_assert_owner(&LOCK_active_mi);
-
/* Make name lower case for comparison */
res= strmake(buff, connection_name->str, connection_name->length);
my_casedn_str(system_charset_info, buff);
@@ -1299,7 +1432,12 @@ bool Master_info_index::check_duplicate_master_info(LEX_STRING *name_arg,
/* Add a Master_info class to Hash Table */
bool Master_info_index::add_master_info(Master_info *mi, bool write_to_file)
{
- if (!my_hash_insert(&master_info_hash, (uchar*) mi))
+ /*
+ We have to protect against shutdown to ensure we are not calling
+ my_hash_insert() while my_hash_free() is in progress
+ */
+ if (unlikely(shutdown_in_progress) ||
+ !my_hash_insert(&master_info_hash, (uchar*) mi))
{
if (global_system_variables.log_warnings > 1)
sql_print_information("Added new Master_info '%.*s' to hash table",
@@ -1325,105 +1463,131 @@ bool Master_info_index::add_master_info(Master_info *mi, bool write_to_file)
atomic
*/
-bool Master_info_index::remove_master_info(LEX_STRING *name)
+bool Master_info_index::remove_master_info(Master_info *mi)
{
- Master_info* mi;
DBUG_ENTER("remove_master_info");
+ mysql_mutex_assert_owner(&LOCK_active_mi);
- if ((mi= get_master_info(name, Sql_condition::WARN_LEVEL_WARN)))
+ // Delete Master_info and rewrite others to file
+ if (!my_hash_delete(&master_info_hash, (uchar*) mi))
{
- // Delete Master_info and rewrite others to file
- if (!my_hash_delete(&master_info_hash, (uchar*) mi))
+ File index_file_nr;
+
+ // Close IO_CACHE and FILE handler fisrt
+ end_io_cache(&index_file);
+ my_close(index_file.file, MYF(MY_WME));
+
+ // Reopen File and truncate it
+ if ((index_file_nr= my_open(index_file_name,
+ O_RDWR | O_CREAT | O_TRUNC | O_BINARY ,
+ MYF(MY_WME))) < 0 ||
+ init_io_cache(&index_file, index_file_nr,
+ IO_SIZE, WRITE_CACHE,
+ my_seek(index_file_nr,0L,MY_SEEK_END,MYF(0)),
+ 0, MYF(MY_WME | MY_WAIT_IF_FULL)))
{
- File index_file_nr;
-
- // Close IO_CACHE and FILE handler fisrt
- end_io_cache(&index_file);
- my_close(index_file.file, MYF(MY_WME));
-
- // Reopen File and truncate it
- if ((index_file_nr= my_open(index_file_name,
- O_RDWR | O_CREAT | O_TRUNC | O_BINARY ,
- MYF(MY_WME))) < 0 ||
- init_io_cache(&index_file, index_file_nr,
- IO_SIZE, WRITE_CACHE,
- my_seek(index_file_nr,0L,MY_SEEK_END,MYF(0)),
- 0, MYF(MY_WME | MY_WAIT_IF_FULL)))
- {
- int error= my_errno;
- if (index_file_nr >= 0)
- my_close(index_file_nr,MYF(0));
-
- sql_print_error("Create of Master Info Index file '%s' failed with "
- "error: %M",
- index_file_name, error);
- DBUG_RETURN(TRUE);
- }
+ int error= my_errno;
+ if (index_file_nr >= 0)
+ my_close(index_file_nr,MYF(0));
- // Rewrite Master_info.index
- for (uint i= 0; i< master_info_hash.records; ++i)
- {
- Master_info *tmp_mi;
- tmp_mi= (Master_info *) my_hash_element(&master_info_hash, i);
- write_master_name_to_index_file(&tmp_mi->connection_name, 0);
- }
- my_sync(index_file_nr, MYF(MY_WME));
+ sql_print_error("Create of Master Info Index file '%s' failed with "
+ "error: %M",
+ index_file_name, error);
+ DBUG_RETURN(TRUE);
+ }
+
+ // Rewrite Master_info.index
+ for (uint i= 0; i< master_info_hash.records; ++i)
+ {
+ Master_info *tmp_mi;
+ tmp_mi= (Master_info *) my_hash_element(&master_info_hash, i);
+ write_master_name_to_index_file(&tmp_mi->connection_name, 0);
}
+ if (my_sync(index_file_nr, MYF(MY_WME)))
+ DBUG_RETURN(TRUE);
}
DBUG_RETURN(FALSE);
}
/**
- Master_info_index::give_error_if_slave_running()
+ give_error_if_slave_running()
+
+ @param
+ already_locked 0 if we need to lock, 1 if we have LOCK_active_mi_locked
@return
TRUE If some slave is running. An error is printed
FALSE No slave is running
*/
-bool Master_info_index::give_error_if_slave_running()
+bool give_error_if_slave_running(bool already_locked)
{
+ bool ret= 0;
DBUG_ENTER("give_error_if_slave_running");
- mysql_mutex_assert_owner(&LOCK_active_mi);
- for (uint i= 0; i< master_info_hash.records; ++i)
+ if (!already_locked)
+ mysql_mutex_lock(&LOCK_active_mi);
+ if (!master_info_index)
{
- Master_info *mi;
- mi= (Master_info *) my_hash_element(&master_info_hash, i);
- if (mi->rli.slave_running != MYSQL_SLAVE_NOT_RUN)
+ my_error(ER_SERVER_SHUTDOWN, MYF(0));
+ ret= 1;
+ }
+ else
+ {
+ HASH *hash= &master_info_index->master_info_hash;
+ for (uint i= 0; i< hash->records; ++i)
{
- my_error(ER_SLAVE_MUST_STOP, MYF(0), (int) mi->connection_name.length,
- mi->connection_name.str);
- DBUG_RETURN(TRUE);
+ Master_info *mi;
+ mi= (Master_info *) my_hash_element(hash, i);
+ if (mi->rli.slave_running != MYSQL_SLAVE_NOT_RUN)
+ {
+ my_error(ER_SLAVE_MUST_STOP, MYF(0), (int) mi->connection_name.length,
+ mi->connection_name.str);
+ ret= 1;
+ break;
+ }
}
}
- DBUG_RETURN(FALSE);
+ if (!already_locked)
+ mysql_mutex_unlock(&LOCK_active_mi);
+ DBUG_RETURN(ret);
}
/**
- Master_info_index::any_slave_sql_running()
-
- The LOCK_active_mi must be held while calling this function.
+ any_slave_sql_running()
@return
0 No Slave SQL thread is running
# Number of slave SQL thread running
+
+ Note that during shutdown we return 1. This is needed to ensure we
+ don't try to resize thread pool during shutdown as during shutdown
+ master_info_hash may be freeing the hash and during that time
+ hash entries can't be accessed.
*/
-uint Master_info_index::any_slave_sql_running()
+uint any_slave_sql_running()
{
uint count= 0;
+ HASH *hash;
DBUG_ENTER("any_slave_sql_running");
- mysql_mutex_assert_owner(&LOCK_active_mi);
- for (uint i= 0; i< master_info_hash.records; ++i)
+ mysql_mutex_lock(&LOCK_active_mi);
+ if (unlikely(shutdown_in_progress || !master_info_index))
{
- Master_info *mi= (Master_info *)my_hash_element(&master_info_hash, i);
+ mysql_mutex_unlock(&LOCK_active_mi);
+ DBUG_RETURN(1);
+ }
+ hash= &master_info_index->master_info_hash;
+ for (uint i= 0; i< hash->records; ++i)
+ {
+ Master_info *mi= (Master_info *)my_hash_element(hash, i);
if (mi->rli.slave_running != MYSQL_SLAVE_NOT_RUN)
count++;
}
+ mysql_mutex_unlock(&LOCK_active_mi);
DBUG_RETURN(count);
}
@@ -1436,15 +1600,25 @@ uint Master_info_index::any_slave_sql_running()
@return
TRUE Error
FALSE Everything ok.
+
+ This code is written so that we don't keep LOCK_active_mi active
+ while we are starting a slave.
*/
bool Master_info_index::start_all_slaves(THD *thd)
{
bool result= FALSE;
- DBUG_ENTER("warn_if_slave_running");
+ DBUG_ENTER("start_all_slaves");
mysql_mutex_assert_owner(&LOCK_active_mi);
- for (uint i= 0; i< master_info_hash.records; ++i)
+ for (uint i= 0; i< master_info_hash.records; i++)
+ {
+ Master_info *mi;
+ mi= (Master_info *) my_hash_element(&master_info_hash, i);
+ mi->in_start_all_slaves= 0;
+ }
+
+ for (uint i= 0; i< master_info_hash.records; )
{
int error;
Master_info *mi;
@@ -1454,25 +1628,40 @@ bool Master_info_index::start_all_slaves(THD *thd)
Try to start all slaves that are configured (host is defined)
and are not already running
*/
- if ((mi->slave_running == MYSQL_SLAVE_NOT_RUN ||
- !mi->rli.slave_running) && *mi->host)
+ if (!((mi->slave_running == MYSQL_SLAVE_NOT_RUN ||
+ !mi->rli.slave_running) && *mi->host) ||
+ mi->in_start_all_slaves)
{
- if ((error= start_slave(thd, mi, 1)))
- {
- my_error(ER_CANT_START_STOP_SLAVE, MYF(0),
- "START",
- (int) mi->connection_name.length,
- mi->connection_name.str);
- result= 1;
- if (error < 0) // fatal error
- break;
- }
- else if (thd)
- push_warning_printf(thd, Sql_condition::WARN_LEVEL_NOTE,
- ER_SLAVE_STARTED, ER_THD(thd, ER_SLAVE_STARTED),
- (int) mi->connection_name.length,
- mi->connection_name.str);
+ i++;
+ continue;
+ }
+ mi->in_start_all_slaves= 1;
+
+ mysql_mutex_lock(&mi->sleep_lock);
+ mi->users++; // Mark used
+ mysql_mutex_unlock(&mi->sleep_lock);
+ mysql_mutex_unlock(&LOCK_active_mi);
+ error= start_slave(thd, mi, 1);
+ mi->release();
+ mysql_mutex_lock(&LOCK_active_mi);
+ if (error)
+ {
+ my_error(ER_CANT_START_STOP_SLAVE, MYF(0),
+ "START",
+ (int) mi->connection_name.length,
+ mi->connection_name.str);
+ result= 1;
+ if (error < 0) // fatal error
+ break;
}
+ else if (thd)
+ push_warning_printf(thd, Sql_condition::WARN_LEVEL_NOTE,
+ ER_SLAVE_STARTED, ER_THD(thd, ER_SLAVE_STARTED),
+ (int) mi->connection_name.length,
+ mi->connection_name.str);
+ /* Restart from first element as master_info_hash may have changed */
+ i= 0;
+ continue;
}
DBUG_RETURN(result);
}
@@ -1488,39 +1677,64 @@ bool Master_info_index::start_all_slaves(THD *thd)
@return
TRUE Error
FALSE Everything ok.
+
+ This code is written so that we don't keep LOCK_active_mi active
+ while we are stopping a slave.
*/
bool Master_info_index::stop_all_slaves(THD *thd)
{
bool result= FALSE;
- DBUG_ENTER("warn_if_slave_running");
+ DBUG_ENTER("stop_all_slaves");
mysql_mutex_assert_owner(&LOCK_active_mi);
DBUG_ASSERT(thd);
- for (uint i= 0; i< master_info_hash.records; ++i)
+ for (uint i= 0; i< master_info_hash.records; i++)
+ {
+ Master_info *mi;
+ mi= (Master_info *) my_hash_element(&master_info_hash, i);
+ mi->in_stop_all_slaves= 0;
+ }
+
+ for (uint i= 0; i< master_info_hash.records ;)
{
int error;
Master_info *mi;
mi= (Master_info *) my_hash_element(&master_info_hash, i);
- if ((mi->slave_running != MYSQL_SLAVE_NOT_RUN ||
- mi->rli.slave_running))
+ if (!(mi->slave_running != MYSQL_SLAVE_NOT_RUN ||
+ mi->rli.slave_running) ||
+ mi->in_stop_all_slaves)
{
- if ((error= stop_slave(thd, mi, 1)))
- {
- my_error(ER_CANT_START_STOP_SLAVE, MYF(0),
- "STOP",
- (int) mi->connection_name.length,
- mi->connection_name.str);
- result= 1;
- if (error < 0) // Fatal error
- break;
- }
- else
- push_warning_printf(thd, Sql_condition::WARN_LEVEL_NOTE,
- ER_SLAVE_STOPPED, ER_THD(thd, ER_SLAVE_STOPPED),
- (int) mi->connection_name.length,
- mi->connection_name.str);
+ i++;
+ continue;
}
+ mi->in_stop_all_slaves= 1; // Protection for loops
+
+ mysql_mutex_lock(&mi->sleep_lock);
+ mi->users++; // Mark used
+ mysql_mutex_unlock(&mi->sleep_lock);
+ mysql_mutex_unlock(&LOCK_active_mi);
+ error= stop_slave(thd, mi, 1);
+ mi->release();
+ mysql_mutex_lock(&LOCK_active_mi);
+ if (error)
+ {
+ my_error(ER_CANT_START_STOP_SLAVE, MYF(0),
+ "STOP",
+ (int) mi->connection_name.length,
+ mi->connection_name.str);
+ result= 1;
+ if (error < 0) // Fatal error
+ break;
+ }
+ else
+ push_warning_printf(thd, Sql_condition::WARN_LEVEL_NOTE,
+ ER_SLAVE_STOPPED, ER_THD(thd, ER_SLAVE_STOPPED),
+ (int) mi->connection_name.length,
+ mi->connection_name.str);
+ /* Restart from first element as master_info_hash may have changed */
+ i= 0;
+ continue;
}
DBUG_RETURN(result);
}
diff --git a/sql/rpl_mi.h b/sql/rpl_mi.h
index 9365c065ea9..31c0f280ac1 100644
--- a/sql/rpl_mi.h
+++ b/sql/rpl_mi.h
@@ -187,6 +187,10 @@ class Master_info : public Slave_reporting_capability
return opt_slave_parallel_threads > 0 &&
parallel_mode > SLAVE_PARALLEL_NONE;
}
+ void release();
+ void wait_until_free();
+ void lock_slave_threads();
+ void unlock_slave_threads();
/* the variables below are needed because we can change masters on the fly */
char master_log_name[FN_REFLEN+6]; /* Room for multi-*/
@@ -205,7 +209,7 @@ class Master_info : public Slave_reporting_capability
File fd; // we keep the file open, so we need to remember the file pointer
IO_CACHE file;
- mysql_mutex_t data_lock, run_lock, sleep_lock;
+ mysql_mutex_t data_lock, run_lock, sleep_lock, start_stop_lock;
mysql_cond_t data_cond, start_cond, stop_cond, sleep_cond;
THD *io_thd;
MYSQL* mysql;
@@ -297,6 +301,9 @@ class Master_info : public Slave_reporting_capability
uint64 gtid_reconnect_event_skip_count;
/* gtid_event_seen is false until we receive first GTID event from master. */
bool gtid_event_seen;
+ bool in_start_all_slaves, in_stop_all_slaves;
+ uint users; /* Active user for object */
+ uint killed;
/* domain-id based filter */
Domain_id_filter domain_id_filter;
@@ -341,13 +348,12 @@ public:
bool check_duplicate_master_info(LEX_STRING *connection_name,
const char *host, uint port);
bool add_master_info(Master_info *mi, bool write_to_file);
- bool remove_master_info(LEX_STRING *connection_name);
+ bool remove_master_info(Master_info *mi);
Master_info *get_master_info(const LEX_STRING *connection_name,
Sql_condition::enum_warning_level warning);
- bool give_error_if_slave_running();
- uint any_slave_sql_running();
bool start_all_slaves(THD *thd);
bool stop_all_slaves(THD *thd);
+ void free_connections();
};
@@ -360,6 +366,8 @@ public:
};
+Master_info *get_master_info(const LEX_STRING *connection_name,
+ Sql_condition::enum_warning_level warning);
bool check_master_connection_name(LEX_STRING *name);
void create_logfile_name_with_suffix(char *res_file_name, size_t length,
const char *info_file,
@@ -369,5 +377,8 @@ void create_logfile_name_with_suffix(char *res_file_name, size_t length,
uchar *get_key_master_info(Master_info *mi, size_t *length,
my_bool not_used __attribute__((unused)));
void free_key_master_info(Master_info *mi);
+uint any_slave_sql_running();
+bool give_error_if_slave_running(bool already_lock);
+
#endif /* HAVE_REPLICATION */
#endif /* RPL_MI_H */
diff --git a/sql/rpl_parallel.cc b/sql/rpl_parallel.cc
index f7aab704c43..6788f422cbd 100644
--- a/sql/rpl_parallel.cc
+++ b/sql/rpl_parallel.cc
@@ -1320,39 +1320,16 @@ handle_rpl_parallel_thread(void *arg)
*/
rpt->batch_free();
- for (;;)
+ if ((events= rpt->event_queue) != NULL)
{
- if ((events= rpt->event_queue) != NULL)
- {
- /*
- Take next group of events from the replication pool.
- This is faster than having to wakeup the pool manager thread to give
- us a new event.
- */
- rpt->dequeue1(events);
- mysql_mutex_unlock(&rpt->LOCK_rpl_thread);
- goto more_events;
- }
- if (!rpt->pause_for_ftwrl ||
- (in_event_group && !group_rgi->parallel_entry->force_abort))
- break;
/*
- We are currently in the delicate process of pausing parallel
- replication while FLUSH TABLES WITH READ LOCK is starting. We must
- not de-allocate the thread (setting rpt->current_owner= NULL) until
- rpl_unpause_after_ftwrl() has woken us up.
+ Take next group of events from the replication pool.
+ This is faster than having to wakeup the pool manager thread to give
+ us a new event.
*/
- mysql_mutex_lock(&rpt->current_entry->LOCK_parallel_entry);
+ rpt->dequeue1(events);
mysql_mutex_unlock(&rpt->LOCK_rpl_thread);
- if (rpt->pause_for_ftwrl)
- mysql_cond_wait(&rpt->current_entry->COND_parallel_entry,
- &rpt->current_entry->LOCK_parallel_entry);
- mysql_mutex_unlock(&rpt->current_entry->LOCK_parallel_entry);
- mysql_mutex_lock(&rpt->LOCK_rpl_thread);
- /*
- Now loop to check again for more events available, since we released
- and re-aquired the LOCK_rpl_thread mutex.
- */
+ goto more_events;
}
rpt->inuse_relaylog_refcount_update();
@@ -1379,11 +1356,35 @@ handle_rpl_parallel_thread(void *arg)
}
if (!in_event_group)
{
+ /* If we are in a FLUSH TABLES FOR READ LOCK, wait for it */
+ while (rpt->current_entry && rpt->pause_for_ftwrl)
+ {
+ /*
+ We are currently in the delicate process of pausing parallel
+ replication while FLUSH TABLES WITH READ LOCK is starting. We must
+ not de-allocate the thread (setting rpt->current_owner= NULL) until
+ rpl_unpause_after_ftwrl() has woken us up.
+ */
+ rpl_parallel_entry *e= rpt->current_entry;
+ /*
+ Wait for rpl_unpause_after_ftwrl() to wake us up.
+ Note that rpl_pause_for_ftwrl() may wait for 'e->pause_sub_id'
+ to change. This should happen eventually in finish_event_group()
+ */
+ mysql_mutex_lock(&e->LOCK_parallel_entry);
+ mysql_mutex_unlock(&rpt->LOCK_rpl_thread);
+ if (rpt->pause_for_ftwrl)
+ mysql_cond_wait(&e->COND_parallel_entry, &e->LOCK_parallel_entry);
+ mysql_mutex_unlock(&e->LOCK_parallel_entry);
+ mysql_mutex_lock(&rpt->LOCK_rpl_thread);
+ }
+
rpt->current_owner= NULL;
/* Tell wait_for_done() that we are done, if it is waiting. */
if (likely(rpt->current_entry) &&
unlikely(rpt->current_entry->force_abort))
mysql_cond_broadcast(&rpt->COND_rpl_thread_stop);
+
rpt->current_entry= NULL;
if (!rpt->stop)
rpt->pool->release_thread(rpt);
@@ -1422,10 +1423,24 @@ dealloc_gco(group_commit_orderer *gco)
my_free(gco);
}
+/**
+ Change thread count for global parallel worker threads
+
+ @param pool parallel thread pool
+ @param new_count Number of threads to be in pool. 0 in shutdown
+ @param force Force thread count to new_count even if slave
+ threads are running
+
+ By default we don't resize pool of there are running threads.
+ However during shutdown we will always do it.
+ This is needed as any_slave_sql_running() returns 1 during shutdown
+ as we don't want to access master_info while
+ Master_info_index::free_connections are running.
+*/
static int
rpl_parallel_change_thread_count(rpl_parallel_thread_pool *pool,
- uint32 new_count)
+ uint32 new_count, bool force)
{
uint32 i;
rpl_parallel_thread **old_list= NULL;
@@ -1437,6 +1452,28 @@ rpl_parallel_change_thread_count(rpl_parallel_thread_pool *pool,
if ((res= pool_mark_busy(pool, current_thd)))
return res;
+ /* Protect against parallel pool resizes */
+ if (pool->count == new_count)
+ {
+ pool_mark_not_busy(pool);
+ return 0;
+ }
+
+ /*
+ If we are about to delete pool, do an extra check that there are no new
+ slave threads running since we marked pool busy
+ */
+ if (!new_count && !force)
+ {
+ if (any_slave_sql_running())
+ {
+ DBUG_PRINT("warning",
+ ("SQL threads running while trying to reset parallel pool"));
+ pool_mark_not_busy(pool);
+ return 0; // Ok to not resize pool
+ }
+ }
+
/*
Allocate the new list of threads up-front.
That way, if we fail half-way, we only need to free whatever we managed
@@ -1450,7 +1487,7 @@ rpl_parallel_change_thread_count(rpl_parallel_thread_pool *pool,
{
my_error(ER_OUTOFMEMORY, MYF(0), (int(new_count*sizeof(*new_list) +
new_count*sizeof(*rpt_array))));
- goto err;;
+ goto err;
}
for (i= 0; i < new_count; ++i)
@@ -1575,12 +1612,26 @@ err:
return 1;
}
+/*
+ Deactivate the parallel replication thread pool, if there are now no more
+ SQL threads running.
+*/
+
+int rpl_parallel_resize_pool_if_no_slaves(void)
+{
+ /* master_info_index is set to NULL on shutdown */
+ if (opt_slave_parallel_threads > 0 && !any_slave_sql_running())
+ return rpl_parallel_inactivate_pool(&global_rpl_thread_pool);
+ return 0;
+}
+
int
rpl_parallel_activate_pool(rpl_parallel_thread_pool *pool)
{
if (!pool->count)
- return rpl_parallel_change_thread_count(pool, opt_slave_parallel_threads);
+ return rpl_parallel_change_thread_count(pool, opt_slave_parallel_threads,
+ 0);
return 0;
}
@@ -1588,7 +1639,7 @@ rpl_parallel_activate_pool(rpl_parallel_thread_pool *pool)
int
rpl_parallel_inactivate_pool(rpl_parallel_thread_pool *pool)
{
- return rpl_parallel_change_thread_count(pool, 0);
+ return rpl_parallel_change_thread_count(pool, 0, 0);
}
@@ -1866,7 +1917,7 @@ rpl_parallel_thread_pool::destroy()
{
if (!inited)
return;
- rpl_parallel_change_thread_count(this, 0);
+ rpl_parallel_change_thread_count(this, 0, 1);
mysql_mutex_destroy(&LOCK_rpl_thread_pool);
mysql_cond_destroy(&COND_rpl_thread_pool);
inited= false;
@@ -1885,6 +1936,7 @@ rpl_parallel_thread_pool::get_thread(rpl_parallel_thread **owner,
{
rpl_parallel_thread *rpt;
+ DBUG_ASSERT(count > 0);
mysql_mutex_lock(&LOCK_rpl_thread_pool);
while (unlikely(busy) || !(rpt= free_list))
mysql_cond_wait(&COND_rpl_thread_pool, &LOCK_rpl_thread_pool);
@@ -2113,6 +2165,11 @@ rpl_parallel::find(uint32 domain_id)
return e;
}
+/**
+ Wait until all sql worker threads has stopped processing
+
+ This is called when sql thread has been killed/stopped
+*/
void
rpl_parallel::wait_for_done(THD *thd, Relay_log_info *rli)
diff --git a/sql/rpl_parallel.h b/sql/rpl_parallel.h
index c6f77b0144c..a0faeae815c 100644
--- a/sql/rpl_parallel.h
+++ b/sql/rpl_parallel.h
@@ -365,6 +365,7 @@ struct rpl_parallel {
extern struct rpl_parallel_thread_pool global_rpl_thread_pool;
+extern int rpl_parallel_resize_pool_if_no_slaves(void);
extern int rpl_parallel_activate_pool(rpl_parallel_thread_pool *pool);
extern int rpl_parallel_inactivate_pool(rpl_parallel_thread_pool *pool);
extern bool process_gtid_for_restart_pos(Relay_log_info *rli, rpl_gtid *gtid);
diff --git a/sql/rpl_rli.cc b/sql/rpl_rli.cc
index cd189b4ab2d..fda922c3e12 100644
--- a/sql/rpl_rli.cc
+++ b/sql/rpl_rli.cc
@@ -207,6 +207,7 @@ a file name for --relay-log-index option", opt_relaylog_index_name);
/* For multimaster, add connection name to relay log filenames */
char buf_relay_logname[FN_REFLEN], buf_relaylog_index_name_buff[FN_REFLEN];
char *buf_relaylog_index_name= opt_relaylog_index_name;
+ mysql_mutex_t *log_lock;
create_logfile_name_with_suffix(buf_relay_logname,
sizeof(buf_relay_logname),
@@ -226,14 +227,18 @@ a file name for --relay-log-index option", opt_relaylog_index_name);
note, that if open() fails, we'll still have index file open
but a destructor will take care of that
*/
+ log_lock= relay_log.get_log_lock();
+ mysql_mutex_lock(log_lock);
if (relay_log.open_index_file(buf_relaylog_index_name, ln, TRUE) ||
relay_log.open(ln, LOG_BIN, 0, 0, SEQ_READ_APPEND,
max_relay_log_size, 1, TRUE))
{
+ mysql_mutex_unlock(log_lock);
mysql_mutex_unlock(&data_lock);
sql_print_error("Failed when trying to open logs for '%s' in Relay_log_info::init(). Error: %M", ln, my_errno);
DBUG_RETURN(1);
}
+ mysql_mutex_unlock(log_lock);
}
/* if file does not exist */
@@ -413,7 +418,7 @@ Failed to open the existing relay log info file '%s' (errno %d)",
}
inited= 1;
mysql_mutex_unlock(&data_lock);
- DBUG_RETURN(error);
+ DBUG_RETURN(0);
err:
sql_print_error("%s", msg);
@@ -1312,9 +1317,10 @@ bool Relay_log_info::is_until_satisfied(my_off_t master_beg_pos)
}
-void Relay_log_info::stmt_done(my_off_t event_master_log_pos, THD *thd,
+bool Relay_log_info::stmt_done(my_off_t event_master_log_pos, THD *thd,
rpl_group_info *rgi)
{
+ int error= 0;
DBUG_ENTER("Relay_log_info::stmt_done");
DBUG_ASSERT(!belongs_to_client());
@@ -1367,10 +1373,11 @@ void Relay_log_info::stmt_done(my_off_t event_master_log_pos, THD *thd,
}
DBUG_EXECUTE_IF("inject_crash_before_flush_rli", DBUG_SUICIDE(););
if (mi->using_gtid == Master_info::USE_GTID_NO)
- flush();
+ if (flush())
+ error= 1;
DBUG_EXECUTE_IF("inject_crash_after_flush_rli", DBUG_SUICIDE(););
}
- DBUG_VOID_RETURN;
+ DBUG_RETURN(error);
}
diff --git a/sql/rpl_rli.h b/sql/rpl_rli.h
index 60a75859050..93e7b869be0 100644
--- a/sql/rpl_rli.h
+++ b/sql/rpl_rli.h
@@ -433,7 +433,7 @@ public:
relay log info and used to produce information for <code>SHOW
SLAVE STATUS</code>.
*/
- void stmt_done(my_off_t event_log_pos, THD *thd, rpl_group_info *rgi);
+ bool stmt_done(my_off_t event_log_pos, THD *thd, rpl_group_info *rgi);
int alloc_inuse_relaylog(const char *name);
void free_inuse_relaylog(inuse_relaylog *ir);
void reset_inuse_relaylog();
diff --git a/sql/sha2.cc b/sql/sha2.cc
deleted file mode 100644
index f2201974172..00000000000
--- a/sql/sha2.cc
+++ /dev/null
@@ -1,68 +0,0 @@
-/* Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; version 2 of the License.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
-
-
-/**
- @file
- A compatibility layer to our built-in SSL implementation, to mimic the
- oft-used external library, OpenSSL.
-*/
-
-#include <my_global.h>
-#include <sha2.h>
-
-#ifdef HAVE_YASSL
-
-/*
- If TaoCrypt::SHA512 or ::SHA384 are not defined (but ::SHA256 is), it's
- probably that neither of config.h's SIZEOF_LONG or SIZEOF_LONG_LONG are
- 64 bits long. At present, both OpenSSL and YaSSL require 64-bit integers
- for SHA-512. (The SIZEOF_* definitions come from autoconf's config.h .)
-*/
-
-# define GEN_YASSL_SHA2_BRIDGE(size) \
-unsigned char* SHA##size(const unsigned char *input_ptr, size_t input_length, \
- char unsigned *output_ptr) { \
- TaoCrypt::SHA##size hasher; \
- \
- hasher.Update(input_ptr, input_length); \
- hasher.Final(output_ptr); \
- return(output_ptr); \
-}
-
-
-/**
- @fn SHA512
- @fn SHA384
- @fn SHA256
- @fn SHA224
-
- Instantiate an hash object, fill in the cleartext value, compute the digest,
- and extract the result from the object.
-
- (Generate the functions. See similar .h code for the prototypes.)
-*/
-# ifndef OPENSSL_NO_SHA512
-GEN_YASSL_SHA2_BRIDGE(512);
-GEN_YASSL_SHA2_BRIDGE(384);
-# else
-# warning Some SHA2 functionality is missing. See OPENSSL_NO_SHA512.
-# endif
-GEN_YASSL_SHA2_BRIDGE(256);
-GEN_YASSL_SHA2_BRIDGE(224);
-
-# undef GEN_YASSL_SHA2_BRIDGE
-
-#endif /* HAVE_YASSL */
diff --git a/sql/share/errmsg-utf8.txt b/sql/share/errmsg-utf8.txt
index 930cd2ceaa2..e1ed868c783 100644
--- a/sql/share/errmsg-utf8.txt
+++ b/sql/share/errmsg-utf8.txt
@@ -4839,7 +4839,7 @@ WARN_DATA_TRUNCATED 01000
spa "Datos truncados para columna '%s' en la línea %lu"
ER_WARN_USING_OTHER_HANDLER
eng "Using storage engine %s for table '%s'"
- ger "Für Tabelle '%s' wird Speicher-Engine %s benutzt"
+ ger "Speicher-Engine %s wird für Tabelle '%s' benutzt"
jpn "ストレージエンジン %s ãŒè¡¨ '%s' ã«åˆ©ç”¨ã•ã‚Œã¦ã„ã¾ã™ã€‚"
por "Usando engine de armazenamento %s para tabela '%s'"
spa "Usando motor de almacenamiento %s para tabla '%s'"
diff --git a/sql/slave.cc b/sql/slave.cc
index e031a424ea6..fbdb78b5c5d 100644
--- a/sql/slave.cc
+++ b/sql/slave.cc
@@ -233,16 +233,14 @@ void init_thread_mask(int* mask,Master_info* mi,bool inverse)
/*
- lock_slave_threads()
+ lock_slave_threads() against other threads doing STOP, START or RESET SLAVE
+
*/
-void lock_slave_threads(Master_info* mi)
+void Master_info::lock_slave_threads()
{
DBUG_ENTER("lock_slave_threads");
-
- //TODO: see if we can do this without dual mutex
- mysql_mutex_lock(&mi->run_lock);
- mysql_mutex_lock(&mi->rli.run_lock);
+ mysql_mutex_lock(&start_stop_lock);
DBUG_VOID_RETURN;
}
@@ -251,13 +249,10 @@ void lock_slave_threads(Master_info* mi)
unlock_slave_threads()
*/
-void unlock_slave_threads(Master_info* mi)
+void Master_info::unlock_slave_threads()
{
DBUG_ENTER("unlock_slave_threads");
-
- //TODO: see if we can do this without dual mutex
- mysql_mutex_unlock(&mi->rli.run_lock);
- mysql_mutex_unlock(&mi->run_lock);
+ mysql_mutex_unlock(&start_stop_lock);
DBUG_VOID_RETURN;
}
@@ -470,7 +465,6 @@ int init_slave()
accepted. However bootstrap may conflict with us if it does START SLAVE.
So it's safer to take the lock.
*/
- mysql_mutex_lock(&LOCK_active_mi);
if (pthread_key_create(&RPL_MASTER_INFO, NULL))
goto err;
@@ -479,7 +473,6 @@ int init_slave()
if (!master_info_index || master_info_index->init_all_master_info())
{
sql_print_error("Failed to initialize multi master structures");
- mysql_mutex_unlock(&LOCK_active_mi);
DBUG_RETURN(1);
}
if (!(active_mi= new Master_info(&default_master_connection_name,
@@ -524,13 +517,22 @@ int init_slave()
if (active_mi->host[0] && !opt_skip_slave_start)
{
- if (start_slave_threads(0, /* No active thd */
- 1 /* need mutex */,
- 0 /* no wait for start*/,
- active_mi,
- master_info_file,
- relay_log_info_file,
- SLAVE_IO | SLAVE_SQL))
+ int error;
+ THD *thd= new THD(next_thread_id());
+ thd->thread_stack= (char*) &thd;
+ thd->store_globals();
+
+ error= start_slave_threads(0, /* No active thd */
+ 1 /* need mutex */,
+ 1 /* wait for start*/,
+ active_mi,
+ master_info_file,
+ relay_log_info_file,
+ SLAVE_IO | SLAVE_SQL);
+
+ thd->reset_globals();
+ delete thd;
+ if (error)
{
sql_print_error("Failed to create slave threads");
goto err;
@@ -538,7 +540,6 @@ int init_slave()
}
end:
- mysql_mutex_unlock(&LOCK_active_mi);
DBUG_RETURN(error);
err:
@@ -711,6 +712,7 @@ int terminate_slave_threads(Master_info* mi,int thread_mask,bool skip_lock)
if (!mi->inited)
DBUG_RETURN(0); /* successfully do nothing */
int error,force_all = (thread_mask & SLAVE_FORCE_ALL);
+ int retval= 0;
mysql_mutex_t *sql_lock = &mi->rli.run_lock, *io_lock = &mi->run_lock;
mysql_mutex_t *log_lock= mi->rli.relay_log.get_log_lock();
@@ -730,24 +732,18 @@ int terminate_slave_threads(Master_info* mi,int thread_mask,bool skip_lock)
skip_lock)) &&
!force_all)
DBUG_RETURN(error);
+ retval= error;
mysql_mutex_lock(log_lock);
DBUG_PRINT("info",("Flushing relay-log info file."));
if (current_thd)
THD_STAGE_INFO(current_thd, stage_flushing_relay_log_info_file);
- if (mi->rli.flush())
- DBUG_RETURN(ER_ERROR_DURING_FLUSH_LOGS);
-
- if (my_sync(mi->rli.info_fd, MYF(MY_WME)))
- DBUG_RETURN(ER_ERROR_DURING_FLUSH_LOGS);
+ if (mi->rli.flush() || my_sync(mi->rli.info_fd, MYF(MY_WME)))
+ retval= ER_ERROR_DURING_FLUSH_LOGS;
mysql_mutex_unlock(log_lock);
}
- if (opt_slave_parallel_threads > 0 &&
- master_info_index &&// master_info_index is set to NULL on server shutdown
- !master_info_index->any_slave_sql_running())
- rpl_parallel_inactivate_pool(&global_rpl_thread_pool);
if (thread_mask & (SLAVE_IO|SLAVE_FORCE_ALL))
{
DBUG_PRINT("info",("Terminating IO thread"));
@@ -758,25 +754,26 @@ int terminate_slave_threads(Master_info* mi,int thread_mask,bool skip_lock)
skip_lock)) &&
!force_all)
DBUG_RETURN(error);
+ if (!retval)
+ retval= error;
mysql_mutex_lock(log_lock);
DBUG_PRINT("info",("Flushing relay log and master info file."));
if (current_thd)
THD_STAGE_INFO(current_thd, stage_flushing_relay_log_and_master_info_repository);
- if (flush_master_info(mi, TRUE, FALSE))
- DBUG_RETURN(ER_ERROR_DURING_FLUSH_LOGS);
-
+ if (likely(mi->fd >= 0))
+ {
+ if (flush_master_info(mi, TRUE, FALSE) || my_sync(mi->fd, MYF(MY_WME)))
+ retval= ER_ERROR_DURING_FLUSH_LOGS;
+ }
if (mi->rli.relay_log.is_open() &&
my_sync(mi->rli.relay_log.get_log_file()->file, MYF(MY_WME)))
- DBUG_RETURN(ER_ERROR_DURING_FLUSH_LOGS);
-
- if (my_sync(mi->fd, MYF(MY_WME)))
- DBUG_RETURN(ER_ERROR_DURING_FLUSH_LOGS);
+ retval= ER_ERROR_DURING_FLUSH_LOGS;
mysql_mutex_unlock(log_lock);
}
- DBUG_RETURN(0);
+ DBUG_RETURN(retval);
}
@@ -939,6 +936,15 @@ int start_slave_thread(
mysql_mutex_unlock(start_lock);
DBUG_RETURN(ER_SLAVE_THREAD);
}
+
+ /*
+ In the following loop we can't check for thd->killed as we have to
+ wait until THD structures for the slave thread are created
+ before we can return.
+ This should be ok as there is no major work done in the slave
+ threads before they signal that we can stop waiting.
+ */
+
if (start_cond && cond_lock) // caller has cond_lock
{
THD* thd = current_thd;
@@ -956,16 +962,9 @@ int start_slave_thread(
registered, we could otherwise go waiting though thd->killed is
set.
*/
- if (!thd->killed)
- mysql_cond_wait(start_cond, cond_lock);
+ mysql_cond_wait(start_cond, cond_lock);
thd->EXIT_COND(& saved_stage);
mysql_mutex_lock(cond_lock); // re-acquire it as exit_cond() released
- if (thd->killed)
- {
- if (start_lock)
- mysql_mutex_unlock(start_lock);
- DBUG_RETURN(thd->killed_errno());
- }
}
}
if (start_lock)
@@ -1054,10 +1053,7 @@ int start_slave_threads(THD *thd,
mi);
if (!error && (thread_mask & SLAVE_SQL))
{
- if (opt_slave_parallel_threads > 0)
- error= rpl_parallel_activate_pool(&global_rpl_thread_pool);
- if (!error)
- error= start_slave_thread(
+ error= start_slave_thread(
#ifdef HAVE_PSI_INTERFACE
key_thread_slave_sql,
#endif
@@ -1073,10 +1069,19 @@ int start_slave_threads(THD *thd,
/*
- Release slave threads at time of executing shutdown.
+ Kill slaves preparing for shutdown
+*/
- SYNOPSIS
- end_slave()
+void slave_prepare_for_shutdown()
+{
+ mysql_mutex_lock(&LOCK_active_mi);
+ master_info_index->free_connections();
+ mysql_mutex_unlock(&LOCK_active_mi);
+ stop_slave_background_thread();
+}
+
+/*
+ Release slave threads at time of executing shutdown.
*/
void end_slave()
@@ -1094,7 +1099,10 @@ void end_slave()
startup parameter to the server was wrong.
*/
mysql_mutex_lock(&LOCK_active_mi);
- /* This will call terminate_slave_threads() on all connections */
+ /*
+ master_info_index should not have any threads anymore as they where
+ killed as part of slave_prepare_for_shutdown()
+ */
delete master_info_index;
master_info_index= 0;
active_mi= 0;
@@ -2878,7 +2886,9 @@ static bool send_show_master_info_data(THD *thd, Master_info *mi, bool full,
mysql_mutex_lock(&mi->data_lock);
mysql_mutex_lock(&mi->rli.data_lock);
+ /* err_lock is to protect mi->last_error() */
mysql_mutex_lock(&mi->err_lock);
+ /* err_lock is to protect mi->rli.last_error() */
mysql_mutex_lock(&mi->rli.err_lock);
protocol->store(mi->host, &my_charset_bin);
protocol->store(mi->user, &my_charset_bin);
@@ -4884,6 +4894,16 @@ pthread_handler_t handle_slave_sql(void *arg)
rli->slave_running= MYSQL_SLAVE_RUN_NOT_CONNECT;
pthread_detach_this_thread();
+
+ if (opt_slave_parallel_threads > 0 &&
+ rpl_parallel_activate_pool(&global_rpl_thread_pool))
+ {
+ mysql_cond_broadcast(&rli->start_cond);
+ rli->report(ERROR_LEVEL, ER_SLAVE_FATAL_ERROR, NULL,
+ "Failed during parallel slave pool activation");
+ goto err_during_init;
+ }
+
if (init_slave_thread(thd, mi, SLAVE_THD_SQL))
{
/*
@@ -5184,8 +5204,15 @@ pthread_handler_t handle_slave_sql(void *arg)
if (rli->mi->using_gtid != Master_info::USE_GTID_NO)
{
ulong domain_count;
+ my_bool save_log_all_errors= thd->log_all_errors;
+ /*
+ We don't need to check return value for rli->flush()
+ as any errors should be logged to stderr
+ */
+ thd->log_all_errors= 1;
rli->flush();
+ thd->log_all_errors= save_log_all_errors;
if (mi->using_parallel())
{
/*
@@ -5296,17 +5323,7 @@ err_during_init:
DBUG_EXECUTE_IF("simulate_slave_delay_at_terminate_bug38694", sleep(5););
mysql_mutex_unlock(&rli->run_lock); // tell the world we are done
- /*
- Deactivate the parallel replication thread pool, if there are now no more
- SQL threads running. Do this here, when we have released all locks, but
- while our THD (and current_thd) is still valid.
- */
- mysql_mutex_lock(&LOCK_active_mi);
- if (opt_slave_parallel_threads > 0 &&
- master_info_index &&// master_info_index is set to NULL on server shutdown
- !master_info_index->any_slave_sql_running())
- rpl_parallel_inactivate_pool(&global_rpl_thread_pool);
- mysql_mutex_unlock(&LOCK_active_mi);
+ rpl_parallel_resize_pool_if_no_slaves();
/* TODO: Check if this lock is needed */
mysql_mutex_lock(&LOCK_thread_count);
@@ -6519,6 +6536,7 @@ err:
void end_relay_log_info(Relay_log_info* rli)
{
+ mysql_mutex_t *log_lock;
DBUG_ENTER("end_relay_log_info");
if (!rli->inited)
@@ -6536,8 +6554,11 @@ void end_relay_log_info(Relay_log_info* rli)
rli->cur_log_fd = -1;
}
rli->inited = 0;
+ log_lock= rli->relay_log.get_log_lock();
+ mysql_mutex_lock(log_lock);
rli->relay_log.close(LOG_CLOSE_INDEX | LOG_CLOSE_STOP_EVENT);
rli->relay_log.harvest_bytes_written(&rli->log_space_total);
+ mysql_mutex_unlock(log_lock);
/*
Delete the slave's temporary tables from memory.
In the future there will be other actions than this, to ensure persistance
@@ -6688,7 +6709,7 @@ static int connect_to_master(THD* thd, MYSQL* mysql, Master_info* mi,
suppress_warnings= 0;
mi->report(ERROR_LEVEL, last_errno, NULL,
"error %s to master '%s@%s:%d'"
- " - retry-time: %d retries: %lu message: %s",
+ " - retry-time: %d maximum-retries: %lu message: %s",
(reconnect ? "reconnecting" : "connecting"),
mi->user, mi->host, mi->port,
mi->connect_retry, master_retry_count,
@@ -7181,9 +7202,12 @@ static Log_event* next_event(rpl_group_info *rgi, ulonglong *event_size)
}
rli->event_relay_log_pos = BIN_LOG_HEADER_SIZE;
strmake_buf(rli->event_relay_log_name,rli->linfo.log_file_name);
- rli->flush();
+ if (rli->flush())
+ {
+ errmsg= "error flushing relay log";
+ goto err;
+ }
}
-
/*
Now we want to open this next log. To know if it's a hot log (the one
being written by the I/O thread now) or a cold log, we can use
diff --git a/sql/slave.h b/sql/slave.h
index 38f3b7c8430..ded9d76e49d 100644
--- a/sql/slave.h
+++ b/sql/slave.h
@@ -230,13 +230,12 @@ bool rpl_master_erroneous_autoinc(THD* thd);
const char *print_slave_db_safe(const char *db);
void skip_load_data_infile(NET* net);
+void slave_prepare_for_shutdown();
void end_slave(); /* release slave threads */
void close_active_mi(); /* clean up slave threads data */
void clear_until_condition(Relay_log_info* rli);
void clear_slave_error(Relay_log_info* rli);
void end_relay_log_info(Relay_log_info* rli);
-void lock_slave_threads(Master_info* mi);
-void unlock_slave_threads(Master_info* mi);
void init_thread_mask(int* mask,Master_info* mi,bool inverse);
Format_description_log_event *
read_relay_log_description_event(IO_CACHE *cur_log, ulonglong start_pos,
diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc
index d18a5b4d503..5e3311d502a 100644
--- a/sql/sql_acl.cc
+++ b/sql/sql_acl.cc
@@ -9754,13 +9754,13 @@ static int handle_grant_struct(enum enum_acl_lists struct_no, bool drop,
case USER_ACL:
acl_user->user.str= strdup_root(&acl_memroot, user_to->user.str);
acl_user->user.length= user_to->user.length;
- acl_user->host.hostname= strdup_root(&acl_memroot, user_to->host.str);
- acl_user->hostname_length= user_to->host.length;
+ update_hostname(&acl_user->host, strdup_root(&acl_memroot, user_to->host.str));
+ acl_user->hostname_length= strlen(acl_user->host.hostname);
break;
case DB_ACL:
acl_db->user= strdup_root(&acl_memroot, user_to->user.str);
- acl_db->host.hostname= strdup_root(&acl_memroot, user_to->host.str);
+ update_hostname(&acl_db->host, strdup_root(&acl_memroot, user_to->host.str));
break;
case COLUMN_PRIVILEGES_HASH:
@@ -11927,7 +11927,6 @@ get_cached_table_access(GRANT_INTERNAL_INFO *grant_internal_info,
struct MPVIO_EXT :public MYSQL_PLUGIN_VIO
{
MYSQL_SERVER_AUTH_INFO auth_info;
- THD *thd;
ACL_USER *acl_user; ///< a copy, independent from acl_users array
plugin_ref plugin; ///< what plugin we're under
LEX_STRING db; ///< db name from the handshake packet
@@ -12007,7 +12006,7 @@ static bool send_server_handshake_packet(MPVIO_EXT *mpvio,
DBUG_ASSERT(mpvio->status == MPVIO_EXT::FAILURE);
DBUG_ASSERT(data_len <= 255);
- THD *thd= mpvio->thd;
+ THD *thd= mpvio->auth_info.thd;
char *buff= (char *) my_alloca(1 + SERVER_VERSION_LENGTH + 1 + data_len + 64);
char scramble_buf[SCRAMBLE_LENGTH];
char *end= buff;
@@ -12057,14 +12056,14 @@ static bool send_server_handshake_packet(MPVIO_EXT *mpvio,
native_password_plugin will have to send it in a separate packet,
adding one more round trip.
*/
- create_random_string(thd->scramble, SCRAMBLE_LENGTH, &thd->rand);
+ thd_create_random_password(thd, thd->scramble, SCRAMBLE_LENGTH);
data= thd->scramble;
}
data_len= SCRAMBLE_LENGTH;
}
end= strxnmov(end, SERVER_VERSION_LENGTH, RPL_VERSION_HACK, server_version, NullS) + 1;
- int4store((uchar*) end, mpvio->thd->thread_id);
+ int4store((uchar*) end, mpvio->auth_info.thd->thread_id);
end+= 4;
/*
@@ -12079,7 +12078,7 @@ static bool send_server_handshake_packet(MPVIO_EXT *mpvio,
int2store(end, thd->client_capabilities);
/* write server characteristics: up to 16 bytes allowed */
end[2]= (char) default_charset_info->number;
- int2store(end+3, mpvio->thd->server_status);
+ int2store(end+3, mpvio->auth_info.thd->server_status);
int2store(end+5, thd->client_capabilities >> 16);
end[7]= data_len;
DBUG_EXECUTE_IF("poison_srv_handshake_scramble_len", end[7]= -100;);
@@ -12093,9 +12092,9 @@ static bool send_server_handshake_packet(MPVIO_EXT *mpvio,
end= strmake(end, plugin_name(mpvio->plugin)->str,
plugin_name(mpvio->plugin)->length);
- int res= my_net_write(&mpvio->thd->net, (uchar*) buff,
+ int res= my_net_write(&mpvio->auth_info.thd->net, (uchar*) buff,
(size_t) (end - buff + 1)) ||
- net_flush(&mpvio->thd->net);
+ net_flush(&mpvio->auth_info.thd->net);
my_afree(buff);
DBUG_RETURN (res);
}
@@ -12154,7 +12153,7 @@ static bool send_plugin_request_packet(MPVIO_EXT *mpvio,
{
DBUG_ASSERT(mpvio->packets_written == 1);
DBUG_ASSERT(mpvio->packets_read == 1);
- NET *net= &mpvio->thd->net;
+ NET *net= &mpvio->auth_info.thd->net;
static uchar switch_plugin_request_buf[]= { 254 };
DBUG_ENTER("send_plugin_request_packet");
@@ -12179,7 +12178,7 @@ static bool send_plugin_request_packet(MPVIO_EXT *mpvio,
client_auth_plugin == old_password_plugin_name.str;
if (switch_from_long_to_short_scramble)
- DBUG_RETURN (secure_auth(mpvio->thd) ||
+ DBUG_RETURN (secure_auth(mpvio->auth_info.thd) ||
my_net_write(net, switch_plugin_request_buf, 1) ||
net_flush(net));
@@ -12195,8 +12194,8 @@ static bool send_plugin_request_packet(MPVIO_EXT *mpvio,
if (switch_from_short_to_long_scramble)
{
my_error(ER_NOT_SUPPORTED_AUTH_MODE, MYF(0));
- general_log_print(mpvio->thd, COM_CONNECT,
- ER_THD(mpvio->thd, ER_NOT_SUPPORTED_AUTH_MODE));
+ general_log_print(mpvio->auth_info.thd, COM_CONNECT,
+ ER_THD(mpvio->auth_info.thd, ER_NOT_SUPPORTED_AUTH_MODE));
DBUG_RETURN (1);
}
@@ -12220,7 +12219,7 @@ static bool send_plugin_request_packet(MPVIO_EXT *mpvio,
*/
static bool find_mpvio_user(MPVIO_EXT *mpvio)
{
- Security_context *sctx= mpvio->thd->security_ctx;
+ Security_context *sctx= mpvio->auth_info.thd->security_ctx;
DBUG_ENTER("find_mpvio_user");
DBUG_ASSERT(mpvio->acl_user == 0);
@@ -12228,7 +12227,7 @@ static bool find_mpvio_user(MPVIO_EXT *mpvio)
ACL_USER *user= find_user_or_anon(sctx->host, sctx->user, sctx->ip);
if (user)
- mpvio->acl_user= user->copy(mpvio->thd->mem_root);
+ mpvio->acl_user= user->copy(mpvio->auth_info.thd->mem_root);
mysql_mutex_unlock(&acl_cache->lock);
@@ -12252,12 +12251,12 @@ static bool find_mpvio_user(MPVIO_EXT *mpvio)
if (!acl_users.elements)
{
mysql_mutex_unlock(&acl_cache->lock);
- login_failed_error(mpvio->thd);
+ login_failed_error(mpvio->auth_info.thd);
DBUG_RETURN(1);
}
uint i= nr1 % acl_users.elements;
ACL_USER *acl_user_tmp= dynamic_element(&acl_users, i, ACL_USER*);
- mpvio->acl_user= acl_user_tmp->copy(mpvio->thd->mem_root);
+ mpvio->acl_user= acl_user_tmp->copy(mpvio->auth_info.thd->mem_root);
mysql_mutex_unlock(&acl_cache->lock);
mpvio->make_it_fail= true;
@@ -12266,15 +12265,15 @@ static bool find_mpvio_user(MPVIO_EXT *mpvio)
/* user account requires non-default plugin and the client is too old */
if (mpvio->acl_user->plugin.str != native_password_plugin_name.str &&
mpvio->acl_user->plugin.str != old_password_plugin_name.str &&
- !(mpvio->thd->client_capabilities & CLIENT_PLUGIN_AUTH))
+ !(mpvio->auth_info.thd->client_capabilities & CLIENT_PLUGIN_AUTH))
{
DBUG_ASSERT(my_strcasecmp(system_charset_info, mpvio->acl_user->plugin.str,
native_password_plugin_name.str));
DBUG_ASSERT(my_strcasecmp(system_charset_info, mpvio->acl_user->plugin.str,
old_password_plugin_name.str));
my_error(ER_NOT_SUPPORTED_AUTH_MODE, MYF(0));
- general_log_print(mpvio->thd, COM_CONNECT,
- ER_THD(mpvio->thd, ER_NOT_SUPPORTED_AUTH_MODE));
+ general_log_print(mpvio->auth_info.thd, COM_CONNECT,
+ ER_THD(mpvio->auth_info.thd, ER_NOT_SUPPORTED_AUTH_MODE));
DBUG_RETURN (1);
}
@@ -12331,7 +12330,7 @@ read_client_connect_attrs(char **ptr, char *end, CHARSET_INFO *from_cs)
/* the packet format is described in send_change_user_packet() */
static bool parse_com_change_user_packet(MPVIO_EXT *mpvio, uint packet_length)
{
- THD *thd= mpvio->thd;
+ THD *thd= mpvio->auth_info.thd;
NET *net= &thd->net;
Security_context *sctx= thd->security_ctx;
@@ -12485,7 +12484,7 @@ static ulong parse_client_handshake_packet(MPVIO_EXT *mpvio,
uchar **buff, ulong pkt_len)
{
#ifndef EMBEDDED_LIBRARY
- THD *thd= mpvio->thd;
+ THD *thd= mpvio->auth_info.thd;
NET *net= &thd->net;
char *end;
DBUG_ASSERT(mpvio->status == MPVIO_EXT::FAILURE);
@@ -12695,7 +12694,7 @@ static ulong parse_client_handshake_packet(MPVIO_EXT *mpvio,
if ((thd->client_capabilities & CLIENT_CONNECT_ATTRS) &&
read_client_connect_attrs(&next_field, ((char *)net->read_pos) + pkt_len,
- mpvio->thd->charset()))
+ mpvio->auth_info.thd->charset()))
return packet_error;
/*
@@ -12780,13 +12779,13 @@ static int server_mpvio_write_packet(MYSQL_PLUGIN_VIO *param,
We'll escape these bytes with \1. Consequently, we
have to escape \1 byte too.
*/
- res= net_write_command(&mpvio->thd->net, 1, (uchar*)"", 0,
+ res= net_write_command(&mpvio->auth_info.thd->net, 1, (uchar*)"", 0,
packet, packet_len);
}
else
{
- res= my_net_write(&mpvio->thd->net, packet, packet_len) ||
- net_flush(&mpvio->thd->net);
+ res= my_net_write(&mpvio->auth_info.thd->net, packet, packet_len) ||
+ net_flush(&mpvio->auth_info.thd->net);
}
mpvio->packets_written++;
DBUG_RETURN(res);
@@ -12816,7 +12815,7 @@ static int server_mpvio_read_packet(MYSQL_PLUGIN_VIO *param, uchar **buf)
if (server_mpvio_write_packet(mpvio, 0, 0))
pkt_len= packet_error;
else
- pkt_len= my_net_read(&mpvio->thd->net);
+ pkt_len= my_net_read(&mpvio->auth_info.thd->net);
}
else if (mpvio->cached_client_reply.pkt)
{
@@ -12850,10 +12849,10 @@ static int server_mpvio_read_packet(MYSQL_PLUGIN_VIO *param, uchar **buf)
if (server_mpvio_write_packet(mpvio, 0, 0))
pkt_len= packet_error;
else
- pkt_len= my_net_read(&mpvio->thd->net);
+ pkt_len= my_net_read(&mpvio->auth_info.thd->net);
}
else
- pkt_len= my_net_read(&mpvio->thd->net);
+ pkt_len= my_net_read(&mpvio->auth_info.thd->net);
if (pkt_len == packet_error)
goto err;
@@ -12871,14 +12870,14 @@ static int server_mpvio_read_packet(MYSQL_PLUGIN_VIO *param, uchar **buf)
goto err;
}
else
- *buf= mpvio->thd->net.read_pos;
+ *buf= mpvio->auth_info.thd->net.read_pos;
DBUG_RETURN((int)pkt_len);
err:
if (mpvio->status == MPVIO_EXT::FAILURE)
{
- if (!mpvio->thd->is_error())
+ if (!mpvio->auth_info.thd->is_error())
my_error(ER_HANDSHAKE_ERROR, MYF(0));
}
DBUG_RETURN(-1);
@@ -12892,7 +12891,7 @@ static void server_mpvio_info(MYSQL_PLUGIN_VIO *vio,
MYSQL_PLUGIN_VIO_INFO *info)
{
MPVIO_EXT *mpvio= (MPVIO_EXT *) vio;
- mpvio_info(mpvio->thd->net.vio, info);
+ mpvio_info(mpvio->auth_info.thd->net.vio, info);
}
static bool acl_check_ssl(THD *thd, const ACL_USER *acl_user)
@@ -13027,11 +13026,11 @@ static int do_auth_once(THD *thd, const LEX_STRING *auth_plugin_name,
if (plugin)
{
st_mysql_auth *auth= (st_mysql_auth *) plugin_decl(plugin)->info;
- switch (auth->interface_version) {
- case 0x0200:
+ switch (auth->interface_version >> 8) {
+ case 0x02:
res= auth->authenticate_user(mpvio, &mpvio->auth_info);
break;
- case 0x0100:
+ case 0x01:
{
MYSQL_SERVER_AUTH_INFO_0x0100 compat;
compat.downgrade(&mpvio->auth_info);
@@ -13050,7 +13049,7 @@ static int do_auth_once(THD *thd, const LEX_STRING *auth_plugin_name,
/* Server cannot load the required plugin. */
Host_errors errors;
errors.m_no_auth_plugin= 1;
- inc_host_errors(mpvio->thd->security_ctx->ip, &errors);
+ inc_host_errors(mpvio->auth_info.thd->security_ctx->ip, &errors);
my_error(ER_PLUGIN_IS_NOT_LOADED, MYF(0), auth_plugin_name->str);
res= CR_ERROR;
}
@@ -13095,9 +13094,9 @@ bool acl_authenticate(THD *thd, uint com_change_user_pkt_len)
mpvio.read_packet= server_mpvio_read_packet;
mpvio.write_packet= server_mpvio_write_packet;
mpvio.info= server_mpvio_info;
- mpvio.thd= thd;
mpvio.status= MPVIO_EXT::FAILURE;
mpvio.make_it_fail= false;
+ mpvio.auth_info.thd= thd;
mpvio.auth_info.host_or_ip= thd->security_ctx->host_or_ip;
mpvio.auth_info.host_or_ip_length=
(unsigned int) strlen(thd->security_ctx->host_or_ip);
@@ -13196,7 +13195,7 @@ bool acl_authenticate(THD *thd, uint com_change_user_pkt_len)
errors.m_auth_plugin= 1;
break;
}
- inc_host_errors(mpvio.thd->security_ctx->ip, &errors);
+ inc_host_errors(mpvio.auth_info.thd->security_ctx->ip, &errors);
if (!thd->is_error())
login_failed_error(thd);
DBUG_RETURN(1);
@@ -13223,7 +13222,7 @@ bool acl_authenticate(THD *thd, uint com_change_user_pkt_len)
{
Host_errors errors;
errors.m_proxy_user= 1;
- inc_host_errors(mpvio.thd->security_ctx->ip, &errors);
+ inc_host_errors(mpvio.auth_info.thd->security_ctx->ip, &errors);
if (!thd->is_error())
login_failed_error(thd);
DBUG_RETURN(1);
@@ -13243,7 +13242,7 @@ bool acl_authenticate(THD *thd, uint com_change_user_pkt_len)
Host_errors errors;
errors.m_proxy_user_acl= 1;
- inc_host_errors(mpvio.thd->security_ctx->ip, &errors);
+ inc_host_errors(mpvio.auth_info.thd->security_ctx->ip, &errors);
if (!thd->is_error())
login_failed_error(thd);
DBUG_RETURN(1);
@@ -13273,7 +13272,7 @@ bool acl_authenticate(THD *thd, uint com_change_user_pkt_len)
{
Host_errors errors;
errors.m_ssl= 1;
- inc_host_errors(mpvio.thd->security_ctx->ip, &errors);
+ inc_host_errors(mpvio.auth_info.thd->security_ctx->ip, &errors);
login_failed_error(thd);
DBUG_RETURN(1);
}
@@ -13410,13 +13409,13 @@ static int native_password_authenticate(MYSQL_PLUGIN_VIO *vio,
uchar *pkt;
int pkt_len;
MPVIO_EXT *mpvio= (MPVIO_EXT *) vio;
- THD *thd=mpvio->thd;
+ THD *thd=info->thd;
DBUG_ENTER("native_password_authenticate");
/* generate the scramble, or reuse the old one */
if (thd->scramble[SCRAMBLE_LENGTH])
{
- create_random_string(thd->scramble, SCRAMBLE_LENGTH, &thd->rand);
+ thd_create_random_password(thd, thd->scramble, SCRAMBLE_LENGTH);
/* and send it to the client */
if (mpvio->write_packet(mpvio, (uchar*)thd->scramble, SCRAMBLE_LENGTH + 1))
DBUG_RETURN(CR_AUTH_HANDSHAKE);
@@ -13495,12 +13494,12 @@ static int old_password_authenticate(MYSQL_PLUGIN_VIO *vio,
uchar *pkt;
int pkt_len;
MPVIO_EXT *mpvio= (MPVIO_EXT *) vio;
- THD *thd=mpvio->thd;
+ THD *thd=info->thd;
/* generate the scramble, or reuse the old one */
if (thd->scramble[SCRAMBLE_LENGTH])
{
- create_random_string(thd->scramble, SCRAMBLE_LENGTH, &thd->rand);
+ thd_create_random_password(thd, thd->scramble, SCRAMBLE_LENGTH);
/* and send it to the client */
if (mpvio->write_packet(mpvio, (uchar*)thd->scramble, SCRAMBLE_LENGTH + 1))
return CR_AUTH_HANDSHAKE;
diff --git a/sql/sql_alter.h b/sql/sql_alter.h
index faba3a14a1b..5668a0f52be 100644
--- a/sql/sql_alter.h
+++ b/sql/sql_alter.h
@@ -70,59 +70,56 @@ public:
// Set for DISABLE KEYS | ENABLE KEYS
static const uint ALTER_KEYS_ONOFF = 1L << 9;
- // Set for CONVERT TO CHARACTER SET
- static const uint ALTER_CONVERT = 1L << 10;
-
// Set for FORCE
// Set for ENGINE(same engine)
// Set by mysql_recreate_table()
- static const uint ALTER_RECREATE = 1L << 11;
+ static const uint ALTER_RECREATE = 1L << 10;
// Set for ADD PARTITION
- static const uint ALTER_ADD_PARTITION = 1L << 12;
+ static const uint ALTER_ADD_PARTITION = 1L << 11;
// Set for DROP PARTITION
- static const uint ALTER_DROP_PARTITION = 1L << 13;
+ static const uint ALTER_DROP_PARTITION = 1L << 12;
// Set for COALESCE PARTITION
- static const uint ALTER_COALESCE_PARTITION = 1L << 14;
+ static const uint ALTER_COALESCE_PARTITION = 1L << 13;
// Set for REORGANIZE PARTITION ... INTO
- static const uint ALTER_REORGANIZE_PARTITION = 1L << 15;
+ static const uint ALTER_REORGANIZE_PARTITION = 1L << 14;
// Set for partition_options
- static const uint ALTER_PARTITION = 1L << 16;
+ static const uint ALTER_PARTITION = 1L << 15;
// Set for LOAD INDEX INTO CACHE ... PARTITION
// Set for CACHE INDEX ... PARTITION
- static const uint ALTER_ADMIN_PARTITION = 1L << 17;
+ static const uint ALTER_ADMIN_PARTITION = 1L << 16;
// Set for REORGANIZE PARTITION
- static const uint ALTER_TABLE_REORG = 1L << 18;
+ static const uint ALTER_TABLE_REORG = 1L << 17;
// Set for REBUILD PARTITION
- static const uint ALTER_REBUILD_PARTITION = 1L << 19;
+ static const uint ALTER_REBUILD_PARTITION = 1L << 18;
// Set for partitioning operations specifying ALL keyword
- static const uint ALTER_ALL_PARTITION = 1L << 20;
+ static const uint ALTER_ALL_PARTITION = 1L << 19;
// Set for REMOVE PARTITIONING
- static const uint ALTER_REMOVE_PARTITIONING = 1L << 21;
+ static const uint ALTER_REMOVE_PARTITIONING = 1L << 20;
// Set for ADD FOREIGN KEY
- static const uint ADD_FOREIGN_KEY = 1L << 22;
+ static const uint ADD_FOREIGN_KEY = 1L << 21;
// Set for DROP FOREIGN KEY
- static const uint DROP_FOREIGN_KEY = 1L << 23;
+ static const uint DROP_FOREIGN_KEY = 1L << 22;
// Set for EXCHANGE PARITION
- static const uint ALTER_EXCHANGE_PARTITION = 1L << 24;
+ static const uint ALTER_EXCHANGE_PARTITION = 1L << 23;
// Set by Sql_cmd_alter_table_truncate_partition::execute()
- static const uint ALTER_TRUNCATE_PARTITION = 1L << 25;
+ static const uint ALTER_TRUNCATE_PARTITION = 1L << 24;
// Set for ADD [COLUMN] FIRST | AFTER
- static const uint ALTER_COLUMN_ORDER = 1L << 26;
+ static const uint ALTER_COLUMN_ORDER = 1L << 25;
static const uint ALTER_ADD_CHECK_CONSTRAINT = 1L << 27;
static const uint ALTER_DROP_CHECK_CONSTRAINT = 1L << 28;
diff --git a/sql/sql_analyze_stmt.cc b/sql/sql_analyze_stmt.cc
index 58f72d6b8de..cc6e0f89f75 100644
--- a/sql/sql_analyze_stmt.cc
+++ b/sql/sql_analyze_stmt.cc
@@ -12,7 +12,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation
diff --git a/sql/sql_analyze_stmt.h b/sql/sql_analyze_stmt.h
index 2a08a842dfc..27fd7fb6d6a 100644
--- a/sql/sql_analyze_stmt.h
+++ b/sql/sql_analyze_stmt.h
@@ -12,7 +12,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
/*
diff --git a/sql/sql_base.cc b/sql/sql_base.cc
index 65cfe99649e..93511bb9188 100644
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@ -5811,7 +5811,7 @@ find_field_in_tables(THD *thd, Item_ident *item,
if (!table_ref->belong_to_view &&
!table_ref->belong_to_derived)
{
- SELECT_LEX *current_sel= thd->lex->current_select;
+ SELECT_LEX *current_sel= item->context->select_lex;
SELECT_LEX *last_select= table_ref->select_lex;
bool all_merged= TRUE;
for (SELECT_LEX *sl= current_sel; sl && sl!=last_select;
diff --git a/sql/sql_binlog.cc b/sql/sql_binlog.cc
index d92ac15822f..5f554a3cd92 100644
--- a/sql/sql_binlog.cc
+++ b/sql/sql_binlog.cc
@@ -20,7 +20,6 @@
#include "sql_parse.h"
#include "sql_acl.h"
#include "rpl_rli.h"
-#include "base64.h"
#include "slave.h"
#include "log_event.h"
diff --git a/sql/sql_class.cc b/sql/sql_class.cc
index c3bd40cf230..f8ba23298e0 100644
--- a/sql/sql_class.cc
+++ b/sql/sql_class.cc
@@ -4408,6 +4408,28 @@ extern "C" int thd_is_connected(MYSQL_THD thd)
}
+extern "C" double thd_rnd(MYSQL_THD thd)
+{
+ return my_rnd(&thd->rand);
+}
+
+
+/**
+ Generate string of printable random characters of requested length.
+
+ @param to[out] Buffer for generation; must be at least length+1 bytes
+ long; result string is always null-terminated
+ @param length[in] How many random characters to put in buffer
+*/
+extern "C" void thd_create_random_password(MYSQL_THD thd,
+ char *to, size_t length)
+{
+ for (char *end= to + length; to < end; to++)
+ *to= (char) (my_rnd(&thd->rand)*94 + 33);
+ *to= '\0';
+}
+
+
#ifdef INNODB_COMPATIBILITY_HOOKS
/** open a table and add it to thd->open_tables
@@ -4481,7 +4503,10 @@ MYSQL_THD create_thd()
void destroy_thd(MYSQL_THD thd)
{
- delete_running_thd(thd);
+ thd->add_status_to_global();
+ unlink_not_visible_thd(thd);
+ delete thd;
+ dec_thread_running();
}
void reset_thd(MYSQL_THD thd)
@@ -4533,6 +4558,15 @@ extern "C" int thd_rpl_is_parallel(const MYSQL_THD thd)
return thd->rgi_slave && thd->rgi_slave->is_parallel_exec;
}
+
+/* Returns high resolution timestamp for the start
+ of the current query. */
+extern "C" unsigned long long thd_start_utime(const MYSQL_THD thd)
+{
+ return thd->start_utime;
+}
+
+
/*
This function can optionally be called to check if thd_rpl_deadlock_check()
needs to be called for waits done by a given transaction.
@@ -6979,7 +7013,13 @@ wait_for_commit::reinit()
So in this case, do a re-init of the mutex. In release builds, we want to
avoid the overhead of a re-init though.
+
+ To ensure that no one is locking the mutex, we take a lock of it first.
+ For full explanation, see wait_for_commit::~wait_for_commit()
*/
+ mysql_mutex_lock(&LOCK_wait_commit);
+ mysql_mutex_unlock(&LOCK_wait_commit);
+
mysql_mutex_destroy(&LOCK_wait_commit);
mysql_mutex_init(key_LOCK_wait_commit, &LOCK_wait_commit, MY_MUTEX_INIT_FAST);
#endif
diff --git a/sql/sql_connect.cc b/sql/sql_connect.cc
index 157e59c2446..5cb4cd87296 100644
--- a/sql/sql_connect.cc
+++ b/sql/sql_connect.cc
@@ -832,11 +832,7 @@ bool init_new_connection_handler_thread()
statistic_increment(connection_errors_internal, &LOCK_status);
return 1;
}
- DBUG_EXECUTE_IF("simulate_failed_connection_1",
- {
- DBUG_SET("-d,simulate_failed_connection_1");
- return(1);
- });
+ DBUG_EXECUTE_IF("simulate_failed_connection_1", return(1); );
return 0;
}
diff --git a/sql/sql_db.cc b/sql/sql_db.cc
index 8b7d4ee5ed2..813a17cdfdb 100644
--- a/sql/sql_db.cc
+++ b/sql/sql_db.cc
@@ -846,7 +846,8 @@ mysql_rm_db_internal(THD *thd,char *db, bool if_exists, bool silent)
if there exists a table with the name 'db', so let's just do it
separately. We know this file exists and needs to be deleted anyway.
*/
- if (my_delete_with_symlink(path, MYF(0)) && my_errno != ENOENT)
+ if (mysql_file_delete_with_symlink(key_file_misc, path, "", MYF(0)) &&
+ my_errno != ENOENT)
{
my_error(EE_DELETE, MYF(0), path, my_errno);
DBUG_RETURN(true);
@@ -1153,9 +1154,9 @@ static bool find_db_tables_and_rm_known_files(THD *thd, MY_DIR *dirp,
strxmov(filePath, path, "/", file->name, NullS);
/*
We ignore ENOENT error in order to skip files that was deleted
- by concurrently running statement like REAPIR TABLE ...
+ by concurrently running statement like REPAIR TABLE ...
*/
- if (my_delete_with_symlink(filePath, MYF(0)) &&
+ if (mysql_file_delete_with_symlink(key_file_misc, filePath, "", MYF(0)) &&
my_errno != ENOENT)
{
my_error(EE_DELETE, MYF(0), filePath, my_errno);
@@ -1271,7 +1272,7 @@ long mysql_rm_arc_files(THD *thd, MY_DIR *dirp, const char *org_path)
continue;
}
strxmov(filePath, org_path, "/", file->name, NullS);
- if (mysql_file_delete_with_symlink(key_file_misc, filePath, MYF(MY_WME)))
+ if (mysql_file_delete_with_symlink(key_file_misc, filePath, "", MYF(MY_WME)))
{
goto err;
}
diff --git a/sql/sql_derived.cc b/sql/sql_derived.cc
index faf6dd790a6..90b6dad313a 100644
--- a/sql/sql_derived.cc
+++ b/sql/sql_derived.cc
@@ -449,6 +449,9 @@ bool mysql_derived_merge(THD *thd, LEX *lex, TABLE_LIST *derived)
{
Item *expr= derived->on_expr;
expr= and_conds(thd, expr, dt_select->join ? dt_select->join->conds : 0);
+ if (expr)
+ expr->top_level_item();
+
if (expr && (derived->prep_on_expr || expr != derived->on_expr))
{
derived->on_expr= expr;
diff --git a/sql/sql_explain.cc b/sql/sql_explain.cc
index 131c5a3bcfa..6b5db7e923b 100644
--- a/sql/sql_explain.cc
+++ b/sql/sql_explain.cc
@@ -12,7 +12,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation
diff --git a/sql/sql_explain.h b/sql/sql_explain.h
index 5793599f4e1..bfddf40ff33 100644
--- a/sql/sql_explain.h
+++ b/sql/sql_explain.h
@@ -12,7 +12,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
/*
diff --git a/sql/sql_expression_cache.cc b/sql/sql_expression_cache.cc
index 3ed33d97094..c79783bf561 100644
--- a/sql/sql_expression_cache.cc
+++ b/sql/sql_expression_cache.cc
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#include <my_global.h>
#include "sql_base.h"
diff --git a/sql/sql_expression_cache.h b/sql/sql_expression_cache.h
index 87be6ddb4f4..05ac51f81f2 100644
--- a/sql/sql_expression_cache.h
+++ b/sql/sql_expression_cache.h
@@ -12,7 +12,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#ifndef SQL_EXPRESSION_CACHE_INCLUDED
#define SQL_EXPRESSION_CACHE_INCLUDED
diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc
index 27820c16543..8e5dfb4f69c 100644
--- a/sql/sql_insert.cc
+++ b/sql/sql_insert.cc
@@ -330,7 +330,7 @@ static bool has_no_default_value(THD *thd, Field *field, TABLE_LIST *table_list)
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, ER_NO_DEFAULT_FOR_FIELD,
ER_THD(thd, ER_NO_DEFAULT_FOR_FIELD), field->field_name);
}
- return true;
+ return thd->really_abort_on_warning();
}
return false;
}
@@ -904,7 +904,12 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list,
if (fields.elements || !value_count || table_list->view != 0)
{
- if (check_that_all_fields_are_given_values(thd, table, table_list))
+ if (table->triggers &&
+ table->triggers->has_triggers(TRG_EVENT_INSERT, TRG_ACTION_BEFORE))
+ {
+ /* BEFORE INSERT triggers exist, the check will be done later, per row */
+ }
+ else if (check_that_all_fields_are_given_values(thd, table, table_list))
{
error= 1;
goto values_loop_end;
@@ -3870,8 +3875,8 @@ bool select_insert::prepare_eof()
bool select_insert::send_ok_packet() {
char message[160]; /* status message */
- ulong row_count; /* rows affected */
- ulong id; /* last insert-id */
+ ulonglong row_count; /* rows affected */
+ ulonglong id; /* last insert-id */
DBUG_ENTER("select_insert::send_ok_packet");
diff --git a/sql/sql_join_cache.cc b/sql/sql_join_cache.cc
index 8a293956da7..12c64caa225 100644
--- a/sql/sql_join_cache.cc
+++ b/sql/sql_join_cache.cc
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
/**
@file
diff --git a/sql/sql_join_cache.h b/sql/sql_join_cache.h
index fa00e309623..4ae843ebfc2 100644
--- a/sql/sql_join_cache.h
+++ b/sql/sql_join_cache.h
@@ -12,7 +12,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
/*
This file contains declarations for implementations
diff --git a/sql/sql_lifo_buffer.h b/sql/sql_lifo_buffer.h
index feec4aeb4c2..8fa13c66dd9 100644
--- a/sql/sql_lifo_buffer.h
+++ b/sql/sql_lifo_buffer.h
@@ -12,7 +12,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
/**
@defgroup Bi-directional LIFO buffers used by DS-MRR implementation
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index b41f6ffd0f0..590d2dfe681 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -2542,12 +2542,12 @@ int prepare_schema_table(THD *thd, LEX *lex, Table_ident *table_ident,
#endif
case SCH_COLUMNS:
case SCH_STATISTICS:
- {
#ifdef DONT_ALLOW_SHOW_COMMANDS
my_message(ER_NOT_ALLOWED_COMMAND,
ER_THD(thd, ER_NOT_ALLOWED_COMMAND), MYF(0));
DBUG_RETURN(1);
#else
+ {
DBUG_ASSERT(table_ident);
TABLE_LIST **query_tables_last= lex->query_tables_last;
schema_select_lex= new (thd->mem_root) SELECT_LEX();
@@ -2914,7 +2914,7 @@ static bool do_execute_sp(THD *thd, sp_head *sp)
int
mysql_execute_command(THD *thd)
{
- int res= FALSE;
+ int res= 0;
int up_result= 0;
LEX *lex= thd->lex;
/* first SELECT_LEX (have special meaning for many of non-SELECTcommands) */
@@ -3593,10 +3593,17 @@ mysql_execute_command(THD *thd)
if (check_global_access(thd, SUPER_ACL))
goto error;
+ /*
+ In this code it's ok to use LOCK_active_mi as we are adding new things
+ into master_info_index
+ */
mysql_mutex_lock(&LOCK_active_mi);
-
if (!master_info_index)
+ {
+ mysql_mutex_unlock(&LOCK_active_mi);
+ my_error(ER_SERVER_SHUTDOWN, MYF(0));
goto error;
+ }
mi= master_info_index->get_master_info(&lex_mi->connection_name,
Sql_condition::WARN_LEVEL_NOTE);
@@ -3625,7 +3632,7 @@ mysql_execute_command(THD *thd)
If new master was not added, we still need to free mi.
*/
if (master_info_added)
- master_info_index->remove_master_info(&lex_mi->connection_name);
+ master_info_index->remove_master_info(mi);
else
delete mi;
}
@@ -3643,22 +3650,24 @@ mysql_execute_command(THD *thd)
/* Accept one of two privileges */
if (check_global_access(thd, SUPER_ACL | REPL_CLIENT_ACL))
goto error;
- mysql_mutex_lock(&LOCK_active_mi);
if (lex->verbose)
+ {
+ mysql_mutex_lock(&LOCK_active_mi);
res= show_all_master_info(thd);
+ mysql_mutex_unlock(&LOCK_active_mi);
+ }
else
{
LEX_MASTER_INFO *lex_mi= &thd->lex->mi;
Master_info *mi;
- mi= master_info_index->get_master_info(&lex_mi->connection_name,
- Sql_condition::WARN_LEVEL_ERROR);
- if (mi != NULL)
+ if ((mi= get_master_info(&lex_mi->connection_name,
+ Sql_condition::WARN_LEVEL_ERROR)))
{
res= show_master_info(thd, mi, 0);
+ mi->release();
}
}
- mysql_mutex_unlock(&LOCK_active_mi);
break;
}
case SQLCOM_SHOW_MASTER_STAT:
@@ -4009,22 +4018,23 @@ end_with_restore_list:
load_error= rpl_load_gtid_slave_state(thd);
- mysql_mutex_lock(&LOCK_active_mi);
-
- if ((mi= (master_info_index->
- get_master_info(&lex_mi->connection_name,
- Sql_condition::WARN_LEVEL_ERROR))))
+ /*
+ We don't need to ensure that only one user is using master_info
+ as start_slave is protected against simultaneous usage
+ */
+ if ((mi= get_master_info(&lex_mi->connection_name,
+ Sql_condition::WARN_LEVEL_ERROR)))
{
if (load_error)
{
/*
- We cannot start a slave using GTID if we cannot load the GTID position
- from the mysql.gtid_slave_pos table. But we can allow non-GTID
- replication (useful eg. during upgrade).
+ We cannot start a slave using GTID if we cannot load the
+ GTID position from the mysql.gtid_slave_pos table. But we
+ can allow non-GTID replication (useful eg. during upgrade).
*/
if (mi->using_gtid != Master_info::USE_GTID_NO)
{
- mysql_mutex_unlock(&LOCK_active_mi);
+ mi->release();
break;
}
else
@@ -4032,8 +4042,8 @@ end_with_restore_list:
}
if (!start_slave(thd, mi, 1 /* net report*/))
my_ok(thd);
+ mi->release();
}
- mysql_mutex_unlock(&LOCK_active_mi);
break;
}
case SQLCOM_SLAVE_STOP:
@@ -4063,13 +4073,17 @@ end_with_restore_list:
}
lex_mi= &thd->lex->mi;
- mysql_mutex_lock(&LOCK_active_mi);
- if ((mi= (master_info_index->
- get_master_info(&lex_mi->connection_name,
- Sql_condition::WARN_LEVEL_ERROR))))
- if (!stop_slave(thd, mi, 1/* net report*/))
+ if ((mi= get_master_info(&lex_mi->connection_name,
+ Sql_condition::WARN_LEVEL_ERROR)))
+ {
+ if (stop_slave(thd, mi, 1/* net report*/))
+ res= 1;
+ mi->release();
+ if (rpl_parallel_resize_pool_if_no_slaves())
+ res= 1;
+ if (!res)
my_ok(thd);
- mysql_mutex_unlock(&LOCK_active_mi);
+ }
break;
}
case SQLCOM_SLAVE_ALL_START:
@@ -5395,11 +5409,13 @@ end_with_restore_list:
reload_acl_and_cache binlog interactions failed
*/
res= 1;
- }
+ }
if (!res)
my_ok(thd);
}
+ else
+ res= 1; // reload_acl_and_cache failed
#ifdef HAVE_REPLICATION
if (lex->type & REFRESH_READ_LOCK)
rpl_unpause_after_ftwrl(thd);
@@ -7755,7 +7771,7 @@ static void wsrep_mysql_parse(THD *thd, char *rawbuf, uint length,
}
/*
- When you modify mysql_parse(), you may need to mofify
+ When you modify mysql_parse(), you may need to modify
mysql_test_parse_for_slave() in this same file.
*/
@@ -9696,48 +9712,24 @@ bool check_ident_length(LEX_STRING *ident)
}
-C_MODE_START
-
/*
Check if path does not contain mysql data home directory
SYNOPSIS
- test_if_data_home_dir()
- dir directory
+ path_starts_from_data_home_dir()
+ dir directory, with all symlinks resolved
RETURN VALUES
0 ok
1 error ; Given path contains data directory
*/
+extern "C" {
-int test_if_data_home_dir(const char *dir)
+int path_starts_from_data_home_dir(const char *path)
{
- char path[FN_REFLEN];
- int dir_len;
- DBUG_ENTER("test_if_data_home_dir");
-
- if (!dir)
- DBUG_RETURN(0);
+ int dir_len= strlen(path);
+ DBUG_ENTER("path_starts_from_data_home_dir");
- /*
- data_file_name and index_file_name include the table name without
- extension. Mostly this does not refer to an existing file. When
- comparing data_file_name or index_file_name against the data
- directory, we try to resolve all symbolic links. On some systems,
- we use realpath(3) for the resolution. This returns ENOENT if the
- resolved path does not refer to an existing file. my_realpath()
- does then copy the requested path verbatim, without symlink
- resolution. Thereafter the comparison can fail even if the
- requested path is within the data directory. E.g. if symlinks to
- another file system are used. To make realpath(3) return the
- resolved path, we strip the table name and compare the directory
- path only. If the directory doesn't exist either, table creation
- will fail anyway.
- */
-
- (void) fn_format(path, dir, "", "",
- (MY_RETURN_REAL_PATH|MY_RESOLVE_SYMLINKS));
- dir_len= strlen(path);
if (mysql_unpacked_real_data_home_len<= dir_len)
{
if (dir_len > mysql_unpacked_real_data_home_len &&
@@ -9765,7 +9757,31 @@ int test_if_data_home_dir(const char *dir)
DBUG_RETURN(0);
}
-C_MODE_END
+}
+
+/*
+ Check if path does not contain mysql data home directory
+
+ SYNOPSIS
+ test_if_data_home_dir()
+ dir directory
+
+ RETURN VALUES
+ 0 ok
+ 1 error ; Given path contains data directory
+*/
+
+int test_if_data_home_dir(const char *dir)
+{
+ char path[FN_REFLEN];
+ DBUG_ENTER("test_if_data_home_dir");
+
+ if (!dir)
+ DBUG_RETURN(0);
+
+ (void) fn_format(path, dir, "", "", MY_RETURN_REAL_PATH);
+ DBUG_RETURN(path_starts_from_data_home_dir(path));
+}
int error_if_data_home_dir(const char *path, const char *what)
diff --git a/sql/sql_parse.h b/sql/sql_parse.h
index d669f36acef..eedb74df959 100644
--- a/sql/sql_parse.h
+++ b/sql/sql_parse.h
@@ -33,7 +33,8 @@ enum enum_mysql_completiontype {
COMMIT_RELEASE=-1, COMMIT=0, COMMIT_AND_CHAIN=6
};
-extern "C" int test_if_data_home_dir(const char *dir);
+extern "C" int path_starts_from_data_home_dir(const char *dir);
+int test_if_data_home_dir(const char *dir);
int error_if_data_home_dir(const char *path, const char *what);
my_bool net_allocate_new_packet(NET *net, void *thd, uint my_flags);
diff --git a/sql/sql_plugin.cc b/sql/sql_plugin.cc
index 31d59ea47ef..101ea3fd3c7 100644
--- a/sql/sql_plugin.cc
+++ b/sql/sql_plugin.cc
@@ -724,7 +724,7 @@ static st_plugin_dl *plugin_dl_add(const LEX_STRING *dl, int report)
{
#ifdef HAVE_DLOPEN
char dlpath[FN_REFLEN];
- uint plugin_dir_len, dummy_errors, dlpathlen, i;
+ uint plugin_dir_len, dummy_errors, i;
struct st_plugin_dl *tmp= 0, plugin_dl;
void *sym;
st_ptr_backup tmp_backup[array_elements(list_of_services)];
@@ -760,15 +760,7 @@ static st_plugin_dl *plugin_dl_add(const LEX_STRING *dl, int report)
/* Open new dll handle */
if (!(plugin_dl.handle= dlopen(dlpath, RTLD_NOW)))
{
- const char *errmsg=dlerror();
- dlpathlen= strlen(dlpath);
- if (!strncmp(dlpath, errmsg, dlpathlen))
- { // if errmsg starts from dlpath, trim this prefix.
- errmsg+=dlpathlen;
- if (*errmsg == ':') errmsg++;
- if (*errmsg == ' ') errmsg++;
- }
- report_error(report, ER_CANT_OPEN_LIBRARY, dlpath, errno, errmsg);
+ report_error(report, ER_CANT_OPEN_LIBRARY, dlpath, errno, my_dlerror(dlpath));
goto ret;
}
dlopen_count++;
@@ -1569,8 +1561,8 @@ int plugin_init(int *argc, char **argv, int flags)
}
/* prepare debug_sync service */
- DBUG_ASSERT(strcmp(list_of_services[4].name, "debug_sync_service") == 0);
- list_of_services[4].service= *(void**)&debug_sync_C_callback_ptr;
+ DBUG_ASSERT(strcmp(list_of_services[1].name, "debug_sync_service") == 0);
+ list_of_services[1].service= *(void**)&debug_sync_C_callback_ptr;
/* prepare encryption_keys service */
finalize_encryption_plugin(0);
@@ -1657,10 +1649,11 @@ int plugin_init(int *argc, char **argv, int flags)
{
char path[FN_REFLEN + 1];
build_table_filename(path, sizeof(path) - 1, "mysql", "plugin", reg_ext, 0);
- enum legacy_db_type db_type;
- frm_type_enum frm_type= dd_frm_type(NULL, path, &db_type);
+ char engine_name_buf[NAME_CHAR_LEN + 1];
+ LEX_STRING maybe_myisam= { engine_name_buf, 0 };
+ frm_type_enum frm_type= dd_frm_type(NULL, path, &maybe_myisam);
/* if mysql.plugin table is MyISAM - load it right away */
- if (frm_type == FRMTYPE_TABLE && db_type == DB_TYPE_MYISAM)
+ if (frm_type == FRMTYPE_TABLE && !strcasecmp(maybe_myisam.str, "MyISAM"))
{
plugin_load(&tmp_root);
flags|= PLUGIN_INIT_SKIP_PLUGIN_TABLE;
@@ -3302,14 +3295,14 @@ uchar* sys_var_pluginvar::real_value_ptr(THD *thd, enum_var_type type)
{
switch (plugin_var->flags & PLUGIN_VAR_TYPEMASK) {
case PLUGIN_VAR_BOOL:
- thd->sys_var_tmp.my_bool_value= (my_bool)option.def_value;
+ thd->sys_var_tmp.my_bool_value= option.def_value;
return (uchar*) &thd->sys_var_tmp.my_bool_value;
case PLUGIN_VAR_INT:
- thd->sys_var_tmp.int_value= (int)option.def_value;
+ thd->sys_var_tmp.int_value= option.def_value;
return (uchar*) &thd->sys_var_tmp.int_value;
case PLUGIN_VAR_LONG:
case PLUGIN_VAR_ENUM:
- thd->sys_var_tmp.long_value= (long)option.def_value;
+ thd->sys_var_tmp.long_value= option.def_value;
return (uchar*) &thd->sys_var_tmp.long_value;
case PLUGIN_VAR_LONGLONG:
case PLUGIN_VAR_SET:
diff --git a/sql/sql_plugin_services.ic b/sql/sql_plugin_services.ic
index c3dfde18ab6..2e71fac50be 100644
--- a/sql/sql_plugin_services.ic
+++ b/sql/sql_plugin_services.ic
@@ -60,6 +60,33 @@ static struct thd_timezone_service_st thd_timezone_handler= {
thd_gmt_sec_to_TIME
};
+static struct my_sha2_service_st my_sha2_handler = {
+ my_sha224,
+ my_sha224_multi,
+ my_sha224_context_size,
+ my_sha224_init,
+ my_sha224_input,
+ my_sha224_result,
+ my_sha256,
+ my_sha256_multi,
+ my_sha256_context_size,
+ my_sha256_init,
+ my_sha256_input,
+ my_sha256_result,
+ my_sha384,
+ my_sha384_multi,
+ my_sha384_context_size,
+ my_sha384_init,
+ my_sha384_input,
+ my_sha384_result,
+ my_sha512,
+ my_sha512_multi,
+ my_sha512_context_size,
+ my_sha512_init,
+ my_sha512_input,
+ my_sha512_result,
+};
+
static struct my_sha1_service_st my_sha1_handler = {
my_sha1,
my_sha1_multi,
@@ -92,6 +119,20 @@ static struct thd_autoinc_service_st thd_autoinc_handler= {
thd_get_autoinc
};
+static struct thd_rnd_service_st thd_rnd_handler= {
+ thd_rnd,
+ thd_create_random_password
+};
+
+static struct base64_service_st base64_handler= {
+ my_base64_needed_encoded_length,
+ my_base64_encode_max_arg_length,
+ my_base64_needed_decoded_length,
+ my_base64_decode_max_arg_length,
+ my_base64_encode,
+ my_base64_decode
+};
+
static struct thd_error_context_service_st thd_error_conext_handler= {
thd_get_error_message,
thd_get_error_number,
@@ -157,21 +198,24 @@ static struct encryption_scheme_service_st encryption_scheme_handler=
static struct st_service_ref list_of_services[]=
{
+ { "base64_service", VERSION_base64, &base64_handler },
+ { "debug_sync_service", VERSION_debug_sync, 0 }, // updated in plugin_init()
+ { "encryption_scheme_service", VERSION_encryption_scheme, &encryption_scheme_handler },
+ { "encryption_service", VERSION_encryption, &encryption_handler },
+ { "logger_service", VERSION_logger, &logger_service_handler },
+ { "my_md5_service", VERSION_my_md5, &my_md5_handler},
+ { "my_sha1_service", VERSION_my_sha1, &my_sha1_handler},
+ { "my_sha2_service", VERSION_my_sha2, &my_sha2_handler},
{ "my_snprintf_service", VERSION_my_snprintf, &my_snprintf_handler },
- { "thd_alloc_service", VERSION_thd_alloc, &thd_alloc_handler },
- { "thd_wait_service", VERSION_thd_wait, &thd_wait_handler },
{ "progress_report_service", VERSION_progress_report, &progress_report_handler },
- { "debug_sync_service", VERSION_debug_sync, 0 }, // updated in plugin_init()
+ { "thd_alloc_service", VERSION_thd_alloc, &thd_alloc_handler },
+ { "thd_autoinc_service", VERSION_thd_autoinc, &thd_autoinc_handler },
+ { "thd_error_context_service", VERSION_thd_error_context, &thd_error_conext_handler },
{ "thd_kill_statement_service", VERSION_kill_statement, &thd_kill_statement_handler },
+ { "thd_rnd_service", VERSION_thd_rnd, &thd_rnd_handler },
+ { "thd_specifics_service", VERSION_thd_specifics, &thd_specifics_handler },
{ "thd_timezone_service", VERSION_thd_timezone, &thd_timezone_handler },
- { "my_sha1_service", VERSION_my_sha1, &my_sha1_handler},
- { "my_md5_service", VERSION_my_md5, &my_md5_handler},
- { "logger_service", VERSION_logger, &logger_service_handler },
- { "thd_autoinc_service", VERSION_thd_autoinc, &thd_autoinc_handler },
+ { "thd_wait_service", VERSION_thd_wait, &thd_wait_handler },
{ "wsrep_service", VERSION_wsrep, &wsrep_handler },
- { "encryption_service", VERSION_encryption, &encryption_handler },
- { "encryption_scheme_service", VERSION_encryption_scheme, &encryption_scheme_handler },
- { "thd_specifics_service", VERSION_thd_specifics, &thd_specifics_handler },
- { "thd_error_context_service", VERSION_thd_error_context, &thd_error_conext_handler },
};
diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc
index c8765f45273..4b2d8b5fb36 100644
--- a/sql/sql_prepare.cc
+++ b/sql/sql_prepare.cc
@@ -2258,7 +2258,7 @@ static int mysql_test_handler_read(Prepared_statement *stmt,
THD *thd= stmt->thd;
LEX *lex= stmt->lex;
SQL_HANDLER *ha_table;
- DBUG_ENTER("mysql_test_select");
+ DBUG_ENTER("mysql_test_handler_read");
lex->select_lex.context.resolve_in_select_list= TRUE;
diff --git a/sql/sql_reload.cc b/sql/sql_reload.cc
index 2d72d1052d2..463989b3805 100644
--- a/sql/sql_reload.cc
+++ b/sql/sql_reload.cc
@@ -181,24 +181,20 @@ bool reload_acl_and_cache(THD *thd, unsigned long long options,
slave is not likely to have the same connection names.
*/
tmp_write_to_binlog= 0;
- mysql_mutex_lock(&LOCK_active_mi);
- if (master_info_index)
+
+ if (!(mi= (get_master_info(&connection_name,
+ Sql_condition::WARN_LEVEL_ERROR))))
{
- if (!(mi= (master_info_index->
- get_master_info(&connection_name,
- Sql_condition::WARN_LEVEL_ERROR))))
- {
- result= 1;
- }
- else
- {
- mysql_mutex_lock(&mi->data_lock);
- if (rotate_relay_log(mi))
- *write_to_binlog= -1;
- mysql_mutex_unlock(&mi->data_lock);
- }
+ result= 1;
+ }
+ else
+ {
+ mysql_mutex_lock(&mi->data_lock);
+ if (rotate_relay_log(mi))
+ *write_to_binlog= -1;
+ mysql_mutex_unlock(&mi->data_lock);
+ mi->release();
}
- mysql_mutex_unlock(&LOCK_active_mi);
#endif
}
#ifdef HAVE_QUERY_CACHE
@@ -375,27 +371,33 @@ bool reload_acl_and_cache(THD *thd, unsigned long long options,
LEX_MASTER_INFO* lex_mi= &thd->lex->mi;
Master_info *mi;
tmp_write_to_binlog= 0;
- mysql_mutex_lock(&LOCK_active_mi);
- if (master_info_index)
+
+ if (!(mi= get_master_info(&lex_mi->connection_name,
+ Sql_condition::WARN_LEVEL_ERROR)))
{
- if (!(mi= (master_info_index->
- get_master_info(&lex_mi->connection_name,
- Sql_condition::WARN_LEVEL_ERROR))))
- {
- result= 1;
- }
- else if (reset_slave(thd, mi))
+ result= 1;
+ }
+ else
+ {
+ /* The following will fail if slave is running */
+ if (reset_slave(thd, mi))
{
+ mi->release();
/* NOTE: my_error() has been already called by reset_slave(). */
result= 1;
}
else if (mi->connection_name.length && thd->lex->reset_slave_info.all)
{
/* If not default connection and 'all' is used */
- master_info_index->remove_master_info(&mi->connection_name);
+ mi->release();
+ mysql_mutex_lock(&LOCK_active_mi);
+ if (master_info_index->remove_master_info(mi))
+ result= 1;
+ mysql_mutex_unlock(&LOCK_active_mi);
}
+ else
+ mi->release();
}
- mysql_mutex_unlock(&LOCK_active_mi);
}
#endif
if (options & REFRESH_USER_RESOURCES)
diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc
index 0180671977c..7c30aa38f1a 100644
--- a/sql/sql_repl.cc
+++ b/sql/sql_repl.cc
@@ -3040,7 +3040,16 @@ int start_slave(THD* thd , Master_info* mi, bool net_report)
relay_log_info_file, 0,
&mi->cmp_connection_name);
- lock_slave_threads(mi); // this allows us to cleanly read slave_running
+ mi->lock_slave_threads();
+ if (mi->killed)
+ {
+ /* connection was deleted while we waited for lock_slave_threads */
+ mi->unlock_slave_threads();
+ my_error(WARN_NO_MASTER_INFO, mi->connection_name.length,
+ mi->connection_name.str);
+ DBUG_RETURN(-1);
+ }
+
// Get a mask of _stopped_ threads
init_thread_mask(&thread_mask,mi,1 /* inverse */);
@@ -3169,7 +3178,7 @@ int start_slave(THD* thd , Master_info* mi, bool net_report)
if (!slave_errno)
slave_errno = start_slave_threads(thd,
- 0 /*no mutex */,
+ 1,
1 /* wait for start */,
mi,
master_info_file_tmp,
@@ -3185,7 +3194,7 @@ int start_slave(THD* thd , Master_info* mi, bool net_report)
}
err:
- unlock_slave_threads(mi);
+ mi->unlock_slave_threads();
thd_proc_info(thd, 0);
if (slave_errno)
@@ -3226,8 +3235,12 @@ int stop_slave(THD* thd, Master_info* mi, bool net_report )
DBUG_RETURN(-1);
THD_STAGE_INFO(thd, stage_killing_slave);
int thread_mask;
- lock_slave_threads(mi);
- // Get a mask of _running_ threads
+ mi->lock_slave_threads();
+ /*
+ Get a mask of _running_ threads.
+ We don't have to test for mi->killed as the thread_mask will take care
+ of checking if threads exists
+ */
init_thread_mask(&thread_mask,mi,0 /* not inverse*/);
/*
Below we will stop all running threads.
@@ -3240,8 +3253,7 @@ int stop_slave(THD* thd, Master_info* mi, bool net_report )
if (thread_mask)
{
- slave_errno= terminate_slave_threads(mi,thread_mask,
- 1 /*skip lock */);
+ slave_errno= terminate_slave_threads(mi,thread_mask, 0 /* get lock */);
}
else
{
@@ -3250,7 +3262,8 @@ int stop_slave(THD* thd, Master_info* mi, bool net_report )
push_warning(thd, Sql_condition::WARN_LEVEL_NOTE, ER_SLAVE_WAS_NOT_RUNNING,
ER_THD(thd, ER_SLAVE_WAS_NOT_RUNNING));
}
- unlock_slave_threads(mi);
+
+ mi->unlock_slave_threads();
if (slave_errno)
{
@@ -3285,11 +3298,20 @@ int reset_slave(THD *thd, Master_info* mi)
char relay_log_info_file_tmp[FN_REFLEN];
DBUG_ENTER("reset_slave");
- lock_slave_threads(mi);
+ mi->lock_slave_threads();
+ if (mi->killed)
+ {
+ /* connection was deleted while we waited for lock_slave_threads */
+ mi->unlock_slave_threads();
+ my_error(WARN_NO_MASTER_INFO, mi->connection_name.length,
+ mi->connection_name.str);
+ DBUG_RETURN(-1);
+ }
+
init_thread_mask(&thread_mask,mi,0 /* not inverse */);
if (thread_mask) // We refuse if any slave thread is running
{
- unlock_slave_threads(mi);
+ mi->unlock_slave_threads();
my_error(ER_SLAVE_MUST_STOP, MYF(0), (int) mi->connection_name.length,
mi->connection_name.str);
DBUG_RETURN(ER_SLAVE_MUST_STOP);
@@ -3353,7 +3375,7 @@ int reset_slave(THD *thd, Master_info* mi)
RUN_HOOK(binlog_relay_io, after_reset_slave, (thd, mi));
err:
- unlock_slave_threads(mi);
+ mi->unlock_slave_threads();
if (error)
my_error(sql_errno, MYF(0), errmsg);
DBUG_RETURN(error);
@@ -3466,8 +3488,8 @@ bool change_master(THD* thd, Master_info* mi, bool *master_info_added)
DBUG_ENTER("change_master");
- mysql_mutex_assert_owner(&LOCK_active_mi);
DBUG_ASSERT(master_info_index);
+ mysql_mutex_assert_owner(&LOCK_active_mi);
*master_info_added= false;
/*
@@ -3487,7 +3509,16 @@ bool change_master(THD* thd, Master_info* mi, bool *master_info_added)
lex_mi->port))
DBUG_RETURN(TRUE);
- lock_slave_threads(mi);
+ mi->lock_slave_threads();
+ if (mi->killed)
+ {
+ /* connection was deleted while we waited for lock_slave_threads */
+ mi->unlock_slave_threads();
+ my_error(WARN_NO_MASTER_INFO, mi->connection_name.length,
+ mi->connection_name.str);
+ DBUG_RETURN(TRUE);
+ }
+
init_thread_mask(&thread_mask,mi,0 /*not inverse*/);
if (thread_mask) // We refuse if any slave thread is running
{
@@ -3811,12 +3842,13 @@ bool change_master(THD* thd, Master_info* mi, bool *master_info_added)
in-memory value at restart (thus causing errors, as the old relay log does
not exist anymore).
*/
- mi->rli.flush();
+ if (mi->rli.flush())
+ ret= 1;
mysql_cond_broadcast(&mi->data_cond);
mysql_mutex_unlock(&mi->rli.data_lock);
err:
- unlock_slave_threads(mi);
+ mi->unlock_slave_threads();
if (ret == FALSE)
my_ok(thd);
DBUG_RETURN(ret);
@@ -3896,13 +3928,9 @@ bool mysql_show_binlog_events(THD* thd)
{
if (!lex_mi->connection_name.str)
lex_mi->connection_name= thd->variables.default_master_connection;
- mysql_mutex_lock(&LOCK_active_mi);
- if (!master_info_index ||
- !(mi= master_info_index->
- get_master_info(&lex_mi->connection_name,
- Sql_condition::WARN_LEVEL_ERROR)))
+ if (!(mi= get_master_info(&lex_mi->connection_name,
+ Sql_condition::WARN_LEVEL_ERROR)))
{
- mysql_mutex_unlock(&LOCK_active_mi);
DBUG_RETURN(TRUE);
}
binary_log= &(mi->rli.relay_log);
@@ -3921,7 +3949,7 @@ bool mysql_show_binlog_events(THD* thd)
if (mi)
{
/* We can unlock the mutex as we have a lock on the file */
- mysql_mutex_unlock(&LOCK_active_mi);
+ mi->release();
mi= 0;
}
@@ -4054,7 +4082,7 @@ bool mysql_show_binlog_events(THD* thd)
mysql_mutex_unlock(log_lock);
}
else if (mi)
- mysql_mutex_unlock(&LOCK_active_mi);
+ mi->release();
// Check that linfo is still on the function scope.
DEBUG_SYNC(thd, "after_show_binlog_events");
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 6f84b4a5762..54b0b01559b 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -6017,7 +6017,7 @@ double matching_candidates_in_table(JOIN_TAB *s, bool with_found_constraint,
{
TABLE *table= s->table;
double sel= table->cond_selectivity;
- double table_records= (double)table->stat_records();
+ double table_records= table->stat_records();
dbl_records= table_records * sel;
return dbl_records;
}
@@ -6043,7 +6043,7 @@ double matching_candidates_in_table(JOIN_TAB *s, bool with_found_constraint,
if (s->table->quick_condition_rows != s->found_records)
records= s->table->quick_condition_rows;
- dbl_records= (double)records;
+ dbl_records= records;
return dbl_records;
}
@@ -8799,8 +8799,6 @@ bool JOIN::get_best_combination()
form= table[tablenr]= j->table;
used_tables|= form->map;
form->reginfo.join_tab=j;
- if (!*j->on_expr_ref)
- form->reginfo.not_exists_optimize=0; // Only with LEFT JOIN
DBUG_PRINT("info",("type: %d", j->type));
if (j->type == JT_CONST)
goto loop_end; // Handled in make_join_stat..
@@ -9363,8 +9361,6 @@ static void add_not_null_conds(JOIN *join)
UPDATE t1 SET t1.f2=(SELECT MAX(t2.f4) FROM t2 WHERE t2.f3=t1.f1);
not_null_item is the t1.f1, but it's referred_tab is 0.
*/
- if (!referred_tab)
- continue;
if (!(notnull= new (join->thd->mem_root)
Item_func_isnotnull(join->thd, item)))
DBUG_VOID_RETURN;
@@ -9376,16 +9372,19 @@ static void add_not_null_conds(JOIN *join)
*/
if (notnull->fix_fields(join->thd, &notnull))
DBUG_VOID_RETURN;
+
DBUG_EXECUTE("where",print_where(notnull,
- referred_tab->table->alias.c_ptr(),
- QT_ORDINARY););
+ (referred_tab ?
+ referred_tab->table->alias.c_ptr() :
+ "outer_ref_cond"),
+ QT_ORDINARY););
if (!tab->first_inner)
- {
- COND *new_cond= referred_tab->join == join ?
+ {
+ COND *new_cond= (referred_tab && referred_tab->join == join) ?
referred_tab->select_cond :
join->outer_ref_cond;
add_cond_and_fix(join->thd, &new_cond, notnull);
- if (referred_tab->join == join)
+ if (referred_tab && referred_tab->join == join)
referred_tab->set_select_cond(new_cond, __LINE__);
else
join->outer_ref_cond= new_cond;
@@ -9537,7 +9536,10 @@ make_outerjoin_info(JOIN *join)
tab->cond_equal= tbl->cond_equal;
if (embedding && !embedding->is_active_sjm())
tab->first_upper= embedding->nested_join->first_nested;
- }
+ }
+ else if (!embedding)
+ tab->table->reginfo.not_exists_optimize= 0;
+
for ( ; embedding ; embedding= embedding->embedding)
{
if (embedding->is_active_sjm())
@@ -9547,7 +9549,10 @@ make_outerjoin_info(JOIN *join)
}
/* Ignore sj-nests: */
if (!(embedding->on_expr && embedding->outer_join))
+ {
+ tab->table->reginfo.not_exists_optimize= 0;
continue;
+ }
NESTED_JOIN *nested_join= embedding->nested_join;
if (!nested_join->counter)
{
@@ -9563,17 +9568,10 @@ make_outerjoin_info(JOIN *join)
}
if (!tab->first_inner)
tab->first_inner= nested_join->first_nested;
- if (tab->table->reginfo.not_exists_optimize)
- tab->first_inner->table->reginfo.not_exists_optimize= 1;
if (++nested_join->counter < nested_join->n_tables)
break;
/* Table tab is the last inner table for nested join. */
nested_join->first_nested->last_inner= tab;
- if (tab->first_inner->table->reginfo.not_exists_optimize)
- {
- for (JOIN_TAB *join_tab= tab->first_inner; join_tab <= tab; join_tab++)
- join_tab->table->reginfo.not_exists_optimize= 1;
- }
}
}
DBUG_RETURN(FALSE);
@@ -10348,7 +10346,7 @@ void JOIN::drop_unused_derived_keys()
continue;
if (!tmp_tbl->pos_in_table_list->is_materialized_derived())
continue;
- if (tmp_tbl->max_keys > 1)
+ if (tmp_tbl->max_keys > 1 && !tab->is_ref_for_hash_join())
tmp_tbl->use_index(tab->ref.key);
if (tmp_tbl->s->keys)
{
@@ -15934,7 +15932,9 @@ static Field *create_tmp_field_from_item(THD *thd, Item *item, TABLE *table,
DBUG_ASSERT(thd == table->in_use);
new_field= item->Item::create_tmp_field(false, table);
- if (copy_func && item->real_item()->is_result_field())
+ if (copy_func &&
+ (item->is_result_field() ||
+ (item->real_item()->is_result_field())))
*((*copy_func)++) = item; // Save for copy_funcs
if (modify_item)
item->set_result_field(new_field);
@@ -18540,32 +18540,41 @@ evaluate_join_record(JOIN *join, JOIN_TAB *join_tab,
first_unmatched->found= 1;
for (JOIN_TAB *tab= first_unmatched; tab <= join_tab; tab++)
{
+ /*
+ Check whether 'not exists' optimization can be used here.
+ If tab->table->reginfo.not_exists_optimize is set to true
+ then WHERE contains a conjunctive predicate IS NULL over
+ a non-nullable field of tab. When activated this predicate
+ will filter out all records with matches for the left part
+ of the outer join whose inner tables start from the
+ first_unmatched table and include table tab. To safely use
+ 'not exists' optimization we have to check that the
+ IS NULL predicate is really activated, i.e. all guards
+ that wrap it are in the 'open' state.
+ */
+ bool not_exists_opt_is_applicable=
+ tab->table->reginfo.not_exists_optimize;
+ for (JOIN_TAB *first_upper= first_unmatched->first_upper;
+ not_exists_opt_is_applicable && first_upper;
+ first_upper= first_upper->first_upper)
+ {
+ if (!first_upper->found)
+ not_exists_opt_is_applicable= false;
+ }
/* Check all predicates that has just been activated. */
/*
Actually all predicates non-guarded by first_unmatched->found
will be re-evaluated again. It could be fixed, but, probably,
it's not worth doing now.
*/
- /*
- not_exists_optimize has been created from a
- select_cond containing 'is_null'. This 'is_null'
- predicate is still present on any 'tab' with
- 'not_exists_optimize'. Furthermore, the usual rules
- for condition guards also applies for
- 'not_exists_optimize' -> When 'is_null==false' we
- know all cond. guards are open and we can apply
- the 'not_exists_optimize'.
- */
- DBUG_ASSERT(!(tab->table->reginfo.not_exists_optimize &&
- !tab->select_cond));
-
if (tab->select_cond && !tab->select_cond->val_int())
{
/* The condition attached to table tab is false */
-
if (tab == join_tab)
{
found= 0;
+ if (not_exists_opt_is_applicable)
+ DBUG_RETURN(NESTED_LOOP_NO_MORE_ROWS);
}
else
{
@@ -18574,21 +18583,10 @@ evaluate_join_record(JOIN *join, JOIN_TAB *join_tab,
not to the last table of the current nest level.
*/
join->return_tab= tab;
- }
-
- if (tab->table->reginfo.not_exists_optimize)
- {
- /*
- When not_exists_optimize is set: No need to further
- explore more rows of 'tab' for this partial result.
- Any found 'tab' matches are known to evaluate to 'false'.
- Returning .._NO_MORE_ROWS will skip rem. 'tab' rows.
- */
- DBUG_RETURN(NESTED_LOOP_NO_MORE_ROWS);
- }
- else if (tab != join_tab)
- {
- DBUG_RETURN(NESTED_LOOP_OK);
+ if (not_exists_opt_is_applicable)
+ DBUG_RETURN(NESTED_LOOP_NO_MORE_ROWS);
+ else
+ DBUG_RETURN(NESTED_LOOP_OK);
}
}
}
diff --git a/sql/sql_show.cc b/sql/sql_show.cc
index adba7ab4d33..18bc19bb85e 100644
--- a/sql/sql_show.cc
+++ b/sql/sql_show.cc
@@ -4133,6 +4133,22 @@ make_table_name_list(THD *thd, Dynamic_array<LEX_STRING*> *table_names,
}
+static void get_table_engine_for_i_s(THD *thd, char *buf, TABLE_LIST *tl,
+ LEX_STRING *db, LEX_STRING *table)
+{
+ LEX_STRING engine_name= { buf, 0 };
+
+ if (thd->get_stmt_da()->sql_errno() == ER_UNKNOWN_STORAGE_ENGINE)
+ {
+ char path[FN_REFLEN];
+ build_table_filename(path, sizeof(path) - 1,
+ db->str, table->str, reg_ext, 0);
+ if (dd_frm_type(thd, path, &engine_name) == FRMTYPE_TABLE)
+ tl->option= engine_name.str;
+ }
+}
+
+
/**
Fill I_S table with data obtained by performing full-blown table open.
@@ -4203,9 +4219,9 @@ fill_schema_table_by_open(THD *thd, bool is_show_fields_or_keys,
/*
Since make_table_list() might change database and table name passed
- to it we create copies of orig_db_name and orig_table_name here.
- These copies are used for make_table_list() while unaltered values
- are passed to process_table() functions.
+ to it (if lower_case_table_names) we create copies of orig_db_name and
+ orig_table_name here. These copies are used for make_table_list()
+ while unaltered values are passed to process_table() functions.
*/
if (!thd->make_lex_string(&db_name,
orig_db_name->str, orig_db_name->length) ||
@@ -4292,6 +4308,10 @@ fill_schema_table_by_open(THD *thd, bool is_show_fields_or_keys,
}
else
{
+ char buf[NAME_CHAR_LEN + 1];
+ if (thd->is_error())
+ get_table_engine_for_i_s(thd, buf, table_list, &db_name, &table_name);
+
result= schema_table->process_table(thd, table_list,
table, result,
orig_db_name,
@@ -4508,15 +4528,13 @@ try_acquire_high_prio_shared_mdl_lock(THD *thd, TABLE_LIST *table,
open_tables function for this table
*/
-static int fill_schema_table_from_frm(THD *thd, TABLE_LIST *tables,
+static int fill_schema_table_from_frm(THD *thd, TABLE *table,
ST_SCHEMA_TABLE *schema_table,
LEX_STRING *db_name,
LEX_STRING *table_name,
- enum enum_schema_tables schema_table_idx,
Open_tables_backup *open_tables_state_backup,
bool can_deadlock)
{
- TABLE *table= tables->table;
TABLE_SHARE *share;
TABLE tbl;
TABLE_LIST table_list;
@@ -4598,7 +4616,19 @@ static int fill_schema_table_from_frm(THD *thd, TABLE_LIST *tables,
share= tdc_acquire_share(thd, &table_list, GTS_TABLE | GTS_VIEW);
if (!share)
{
- res= 0;
+ if (thd->get_stmt_da()->sql_errno() == ER_NO_SUCH_TABLE ||
+ thd->get_stmt_da()->sql_errno() == ER_WRONG_OBJECT)
+ {
+ res= 0;
+ }
+ else
+ {
+ char buf[NAME_CHAR_LEN + 1];
+ get_table_engine_for_i_s(thd, buf, &table_list, db_name, table_name);
+
+ res= schema_table->process_table(thd, &table_list, table,
+ true, db_name, table_name);
+ }
goto end;
}
@@ -4874,9 +4904,8 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond)
if (!(table_open_method & ~OPEN_FRM_ONLY) &&
db_name != &INFORMATION_SCHEMA_NAME)
{
- if (!fill_schema_table_from_frm(thd, tables, schema_table,
+ if (!fill_schema_table_from_frm(thd, table, schema_table,
db_name, table_name,
- schema_table_idx,
&open_tables_state_backup,
can_deadlock))
continue;
@@ -5010,6 +5039,11 @@ static int get_schema_tables_record(THD *thd, TABLE_LIST *tables,
else
table->field[3]->store(STRING_WITH_LEN("BASE TABLE"), cs);
+ if (tables->option)
+ {
+ table->field[4]->store(tables->option, strlen(tables->option), cs);
+ table->field[4]->set_notnull();
+ }
goto err;
}
diff --git a/sql/sql_statistics.cc b/sql/sql_statistics.cc
index 979852e2f6b..ad71f634265 100644
--- a/sql/sql_statistics.cc
+++ b/sql/sql_statistics.cc
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
/**
@file
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index 07af3b891ea..baab8e320a0 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -6607,6 +6607,9 @@ static bool fill_alter_inplace_info(THD *thd,
new_key->user_defined_key_parts))
goto index_changed;
+ if (table_key->block_size != new_key->block_size)
+ goto index_changed;
+
if (engine_options_differ(table_key->option_struct, new_key->option_struct,
table->file->ht->index_options))
goto index_changed;
diff --git a/sql/sql_udf.cc b/sql/sql_udf.cc
index 394fa713445..05698ce82cc 100644
--- a/sql/sql_udf.cc
+++ b/sql/sql_udf.cc
@@ -228,14 +228,13 @@ void udf_init()
if (dl == NULL)
{
char dlpath[FN_REFLEN];
- strxnmov(dlpath, sizeof(dlpath) - 1, opt_plugin_dir, "/", tmp->dl,
- NullS);
+ strxnmov(dlpath, sizeof(dlpath) - 1, opt_plugin_dir, "/", tmp->dl, NullS);
(void) unpack_filename(dlpath, dlpath);
if (!(dl= dlopen(dlpath, RTLD_NOW)))
{
/* Print warning to log */
sql_print_error(ER_THD(new_thd, ER_CANT_OPEN_LIBRARY),
- tmp->dl, errno, dlerror());
+ tmp->dl, errno, my_dlerror(dlpath));
/* Keep the udf in the hash so that we can remove it later */
continue;
}
@@ -539,10 +538,10 @@ int mysql_create_function(THD *thd,udf_func *udf)
if (!(dl = dlopen(dlpath, RTLD_NOW)))
{
+ my_error(ER_CANT_OPEN_LIBRARY, MYF(0),
+ udf->dl, errno, my_dlerror(dlpath));
DBUG_PRINT("error",("dlopen of %s failed, error: %d (%s)",
udf->dl, errno, dlerror()));
- my_error(ER_CANT_OPEN_LIBRARY, MYF(0),
- udf->dl, errno, dlerror());
goto err;
}
new_dl=1;
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index fe387ed80f2..412fcce8625 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -1017,7 +1017,7 @@ Virtual_column_info *add_virtual_expression(THD *thd, Item *expr)
bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
%}
-%pure_parser /* We have threads */
+%pure-parser /* We have threads */
%parse-param { THD *thd }
%lex-param { THD *thd }
/*
@@ -7748,7 +7748,7 @@ alter_list_item:
$5->name, $4->csname));
if (Lex->create_info.add_alter_list_item_convert_to_charset($5))
MYSQL_YYABORT;
- Lex->alter_info.flags|= Alter_info::ALTER_CONVERT;
+ Lex->alter_info.flags|= Alter_info::ALTER_OPTIONS;
}
| create_table_options_space_separated
{
diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc
index fd724bc7dd1..a3bc3f6d9cf 100644
--- a/sql/sys_vars.cc
+++ b/sql/sys_vars.cc
@@ -1596,7 +1596,6 @@ bool
Sys_var_gtid_slave_pos::do_check(THD *thd, set_var *var)
{
String str, *res;
- bool running;
DBUG_ASSERT(var->type == OPT_GLOBAL);
@@ -1607,11 +1606,7 @@ Sys_var_gtid_slave_pos::do_check(THD *thd, set_var *var)
return true;
}
- mysql_mutex_lock(&LOCK_active_mi);
- running= (!master_info_index ||
- master_info_index->give_error_if_slave_running());
- mysql_mutex_unlock(&LOCK_active_mi);
- if (running)
+ if (give_error_if_slave_running(0))
return true;
if (!(res= var->value->val_str(&str)))
return true;
@@ -1649,7 +1644,7 @@ Sys_var_gtid_slave_pos::global_update(THD *thd, set_var *var)
mysql_mutex_unlock(&LOCK_global_system_variables);
mysql_mutex_lock(&LOCK_active_mi);
- if (!master_info_index || master_info_index->give_error_if_slave_running())
+ if (give_error_if_slave_running(1))
err= true;
else
err= rpl_gtid_pos_update(thd, var->save_result.string_value.str,
@@ -1835,16 +1830,7 @@ Sys_var_last_gtid::session_value_ptr(THD *thd, const LEX_STRING *base)
static bool
check_slave_parallel_threads(sys_var *self, THD *thd, set_var *var)
{
- bool running;
-
- mysql_mutex_lock(&LOCK_active_mi);
- running= (!master_info_index ||
- master_info_index->give_error_if_slave_running());
- mysql_mutex_unlock(&LOCK_active_mi);
- if (running)
- return true;
-
- return false;
+ return give_error_if_slave_running(0);
}
static bool
@@ -1853,10 +1839,7 @@ fix_slave_parallel_threads(sys_var *self, THD *thd, enum_var_type type)
bool err;
mysql_mutex_unlock(&LOCK_global_system_variables);
- mysql_mutex_lock(&LOCK_active_mi);
- err= (!master_info_index ||
- master_info_index->give_error_if_slave_running());
- mysql_mutex_unlock(&LOCK_active_mi);
+ err= give_error_if_slave_running(0);
mysql_mutex_lock(&LOCK_global_system_variables);
return err;
@@ -1888,16 +1871,7 @@ static Sys_var_ulong Sys_slave_parallel_workers(
static bool
check_slave_domain_parallel_threads(sys_var *self, THD *thd, set_var *var)
{
- bool running;
-
- mysql_mutex_lock(&LOCK_active_mi);
- running= (!master_info_index ||
- master_info_index->give_error_if_slave_running());
- mysql_mutex_unlock(&LOCK_active_mi);
- if (running)
- return true;
-
- return false;
+ return give_error_if_slave_running(0);
}
static bool
@@ -1906,13 +1880,10 @@ fix_slave_domain_parallel_threads(sys_var *self, THD *thd, enum_var_type type)
bool running;
mysql_mutex_unlock(&LOCK_global_system_variables);
- mysql_mutex_lock(&LOCK_active_mi);
- running= (!master_info_index ||
- master_info_index->give_error_if_slave_running());
- mysql_mutex_unlock(&LOCK_active_mi);
+ running= give_error_if_slave_running(0);
mysql_mutex_lock(&LOCK_global_system_variables);
- return running ? true : false;
+ return running;
}
@@ -2055,16 +2026,7 @@ static Sys_var_bit Sys_skip_parallel_replication(
static bool
check_gtid_ignore_duplicates(sys_var *self, THD *thd, set_var *var)
{
- bool running;
-
- mysql_mutex_lock(&LOCK_active_mi);
- running= (!master_info_index ||
- master_info_index->give_error_if_slave_running());
- mysql_mutex_unlock(&LOCK_active_mi);
- if (running)
- return true;
-
- return false;
+ return give_error_if_slave_running(0);
}
static bool
@@ -2073,13 +2035,10 @@ fix_gtid_ignore_duplicates(sys_var *self, THD *thd, enum_var_type type)
bool running;
mysql_mutex_unlock(&LOCK_global_system_variables);
- mysql_mutex_lock(&LOCK_active_mi);
- running= (!master_info_index ||
- master_info_index->give_error_if_slave_running());
- mysql_mutex_unlock(&LOCK_active_mi);
+ running= give_error_if_slave_running(0);
mysql_mutex_lock(&LOCK_global_system_variables);
- return running ? true : false;
+ return running;
}
@@ -2980,10 +2939,8 @@ Sys_var_replicate_events_marked_for_skip::global_update(THD *thd, set_var *var)
DBUG_ENTER("Sys_var_replicate_events_marked_for_skip::global_update");
mysql_mutex_unlock(&LOCK_global_system_variables);
- mysql_mutex_lock(&LOCK_active_mi);
- if (master_info_index && !master_info_index->give_error_if_slave_running())
+ if (!give_error_if_slave_running(0))
result= Sys_var_enum::global_update(thd, var);
- mysql_mutex_unlock(&LOCK_active_mi);
mysql_mutex_lock(&LOCK_global_system_variables);
DBUG_RETURN(result);
}
@@ -4379,35 +4336,31 @@ static Sys_var_mybool Sys_relay_log_recovery(
bool Sys_var_rpl_filter::global_update(THD *thd, set_var *var)
{
bool result= true; // Assume error
- Master_info *mi;
LEX_STRING *base_name= &var->base;
if (!base_name->length)
base_name= &thd->variables.default_master_connection;
mysql_mutex_unlock(&LOCK_global_system_variables);
- mysql_mutex_lock(&LOCK_active_mi);
-
- mi= master_info_index->
- get_master_info(base_name, !base_name->length ?
- Sql_condition::WARN_LEVEL_ERROR :
- Sql_condition::WARN_LEVEL_WARN);
- if (mi)
+
+ if (Master_info *mi= get_master_info(base_name, !var->base.length ?
+ Sql_condition::WARN_LEVEL_ERROR :
+ Sql_condition::WARN_LEVEL_WARN))
{
if (mi->rli.slave_running)
{
my_error(ER_SLAVE_MUST_STOP, MYF(0),
- mi->connection_name.length,
- mi->connection_name.str);
+ mi->connection_name.length,
+ mi->connection_name.str);
result= true;
}
else
{
result= set_filter_value(var->save_result.string_value.str, mi);
}
+ mi->release();
}
- mysql_mutex_unlock(&LOCK_active_mi);
mysql_mutex_lock(&LOCK_global_system_variables);
return result;
}
@@ -4417,6 +4370,8 @@ bool Sys_var_rpl_filter::set_filter_value(const char *value, Master_info *mi)
bool status= true;
Rpl_filter* rpl_filter= mi->rpl_filter;
+ /* Proctect against other threads */
+ mysql_mutex_lock(&LOCK_active_mi);
switch (opt_id) {
case OPT_REPLICATE_DO_DB:
status= rpl_filter->set_do_db(value);
@@ -4437,7 +4392,7 @@ bool Sys_var_rpl_filter::set_filter_value(const char *value, Master_info *mi)
status= rpl_filter->set_wild_ignore_table(value);
break;
}
-
+ mysql_mutex_unlock(&LOCK_active_mi);
return status;
}
@@ -4451,23 +4406,20 @@ uchar *Sys_var_rpl_filter::global_value_ptr(THD *thd,
Rpl_filter *rpl_filter;
mysql_mutex_unlock(&LOCK_global_system_variables);
- mysql_mutex_lock(&LOCK_active_mi);
-
- mi= master_info_index->
- get_master_info(base_name, !base_name->length ?
- Sql_condition::WARN_LEVEL_ERROR :
- Sql_condition::WARN_LEVEL_WARN);
-
- mysql_mutex_lock(&LOCK_global_system_variables);
+ mi= get_master_info(base_name, !base_name->length ?
+ Sql_condition::WARN_LEVEL_ERROR :
+ Sql_condition::WARN_LEVEL_WARN);
if (!mi)
{
- mysql_mutex_unlock(&LOCK_active_mi);
+ mysql_mutex_lock(&LOCK_global_system_variables);
return 0;
}
+
rpl_filter= mi->rpl_filter;
tmp.length(0);
+ mysql_mutex_lock(&LOCK_active_mi);
switch (opt_id) {
case OPT_REPLICATE_DO_DB:
rpl_filter->get_do_db(&tmp);
@@ -4488,9 +4440,12 @@ uchar *Sys_var_rpl_filter::global_value_ptr(THD *thd,
rpl_filter->get_wild_ignore_table(&tmp);
break;
}
+ mysql_mutex_unlock(&LOCK_active_mi);
+ mysql_mutex_lock(&LOCK_global_system_variables);
+
+ mi->release();
ret= (uchar *) thd->strmake(tmp.ptr(), tmp.length());
- mysql_mutex_unlock(&LOCK_active_mi);
return ret;
}
@@ -4559,17 +4514,12 @@ get_master_info_ulonglong_value(THD *thd, ptrdiff_t offset)
Master_info *mi;
ulonglong res= 0; // Default value
mysql_mutex_unlock(&LOCK_global_system_variables);
- mysql_mutex_lock(&LOCK_active_mi);
- mi= master_info_index->
- get_master_info(&thd->variables.default_master_connection,
- Sql_condition::WARN_LEVEL_WARN);
- if (mi)
+ if ((mi= get_master_info(&thd->variables.default_master_connection,
+ Sql_condition::WARN_LEVEL_WARN)))
{
- mysql_mutex_lock(&mi->rli.data_lock);
res= *((ulonglong*) (((uchar*) mi) + master_info_offset));
- mysql_mutex_unlock(&mi->rli.data_lock);
+ mi->release();
}
- mysql_mutex_unlock(&LOCK_active_mi);
mysql_mutex_lock(&LOCK_global_system_variables);
return res;
}
@@ -4584,19 +4534,16 @@ bool update_multi_source_variable(sys_var *self_var, THD *thd,
if (type == OPT_GLOBAL)
mysql_mutex_unlock(&LOCK_global_system_variables);
- mysql_mutex_lock(&LOCK_active_mi);
- mi= master_info_index->
- get_master_info(&thd->variables.default_master_connection,
- Sql_condition::WARN_LEVEL_ERROR);
- if (mi)
+ if ((mi= (get_master_info(&thd->variables.default_master_connection,
+ Sql_condition::WARN_LEVEL_ERROR))))
{
mysql_mutex_lock(&mi->rli.run_lock);
mysql_mutex_lock(&mi->rli.data_lock);
result= self->update_variable(thd, mi);
mysql_mutex_unlock(&mi->rli.data_lock);
mysql_mutex_unlock(&mi->rli.run_lock);
+ mi->release();
}
- mysql_mutex_unlock(&LOCK_active_mi);
if (type == OPT_GLOBAL)
mysql_mutex_lock(&LOCK_global_system_variables);
return result;
diff --git a/sql/table.cc b/sql/table.cc
index 6b15c06cb91..6d1a3a7f8d8 100644
--- a/sql/table.cc
+++ b/sql/table.cc
@@ -591,7 +591,7 @@ enum open_frm_error open_table_def(THD *thd, TABLE_SHARE *share, uint flags)
{
DBUG_ASSERT(flags & GTS_TABLE);
DBUG_ASSERT(flags & GTS_USE_DISCOVERY);
- mysql_file_delete_with_symlink(key_file_frm, path, MYF(0));
+ mysql_file_delete_with_symlink(key_file_frm, path, "", MYF(0));
file= -1;
}
else
diff --git a/sql/threadpool.h b/sql/threadpool.h
index 17c8b6ea4ea..ba17dc042c2 100644
--- a/sql/threadpool.h
+++ b/sql/threadpool.h
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#define MAX_THREAD_GROUPS 100000
diff --git a/sql/threadpool_common.cc b/sql/threadpool_common.cc
index 643ff80de2a..c6a3c7e44f8 100644
--- a/sql/threadpool_common.cc
+++ b/sql/threadpool_common.cc
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#include <my_global.h>
#include <violite.h>
diff --git a/sql/threadpool_generic.cc b/sql/threadpool_generic.cc
index 87c74d18aea..2ab874b2232 100644
--- a/sql/threadpool_generic.cc
+++ b/sql/threadpool_generic.cc
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#include <my_global.h>
#include <violite.h>
diff --git a/sql/threadpool_win.cc b/sql/threadpool_win.cc
index dec898d92bb..855b9b38d78 100644
--- a/sql/threadpool_win.cc
+++ b/sql/threadpool_win.cc
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#ifdef _WIN32_WINNT
#undef _WIN32_WINNT
diff --git a/sql/winservice.c b/sql/winservice.c
index 74e9e56acc6..efbbb527c9b 100644
--- a/sql/winservice.c
+++ b/sql/winservice.c
@@ -12,7 +12,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
/*
Get Properties of an existing mysqld Windows service
diff --git a/sql/winservice.h b/sql/winservice.h
index c3e2bfe1b20..fe3fe526548 100644
--- a/sql/winservice.h
+++ b/sql/winservice.h
@@ -12,7 +12,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
/*
Extract properties of a windows service binary path
diff --git a/sql/wsrep_applier.h b/sql/wsrep_applier.h
index d58d3cdc54e..f19d2d46d0c 100644
--- a/sql/wsrep_applier.h
+++ b/sql/wsrep_applier.h
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#ifndef WSREP_APPLIER_H
#define WSREP_APPLIER_H
diff --git a/sql/wsrep_check_opts.cc b/sql/wsrep_check_opts.cc
index bc77c434525..8da791b3429 100644
--- a/sql/wsrep_check_opts.cc
+++ b/sql/wsrep_check_opts.cc
@@ -12,7 +12,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#include "mysqld.h"
#include "sys_vars_shared.h"
diff --git a/sql/wsrep_hton.cc b/sql/wsrep_hton.cc
index 2a93484002e..79dad571585 100644
--- a/sql/wsrep_hton.cc
+++ b/sql/wsrep_hton.cc
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#include <mysqld.h>
#include "sql_base.h"
diff --git a/sql/wsrep_mysqld.cc b/sql/wsrep_mysqld.cc
index b0275fc2fd5..9a99dffc724 100644
--- a/sql/wsrep_mysqld.cc
+++ b/sql/wsrep_mysqld.cc
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#include <mysqld.h>
#include <sql_class.h>
diff --git a/sql/wsrep_mysqld.h b/sql/wsrep_mysqld.h
index 0332432a199..8c81367d12f 100644
--- a/sql/wsrep_mysqld.h
+++ b/sql/wsrep_mysqld.h
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#include <wsrep.h>
diff --git a/sql/wsrep_notify.cc b/sql/wsrep_notify.cc
index d1beb9c38d6..92c685ba485 100644
--- a/sql/wsrep_notify.cc
+++ b/sql/wsrep_notify.cc
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#include <mysqld.h>
#include "wsrep_priv.h"
diff --git a/sql/wsrep_priv.h b/sql/wsrep_priv.h
index e2dc526608f..97307fcc948 100644
--- a/sql/wsrep_priv.h
+++ b/sql/wsrep_priv.h
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
*/
//! @file declares symbols private to wsrep integration layer
diff --git a/sql/wsrep_sst.cc b/sql/wsrep_sst.cc
index 03cd8674242..076da23967a 100644
--- a/sql/wsrep_sst.cc
+++ b/sql/wsrep_sst.cc
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#include "wsrep_sst.h"
diff --git a/sql/wsrep_utils.cc b/sql/wsrep_utils.cc
index 9a9c2f84ac6..9c77cb49256 100644
--- a/sql/wsrep_utils.cc
+++ b/sql/wsrep_utils.cc
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
*/
//! @file some utility functions and classes not directly related to replication
diff --git a/sql/wsrep_var.cc b/sql/wsrep_var.cc
index e6d4bbbc303..b34fdf8b7ed 100644
--- a/sql/wsrep_var.cc
+++ b/sql/wsrep_var.cc
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#include "wsrep_var.h"
diff --git a/sql/wsrep_xid.cc b/sql/wsrep_xid.cc
index 876f791da69..2ff6ea0b32e 100644
--- a/sql/wsrep_xid.cc
+++ b/sql/wsrep_xid.cc
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
*/
//! @file some utility functions and classes not directly related to replication
diff --git a/storage/cassandra/ha_cassandra.cc b/storage/cassandra/ha_cassandra.cc
index aa4a9bbad47..f0ad2e39081 100644
--- a/storage/cassandra/ha_cassandra.cc
+++ b/storage/cassandra/ha_cassandra.cc
@@ -12,7 +12,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation
diff --git a/storage/cassandra/ha_cassandra.h b/storage/cassandra/ha_cassandra.h
index 0c225c58780..5da1bbcaa78 100644
--- a/storage/cassandra/ha_cassandra.h
+++ b/storage/cassandra/ha_cassandra.h
@@ -12,7 +12,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#ifdef USE_PRAGMA_INTERFACE
#pragma interface /* gcc class implementation */
#endif
diff --git a/storage/connect/CMakeLists.txt b/storage/connect/CMakeLists.txt
index ce6de424421..a602084b5bd 100644
--- a/storage/connect/CMakeLists.txt
+++ b/storage/connect/CMakeLists.txt
@@ -22,16 +22,16 @@ fmdlex.c osutil.c plugutil.c rcmsg.c rcmsg.h
array.cpp blkfil.cpp colblk.cpp csort.cpp
filamap.cpp filamdbf.cpp filamfix.cpp filamgz.cpp filamtxt.cpp
filter.cpp json.cpp jsonudf.cpp maputil.cpp myconn.cpp myutil.cpp plgdbutl.cpp
-reldef.cpp tabcol.cpp tabdos.cpp tabfix.cpp tabfmt.cpp tabjson.cpp table.cpp
-tabmul.cpp tabmysql.cpp taboccur.cpp tabpivot.cpp tabsys.cpp tabtbl.cpp tabutil.cpp
-tabvir.cpp tabxcl.cpp valblk.cpp value.cpp xindex.cpp xobject.cpp
+reldef.cpp tabcol.cpp tabdos.cpp tabext.cpp tabfix.cpp tabfmt.cpp tabjson.cpp
+table.cpp tabmul.cpp tabmysql.cpp taboccur.cpp tabpivot.cpp tabsys.cpp tabtbl.cpp
+tabutil.cpp tabvir.cpp tabxcl.cpp valblk.cpp value.cpp xindex.cpp xobject.cpp
array.h blkfil.h block.h catalog.h checklvl.h colblk.h connect.h csort.h
engmsg.h filamap.h filamdbf.h filamfix.h filamgz.h filamtxt.h
filter.h global.h ha_connect.h inihandl.h json.h jsonudf.h maputil.h msgid.h
mycat.h myconn.h myutil.h os.h osutil.h plgcnx.h plgdbsem.h preparse.h reldef.h
-resource.h tabcol.h tabdos.h tabfix.h tabfmt.h tabjson.h tabmul.h tabmysql.h
-taboccur.h tabpivot.h tabsys.h tabtbl.h tabutil.h tabvir.h tabxcl.h
+resource.h tabcol.h tabdos.h tabext.h tabfix.h tabfmt.h tabjson.h tabmul.h
+tabmysql.h taboccur.h tabpivot.h tabsys.h tabtbl.h tabutil.h tabvir.h tabxcl.h
user_connect.h valblk.h value.h xindex.h xobject.h xtable.h)
#
diff --git a/storage/connect/array.cpp b/storage/connect/array.cpp
index 193514eeb99..1998ab890e9 100644
--- a/storage/connect/array.cpp
+++ b/storage/connect/array.cpp
@@ -1,7 +1,7 @@
/************* Array C++ Functions Source Code File (.CPP) *************/
/* Name: ARRAY.CPP Version 2.3 */
/* */
-/* (C) Copyright to the author Olivier BERTRAND 2005-2015 */
+/* (C) Copyright to the author Olivier BERTRAND 2005-2017 */
/* */
/* This file contains the XOBJECT derived class ARRAY functions. */
/* ARRAY is used for elaborate type of processing, such as sorting */
@@ -141,7 +141,7 @@ PARRAY MakeValueArray(PGLOBAL g, PPARM pp)
/* ARRAY public constructor. */
/***********************************************************************/
ARRAY::ARRAY(PGLOBAL g, int type, int size, int length, int prec)
- : CSORT(FALSE)
+ : CSORT(false)
{
Nval = 0;
Ndif = 0;
@@ -188,14 +188,14 @@ ARRAY::ARRAY(PGLOBAL g, int type, int size, int length, int prec)
else if (type != TYPE_PCHAR)
Value = AllocateValue(g, type, Len, prec);
- Constant = TRUE;
+ Constant = true;
} // end of ARRAY constructor
#if 0
/***********************************************************************/
/* ARRAY public constructor from a QUERY. */
/***********************************************************************/
-ARRAY::ARRAY(PGLOBAL g, PQUERY qryp) : CSORT(FALSE)
+ARRAY::ARRAY(PGLOBAL g, PQUERY qryp) : CSORT(false)
{
Type = qryp->GetColType(0);
Nval = qryp->GetNblin();
@@ -206,7 +206,7 @@ ARRAY::ARRAY(PGLOBAL g, PQUERY qryp) : CSORT(FALSE)
Xsize = -1;
Len = qryp->GetColLength(0);
X = Inf = Sup = 0;
- Correlated = FALSE;
+ Correlated = false;
switch (Type) {
case TYPE_STRING:
@@ -229,13 +229,13 @@ ARRAY::ARRAY(PGLOBAL g, PQUERY qryp) : CSORT(FALSE)
// The error message was built by ???
Type = TYPE_ERROR;
- Constant = TRUE;
+ Constant = true;
} // end of ARRAY constructor
/***********************************************************************/
/* ARRAY constructor from a TYPE_LIST subarray. */
/***********************************************************************/
-ARRAY::ARRAY(PGLOBAL g, PARRAY par, int k) : CSORT(FALSE)
+ARRAY::ARRAY(PGLOBAL g, PARRAY par, int k) : CSORT(false)
{
int prec;
LSTBLK *lp;
@@ -260,7 +260,7 @@ ARRAY::ARRAY(PGLOBAL g, PARRAY par, int k) : CSORT(FALSE)
Len = (Type == TYPE_STRING) ? Vblp->GetVlen() : 0;
prec = (Type == TYPE_FLOAT) ? 2 : 0;
Value = AllocateValue(g, Type, Len, prec, NULL);
- Constant = TRUE;
+ Constant = true;
} // end of ARRAY constructor
/***********************************************************************/
@@ -283,7 +283,7 @@ bool ARRAY::AddValue(PGLOBAL g, PSZ strp)
{
if (Type != TYPE_STRING) {
sprintf(g->Message, MSG(ADD_BAD_TYPE), GetTypeName(Type), "CHAR");
- return TRUE;
+ return true;
} // endif Type
if (trace)
@@ -292,7 +292,7 @@ bool ARRAY::AddValue(PGLOBAL g, PSZ strp)
//Value->SetValue_psz(strp);
//Vblp->SetValue(valp, Nval++);
Vblp->SetValue(strp, Nval++);
- return FALSE;
+ return false;
} // end of AddValue
/***********************************************************************/
@@ -302,14 +302,14 @@ bool ARRAY::AddValue(PGLOBAL g, void *p)
{
if (Type != TYPE_PCHAR) {
sprintf(g->Message, MSG(ADD_BAD_TYPE), GetTypeName(Type), "PCHAR");
- return TRUE;
+ return true;
} // endif Type
if (trace)
htrc(" adding pointer(%d): %p\n", Nval, p);
Vblp->SetValue((PSZ)p, Nval++);
- return FALSE;
+ return false;
} // end of AddValue
/***********************************************************************/
@@ -319,7 +319,7 @@ bool ARRAY::AddValue(PGLOBAL g, short n)
{
if (Type != TYPE_SHORT) {
sprintf(g->Message, MSG(ADD_BAD_TYPE), GetTypeName(Type), "SHORT");
- return TRUE;
+ return true;
} // endif Type
if (trace)
@@ -328,7 +328,7 @@ bool ARRAY::AddValue(PGLOBAL g, short n)
//Value->SetValue(n);
//Vblp->SetValue(valp, Nval++);
Vblp->SetValue(n, Nval++);
- return FALSE;
+ return false;
} // end of AddValue
/***********************************************************************/
@@ -338,7 +338,7 @@ bool ARRAY::AddValue(PGLOBAL g, int n)
{
if (Type != TYPE_INT) {
sprintf(g->Message, MSG(ADD_BAD_TYPE), GetTypeName(Type), "INTEGER");
- return TRUE;
+ return true;
} // endif Type
if (trace)
@@ -347,7 +347,7 @@ bool ARRAY::AddValue(PGLOBAL g, int n)
//Value->SetValue(n);
//Vblp->SetValue(valp, Nval++);
Vblp->SetValue(n, Nval++);
- return FALSE;
+ return false;
} // end of AddValue
/***********************************************************************/
@@ -357,7 +357,7 @@ bool ARRAY::AddValue(PGLOBAL g, double d)
{
if (Type != TYPE_DOUBLE) {
sprintf(g->Message, MSG(ADD_BAD_TYPE), GetTypeName(Type), "DOUBLE");
- return TRUE;
+ return true;
} // endif Type
if (trace)
@@ -365,7 +365,7 @@ bool ARRAY::AddValue(PGLOBAL g, double d)
Value->SetValue(d);
Vblp->SetValue(Value, Nval++);
- return FALSE;
+ return false;
} // end of AddValue
/***********************************************************************/
@@ -376,7 +376,7 @@ bool ARRAY::AddValue(PGLOBAL g, PXOB xp)
if (Type != xp->GetResultType()) {
sprintf(g->Message, MSG(ADD_BAD_TYPE),
GetTypeName(xp->GetResultType()), GetTypeName(Type));
- return TRUE;
+ return true;
} // endif Type
if (trace)
@@ -384,7 +384,7 @@ bool ARRAY::AddValue(PGLOBAL g, PXOB xp)
//AddValue(xp->GetValue());
Vblp->SetValue(xp->GetValue(), Nval++);
- return FALSE;
+ return false;
} // end of AddValue
/***********************************************************************/
@@ -395,14 +395,14 @@ bool ARRAY::AddValue(PGLOBAL g, PVAL vp)
if (Type != vp->GetType()) {
sprintf(g->Message, MSG(ADD_BAD_TYPE),
GetTypeName(vp->GetType()), GetTypeName(Type));
- return TRUE;
+ return true;
} // endif Type
if (trace)
htrc(" adding (%d) from vp=%p\n", Nval, vp);
Vblp->SetValue(vp, Nval++);
- return FALSE;
+ return false;
} // end of AddValue
/***********************************************************************/
@@ -423,12 +423,12 @@ bool ARRAY::GetSubValue(PGLOBAL g, PVAL valp, int *kp)
if (Type != TYPE_LIST) {
sprintf(g->Message, MSG(NO_SUB_VAL), Type);
- return TRUE;
+ return true;
} // endif Type
vblp = ((LSTBLK*)Vblp)->Mbvk[kp[0]]->Vblk;
valp->SetValue_pvblk(vblp, kp[1]);
- return FALSE;
+ return false;
} // end of GetSubValue
#endif // 0
@@ -476,11 +476,11 @@ bool ARRAY::Find(PVAL valp)
else if (n > 0)
Inf = X;
else
- return TRUE;
+ return true;
} // endwhile
- return FALSE;
+ return false;
} // end of Find
/***********************************************************************/
@@ -504,9 +504,9 @@ bool ARRAY::FilTest(PGLOBAL g, PVAL valp, OPVAL opc, int opm)
int top = Nval - 1;
if (top < 0) // Array is empty
- // Return TRUE for ALL because it means that there are no item that
+ // Return true for ALL because it means that there are no item that
// does not verify the condition, which is true indeed.
- // Return FALSE for ANY because TRUE means that there is at least
+ // Return false for ANY because true means that there is at least
// one item that verifies the condition, which is false.
return opm == 2;
@@ -528,9 +528,9 @@ bool ARRAY::FilTest(PGLOBAL g, PVAL valp, OPVAL opc, int opm)
else if (opc == OP_NE && opm == 2)
return !Find(vp);
else if (opc == OP_EQ && opm == 2)
- return (Ndif == 1) ? !(Vcompare(vp, 0) & bt) : FALSE;
+ return (Ndif == 1) ? !(Vcompare(vp, 0) & bt) : false;
else if (opc == OP_NE && opm == 1)
- return (Ndif == 1) ? !(Vcompare(vp, 0) & bt) : TRUE;
+ return (Ndif == 1) ? !(Vcompare(vp, 0) & bt) : true;
if (Type != TYPE_LIST) {
if (opc == OP_GT || opc == OP_GE)
@@ -544,15 +544,15 @@ bool ARRAY::FilTest(PGLOBAL g, PVAL valp, OPVAL opc, int opm)
if (opm == 2) {
for (i = 0; i < Nval; i++)
if (Vcompare(vp, i) & bt)
- return FALSE;
+ return false;
- return TRUE;
+ return true;
} else { // opm == 1
for (i = 0; i < Nval; i++)
if (!(Vcompare(vp, i) & bt))
- return TRUE;
+ return true;
- return FALSE;
+ return false;
} // endif opm
} // end of FilTest
@@ -566,7 +566,7 @@ bool ARRAY::CanBeShort(void)
int* To_Val = (int*)Valblk->GetMemp();
if (Type != TYPE_INT || !Ndif)
- return FALSE;
+ return false;
// Because the array is sorted, this is true if all the array
// int values are in the range of SHORT values
@@ -582,7 +582,7 @@ bool ARRAY::CanBeShort(void)
int ARRAY::Convert(PGLOBAL g, int k, PVAL vp)
{
int i, prec = 0;
- bool b = FALSE;
+ bool b = false;
PMBV ovblk = Valblk;
PVBLK ovblp = Vblp;
@@ -619,7 +619,7 @@ int ARRAY::Convert(PGLOBAL g, int k, PVAL vp)
if (((DTVAL*)Value)->SetFormat(g, vp))
return TYPE_ERROR;
else
- b = TRUE; // Sort the new array on date internal values
+ b = true; // Sort the new array on date internal values
/*********************************************************************/
/* Do the actual conversion. */
@@ -706,7 +706,7 @@ void ARRAY::SetPrecision(PGLOBAL g, int p)
/***********************************************************************/
/* Sort and eliminate distinct values from an array. */
/* Note: this is done by making a sorted index on distinct values. */
-/* Returns FALSE if Ok or TRUE in case of error. */
+/* Returns false if Ok or true in case of error. */
/***********************************************************************/
bool ARRAY::Sort(PGLOBAL g)
{
@@ -789,14 +789,14 @@ bool ARRAY::Sort(PGLOBAL g)
Bot = -1; // For non optimized search
Top = Ndif; // Find searches the whole array.
- return FALSE;
+ return false;
error:
Nval = Ndif = 0;
Valblk->Free();
PlgDBfree(Index);
PlgDBfree(Offset);
- return TRUE;
+ return true;
} // end of Sort
/***********************************************************************/
@@ -839,9 +839,9 @@ void *ARRAY::GetSortIndex(PGLOBAL g)
/***********************************************************************/
/* Block filter testing for IN operator on Column/Array operands. */
-/* Here we call Find that returns TRUE if the value is in the array */
+/* Here we call Find that returns true if the value is in the array */
/* with X equal to the index of the found value in the array, or */
-/* FALSE if the value is not in the array with Inf and Sup being the */
+/* false if the value is not in the array with Inf and Sup being the */
/* indexes of the array values that are immediately below and over */
/* the not found value. This enables to restrict the array to the */
/* values that are between the min and max block values and to return */
@@ -854,9 +854,9 @@ int ARRAY::BlockTest(PGLOBAL, int opc, int opm,
bool bin, bax, pin, pax, veq, all = (opm == 2);
if (Ndif == 0) // Array is empty
- // Return TRUE for ALL because it means that there are no item that
+ // Return true for ALL because it means that there are no item that
// does not verify the condition, which is true indeed.
- // Return FALSE for ANY because TRUE means that there is at least
+ // Return false for ANY because true means that there is at least
// one item that verifies the condition, which is false.
return (all) ? 2 : -2;
else if (opc == OP_EQ && all && Ndif > 1)
@@ -864,7 +864,7 @@ int ARRAY::BlockTest(PGLOBAL, int opc, int opm,
else if (opc == OP_NE && !all && Ndif > 1)
return 2;
// else if (Ndif == 1)
-// all = FALSE;
+// all = false;
// veq is true when all values in the block are equal
switch (Type) {
@@ -874,7 +874,7 @@ int ARRAY::BlockTest(PGLOBAL, int opc, int opm,
case TYPE_SHORT: veq = *(short*)minp == *(short*)maxp; break;
case TYPE_INT: veq = *(int*)minp == *(int*)maxp; break;
case TYPE_DOUBLE: veq = *(double*)minp == *(double*)maxp; break;
- default: veq = FALSE; // Error ?
+ default: veq = false; // Error ?
} // endswitch type
if (!s)
@@ -898,7 +898,7 @@ int ARRAY::BlockTest(PGLOBAL, int opc, int opm,
case OP_GT: return -1; break;
} // endswitch opc
- pax = (opc == OP_GE) ? (X < Ndif - 1) : TRUE;
+ pax = (opc == OP_GE) ? (X < Ndif - 1) : true;
} else if (Inf == Bot) {
// Max value is smaller than min list value
return (opc == OP_LT || opc == OP_LE || opc == OP_NE) ? 1 : -1;
@@ -924,7 +924,7 @@ int ARRAY::BlockTest(PGLOBAL, int opc, int opm,
case OP_LT: return (s) ? -2 : -1; break;
} // endswitch opc
- pin = (opc == OP_LE) ? (X > 0) : TRUE;
+ pin = (opc == OP_LE) ? (X > 0) : true;
} else if (Sup == Ndif) {
// Min value is greater than max list value
if (opc == OP_GT || opc == OP_GE || opc == OP_NE)
@@ -956,7 +956,7 @@ int ARRAY::BlockTest(PGLOBAL, int opc, int opm,
// the only possible overlaps between the array and the block are:
// Array: +-------+ +-------+ +-------+ +-----+
// Block: +-----+ +---+ +------+ +--------+
- // TRUE: pax pin pax pin
+ // true: pax pin pax pin
if (all) switch (opc) {
case OP_GT:
case OP_GE: return (pax) ? -1 : 0; break;
@@ -1052,7 +1052,7 @@ void ARRAY::Print(PGLOBAL, char *ps, uint z)
/***********************************************************************/
/* MULAR public constructor. */
/***********************************************************************/
-MULAR::MULAR(PGLOBAL g, int n) : CSORT(FALSE)
+MULAR::MULAR(PGLOBAL g, int n) : CSORT(false)
{
Narray = n;
Pars = (PARRAY*)PlugSubAlloc(g, NULL, n * sizeof(PARRAY));
@@ -1075,7 +1075,7 @@ int MULAR::Qcompare(int *i1, int *i2)
/***********************************************************************/
/* Sort and eliminate distinct values from multiple arrays. */
/* Note: this is done by making a sorted index on distinct values. */
-/* Returns FALSE if Ok or TRUE in case of error. */
+/* Returns false if Ok or true in case of error. */
/***********************************************************************/
bool MULAR::Sort(PGLOBAL g)
{
@@ -1087,7 +1087,7 @@ bool MULAR::Sort(PGLOBAL g)
for (n = 1; n < Narray; n++)
if (Pars[n]->Nval != nval) {
strcpy(g->Message, MSG(BAD_ARRAY_VAL));
- return TRUE;
+ return true;
} // endif nval
// Prepare non conservative sort with offet values
@@ -1161,10 +1161,10 @@ bool MULAR::Sort(PGLOBAL g)
Pars[n]->Top = ndif; // Find searches the whole array.
} // endfor n
- return FALSE;
+ return false;
error:
PlgDBfree(Index);
PlgDBfree(Offset);
- return TRUE;
+ return true;
} // end of Sort
diff --git a/storage/connect/array.h b/storage/connect/array.h
index 6fb38ae6b47..dfc3638de8a 100644
--- a/storage/connect/array.h
+++ b/storage/connect/array.h
@@ -1,7 +1,7 @@
/**************** Array H Declares Source Code File (.H) ***************/
/* Name: ARRAY.H Version 3.1 */
/* */
-/* (C) Copyright to the author Olivier BERTRAND 2005-2014 */
+/* (C) Copyright to the author Olivier BERTRAND 2005-2017 */
/* */
/* This file contains the ARRAY and VALBASE derived classes declares. */
/***********************************************************************/
@@ -53,8 +53,8 @@ class DllExport ARRAY : public XOBJECT, public CSORT { // Array descblock
using XOBJECT::GetIntValue;
virtual void Reset(void) {Bot = -1;}
virtual int Qcompare(int *, int *);
- virtual bool Compare(PXOB) {assert(FALSE); return FALSE;}
- virtual bool SetFormat(PGLOBAL, FORMAT&) {assert(FALSE); return FALSE;}
+ virtual bool Compare(PXOB) {assert(false); return false;}
+ virtual bool SetFormat(PGLOBAL, FORMAT&) {assert(false); return false;}
//virtual int CheckSpcCol(PTDB, int) {return 0;}
virtual void Print(PGLOBAL g, FILE *f, uint n);
virtual void Print(PGLOBAL g, char *ps, uint z);
diff --git a/storage/connect/colblk.cpp b/storage/connect/colblk.cpp
index 80b405be041..58841387249 100644
--- a/storage/connect/colblk.cpp
+++ b/storage/connect/colblk.cpp
@@ -1,7 +1,7 @@
/************* Colblk C++ Functions Source Code File (.CPP) ************/
-/* Name: COLBLK.CPP Version 2.1 */
+/* Name: COLBLK.CPP Version 2.2 */
/* */
-/* (C) Copyright to the author Olivier BERTRAND 1998-2015 */
+/* (C) Copyright to the author Olivier BERTRAND 1998-2017 */
/* */
/* This file contains the COLBLK class functions. */
/***********************************************************************/
@@ -300,7 +300,7 @@ FIDBLK::FIDBLK(PCOLUMN cp, OPVAL op) : SPCBLK(cp), Op(op)
#if defined(__WIN__)
Format.Prec = 1; // Case insensitive
#endif // __WIN__
- Constant = (!((PTDBASE)To_Tdb)->GetDef()->GetMultiple() &&
+ Constant = (!To_Tdb->GetDef()->GetMultiple() &&
To_Tdb->GetAmType() != TYPE_AM_PLG &&
To_Tdb->GetAmType() != TYPE_AM_PLM);
Fn = NULL;
@@ -312,11 +312,11 @@ FIDBLK::FIDBLK(PCOLUMN cp, OPVAL op) : SPCBLK(cp), Op(op)
/***********************************************************************/
void FIDBLK::ReadColumn(PGLOBAL g)
{
- if (Fn != ((PTDBASE)To_Tdb)->GetFile(g)) {
+ if (Fn != To_Tdb->GetFile(g)) {
char filename[_MAX_PATH];
- Fn = ((PTDBASE)To_Tdb)->GetFile(g);
- PlugSetPath(filename, Fn, ((PTDBASE)To_Tdb)->GetPath());
+ Fn = To_Tdb->GetFile(g);
+ PlugSetPath(filename, Fn, To_Tdb->GetPath());
if (Op != OP_XX) {
char buff[_MAX_PATH];
@@ -378,10 +378,8 @@ void PRTBLK::ReadColumn(PGLOBAL g)
{
if (Pname == NULL) {
char *p;
- PTDBASE tdbp = (PTDBASE)To_Tdb;
-
- Pname = tdbp->GetDef()->GetStringCatInfo(g, "partname", "?");
+ Pname = To_Tdb->GetDef()->GetStringCatInfo(g, "partname", "?");
p = strrchr(Pname, '#');
Value->SetValue_psz((p) ? p + 1 : Pname);
} // endif Pname
diff --git a/storage/connect/connect.cc b/storage/connect/connect.cc
index 460d47bcf62..098119e7be1 100644
--- a/storage/connect/connect.cc
+++ b/storage/connect/connect.cc
@@ -12,7 +12,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
/***********************************************************************/
/* Author Olivier BERTRAND bertrandop@gmail.com 2004-2015 */
@@ -157,23 +157,22 @@ bool CntCheckDB(PGLOBAL g, PHC handler, const char *pathname)
/* Returns valid: true if this is a table info. */
/***********************************************************************/
bool CntInfo(PGLOBAL g, PTDB tp, PXF info)
- {
- bool b;
- PTDBDOS tdbp= (PTDBDOS)tp;
+{
+ if (tp) {
+ bool b = (tp->GetFtype() == RECFM_NAF);
+ PTDBDOS tdbp = b ? NULL : (PTDBDOS)tp;
- if (tdbp) {
- b= tdbp->GetFtype() != RECFM_NAF;
- info->data_file_length= (b) ? (ulonglong)tdbp->GetFileLength(g) : 0;
+ info->data_file_length = (b) ? 0 : (ulonglong)tdbp->GetFileLength(g);
- if (!b || info->data_file_length)
- info->records= (unsigned)tdbp->Cardinality(g);
-// info->records= (unsigned)tdbp->GetMaxSize(g);
+ if (b || info->data_file_length)
+ info->records= (unsigned)tp->Cardinality(g);
+// info->records= (unsigned)tp->GetMaxSize(g);
else
info->records= 0;
// info->mean_rec_length= tdbp->GetLrecl();
info->mean_rec_length= 0;
- info->data_file_name= (b) ? tdbp->GetFile(g) : NULL;
+ info->data_file_name= (b) ? NULL : tdbp->GetFile(g);
return true;
} else {
info->data_file_length= 0;
@@ -183,7 +182,7 @@ bool CntInfo(PGLOBAL g, PTDB tp, PXF info)
return false;
} // endif tdbp
- } // end of CntInfo
+} // end of CntInfo
/***********************************************************************/
/* GetTDB: Get the table description block of a CONNECT table. */
@@ -332,9 +331,9 @@ bool CntOpenTable(PGLOBAL g, PTDB tdbp, MODE mode, char *c1, char *c2,
} // endfor colp
// Attach the updated columns list to the main table
- ((PTDBASE)tdbp)->SetSetCols(utp->GetColumns());
+ tdbp->SetSetCols(utp->GetColumns());
} else if (tdbp && mode == MODE_INSERT)
- ((PTDBASE)tdbp)->SetSetCols(tdbp->GetColumns());
+ tdbp->SetSetCols(tdbp->GetColumns());
// Now do open the physical table
if (trace)
@@ -343,7 +342,7 @@ bool CntOpenTable(PGLOBAL g, PTDB tdbp, MODE mode, char *c1, char *c2,
//tdbp->SetMode(mode);
- if (del/* && ((PTDBASE)tdbp)->GetFtype() != RECFM_NAF*/) {
+ if (del/* && (tdbp->GetFtype() != RECFM_NAF*/) {
// To avoid erasing the table when doing a partial delete
// make a fake Next
// PDOSDEF ddp= new(g) DOSDEF;
@@ -436,7 +435,7 @@ RCODE CntReadNext(PGLOBAL g, PTDB tdbp)
if (!tdbp)
return RC_FX;
- else if (((PTDBASE)tdbp)->GetKindex()) {
+ else if (tdbp->GetKindex()) {
// Reading sequencially an indexed table. This happens after the
// handler function records_in_range was called and MySQL decides
// to quit using the index (!!!) Drop the index.
@@ -483,7 +482,7 @@ RCODE CntWriteRow(PGLOBAL g, PTDB tdbp)
{
RCODE rc;
PCOL colp;
- PTDBASE tp= (PTDBASE)tdbp;
+//PTDBASE tp= (PTDBASE)tdbp;
if (!tdbp)
return RC_FX;
@@ -501,13 +500,13 @@ RCODE CntWriteRow(PGLOBAL g, PTDB tdbp)
} // endif rc
// Store column values in table write buffer(s)
- for (colp= tp->GetSetCols(); colp; colp= colp->GetNext())
+ for (colp= tdbp->GetSetCols(); colp; colp= colp->GetNext())
if (!colp->GetColUse(U_VIRTUAL))
colp->WriteColumn(g);
- if (tp->IsIndexed())
+ if (tdbp->IsIndexed())
// Index values must be sorted before updating
- rc= (RCODE)((PTDBDOS)tp)->GetTxfp()->StoreValues(g, true);
+ rc= (RCODE)((PTDBDOS)tdbp)->GetTxfp()->StoreValues(g, true);
else
// Return result code from write operation
rc= (RCODE)tdbp->WriteDB(g);
@@ -535,7 +534,7 @@ RCODE CntUpdateRow(PGLOBAL g, PTDB tdbp)
RCODE CntDeleteRow(PGLOBAL g, PTDB tdbp, bool all)
{
RCODE rc;
- PTDBASE tp= (PTDBASE)tdbp;
+//PTDBASE tp= (PTDBASE)tdbp;
if (!tdbp || tdbp->GetMode() != MODE_DELETE)
return RC_FX;
@@ -543,16 +542,16 @@ RCODE CntDeleteRow(PGLOBAL g, PTDB tdbp, bool all)
return RC_NF;
if (all) {
- if (((PTDBASE)tdbp)->GetDef()->Indexable())
+ if (tdbp->GetDef()->Indexable())
((PTDBDOS)tdbp)->Cardinal= 0;
// Note: if all, this call will be done when closing the table
rc= (RCODE)tdbp->DeleteDB(g, RC_FX);
-//} else if (tp->GetKindex() && !tp->GetKindex()->IsSorted() &&
-// tp->Txfp->GetAmType() != TYPE_AM_DBF) {
- } else if(tp->IsIndexed()) {
+//} else if (tdbp->GetKindex() && !((PTDBASE)tdbp)->GetKindex()->IsSorted() &&
+// ((PTDBASE)tdbp)->Txfp->GetAmType() != TYPE_AM_DBF) {
+ } else if(tdbp->IsIndexed()) {
// Index values must be sorted before updating
- rc= (RCODE)((PTDBDOS)tp)->GetTxfp()->StoreValues(g, false);
+ rc= (RCODE)((PTDBDOS)tdbp)->GetTxfp()->StoreValues(g, false);
} else // Return result code from delete operation
rc= (RCODE)tdbp->DeleteDB(g, RC_OK);
@@ -565,7 +564,7 @@ RCODE CntDeleteRow(PGLOBAL g, PTDB tdbp, bool all)
int CntCloseTable(PGLOBAL g, PTDB tdbp, bool nox, bool abort)
{
int rc= RC_OK;
- TDBASE *tbxp= (PTDBASE)tdbp;
+//TDBASE *tbxp= (PTDBASE)tdbp;
if (!tdbp)
return rc; // Nothing to do
@@ -581,13 +580,13 @@ int CntCloseTable(PGLOBAL g, PTDB tdbp, bool nox, bool abort)
tdbp, tdbp->GetMode(), nox, abort);
if (tdbp->GetMode() == MODE_DELETE && tdbp->GetUse() == USE_OPEN) {
- if (tbxp->IsIndexed())
+ if (tdbp->IsIndexed())
rc= ((PTDBDOS)tdbp)->GetTxfp()->DeleteSortedRows(g);
if (!rc)
rc= tdbp->DeleteDB(g, RC_EF); // Specific A.M. delete routine
- } else if (tbxp->GetMode() == MODE_UPDATE && tbxp->IsIndexed())
+ } else if (tdbp->GetMode() == MODE_UPDATE && tdbp->IsIndexed())
rc= ((PTDBDOX)tdbp)->Txfp->UpdateSortedRows(g);
switch(rc) {
@@ -595,7 +594,7 @@ int CntCloseTable(PGLOBAL g, PTDB tdbp, bool nox, bool abort)
abort= true;
break;
case RC_INFO:
- PushWarning(g, tbxp);
+ PushWarning(g, tdbp);
break;
} // endswitch rc
@@ -631,11 +630,13 @@ int CntCloseTable(PGLOBAL g, PTDB tdbp, bool nox, bool abort)
if (trace > 1)
printf("About to reset opt\n");
- // Make all the eventual indexes
- tbxp= (TDBDOX*)tdbp;
- tbxp->ResetKindex(g, NULL);
- tbxp->SetKey_Col(NULL);
- rc= tbxp->ResetTableOpt(g, true, tbxp->GetDef()->Indexable() == 1);
+ if (!tdbp->IsRemote()) {
+ // Make all the eventual indexes
+ PTDBDOX tbxp = (PTDBDOX)tdbp;
+ tbxp->ResetKindex(g, NULL);
+ tbxp->SetKey_Col(NULL);
+ rc = tbxp->ResetTableOpt(g, true, tbxp->GetDef()->Indexable() == 1);
+ } // endif remote
err:
if (trace > 1)
@@ -657,10 +658,10 @@ int CntIndexInit(PGLOBAL g, PTDB ptdb, int id, bool sorted)
if (!ptdb)
return -1;
- else if (!((PTDBASE)ptdb)->GetDef()->Indexable()) {
+ else if (!ptdb->GetDef()->Indexable()) {
sprintf(g->Message, MSG(TABLE_NO_INDEX), ptdb->GetName());
return 0;
- } else if (((PTDBASE)ptdb)->GetDef()->Indexable() == 3) {
+ } else if (ptdb->GetDef()->Indexable() == 3) {
return 1;
} else
tdbp= (PTDBDOX)ptdb;
@@ -745,7 +746,7 @@ RCODE CntIndexRead(PGLOBAL g, PTDB ptdb, OPVAL op,
if (!ptdb)
return RC_FX;
else
- x= ((PTDBASE)ptdb)->GetDef()->Indexable();
+ x= ptdb->GetDef()->Indexable();
if (!x) {
sprintf(g->Message, MSG(TABLE_NO_INDEX), ptdb->GetName());
@@ -875,7 +876,7 @@ int CntIndexRange(PGLOBAL g, PTDB ptdb, const uchar* *key, uint *len,
if (!ptdb)
return -1;
- x= ((PTDBASE)ptdb)->GetDef()->Indexable();
+ x= ptdb->GetDef()->Indexable();
if (!x) {
sprintf(g->Message, MSG(TABLE_NO_INDEX), ptdb->GetName());
diff --git a/storage/connect/connect.h b/storage/connect/connect.h
index ce4cf9bf8b9..128561b80f3 100644
--- a/storage/connect/connect.h
+++ b/storage/connect/connect.h
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
/**************** Cnt H Declares Source Code File (.H) *****************/
/* Name: CONNECT.H Version 2.4 */
diff --git a/storage/connect/domdoc.cpp b/storage/connect/domdoc.cpp
index eb9660b439d..1622ec16c68 100644
--- a/storage/connect/domdoc.cpp
+++ b/storage/connect/domdoc.cpp
@@ -116,7 +116,9 @@ bool DOMDOC::ParseFile(PGLOBAL g, char *fn)
// Parse an in memory document
char *xdoc = GetMemDoc(g, fn);
- b = (xdoc) ? (bool)Docp->loadXML((_bstr_t)xdoc) : false;
+ // This is not equivalent to load for UTF8 characters
+ // It is why get node content is not the same
+ b = (xdoc) ? (bool)Docp->loadXML((_bstr_t)xdoc) : false;
} else
// Load the document
b = (bool)Docp->load((_bstr_t)fn);
@@ -266,6 +268,7 @@ DOMNODE::DOMNODE(PXDOC dp, MSXML2::IXMLDOMNodePtr np) : XMLNODE(dp)
Nodep = np;
Ws = NULL;
Len = 0;
+ Zip = (bool)dp->zip;
} // end of DOMNODE constructor
/******************************************************************/
@@ -316,8 +319,10 @@ RCODE DOMNODE::GetContent(PGLOBAL g, char *buf, int len)
RCODE rc = RC_OK;
// Nodep can be null for a missing HTML table column
- if (Nodep) {
- if (!WideCharToMultiByte(CP_UTF8, 0, Nodep->text, -1,
+ if (Nodep) {
+ if (Zip) {
+ strcpy(buf, Nodep->text);
+ } else if (!WideCharToMultiByte(CP_UTF8, 0, Nodep->text, -1,
buf, len, NULL, NULL)) {
DWORD lsr = GetLastError();
diff --git a/storage/connect/domdoc.h b/storage/connect/domdoc.h
index cfec98a9422..7f269002d59 100644
--- a/storage/connect/domdoc.h
+++ b/storage/connect/domdoc.h
@@ -93,6 +93,7 @@ class DOMNODE : public XMLNODE {
char Name[64];
WCHAR *Ws;
int Len;
+ bool Zip;
}; // end of class DOMNODE
/******************************************************************/
diff --git a/storage/connect/filamap.cpp b/storage/connect/filamap.cpp
index 94c562a9981..8fffaca3d06 100644
--- a/storage/connect/filamap.cpp
+++ b/storage/connect/filamap.cpp
@@ -5,7 +5,7 @@
/* */
/* COPYRIGHT: */
/* ---------- */
-/* (C) Copyright to the author Olivier BERTRAND 2005-2015 */
+/* (C) Copyright to the author Olivier BERTRAND 2005-2017 */
/* */
/* WHAT THIS PROGRAM DOES: */
/* ----------------------- */
@@ -45,6 +45,7 @@
#include "maputil.h"
#include "filamap.h"
#include "tabdos.h"
+#include "tabfmt.h"
/* --------------------------- Class MAPFAM -------------------------- */
@@ -322,17 +323,20 @@ int MAPFAM::ReadBuffer(PGLOBAL g)
int rc, len;
// Are we at the end of the memory
- if (Mempos >= Top)
+ if (Mempos >= Top) {
if ((rc = GetNext(g)) != RC_OK)
return rc;
+ else if (Tdbp->GetAmType() == TYPE_AM_CSV && ((PTDBCSV)Tdbp)->Header)
+ if ((rc = SkipRecord(g, true)) != RC_OK)
+ return rc;
+
+ } // endif Mempos
if (!Placed) {
/*******************************************************************/
/* Record file position in case of UPDATE or DELETE. */
/*******************************************************************/
- int rc;
-
next:
Fpos = Mempos;
CurBlk = (int)Rows++;
diff --git a/storage/connect/filamdbf.cpp b/storage/connect/filamdbf.cpp
index 5e3dfd8fe60..55feaa02bc4 100644
--- a/storage/connect/filamdbf.cpp
+++ b/storage/connect/filamdbf.cpp
@@ -5,7 +5,7 @@
/* */
/* COPYRIGHT: */
/* ---------- */
-/* (C) Copyright to the author Olivier BERTRAND 2005-2015 */
+/* (C) Copyright to the author Olivier BERTRAND 2005-2017 */
/* */
/* WHAT THIS PROGRAM DOES: */
/* ----------------------- */
@@ -281,15 +281,25 @@ PQRYRES DBFColumns(PGLOBAL g, char *dp, const char *fn, bool info)
/************************************************************************/
switch (thisfield.Type) {
case 'C': // Characters
- case 'L': // Logical 'T' or 'F'
- type = TYPE_STRING;
+ case 'L': // Logical 'T' or 'F' or space
+ type = TYPE_STRING;
+ break;
+ case 'M': // Memo a .DBT block number
+ case 'B': // Binary a .DBT block number
+ case 'G': // Ole a .DBT block number
+ type = TYPE_STRING;
break;
+ //case 'I': // Long
+ //case '+': // Autoincrement
+ // type = TYPE_INT;
+ // break;
case 'N':
type = (thisfield.Decimals) ? TYPE_DOUBLE
: (len > 10) ? TYPE_BIGINT : TYPE_INT;
break;
- case 'F':
- type = TYPE_DOUBLE;
+ case 'F': // Float
+ //case 'O': // Double
+ type = TYPE_DOUBLE;
break;
case 'D':
type = TYPE_DATE; // Is this correct ???
@@ -441,6 +451,7 @@ int DBFFAM::Cardinality(PGLOBAL g)
if (Accept) {
Lrecl = rln;
+ Blksize = Nrec * rln;
PushWarning(g, Tdbp);
} else
return -1;
@@ -582,6 +593,7 @@ bool DBFFAM::AllocateBuffer(PGLOBAL g)
if (Accept) {
Lrecl = reclen;
+ Blksize = Nrec * Lrecl;
PushWarning(g, Tdbp);
} else
return true;
@@ -598,7 +610,7 @@ bool DBFFAM::AllocateBuffer(PGLOBAL g)
header->Filedate[1] = datm->tm_mon + 1;
header->Filedate[2] = datm->tm_mday;
header->SetHeadlen((ushort)hlen);
- header->SetReclen((ushort)reclen);
+ header->SetReclen(reclen);
descp = (DESCRIPTOR*)header;
// Currently only standard Xbase types are supported
@@ -664,6 +676,7 @@ bool DBFFAM::AllocateBuffer(PGLOBAL g)
if (Accept) {
Lrecl = header.Reclen();
+ Blksize = Nrec * Lrecl;
PushWarning(g, Tdbp);
} else
return true;
@@ -956,6 +969,7 @@ int DBMFAM::Cardinality(PGLOBAL g)
if (Accept) {
Lrecl = rln;
+ Blksize = Nrec * Lrecl;
PushWarning(g, Tdbp);
} else
return -1;
@@ -1008,6 +1022,7 @@ bool DBMFAM::AllocateBuffer(PGLOBAL g)
if (Accept) {
Lrecl = hp->Reclen();
+ Blksize = Nrec * Lrecl;
PushWarning(g, Tdbp);
} else
return true;
diff --git a/storage/connect/filamgz.cpp b/storage/connect/filamgz.cpp
index 07242ea633c..dc6f277ee27 100644
--- a/storage/connect/filamgz.cpp
+++ b/storage/connect/filamgz.cpp
@@ -724,20 +724,20 @@ void ZBKFAM::Rewind(void)
/***********************************************************************/
/* Constructors. */
/***********************************************************************/
-ZIXFAM::ZIXFAM(PDOSDEF tdp) : ZBKFAM(tdp)
+GZXFAM::GZXFAM(PDOSDEF tdp) : ZBKFAM(tdp)
{
//Block = tdp->GetBlock();
//Last = tdp->GetLast();
Nrec = (tdp->GetElemt()) ? tdp->GetElemt() : DOS_BUFF_LEN;
Blksize = Nrec * Lrecl;
- } // end of ZIXFAM standard constructor
+ } // end of GZXFAM standard constructor
/***********************************************************************/
/* ZIX Cardinality: returns table cardinality in number of rows. */
/* This function can be called with a null argument to test the */
/* availability of Cardinality implementation (1 yes, 0 no). */
/***********************************************************************/
-int ZIXFAM::Cardinality(PGLOBAL g)
+int GZXFAM::Cardinality(PGLOBAL g)
{
if (Last)
return (g) ? (int)((Block - 1) * Nrec + Last) : 1;
@@ -750,7 +750,7 @@ int ZIXFAM::Cardinality(PGLOBAL g)
/* Allocate the line buffer. For mode Delete a bigger buffer has to */
/* be allocated because is it also used to move lines into the file. */
/***********************************************************************/
-bool ZIXFAM::AllocateBuffer(PGLOBAL g)
+bool GZXFAM::AllocateBuffer(PGLOBAL g)
{
Buflen = Blksize;
To_Buf = (char*)PlugSubAlloc(g, NULL, Buflen);
@@ -788,7 +788,7 @@ bool ZIXFAM::AllocateBuffer(PGLOBAL g)
/***********************************************************************/
/* ReadBuffer: Read one line from a compressed text file. */
/***********************************************************************/
-int ZIXFAM::ReadBuffer(PGLOBAL g)
+int GZXFAM::ReadBuffer(PGLOBAL g)
{
int n, rc = RC_OK;
@@ -850,7 +850,7 @@ int ZIXFAM::ReadBuffer(PGLOBAL g)
/* WriteDB: Data Base write routine for ZDOS access method. */
/* Update is not possible without using a temporary file (NIY). */
/***********************************************************************/
-int ZIXFAM::WriteBuffer(PGLOBAL g)
+int GZXFAM::WriteBuffer(PGLOBAL g)
{
/*********************************************************************/
/* In Insert mode, blocs are added sequentialy to the file end. */
diff --git a/storage/connect/filamgz.h b/storage/connect/filamgz.h
index d667fdddcc2..7a00c0d4bc7 100644
--- a/storage/connect/filamgz.h
+++ b/storage/connect/filamgz.h
@@ -12,7 +12,7 @@
typedef class GZFAM *PGZFAM;
typedef class ZBKFAM *PZBKFAM;
-typedef class ZIXFAM *PZIXFAM;
+typedef class GZXFAM *PZIXFAM;
typedef class ZLBFAM *PZLBFAM;
/***********************************************************************/
@@ -101,16 +101,16 @@ class DllExport ZBKFAM : public GZFAM {
/* length files compressed using the gzip library functions. */
/* The file is always accessed by block. */
/***********************************************************************/
-class DllExport ZIXFAM : public ZBKFAM {
+class DllExport GZXFAM : public ZBKFAM {
public:
// Constructor
- ZIXFAM(PDOSDEF tdp);
- ZIXFAM(PZIXFAM txfp) : ZBKFAM(txfp) {}
+ GZXFAM(PDOSDEF tdp);
+ GZXFAM(PZIXFAM txfp) : ZBKFAM(txfp) {}
// Implementation
virtual int GetNextPos(void) {return 0;}
virtual PTXF Duplicate(PGLOBAL g)
- {return (PTXF)new(g) ZIXFAM(this);}
+ {return (PTXF)new(g) GZXFAM(this);}
// Methods
virtual int Cardinality(PGLOBAL g);
@@ -120,7 +120,7 @@ class DllExport ZIXFAM : public ZBKFAM {
protected:
// No additional Members
- }; // end of class ZIXFAM
+ }; // end of class GZXFAM
/***********************************************************************/
/* This is the DOS/UNIX Access Method class declaration for PlugDB */
diff --git a/storage/connect/filamzip.cpp b/storage/connect/filamzip.cpp
index 6aca4631f32..3d157da5e87 100644
--- a/storage/connect/filamzip.cpp
+++ b/storage/connect/filamzip.cpp
@@ -1,11 +1,11 @@
/*********** File AM Zip C++ Program Source Code File (.CPP) ***********/
/* PROGRAM NAME: FILAMZIP */
/* ------------- */
-/* Version 1.0 */
+/* Version 1.1 */
/* */
/* COPYRIGHT: */
/* ---------- */
-/* (C) Copyright to the author Olivier BERTRAND 2016 */
+/* (C) Copyright to the author Olivier BERTRAND 2016-2017 */
/* */
/* WHAT THIS PROGRAM DOES: */
/* ----------------------- */
@@ -19,13 +19,16 @@
#include "my_global.h"
#if !defined(__WIN__)
#if defined(UNIX)
+#include <fnmatch.h>
#include <errno.h>
+#include <dirent.h>
#include <unistd.h>
#else // !UNIX
#include <io.h>
#endif // !UNIX
#include <fcntl.h>
#endif // !__WIN__
+#include <time.h>
/***********************************************************************/
/* Include application header files: */
@@ -40,12 +43,346 @@
//#include "tabzip.h"
#include "filamzip.h"
+#define WRITEBUFFERSIZE (16384)
+
+bool ZipLoadFile(PGLOBAL g, char *zfn, char *fn, char *entry, bool append, bool mul);
+
+/***********************************************************************/
+/* Compress a file in zip when creating a table. */
+/***********************************************************************/
+static bool ZipFile(PGLOBAL g, ZIPUTIL *zutp, char *fn, char *entry, char *buf)
+{
+ int rc = RC_OK, size_read, size_buf = WRITEBUFFERSIZE;
+ FILE *fin;
+
+ if (zutp->addEntry(g, entry))
+ return true;
+ else if (!(fin = fopen(fn, "rb"))) {
+ sprintf(g->Message, "error in opening %s for reading", fn);
+ return true;
+ } // endif fin
+
+ do {
+ size_read = (int)fread(buf, 1, size_buf, fin);
+
+ if (size_read < size_buf && feof(fin) == 0) {
+ sprintf(g->Message, "error in reading %s", fn);
+ rc = RC_FX;
+ } // endif size_read
+
+ if (size_read > 0) {
+ rc = zutp->writeEntry(g, buf, size_read);
+
+ if (rc == RC_FX)
+ sprintf(g->Message, "error in writing %s in the zipfile", fn);
+
+ } // endif size_read
+
+ } while (rc == RC_OK && size_read > 0);
+
+ fclose(fin);
+ zutp->closeEntry();
+ return rc != RC_OK;
+} // end of ZipFile
+
+/***********************************************************************/
+/* Find and Compress several files in zip when creating a table. */
+/***********************************************************************/
+static bool ZipFiles(PGLOBAL g, ZIPUTIL *zutp, char *pat, char *buf)
+{
+ char filename[_MAX_PATH];
+ int rc;
+
+ /*********************************************************************/
+ /* pat is a multiple file name with wildcard characters */
+ /*********************************************************************/
+ strcpy(filename, pat);
+
+#if defined(__WIN__)
+ char drive[_MAX_DRIVE], direc[_MAX_DIR];
+ WIN32_FIND_DATA FileData;
+ HANDLE hSearch;
+
+ _splitpath(filename, drive, direc, NULL, NULL);
+
+ // Start searching files in the target directory.
+ hSearch = FindFirstFile(filename, &FileData);
+
+ if (hSearch == INVALID_HANDLE_VALUE) {
+ rc = GetLastError();
+
+ if (rc != ERROR_FILE_NOT_FOUND) {
+ FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
+ NULL, GetLastError(), 0, (LPTSTR)&filename, sizeof(filename), NULL);
+ sprintf(g->Message, MSG(BAD_FILE_HANDLE), filename);
+ return true;
+ } else {
+ strcpy(g->Message, "Cannot find any file to load");
+ return true;
+ } // endif rc
+
+ } // endif hSearch
+
+ while (true) {
+ if (!(FileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) {
+ strcat(strcat(strcpy(filename, drive), direc), FileData.cFileName);
+
+ if (ZipFile(g, zutp, filename, FileData.cFileName, buf)) {
+ FindClose(hSearch);
+ return true;
+ } // endif ZipFile
+
+ } // endif dwFileAttributes
+
+ if (!FindNextFile(hSearch, &FileData)) {
+ rc = GetLastError();
+
+ if (rc != ERROR_NO_MORE_FILES) {
+ sprintf(g->Message, MSG(NEXT_FILE_ERROR), rc);
+ FindClose(hSearch);
+ return true;
+ } // endif rc
+
+ break;
+ } // endif FindNextFile
+
+ } // endwhile n
+
+ // Close the search handle.
+ if (!FindClose(hSearch)) {
+ strcpy(g->Message, MSG(SRCH_CLOSE_ERR));
+ return true;
+ } // endif FindClose
+
+#else // !__WIN__
+ struct stat fileinfo;
+ char fn[FN_REFLEN], direc[FN_REFLEN], pattern[FN_HEADLEN], ftype[FN_EXTLEN];
+ DIR *dir;
+ struct dirent *entry;
+
+ _splitpath(filename, NULL, direc, pattern, ftype);
+ strcat(pattern, ftype);
+
+ // Start searching files in the target directory.
+ if (!(dir = opendir(direc))) {
+ sprintf(g->Message, MSG(BAD_DIRECTORY), direc, strerror(errno));
+ return true;
+ } // endif dir
+
+ while ((entry = readdir(dir))) {
+ strcat(strcpy(fn, direc), entry->d_name);
+
+ if (lstat(fn, &fileinfo) < 0) {
+ sprintf(g->Message, "%s: %s", fn, strerror(errno));
+ return true;
+ } else if (!S_ISREG(fileinfo.st_mode))
+ continue; // Not a regular file (should test for links)
+
+ /*******************************************************************/
+ /* Test whether the file name matches the table name filter. */
+ /*******************************************************************/
+ if (fnmatch(pattern, entry->d_name, 0))
+ continue; // Not a match
+
+ strcat(strcpy(filename, direc), entry->d_name);
+
+ if (ZipFile(g, zutp, filename, entry->d_name, buf)) {
+ closedir(dir);
+ return true;
+ } // endif ZipFile
+
+ } // endwhile readdir
+
+ // Close the dir handle.
+ closedir(dir);
+#endif // !__WIN__
+
+ return false;
+} // end of ZipFiles
+
+/***********************************************************************/
+/* Load and Compress a file in zip when creating a table. */
+/***********************************************************************/
+bool ZipLoadFile(PGLOBAL g, char *zfn, char *fn, char *entry, bool append, bool mul)
+{
+ char *buf;
+ bool err;
+ ZIPUTIL *zutp = new(g) ZIPUTIL(NULL);
+
+ if (zutp->open(g, zfn, append))
+ return true;
+
+ buf = (char*)PlugSubAlloc(g, NULL, WRITEBUFFERSIZE);
+
+ if (mul)
+ err = ZipFiles(g, zutp, fn, buf);
+ else
+ err = ZipFile(g, zutp, fn, entry, buf);
+
+ zutp->close();
+ return err;
+} // end of ZipLoadFile
+
/* -------------------------- class ZIPUTIL -------------------------- */
/***********************************************************************/
/* Constructors. */
/***********************************************************************/
-ZIPUTIL::ZIPUTIL(PSZ tgt, bool mul)
+ZIPUTIL::ZIPUTIL(PSZ tgt)
+{
+ zipfile = NULL;
+ target = tgt;
+ fp = NULL;
+ entryopen = false;
+} // end of ZIPUTIL standard constructor
+
+#if 0
+ZIPUTIL::ZIPUTIL(ZIPUTIL *zutp)
+{
+ zipfile = zutp->zipfile;
+ target = zutp->target;
+ fp = zutp->fp;
+ entryopen = zutp->entryopen;
+} // end of UNZIPUTL copy constructor
+#endif // 0
+
+/***********************************************************************/
+/* Fill the zip time structure */
+/* param: tmZip time structure to be filled */
+/***********************************************************************/
+void ZIPUTIL::getTime(tm_zip& tmZip)
+{
+ time_t rawtime;
+ time(&rawtime);
+ struct tm *timeinfo = localtime(&rawtime);
+ tmZip.tm_sec = timeinfo->tm_sec;
+ tmZip.tm_min = timeinfo->tm_min;
+ tmZip.tm_hour = timeinfo->tm_hour;
+ tmZip.tm_mday = timeinfo->tm_mday;
+ tmZip.tm_mon = timeinfo->tm_mon;
+ tmZip.tm_year = timeinfo->tm_year;
+} // end of getTime
+
+/***********************************************************************/
+/* open a zip file for deflate. */
+/* param: filename path and the filename of the zip file to open. */
+/* append: set true to append the zip file */
+/* return: true if open, false otherwise. */
+/***********************************************************************/
+bool ZIPUTIL::open(PGLOBAL g, char *filename, bool append)
+{
+ if (!zipfile && !(zipfile = zipOpen64(filename,
+ append ? APPEND_STATUS_ADDINZIP
+ : APPEND_STATUS_CREATE)))
+ sprintf(g->Message, "Zipfile open error on %s", filename);
+
+ return (zipfile == NULL);
+} // end of open
+
+/***********************************************************************/
+/* Close the zip file. */
+/***********************************************************************/
+void ZIPUTIL::close()
+{
+ if (zipfile) {
+ closeEntry();
+ zipClose(zipfile, 0);
+ zipfile = NULL;
+ } // endif zipfile
+
+} // end of close
+
+/***********************************************************************/
+/* OpenTableFile: Open a DOS/UNIX table file from a ZIP file. */
+/***********************************************************************/
+bool ZIPUTIL::OpenTable(PGLOBAL g, MODE mode, char *fn, bool append)
+{
+ /*********************************************************************/
+ /* The file will be compressed. */
+ /*********************************************************************/
+ if (mode == MODE_INSERT) {
+ bool b = open(g, fn, append);
+
+ if (!b) {
+ if (addEntry(g, target))
+ return true;
+
+ /*****************************************************************/
+ /* Link a Fblock. This make possible to automatically close it */
+ /* in case of error g->jump. */
+ /*****************************************************************/
+ PDBUSER dbuserp = (PDBUSER)g->Activityp->Aptr;
+
+ fp = (PFBLOCK)PlugSubAlloc(g, NULL, sizeof(FBLOCK));
+ fp->Type = TYPE_FB_ZIP;
+ fp->Fname = PlugDup(g, fn);
+ fp->Next = dbuserp->Openlist;
+ dbuserp->Openlist = fp;
+ fp->Count = 1;
+ fp->Length = 0;
+ fp->Memory = NULL;
+ fp->Mode = mode;
+ fp->File = this;
+ fp->Handle = 0;
+ } else
+ return true;
+
+ } else {
+ strcpy(g->Message, "Only INSERT mode supported for ZIPPING files");
+ return true;
+ } // endif mode
+
+ return false;
+} // end of OpenTableFile
+
+/***********************************************************************/
+/* Add target in zip file. */
+/***********************************************************************/
+bool ZIPUTIL::addEntry(PGLOBAL g, char *entry)
+{
+ //?? we dont need the stinking time
+ zip_fileinfo zi = { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
+
+ getTime(zi.tmz_date);
+ target = entry;
+
+ int err = zipOpenNewFileInZip(zipfile, target, &zi,
+ NULL, 0, NULL, 0, NULL, Z_DEFLATED, Z_DEFAULT_COMPRESSION);
+
+ return !(entryopen = (err == ZIP_OK));
+} // end of addEntry
+
+/***********************************************************************/
+/* writeEntry: Deflate the buffer to the zip file. */
+/***********************************************************************/
+int ZIPUTIL::writeEntry(PGLOBAL g, char *buf, int len)
+{
+ if (zipWriteInFileInZip(zipfile, buf, len) < 0) {
+ sprintf(g->Message, "Error writing %s in the zipfile", target);
+ return RC_FX;
+ } // endif zipWriteInFileInZip
+
+ return RC_OK;
+} // end of writeEntry
+
+/***********************************************************************/
+/* Close the zip file. */
+/***********************************************************************/
+void ZIPUTIL::closeEntry()
+{
+ if (entryopen) {
+ zipCloseFileInZip(zipfile);
+ entryopen = false;
+ } // endif entryopen
+
+} // end of closeEntry
+
+/* ------------------------- class UNZIPUTL -------------------------- */
+
+/***********************************************************************/
+/* Constructors. */
+/***********************************************************************/
+UNZIPUTL::UNZIPUTL(PSZ tgt, bool mul)
{
zipfile = NULL;
target = tgt;
@@ -62,10 +399,10 @@ ZIPUTIL::ZIPUTIL(PSZ tgt, bool mul)
#else
for (int i = 0; i < 256; ++i) mapCaseTable[i] = i;
#endif
-} // end of ZIPUTIL standard constructor
+} // end of UNZIPUTL standard constructor
#if 0
-ZIPUTIL::ZIPUTIL(PZIPUTIL zutp)
+UNZIPUTL::UNZIPUTL(PZIPUTIL zutp)
{
zipfile = zutp->zipfile;
target = zutp->target;
@@ -74,14 +411,14 @@ ZIPUTIL::ZIPUTIL(PZIPUTIL zutp)
entryopen = zutp->entryopen;
multiple = zutp->multiple;
for (int i = 0; i < 256; ++i) mapCaseTable[i] = zutp->mapCaseTable[i];
-} // end of ZIPUTIL copy constructor
+} // end of UNZIPUTL copy constructor
#endif // 0
/***********************************************************************/
/* This code is the copyright property of Alessandro Felice Cantatore. */
/* http://xoomer.virgilio.it/acantato/dev/wildcard/wildmatch.html */
/***********************************************************************/
-bool ZIPUTIL::WildMatch(PSZ pat, PSZ str) {
+bool UNZIPUTL::WildMatch(PSZ pat, PSZ str) {
PSZ s, p;
bool star = FALSE;
@@ -116,7 +453,7 @@ starCheck:
/* param: filename path and the filename of the zip file to open. */
/* return: true if open, false otherwise. */
/***********************************************************************/
-bool ZIPUTIL::open(PGLOBAL g, char *filename)
+bool UNZIPUTL::open(PGLOBAL g, char *filename)
{
if (!zipfile && !(zipfile = unzOpen64(filename)))
sprintf(g->Message, "Zipfile open error on %s", filename);
@@ -127,7 +464,7 @@ bool ZIPUTIL::open(PGLOBAL g, char *filename)
/***********************************************************************/
/* Close the zip file. */
/***********************************************************************/
-void ZIPUTIL::close()
+void UNZIPUTL::close()
{
if (zipfile) {
closeEntry();
@@ -140,7 +477,7 @@ void ZIPUTIL::close()
/***********************************************************************/
/* Find next entry matching target pattern. */
/***********************************************************************/
-int ZIPUTIL::findEntry(PGLOBAL g, bool next)
+int UNZIPUTL::findEntry(PGLOBAL g, bool next)
{
int rc;
@@ -183,7 +520,7 @@ int ZIPUTIL::findEntry(PGLOBAL g, bool next)
/***********************************************************************/
/* Get the next used entry. */
/***********************************************************************/
-int ZIPUTIL::nextEntry(PGLOBAL g)
+int UNZIPUTL::nextEntry(PGLOBAL g)
{
if (multiple) {
int rc;
@@ -206,7 +543,7 @@ int ZIPUTIL::nextEntry(PGLOBAL g)
/***********************************************************************/
/* OpenTableFile: Open a DOS/UNIX table file from a ZIP file. */
/***********************************************************************/
-bool ZIPUTIL::OpenTable(PGLOBAL g, MODE mode, char *fn)
+bool UNZIPUTL::OpenTable(PGLOBAL g, MODE mode, char *fn)
{
/*********************************************************************/
/* The file will be decompressed into virtual memory. */
@@ -268,7 +605,7 @@ bool ZIPUTIL::OpenTable(PGLOBAL g, MODE mode, char *fn)
return true;
} else {
- strcpy(g->Message, "Only READ mode supported for ZIP files");
+ strcpy(g->Message, "Only READ mode supported for ZIPPED tables");
return true;
} // endif mode
@@ -278,7 +615,7 @@ bool ZIPUTIL::OpenTable(PGLOBAL g, MODE mode, char *fn)
/***********************************************************************/
/* Open target in zip file. */
/***********************************************************************/
-bool ZIPUTIL::openEntry(PGLOBAL g)
+bool UNZIPUTL::openEntry(PGLOBAL g)
{
int rc;
@@ -316,7 +653,7 @@ bool ZIPUTIL::openEntry(PGLOBAL g)
/***********************************************************************/
/* Close the zip file. */
/***********************************************************************/
-void ZIPUTIL::closeEntry()
+void UNZIPUTL::closeEntry()
{
if (entryopen) {
unzCloseCurrentFile(zipfile);
@@ -330,36 +667,29 @@ void ZIPUTIL::closeEntry()
} // end of closeEntry
-/* -------------------------- class ZIPFAM --------------------------- */
+/* -------------------------- class UNZFAM --------------------------- */
/***********************************************************************/
/* Constructors. */
/***********************************************************************/
-ZIPFAM::ZIPFAM(PDOSDEF tdp) : MAPFAM(tdp)
+UNZFAM::UNZFAM(PDOSDEF tdp) : MAPFAM(tdp)
{
zutp = NULL;
target = tdp->GetEntry();
mul = tdp->GetMul();
-} // end of ZIPFAM standard constructor
-
-ZIPFAM::ZIPFAM(PZIPFAM txfp) : MAPFAM(txfp)
-{
- zutp = txfp->zutp;
- target = txfp->target;
- mul = txfp->mul;
-} // end of ZIPFAM copy constructor
+} // end of UNZFAM standard constructor
-ZIPFAM::ZIPFAM(PDOSDEF tdp, PZPXFAM txfp) : MAPFAM(tdp)
+UNZFAM::UNZFAM(PUNZFAM txfp) : MAPFAM(txfp)
{
zutp = txfp->zutp;
target = txfp->target;
mul = txfp->mul;
-} // end of ZIPFAM constructor used in ResetTableOpt
+} // end of UNZFAM copy constructor
/***********************************************************************/
/* ZIP GetFileLength: returns file size in number of bytes. */
/***********************************************************************/
-int ZIPFAM::GetFileLength(PGLOBAL g)
+int UNZFAM::GetFileLength(PGLOBAL g)
{
int len = (zutp && zutp->entryopen) ? Top - Memory
: TXTFAM::GetFileLength(g) * 3;
@@ -373,7 +703,7 @@ int ZIPFAM::GetFileLength(PGLOBAL g)
/***********************************************************************/
/* ZIP Cardinality: return the number of rows if possible. */
/***********************************************************************/
-int ZIPFAM::Cardinality(PGLOBAL g)
+int UNZFAM::Cardinality(PGLOBAL g)
{
if (!g)
return 1;
@@ -388,7 +718,7 @@ int ZIPFAM::Cardinality(PGLOBAL g)
/***********************************************************************/
/* OpenTableFile: Open a DOS/UNIX table file from a ZIP file. */
/***********************************************************************/
-bool ZIPFAM::OpenTableFile(PGLOBAL g)
+bool UNZFAM::OpenTableFile(PGLOBAL g)
{
char filename[_MAX_PATH];
MODE mode = Tdbp->GetMode();
@@ -396,7 +726,7 @@ bool ZIPFAM::OpenTableFile(PGLOBAL g)
/*********************************************************************/
/* Allocate the ZIP utility class. */
/*********************************************************************/
- zutp = new(g) ZIPUTIL(target, mul);
+ zutp = new(g) UNZIPUTL(target, mul);
// We used the file name relative to recorded datapath
PlugSetPath(filename, To_File, Tdbp->GetPath());
@@ -415,7 +745,7 @@ bool ZIPFAM::OpenTableFile(PGLOBAL g)
/***********************************************************************/
/* GetNext: go to next entry. */
/***********************************************************************/
-int ZIPFAM::GetNext(PGLOBAL g)
+int UNZFAM::GetNext(PGLOBAL g)
{
int rc = zutp->nextEntry(g);
@@ -431,7 +761,7 @@ int ZIPFAM::GetNext(PGLOBAL g)
/***********************************************************************/
/* ReadBuffer: Read one line for a ZIP file. */
/***********************************************************************/
-int ZIPFAM::ReadBuffer(PGLOBAL g)
+int UNZFAM::ReadBuffer(PGLOBAL g)
{
int rc, len;
@@ -497,37 +827,37 @@ int ZIPFAM::ReadBuffer(PGLOBAL g)
/***********************************************************************/
/* Table file close routine for MAP access method. */
/***********************************************************************/
-void ZIPFAM::CloseTableFile(PGLOBAL g, bool)
+void UNZFAM::CloseTableFile(PGLOBAL g, bool)
{
close();
} // end of CloseTableFile
#endif // 0
-/* -------------------------- class ZPXFAM --------------------------- */
+/* -------------------------- class UZXFAM --------------------------- */
/***********************************************************************/
/* Constructors. */
/***********************************************************************/
-ZPXFAM::ZPXFAM(PDOSDEF tdp) : MPXFAM(tdp)
+UZXFAM::UZXFAM(PDOSDEF tdp) : MPXFAM(tdp)
{
zutp = NULL;
target = tdp->GetEntry();
mul = tdp->GetMul();
//Lrecl = tdp->GetLrecl();
-} // end of ZPXFAM standard constructor
+} // end of UZXFAM standard constructor
-ZPXFAM::ZPXFAM(PZPXFAM txfp) : MPXFAM(txfp)
+UZXFAM::UZXFAM(PUZXFAM txfp) : MPXFAM(txfp)
{
zutp = txfp->zutp;
target = txfp->target;
mul = txfp->mul;
//Lrecl = txfp->Lrecl;
-} // end of ZPXFAM copy constructor
+} // end of UZXFAM copy constructor
/***********************************************************************/
/* ZIP GetFileLength: returns file size in number of bytes. */
/***********************************************************************/
-int ZPXFAM::GetFileLength(PGLOBAL g)
+int UZXFAM::GetFileLength(PGLOBAL g)
{
int len;
@@ -545,7 +875,7 @@ int ZPXFAM::GetFileLength(PGLOBAL g)
/***********************************************************************/
/* ZIP Cardinality: return the number of rows if possible. */
/***********************************************************************/
-int ZPXFAM::Cardinality(PGLOBAL g)
+int UZXFAM::Cardinality(PGLOBAL g)
{
if (!g)
return 1;
@@ -566,7 +896,7 @@ int ZPXFAM::Cardinality(PGLOBAL g)
/***********************************************************************/
/* OpenTableFile: Open a DOS/UNIX table file from a ZIP file. */
/***********************************************************************/
-bool ZPXFAM::OpenTableFile(PGLOBAL g)
+bool UZXFAM::OpenTableFile(PGLOBAL g)
{
// May have been already opened in GetFileLength
if (!zutp || !zutp->zipfile) {
@@ -577,7 +907,7 @@ bool ZPXFAM::OpenTableFile(PGLOBAL g)
/* Allocate the ZIP utility class. */
/*********************************************************************/
if (!zutp)
- zutp = new(g)ZIPUTIL(target, mul);
+ zutp = new(g)UNZIPUTL(target, mul);
// We used the file name relative to recorded datapath
PlugSetPath(filename, To_File, Tdbp->GetPath());
@@ -600,7 +930,7 @@ bool ZPXFAM::OpenTableFile(PGLOBAL g)
/***********************************************************************/
/* GetNext: go to next entry. */
/***********************************************************************/
-int ZPXFAM::GetNext(PGLOBAL g)
+int UZXFAM::GetNext(PGLOBAL g)
{
int rc = zutp->nextEntry(g);
@@ -620,3 +950,146 @@ int ZPXFAM::GetNext(PGLOBAL g)
return RC_OK;
} // end of GetNext
+/* -------------------------- class ZIPFAM --------------------------- */
+
+/***********************************************************************/
+/* Constructor. */
+/***********************************************************************/
+ZIPFAM::ZIPFAM(PDOSDEF tdp) : DOSFAM(tdp)
+{
+ zutp = NULL;
+ target = tdp->GetEntry();
+ append = tdp->GetAppend();
+} // end of ZIPFAM standard constructor
+
+/***********************************************************************/
+/* OpenTableFile: Open a DOS/UNIX table file from a ZIP file. */
+/***********************************************************************/
+bool ZIPFAM::OpenTableFile(PGLOBAL g)
+{
+ char filename[_MAX_PATH];
+ MODE mode = Tdbp->GetMode();
+
+ /*********************************************************************/
+ /* Allocate the ZIP utility class. */
+ /*********************************************************************/
+ zutp = new(g) ZIPUTIL(target);
+
+ // We used the file name relative to recorded datapath
+ PlugSetPath(filename, To_File, Tdbp->GetPath());
+
+ if (!zutp->OpenTable(g, mode, filename, append)) {
+ To_Fb = zutp->fp; // Useful when closing
+ } else
+ return true;
+
+ return AllocateBuffer(g);
+} // end of OpenTableFile
+
+/***********************************************************************/
+/* ReadBuffer: Read one line for a ZIP file. */
+/***********************************************************************/
+int ZIPFAM::ReadBuffer(PGLOBAL g)
+{
+ strcpy(g->Message, "ReadBuffer should not been called when zipping");
+ return RC_FX;
+} // end of ReadBuffer
+
+/***********************************************************************/
+/* WriteBuffer: Deflate the buffer to the zip file. */
+/***********************************************************************/
+int ZIPFAM::WriteBuffer(PGLOBAL g)
+{
+ int len;
+
+ // Prepare to write the new line
+ strcat(strcpy(To_Buf, Tdbp->GetLine()), (Bin) ? CrLf : "\n");
+ len = strchr(To_Buf, '\n') - To_Buf + 1;
+ return zutp->writeEntry(g, To_Buf, len);
+} // end of WriteBuffer
+
+/***********************************************************************/
+/* Table file close routine for ZIP access method. */
+/***********************************************************************/
+void ZIPFAM::CloseTableFile(PGLOBAL g, bool)
+{
+ To_Fb->Count = 0;
+ zutp->close();
+} // end of CloseTableFile
+
+/* -------------------------- class ZPXFAM --------------------------- */
+
+/***********************************************************************/
+/* Constructor. */
+/***********************************************************************/
+ZPXFAM::ZPXFAM(PDOSDEF tdp) : FIXFAM(tdp)
+{
+ zutp = NULL;
+ target = tdp->GetEntry();
+ append = tdp->GetAppend();
+ //Lrecl = tdp->GetLrecl();
+} // end of UZXFAM standard constructor
+
+/***********************************************************************/
+/* OpenTableFile: Open a DOS/UNIX table file from a ZIP file. */
+/***********************************************************************/
+bool ZPXFAM::OpenTableFile(PGLOBAL g)
+{
+ char filename[_MAX_PATH];
+ MODE mode = Tdbp->GetMode();
+
+ /*********************************************************************/
+ /* Allocate the ZIP utility class. */
+ /*********************************************************************/
+ zutp = new(g) ZIPUTIL(target);
+
+ // We used the file name relative to recorded datapath
+ PlugSetPath(filename, To_File, Tdbp->GetPath());
+
+ if (!zutp->OpenTable(g, mode, filename, append)) {
+ To_Fb = zutp->fp; // Useful when closing
+ } else
+ return true;
+
+ return AllocateBuffer(g);
+} // end of OpenTableFile
+
+/***********************************************************************/
+/* WriteBuffer: Deflate the buffer to the zip file. */
+/***********************************************************************/
+int ZPXFAM::WriteBuffer(PGLOBAL g)
+{
+ /*********************************************************************/
+ /* In Insert mode, we write only full blocks. */
+ /*********************************************************************/
+ if (++CurNum != Rbuf) {
+ Tdbp->IncLine(Lrecl); // Used by DOSCOL functions
+ return RC_OK;
+ } // endif CurNum
+
+ // Now start the compress process.
+ if (zutp->writeEntry(g, To_Buf, Lrecl * Rbuf) != RC_OK) {
+ Closing = true;
+ return RC_FX;
+ } // endif writeEntry
+
+ CurBlk++;
+ CurNum = 0;
+ Tdbp->SetLine(To_Buf);
+ return RC_OK;
+} // end of WriteBuffer
+
+/***********************************************************************/
+/* Table file close routine for ZIP access method. */
+/***********************************************************************/
+void ZPXFAM::CloseTableFile(PGLOBAL g, bool)
+{
+ if (CurNum && !Closing) {
+ // Some more inserted lines remain to be written
+ Rbuf = CurNum--;
+ WriteBuffer(g);
+ } // endif Curnum
+
+ To_Fb->Count = 0;
+ zutp->close();
+} // end of CloseTableFile
diff --git a/storage/connect/filamzip.h b/storage/connect/filamzip.h
index 9312fb2f70e..3160703bd20 100644
--- a/storage/connect/filamzip.h
+++ b/storage/connect/filamzip.h
@@ -1,7 +1,7 @@
/************** filamzip H Declares Source Code File (.H) **************/
-/* Name: filamzip.h Version 1.0 */
+/* Name: filamzip.h Version 1.1 */
/* */
-/* (C) Copyright to the author Olivier BERTRAND 2016 */
+/* (C) Copyright to the author Olivier BERTRAND 2016-2017 */
/* */
/* This file contains the ZIP file access method classes declares. */
/***********************************************************************/
@@ -10,10 +10,14 @@
#include "block.h"
#include "filamap.h"
+#include "filamfix.h"
+#include "zip.h"
#include "unzip.h"
#define DLLEXPORT extern "C"
+typedef class UNZFAM *PUNZFAM;
+typedef class UZXFAM *PUZXFAM;
typedef class ZIPFAM *PZIPFAM;
typedef class ZPXFAM *PZPXFAM;
@@ -21,16 +25,50 @@ typedef class ZPXFAM *PZPXFAM;
/* This is the ZIP utility fonctions class. */
/***********************************************************************/
class DllExport ZIPUTIL : public BLOCK {
-public:
+ public:
// Constructor
- ZIPUTIL(PSZ tgt, bool mul);
-//ZIPUTIL(ZIPUTIL *zutp);
+ ZIPUTIL(PSZ tgt);
+ //ZIPUTIL(ZIPUTIL *zutp);
// Implementation
-//PTXF Duplicate(PGLOBAL g) { return (PTXF) new(g)ZIPFAM(this); }
+ //PTXF Duplicate(PGLOBAL g) { return (PTXF) new(g)UNZFAM(this); }
// Methods
- virtual bool OpenTable(PGLOBAL g, MODE mode, char *fn);
+ bool OpenTable(PGLOBAL g, MODE mode, char *fn, bool append);
+ bool open(PGLOBAL g, char *fn, bool append);
+ bool addEntry(PGLOBAL g, char *entry);
+ void close(void);
+ void closeEntry(void);
+ int writeEntry(PGLOBAL g, char *buf, int len);
+ void getTime(tm_zip& tmZip);
+
+ // Members
+ zipFile zipfile; // The ZIP container file
+ PSZ target; // The target file name
+//unz_file_info finfo; // The current file info
+ PFBLOCK fp;
+//char *memory;
+//uint size;
+//int multiple; // Multiple targets
+ bool entryopen; // True when open current entry
+//char fn[FILENAME_MAX]; // The current entry file name
+//char mapCaseTable[256];
+}; // end of ZIPUTIL
+
+/***********************************************************************/
+/* This is the unZIP utility fonctions class. */
+/***********************************************************************/
+class DllExport UNZIPUTL : public BLOCK {
+ public:
+ // Constructor
+ UNZIPUTL(PSZ tgt, bool mul);
+//UNZIPUTL(UNZIPUTL *zutp);
+
+ // Implementation
+//PTXF Duplicate(PGLOBAL g) { return (PTXF) new(g)UNZFAM(this); }
+
+ // Methods
+ bool OpenTable(PGLOBAL g, MODE mode, char *fn);
bool open(PGLOBAL g, char *fn);
bool openEntry(PGLOBAL g);
void close(void);
@@ -50,68 +88,120 @@ public:
bool entryopen; // True when open current entry
char fn[FILENAME_MAX]; // The current entry file name
char mapCaseTable[256];
-}; // end of ZIPFAM
+}; // end of UNZIPUTL
/***********************************************************************/
-/* This is the ZIP file access method. */
+/* This is the unzip file access method. */
/***********************************************************************/
-class DllExport ZIPFAM : public MAPFAM {
- friend class ZPXFAM;
-public:
+class DllExport UNZFAM : public MAPFAM {
+//friend class UZXFAM;
+ public:
// Constructors
- ZIPFAM(PDOSDEF tdp);
- ZIPFAM(PZIPFAM txfp);
- ZIPFAM(PDOSDEF tdp, PZPXFAM txfp);
+ UNZFAM(PDOSDEF tdp);
+ UNZFAM(PUNZFAM txfp);
// Implementation
- virtual AMT GetAmType(void) { return TYPE_AM_ZIP; }
- virtual PTXF Duplicate(PGLOBAL g) { return (PTXF) new(g)ZIPFAM(this); }
+ virtual AMT GetAmType(void) {return TYPE_AM_ZIP;}
+ virtual PTXF Duplicate(PGLOBAL g) {return (PTXF) new(g) UNZFAM(this);}
// Methods
virtual int Cardinality(PGLOBAL g);
virtual int GetFileLength(PGLOBAL g);
-//virtual int MaxBlkSize(PGLOBAL g, int s) {return s;}
+ //virtual int MaxBlkSize(PGLOBAL g, int s) {return s;}
virtual bool OpenTableFile(PGLOBAL g);
virtual bool DeferReading(void) { return false; }
virtual int GetNext(PGLOBAL g);
-//virtual int ReadBuffer(PGLOBAL g);
-//virtual int WriteBuffer(PGLOBAL g);
-//virtual int DeleteRecords(PGLOBAL g, int irc);
-//virtual void CloseTableFile(PGLOBAL g, bool abort);
+ //virtual int ReadBuffer(PGLOBAL g);
+ //virtual int WriteBuffer(PGLOBAL g);
+ //virtual int DeleteRecords(PGLOBAL g, int irc);
+ //virtual void CloseTableFile(PGLOBAL g, bool abort);
-protected:
+ protected:
// Members
- ZIPUTIL *zutp;
- PSZ target;
- bool mul;
-}; // end of ZIPFAM
+ UNZIPUTL *zutp;
+ PSZ target;
+ bool mul;
+}; // end of UNZFAM
/***********************************************************************/
-/* This is the fixed ZIP file access method. */
+/* This is the fixed unzip file access method. */
/***********************************************************************/
-class DllExport ZPXFAM : public MPXFAM {
- friend class ZIPFAM;
-public:
+class DllExport UZXFAM : public MPXFAM {
+//friend class UNZFAM;
+ public:
// Constructors
- ZPXFAM(PDOSDEF tdp);
- ZPXFAM(PZPXFAM txfp);
+ UZXFAM(PDOSDEF tdp);
+ UZXFAM(PUZXFAM txfp);
// Implementation
virtual AMT GetAmType(void) { return TYPE_AM_ZIP; }
- virtual PTXF Duplicate(PGLOBAL g) { return (PTXF) new(g)ZPXFAM(this); }
+ virtual PTXF Duplicate(PGLOBAL g) { return (PTXF) new(g)UZXFAM(this); }
// Methods
virtual int GetFileLength(PGLOBAL g);
virtual int Cardinality(PGLOBAL g);
virtual bool OpenTableFile(PGLOBAL g);
virtual int GetNext(PGLOBAL g);
-//virtual int ReadBuffer(PGLOBAL g);
+ //virtual int ReadBuffer(PGLOBAL g);
+
+ protected:
+ // Members
+ UNZIPUTL *zutp;
+ PSZ target;
+ bool mul;
+}; // end of UZXFAM
+
+/***********************************************************************/
+/* This is the zip file access method. */
+/***********************************************************************/
+class DllExport ZIPFAM : public DOSFAM {
+ public:
+ // Constructors
+ ZIPFAM(PDOSDEF tdp);
+
+ // Implementation
+ virtual AMT GetAmType(void) {return TYPE_AM_ZIP;}
+
+ // Methods
+ virtual int Cardinality(PGLOBAL g) {return 0;}
+ virtual int GetFileLength(PGLOBAL g) {return g ? 0 : 1;}
+ //virtual int MaxBlkSize(PGLOBAL g, int s) {return s;}
+ virtual bool OpenTableFile(PGLOBAL g);
+ virtual int ReadBuffer(PGLOBAL g);
+ virtual int WriteBuffer(PGLOBAL g);
+ //virtual int DeleteRecords(PGLOBAL g, int irc);
+ virtual void CloseTableFile(PGLOBAL g, bool abort);
+
+ protected:
+ // Members
+ ZIPUTIL *zutp;
+ PSZ target;
+ bool append;
+}; // end of ZIPFAM
+
+/***********************************************************************/
+/* This is the fixed zip file access method. */
+/***********************************************************************/
+class DllExport ZPXFAM : public FIXFAM {
+ public:
+ // Constructors
+ ZPXFAM(PDOSDEF tdp);
+
+ // Implementation
+ virtual AMT GetAmType(void) {return TYPE_AM_ZIP;}
+
+ // Methods
+ virtual int Cardinality(PGLOBAL g) {return 0;}
+ virtual int GetFileLength(PGLOBAL g) {return g ? 0 : 1;}
+ virtual bool OpenTableFile(PGLOBAL g);
+ virtual int WriteBuffer(PGLOBAL g);
+ virtual void CloseTableFile(PGLOBAL g, bool abort);
-protected:
+ protected:
// Members
ZIPUTIL *zutp;
PSZ target;
- bool mul;
+ bool append;
}; // end of ZPXFAM
#endif // __FILAMZIP_H
diff --git a/storage/connect/ha_connect.cc b/storage/connect/ha_connect.cc
index b542ca180c5..f2727ba15f7 100644
--- a/storage/connect/ha_connect.cc
+++ b/storage/connect/ha_connect.cc
@@ -1,4 +1,4 @@
-/* Copyright (C) Olivier Bertrand 2004 - 2016
+/* Copyright (C) Olivier Bertrand 2004 - 2017
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
/**
@file ha_connect.cc
@@ -125,6 +125,8 @@
#endif // UNIX
#include "global.h"
#include "plgdbsem.h"
+#include "xtable.h"
+#include "tabext.h"
#if defined(ODBC_SUPPORT)
#include "odbccat.h"
#endif // ODBC_SUPPORT
@@ -132,12 +134,11 @@
#include "tabjdbc.h"
#include "jdbconn.h"
#endif // JDBC_SUPPORT
-#include "xtable.h"
#include "tabmysql.h"
#include "filamdbf.h"
#include "tabxcl.h"
#include "tabfmt.h"
-#include "reldef.h"
+//#include "reldef.h"
#include "tabcol.h"
#include "xindex.h"
#if defined(__WIN__)
@@ -171,9 +172,9 @@
#define JSONMAX 10 // JSON Default max grp size
extern "C" {
- char version[]= "Version 1.05.0001 December 13, 2016";
+ char version[]= "Version 1.05.0003 February 27, 2017";
#if defined(__WIN__)
- char compver[]= "Version 1.05.0001 " __DATE__ " " __TIME__;
+ char compver[]= "Version 1.05.0003 " __DATE__ " " __TIME__;
char slash= '\\';
#else // !__WIN__
char slash= '/';
@@ -214,6 +215,7 @@ int TranslateJDBCType(int stp, char *tn, int prec, int& len, char& v);
void PushWarning(PGLOBAL g, THD *thd, int level);
bool CheckSelf(PGLOBAL g, TABLE_SHARE *s, const char *host,
const char *db, char *tab, const char *src, int port);
+bool ZipLoadFile(PGLOBAL, char*, char*, char*, bool, bool);
bool ExactInfo(void);
USETEMP UseTemp(void);
int GetConvSize(void);
@@ -556,7 +558,7 @@ ha_create_table_option connect_index_option_list[]=
/***********************************************************************/
/* Push G->Message as a MySQL warning. */
/***********************************************************************/
-bool PushWarning(PGLOBAL g, PTDBASE tdbp, int level)
+bool PushWarning(PGLOBAL g, PTDB tdbp, int level)
{
PHC phc;
THD *thd;
@@ -1024,7 +1026,7 @@ char *GetListOption(PGLOBAL g, const char *opname,
char key[16], val[256];
char *pk, *pv, *pn;
- char *opval= (char*) def;
+ char *opval= (char*)def;
int n;
for (pk= (char*)oplist; pk; pk= ++pn) {
@@ -1032,26 +1034,17 @@ char *GetListOption(PGLOBAL g, const char *opname,
pv= strchr(pk, '=');
if (pv && (!pn || pv < pn)) {
- n= pv - pk;
+ n= MY_MIN(static_cast<size_t>(pv - pk), sizeof(key) - 1);
memcpy(key, pk, n);
key[n]= 0;
pv++;
-
- if (pn) {
- n= pn - pv;
- memcpy(val, pv, n);
- val[n]= 0;
- } else
- strcpy(val, pv);
-
+ n= MY_MIN((pn ? pn - pv : strlen(pv)), sizeof(val) - 1);
+ memcpy(val, pv, n);
+ val[n]= 0;
} else {
- if (pn) {
- n= MY_MIN(pn - pk, 15);
- memcpy(key, pk, n);
- key[n]= 0;
- } else
- strcpy(key, pk);
-
+ n= MY_MIN((pn ? pn - pk : strlen(pk)), sizeof(key) - 1);
+ memcpy(key, pk, n);
+ key[n]= 0;
val[0]= 0;
} // endif pv
@@ -1105,7 +1098,7 @@ char *GetStringTableOption(PGLOBAL g, PTOS options, char *opname, char *sdef)
else if (!stricmp(opname, "Data_charset"))
opval= options->data_charset;
- if (!opval && options && options->oplist)
+ if (!opval && options->oplist)
opval= GetListOption(g, opname, options->oplist);
return opval ? (char*)opval : sdef;
@@ -2113,7 +2106,7 @@ int ha_connect::ScanRecord(PGLOBAL g, uchar *)
PCOL colp;
PVAL value, sdvalin;
Field *fp;
- PTDBASE tp= (PTDBASE)tdbp;
+//PTDBASE tp= (PTDBASE)tdbp;
String attribute(attr_buffer, sizeof(attr_buffer),
table->s->table_charset);
my_bitmap_map *bmap= dbug_tmp_use_all_columns(table, table->read_set);
@@ -2131,7 +2124,7 @@ int ha_connect::ScanRecord(PGLOBAL g, uchar *)
&& tdbp->GetAmType() != TYPE_AM_ODBC
&& tdbp->GetAmType() != TYPE_AM_JDBC) ||
bitmap_is_set(table->write_set, fp->field_index)) {
- for (colp= tp->GetSetCols(); colp; colp= colp->GetNext())
+ for (colp= tdbp->GetSetCols(); colp; colp= colp->GetNext())
if (!stricmp(colp->GetName(), fp->field_name))
break;
@@ -2218,7 +2211,7 @@ int ha_connect::ScanRecord(PGLOBAL g, uchar *)
} else if (xmod == MODE_UPDATE) {
PCOL cp;
- for (cp= tp->GetColumns(); cp; cp= cp->GetNext())
+ for (cp= tdbp->GetColumns(); cp; cp= cp->GetNext())
if (!stricmp(colp->GetName(), cp->GetName()))
break;
@@ -2685,7 +2678,8 @@ PCFIL ha_connect::CheckCond(PGLOBAL g, PCFIL filp, const Item *cond)
{
AMT tty = filp->Type;
char *body= filp->Body;
- unsigned int i;
+ char *havg= filp->Having;
+ unsigned int i;
bool ismul= false, x= (tty == TYPE_AM_MYX || tty == TYPE_AM_XDBC);
bool nonul= ((tty == TYPE_AM_ODBC || tty == TYPE_AM_JDBC) &&
(tdbp->GetMode() == MODE_INSERT || tdbp->GetMode() == MODE_DELETE));
@@ -2698,7 +2692,8 @@ PCFIL ha_connect::CheckCond(PGLOBAL g, PCFIL filp, const Item *cond)
htrc("Cond type=%d\n", cond->type());
if (cond->type() == COND::COND_ITEM) {
- char *p1, *p2;
+ char *pb0, *pb1, *pb2, *ph0, *ph1, *ph2;
+ bool bb = false, bh = false;
Item_cond *cond_item= (Item_cond *)cond;
if (x)
@@ -2718,38 +2713,78 @@ PCFIL ha_connect::CheckCond(PGLOBAL g, PCFIL filp, const Item *cond)
List_iterator<Item> li(*arglist);
const Item *subitem;
- p1= body + strlen(body);
- strcpy(p1, "(");
- p2= p1 + 1;
+ pb0= pb1= body + strlen(body);
+ strcpy(pb0, "(");
+ pb2= pb1 + 1;
+
+ if (havg) {
+ ph0= ph1= havg + strlen(havg);
+ strcpy(ph0, "(");
+ ph2= ph1 + 1;
+ } // endif havg
for (i= 0; i < arglist->elements; i++)
if ((subitem= li++)) {
if (!CheckCond(g, filp, subitem)) {
if (vop == OP_OR || nonul)
return NULL;
- else
- *p2= 0;
+ else {
+ *pb2= 0;
+ if (havg) *ph2= 0;
+ } // endelse
} else {
- p1= p2 + strlen(p2);
- strcpy(p1, GetValStr(vop, false));
- p2= p1 + strlen(p1);
+ if (filp->Bd) {
+ pb1= pb2 + strlen(pb2);
+ strcpy(pb1, GetValStr(vop, false));
+ pb2= pb1 + strlen(pb1);
+ } // endif Bd
+
+ if (filp->Hv) {
+ ph1= ph2 + strlen(ph2);
+ strcpy(ph1, GetValStr(vop, false));
+ ph2= ph1 + strlen(ph1);
+ } // endif Hv
+
} // endif CheckCond
+ bb |= filp->Bd;
+ bh |= filp->Hv;
+ filp->Bd = filp->Hv = false;
} else
return NULL;
- if (*p1 != '(')
- strcpy(p1, ")");
- else
- return NULL;
+ if (bb) {
+ strcpy(pb1, ")");
+ filp->Bd = bb;
+ } else
+ *pb0= 0;
+
+ if (havg) {
+ if (bb && bh && vop == OP_OR) {
+ // Cannot or'ed a where clause with a having clause
+ bb= bh= 0;
+ *pb0 = 0;
+ *ph0 = 0;
+ } else if (bh) {
+ strcpy(ph1, ")");
+ filp->Hv= bh;
+ } else
+ *ph0 = 0;
+
+ } // endif havg
+
+ if (!bb && !bh)
+ return NULL;
} else if (cond->type() == COND::FUNC_ITEM) {
unsigned int i;
- bool iscol, neg= FALSE;
+ bool iscol, ishav= false, neg= false;
Item_func *condf= (Item_func *)cond;
Item* *args= condf->arguments();
+ filp->Bd = filp->Hv = false;
+
if (trace)
htrc("Func type=%d argnum=%d\n", condf->functype(),
condf->argument_count());
@@ -2798,8 +2833,9 @@ PCFIL ha_connect::CheckCond(PGLOBAL g, PCFIL filp, const Item *cond)
ha_field_option_struct *fop;
Item_field *pField= (Item_field *)args[i];
- if (x && i)
- return NULL;
+ // IN and BETWEEN clauses should be col VOP list
+ if (i && (x || ismul))
+ return NULL; // IN and BETWEEN clauses should be col VOP list
else if (pField->field->table != table)
return NULL; // Field does not belong to this table
else if (tty != TYPE_AM_WMI && IsIndexed(pField->field))
@@ -2815,10 +2851,19 @@ PCFIL ha_connect::CheckCond(PGLOBAL g, PCFIL filp, const Item *cond)
else
return NULL;
- } else if (tty == TYPE_AM_TBL)
- return NULL;
- else
- fnm= pField->field->field_name;
+ } else if (tty == TYPE_AM_TBL) {
+ return NULL;
+ } else {
+ bool h;
+
+ fnm = filp->Chk(pField->field->field_name, &h);
+
+ if (h && i && !ishav)
+ return NULL; // Having should be col VOP arg
+ else
+ ishav = h;
+
+ } // endif's
if (trace) {
htrc("Field index=%d\n", pField->field->field_index);
@@ -2827,11 +2872,7 @@ PCFIL ha_connect::CheckCond(PGLOBAL g, PCFIL filp, const Item *cond)
htrc("Field_type=%d\n", args[i]->field_type());
} // endif trace
- // IN and BETWEEN clauses should be col VOP list
- if (i && ismul)
- return NULL;
-
- strcat(body, fnm);
+ strcat((ishav ? havg : body), fnm);
} else if (args[i]->type() == COND::FUNC_ITEM) {
if (tty == TYPE_AM_MYSQL) {
if (!CheckCond(g, filp, args[i]))
@@ -2870,32 +2911,34 @@ PCFIL ha_connect::CheckCond(PGLOBAL g, PCFIL filp, const Item *cond)
return NULL;
if (!x) {
+ char *s = (ishav) ? havg : body;
+
// Append the value to the filter
switch (args[i]->field_type()) {
case MYSQL_TYPE_TIMESTAMP:
case MYSQL_TYPE_DATETIME:
if (tty == TYPE_AM_ODBC) {
- strcat(body, "{ts '");
- strncat(body, res->ptr(), res->length());
+ strcat(s, "{ts '");
+ strncat(s, res->ptr(), res->length());
if (res->length() < 19)
- strcat(body, &"1970-01-01 00:00:00"[res->length()]);
+ strcat(s, &"1970-01-01 00:00:00"[res->length()]);
- strcat(body, "'}");
+ strcat(s, "'}");
break;
} // endif ODBC
case MYSQL_TYPE_DATE:
if (tty == TYPE_AM_ODBC) {
- strcat(body, "{d '");
- strcat(strncat(body, res->ptr(), res->length()), "'}");
+ strcat(s, "{d '");
+ strcat(strncat(s, res->ptr(), res->length()), "'}");
break;
} // endif ODBC
case MYSQL_TYPE_TIME:
if (tty == TYPE_AM_ODBC) {
- strcat(body, "{t '");
- strcat(strncat(body, res->ptr(), res->length()), "'}");
+ strcat(s, "{t '");
+ strcat(strncat(s, res->ptr(), res->length()), "'}");
break;
} // endif ODBC
@@ -2904,39 +2947,39 @@ PCFIL ha_connect::CheckCond(PGLOBAL g, PCFIL filp, const Item *cond)
switch (args[0]->field_type()) {
case MYSQL_TYPE_TIMESTAMP:
case MYSQL_TYPE_DATETIME:
- strcat(body, "{ts '");
- strncat(body, res->ptr(), res->length());
+ strcat(s, "{ts '");
+ strncat(s, res->ptr(), res->length());
if (res->length() < 19)
- strcat(body, &"1970-01-01 00:00:00"[res->length()]);
+ strcat(s, &"1970-01-01 00:00:00"[res->length()]);
- strcat(body, "'}");
+ strcat(s, "'}");
break;
case MYSQL_TYPE_DATE:
- strcat(body, "{d '");
- strncat(body, res->ptr(), res->length());
- strcat(body, "'}");
+ strcat(s, "{d '");
+ strncat(s, res->ptr(), res->length());
+ strcat(s, "'}");
break;
case MYSQL_TYPE_TIME:
- strcat(body, "{t '");
- strncat(body, res->ptr(), res->length());
- strcat(body, "'}");
+ strcat(s, "{t '");
+ strncat(s, res->ptr(), res->length());
+ strcat(s, "'}");
break;
default:
- strcat(body, "'");
- strncat(body, res->ptr(), res->length());
- strcat(body, "'");
+ strcat(s, "'");
+ strncat(s, res->ptr(), res->length());
+ strcat(s, "'");
} // endswitch field type
} else {
- strcat(body, "'");
- strncat(body, res->ptr(), res->length());
- strcat(body, "'");
+ strcat(s, "'");
+ strncat(s, res->ptr(), res->length());
+ strcat(s, "'");
} // endif tty
break;
default:
- strncat(body, res->ptr(), res->length());
+ strncat(s, res->ptr(), res->length());
} // endswitch field type
} else {
@@ -2952,22 +2995,28 @@ PCFIL ha_connect::CheckCond(PGLOBAL g, PCFIL filp, const Item *cond)
} // endif x
- } // endif
+ } // endif's Type
if (!x) {
- if (!i)
- strcat(body, GetValStr(vop, neg));
+ char *s = (ishav) ? havg : body;
+
+ if (!i)
+ strcat(s, GetValStr(vop, neg));
else if (vop == OP_XX && i == 1)
- strcat(body, " AND ");
+ strcat(s, " AND ");
else if (vop == OP_IN)
- strcat(body, (i == condf->argument_count() - 1) ? ")" : ",");
+ strcat(s, (i == condf->argument_count() - 1) ? ")" : ",");
} // endif x
} // endfor i
- if (x)
- filp->Op= vop;
+ if (x)
+ filp->Op = vop;
+ else if (ishav)
+ filp->Hv = true;
+ else
+ filp->Bd = true;
} else {
if (trace)
@@ -3024,16 +3073,28 @@ const COND *ha_connect::cond_push(const COND *cond)
if (b) {
PCFIL filp;
+ int rc;
if ((filp= tdbp->GetCondFil()) && filp->Cond == cond &&
filp->Idx == active_index && filp->Type == tty)
goto fin; // Already done
filp= new(g) CONDFIL(cond, active_index, tty);
- filp->Body= (char*)PlugSubAlloc(g, NULL, (x) ? 128 : 0);
- *filp->Body= 0;
+ rc = filp->Init(g, this);
+
+ if (rc == RC_INFO) {
+ filp->Having = (char*)PlugSubAlloc(g, NULL, 256);
+ *filp->Having = 0;
+ } else if (rc == RC_FX)
+ goto fin;
+
+ filp->Body = (char*)PlugSubAlloc(g, NULL, (x) ? 128 : 0);
+ *filp->Body = 0;
if (CheckCond(g, filp, cond)) {
+ if (filp->Having && strlen(filp->Having) > 255)
+ goto fin; // Memory collapse
+
if (trace)
htrc("cond_push: %s\n", filp->Body);
@@ -3206,9 +3267,9 @@ int ha_connect::optimize(THD* thd, HA_CHECK_OPT*)
tdbp= GetTDB(g);
dup->Check |= CHK_OPT;
- if (tdbp) {
+ if (tdbp && !tdbp->IsRemote()) {
bool dop= IsTypeIndexable(GetRealType(NULL));
- bool dox= (((PTDBASE)tdbp)->GetDef()->Indexable() == 1);
+ bool dox= (tdbp->GetDef()->Indexable() == 1);
if ((rc= ((PTDBASE)tdbp)->ResetTableOpt(g, dop, dox))) {
if (rc == RC_INFO) {
@@ -3219,7 +3280,7 @@ int ha_connect::optimize(THD* thd, HA_CHECK_OPT*)
} // endif rc
- } else
+ } else if (!tdbp)
rc= HA_ERR_INTERNAL_ERROR;
return rc;
@@ -3462,9 +3523,9 @@ int ha_connect::index_init(uint idx, bool sorted)
htrc("index_init CONNECT: %s\n", g->Message);
active_index= MAX_KEY;
rc= HA_ERR_INTERNAL_ERROR;
- } else if (((PTDBDOX)tdbp)->To_Kindex) {
+ } else if (tdbp->GetKindex()) {
if (((PTDBDOX)tdbp)->To_Kindex->GetNum_K()) {
- if (((PTDBASE)tdbp)->GetFtype() != RECFM_NAF)
+ if (tdbp->GetFtype() != RECFM_NAF)
((PTDBDOX)tdbp)->GetTxfp()->ResetBuffer(g);
active_index= idx;
@@ -3878,11 +3939,10 @@ int ha_connect::rnd_next(uchar *buf)
void ha_connect::position(const uchar *)
{
DBUG_ENTER("ha_connect::position");
-//if (((PTDBASE)tdbp)->GetDef()->Indexable())
- my_store_ptr(ref, ref_length, (my_off_t)((PTDBASE)tdbp)->GetRecpos());
+ my_store_ptr(ref, ref_length, (my_off_t)tdbp->GetRecpos());
if (trace > 1)
- htrc("position: pos=%d\n", ((PTDBASE)tdbp)->GetRecpos());
+ htrc("position: pos=%d\n", tdbp->GetRecpos());
DBUG_VOID_RETURN;
} // end of position
@@ -3907,14 +3967,14 @@ void ha_connect::position(const uchar *)
int ha_connect::rnd_pos(uchar *buf, uchar *pos)
{
int rc;
- PTDBASE tp= (PTDBASE)tdbp;
+//PTDBASE tp= (PTDBASE)tdbp;
DBUG_ENTER("ha_connect::rnd_pos");
- if (!tp->SetRecpos(xp->g, (int)my_get_ptr(pos, ref_length))) {
+ if (!tdbp->SetRecpos(xp->g, (int)my_get_ptr(pos, ref_length))) {
if (trace)
- htrc("rnd_pos: %d\n", tp->GetRecpos());
+ htrc("rnd_pos: %d\n", tdbp->GetRecpos());
- tp->SetFilter(NULL);
+ tdbp->SetFilter(NULL);
rc= rnd_next(buf);
} else
rc= HA_ERR_KEY_NOT_FOUND;
@@ -4092,7 +4152,7 @@ int ha_connect::delete_all_rows()
if (tdbp && tdbp->GetUse() == USE_OPEN &&
tdbp->GetAmType() != TYPE_AM_XML &&
- ((PTDBASE)tdbp)->GetFtype() != RECFM_NAF)
+ tdbp->GetFtype() != RECFM_NAF)
// Close and reopen the table so it will be deleted
rc= CloseTable(g);
@@ -4470,12 +4530,12 @@ int ha_connect::external_lock(THD *thd, int lock_type)
if (!tdbp) {
if (!(tdbp= GetTDB(g)))
DBUG_RETURN(HA_ERR_INTERNAL_ERROR);
- else if (!((PTDBASE)tdbp)->GetDef()->Indexable()) {
+ else if (!tdbp->GetDef()->Indexable()) {
sprintf(g->Message, "external_lock: Table %s is not indexable", tdbp->GetName());
// DBUG_RETURN(HA_ERR_INTERNAL_ERROR); causes assert error
push_warning(thd, Sql_condition::WARN_LEVEL_WARN, 0, g->Message);
DBUG_RETURN(0);
- } else if (((PTDBASE)tdbp)->GetDef()->Indexable() == 1) {
+ } else if (tdbp->GetDef()->Indexable() == 1) {
bool oldsep= ((PCHK)g->Xchk)->oldsep;
bool newsep= ((PCHK)g->Xchk)->newsep;
PTDBDOS tdp= (PTDBDOS)tdbp;
@@ -4556,7 +4616,7 @@ int ha_connect::external_lock(THD *thd, int lock_type)
rc= 0;
} // endif MakeIndex
- } else if (((PTDBASE)tdbp)->GetDef()->Indexable() == 3) {
+ } else if (tdbp->GetDef()->Indexable() == 3) {
if (CheckVirtualIndex(NULL)) {
// Make it a warning to avoid crash
push_warning(thd, Sql_condition::WARN_LEVEL_WARN,
@@ -5172,7 +5232,7 @@ static int connect_assisted_discovery(handlerton *, THD* thd,
TABLE_SHARE *table_s,
HA_CREATE_INFO *create_info)
{
- char v=0, spc= ',', qch= 0;
+ char v=0;
const char *fncn= "?";
const char *user, *fn, *db, *host, *pwd, *sep, *tbl, *src;
const char *col, *ocl, *rnk, *pic, *fcl, *skc, *zfn;
@@ -5224,8 +5284,6 @@ static int connect_assisted_discovery(handlerton *, THD* thd,
fncn= topt->catfunc;
fnc= GetFuncID(fncn);
sep= topt->separator;
- spc= (!sep) ? ',' : *sep;
- qch= topt->qchar ? *topt->qchar : (signed)topt->quoted >= 0 ? '"' : 0;
mul = (int)topt->multiple;
tbl= topt->tablist;
col= topt->colist;
@@ -5425,8 +5483,8 @@ static int connect_assisted_discovery(handlerton *, THD* thd,
if (mydef->GetPassword())
pwd= mydef->GetPassword();
- if (mydef->GetDatabase())
- db= mydef->GetDatabase();
+ if (mydef->GetTabschema())
+ db = mydef->GetTabschema();
if (mydef->GetTabname())
tab= mydef->GetTabname();
@@ -6052,8 +6110,8 @@ int ha_connect::create(const char *name, TABLE *table_arg,
if (mydef->GetHostname())
host= mydef->GetHostname();
- if (mydef->GetDatabase())
- db= mydef->GetDatabase();
+ if (mydef->GetTabschema())
+ db = mydef->GetTabschema();
if (mydef->GetTabname())
tab= mydef->GetTabname();
@@ -6266,21 +6324,26 @@ int ha_connect::create(const char *name, TABLE *table_arg,
// Check for incompatible options
if (options->sepindex) {
my_message(ER_UNKNOWN_ERROR,
- "SEPINDEX is incompatible with unspecified file name",
- MYF(0));
+ "SEPINDEX is incompatible with unspecified file name", MYF(0));
DBUG_RETURN(HA_ERR_UNSUPPORTED);
- } else if (GetTypeID(options->type) == TAB_VEC)
- if (!table->s->max_rows || options->split) {
- my_printf_error(ER_UNKNOWN_ERROR,
- "%s tables whose file name is unspecified cannot be split",
- MYF(0), options->type);
- DBUG_RETURN(HA_ERR_UNSUPPORTED);
- } else if (options->header == 2) {
- my_printf_error(ER_UNKNOWN_ERROR,
- "header=2 is not allowed for %s tables whose file name is unspecified",
- MYF(0), options->type);
- DBUG_RETURN(HA_ERR_UNSUPPORTED);
- } // endif's
+ } else if (GetTypeID(options->type) == TAB_VEC) {
+ if (!table->s->max_rows || options->split) {
+ my_printf_error(ER_UNKNOWN_ERROR,
+ "%s tables whose file name is unspecified cannot be split",
+ MYF(0), options->type);
+ DBUG_RETURN(HA_ERR_UNSUPPORTED);
+ } else if (options->header == 2) {
+ my_printf_error(ER_UNKNOWN_ERROR,
+ "header=2 is not allowed for %s tables whose file name is unspecified",
+ MYF(0), options->type);
+ DBUG_RETURN(HA_ERR_UNSUPPORTED);
+ } // endif's
+
+ } else if (options->zipped) {
+ my_message(ER_UNKNOWN_ERROR,
+ "ZIPPED is incompatible with unspecified file name", MYF(0));
+ DBUG_RETURN(HA_ERR_UNSUPPORTED);
+ } // endif's options
// Fold type to lower case
for (int i= 0; i < 12; i++)
@@ -6333,6 +6396,36 @@ int ha_connect::create(const char *name, TABLE *table_arg,
if (trace)
htrc("xchk=%p createas=%d\n", g->Xchk, g->Createas);
+ if (options->zipped) {
+ // Check whether the zip entry must be made from a file
+ char *fn = GetListOption(g, "Load", options->oplist, NULL);
+
+ if (fn) {
+ char zbuf[_MAX_PATH], buf[_MAX_PATH], dbpath[_MAX_PATH];
+ char *entry = GetListOption(g, "Entry", options->oplist, NULL);
+ char *a = GetListOption(g, "Append", options->oplist, "NO");
+ bool append = *a == '1' || *a == 'Y' || *a == 'y' || !stricmp(a, "ON");
+ char *m = GetListOption(g, "Mulentries", options->oplist, "NO");
+ bool mul = *m == '1' || *m == 'Y' || *m == 'y' || !stricmp(m, "ON");
+
+ if (!entry && !mul) {
+ my_message(ER_UNKNOWN_ERROR, "Missing entry name", MYF(0));
+ DBUG_RETURN(HA_ERR_INTERNAL_ERROR);
+ } // endif entry
+
+ strcat(strcat(strcpy(dbpath, "./"), table->s->db.str), "/");
+ PlugSetPath(zbuf, options->filename, dbpath);
+ PlugSetPath(buf, fn, dbpath);
+
+ if (ZipLoadFile(g, zbuf, buf, entry, append, mul)) {
+ my_message(ER_UNKNOWN_ERROR, g->Message, MYF(0));
+ DBUG_RETURN(HA_ERR_INTERNAL_ERROR);
+ } // endif LoadFile
+
+ } // endif fn
+
+ } // endif zipped
+
// To check whether indexes have to be made or remade
if (!g->Xchk) {
PIXDEF xdp;
@@ -6951,10 +7044,10 @@ maria_declare_plugin(connect)
PLUGIN_LICENSE_GPL,
connect_init_func, /* Plugin Init */
connect_done_func, /* Plugin Deinit */
- 0x0104, /* version number (1.04) */
+ 0x0105, /* version number (1.05) */
NULL, /* status variables */
connect_system_variables, /* system variables */
- "1.05.0001", /* string version */
+ "1.05.0003", /* string version */
MariaDB_PLUGIN_MATURITY_GAMMA /* maturity */
}
maria_declare_plugin_end;
diff --git a/storage/connect/ha_connect.h b/storage/connect/ha_connect.h
index 3d9ff967618..cb15d371b5c 100644
--- a/storage/connect/ha_connect.h
+++ b/storage/connect/ha_connect.h
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
/** @file ha_connect.h
diff --git a/storage/connect/inihandl.c b/storage/connect/inihandl.c
index 896431b855f..e5eb3567779 100644
--- a/storage/connect/inihandl.c
+++ b/storage/connect/inihandl.c
@@ -16,7 +16,7 @@
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
*/
#include "my_global.h"
diff --git a/storage/connect/ioapi.c b/storage/connect/ioapi.c
index 7f5c191b2af..a49da91f7f0 100644
--- a/storage/connect/ioapi.c
+++ b/storage/connect/ioapi.c
@@ -27,6 +27,7 @@
#include "ioapi.h"
+#include "my_attribute.h"
voidpf call_zopen64 (const zlib_filefunc64_32_def* pfilefunc,const void*filename,int mode)
{
@@ -92,7 +93,7 @@ static long ZCALLBACK fseek64_file_func OF((voidpf opaque, voidpf stream, ZPO
static int ZCALLBACK fclose_file_func OF((voidpf opaque, voidpf stream));
static int ZCALLBACK ferror_file_func OF((voidpf opaque, voidpf stream));
-static voidpf ZCALLBACK fopen_file_func (voidpf opaque, const char* filename, int mode)
+static voidpf ZCALLBACK fopen_file_func (voidpf opaque __attribute__((unused)), const char* filename, int mode)
{
FILE* file = NULL;
const char* mode_fopen = NULL;
@@ -110,7 +111,7 @@ static voidpf ZCALLBACK fopen_file_func (voidpf opaque, const char* filename, in
return file;
}
-static voidpf ZCALLBACK fopen64_file_func (voidpf opaque, const void* filename, int mode)
+static voidpf ZCALLBACK fopen64_file_func (voidpf opaque __attribute__((unused)), const void* filename, int mode)
{
FILE* file = NULL;
const char* mode_fopen = NULL;
@@ -129,21 +130,21 @@ static voidpf ZCALLBACK fopen64_file_func (voidpf opaque, const void* filename,
}
-static uLong ZCALLBACK fread_file_func (voidpf opaque, voidpf stream, void* buf, uLong size)
+static uLong ZCALLBACK fread_file_func (voidpf opaque __attribute__((unused)), voidpf stream, void* buf, uLong size)
{
uLong ret;
ret = (uLong)fread(buf, 1, (size_t)size, (FILE *)stream);
return ret;
}
-static uLong ZCALLBACK fwrite_file_func (voidpf opaque, voidpf stream, const void* buf, uLong size)
+static uLong ZCALLBACK fwrite_file_func (voidpf opaque __attribute__((unused)), voidpf stream, const void* buf, uLong size)
{
uLong ret;
ret = (uLong)fwrite(buf, 1, (size_t)size, (FILE *)stream);
return ret;
}
-static long ZCALLBACK ftell_file_func (voidpf opaque, voidpf stream)
+static long ZCALLBACK ftell_file_func (voidpf opaque __attribute__((unused)), voidpf stream)
{
long ret;
ret = ftell((FILE *)stream);
@@ -151,14 +152,14 @@ static long ZCALLBACK ftell_file_func (voidpf opaque, voidpf stream)
}
-static ZPOS64_T ZCALLBACK ftell64_file_func (voidpf opaque, voidpf stream)
+static ZPOS64_T ZCALLBACK ftell64_file_func (voidpf opaque __attribute__((unused)), voidpf stream)
{
ZPOS64_T ret;
ret = FTELLO_FUNC((FILE *)stream);
return ret;
}
-static long ZCALLBACK fseek_file_func (voidpf opaque, voidpf stream, uLong offset, int origin)
+static long ZCALLBACK fseek_file_func (voidpf opaque __attribute__((unused)), voidpf stream, uLong offset, int origin)
{
int fseek_origin=0;
long ret;
@@ -181,7 +182,7 @@ static long ZCALLBACK fseek_file_func (voidpf opaque, voidpf stream, uLong offs
return ret;
}
-static long ZCALLBACK fseek64_file_func (voidpf opaque, voidpf stream, ZPOS64_T offset, int origin)
+static long ZCALLBACK fseek64_file_func (voidpf opaque __attribute__((unused)), voidpf stream, ZPOS64_T offset, int origin)
{
int fseek_origin=0;
long ret;
@@ -207,14 +208,14 @@ static long ZCALLBACK fseek64_file_func (voidpf opaque, voidpf stream, ZPOS64_T
}
-static int ZCALLBACK fclose_file_func (voidpf opaque, voidpf stream)
+static int ZCALLBACK fclose_file_func (voidpf opaque __attribute__((unused)), voidpf stream)
{
int ret;
ret = fclose((FILE *)stream);
return ret;
}
-static int ZCALLBACK ferror_file_func (voidpf opaque, voidpf stream)
+static int ZCALLBACK ferror_file_func (voidpf opaque __attribute__((unused)), voidpf stream)
{
int ret;
ret = ferror((FILE *)stream);
diff --git a/storage/connect/jdbconn.cpp b/storage/connect/jdbconn.cpp
index a69f84a94a1..c1d077406b7 100644
--- a/storage/connect/jdbconn.cpp
+++ b/storage/connect/jdbconn.cpp
@@ -1,7 +1,7 @@
/************ Jdbconn C++ Functions Source Code File (.CPP) ************/
-/* Name: JDBCONN.CPP Version 1.0 */
+/* Name: JDBCONN.CPP Version 1.1 */
/* */
-/* (C) Copyright to the author Olivier BERTRAND 2016 */
+/* (C) Copyright to the author Olivier BERTRAND 2016-2017 */
/* */
/* This file contains the JDBC connection classes functions. */
/***********************************************************************/
@@ -45,9 +45,9 @@
#include "plgdbsem.h"
#include "xobject.h"
#include "xtable.h"
+#include "tabext.h"
#include "tabjdbc.h"
//#include "jdbconn.h"
-//#include "plgcnx.h" // For DB types
#include "resource.h"
#include "valblk.h"
#include "osutil.h"
@@ -318,13 +318,21 @@ PQRYRES JDBCColumns(PGLOBAL g, char *db, char *table, char *colpat,
/**************************************************************************/
PQRYRES JDBCSrcCols(PGLOBAL g, char *src, PJPARM sjp)
{
+ char *sqry;
PQRYRES qrp;
JDBConn *jcp = new(g)JDBConn(g, NULL);
if (jcp->Open(sjp))
return NULL;
- qrp = jcp->GetMetaData(g, src);
+ if (strstr(src, "%s")) {
+ // Place holder for an eventual where clause
+ sqry = (char*)PlugSubAlloc(g, NULL, strlen(src) + 2);
+ sprintf(sqry, src, "1=1"); // dummy where clause
+ } else
+ sqry = src;
+
+ qrp = jcp->GetMetaData(g, sqry);
jcp->Close();
return qrp;
} // end of JDBCSrcCols
@@ -818,6 +826,11 @@ int JDBConn::Open(PJPARM sop)
jpop->Append(GetPluginDir());
jpop->Append("JdbcInterface.jar");
+ // All wrappers are pre-compiled in JavaWrappers.jar in the plugin dir
+ jpop->Append(sep);
+ jpop->Append(GetPluginDir());
+ jpop->Append("JavaWrappers.jar");
+
//================== prepare loading of Java VM ============================
JavaVMInitArgs vm_args; // Initialization arguments
JavaVMOption* options = new JavaVMOption[N]; // JVM invocation options
@@ -1157,6 +1170,9 @@ void JDBConn::Close()
jint rc;
jmethodID did = nullptr;
+ // Could have been detached in case of join
+ rc = jvm->AttachCurrentThread((void**)&env, nullptr);
+
if (gmID(m_G, did, "JdbcDisconnect", "()I"))
printf("%s\n", Msg);
else if (Check(env->CallIntMethod(job, did)))
diff --git a/storage/connect/json.cpp b/storage/connect/json.cpp
index c45630129f1..b473871e9f7 100644
--- a/storage/connect/json.cpp
+++ b/storage/connect/json.cpp
@@ -1,7 +1,7 @@
/*************** json CPP Declares Source Code File (.H) ***************/
-/* Name: json.cpp Version 1.2 */
+/* Name: json.cpp Version 1.3 */
/* */
-/* (C) Copyright to the author Olivier BERTRAND 2014 - 2015 */
+/* (C) Copyright to the author Olivier BERTRAND 2014 - 2017 */
/* */
/* This file contains the JSON classes functions. */
/***********************************************************************/
@@ -27,8 +27,33 @@
#define EL "\r\n"
#else
#define EL "\n"
+#undef SE_CATCH // Does not work for Linux
#endif
+#if defined(SE_CATCH)
+/**************************************************************************/
+/* This is the support of catching C interrupts to prevent crashes. */
+/**************************************************************************/
+#include <eh.h>
+
+class SE_Exception {
+public:
+ SE_Exception(unsigned int n, PEXCEPTION_RECORD p) : nSE(n), eRec(p) {}
+ ~SE_Exception() {}
+
+ unsigned int nSE;
+ PEXCEPTION_RECORD eRec;
+}; // end of class SE_Exception
+
+void trans_func(unsigned int u, _EXCEPTION_POINTERS* pExp)
+{
+ throw SE_Exception(u, pExp->ExceptionRecord);
+} // end of trans_func
+
+char *GetExceptionDesc(PGLOBAL g, unsigned int e);
+#endif // SE_CATCH
+
+
/***********************************************************************/
/* Parse a json string. */
/* Note: when pretty is not known, the caller set pretty to 3. */
@@ -40,6 +65,9 @@ PJSON ParseJson(PGLOBAL g, char *s, int len, int *ptyp, bool *comma)
PJSON jsp = NULL;
STRG src;
+ if (trace)
+ htrc("ParseJson: s=%.10s len=%d\n", s, len);
+
if (!s || !len) {
strcpy(g->Message, "Void JSON object");
return NULL;
@@ -53,15 +81,37 @@ PJSON ParseJson(PGLOBAL g, char *s, int len, int *ptyp, bool *comma)
if (s[0] == '[' && (s[1] == '\n' || (s[1] == '\r' && s[2] == '\n')))
pty[0] = false;
+
// Save stack and allocation environment and prepare error return
if (g->jump_level == MAX_JUMP) {
strcpy(g->Message, MSG(TOO_MANY_JUMPS));
return NULL;
} // endif jump_level
- if ((rc= setjmp(g->jumper[++g->jump_level])) != 0) {
- goto err;
- } // endif rc
+#if defined(SE_CATCH)
+ // Let's try to recover from any kind of interrupt
+ _se_translator_function f = _set_se_translator(trans_func);
+
+ try {
+#endif // SE_CATCH --------------------- try section --------------------
+ if ((rc = setjmp(g->jumper[++g->jump_level])) != 0) {
+ goto err;
+ } // endif rc
+
+#if defined(SE_CATCH) // ------------- end of try section -----------------
+ } catch (SE_Exception e) {
+ sprintf(g->Message, "ParseJson: exception doing setjmp: %s (rc=%hd)",
+ GetExceptionDesc(g, e.nSE), e.nSE);
+ _set_se_translator(f);
+ goto err;
+ } catch (...) {
+ strcpy(g->Message, "Exception doing setjmp");
+ _set_se_translator(f);
+ goto err;
+ } // end of try-catches
+
+ _set_se_translator(f);
+#endif // SE_CATCH
for (i = 0; i < len; i++)
switch (s[i]) {
@@ -140,7 +190,7 @@ tryit:
strcpy(g->Message, "More than one item in file");
err:
- g->jump_level--;
+ g->jump_level--;
return NULL;
} // end of ParseJson
@@ -390,14 +440,14 @@ char *ParseString(PGLOBAL g, int& i, STRG& src)
// if (charset == utf8) {
char xs[5];
uint hex;
-
+
xs[0] = s[++i];
xs[1] = s[++i];
xs[2] = s[++i];
xs[3] = s[++i];
xs[4] = 0;
hex = strtoul(xs, NULL, 16);
-
+
if (hex < 0x80) {
p[n] = (uchar)hex;
} else if (hex < 0x800) {
@@ -414,7 +464,7 @@ char *ParseString(PGLOBAL g, int& i, STRG& src)
} else {
char xs[3];
UINT hex;
-
+
i += 2;
xs[0] = s[++i];
xs[1] = s[++i];
@@ -468,7 +518,7 @@ PVAL ParseNumeric(PGLOBAL g, int& i, STRG& src)
case '.':
if (!found_digit || has_dot || has_e)
goto err;
-
+
has_dot = true;
break;
case 'e':
@@ -769,7 +819,7 @@ bool JOUTSTR::Escape(const char *s)
for (unsigned int i = 0; s[i]; i++)
switch (s[i]) {
- case '"':
+ case '"':
case '\\':
case '\t':
case '\n':
@@ -1057,7 +1107,7 @@ void JARRAY::InitArray(PGLOBAL g)
int i;
PJVAL jvp, *pjvp = &First;
- for (Size = 0, jvp = First; jvp; jvp = jvp->Next)
+ for (Size = 0, jvp = First; jvp; jvp = jvp->Next)
if (!jvp->Del)
Size++;
@@ -1191,8 +1241,8 @@ bool JARRAY::IsNull(void)
/***********************************************************************/
JVALUE::JVALUE(PGLOBAL g, PVAL valp) : JSON()
{
- Jsp = NULL;
- Value = AllocateValue(g, valp);
+ Jsp = NULL;
+ Value = AllocateValue(g, valp);
Next = NULL;
Del = false;
} // end of JVALUE constructor
@@ -1297,7 +1347,7 @@ PSZ JVALUE::GetText(PGLOBAL g, PSZ text)
} // end of GetText
void JVALUE::SetValue(PJSON jsp)
-{
+{
if (jsp && jsp->GetType() == TYPE_JVAL) {
Jsp = jsp->GetJsp();
Value = jsp->GetValue();
diff --git a/storage/connect/jsonudf.cpp b/storage/connect/jsonudf.cpp
index bc7f231814d..f07a1ac818f 100644
--- a/storage/connect/jsonudf.cpp
+++ b/storage/connect/jsonudf.cpp
@@ -1,6 +1,6 @@
/****************** jsonudf C++ Program Source Code File (.CPP) ******************/
-/* PROGRAM NAME: jsonudf Version 1.4 */
-/* (C) Copyright to the author Olivier BERTRAND 2015-2016 */
+/* PROGRAM NAME: jsonudf Version 1.5 */
+/* (C) Copyright to the author Olivier BERTRAND 2015-2017 */
/* This program are the JSON User Defined Functions . */
/*********************************************************************************/
@@ -242,13 +242,16 @@ my_bool JSNX::ParseJpath(PGLOBAL g)
// Jpath = Name;
return true;
- pbuf = PlugDup(g, Jpath);
+ if (!(pbuf = PlgDBDup(g, Jpath)))
+ return true;
// The Jpath must be analyzed
for (i = 0, p = pbuf; (p = strchr(p, ':')); i++, p++)
Nod++; // One path node found
- Nodes = (PJNODE)PlugSubAlloc(g, NULL, (++Nod) * sizeof(JNODE));
+ if (!(Nodes = (PJNODE)PlgDBSubAlloc(g, NULL, (++Nod) * sizeof(JNODE))))
+ return true;
+
memset(Nodes, 0, (Nod)* sizeof(JNODE));
// Analyze the Jpath for this column
@@ -1086,9 +1089,10 @@ inline void JsonFreeMem(PGLOBAL g)
/*********************************************************************************/
static my_bool JsonInit(UDF_INIT *initid, UDF_ARGS *args,
char *message, my_bool mbn,
- unsigned long reslen, unsigned long memlen)
+ unsigned long reslen, unsigned long memlen,
+ unsigned long more = 0)
{
- PGLOBAL g = PlugInit(NULL, memlen);
+ PGLOBAL g = PlugInit(NULL, memlen + more);
if (!g) {
strcpy(message, "Allocation error");
@@ -1100,6 +1104,7 @@ static my_bool JsonInit(UDF_INIT *initid, UDF_ARGS *args,
} // endif g
g->Mrr = (args->arg_count && args->args[0]) ? 1 : 0;
+ g->ActivityStart = (PACTIVITY)more;
initid->maybe_null = mbn;
initid->max_length = reslen;
initid->ptr = (char*)g;
@@ -1443,6 +1448,8 @@ static my_bool CheckMemory(PGLOBAL g, UDF_INIT *initid, UDF_ARGS *args, uint n,
} // endif b
+ ml += (unsigned long)g->ActivityStart; // more
+
if (ml > g->Sarea_Size) {
free(g->Sarea);
@@ -2757,7 +2764,7 @@ void json_item_merge_deinit(UDF_INIT* initid)
/*********************************************************************************/
my_bool json_get_item_init(UDF_INIT *initid, UDF_ARGS *args, char *message)
{
- unsigned long reslen, memlen;
+ unsigned long reslen, memlen, more;
int n = IsJson(args, 0);
if (args->arg_count < 2) {
@@ -2766,7 +2773,7 @@ my_bool json_get_item_init(UDF_INIT *initid, UDF_ARGS *args, char *message)
} else if (!n && args->arg_type[0] != STRING_RESULT) {
strcpy(message, "First argument must be a json item");
return true;
- } else if (args->arg_type[1] != STRING_RESULT) {
+ } else if (args->arg_type[1] != STRING_RESULT) {
strcpy(message, "Second argument is not a string (jpath)");
return true;
} else
@@ -2779,11 +2786,13 @@ my_bool json_get_item_init(UDF_INIT *initid, UDF_ARGS *args, char *message)
memcpy(fn, args->args[0], args->lengths[0]);
fn[args->lengths[0]] = 0;
fl = GetFileLength(fn);
- memlen += fl * 3;
- } else if (n != 3)
- memlen += args->lengths[0] * 3;
+ more = fl * 3;
+ } else if (n != 3) {
+ more = args->lengths[0] * 3;
+ } else
+ more = 0;
- return JsonInit(initid, args, message, true, reslen, memlen);
+ return JsonInit(initid, args, message, true, reslen, memlen, more);
} // end of json_get_item_init
char *json_get_item(UDF_INIT *initid, UDF_ARGS *args, char *result,
@@ -2884,7 +2893,7 @@ my_bool jsonget_string_init(UDF_INIT *initid, UDF_ARGS *args, char *message)
} // endif's
CalcLen(args, false, reslen, memlen);
- memlen += more;
+//memlen += more;
if (n == 2 && args->args[0]) {
char fn[_MAX_PATH];
@@ -2893,11 +2902,11 @@ my_bool jsonget_string_init(UDF_INIT *initid, UDF_ARGS *args, char *message)
memcpy(fn, args->args[0], args->lengths[0]);
fn[args->lengths[0]] = 0;
fl = GetFileLength(fn);
- memlen += fl * 3;
+ more += fl * 3;
} else if (n != 3)
- memlen += args->lengths[0] * 3;
+ more += args->lengths[0] * 3;
- return JsonInit(initid, args, message, true, reslen, memlen);
+ return JsonInit(initid, args, message, true, reslen, memlen, more);
} // end of jsonget_string_init
char *jsonget_string(UDF_INIT *initid, UDF_ARGS *args, char *result,
@@ -2993,7 +3002,7 @@ void jsonget_string_deinit(UDF_INIT* initid)
/*********************************************************************************/
my_bool jsonget_int_init(UDF_INIT *initid, UDF_ARGS *args, char *message)
{
- unsigned long reslen, memlen;
+ unsigned long reslen, memlen, more;
if (args->arg_count != 2) {
strcpy(message, "This function must have 2 arguments");
@@ -3007,10 +3016,10 @@ my_bool jsonget_int_init(UDF_INIT *initid, UDF_ARGS *args, char *message)
} else
CalcLen(args, false, reslen, memlen);
- if (IsJson(args, 0) != 3)
- memlen += 1000; // TODO: calculate this
+ // TODO: calculate this
+ more = (IsJson(args, 0) != 3) ? 1000 : 0;
- return JsonInit(initid, args, message, true, reslen, memlen);
+ return JsonInit(initid, args, message, true, reslen, memlen, more);
} // end of jsonget_int_init
long long jsonget_int(UDF_INIT *initid, UDF_ARGS *args,
@@ -3099,7 +3108,7 @@ void jsonget_int_deinit(UDF_INIT* initid)
/*********************************************************************************/
my_bool jsonget_real_init(UDF_INIT *initid, UDF_ARGS *args, char *message)
{
- unsigned long reslen, memlen;
+ unsigned long reslen, memlen, more;
if (args->arg_count < 2) {
strcpy(message, "At least 2 arguments required");
@@ -3122,10 +3131,10 @@ my_bool jsonget_real_init(UDF_INIT *initid, UDF_ARGS *args, char *message)
CalcLen(args, false, reslen, memlen);
- if (IsJson(args, 0) != 3)
- memlen += 1000; // TODO: calculate this
+ // TODO: calculate this
+ more = (IsJson(args, 0) != 3) ? 1000 : 0;
- return JsonInit(initid, args, message, true, reslen, memlen);
+ return JsonInit(initid, args, message, true, reslen, memlen, more);
} // end of jsonget_real_init
double jsonget_real(UDF_INIT *initid, UDF_ARGS *args,
@@ -3233,10 +3242,11 @@ my_bool jsonlocate_init(UDF_INIT *initid, UDF_ARGS *args, char *message)
CalcLen(args, false, reslen, memlen);
- if (IsJson(args, 0) != 3)
- memlen += more; // TODO: calculate this
+ // TODO: calculate this
+ if (IsJson(args, 0) == 3)
+ more = 0;
- return JsonInit(initid, args, message, true, reslen, memlen);
+ return JsonInit(initid, args, message, true, reslen, memlen, more);
} // end of jsonlocate_init
char *jsonlocate(UDF_INIT *initid, UDF_ARGS *args, char *result,
@@ -3357,10 +3367,11 @@ my_bool json_locate_all_init(UDF_INIT *initid, UDF_ARGS *args, char *message)
CalcLen(args, false, reslen, memlen);
- if (IsJson(args, 0) != 3)
- memlen += more; // TODO: calculate this
+ // TODO: calculate this
+ if (IsJson(args, 0) == 3)
+ more = 0;
- return JsonInit(initid, args, message, true, reslen, memlen);
+ return JsonInit(initid, args, message, true, reslen, memlen, more);
} // end of json_locate_all_init
char *json_locate_all(UDF_INIT *initid, UDF_ARGS *args, char *result,
@@ -3484,12 +3495,12 @@ my_bool jsoncontains_init(UDF_INIT *initid, UDF_ARGS *args, char *message)
} // endif's
CalcLen(args, false, reslen, memlen);
- memlen += more;
+//memlen += more;
- if (IsJson(args, 0) != 3)
- memlen += 1000; // TODO: calculate this
+ // TODO: calculate this
+ more += (IsJson(args, 0) != 3 ? 1000 : 0);
- return JsonInit(initid, args, message, false, reslen, memlen);
+ return JsonInit(initid, args, message, false, reslen, memlen, more);
} // end of jsoncontains_init
long long jsoncontains(UDF_INIT *initid, UDF_ARGS *args, char *result,
@@ -3536,12 +3547,12 @@ my_bool jsoncontains_path_init(UDF_INIT *initid, UDF_ARGS *args, char *message)
} // endif's
CalcLen(args, false, reslen, memlen);
- memlen += more;
+//memlen += more;
- if (IsJson(args, 0) != 3)
- memlen += 1000; // TODO: calculate this
+ // TODO: calculate this
+ more += (IsJson(args, 0) != 3 ? 1000 : 0);
- return JsonInit(initid, args, message, true, reslen, memlen);
+ return JsonInit(initid, args, message, true, reslen, memlen, more);
} // end of jsoncontains_path_init
long long jsoncontains_path(UDF_INIT *initid, UDF_ARGS *args, char *result,
@@ -3735,7 +3746,7 @@ fin:
/*********************************************************************************/
my_bool json_set_item_init(UDF_INIT *initid, UDF_ARGS *args, char *message)
{
- unsigned long reslen, memlen;
+ unsigned long reslen, memlen, more = 0;
int n = IsJson(args, 0);
if (!(args->arg_count % 2)) {
@@ -3754,11 +3765,11 @@ my_bool json_set_item_init(UDF_INIT *initid, UDF_ARGS *args, char *message)
memcpy(fn, args->args[0], args->lengths[0]);
fn[args->lengths[0]] = 0;
fl = GetFileLength(fn);
- memlen += fl * 3;
+ more += fl * 3;
} else if (n != 3)
- memlen += args->lengths[0] * 3;
+ more += args->lengths[0] * 3;
- if (!JsonInit(initid, args, message, true, reslen, memlen)) {
+ if (!JsonInit(initid, args, message, true, reslen, memlen, more)) {
PGLOBAL g = (PGLOBAL)initid->ptr;
// This is a constant function
@@ -3953,7 +3964,7 @@ void json_file_deinit(UDF_INIT* initid)
/*********************************************************************************/
my_bool jfile_make_init(UDF_INIT *initid, UDF_ARGS *args, char *message)
{
- unsigned long reslen, memlen, more = 1024;
+ unsigned long reslen, memlen;
if (args->arg_count < 1 || args->arg_count > 3) {
strcpy(message, "Wrong number of arguments");
@@ -4992,7 +5003,7 @@ fin:
/*********************************************************************************/
my_bool jbin_set_item_init(UDF_INIT *initid, UDF_ARGS *args, char *message)
{
- unsigned long reslen, memlen;
+ unsigned long reslen, memlen, more = 0;
int n = IsJson(args, 0);
if (!(args->arg_count % 2)) {
@@ -5011,11 +5022,11 @@ my_bool jbin_set_item_init(UDF_INIT *initid, UDF_ARGS *args, char *message)
memcpy(fn, args->args[0], args->lengths[0]);
fn[args->lengths[0]] = 0;
fl = GetFileLength(fn);
- memlen += fl * 3;
+ more = fl * 3;
} else if (n != 3)
- memlen += args->lengths[0] * 3;
+ more = args->lengths[0] * 3;
- return JsonInit(initid, args, message, true, reslen, memlen);
+ return JsonInit(initid, args, message, true, reslen, memlen, more);
} // end of jbin_set_item_init
char *jbin_set_item(UDF_INIT *initid, UDF_ARGS *args, char *result,
@@ -5103,8 +5114,8 @@ my_bool jbin_file_init(UDF_INIT *initid, UDF_ARGS *args, char *message)
fl = GetFileLength(args->args[0]);
reslen += fl;
more += fl * M;
- memlen += more;
- return JsonInit(initid, args, message, true, reslen, memlen);
+//memlen += more;
+ return JsonInit(initid, args, message, true, reslen, memlen, more);
} // end of jbin_file_init
char *jbin_file(UDF_INIT *initid, UDF_ARGS *args, char *result,
diff --git a/storage/connect/mycat.cc b/storage/connect/mycat.cc
index 497fe5e1aa8..1fcd8ac78da 100644
--- a/storage/connect/mycat.cc
+++ b/storage/connect/mycat.cc
@@ -1,4 +1,4 @@
-/* Copyright (C) Olivier Bertrand 2004 - 2016
+/* Copyright (C) Olivier Bertrand 2004 - 2017
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -11,14 +11,14 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
/*************** Mycat CC Program Source Code File (.CC) ***************/
/* PROGRAM NAME: MYCAT */
/* ------------- */
-/* Version 1.5 */
+/* Version 1.6 */
/* */
-/* Author: Olivier Bertrand 2012 - 2016 */
+/* Author: Olivier Bertrand 2012 - 2017 */
/* */
/* WHAT THIS PROGRAM DOES: */
/* ----------------------- */
@@ -58,9 +58,10 @@
#endif // UNIX
#include "global.h"
#include "plgdbsem.h"
-#include "reldef.h"
-#include "tabcol.h"
+//#include "reldef.h"
#include "xtable.h"
+#include "tabext.h"
+#include "tabcol.h"
#include "filamtxt.h"
#include "tabdos.h"
#include "tabfmt.h"
@@ -559,13 +560,13 @@ PRELDEF MYCAT::MakeTableDesc(PGLOBAL g, PTABLE tablep, LPCSTR am)
case TAB_XML: tdp= new(g) XMLDEF; break;
#endif // XML_SUPPORT
#if defined(VCT_SUPPORT)
- case TAB_VEC: tdp = new(g)VCTDEF; break;
+ case TAB_VEC: tdp = new(g) VCTDEF; break;
#endif // VCT_SUPPORT
#if defined(ODBC_SUPPORT)
case TAB_ODBC: tdp= new(g) ODBCDEF; break;
#endif // ODBC_SUPPORT
#if defined(JDBC_SUPPORT)
- case TAB_JDBC: tdp= new(g)JDBCDEF; break;
+ case TAB_JDBC: tdp= new(g) JDBCDEF; break;
#endif // JDBC_SUPPORT
#if defined(__WIN__)
case TAB_MAC: tdp= new(g) MACDEF; break;
diff --git a/storage/connect/mycat.h b/storage/connect/mycat.h
index 663b68fd4b9..a3682b31f17 100644
--- a/storage/connect/mycat.h
+++ b/storage/connect/mycat.h
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
/**************** MYCAT H Declares Source Code File (.H) ***************/
/* Name: MYCAT.H Version 2.3 */
diff --git a/storage/connect/myconn.cpp b/storage/connect/myconn.cpp
index 644ca019e4a..d05254a32a6 100644
--- a/storage/connect/myconn.cpp
+++ b/storage/connect/myconn.cpp
@@ -1,11 +1,11 @@
/************** MyConn C++ Program Source Code File (.CPP) **************/
/* PROGRAM NAME: MYCONN */
/* ------------- */
-/* Version 1.8 */
+/* Version 1.9 */
/* */
/* COPYRIGHT: */
/* ---------- */
-/* (C) Copyright to the author Olivier BERTRAND 2007-2016 */
+/* (C) Copyright to the author Olivier BERTRAND 2007-2017 */
/* */
/* WHAT THIS PROGRAM DOES: */
/* ----------------------- */
@@ -375,10 +375,18 @@ PQRYRES SrcColumns(PGLOBAL g, const char *host, const char *db,
if (!port)
port = mysqld_port;
- if (!strnicmp(srcdef, "select ", 7)) {
- query = (char *)PlugSubAlloc(g, NULL, strlen(srcdef) + 9);
- strcat(strcpy(query, srcdef), " LIMIT 0");
- } else
+ if (!strnicmp(srcdef, "select ", 7) || strstr(srcdef, "%s")) {
+ query = (char *)PlugSubAlloc(g, NULL, strlen(srcdef) + 10);
+
+ if (strstr(srcdef, "%s"))
+ sprintf(query, srcdef, "1=1"); // dummy where clause
+ else
+ strcpy(query, srcdef);
+
+ if (!strnicmp(srcdef, "select ", 7))
+ strcat(query, " LIMIT 0");
+
+ } else
query = (char *)srcdef;
// Open a MySQL connection for this table
diff --git a/storage/connect/mysql-test/connect/r/xml_zip.result b/storage/connect/mysql-test/connect/r/xml_zip.result
new file mode 100644
index 00000000000..f176149c53f
--- /dev/null
+++ b/storage/connect/mysql-test/connect/r/xml_zip.result
@@ -0,0 +1,98 @@
+Warnings:
+Warning 1105 No file name. Table will use t1.xml
+#
+# Testing zipped XML tables
+#
+CREATE TABLE t1 (
+ISBN CHAR(13) NOT NULL FIELD_FORMAT='@',
+LANG CHAR(2) NOT NULL FIELD_FORMAT='@',
+SUBJECT CHAR(12) NOT NULL FIELD_FORMAT='@',
+AUTHOR_FIRSTNAME CHAR(15) NOT NULL FIELD_FORMAT='AUTHOR/FIRSTNAME',
+AUTHOR_LASTNAME CHAR(8) NOT NULL FIELD_FORMAT='AUTHOR/LASTNAME',
+TRANSLATOR_PREFIX CHAR(24) DEFAULT NULL FIELD_FORMAT='TRANSLATOR/@PREFIX',
+TRANSLATOR_FIRSTNAME CHAR(6) DEFAULT NULL FIELD_FORMAT='TRANSLATOR/FIRSTNAME',
+TRANSLATOR_LASTNAME CHAR(6) DEFAULT NULL FIELD_FORMAT='TRANSLATOR/LASTNAME',
+TITLE CHAR(30) NOT NULL,
+PUBLISHER_NAME CHAR(15) NOT NULL FIELD_FORMAT='PUBLISHER/NAME',
+PUBLISHER_PLACE CHAR(5) NOT NULL FIELD_FORMAT='PUBLISHER/PLACE',
+DATEPUB CHAR(4) NOT NULL
+) ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='xsample2.zip' ZIPPED=YES
+OPTION_LIST='entry=xsample2.xml,load=xsample2.xml,rownode=BOOK,xmlsup=libxml2,expand=1,mulnode=AUTHOR';
+SELECT * FROM t1;
+ISBN 9782212090819
+LANG fr
+SUBJECT applications
+AUTHOR_FIRSTNAME Jean-Christophe
+AUTHOR_LASTNAME Bernadac
+TRANSLATOR_PREFIX NULL
+TRANSLATOR_FIRSTNAME NULL
+TRANSLATOR_LASTNAME NULL
+TITLE Construire une application XML
+PUBLISHER_NAME Eyrolles
+PUBLISHER_PLACE Paris
+DATEPUB 1999
+ISBN 9782212090819
+LANG fr
+SUBJECT applications
+AUTHOR_FIRSTNAME François
+AUTHOR_LASTNAME Knab
+TRANSLATOR_PREFIX NULL
+TRANSLATOR_FIRSTNAME NULL
+TRANSLATOR_LASTNAME NULL
+TITLE Construire une application XML
+PUBLISHER_NAME Eyrolles
+PUBLISHER_PLACE Paris
+DATEPUB 1999
+ISBN 9782840825685
+LANG fr
+SUBJECT applications
+AUTHOR_FIRSTNAME William J.
+AUTHOR_LASTNAME Pardi
+TRANSLATOR_PREFIX adapté de l'anglais par
+TRANSLATOR_FIRSTNAME James
+TRANSLATOR_LASTNAME Guerin
+TITLE XML en Action
+PUBLISHER_NAME Microsoft Press
+PUBLISHER_PLACE Paris
+DATEPUB 1999
+ISBN 9782212090529
+LANG fr
+SUBJECT général
+AUTHOR_FIRSTNAME Alain
+AUTHOR_LASTNAME Michard
+TRANSLATOR_PREFIX NULL
+TRANSLATOR_FIRSTNAME NULL
+TRANSLATOR_LASTNAME NULL
+TITLE XML, Langage et Applications
+PUBLISHER_NAME Eyrolles
+PUBLISHER_PLACE Paris
+DATEPUB 2003
+CREATE TABLE t2
+ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='xsample2.zip' ZIPPED=YES
+OPTION_LIST='xmlsup=libxml2';
+SELECT * FROM t2;
+ISBN 9782212090819
+LANG fr
+SUBJECT applications
+AUTHOR Jean-Christophe Bernadac
+TRANSLATOR NULL
+TITLE Construire une application XML
+PUBLISHER Eyrolles Paris
+DATEPUB 1999
+ISBN 9782840825685
+LANG fr
+SUBJECT applications
+AUTHOR William J. Pardi
+TRANSLATOR James Guerin
+TITLE XML en Action
+PUBLISHER Microsoft Press Paris
+DATEPUB 1999
+ISBN 9782212090529
+LANG fr
+SUBJECT général
+AUTHOR Alain Michard
+TRANSLATOR NULL
+TITLE XML, Langage et Applications
+PUBLISHER Eyrolles Paris
+DATEPUB 2003
+DROP TABLE t1,t2;
diff --git a/storage/connect/mysql-test/connect/r/zip.result b/storage/connect/mysql-test/connect/r/zip.result
new file mode 100644
index 00000000000..c03b27bd428
--- /dev/null
+++ b/storage/connect/mysql-test/connect/r/zip.result
@@ -0,0 +1,240 @@
+#
+# Testing zipped DOS tables
+#
+CREATE TABLE t1 (
+digit INT(3) NOT NULL,
+letter CHAR(16) NOT NULL)
+ENGINE=CONNECT TABLE_TYPE=DOS FILE_NAME='newdos.zip'
+OPTION_LIST='ENTRY=new1.dos' ZIPPED=1;
+INSERT INTO t1 VALUES(1,'One'),(2,'Two'),(3,'Three'),(4,'Four'),(5,'Five'),(6,'Six'),(7,'Seven'),(8,'Eight'),(9,'Nine'),(10,'Ten');
+SELECT * FROM t1;
+digit letter
+1 One
+2 Two
+3 Three
+4 Four
+5 Five
+6 Six
+7 Seven
+8 Eight
+9 Nine
+10 Ten
+CREATE TABLE t2 (
+digit INT(3) NOT NULL,
+letter CHAR(16) NOT NULL)
+ENGINE=CONNECT TABLE_TYPE=DOS FILE_NAME='newdos.zip'
+OPTION_LIST='ENTRY=new2.dos,APPEND=1' ZIPPED=1;
+INSERT INTO t2 VALUES(11,'Eleven'),(12,'Twelve'),(13,'Thirteen'),(14,'Fourteen'),(15,'Fiften'),(16,'Sixteen'),(17,'Seventeen'),(18,'Eighteen'),(19,'Nineteen'),(20,'Twenty');
+SELECT * FROM t2;
+digit letter
+11 Eleven
+12 Twelve
+13 Thirteen
+14 Fourteen
+15 Fiften
+16 Sixteen
+17 Seventeen
+18 Eighteen
+19 Nineteen
+20 Twenty
+CREATE TABLE t3 (
+digit INT(3) NOT NULL,
+letter CHAR(16) NOT NULL)
+ENGINE=CONNECT TABLE_TYPE=DOS FILE_NAME='newdos.zip'
+OPTION_LIST='MULENTRIES=1' ZIPPED=1;
+SELECT * FROM t3;
+digit letter
+1 One
+2 Two
+3 Three
+4 Four
+5 Five
+6 Six
+7 Seven
+8 Eight
+9 Nine
+10 Ten
+11 Eleven
+12 Twelve
+13 Thirteen
+14 Fourteen
+15 Fiften
+16 Sixteen
+17 Seventeen
+18 Eighteen
+19 Nineteen
+20 Twenty
+CREATE TABLE t4 (
+fn VARCHAR(256)NOT NULL,
+cmpsize BIGINT NOT NULL FLAG=1,
+uncsize BIGINT NOT NULL FLAG=2,
+method INT NOT NULL FLAG=3)
+ENGINE=CONNECT TABLE_TYPE=ZIP FILE_NAME='newdos.zip';
+SELECT * FROM t4;
+fn cmpsize uncsize method
+new1.dos 67 79 8
+new2.dos 77 112 8
+DROP TABLE t1,t2,t3,t4;
+#
+# Testing zipped CSV tables
+#
+CREATE TABLE t1 (
+digit INT(3) NOT NULL,
+letter CHAR(16) NOT NULL)
+ENGINE=CONNECT TABLE_TYPE=CSV FILE_NAME='newcsv.zip'
+OPTION_LIST='ENTRY=new1.csv' HEADER=1 ZIPPED=1;
+INSERT INTO t1 VALUES(1,'One'),(2,'Two'),(3,'Three'),(4,'Four'),(5,'Five'),(6,'Six'),(7,'Seven'),(8,'Eight'),(9,'Nine'),(10,'Ten');
+SELECT * FROM t1;
+digit letter
+1 One
+2 Two
+3 Three
+4 Four
+5 Five
+6 Six
+7 Seven
+8 Eight
+9 Nine
+10 Ten
+CREATE TABLE td1
+ENGINE=CONNECT TABLE_TYPE=CSV FILE_NAME='newcsv.zip'
+OPTION_LIST='ENTRY=new1.csv' HEADER=1 ZIPPED=1;
+SELECT * FROM td1;
+digit letter
+1 One
+2 Two
+3 Three
+4 Four
+5 Five
+6 Six
+7 Seven
+8 Eight
+9 Nine
+10 Ten
+DROP TABLE td1;
+CREATE TABLE t2 (
+digit INT(3) NOT NULL,
+letter CHAR(16) NOT NULL)
+ENGINE=CONNECT TABLE_TYPE=CSV FILE_NAME='newcsv.zip'
+OPTION_LIST='ENTRY=new2.csv,APPEND=1' HEADER=1 ZIPPED=1;
+INSERT INTO t2 VALUES(11,'Eleven'),(12,'Twelve'),(13,'Thirteen'),(14,'Fourteen'),(15,'Fiften'),(16,'Sixteen'),(17,'Seventeen'),(18,'Eighteen'),(19,'Nineteen'),(20,'Twenty');
+SELECT * FROM t2;
+digit letter
+11 Eleven
+12 Twelve
+13 Thirteen
+14 Fourteen
+15 Fiften
+16 Sixteen
+17 Seventeen
+18 Eighteen
+19 Nineteen
+20 Twenty
+CREATE TABLE t3
+ENGINE=CONNECT TABLE_TYPE=CSV FILE_NAME='newcsv.zip'
+OPTION_LIST='MULENTRIES=1' HEADER=1 ZIPPED=1;
+SELECT * FROM t3;
+digit letter
+1 One
+2 Two
+3 Three
+4 Four
+5 Five
+6 Six
+7 Seven
+8 Eight
+9 Nine
+10 Ten
+11 Eleven
+12 Twelve
+13 Thirteen
+14 Fourteen
+15 Fiften
+16 Sixteen
+17 Seventeen
+18 Eighteen
+19 Nineteen
+20 Twenty
+CREATE TABLE t4 (
+fn VARCHAR(256)NOT NULL,
+cmpsize BIGINT NOT NULL FLAG=1,
+uncsize BIGINT NOT NULL FLAG=2,
+method INT NOT NULL FLAG=3)
+ENGINE=CONNECT TABLE_TYPE=ZIP FILE_NAME='newcsv.zip';
+SELECT * FROM t4;
+fn cmpsize uncsize method
+new1.csv 79 83 8
+new2.csv 94 125 8
+DROP TABLE t1,t2,t3,t4;
+#
+# Testing zipped JSON tables
+#
+CREATE TABLE t1 (
+_id INT(2) NOT NULL,
+name_first CHAR(9) NOT NULL FIELD_FORMAT='name:first',
+name_aka CHAR(4) DEFAULT NULL FIELD_FORMAT='name:aka',
+name_last CHAR(10) NOT NULL FIELD_FORMAT='name:last',
+title CHAR(12) DEFAULT NULL,
+birth CHAR(20) DEFAULT NULL,
+death CHAR(20) DEFAULT NULL,
+contribs CHAR(7) NOT NULL FIELD_FORMAT='contribs:',
+awards_award CHAR(42) DEFAULT NULL FIELD_FORMAT='awards::award',
+awards_year CHAR(4) DEFAULT NULL FIELD_FORMAT='awards::year',
+awards_by CHAR(38) DEFAULT NULL FIELD_FORMAT='awards::by'
+) ENGINE=CONNECT TABLE_TYPE=JSON FILE_NAME='bios.zip' OPTION_LIST='ENTRY=bios.json,LOAD=bios.json' ZIPPED=YES;
+SELECT * FROM t1;
+_id name_first name_aka name_last title birth death contribs awards_award awards_year awards_by
+1 John NULL Backus NULL 1924-12-03T05:00:00Z 2007-03-17T04:00:00Z Fortran W.W. McDowell Award 1967 IEEE Computer Society
+2 John NULL McCarthy NULL 1927-09-04T04:00:00Z 2011-12-24T05:00:00Z Lisp Turing Award 1971 ACM
+3 Grace NULL Hopper Rear Admiral 1906-12-09T05:00:00Z 1992-01-01T05:00:00Z UNIVAC Computer Sciences Man of the Year 1969 Data Processing Management Association
+4 Kristen NULL Nygaard NULL 1926-08-27T04:00:00Z 2002-08-10T04:00:00Z OOP Rosing Prize 1999 Norwegian Data Association
+5 Ole-Johan NULL Dahl NULL 1931-10-12T04:00:00Z 2002-06-29T04:00:00Z OOP Rosing Prize 1999 Norwegian Data Association
+6 Guido NULL van Rossum NULL 1956-01-31T05:00:00Z NULL Python Award for the Advancement of Free Software 2001 Free Software Foundation
+7 Dennis NULL Ritchie NULL 1941-09-09T04:00:00Z 2011-10-12T04:00:00Z UNIX Turing Award 1983 ACM
+8 Yukihiro Matz Matsumoto NULL 1965-04-14T04:00:00Z NULL Ruby Award for the Advancement of Free Software 2011 Free Software Foundation
+9 James NULL Gosling NULL 1955-05-19T04:00:00Z NULL Java The Economist Innovation Award 2002 The Economist
+10 Martin NULL Odersky NULL NULL NULL Scala NULL NULL NULL
+CREATE TABLE t2
+ENGINE=CONNECT TABLE_TYPE=JSON FILE_NAME='bios.zip' ZIPPED=1
+OPTION_LIST='LEVEL=5';
+SELECT * FROM t2;
+_id name_first name_aka name_last title birth death contribs awards_award awards_year awards_by
+1 John NULL Backus NULL 1924-12-03T05:00:00Z 2007-03-17T04:00:00Z Fortran W.W. McDowell Award 1967 IEEE Computer Society
+2 John NULL McCarthy NULL 1927-09-04T04:00:00Z 2011-12-24T05:00:00Z Lisp Turing Award 1971 ACM
+3 Grace NULL Hopper Rear Admiral 1906-12-09T05:00:00Z 1992-01-01T05:00:00Z UNIVAC Computer Sciences Man of the Year 1969 Data Processing Management Association
+4 Kristen NULL Nygaard NULL 1926-08-27T04:00:00Z 2002-08-10T04:00:00Z OOP Rosing Prize 1999 Norwegian Data Association
+5 Ole-Johan NULL Dahl NULL 1931-10-12T04:00:00Z 2002-06-29T04:00:00Z OOP Rosing Prize 1999 Norwegian Data Association
+6 Guido NULL van Rossum NULL 1956-01-31T05:00:00Z NULL Python Award for the Advancement of Free Software 2001 Free Software Foundation
+7 Dennis NULL Ritchie NULL 1941-09-09T04:00:00Z 2011-10-12T04:00:00Z UNIX Turing Award 1983 ACM
+8 Yukihiro Matz Matsumoto NULL 1965-04-14T04:00:00Z NULL Ruby Award for the Advancement of Free Software 2011 Free Software Foundation
+9 James NULL Gosling NULL 1955-05-19T04:00:00Z NULL Java The Economist Innovation Award 2002 The Economist
+10 Martin NULL Odersky NULL NULL NULL Scala NULL NULL NULL
+CREATE TABLE t3 (
+_id INT(2) NOT NULL,
+firstname CHAR(9) NOT NULL FIELD_FORMAT='name:first',
+aka CHAR(4) DEFAULT NULL FIELD_FORMAT='name:aka',
+lastname CHAR(10) NOT NULL FIELD_FORMAT='name:last',
+title CHAR(12) DEFAULT NULL,
+birth date DEFAULT NULL date_format="YYYY-DD-MM'T'hh:mm:ss'Z'",
+death date DEFAULT NULL date_format="YYYY-DD-MM'T'hh:mm:ss'Z'",
+contribs CHAR(64) NOT NULL FIELD_FORMAT='contribs:[", "]',
+award CHAR(42) DEFAULT NULL FIELD_FORMAT='awards:[x]:award',
+year CHAR(4) DEFAULT NULL FIELD_FORMAT='awards:[x]:year',
+`by` CHAR(38) DEFAULT NULL FIELD_FORMAT='awards:[x]:by'
+) ENGINE=CONNECT TABLE_TYPE='json' FILE_NAME='bios.zip' ZIPPED=YES;
+SELECT * FROM t3 WHERE _id = 1;
+_id firstname aka lastname title birth death contribs award year by
+1 John NULL Backus NULL 1924-03-12 2008-05-03 Fortran, ALGOL, Backus-Naur Form, FP W.W. McDowell Award 1967 IEEE Computer Society
+1 John NULL Backus NULL 1924-03-12 2008-05-03 Fortran, ALGOL, Backus-Naur Form, FP National Medal of Science 1975 National Science Foundation
+1 John NULL Backus NULL 1924-03-12 2008-05-03 Fortran, ALGOL, Backus-Naur Form, FP Turing Award 1977 ACM
+1 John NULL Backus NULL 1924-03-12 2008-05-03 Fortran, ALGOL, Backus-Naur Form, FP Draper Prize 1993 National Academy of Engineering
+CREATE TABLE t4 (
+fn VARCHAR(256)NOT NULL,
+cmpsize BIGINT NOT NULL FLAG=1,
+uncsize BIGINT NOT NULL FLAG=2,
+method INT NOT NULL FLAG=3)
+ENGINE=CONNECT TABLE_TYPE=ZIP FILE_NAME='bios.zip';
+SELECT * FROM t4;
+fn cmpsize uncsize method
+bios.json 1096 6848 8
+DROP TABLE t1,t2,t3,t4;
diff --git a/storage/connect/mysql-test/connect/std_data/bios.json b/storage/connect/mysql-test/connect/std_data/bios.json
new file mode 100644
index 00000000000..85e4ecb933f
--- /dev/null
+++ b/storage/connect/mysql-test/connect/std_data/bios.json
@@ -0,0 +1,273 @@
+[
+ {
+ "_id" : 1,
+ "name" : {
+ "first" : "John",
+ "last" : "Backus"
+ },
+ "birth" : "1924-12-03T05:00:00Z",
+ "death" : "2007-03-17T04:00:00Z",
+ "contribs" : [
+ "Fortran",
+ "ALGOL",
+ "Backus-Naur Form",
+ "FP"
+ ],
+ "awards" : [
+ {
+ "award" : "W.W. McDowell Award",
+ "year" : 1967,
+ "by" : "IEEE Computer Society"
+ },
+ {
+ "award" : "National Medal of Science",
+ "year" : 1975,
+ "by" : "National Science Foundation"
+ },
+ {
+ "award" : "Turing Award",
+ "year" : 1977,
+ "by" : "ACM"
+ },
+ {
+ "award" : "Draper Prize",
+ "year" : 1993,
+ "by" : "National Academy of Engineering"
+ }
+ ]
+ },
+ {
+ "_id" : 2,
+ "name" : {
+ "first" : "John",
+ "last" : "McCarthy"
+ },
+ "birth" : "1927-09-04T04:00:00Z",
+ "death" : "2011-12-24T05:00:00Z",
+ "contribs" : [
+ "Lisp",
+ "Artificial Intelligence",
+ "ALGOL"
+ ],
+ "awards" : [
+ {
+ "award" : "Turing Award",
+ "year" : 1971,
+ "by" : "ACM"
+ },
+ {
+ "award" : "Kyoto Prize",
+ "year" : 1988,
+ "by" : "Inamori Foundation"
+ },
+ {
+ "award" : "National Medal of Science",
+ "year" : 1990,
+ "by" : "National Science Foundation"
+ }
+ ]
+ },
+ {
+ "_id" : 3,
+ "name" : {
+ "first" : "Grace",
+ "last" : "Hopper"
+ },
+ "title" : "Rear Admiral",
+ "birth" : "1906-12-09T05:00:00Z",
+ "death" : "1992-01-01T05:00:00Z",
+ "contribs" : [
+ "UNIVAC",
+ "compiler",
+ "FLOW-MATIC",
+ "COBOL"
+ ],
+ "awards" : [
+ {
+ "award" : "Computer Sciences Man of the Year",
+ "year" : 1969,
+ "by" : "Data Processing Management Association"
+ },
+ {
+ "award" : "Distinguished Fellow",
+ "year" : 1973,
+ "by" : " British Computer Society"
+ },
+ {
+ "award" : "W. W. McDowell Award",
+ "year" : 1976,
+ "by" : "IEEE Computer Society"
+ },
+ {
+ "award" : "National Medal of Technology",
+ "year" : 1991,
+ "by" : "United States"
+ }
+ ]
+ },
+ {
+ "_id" : 4,
+ "name" : {
+ "first" : "Kristen",
+ "last" : "Nygaard"
+ },
+ "birth" : "1926-08-27T04:00:00Z",
+ "death" : "2002-08-10T04:00:00Z",
+ "contribs" : [
+ "OOP",
+ "Simula"
+ ],
+ "awards" : [
+ {
+ "award" : "Rosing Prize",
+ "year" : 1999,
+ "by" : "Norwegian Data Association"
+ },
+ {
+ "award" : "Turing Award",
+ "year" : 2001,
+ "by" : "ACM"
+ },
+ {
+ "award" : "IEEE John von Neumann Medal",
+ "year" : 2001,
+ "by" : "IEEE"
+ }
+ ]
+ },
+ {
+ "_id" : 5,
+ "name" : {
+ "first" : "Ole-Johan",
+ "last" : "Dahl"
+ },
+ "birth" : "1931-10-12T04:00:00Z",
+ "death" : "2002-06-29T04:00:00Z",
+ "contribs" : [
+ "OOP",
+ "Simula"
+ ],
+ "awards" : [
+ {
+ "award" : "Rosing Prize",
+ "year" : 1999,
+ "by" : "Norwegian Data Association"
+ },
+ {
+ "award" : "Turing Award",
+ "year" : 2001,
+ "by" : "ACM"
+ },
+ {
+ "award" : "IEEE John von Neumann Medal",
+ "year" : 2001,
+ "by" : "IEEE"
+ }
+ ]
+ },
+ {
+ "_id" : 6,
+ "name" : {
+ "first" : "Guido",
+ "last" : "van Rossum"
+ },
+ "birth" : "1956-01-31T05:00:00Z",
+ "contribs" : [
+ "Python"
+ ],
+ "awards" : [
+ {
+ "award" : "Award for the Advancement of Free Software",
+ "year" : 2001,
+ "by" : "Free Software Foundation"
+ },
+ {
+ "award" : "NLUUG Award",
+ "year" : 2003,
+ "by" : "NLUUG"
+ }
+ ]
+ },
+ {
+ "_id" : 7,
+ "name" : {
+ "first" : "Dennis",
+ "last" : "Ritchie"
+ },
+ "birth" : "1941-09-09T04:00:00Z",
+ "death" : "2011-10-12T04:00:00Z",
+ "contribs" : [
+ "UNIX",
+ "C"
+ ],
+ "awards" : [
+ {
+ "award" : "Turing Award",
+ "year" : 1983,
+ "by" : "ACM"
+ },
+ {
+ "award" : "National Medal of Technology",
+ "year" : 1998,
+ "by" : "United States"
+ },
+ {
+ "award" : "Japan Prize",
+ "year" : 2011,
+ "by" : "The Japan Prize Foundation"
+ }
+ ]
+ },
+ {
+ "_id" : 8,
+ "name" : {
+ "first" : "Yukihiro",
+ "aka" : "Matz",
+ "last" : "Matsumoto"
+ },
+ "birth" : "1965-04-14T04:00:00Z",
+ "contribs" : [
+ "Ruby"
+ ],
+ "awards" : [
+ {
+ "award" : "Award for the Advancement of Free Software",
+ "year" : "2011",
+ "by" : "Free Software Foundation"
+ }
+ ]
+ },
+ {
+ "_id" : 9,
+ "name" : {
+ "first" : "James",
+ "last" : "Gosling"
+ },
+ "birth" : "1955-05-19T04:00:00Z",
+ "contribs" : [
+ "Java"
+ ],
+ "awards" : [
+ {
+ "award" : "The Economist Innovation Award",
+ "year" : 2002,
+ "by" : "The Economist"
+ },
+ {
+ "award" : "Officer of the Order of Canada",
+ "year" : 2007,
+ "by" : "Canada"
+ }
+ ]
+ },
+ {
+ "_id" : 10,
+ "name" : {
+ "first" : "Martin",
+ "last" : "Odersky"
+ },
+ "contribs" : [
+ "Scala"
+ ]
+ }
+]
diff --git a/storage/connect/mysql-test/connect/std_data/xsample2.xml b/storage/connect/mysql-test/connect/std_data/xsample2.xml
new file mode 100644
index 00000000000..35295844370
--- /dev/null
+++ b/storage/connect/mysql-test/connect/std_data/xsample2.xml
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<BIBLIO SUBJECT="XML">
+ <BOOK ISBN="9782212090819" LANG="fr" SUBJECT="applications">
+ <AUTHOR>
+ <FIRSTNAME>Jean-Christophe</FIRSTNAME>
+ <LASTNAME>Bernadac</LASTNAME>
+ </AUTHOR>
+ <AUTHOR>
+ <FIRSTNAME>François</FIRSTNAME>
+ <LASTNAME>Knab</LASTNAME>
+ </AUTHOR>
+ <TITLE>Construire une application XML</TITLE>
+ <PUBLISHER>
+ <NAME>Eyrolles</NAME>
+ <PLACE>Paris</PLACE>
+ </PUBLISHER>
+ <DATEPUB>1999</DATEPUB>
+ </BOOK>
+ <BOOK ISBN="9782840825685" LANG="fr" SUBJECT="applications">
+ <AUTHOR>
+ <FIRSTNAME>William J.</FIRSTNAME>
+ <LASTNAME>Pardi</LASTNAME>
+ </AUTHOR>
+ <TRANSLATOR PREFIX="adapté de l'anglais par">
+ <FIRSTNAME>James</FIRSTNAME>
+ <LASTNAME>Guerin</LASTNAME>
+ </TRANSLATOR>
+ <TITLE>XML en Action</TITLE>
+ <PUBLISHER>
+ <NAME>Microsoft Press</NAME>
+ <PLACE>Paris</PLACE>
+ </PUBLISHER>
+ <DATEPUB>1999</DATEPUB>
+ </BOOK>
+ <BOOK ISBN="9782212090529" LANG="fr" SUBJECT="général">
+ <AUTHOR>
+ <FIRSTNAME>Alain</FIRSTNAME>
+ <LASTNAME>Michard</LASTNAME>
+ </AUTHOR>
+ <TITLE>XML, Langage et Applications</TITLE>
+ <PUBLISHER>
+ <NAME>Eyrolles</NAME>
+ <PLACE>Paris</PLACE>
+ </PUBLISHER>
+ <DATEPUB>2003</DATEPUB>
+ </BOOK>
+</BIBLIO>
diff --git a/storage/connect/mysql-test/connect/t/have_zip.inc b/storage/connect/mysql-test/connect/t/have_zip.inc
new file mode 100644
index 00000000000..d1283fc1d38
--- /dev/null
+++ b/storage/connect/mysql-test/connect/t/have_zip.inc
@@ -0,0 +1,19 @@
+--disable_query_log
+--error 0,ER_UNKNOWN_ERROR
+CREATE TABLE t1 (a CHAR(10)) ENGINE=CONNECT TABLE_TYPE=ZIP FILE_NAME='test.zip';
+if ($mysql_errno)
+{
+ Skip No ZIP support;
+}
+#if (!`SELECT count(*) FROM INFORMATION_SCHEMA.TABLES
+# WHERE TABLE_SCHEMA='test' AND TABLE_NAME='t1'
+# AND ENGINE='CONNECT'
+# AND CREATE_OPTIONS LIKE '%`table_type`=ZIP%'
+# AND CREATE OPTIONS LIKE "%`file_name`='test.zip'%"`)
+#{
+# DROP TABLE IF EXISTS t1;
+# Skip Need ZIP support;
+#}
+DROP TABLE t1;
+--enable_query_log
+
diff --git a/storage/connect/mysql-test/connect/t/xml_zip.test b/storage/connect/mysql-test/connect/t/xml_zip.test
new file mode 100644
index 00000000000..d8c7894f861
--- /dev/null
+++ b/storage/connect/mysql-test/connect/t/xml_zip.test
@@ -0,0 +1,41 @@
+--source have_zip.inc
+--source have_libxml2.inc
+
+let $MYSQLD_DATADIR= `select @@datadir`;
+
+--vertical_results
+
+--copy_file $MTR_SUITE_DIR/std_data/xsample2.xml $MYSQLD_DATADIR/test/xsample2.xml
+
+--echo #
+--echo # Testing zipped XML tables
+--echo #
+CREATE TABLE t1 (
+ISBN CHAR(13) NOT NULL FIELD_FORMAT='@',
+LANG CHAR(2) NOT NULL FIELD_FORMAT='@',
+SUBJECT CHAR(12) NOT NULL FIELD_FORMAT='@',
+AUTHOR_FIRSTNAME CHAR(15) NOT NULL FIELD_FORMAT='AUTHOR/FIRSTNAME',
+AUTHOR_LASTNAME CHAR(8) NOT NULL FIELD_FORMAT='AUTHOR/LASTNAME',
+TRANSLATOR_PREFIX CHAR(24) DEFAULT NULL FIELD_FORMAT='TRANSLATOR/@PREFIX',
+TRANSLATOR_FIRSTNAME CHAR(6) DEFAULT NULL FIELD_FORMAT='TRANSLATOR/FIRSTNAME',
+TRANSLATOR_LASTNAME CHAR(6) DEFAULT NULL FIELD_FORMAT='TRANSLATOR/LASTNAME',
+TITLE CHAR(30) NOT NULL,
+PUBLISHER_NAME CHAR(15) NOT NULL FIELD_FORMAT='PUBLISHER/NAME',
+PUBLISHER_PLACE CHAR(5) NOT NULL FIELD_FORMAT='PUBLISHER/PLACE',
+DATEPUB CHAR(4) NOT NULL
+) ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='xsample2.zip' ZIPPED=YES
+OPTION_LIST='entry=xsample2.xml,load=xsample2.xml,rownode=BOOK,xmlsup=libxml2,expand=1,mulnode=AUTHOR';
+SELECT * FROM t1;
+
+#testing discovery
+CREATE TABLE t2
+ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='xsample2.zip' ZIPPED=YES
+OPTION_LIST='xmlsup=libxml2';
+SELECT * FROM t2;
+DROP TABLE t1,t2;
+
+#
+# Clean up
+#
+--remove_file $MYSQLD_DATADIR/test/xsample2.xml
+--remove_file $MYSQLD_DATADIR/test/xsample2.zip
diff --git a/storage/connect/mysql-test/connect/t/zip.test b/storage/connect/mysql-test/connect/t/zip.test
new file mode 100644
index 00000000000..a4892e9ed4e
--- /dev/null
+++ b/storage/connect/mysql-test/connect/t/zip.test
@@ -0,0 +1,136 @@
+--source have_zip.inc
+let $MYSQLD_DATADIR= `select @@datadir`;
+
+--copy_file $MTR_SUITE_DIR/std_data/bios.json $MYSQLD_DATADIR/test/bios.json
+
+--echo #
+--echo # Testing zipped DOS tables
+--echo #
+CREATE TABLE t1 (
+digit INT(3) NOT NULL,
+letter CHAR(16) NOT NULL)
+ENGINE=CONNECT TABLE_TYPE=DOS FILE_NAME='newdos.zip'
+OPTION_LIST='ENTRY=new1.dos' ZIPPED=1;
+INSERT INTO t1 VALUES(1,'One'),(2,'Two'),(3,'Three'),(4,'Four'),(5,'Five'),(6,'Six'),(7,'Seven'),(8,'Eight'),(9,'Nine'),(10,'Ten');
+SELECT * FROM t1;
+
+CREATE TABLE t2 (
+digit INT(3) NOT NULL,
+letter CHAR(16) NOT NULL)
+ENGINE=CONNECT TABLE_TYPE=DOS FILE_NAME='newdos.zip'
+OPTION_LIST='ENTRY=new2.dos,APPEND=1' ZIPPED=1;
+INSERT INTO t2 VALUES(11,'Eleven'),(12,'Twelve'),(13,'Thirteen'),(14,'Fourteen'),(15,'Fiften'),(16,'Sixteen'),(17,'Seventeen'),(18,'Eighteen'),(19,'Nineteen'),(20,'Twenty');
+SELECT * FROM t2;
+
+CREATE TABLE t3 (
+digit INT(3) NOT NULL,
+letter CHAR(16) NOT NULL)
+ENGINE=CONNECT TABLE_TYPE=DOS FILE_NAME='newdos.zip'
+OPTION_LIST='MULENTRIES=1' ZIPPED=1;
+SELECT * FROM t3;
+
+CREATE TABLE t4 (
+fn VARCHAR(256)NOT NULL,
+cmpsize BIGINT NOT NULL FLAG=1,
+uncsize BIGINT NOT NULL FLAG=2,
+method INT NOT NULL FLAG=3)
+ENGINE=CONNECT TABLE_TYPE=ZIP FILE_NAME='newdos.zip';
+SELECT * FROM t4;
+DROP TABLE t1,t2,t3,t4;
+
+--echo #
+--echo # Testing zipped CSV tables
+--echo #
+CREATE TABLE t1 (
+digit INT(3) NOT NULL,
+letter CHAR(16) NOT NULL)
+ENGINE=CONNECT TABLE_TYPE=CSV FILE_NAME='newcsv.zip'
+OPTION_LIST='ENTRY=new1.csv' HEADER=1 ZIPPED=1;
+INSERT INTO t1 VALUES(1,'One'),(2,'Two'),(3,'Three'),(4,'Four'),(5,'Five'),(6,'Six'),(7,'Seven'),(8,'Eight'),(9,'Nine'),(10,'Ten');
+SELECT * FROM t1;
+
+# Test discovery
+CREATE TABLE td1
+ENGINE=CONNECT TABLE_TYPE=CSV FILE_NAME='newcsv.zip'
+OPTION_LIST='ENTRY=new1.csv' HEADER=1 ZIPPED=1;
+SELECT * FROM td1;
+DROP TABLE td1;
+
+CREATE TABLE t2 (
+digit INT(3) NOT NULL,
+letter CHAR(16) NOT NULL)
+ENGINE=CONNECT TABLE_TYPE=CSV FILE_NAME='newcsv.zip'
+OPTION_LIST='ENTRY=new2.csv,APPEND=1' HEADER=1 ZIPPED=1;
+INSERT INTO t2 VALUES(11,'Eleven'),(12,'Twelve'),(13,'Thirteen'),(14,'Fourteen'),(15,'Fiften'),(16,'Sixteen'),(17,'Seventeen'),(18,'Eighteen'),(19,'Nineteen'),(20,'Twenty');
+SELECT * FROM t2;
+
+CREATE TABLE t3
+ENGINE=CONNECT TABLE_TYPE=CSV FILE_NAME='newcsv.zip'
+OPTION_LIST='MULENTRIES=1' HEADER=1 ZIPPED=1;
+SELECT * FROM t3;
+
+CREATE TABLE t4 (
+fn VARCHAR(256)NOT NULL,
+cmpsize BIGINT NOT NULL FLAG=1,
+uncsize BIGINT NOT NULL FLAG=2,
+method INT NOT NULL FLAG=3)
+ENGINE=CONNECT TABLE_TYPE=ZIP FILE_NAME='newcsv.zip';
+SELECT * FROM t4;
+DROP TABLE t1,t2,t3,t4;
+
+--echo #
+--echo # Testing zipped JSON tables
+--echo #
+CREATE TABLE t1 (
+_id INT(2) NOT NULL,
+name_first CHAR(9) NOT NULL FIELD_FORMAT='name:first',
+name_aka CHAR(4) DEFAULT NULL FIELD_FORMAT='name:aka',
+name_last CHAR(10) NOT NULL FIELD_FORMAT='name:last',
+title CHAR(12) DEFAULT NULL,
+birth CHAR(20) DEFAULT NULL,
+death CHAR(20) DEFAULT NULL,
+contribs CHAR(7) NOT NULL FIELD_FORMAT='contribs:',
+awards_award CHAR(42) DEFAULT NULL FIELD_FORMAT='awards::award',
+awards_year CHAR(4) DEFAULT NULL FIELD_FORMAT='awards::year',
+awards_by CHAR(38) DEFAULT NULL FIELD_FORMAT='awards::by'
+) ENGINE=CONNECT TABLE_TYPE=JSON FILE_NAME='bios.zip' OPTION_LIST='ENTRY=bios.json,LOAD=bios.json' ZIPPED=YES;
+SELECT * FROM t1;
+
+# Test discovery
+CREATE TABLE t2
+ENGINE=CONNECT TABLE_TYPE=JSON FILE_NAME='bios.zip' ZIPPED=1
+OPTION_LIST='LEVEL=5';
+SELECT * FROM t2;
+
+CREATE TABLE t3 (
+_id INT(2) NOT NULL,
+firstname CHAR(9) NOT NULL FIELD_FORMAT='name:first',
+aka CHAR(4) DEFAULT NULL FIELD_FORMAT='name:aka',
+lastname CHAR(10) NOT NULL FIELD_FORMAT='name:last',
+title CHAR(12) DEFAULT NULL,
+birth date DEFAULT NULL date_format="YYYY-DD-MM'T'hh:mm:ss'Z'",
+death date DEFAULT NULL date_format="YYYY-DD-MM'T'hh:mm:ss'Z'",
+contribs CHAR(64) NOT NULL FIELD_FORMAT='contribs:[", "]',
+award CHAR(42) DEFAULT NULL FIELD_FORMAT='awards:[x]:award',
+year CHAR(4) DEFAULT NULL FIELD_FORMAT='awards:[x]:year',
+`by` CHAR(38) DEFAULT NULL FIELD_FORMAT='awards:[x]:by'
+) ENGINE=CONNECT TABLE_TYPE='json' FILE_NAME='bios.zip' ZIPPED=YES;
+SELECT * FROM t3 WHERE _id = 1;
+
+CREATE TABLE t4 (
+fn VARCHAR(256)NOT NULL,
+cmpsize BIGINT NOT NULL FLAG=1,
+uncsize BIGINT NOT NULL FLAG=2,
+method INT NOT NULL FLAG=3)
+ENGINE=CONNECT TABLE_TYPE=ZIP FILE_NAME='bios.zip';
+SELECT * FROM t4;
+DROP TABLE t1,t2,t3,t4;
+
+#
+# Clean up
+#
+--remove_file $MYSQLD_DATADIR/test/newdos.zip
+--remove_file $MYSQLD_DATADIR/test/newcsv.zip
+--remove_file $MYSQLD_DATADIR/test/bios.zip
+--remove_file $MYSQLD_DATADIR/test/bios.json
+
diff --git a/storage/connect/odbconn.cpp b/storage/connect/odbconn.cpp
index 7320f4cc1d9..433e392eace 100644
--- a/storage/connect/odbconn.cpp
+++ b/storage/connect/odbconn.cpp
@@ -35,8 +35,8 @@
#include "global.h"
#include "plgdbsem.h"
#include "xobject.h"
-//#include "kindex.h"
#include "xtable.h"
+#include "tabext.h"
#include "odbccat.h"
#include "tabodbc.h"
#include "plgcnx.h" // For DB types
@@ -413,12 +413,20 @@ PQRYRES ODBCColumns(PGLOBAL g, char *dsn, char *db, char *table,
/**************************************************************************/
PQRYRES ODBCSrcCols(PGLOBAL g, char *dsn, char *src, POPARM sop)
{
+ char *sqry;
ODBConn *ocp = new(g) ODBConn(g, NULL);
if (ocp->Open(dsn, sop, 10) < 1) // openReadOnly + noOdbcDialog
return NULL;
- return ocp->GetMetaData(g, dsn, src);
+ if (strstr(src, "%s")) {
+ // Place holder for an eventual where clause
+ sqry = (char*)PlugSubAlloc(g, NULL, strlen(src) + 3);
+ sprintf(sqry, src, "1=1", "1=1"); // dummy where clause
+ } else
+ sqry = src;
+
+ return ocp->GetMetaData(g, dsn, sqry);
} // end of ODBCSrcCols
#if 0
@@ -1417,7 +1425,7 @@ int ODBConn::ExecDirectSQL(char *sql, ODBCCOL *tocols)
b = true;
if (trace)
- htrc("ExecDirect hstmt=%p %.64s\n", hstmt, sql);
+ htrc("ExecDirect hstmt=%p %.256s\n", hstmt, sql);
if (m_Tdb->Srcdef) {
// Be sure this is a query returning a result set
diff --git a/storage/connect/plgdbsem.h b/storage/connect/plgdbsem.h
index cb408494319..800b1098d50 100644
--- a/storage/connect/plgdbsem.h
+++ b/storage/connect/plgdbsem.h
@@ -1,7 +1,7 @@
/************** PlgDBSem H Declares Source Code File (.H) **************/
/* Name: PLGDBSEM.H Version 3.7 */
/* */
-/* (C) Copyright to the author Olivier BERTRAND 1998-2016 */
+/* (C) Copyright to the author Olivier BERTRAND 1998-2017 */
/* */
/* This file contains the CONNECT storage engine definitions. */
/***********************************************************************/
@@ -57,7 +57,7 @@ enum TABTYPE {TAB_UNDEF = 0, /* Table of undefined type */
TAB_FIX = 2, /* Fixed column offset, fixed LRECL */
TAB_BIN = 3, /* Like FIX but can have binary fields */
TAB_CSV = 4, /* DOS files with CSV records */
- TAB_FMT = 5, /* DOS files with formatted recordss */
+ TAB_FMT = 5, /* DOS files with formatted records */
TAB_DBF = 6, /* DBF Dbase or Foxpro files */
TAB_XML = 7, /* XML or HTML files */
TAB_INI = 8, /* INI or CFG files */
@@ -212,11 +212,24 @@ enum OPVAL {OP_EQ = 1, /* Filtering operator = */
OP_SUB = 17, /* Expression Substract operator */
OP_MULT = 18, /* Expression Multiply operator */
OP_DIV = 19, /* Expression Divide operator */
- OP_NOP = 21, /* Scalar function is nopped */
OP_NUM = 22, /* Scalar function Op Num */
- OP_ABS = 23, /* Scalar function Op Abs */
OP_MAX = 24, /* Scalar function Op Max */
OP_MIN = 25, /* Scalar function Op Min */
+ OP_EXP = 36, /* Scalar function Op Exp */
+ OP_FDISK = 94, /* Operator Disk of fileid */
+ OP_FPATH = 95, /* Operator Path of fileid */
+ OP_FNAME = 96, /* Operator Name of fileid */
+ OP_FTYPE = 97, /* Operator Type of fileid */
+ OP_LAST = 82, /* Index operator Find Last */
+ OP_FIRST = 106, /* Index operator Find First */
+ OP_NEXT = 107, /* Index operator Find Next */
+ OP_SAME = 108, /* Index operator Find Next Same */
+ OP_FSTDIF = 109, /* Index operator Find First dif */
+ OP_NXTDIF = 110, /* Index operator Find Next dif */
+ OP_PREV = 116}; /* Index operator Find Previous */
+#if 0
+ OP_NOP = 21, /* Scalar function is nopped */
+ OP_ABS = 23, /* Scalar function Op Abs */
OP_CEIL = 26, /* Scalar function Op Ceil */
OP_FLOOR = 27, /* Scalar function Op Floor */
OP_MOD = 28, /* Scalar function Op Mod */
@@ -312,6 +325,7 @@ enum OPVAL {OP_EQ = 1, /* Filtering operator = */
OP_REMOVE = 201, /* Scalar function Op Remove */
OP_RENAME = 202, /* Scalar function Op Rename */
OP_FCOMP = 203}; /* Scalar function Op Compare */
+#endif // 0
enum TUSE {USE_NO = 0, /* Table is not yet linearized */
USE_LIN = 1, /* Table is linearized */
@@ -356,6 +370,7 @@ typedef class XOBJECT *PXOB;
typedef class COLBLK *PCOL;
typedef class TDB *PTDB;
typedef class TDBASE *PTDBASE;
+typedef class TDBEXT *PTDBEXT;
typedef class TDBDOS *PTDBDOS;
typedef class TDBFIX *PTDBFIX;
typedef class TDBFMT *PTDBFMT;
@@ -374,6 +389,7 @@ typedef class KXYCOL *PXCOL;
typedef class CATALOG *PCATLG;
typedef class RELDEF *PRELDEF;
typedef class TABDEF *PTABDEF;
+typedef class EXTDEF *PEXTBDEF;
typedef class DOSDEF *PDOSDEF;
typedef class CSVDEF *PCSVDEF;
typedef class VCTDEF *PVCTDEF;
@@ -619,4 +635,4 @@ int global_open(GLOBAL *g, int msgid, const char *filename, int flags, int mode)
DllExport LPCSTR PlugSetPath(LPSTR to, LPCSTR name, LPCSTR dir);
char *MakeEscape(PGLOBAL g, char* str, char q);
-DllExport bool PushWarning(PGLOBAL, PTDBASE, int level = 1);
+DllExport bool PushWarning(PGLOBAL, PTDB, int level = 1);
diff --git a/storage/connect/plgdbutl.cpp b/storage/connect/plgdbutl.cpp
index 83975c6d8fa..1910cdcdec8 100644
--- a/storage/connect/plgdbutl.cpp
+++ b/storage/connect/plgdbutl.cpp
@@ -1,11 +1,11 @@
/********** PlgDBUtl Fpe C++ Program Source Code File (.CPP) ***********/
/* PROGRAM NAME: PLGDBUTL */
/* ------------- */
-/* Version 3.9 */
+/* Version 4.0 */
/* */
/* COPYRIGHT: */
/* ---------- */
-/* (C) Copyright to the author Olivier BERTRAND 1998-2016 */
+/* (C) Copyright to the author Olivier BERTRAND 1998-2017 */
/* */
/* WHAT THIS PROGRAM DOES: */
/* ----------------------- */
@@ -939,7 +939,11 @@ int PlugCloseFile(PGLOBAL g __attribute__((unused)), PFBLOCK fp, bool all)
#endif // LIBXML2_SUPPORT
#ifdef ZIP_SUPPORT
case TYPE_FB_ZIP:
- ((ZIPUTIL*)fp->File)->close();
+ if (fp->Mode == MODE_INSERT)
+ ((ZIPUTIL*)fp->File)->close();
+ else
+ ((UNZIPUTL*)fp->File)->close();
+
fp->Memory = NULL;
fp->Mode = MODE_ANY;
fp->Count = 0;
@@ -1119,7 +1123,7 @@ char *GetAmName(PGLOBAL g, AMT am, void *memp)
return amn;
} // end of GetAmName
-#if defined(__WIN__) && !defined(NOCATCH)
+#if defined(SE_CATCH)
/***********************************************************************/
/* GetExceptionDesc: return the description of an exception code. */
/***********************************************************************/
@@ -1207,7 +1211,7 @@ char *GetExceptionDesc(PGLOBAL g, unsigned int e)
return p;
} // end of GetExceptionDesc
-#endif // __WIN__ && !NOCATCH
+#endif // SE_CATCH
/***********************************************************************/
/* PlgDBalloc: allocates or suballocates memory conditionally. */
diff --git a/storage/connect/plgxml.cpp b/storage/connect/plgxml.cpp
index 71b72621b06..eb31e24235b 100644
--- a/storage/connect/plgxml.cpp
+++ b/storage/connect/plgxml.cpp
@@ -1,6 +1,6 @@
/******************************************************************/
/* Implementation of XML document processing using PdbXML. */
-/* Author: Olivier Bertrand 2007-2012 */
+/* Author: Olivier Bertrand 2007-2017 */
/******************************************************************/
#include "my_global.h"
#include "global.h"
@@ -49,7 +49,7 @@ bool XMLDOCUMENT::InitZip(PGLOBAL g, char *entry)
{
#if defined(ZIP_SUPPORT)
bool mul = (entry) ? strchr(entry, '*') || strchr(entry, '?') : false;
- zip = new(g) ZIPUTIL(entry, mul);
+ zip = new(g) UNZIPUTL(entry, mul);
return zip == NULL;
#else // !ZIP_SUPPORT
sprintf(g->Message, MSG(NO_FEAT_SUPPORT), "ZIP");
diff --git a/storage/connect/plgxml.h b/storage/connect/plgxml.h
index db7dfa6bda5..6870764c503 100644
--- a/storage/connect/plgxml.h
+++ b/storage/connect/plgxml.h
@@ -101,7 +101,7 @@ class XMLDOCUMENT : public BLOCK {
// Members
#if defined(ZIP_SUPPORT)
- ZIPUTIL *zip; /* Used for zipped file */
+ UNZIPUTL *zip; /* Used for zipped file */
#else // !ZIP_SUPPORT
bool zip; /* Always false */
#endif // !ZIP_SUPPORT
diff --git a/storage/connect/plugutil.c b/storage/connect/plugutil.c
index 2551b603349..bfac8a5fd99 100644
--- a/storage/connect/plugutil.c
+++ b/storage/connect/plugutil.c
@@ -244,6 +244,9 @@ LPCSTR PlugSetPath(LPSTR pBuff, LPCSTR prefix, LPCSTR FileName, LPCSTR defpath)
char *drive = NULL, *defdrv = NULL;
#endif
+ if (trace > 1)
+ htrc("prefix=%s fn=%s path=%s\n", prefix, FileName, defpath);
+
if (!strncmp(FileName, "//", 2) || !strncmp(FileName, "\\\\", 2)) {
strcpy(pBuff, FileName); // Remote file
return pBuff;
diff --git a/storage/connect/reldef.cpp b/storage/connect/reldef.cpp
index ef91414a9ab..c6878737f1d 100644
--- a/storage/connect/reldef.cpp
+++ b/storage/connect/reldef.cpp
@@ -621,8 +621,8 @@ bool OEMDEF::DefineAM(PGLOBAL g, LPCSTR, int)
/***********************************************************************/
PTDB OEMDEF::GetTable(PGLOBAL g, MODE mode)
{
- RECFM rfm;
- PTDBASE tdbp = NULL;
+ RECFM rfm;
+ PTDB tdbp = NULL;
// If define block not here yet, get it now
if (!Pxdef && !(Pxdef = GetXdef(g)))
@@ -632,7 +632,7 @@ PTDB OEMDEF::GetTable(PGLOBAL g, MODE mode)
/* Allocate a TDB of the proper type. */
/* Column blocks will be allocated only when needed. */
/*********************************************************************/
- if (!(tdbp = (PTDBASE)Pxdef->GetTable(g, mode)))
+ if (!(tdbp = Pxdef->GetTable(g, mode)))
return NULL;
else
rfm = tdbp->GetFtype();
diff --git a/storage/connect/reldef.h b/storage/connect/reldef.h
index bc1bd2ddd74..52a131dbf3d 100644
--- a/storage/connect/reldef.h
+++ b/storage/connect/reldef.h
@@ -64,15 +64,16 @@ class DllExport RELDEF : public BLOCK { // Relation definition block
}; // end of RELDEF
/***********************************************************************/
-/* These classes correspond to the data base description contained in */
-/* a .XDB file the A.M. DOS, FIX, CSV, MAP, BIN, VCT, PLG, ODBC, DOM. */
+/* This class corresponds to the data base description for tables */
+/* of type DOS, FIX, CSV, DBF, BIN, VCT, JSON, XML... */
/***********************************************************************/
class DllExport TABDEF : public RELDEF { /* Logical table descriptor */
friend class CATALOG;
friend class PLUGCAT;
friend class MYCAT;
- friend class TDBASE;
- public:
+ friend class TDB;
+ friend class TDBEXT;
+public:
// Constructor
TABDEF(void); // Constructor
@@ -112,11 +113,11 @@ class DllExport TABDEF : public RELDEF { /* Logical table descriptor */
int Sort; /* Table already sorted ??? */
int Multiple; /* 0: No 1: DIR 2: Section 3: filelist */
int Degree; /* Number of columns in the table */
- int Pseudo; /* Bit: 1 ROWID Ok, 2 FILEID Ok */
+ int Pseudo; /* Bit: 1 ROWID }Ok, 2 FILEID Ok */
bool Read_Only; /* true for read only tables */
const CHARSET_INFO *m_data_charset;
const char *csname; /* Table charset name */
- }; // end of TABDEF
+}; // end of TABDEF
/***********************************************************************/
/* Externally defined OEM tables. */
@@ -190,11 +191,12 @@ class DllExport COLCRT : public BLOCK { /* Column description block
/***********************************************************************/
/* Column definition block. */
/***********************************************************************/
-class DllExport COLDEF : public COLCRT { /* Column description block */
+class DllExport COLDEF : public COLCRT { /* Column description block */
friend class TABDEF;
friend class COLBLK;
friend class DBFFAM;
- friend class TDBASE;
+ friend class TDB;
+ friend class TDBASE;
friend class TDBDOS;
public:
COLDEF(void); // Constructor
diff --git a/storage/connect/tabdos.cpp b/storage/connect/tabdos.cpp
index 16cc6c33b44..d2bb3d7a4af 100644
--- a/storage/connect/tabdos.cpp
+++ b/storage/connect/tabdos.cpp
@@ -102,6 +102,7 @@ DOSDEF::DOSDEF(void)
Mapped = false;
Zipped = false;
Mulentries = false;
+ Append = false;
Padded = false;
Huge = false;
Accept = false;
@@ -132,10 +133,13 @@ bool DOSDEF::DefineAM(PGLOBAL g, LPCSTR am, int)
: (am && (*am == 'B' || *am == 'b')) ? "B"
: (am && !stricmp(am, "DBF")) ? "D" : "V";
- if ((Zipped = GetBoolCatInfo("Zipped", false)))
- Mulentries = ((Entry = GetStringCatInfo(g, "Entry", NULL)))
- ? strchr(Entry, '*') || strchr(Entry, '?')
- : GetBoolCatInfo("Mulentries", false);
+ if ((Zipped = GetBoolCatInfo("Zipped", false))) {
+ Entry = GetStringCatInfo(g, "Entry", NULL);
+ Mulentries = (Entry && *Entry) ? strchr(Entry, '*') || strchr(Entry, '?')
+ : false;
+ Mulentries = GetBoolCatInfo("Mulentries", Mulentries);
+ Append = GetBoolCatInfo("Append", false);
+ }
Desc = Fn = GetStringCatInfo(g, "Filename", NULL);
Ofn = GetStringCatInfo(g, "Optname", Fn);
@@ -347,10 +351,26 @@ PTDB DOSDEF::GetTable(PGLOBAL g, MODE mode)
if (Zipped) {
#if defined(ZIP_SUPPORT)
if (Recfm == RECFM_VAR) {
- txfp = new(g)ZIPFAM(this);
- tdbp = new(g)TDBDOS(this, txfp);
+ if (mode == MODE_READ || mode == MODE_ANY) {
+ txfp = new(g) UNZFAM(this);
+ } else if (mode == MODE_INSERT) {
+ txfp = new(g) ZIPFAM(this);
+ } else {
+ strcpy(g->Message, "UPDATE/DELETE not supported for ZIP");
+ return NULL;
+ } // endif's mode
+
+ tdbp = new(g) TDBDOS(this, txfp);
} else {
- txfp = new(g)ZPXFAM(this);
+ if (mode == MODE_READ || mode == MODE_ANY) {
+ txfp = new(g) UZXFAM(this);
+ } else if (mode == MODE_INSERT) {
+ txfp = new(g) ZPXFAM(this);
+ } else {
+ strcpy(g->Message, "UPDATE/DELETE not supported for ZIP");
+ return NULL;
+ } // endif's mode
+
tdbp = new(g)TDBFIX(this, txfp);
} // endif Recfm
@@ -376,7 +396,7 @@ PTDB DOSDEF::GetTable(PGLOBAL g, MODE mode)
txfp = new(g) MPXFAM(this);
else if (Compressed) {
#if defined(GZ_SUPPORT)
- txfp = new(g) ZIXFAM(this);
+ txfp = new(g) GZXFAM(this);
#else // !GZ_SUPPORT
sprintf(g->Message, MSG(NO_FEAT_SUPPORT), "GZ");
return NULL;
@@ -484,7 +504,7 @@ TDBDOS::TDBDOS(PGLOBAL g, PTDBDOS tdbp) : TDBASE(tdbp)
} // end of TDBDOS copy constructor
// Method
-PTDB TDBDOS::CopyOne(PTABS t)
+PTDB TDBDOS::Clone(PTABS t)
{
PTDB tp;
PDOSCOL cp1, cp2;
@@ -498,7 +518,7 @@ PTDB TDBDOS::CopyOne(PTABS t)
} // endfor cp1
return tp;
- } // end of CopyOne
+ } // end of Clone
/***********************************************************************/
/* Allocate DOS column description block. */
diff --git a/storage/connect/tabdos.h b/storage/connect/tabdos.h
index 4c8eb438a26..922d52ee399 100644
--- a/storage/connect/tabdos.h
+++ b/storage/connect/tabdos.h
@@ -28,7 +28,7 @@ class DllExport DOSDEF : public TABDEF { /* Logical table description */
friend class TDBFIX;
friend class TXTFAM;
friend class DBFBASE;
- friend class ZIPUTIL;
+ friend class UNZIPUTL;
public:
// Constructor
DOSDEF(void);
@@ -43,7 +43,8 @@ class DllExport DOSDEF : public TABDEF { /* Logical table description */
PSZ GetOfn(void) {return Ofn;}
PSZ GetEntry(void) {return Entry;}
bool GetMul(void) {return Mulentries;}
- void SetBlock(int block) {Block = block;}
+ bool GetAppend(void) {return Append;}
+ void SetBlock(int block) { Block = block; }
int GetBlock(void) {return Block;}
int GetLast(void) {return Last;}
void SetLast(int last) {Last = last;}
@@ -81,6 +82,7 @@ class DllExport DOSDEF : public TABDEF { /* Logical table description */
bool Mapped; /* 0: disk file, 1: memory mapped file */
bool Zipped; /* true for zipped table file */
bool Mulentries; /* true for multiple entries */
+ bool Append; /* Used when creating zipped table */
bool Padded; /* true for padded table file */
bool Huge; /* true for files larger than 2GB */
bool Accept; /* true if wrong lines are accepted */
@@ -140,7 +142,7 @@ class DllExport TDBDOS : public TDBASE {
{return (PTDB)new(g) TDBDOS(g, this);}
// Methods
- virtual PTDB CopyOne(PTABS t);
+ virtual PTDB Clone(PTABS t);
virtual void ResetDB(void) {Txfp->Reset();}
virtual bool IsUsingTemp(PGLOBAL g);
virtual bool IsIndexed(void) {return Indxd;}
diff --git a/storage/connect/tabext.cpp b/storage/connect/tabext.cpp
new file mode 100644
index 00000000000..e3518126a49
--- /dev/null
+++ b/storage/connect/tabext.cpp
@@ -0,0 +1,640 @@
+/************* Tabext C++ Functions Source Code File (.CPP) ************/
+/* Name: TABEXT.CPP Version 1.0 */
+/* */
+/* (C) Copyright to the author Olivier BERTRAND 2017 */
+/* */
+/* This file contains the TBX, TDB and OPJOIN classes functions. */
+/***********************************************************************/
+
+/***********************************************************************/
+/* Include relevant MariaDB header file. */
+/***********************************************************************/
+#define MYSQL_SERVER 1
+#include "my_global.h"
+#include "sql_class.h"
+#include "sql_servers.h"
+#include "sql_string.h"
+#if !defined(__WIN__)
+#include "osutil.h"
+#endif
+
+/***********************************************************************/
+/* Include required application header files */
+/* global.h is header containing all global Plug declarations. */
+/* plgdbsem.h is header containing the DB applic. declarations. */
+/* xobject.h is header containing XOBJECT derived classes declares. */
+/***********************************************************************/
+#include "global.h"
+#include "plgdbsem.h"
+#include "xtable.h"
+#include "tabext.h"
+#include "ha_connect.h"
+
+/* -------------------------- Class CONDFIL -------------------------- */
+
+/***********************************************************************/
+/* CONDFIL Constructor. */
+/***********************************************************************/
+CONDFIL::CONDFIL(const Item *cond, uint idx, AMT type)
+{
+ Cond = cond;
+ Idx = idx;
+ Type = type;
+ Op = OP_XX;
+ Cmds = NULL;
+ Alist = NULL;
+ All = true;
+ Bd = false;
+ Hv = false;
+ Body = NULL,
+ Having = NULL;
+} // end of CONDFIL constructor
+
+/***********************************************************************/
+/* Make and allocate the alias list. */
+/***********************************************************************/
+int CONDFIL::Init(PGLOBAL g, PHC hc)
+{
+ PTOS options = hc->GetTableOptionStruct();
+ char *p, *cn, *cal, *alt = NULL;
+ int rc = RC_OK;
+ bool h;
+
+ if (options)
+ alt = GetListOption(g, "Alias", options->oplist, NULL);
+
+ while (alt) {
+ if (!(p = strchr(alt, '='))) {
+ strcpy(g->Message, "Invalid alias list");
+ rc = RC_FX;
+ break;
+ } // endif !p
+
+ cal = alt; // Alias
+ *p++ = 0;
+
+ if ((h = *p == '*')) {
+ rc = RC_INFO;
+ p++;
+ } // endif h
+
+ cn = p; // Remote column name
+
+ if ((alt = strchr(p, ';')))
+ *alt++ = 0;
+
+ if (*cn == 0)
+ cn = alt;
+
+ Alist = new(g) ALIAS(Alist, cn, cal, h);
+ } // endwhile alt
+
+ return rc;
+} // end of Init
+
+/***********************************************************************/
+/* Make and allocate the alias list. */
+/***********************************************************************/
+const char *CONDFIL::Chk(const char *fln, bool *h)
+{
+ for (PAL pal = Alist; pal; pal = pal->Next)
+ if (!stricmp(fln, pal->Alias)) {
+ *h = pal->Having;
+ return pal->Name;
+ } // endif fln
+
+ *h = false;
+ return fln;
+} // end of Chk
+
+/* --------------------------- Class EXTDEF -------------------------- */
+
+/***********************************************************************/
+/* EXTDEF Constructor. */
+/***********************************************************************/
+EXTDEF::EXTDEF(void)
+{
+ Tabname = Tabschema = Username = Password = Tabcat = Tabtyp = NULL;
+ Colpat = Srcdef = Qchar = Qrystr = Sep = Phpos = NULL;
+ Options = Cto = Qto = Quoted = Maxerr = Maxres = Memory = 0;
+ Scrollable = Xsrc = false;
+} // end of EXTDEF constructor
+
+/***********************************************************************/
+/* DefineAM: define specific AM block values from XDB file. */
+/***********************************************************************/
+bool EXTDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
+{
+ Desc = NULL;
+ Tabname = GetStringCatInfo(g, "Name",
+ (Catfunc & (FNC_TABLE | FNC_COL)) ? NULL : Name);
+ Tabname = GetStringCatInfo(g, "Tabname", Tabname);
+ Tabschema = GetStringCatInfo(g, "Dbname", NULL);
+ Tabschema = GetStringCatInfo(g, "Schema", Tabschema);
+ Tabcat = GetStringCatInfo(g, "Qualifier", NULL);
+ Tabcat = GetStringCatInfo(g, "Catalog", Tabcat);
+ Username = GetStringCatInfo(g, "User", NULL);
+ Password = GetStringCatInfo(g, "Password", NULL);
+
+ if ((Srcdef = GetStringCatInfo(g, "Srcdef", NULL)))
+ Read_Only = true;
+
+ Qrystr = GetStringCatInfo(g, "Query_String", "?");
+ Sep = GetStringCatInfo(g, "Separator", NULL);
+//Alias = GetStringCatInfo(g, "Alias", NULL);
+ Phpos = GetStringCatInfo(g, "Phpos", NULL);
+ Xsrc = GetBoolCatInfo("Execsrc", FALSE);
+ Maxerr = GetIntCatInfo("Maxerr", 0);
+ Maxres = GetIntCatInfo("Maxres", 0);
+ Quoted = GetIntCatInfo("Quoted", 0);
+ Options = 0;
+ Cto = 0;
+ Qto = 0;
+
+ if ((Scrollable = GetBoolCatInfo("Scrollable", false)) && !Elemt)
+ Elemt = 1; // Cannot merge SQLFetch and SQLExtendedFetch
+
+ if (Catfunc == FNC_COL)
+ Colpat = GetStringCatInfo(g, "Colpat", NULL);
+
+ if (Catfunc == FNC_TABLE)
+ Tabtyp = GetStringCatInfo(g, "Tabtype", NULL);
+
+ // Memory was Boolean, it is now integer
+ if (!(Memory = GetIntCatInfo("Memory", 0)))
+ Memory = GetBoolCatInfo("Memory", false) ? 1 : 0;
+
+ Pseudo = 2; // FILID is Ok but not ROWID
+ return false;
+} // end of DefineAM
+
+/* ---------------------------TDBEXT class --------------------------- */
+
+/***********************************************************************/
+/* Implementation of the TDBEXT class. */
+/***********************************************************************/
+TDBEXT::TDBEXT(EXTDEF *tdp) : TDB(tdp)
+{
+ Qrp = NULL;
+
+ if (tdp) {
+ TableName = tdp->Tabname;
+ Schema = tdp->Tabschema;
+ User = tdp->Username;
+ Pwd = tdp->Password;
+ Catalog = tdp->Tabcat;
+ Srcdef = tdp->Srcdef;
+ Qrystr = tdp->Qrystr;
+ Sep = tdp->GetSep();
+ Options = tdp->Options;
+ Cto = tdp->Cto;
+ Qto = tdp->Qto;
+ Quoted = MY_MAX(0, tdp->GetQuoted());
+ Rows = tdp->GetElemt();
+ Memory = tdp->Memory;
+ Scrollable = tdp->Scrollable;
+ } else {
+ TableName = NULL;
+ Schema = NULL;
+ User = NULL;
+ Pwd = NULL;
+ Catalog = NULL;
+ Srcdef = NULL;
+ Qrystr = NULL;
+ Sep = 0;
+ Options = 0;
+ Cto = 0;
+ Qto = 0;
+ Quoted = 0;
+ Rows = 0;
+ Memory = 0;
+ Scrollable = false;
+ } // endif tdp
+
+ Quote = NULL;
+ Query = NULL;
+ Count = NULL;
+ //Where = NULL;
+ MulConn = NULL;
+ DBQ = NULL;
+ Qrp = NULL;
+ Fpos = 0;
+ Curpos = 0;
+ AftRows = 0;
+ CurNum = 0;
+ Rbuf = 0;
+ BufSize = 0;
+ Nparm = 0;
+ Ncol = 0;
+ Placed = false;
+} // end of TDBEXT constructor
+
+TDBEXT::TDBEXT(PTDBEXT tdbp) : TDB(tdbp)
+{
+ Qrp = tdbp->Qrp;
+ TableName = tdbp->TableName;
+ Schema = tdbp->Schema;
+ User = tdbp->User;
+ Pwd = tdbp->Pwd;
+ Catalog = tdbp->Catalog;
+ Srcdef = tdbp->Srcdef;
+ Qrystr = tdbp->Qrystr;
+ Sep = tdbp->Sep;
+ Options = tdbp->Options;
+ Cto = tdbp->Cto;
+ Qto = tdbp->Qto;
+ Quoted = tdbp->Quoted;
+ Rows = tdbp->Rows;
+ Memory = tdbp->Memory;
+ Scrollable = tdbp->Scrollable;
+ Quote = tdbp->Quote;
+ Query = tdbp->Query;
+ Count = tdbp->Count;
+ //Where = tdbp->Where;
+ MulConn = tdbp->MulConn;
+ DBQ = tdbp->DBQ;
+ Fpos = 0;
+ Curpos = 0;
+ AftRows = 0;
+ CurNum = 0;
+ Rbuf = 0;
+ BufSize = tdbp->BufSize;
+ Nparm = tdbp->Nparm;
+ Ncol = tdbp->Ncol;
+ Placed = false;
+} // end of TDBEXT copy constructor
+
+/******************************************************************/
+/* Convert an UTF-8 string to latin characters. */
+/******************************************************************/
+int TDBEXT::Decode(char *txt, char *buf, size_t n)
+{
+ uint dummy_errors;
+ uint32 len = copy_and_convert(buf, n, &my_charset_latin1,
+ txt, strlen(txt),
+ &my_charset_utf8_general_ci,
+ &dummy_errors);
+ buf[len] = '\0';
+ return 0;
+} // end of Decode
+
+/***********************************************************************/
+/* MakeSQL: make the SQL statement use with remote connection. */
+/* TODO: when implementing remote filtering, column only used in */
+/* local filter should be removed from column list. */
+/***********************************************************************/
+bool TDBEXT::MakeSQL(PGLOBAL g, bool cnt)
+{
+ char *schmp = NULL, *catp = NULL, buf[NAM_LEN * 3];
+ int len;
+ bool oom = false, first = true;
+ PTABLE tablep = To_Table;
+ PCOL colp;
+
+ if (Srcdef) {
+ if ((catp = strstr(Srcdef, "%s"))) {
+ char *fil1, *fil2;
+ PSZ ph = ((EXTDEF*)To_Def)->Phpos;
+
+ if (!ph)
+ ph = (strstr(catp + 2, "%s")) ? const_cast<char*>("WH") :
+ const_cast<char*>("W");
+
+ if (stricmp(ph, "H")) {
+ fil1 = (To_CondFil && *To_CondFil->Body)
+ ? To_CondFil->Body : PlugDup(g, "1=1");
+ } // endif ph
+
+ if (stricmp(ph, "W")) {
+ fil2 = (To_CondFil && To_CondFil->Having && *To_CondFil->Having)
+ ? To_CondFil->Having : PlugDup(g, "1=1");
+ } // endif ph
+
+ if (!stricmp(ph, "W")) {
+ Query = new(g)STRING(g, strlen(Srcdef) + strlen(fil1));
+ Query->SetLength(sprintf(Query->GetStr(), Srcdef, fil1));
+ } else if (!stricmp(ph, "WH")) {
+ Query = new(g)STRING(g, strlen(Srcdef) + strlen(fil1) + strlen(fil2));
+ Query->SetLength(sprintf(Query->GetStr(), Srcdef, fil1, fil2));
+ } else if (!stricmp(ph, "H")) {
+ Query = new(g)STRING(g, strlen(Srcdef) + strlen(fil2));
+ Query->SetLength(sprintf(Query->GetStr(), Srcdef, fil2));
+ } else if (!stricmp(ph, "HW")) {
+ Query = new(g)STRING(g, strlen(Srcdef) + strlen(fil1) + strlen(fil2));
+ Query->SetLength(sprintf(Query->GetStr(), Srcdef, fil2, fil1));
+ } else {
+ strcpy(g->Message, "MakeSQL: Wrong place holders specification");
+ return true;
+ } // endif's ph
+
+ } else
+ Query = new(g)STRING(g, 0, Srcdef);
+
+ return false;
+ } // endif Srcdef
+
+ // Allocate the string used to contain the Query
+ Query = new(g)STRING(g, 1023, "SELECT ");
+
+ if (!cnt) {
+ if (Columns) {
+ // Normal SQL statement to retrieve results
+ for (colp = Columns; colp; colp = colp->GetNext())
+ if (!colp->IsSpecial()) {
+ if (!first)
+ oom |= Query->Append(", ");
+ else
+ first = false;
+
+ // Column name can be encoded in UTF-8
+ Decode(colp->GetName(), buf, sizeof(buf));
+
+ if (Quote) {
+ // Put column name between identifier quotes in case in contains blanks
+ oom |= Query->Append(Quote);
+ oom |= Query->Append(buf);
+ oom |= Query->Append(Quote);
+ } else
+ oom |= Query->Append(buf);
+
+ ((PEXTCOL)colp)->SetRank(++Ncol);
+ } // endif colp
+
+ } else
+ // !Columns can occur for queries such that sql count(*) from...
+ // for which we will count the rows from sql * from...
+ oom |= Query->Append('*');
+
+ } else
+ // SQL statement used to retrieve the size of the result
+ oom |= Query->Append("count(*)");
+
+ oom |= Query->Append(" FROM ");
+
+ if (Catalog && *Catalog)
+ catp = Catalog;
+
+ //if (tablep->GetSchema())
+ // schmp = (char*)tablep->GetSchema();
+ //else
+ if (Schema && *Schema)
+ schmp = Schema;
+
+ if (catp) {
+ oom |= Query->Append(catp);
+
+ if (schmp) {
+ oom |= Query->Append('.');
+ oom |= Query->Append(schmp);
+ } // endif schmp
+
+ oom |= Query->Append('.');
+ } else if (schmp) {
+ oom |= Query->Append(schmp);
+ oom |= Query->Append('.');
+ } // endif schmp
+
+ // Table name can be encoded in UTF-8
+ Decode(TableName, buf, sizeof(buf));
+
+ if (Quote) {
+ // Put table name between identifier quotes in case in contains blanks
+ oom |= Query->Append(Quote);
+ oom |= Query->Append(buf);
+ oom |= Query->Append(Quote);
+ } else
+ oom |= Query->Append(buf);
+
+ len = Query->GetLength();
+
+ if (To_CondFil) {
+ if (Mode == MODE_READ) {
+ oom |= Query->Append(" WHERE ");
+ oom |= Query->Append(To_CondFil->Body);
+ len = Query->GetLength() + 1;
+ } else
+ len += (strlen(To_CondFil->Body) + 256);
+
+ } else
+ len += ((Mode == MODE_READX) ? 256 : 1);
+
+ if (oom || Query->Resize(len)) {
+ strcpy(g->Message, "MakeSQL: Out of memory");
+ return true;
+ } // endif oom
+
+ if (trace)
+ htrc("Query=%s\n", Query->GetStr());
+
+ return false;
+} // end of MakeSQL
+
+/***********************************************************************/
+/* MakeCommand: make the Update or Delete statement to send to the */
+/* MySQL server. Limited to remote values and filtering. */
+/***********************************************************************/
+bool TDBEXT::MakeCommand(PGLOBAL g)
+{
+ char *p, *stmt, name[68], *body = NULL;
+ char *qrystr = (char*)PlugSubAlloc(g, NULL, strlen(Qrystr) + 1);
+ bool qtd = Quoted > 0;
+ int i = 0, k = 0;
+
+ // Make a lower case copy of the originale query and change
+ // back ticks to the data source identifier quoting character
+ do {
+ qrystr[i] = (Qrystr[i] == '`') ? *Quote : tolower(Qrystr[i]);
+ } while (Qrystr[i++]);
+
+ if (To_CondFil && (p = strstr(qrystr, " where "))) {
+ p[7] = 0; // Remove where clause
+ Qrystr[(p - qrystr) + 7] = 0;
+ body = To_CondFil->Body;
+ stmt = (char*)PlugSubAlloc(g, NULL, strlen(qrystr)
+ + strlen(body) + 64);
+ } else
+ stmt = (char*)PlugSubAlloc(g, NULL, strlen(Qrystr) + 64);
+
+ // Check whether the table name is equal to a keyword
+ // If so, it must be quoted in the original query
+ strlwr(strcat(strcat(strcpy(name, " "), Name), " "));
+
+ if (strstr(" update delete low_priority ignore quick from ", name)) {
+ strlwr(strcat(strcat(strcpy(name, Quote), Name), Quote));
+ k += 2;
+ } else
+ strlwr(strcpy(name, Name)); // Not a keyword
+
+ if ((p = strstr(qrystr, name))) {
+ for (i = 0; i < p - qrystr; i++)
+ stmt[i] = (Qrystr[i] == '`') ? *Quote : Qrystr[i];
+
+ stmt[i] = 0;
+ k += i + (int)strlen(Name);
+
+ if (qtd && *(p - 1) == ' ')
+ strcat(strcat(strcat(stmt, Quote), TableName), Quote);
+ else
+ strcat(stmt, TableName);
+
+ i = (int)strlen(stmt);
+
+ do {
+ stmt[i++] = (Qrystr[k] == '`') ? *Quote : Qrystr[k];
+ } while (Qrystr[k++]);
+
+ if (body)
+ strcat(stmt, body);
+
+ } else {
+ sprintf(g->Message, "Cannot use this %s command",
+ (Mode == MODE_UPDATE) ? "UPDATE" : "DELETE");
+ return true;
+ } // endif p
+
+ if (trace)
+ htrc("Command=%s\n", stmt);
+
+ Query = new(g)STRING(g, 0, stmt);
+ return (!Query->GetSize());
+} // end of MakeCommand
+
+/***********************************************************************/
+/* GetRecpos: return the position of last read record. */
+/***********************************************************************/
+int TDBEXT::GetRecpos(void)
+{
+ return Fpos;
+} // end of GetRecpos
+
+/***********************************************************************/
+/* ODBC GetMaxSize: returns table size estimate in number of lines. */
+/***********************************************************************/
+int TDBEXT::GetMaxSize(PGLOBAL g)
+{
+ if (MaxSize < 0) {
+ if (Mode == MODE_DELETE)
+ // Return 0 in mode DELETE in case of delete all.
+ MaxSize = 0;
+ else if (!Cardinality(NULL))
+ MaxSize = 10; // To make MySQL happy
+ else if ((MaxSize = Cardinality(g)) < 0)
+ MaxSize = 12; // So we can see an error occurred
+
+ } // endif MaxSize
+
+ return MaxSize;
+} // end of GetMaxSize
+
+/***********************************************************************/
+/* Return max size value. */
+/***********************************************************************/
+int TDBEXT::GetProgMax(PGLOBAL g)
+{
+ return GetMaxSize(g);
+} // end of GetProgMax
+
+/* ---------------------------EXTCOL class --------------------------- */
+
+/***********************************************************************/
+/* EXTCOL public constructor. */
+/***********************************************************************/
+EXTCOL::EXTCOL(PCOLDEF cdp, PTDB tdbp, PCOL cprec, int i, PSZ am)
+ : COLBLK(cdp, tdbp, i)
+{
+ if (cprec) {
+ Next = cprec->GetNext();
+ cprec->SetNext(this);
+ } else {
+ Next = tdbp->GetColumns();
+ tdbp->SetColumns(this);
+ } // endif cprec
+
+ if (trace)
+ htrc(" making new %sCOL C%d %s at %p\n", am, Index, Name, this);
+
+ // Set additional remote access method information for column.
+ Crp = NULL;
+ Long = Precision;
+ To_Val = NULL;
+ Bufp = NULL;
+ Blkp = NULL;
+ Rank = 0; // Not known yet
+} // end of JDBCCOL constructor
+
+/***********************************************************************/
+/* EXTCOL private constructor. */
+/***********************************************************************/
+EXTCOL::EXTCOL(void) : COLBLK()
+{
+ Crp = NULL;
+ Buf_Type = TYPE_INT; // This is a count(*) column
+
+ // Set additional Dos access method information for column.
+ Long = sizeof(int);
+ To_Val = NULL;
+ Bufp = NULL;
+ Blkp = NULL;
+ Rank = 1;
+} // end of EXTCOL constructor
+
+/***********************************************************************/
+/* EXTCOL constructor used for copying columns. */
+/* tdbp is the pointer to the new table descriptor. */
+/***********************************************************************/
+EXTCOL::EXTCOL(PEXTCOL col1, PTDB tdbp) : COLBLK(col1, tdbp)
+{
+ Crp = col1->Crp;
+ Long = col1->Long;
+ To_Val = col1->To_Val;
+ Bufp = col1->Bufp;
+ Blkp = col1->Blkp;
+ Rank = col1->Rank;
+} // end of JDBCCOL copy constructor
+
+/***********************************************************************/
+/* SetBuffer: prepare a column block for write operation. */
+/***********************************************************************/
+bool EXTCOL::SetBuffer(PGLOBAL g, PVAL value, bool ok, bool check)
+{
+ if (!(To_Val = value)) {
+ sprintf(g->Message, MSG(VALUE_ERROR), Name);
+ return true;
+ } else if (Buf_Type == value->GetType()) {
+ // Values are of the (good) column type
+ if (Buf_Type == TYPE_DATE) {
+ // If any of the date values is formatted
+ // output format must be set for the receiving table
+ if (GetDomain() || ((DTVAL *)value)->IsFormatted())
+ goto newval; // This will make a new value;
+
+ } else if (Buf_Type == TYPE_DOUBLE)
+ // Float values must be written with the correct (column) precision
+ // Note: maybe this should be forced by ShowValue instead of this ?
+ value->SetPrec(GetScale());
+
+ Value = value; // Directly access the external value
+ } else {
+ // Values are not of the (good) column type
+ if (check) {
+ sprintf(g->Message, MSG(TYPE_VALUE_ERR), Name,
+ GetTypeName(Buf_Type), GetTypeName(value->GetType()));
+ return true;
+ } // endif check
+
+ newval:
+ if (InitValue(g)) // Allocate the matching value block
+ return true;
+
+ } // endif's Value, Buf_Type
+
+ // Because Colblk's have been made from a copy of the original TDB in
+ // case of Update, we must reset them to point to the original one.
+ if (To_Tdb->GetOrig())
+ To_Tdb = (PTDB)To_Tdb->GetOrig();
+
+ // Set the Column
+ Status = (ok) ? BUF_EMPTY : BUF_NO;
+ return false;
+} // end of SetBuffer
+
diff --git a/storage/connect/tabext.h b/storage/connect/tabext.h
new file mode 100644
index 00000000000..2ef20c89f2c
--- /dev/null
+++ b/storage/connect/tabext.h
@@ -0,0 +1,200 @@
+/*************** Tabext H Declares Source Code File (.H) ***************/
+/* Name: TABEXT.H Version 1.0 */
+/* */
+/* (C) Copyright to the author Olivier BERTRAND 2017 */
+/* */
+/* This is the EXTDEF, TABEXT and EXTCOL classes definitions. */
+/***********************************************************************/
+
+#ifndef __TABEXT_H
+#define __TABEXTF_H
+
+#include "reldef.h"
+
+typedef class ALIAS *PAL;
+
+class ALIAS : public BLOCK {
+ public:
+ ALIAS(PAL x, PSZ n, PSZ a, bool h)
+ {Next = x, Name = n, Alias = a, Having = h;}
+
+ PAL Next;
+ PSZ Name;
+ PSZ Alias;
+ bool Having;
+}; // end of class ALIAS
+
+// Condition filter structure
+class CONDFIL : public BLOCK {
+ public:
+ // Constructor
+ CONDFIL(const Item *cond, uint idx, AMT type);
+
+ // Functions
+ int Init(PGLOBAL g, PHC hc);
+ const char *Chk(const char *cln, bool *h);
+
+ // Members
+ const Item *Cond;
+ AMT Type;
+ uint Idx;
+ OPVAL Op;
+ PCMD Cmds;
+ PAL Alist;
+ bool All;
+ bool Bd;
+ bool Hv;
+ char *Body;
+ char *Having;
+}; // end of class CONDFIL
+
+/***********************************************************************/
+/* This class corresponds to the data base description for external */
+/* tables of type MYSQL, ODBC, JDBC... */
+/***********************************************************************/
+class DllExport EXTDEF : public TABDEF { /* EXT table */
+ friend class TDBEXT;
+public:
+ // Constructor
+ EXTDEF(void); // Constructor
+
+ // Implementation
+ virtual const char *GetType(void) { return "EXT"; }
+ inline PSZ GetTabname(void) { return Tabname; }
+ inline PSZ GetTabschema(void) { return Tabschema; }
+ inline PSZ GetUsername(void) { return Username; };
+ inline PSZ GetPassword(void) { return Password; };
+ inline PSZ GetTabcat(void) { return Tabcat; }
+ inline PSZ GetSrcdef(void) { return Srcdef; }
+ inline char GetSep(void) { return (Sep) ? *Sep : 0; }
+ inline int GetQuoted(void) { return Quoted; }
+ inline int GetOptions(void) { return Options; }
+
+ // Methods
+ virtual int Indexable(void) { return 2; }
+ virtual bool DefineAM(PGLOBAL g, LPCSTR am, int poff);
+
+protected:
+ // Members
+ PSZ Tabname; /* External table name */
+ PSZ Tabschema; /* External table schema */
+ PSZ Username; /* User connect name */
+ PSZ Password; /* Password connect info */
+ PSZ Tabcat; /* External table catalog */
+ PSZ Tabtyp; /* Catalog table type */
+ PSZ Colpat; /* Catalog column pattern */
+ PSZ Srcdef; /* The source table SQL definition */
+ PSZ Qchar; /* Identifier quoting character */
+ PSZ Qrystr; /* The original query */
+ PSZ Sep; /* Decimal separator */
+//PSZ Alias; /* Column alias list */
+ PSZ Phpos; /* Place holer positions */
+ int Options; /* Open connection options */
+ int Cto; /* Open connection timeout */
+ int Qto; /* Query (command) timeout */
+ int Quoted; /* Identifier quoting level */
+ int Maxerr; /* Maxerr for an Exec table */
+ int Maxres; /* Maxres for a catalog table */
+ int Memory; /* Put result set in memory */
+ bool Scrollable; /* Use scrollable cursor */
+ bool Xsrc; /* Execution type */
+}; // end of EXTDEF
+
+/***********************************************************************/
+/* This is the base class for all external tables. */
+/***********************************************************************/
+class DllExport TDBEXT : public TDB {
+public:
+ // Constructors
+ TDBEXT(EXTDEF *tdp);
+ TDBEXT(PTDBEXT tdbp);
+
+ // Implementation
+
+ // Properties
+ virtual bool IsRemote(void) { return true; }
+
+ // Methods
+ virtual PSZ GetServer(void) { return "Remote"; }
+ virtual int GetRecpos(void);
+
+ // Database routines
+ virtual int GetMaxSize(PGLOBAL g);
+ virtual int GetProgMax(PGLOBAL g);
+
+protected:
+ // Internal functions
+ virtual bool MakeSQL(PGLOBAL g, bool cnt);
+ //virtual bool MakeInsert(PGLOBAL g);
+ virtual bool MakeCommand(PGLOBAL g);
+ int Decode(char *utf, char *buf, size_t n);
+
+ // Members
+ PQRYRES Qrp; // Points to storage result
+ PSTRG Query; // Constructed SQL query
+ char *TableName; // Points to ODBC table name
+ char *Schema; // Points to ODBC table Schema
+ char *User; // User connect info
+ char *Pwd; // Password connect info
+ char *Catalog; // Points to ODBC table Catalog
+ char *Srcdef; // The source table SQL definition
+ char *Count; // Points to count(*) SQL statement
+ //char *Where; // Points to local where clause
+ char *Quote; // The identifier quoting character
+ char *MulConn; // Used for multiple ODBC tables
+ char *DBQ; // The address part of Connect string
+ char *Qrystr; // The original query
+ char Sep; // The decimal separator
+ int Options; // Connect options
+ int Cto; // Connect timeout
+ int Qto; // Query timeout
+ int Quoted; // The identifier quoting level
+ int Fpos; // Position of last read record
+ int Curpos; // Cursor position of last fetch
+ int AftRows; // The number of affected rows
+ int Rows; // Rowset size
+ int CurNum; // Current buffer line number
+ int Rbuf; // Number of lines read in buffer
+ int BufSize; // Size of connect string buffer
+ int Nparm; // The number of statement parameters
+ int Memory; // 0: No 1: Alloc 2: Put 3: Get
+ int Ncol; // The column number (JDBC)
+ bool Scrollable; // Use scrollable cursor
+ bool Placed; // True for position reading
+}; // end of class TDBEXT
+
+/***********************************************************************/
+/* Virual class EXTCOL: external column. */
+/***********************************************************************/
+class DllExport EXTCOL : public COLBLK {
+ friend class TDBEXT;
+public:
+ // Constructor
+ EXTCOL(PCOLDEF cdp, PTDB tdbp, PCOL cprec, int i, PSZ am);
+ EXTCOL(PEXTCOL colp, PTDB tdbp); // Constructor used in copy process
+
+ // Implementation
+ inline int GetRank(void) { return Rank; }
+ inline void SetRank(int k) { Rank = k; }
+ //inline PVBLK GetBlkp(void) {return Blkp;}
+ inline void SetCrp(PCOLRES crp) { Crp = crp; }
+
+ // Methods
+ virtual bool SetBuffer(PGLOBAL g, PVAL value, bool ok, bool check);
+ virtual void ReadColumn(PGLOBAL) = 0;
+ virtual void WriteColumn(PGLOBAL) = 0;
+
+protected:
+ // Constructor for count(*) column
+ EXTCOL(void);
+
+ // Members
+ PCOLRES Crp; // To storage result
+ void *Bufp; // To extended buffer
+ PVBLK Blkp; // To Value Block
+ PVAL To_Val; // To value used for Insert
+ int Rank; // Rank (position) number in the query
+ //int Flag; // ???
+}; // end of class EXTCOL
+
+#endif // __TABEXT_H
diff --git a/storage/connect/tabfix.cpp b/storage/connect/tabfix.cpp
index d99f7800f26..bf123cd36c8 100644
--- a/storage/connect/tabfix.cpp
+++ b/storage/connect/tabfix.cpp
@@ -77,7 +77,7 @@ TDBFIX::TDBFIX(PGLOBAL g, PTDBFIX tdbp) : TDBDOS(g, tdbp)
} // end of TDBFIX copy constructor
// Method
-PTDB TDBFIX::CopyOne(PTABS t)
+PTDB TDBFIX::Clone(PTABS t)
{
PTDB tp;
PGLOBAL g = t->G;
@@ -105,7 +105,7 @@ PTDB TDBFIX::CopyOne(PTABS t)
} // endif Ftype
return tp;
- } // end of CopyOne
+ } // end of Clone
/***********************************************************************/
/* Reset read/write position values. */
diff --git a/storage/connect/tabfix.h b/storage/connect/tabfix.h
index 49956ba0711..4b9f9689992 100644
--- a/storage/connect/tabfix.h
+++ b/storage/connect/tabfix.h
@@ -34,7 +34,7 @@ class DllExport TDBFIX : public TDBDOS {
{return (PTDB)new(g) TDBFIX(g, this);}
// Methods
- virtual PTDB CopyOne(PTABS t);
+ virtual PTDB Clone(PTABS t);
virtual void ResetDB(void);
virtual bool IsUsingTemp(PGLOBAL g);
virtual int RowNumber(PGLOBAL g, bool b = false);
diff --git a/storage/connect/tabfmt.cpp b/storage/connect/tabfmt.cpp
index 183bb8f8d65..1a75d572ecd 100644
--- a/storage/connect/tabfmt.cpp
+++ b/storage/connect/tabfmt.cpp
@@ -5,7 +5,7 @@
/* */
/* COPYRIGHT: */
/* ---------- */
-/* (C) Copyright to the author Olivier BERTRAND 2001 - 2016 */
+/* (C) Copyright to the author Olivier BERTRAND 2001 - 2017 */
/* */
/* WHAT THIS PROGRAM DOES: */
/* ----------------------- */
@@ -98,8 +98,9 @@ PQRYRES CSVColumns(PGLOBAL g, char *dp, PTOS topt, bool info)
int num_read = 0, num_max = 10000000; // Statistics
int len[MAXCOL], typ[MAXCOL], prc[MAXCOL];
PCSVDEF tdp;
- PTDBCSV tdbp;
- PQRYRES qrp;
+ PTDBCSV tcvp;
+ PTDBASE tdbp;
+ PQRYRES qrp;
PCOLRES crp;
if (info) {
@@ -108,10 +109,10 @@ PQRYRES CSVColumns(PGLOBAL g, char *dp, PTOS topt, bool info)
goto skipit;
} // endif info
- if (GetIntegerTableOption(g, topt, "Multiple", 0)) {
- strcpy(g->Message, "Cannot find column definition for multiple table");
- return NULL;
- } // endif Multiple
+ //if (GetIntegerTableOption(g, topt, "Multiple", 0)) {
+ // strcpy(g->Message, "Cannot find column definition for multiple table");
+ // return NULL;
+ //} // endif Multiple
// num_max = atoi(p+1); // Max num of record to test
imax = hmax = nerr = 0;
@@ -127,10 +128,20 @@ PQRYRES CSVColumns(PGLOBAL g, char *dp, PTOS topt, bool info)
/* Get the CSV table description block. */
/*********************************************************************/
tdp = new(g) CSVDEF;
+ tdp->Database = dp;
+
+ if ((tdp->Zipped = GetBooleanTableOption(g, topt, "Zipped", false))) {
#if defined(ZIP_SUPPORT)
- tdp->Entry = GetStringTableOption(g, topt, "Entry", NULL);
- tdp->Zipped = GetBooleanTableOption(g, topt, "Zipped", false);
-#endif // ZIP_SUPPORT
+ tdp->Entry = GetStringTableOption(g, topt, "Entry", NULL);
+ tdp->Mulentries = (tdp->Entry)
+ ? strchr(tdp->Entry, '*') || strchr(tdp->Entry, '?')
+ : GetBooleanTableOption(g, topt, "Mulentries", false);
+#else // !ZIP_SUPPORT
+ strcpy(g->Message, "ZIP not supported by this version");
+ return NULL;
+#endif // !ZIP_SUPPORT
+ } // endif // Zipped
+
fn = tdp->Fn = GetStringTableOption(g, topt, "Filename", NULL);
if (!tdp->Fn) {
@@ -141,6 +152,7 @@ PQRYRES CSVColumns(PGLOBAL g, char *dp, PTOS topt, bool info)
if (!(tdp->Lrecl = GetIntegerTableOption(g, topt, "Lrecl", 0)))
tdp->Lrecl = 4096;
+ tdp->Multiple = GetIntegerTableOption(g, topt, "Multiple", 0);
p = GetStringTableOption(g, topt, "Separator", ",");
tdp->Sep = (strlen(p) == 2 && p[0] == '\\' && p[1] == 't') ? '\t' : *p;
@@ -177,17 +189,18 @@ PQRYRES CSVColumns(PGLOBAL g, char *dp, PTOS topt, bool info)
htrc("File %s Sep=%c Qot=%c Header=%d maxerr=%d\n",
SVP(tdp->Fn), tdp->Sep, tdp->Qot, tdp->Header, tdp->Maxerr);
- if (tdp->Zipped) {
-#if defined(ZIP_SUPPORT)
- tdbp = new(g)TDBCSV(tdp, new(g)ZIPFAM(tdp));
-#else // !ZIP_SUPPORT
- sprintf(g->Message, MSG(NO_FEAT_SUPPORT), "ZIP");
- return NULL;
-#endif // !ZIP_SUPPORT
- } else
- tdbp = new(g) TDBCSV(tdp, new(g) DOSFAM(tdp));
+ if (tdp->Zipped)
+ tcvp = new(g)TDBCSV(tdp, new(g)UNZFAM(tdp));
+ else
+ tcvp = new(g) TDBCSV(tdp, new(g) DOSFAM(tdp));
+
+ tcvp->SetMode(MODE_READ);
- tdbp->SetMode(MODE_READ);
+ if (tdp->Multiple) {
+ tdbp = new(g)TDBMUL(tcvp);
+ tdbp->SetMode(MODE_READ);
+ } else
+ tdbp = tcvp;
/*********************************************************************/
/* Open the CSV file. */
@@ -202,7 +215,7 @@ PQRYRES CSVColumns(PGLOBAL g, char *dp, PTOS topt, bool info)
phase = 0;
if ((rc = tdbp->ReadDB(g)) == RC_OK) {
- p = PlgDBDup(g, tdbp->To_Line);
+ p = PlgDBDup(g, tcvp->To_Line);
//skip leading blanks
for (; *p == ' '; p++) ;
@@ -245,6 +258,7 @@ PQRYRES CSVColumns(PGLOBAL g, char *dp, PTOS topt, bool info)
for (i = 0; i < hmax; i++)
length[0] = MY_MAX(length[0], strlen(colname[i]));
+ tcvp->Header = true; // In case of multiple table
} // endif hdr
for (num_read++; num_read <= num_max; num_read++) {
@@ -265,7 +279,7 @@ PQRYRES CSVColumns(PGLOBAL g, char *dp, PTOS topt, bool info)
/*******************************************************************/
i = n = phase = blank = digit = dec = 0;
- for (p = tdbp->To_Line; *p; p++)
+ for (p = tcvp->To_Line; *p; p++)
if (*p == sep) {
if (phase != 1) {
if (i == MAXCOL - 1) {
@@ -503,7 +517,14 @@ PTDB CSVDEF::GetTable(PGLOBAL g, MODE mode)
/*******************************************************************/
if (Zipped) {
#if defined(ZIP_SUPPORT)
- txfp = new(g) ZIPFAM(this);
+ if (mode == MODE_READ || mode == MODE_ANY) {
+ txfp = new(g) UNZFAM(this);
+ } else if (mode == MODE_INSERT) {
+ txfp = new(g) ZIPFAM(this);
+ } else {
+ strcpy(g->Message, "UPDATE/DELETE not supported for ZIP");
+ return NULL;
+ } // endif's mode
#else // !ZIP_SUPPORT
strcpy(g->Message, "ZIP not supported");
return NULL;
@@ -640,7 +661,7 @@ TDBCSV::TDBCSV(PGLOBAL g, PTDBCSV tdbp) : TDBDOS(g, tdbp)
} // end of TDBCSV copy constructor
// Method
-PTDB TDBCSV::CopyOne(PTABS t)
+PTDB TDBCSV::Clone(PTABS t)
{
PTDB tp;
PCSVCOL cp1, cp2;
@@ -654,7 +675,7 @@ PTDB TDBCSV::CopyOne(PTABS t)
} // endfor cp1
return tp;
- } // end of CopyOne
+ } // end of Clone
/***********************************************************************/
/* Allocate CSV column description block. */
@@ -1148,7 +1169,7 @@ TDBFMT::TDBFMT(PGLOBAL g, PTDBFMT tdbp) : TDBCSV(g, tdbp)
} // end of TDBFMT copy constructor
// Method
-PTDB TDBFMT::CopyOne(PTABS t)
+PTDB TDBFMT::Clone(PTABS t)
{
PTDB tp;
PCSVCOL cp1, cp2;
@@ -1165,7 +1186,7 @@ PTDB TDBFMT::CopyOne(PTABS t)
} // endfor cp1
return tp;
- } // end of CopyOne
+ } // end of Clone
/***********************************************************************/
/* Allocate FMT column description block. */
diff --git a/storage/connect/tabfmt.h b/storage/connect/tabfmt.h
index 5ce8d399a64..e5655435be7 100644
--- a/storage/connect/tabfmt.h
+++ b/storage/connect/tabfmt.h
@@ -52,6 +52,7 @@ public:
/***********************************************************************/
class DllExport TDBCSV : public TDBDOS {
friend class CSVCOL;
+ friend class MAPFAM;
friend PQRYRES CSVColumns(PGLOBAL, char *, PTOS, bool);
public:
// Constructor
@@ -64,7 +65,7 @@ public:
{return (PTDB)new(g) TDBCSV(g, this);}
// Methods
- virtual PTDB CopyOne(PTABS t);
+ virtual PTDB Clone(PTABS t);
//virtual bool IsUsingTemp(PGLOBAL g);
virtual int GetBadLines(void) {return (int)Nerr;}
@@ -147,7 +148,7 @@ class DllExport TDBFMT : public TDBCSV {
{return (PTDB)new(g) TDBFMT(g, this);}
// Methods
- virtual PTDB CopyOne(PTABS t);
+ virtual PTDB Clone(PTABS t);
// Database routines
virtual PCOL MakeCol(PGLOBAL g, PCOLDEF cdp, PCOL cprec, int n);
diff --git a/storage/connect/tabjdbc.cpp b/storage/connect/tabjdbc.cpp
index c36aa080956..5431e35e0ec 100644
--- a/storage/connect/tabjdbc.cpp
+++ b/storage/connect/tabjdbc.cpp
@@ -1,11 +1,11 @@
/************* TabJDBC C++ Program Source Code File (.CPP) *************/
/* PROGRAM NAME: TABJDBC */
/* ------------- */
-/* Version 1.1 */
+/* Version 1.2 */
/* */
/* COPYRIGHT: */
/* ---------- */
-/* (C) Copyright to the author Olivier BERTRAND 2016 */
+/* (C) Copyright to the author Olivier BERTRAND 2016-2017 */
/* */
/* WHAT THIS PROGRAM DOES: */
/* ----------------------- */
@@ -69,9 +69,10 @@
#include "plgdbsem.h"
#include "mycat.h"
#include "xtable.h"
+#include "tabext.h"
#include "tabjdbc.h"
#include "tabmul.h"
-#include "reldef.h"
+//#include "reldef.h"
#include "tabcol.h"
#include "valblk.h"
#include "ha_connect.h"
@@ -96,10 +97,7 @@ bool ExactInfo(void);
/***********************************************************************/
JDBCDEF::JDBCDEF(void)
{
- Driver = Url = Wrapname =Tabname = Tabschema = Username = Colpat = NULL;
- Password = Tabcat = Tabtype = Srcdef = Qchar = Qrystr = Sep = NULL;
- Options = Quoted = Maxerr = Maxres = Memory = 0;
- Scrollable = Xsrc = false;
+ Driver = Url = Wrapname = NULL;
} // end of JDBCDEF constructor
/***********************************************************************/
@@ -134,23 +132,26 @@ bool JDBCDEF::SetParms(PJPARM sjp)
int JDBCDEF::ParseURL(PGLOBAL g, char *url, bool b)
{
if (strncmp(url, "jdbc:", 5)) {
+ PSZ p;
+
// No "jdbc:" in connection string. Must be a straight
// "server" or "server/table"
// ok, so we do a little parsing, but not completely!
- if ((Tabname= strchr(url, '/'))) {
+ if ((p = strchr(url, '/'))) {
// If there is a single '/' in the connection string,
// this means the user is specifying a table name
- *Tabname++= '\0';
+ *p++= '\0';
// there better not be any more '/'s !
- if (strchr(Tabname, '/'))
+ if (strchr(p, '/'))
return RC_FX;
- } else if (b) {
- // Otherwise, straight server name,
- Tabname = GetStringCatInfo(g, "Name", NULL);
- Tabname = GetStringCatInfo(g, "Tabname", Tabname);
- } // endelse
+ Tabname = p;
+// } else if (b) {
+// // Otherwise, straight server name,
+// Tabname = GetStringCatInfo(g, "Name", NULL);
+// Tabname = GetStringCatInfo(g, "Tabname", Tabname);
+ } // endif
if (trace)
htrc("server: %s Tabname: %s", url, Tabname);
@@ -204,6 +205,9 @@ bool JDBCDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
{
int rc = RC_OK;
+ if (EXTDEF::DefineAM(g, am, poff))
+ return true;
+
Driver = GetStringCatInfo(g, "Driver", NULL);
Desc = Url = GetStringCatInfo(g, "Connect", NULL);
@@ -223,41 +227,41 @@ bool JDBCDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
if (rc == RC_FX) // Error
return true;
- else if (rc == RC_OK) { // Url was not a server name
- Tabname = GetStringCatInfo(g, "Name",
- (Catfunc & (FNC_TABLE | FNC_COL)) ? NULL : Name);
- Tabname = GetStringCatInfo(g, "Tabname", Tabname);
- Username = GetStringCatInfo(g, "User", NULL);
- Password = GetStringCatInfo(g, "Password", NULL);
- } // endif rc
+//else if (rc == RC_OK) { // Url was not a server name
+// Tabname = GetStringCatInfo(g, "Name",
+// (Catfunc & (FNC_TABLE | FNC_COL)) ? NULL : Name);
+// Tabname = GetStringCatInfo(g, "Tabname", Tabname);
+// Username = GetStringCatInfo(g, "User", NULL);
+// Password = GetStringCatInfo(g, "Password", NULL);
+//} // endif rc
- if ((Srcdef = GetStringCatInfo(g, "Srcdef", NULL)))
- Read_Only = true;
+//if ((Srcdef = GetStringCatInfo(g, "Srcdef", NULL)))
+// Read_Only = true;
Wrapname = GetStringCatInfo(g, "Wrapper", NULL);
//Prop = GetStringCatInfo(g, "Properties", NULL);
- Tabcat = GetStringCatInfo(g, "Qualifier", NULL);
- Tabcat = GetStringCatInfo(g, "Catalog", Tabcat);
- Tabschema = GetStringCatInfo(g, "Dbname", NULL);
- Tabschema = GetStringCatInfo(g, "Schema", Tabschema);
-
- if (Catfunc == FNC_COL)
- Colpat = GetStringCatInfo(g, "Colpat", NULL);
-
- if (Catfunc == FNC_TABLE)
- Tabtype = GetStringCatInfo(g, "Tabtype", NULL);
-
- Qrystr = GetStringCatInfo(g, "Query_String", "?");
- Sep = GetStringCatInfo(g, "Separator", NULL);
- Xsrc = GetBoolCatInfo("Execsrc", FALSE);
- Maxerr = GetIntCatInfo("Maxerr", 0);
- Maxres = GetIntCatInfo("Maxres", 0);
- Quoted = GetIntCatInfo("Quoted", 0);
-//Cto= GetIntCatInfo("ConnectTimeout", DEFAULT_LOGIN_TIMEOUT);
-//Qto= GetIntCatInfo("QueryTimeout", DEFAULT_QUERY_TIMEOUT);
- Scrollable = GetBoolCatInfo("Scrollable", false);
- Memory = GetIntCatInfo("Memory", 0);
- Pseudo = 2; // FILID is Ok but not ROWID
+//Tabcat = GetStringCatInfo(g, "Qualifier", NULL);
+//Tabcat = GetStringCatInfo(g, "Catalog", Tabcat);
+//Tabschema = GetStringCatInfo(g, "Dbname", NULL);
+//Tabschema = GetStringCatInfo(g, "Schema", Tabschema);
+
+//if (Catfunc == FNC_COL)
+// Colpat = GetStringCatInfo(g, "Colpat", NULL);
+
+//if (Catfunc == FNC_TABLE)
+// Tabtyp = GetStringCatInfo(g, "Tabtype", NULL);
+
+//Qrystr = GetStringCatInfo(g, "Query_String", "?");
+//Sep = GetStringCatInfo(g, "Separator", NULL);
+//Xsrc = GetBoolCatInfo("Execsrc", FALSE);
+//Maxerr = GetIntCatInfo("Maxerr", 0);
+//Maxres = GetIntCatInfo("Maxres", 0);
+//Quoted = GetIntCatInfo("Quoted", 0);
+// Cto= GetIntCatInfo("ConnectTimeout", DEFAULT_LOGIN_TIMEOUT);
+// Qto= GetIntCatInfo("QueryTimeout", DEFAULT_QUERY_TIMEOUT);
+//Scrollable = GetBoolCatInfo("Scrollable", false);
+//Memory = GetIntCatInfo("Memory", 0);
+//Pseudo = 2; // FILID is Ok but not ROWID
return false;
} // end of DefineAM
@@ -266,7 +270,7 @@ bool JDBCDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
/***********************************************************************/
PTDB JDBCDEF::GetTable(PGLOBAL g, MODE m)
{
- PTDBASE tdbp = NULL;
+ PTDB tdbp = NULL;
/*********************************************************************/
/* Allocate a TDB of the proper type. */
@@ -326,7 +330,7 @@ int JDBCPARM::CheckSize(int rows)
/***********************************************************************/
/* Implementation of the TDBJDBC class. */
/***********************************************************************/
-TDBJDBC::TDBJDBC(PJDBCDEF tdp) : TDBASE(tdp)
+TDBJDBC::TDBJDBC(PJDBCDEF tdp) : TDBEXT(tdp)
{
Jcp = NULL;
Cnp = NULL;
@@ -335,101 +339,45 @@ TDBJDBC::TDBJDBC(PJDBCDEF tdp) : TDBASE(tdp)
Ops.Driver = tdp->Driver;
Ops.Url = tdp->Url;
WrapName = tdp->Wrapname;
- TableName = tdp->Tabname;
- Schema = tdp->Tabschema;
Ops.User = tdp->Username;
Ops.Pwd = tdp->Password;
// Ops.Properties = tdp->Prop;
- Catalog = tdp->Tabcat;
- Srcdef = tdp->Srcdef;
- Qrystr = tdp->Qrystr;
- Sep = tdp->GetSep();
- Options = tdp->Options;
// Ops.Cto = tdp->Cto;
// Ops.Qto = tdp->Qto;
- Quoted = MY_MAX(0, tdp->GetQuoted());
- Rows = tdp->GetElemt();
- Memory = tdp->Memory;
Ops.Scrollable = tdp->Scrollable;
} else {
WrapName = NULL;
- TableName = NULL;
- Schema = NULL;
Ops.Driver = NULL;
Ops.Url = NULL;
Ops.User = NULL;
Ops.Pwd = NULL;
// Ops.Properties = NULL;
- Catalog = NULL;
- Srcdef = NULL;
- Qrystr = NULL;
- Sep = 0;
- Options = 0;
// Ops.Cto = DEFAULT_LOGIN_TIMEOUT;
// Ops.Qto = DEFAULT_QUERY_TIMEOUT;
- Quoted = 0;
- Rows = 0;
- Memory = 0;
Ops.Scrollable = false;
} // endif tdp
- Quote = NULL;
- Query = NULL;
- Count = NULL;
-//Where = NULL;
- MulConn = NULL;
- DBQ = NULL;
- Qrp = NULL;
- Fpos = 0;
- Curpos = 0;
- AftRows = 0;
- CurNum = 0;
- Rbuf = 0;
- BufSize = 0;
- Ncol = 0;
- Nparm = 0;
- Placed = false;
+//Ncol = 0;
Prepared = false;
Werr = false;
Rerr = false;
Ops.Fsize = Ops.CheckSize(Rows);
} // end of TDBJDBC standard constructor
-TDBJDBC::TDBJDBC(PTDBJDBC tdbp) : TDBASE(tdbp)
+TDBJDBC::TDBJDBC(PTDBJDBC tdbp) : TDBEXT(tdbp)
{
Jcp = tdbp->Jcp; // is that right ?
Cnp = tdbp->Cnp;
WrapName = tdbp->WrapName;
- TableName = tdbp->TableName;
- Schema = tdbp->Schema;
Ops = tdbp->Ops;
- Catalog = tdbp->Catalog;
- Srcdef = tdbp->Srcdef;
- Qrystr = tdbp->Qrystr;
- Memory = tdbp->Memory;
-//Scrollable = tdbp->Scrollable;
- Quote = tdbp->Quote;
- Query = tdbp->Query;
- Count = tdbp->Count;
-//Where = tdbp->Where;
- MulConn = tdbp->MulConn;
- DBQ = tdbp->DBQ;
- Options = tdbp->Options;
- Quoted = tdbp->Quoted;
- Rows = tdbp->Rows;
- Fpos = 0;
- Curpos = 0;
- AftRows = 0;
- CurNum = 0;
- Rbuf = 0;
- BufSize = tdbp->BufSize;
- Nparm = tdbp->Nparm;
- Qrp = tdbp->Qrp;
- Placed = false;
+//Ncol = tdbp->Ncol;
+ Prepared = tdbp->Prepared;
+ Werr = tdbp->Werr;
+ Rerr = tdbp->Rerr;
} // end of TDBJDBC copy constructor
// Method
-PTDB TDBJDBC::CopyOne(PTABS t)
+PTDB TDBJDBC::Clone(PTABS t)
{
PTDB tp;
PJDBCCOL cp1, cp2;
@@ -443,7 +391,7 @@ PTDB TDBJDBC::CopyOne(PTABS t)
} // endfor cp1
return tp;
-} // end of CopyOne
+} // end of Clone
/***********************************************************************/
/* Allocate JDBC column description block. */
@@ -453,134 +401,6 @@ PCOL TDBJDBC::MakeCol(PGLOBAL g, PCOLDEF cdp, PCOL cprec, int n)
return new(g)JDBCCOL(cdp, this, cprec, n);
} // end of MakeCol
-/******************************************************************/
-/* Convert an UTF-8 string to latin characters. */
-/******************************************************************/
-int TDBJDBC::Decode(char *txt, char *buf, size_t n)
-{
- uint dummy_errors;
- uint32 len= copy_and_convert(buf, n, &my_charset_latin1,
- txt, strlen(txt),
- &my_charset_utf8_general_ci,
- &dummy_errors);
- buf[len]= '\0';
- return 0;
-} // end of Decode
-
-/***********************************************************************/
-/* MakeSQL: make the SQL statement use with JDBC connection. */
-/* TODO: when implementing EOM filtering, column only used in local */
-/* filter should be removed from column list. */
-/***********************************************************************/
-bool TDBJDBC::MakeSQL(PGLOBAL g, bool cnt)
-{
- char *schmp = NULL, *catp = NULL, buf[NAM_LEN * 3];
- int len;
- bool oom = false, first = true;
- PTABLE tablep = To_Table;
- PCOL colp;
-
- if (Srcdef) {
- Query = new(g)STRING(g, 0, Srcdef);
- return false;
- } // endif Srcdef
-
- // Allocate the string used to contain the Query
- Query = new(g)STRING(g, 1023, "SELECT ");
-
- if (!cnt) {
- if (Columns) {
- // Normal SQL statement to retrieve results
- for (colp = Columns; colp; colp = colp->GetNext())
- if (!colp->IsSpecial()) {
- if (!first)
- oom |= Query->Append(", ");
- else
- first = false;
-
- // Column name can be encoded in UTF-8
- Decode(colp->GetName(), buf, sizeof(buf));
-
- if (Quote) {
- // Put column name between identifier quotes in case in contains blanks
- oom |= Query->Append(Quote);
- oom |= Query->Append(buf);
- oom |= Query->Append(Quote);
- } else
- oom |= Query->Append(buf);
-
- ((PJDBCCOL)colp)->Rank = ++Ncol;
- } // endif colp
-
- } else
- // !Columns can occur for queries such that sql count(*) from...
- // for which we will count the rows from sql * from...
- oom |= Query->Append('*');
-
- } else
- // SQL statement used to retrieve the size of the result
- oom |= Query->Append("count(*)");
-
- oom |= Query->Append(" FROM ");
-
- if (Catalog && *Catalog)
- catp = Catalog;
-
- //if (tablep->GetSchema())
- // schmp = (char*)tablep->GetSchema();
- //else
- if (Schema && *Schema)
- schmp = Schema;
-
- if (catp) {
- oom |= Query->Append(catp);
-
- if (schmp) {
- oom |= Query->Append('.');
- oom |= Query->Append(schmp);
- } // endif schmp
-
- oom |= Query->Append('.');
- } else if (schmp) {
- oom |= Query->Append(schmp);
- oom |= Query->Append('.');
- } // endif schmp
-
- // Table name can be encoded in UTF-8
- Decode(TableName, buf, sizeof(buf));
-
- if (Quote) {
- // Put table name between identifier quotes in case in contains blanks
- oom |= Query->Append(Quote);
- oom |= Query->Append(buf);
- oom |= Query->Append(Quote);
- } else
- oom |= Query->Append(buf);
-
- len = Query->GetLength();
-
- if (To_CondFil) {
- if (Mode == MODE_READ) {
- oom |= Query->Append(" WHERE ");
- oom |= Query->Append(To_CondFil->Body);
- len = Query->GetLength() + 1;
- } else
- len += (strlen(To_CondFil->Body) + 256);
-
- } else
- len += ((Mode == MODE_READX) ? 256 : 1);
-
- if (oom || Query->Resize(len)) {
- strcpy(g->Message, "MakeSQL: Out of memory");
- return true;
- } // endif oom
-
- if (trace)
- htrc("Query=%s\n", Query->GetStr());
-
- return false;
-} // end of MakeSQL
-
/***********************************************************************/
/* MakeInsert: make the Insert statement used with JDBC connection. */
/***********************************************************************/
@@ -601,7 +421,7 @@ bool TDBJDBC::MakeInsert(PGLOBAL g)
// Column name can be encoded in UTF-8
Decode(colp->GetName(), buf, sizeof(buf));
len += (strlen(buf) + 6); // comma + quotes + valist
- ((PJDBCCOL)colp)->Rank = ++Nparm;
+ ((PEXTCOL)colp)->SetRank(++Nparm);
} // endif colp
// Below 32 is enough to contain the fixed part of the query
@@ -711,76 +531,6 @@ bool TDBJDBC::SetParameters(PGLOBAL g)
} // end of SetParameters
/***********************************************************************/
-/* MakeCommand: make the Update or Delete statement to send to the */
-/* MySQL server. Limited to remote values and filtering. */
-/***********************************************************************/
-bool TDBJDBC::MakeCommand(PGLOBAL g)
-{
- char *p, *stmt, name[68], *body = NULL, *qc = Jcp->GetQuoteChar();
- char *qrystr = (char*)PlugSubAlloc(g, NULL, strlen(Qrystr) + 1);
- bool qtd = Quoted > 0;
- int i = 0, k = 0;
-
- // Make a lower case copy of the originale query and change
- // back ticks to the data source identifier quoting character
- do {
- qrystr[i] = (Qrystr[i] == '`') ? *qc : tolower(Qrystr[i]);
- } while (Qrystr[i++]);
-
- if (To_CondFil && (p = strstr(qrystr, " where "))) {
- p[7] = 0; // Remove where clause
- Qrystr[(p - qrystr) + 7] = 0;
- body = To_CondFil->Body;
- stmt = (char*)PlugSubAlloc(g, NULL, strlen(qrystr)
- + strlen(body) + 64);
- } else
- stmt = (char*)PlugSubAlloc(g, NULL, strlen(Qrystr) + 64);
-
- // Check whether the table name is equal to a keyword
- // If so, it must be quoted in the original query
- strlwr(strcat(strcat(strcpy(name, " "), Name), " "));
-
- if (strstr(" update delete low_priority ignore quick from ", name)) {
- strlwr(strcat(strcat(strcpy(name, qc), Name), qc));
- k += 2;
- } else
- strlwr(strcpy(name, Name)); // Not a keyword
-
- if ((p = strstr(qrystr, name))) {
- for (i = 0; i < p - qrystr; i++)
- stmt[i] = (Qrystr[i] == '`') ? *qc : Qrystr[i];
-
- stmt[i] = 0;
- k += i + (int)strlen(Name);
-
- if (qtd && *(p-1) == ' ')
- strcat(strcat(strcat(stmt, qc), TableName), qc);
- else
- strcat(stmt, TableName);
-
- i = (int)strlen(stmt);
-
- do {
- stmt[i++] = (Qrystr[k] == '`') ? *qc : Qrystr[k];
- } while (Qrystr[k++]);
-
- if (body)
- strcat(stmt, body);
-
- } else {
- sprintf(g->Message, "Cannot use this %s command",
- (Mode == MODE_UPDATE) ? "UPDATE" : "DELETE");
- return 1;
- } // endif p
-
- if (trace)
- htrc("Command=%s\n", stmt);
-
- Query = new(g)STRING(g, 0, stmt);
- return (!Query->GetSize());
-} // end of MakeCommand
-
-/***********************************************************************/
/* ResetSize: call by TDBMUL when calculating size estimate. */
/***********************************************************************/
void TDBJDBC::ResetSize(void)
@@ -834,33 +584,6 @@ int TDBJDBC::Cardinality(PGLOBAL g)
} // end of Cardinality
/***********************************************************************/
-/* JDBC GetMaxSize: returns table size estimate in number of lines. */
-/***********************************************************************/
-int TDBJDBC::GetMaxSize(PGLOBAL g)
-{
- if (MaxSize < 0) {
- if (Mode == MODE_DELETE)
- // Return 0 in mode DELETE in case of delete all.
- MaxSize = 0;
- else if (!Cardinality(NULL))
- MaxSize = 10; // To make MySQL happy
- else if ((MaxSize = Cardinality(g)) < 0)
- MaxSize = 12; // So we can see an error occured
-
- } // endif MaxSize
-
- return MaxSize;
-} // end of GetMaxSize
-
-/***********************************************************************/
-/* Return max size value. */
-/***********************************************************************/
-int TDBJDBC::GetProgMax(PGLOBAL g)
-{
- return GetMaxSize(g);
-} // end of GetProgMax
-
-/***********************************************************************/
/* JDBC Access Method opening routine. */
/* New method now that this routine is called recursively (last table */
/* first in reverse order): index blocks are immediately linked to */
@@ -997,6 +720,7 @@ bool TDBJDBC::OpenDB(PGLOBAL g)
return false;
} // end of OpenDB
+#if 0
/***********************************************************************/
/* GetRecpos: return the position of last read record. */
/***********************************************************************/
@@ -1004,6 +728,7 @@ int TDBJDBC::GetRecpos(void)
{
return Fpos;
} // end of GetRecpos
+#endif // 0
/***********************************************************************/
/* SetRecpos: set the position of next read record. */
@@ -1105,8 +830,7 @@ int TDBJDBC::ReadDB(PGLOBAL g)
int rc;
if (trace > 1)
- htrc("JDBC ReadDB: R%d Mode=%d key=%p link=%p Kindex=%p\n",
- GetTdb_No(), Mode, To_Key_Col, To_Link, To_Kindex);
+ htrc("JDBC ReadDB: R%d Mode=%d\n", GetTdb_No(), Mode);
if (Mode == MODE_UPDATE || Mode == MODE_DELETE) {
if (!Query && MakeCommand(g))
@@ -1125,12 +849,6 @@ int TDBJDBC::ReadDB(PGLOBAL g)
} // endif Mode
- if (To_Kindex) {
- // Direct access of JDBC tables is not implemented
- strcpy(g->Message, "No JDBC direct access");
- return RC_FX;
- } // endif To_Kindex
-
/*********************************************************************/
/* Now start the reading process. */
/* Here is the place to fetch the line(s). */
@@ -1302,70 +1020,26 @@ void TDBJDBC::CloseDB(PGLOBAL g)
/* JDBCCOL public constructor. */
/***********************************************************************/
JDBCCOL::JDBCCOL(PCOLDEF cdp, PTDB tdbp, PCOL cprec, int i, PSZ am)
- : COLBLK(cdp, tdbp, i)
+ : EXTCOL(cdp, tdbp, cprec, i, am)
{
- if (cprec) {
- Next = cprec->GetNext();
- cprec->SetNext(this);
- } else {
- Next = tdbp->GetColumns();
- tdbp->SetColumns(this);
- } // endif cprec
-
- // Set additional JDBC access method information for column.
- Crp = NULL;
- //Long = cdp->GetLong();
- Long = Precision;
- //strcpy(F_Date, cdp->F_Date);
- To_Val = NULL;
-//Slen = 0;
-//StrLen = &Slen;
-//Sqlbuf = NULL;
- Bufp = NULL;
- Blkp = NULL;
- Rank = 0; // Not known yet
-
- if (trace)
- htrc(" making new %sCOL C%d %s at %p\n", am, Index, Name, this);
-
} // end of JDBCCOL constructor
/***********************************************************************/
/* JDBCCOL private constructor. */
/***********************************************************************/
-JDBCCOL::JDBCCOL(void) : COLBLK()
+JDBCCOL::JDBCCOL(void) : EXTCOL()
{
- Crp = NULL;
- Buf_Type = TYPE_INT; // This is a count(*) column
- // Set additional Dos access method information for column.
- Long = sizeof(int);
- To_Val = NULL;
-//Slen = 0;
-//StrLen = &Slen;
-//Sqlbuf = NULL;
- Bufp = NULL;
- Blkp = NULL;
- Rank = 1;
} // end of JDBCCOL constructor
/***********************************************************************/
/* JDBCCOL constructor used for copying columns. */
/* tdbp is the pointer to the new table descriptor. */
/***********************************************************************/
-JDBCCOL::JDBCCOL(JDBCCOL *col1, PTDB tdbp) : COLBLK(col1, tdbp)
+JDBCCOL::JDBCCOL(JDBCCOL *col1, PTDB tdbp) : EXTCOL(col1, tdbp)
{
- Crp = col1->Crp;
- Long = col1->Long;
- //strcpy(F_Date, col1->F_Date);
- To_Val = col1->To_Val;
-//Slen = col1->Slen;
-//StrLen = col1->StrLen;
-//Sqlbuf = col1->Sqlbuf;
- Bufp = col1->Bufp;
- Blkp = col1->Blkp;
- Rank = col1->Rank;
} // end of JDBCCOL copy constructor
+#if 0
/***********************************************************************/
/* SetBuffer: prepare a column block for write operation. */
/***********************************************************************/
@@ -1411,6 +1085,7 @@ bool JDBCCOL::SetBuffer(PGLOBAL g, PVAL value, bool ok, bool check)
Status = (ok) ? BUF_EMPTY : BUF_NO;
return false;
} // end of SetBuffer
+#endif // 0
/***********************************************************************/
/* ReadColumn: when SQLFetch is used there is nothing to do as the */
@@ -1456,72 +1131,8 @@ void JDBCCOL::ReadColumn(PGLOBAL g)
} // end of ReadColumn
-#if 0
/***********************************************************************/
-/* AllocateBuffers: allocate the extended buffer for SQLExtendedFetch */
-/* or Fetch. Note: we use Long+1 here because JDBC must have space */
-/* for the ending null character. */
-/***********************************************************************/
-void JDBCCOL::AllocateBuffers(PGLOBAL g, int rows)
-{
- if (Buf_Type == TYPE_DATE)
- Sqlbuf = (TIMESTAMP_STRUCT*)PlugSubAlloc(g, NULL,
- sizeof(TIMESTAMP_STRUCT));
-
- if (!rows)
- return;
-
- if (Buf_Type == TYPE_DATE)
- Bufp = PlugSubAlloc(g, NULL, rows * sizeof(TIMESTAMP_STRUCT));
- else {
- Blkp = AllocValBlock(g, NULL, Buf_Type, rows, GetBuflen(),
- GetScale(), true, false, false);
- Bufp = Blkp->GetValPointer();
- } // endelse
-
- if (rows > 1)
- StrLen = (SQLLEN *)PlugSubAlloc(g, NULL, rows * sizeof(SQLLEN));
-
-} // end of AllocateBuffers
-
-/***********************************************************************/
-/* Returns the buffer to use for Fetch or Extended Fetch. */
-/***********************************************************************/
-void *JDBCCOL::GetBuffer(DWORD rows)
-{
- if (rows && To_Tdb) {
- assert(rows == (DWORD)((TDBJDBC*)To_Tdb)->Rows);
- return Bufp;
- } else
- return (Buf_Type == TYPE_DATE) ? Sqlbuf : Value->GetTo_Val();
-
-} // end of GetBuffer
-
-/***********************************************************************/
-/* Returns the buffer length to use for Fetch or Extended Fetch. */
-/***********************************************************************/
-SWORD JDBCCOL::GetBuflen(void)
-{
- SWORD flen;
-
- switch (Buf_Type) {
- case TYPE_DATE:
- flen = (SWORD)sizeof(TIMESTAMP_STRUCT);
- break;
- case TYPE_STRING:
- case TYPE_DECIM:
- flen = (SWORD)Value->GetClen() + 1;
- break;
- default:
- flen = (SWORD)Value->GetClen();
- } // endswitch Buf_Type
-
- return flen;
-} // end of GetBuflen
-#endif // 0
-
-/***********************************************************************/
-/* WriteColumn: make sure the bind buffer is updated. */
+/* WriteColumn: Convert if necessary. */
/***********************************************************************/
void JDBCCOL::WriteColumn(PGLOBAL g)
{
@@ -1531,30 +1142,6 @@ void JDBCCOL::WriteColumn(PGLOBAL g)
if (Value != To_Val)
Value->SetValue_pval(To_Val, FALSE); // Convert the inserted value
-#if 0
- if (Buf_Type == TYPE_DATE) {
- struct tm tm, *dbtime = ((DTVAL*)Value)->GetGmTime(&tm);
-
- Sqlbuf->second = dbtime->tm_sec;
- Sqlbuf->minute = dbtime->tm_min;
- Sqlbuf->hour = dbtime->tm_hour;
- Sqlbuf->day = dbtime->tm_mday;
- Sqlbuf->month = dbtime->tm_mon + 1;
- Sqlbuf->year = dbtime->tm_year + 1900;
- Sqlbuf->fraction = 0;
- } else if (Buf_Type == TYPE_DECIM) {
- // Some data sources require local decimal separator
- char *p, sep = ((PTDBJDBC)To_Tdb)->Sep;
-
- if (sep && (p = strchr(Value->GetCharValue(), '.')))
- *p = sep;
-
- } // endif Buf_Type
-
- if (Nullable)
- *StrLen = (Value->IsNull()) ? SQL_NULL_DATA :
- (IsTypeChar(Buf_Type)) ? SQL_NTS : 0;
-#endif // 0
} // end of WriteColumn
/* -------------------------- Class TDBXJDC -------------------------- */
@@ -1795,7 +1382,7 @@ TDBJTB::TDBJTB(PJDBCDEF tdp) : TDBJDRV(tdp)
{
Schema = tdp->Tabschema;
Tab = tdp->Tabname;
- Tabtype = tdp->Tabtype;
+ Tabtype = tdp->Tabtyp;
Ops.Driver = tdp->Driver;
Ops.Url = tdp->Url;
Ops.User = tdp->Username;
diff --git a/storage/connect/tabjdbc.h b/storage/connect/tabjdbc.h
index fee8223abaf..46d2073e923 100644
--- a/storage/connect/tabjdbc.h
+++ b/storage/connect/tabjdbc.h
@@ -21,7 +21,7 @@ typedef class JSRCCOL *PJSRCCOL;
/***********************************************************************/
/* JDBC table. */
/***********************************************************************/
-class DllExport JDBCDEF : public TABDEF { /* Logical table description */
+class DllExport JDBCDEF : public EXTDEF { /* Logical table description */
friend class TDBJDBC;
friend class TDBXJDC;
friend class TDBJDRV;
@@ -33,17 +33,8 @@ public:
// Implementation
virtual const char *GetType(void) { return "JDBC"; }
- PSZ GetTabname(void) { return Tabname; }
- PSZ GetTabschema(void) { return Tabschema; }
- PSZ GetTabcat(void) { return Tabcat; }
- PSZ GetSrcdef(void) { return Srcdef; }
- char GetSep(void) { return (Sep) ? *Sep : 0; }
- int GetQuoted(void) { return Quoted; }
-//int GetCatver(void) { return Catver; }
- int GetOptions(void) { return Options; }
// Methods
- virtual int Indexable(void) { return 2; }
virtual bool DefineAM(PGLOBAL g, LPCSTR am, int poff);
virtual PTDB GetTable(PGLOBAL g, MODE m);
int ParseURL(PGLOBAL g, char *url, bool b = true);
@@ -53,28 +44,7 @@ protected:
// Members
PSZ Driver; /* JDBC driver */
PSZ Url; /* JDBC driver URL */
- PSZ Tabname; /* External table name */
PSZ Wrapname; /* Java wrapper name */
- PSZ Tabschema; /* External table schema */
- PSZ Username; /* User connect name */
- PSZ Password; /* Password connect info */
-//PSZ Prop; /* Connection Properties */
- PSZ Tabcat; /* External table catalog */
- PSZ Tabtype; /* External table type */
- PSZ Colpat; /* Catalog column pattern */
- PSZ Srcdef; /* The source table SQL definition */
- PSZ Qchar; /* Identifier quoting character */
- PSZ Qrystr; /* The original query */
- PSZ Sep; /* Decimal separator */
- int Options; /* Open connection options */
-//int Cto; /* Open connection timeout */
-//int Qto; /* Query (command) timeout */
- int Quoted; /* Identifier quoting level */
- int Maxerr; /* Maxerr for an Exec table */
- int Maxres; /* Maxres for a catalog table */
- int Memory; /* Put result set in memory */
- bool Scrollable; /* Use scrollable cursor */
- bool Xsrc; /* Execution type */
}; // end of JDBCDEF
#if !defined(NJDBC)
@@ -84,34 +54,34 @@ protected:
/* This is the JDBC Access Method class declaration for files from */
/* other DB drivers to be accessed via JDBC. */
/***********************************************************************/
-class TDBJDBC : public TDBASE {
+class TDBJDBC : public TDBEXT {
friend class JDBCCOL;
friend class JDBConn;
public:
// Constructor
TDBJDBC(PJDBCDEF tdp = NULL);
- TDBJDBC(PTDBJDBC tdbp);
+ TDBJDBC(PTDBJDBC tdbp);
// Implementation
- virtual AMT GetAmType(void) { return TYPE_AM_JDBC; }
- virtual PTDB Duplicate(PGLOBAL g) { return (PTDB)new(g)TDBJDBC(this); }
+ virtual AMT GetAmType(void) {return TYPE_AM_JDBC;}
+ virtual PTDB Duplicate(PGLOBAL g) {return (PTDB)new(g) TDBJDBC(this);}
// Methods
- virtual PTDB CopyOne(PTABS t);
- virtual int GetRecpos(void);
+ virtual PTDB Clone(PTABS t);
+//virtual int GetRecpos(void);
virtual bool SetRecpos(PGLOBAL g, int recpos);
//virtual PSZ GetFile(PGLOBAL g);
//virtual void SetFile(PGLOBAL g, PSZ fn);
virtual void ResetSize(void);
- //virtual int GetAffectedRows(void) {return AftRows;}
+//virtual int GetAffectedRows(void) {return AftRows;}
virtual PSZ GetServer(void) { return "JDBC"; }
virtual int Indexable(void) { return 2; }
// Database routines
virtual PCOL MakeCol(PGLOBAL g, PCOLDEF cdp, PCOL cprec, int n);
virtual int Cardinality(PGLOBAL g);
- virtual int GetMaxSize(PGLOBAL g);
- virtual int GetProgMax(PGLOBAL g);
+//virtual int GetMaxSize(PGLOBAL g);
+//virtual int GetProgMax(PGLOBAL g);
virtual bool OpenDB(PGLOBAL g);
virtual int ReadDB(PGLOBAL g);
virtual int WriteDB(PGLOBAL g);
@@ -121,97 +91,50 @@ public:
protected:
// Internal functions
- int Decode(char *utf, char *buf, size_t n);
- bool MakeSQL(PGLOBAL g, bool cnt);
+//int Decode(char *utf, char *buf, size_t n);
+//bool MakeSQL(PGLOBAL g, bool cnt);
bool MakeInsert(PGLOBAL g);
- bool MakeCommand(PGLOBAL g);
- //bool MakeFilter(PGLOBAL g, bool c);
+//virtual bool MakeCommand(PGLOBAL g);
+//bool MakeFilter(PGLOBAL g, bool c);
bool SetParameters(PGLOBAL g);
- //char *MakeUpdate(PGLOBAL g);
- //char *MakeDelete(PGLOBAL g);
+//char *MakeUpdate(PGLOBAL g);
+//char *MakeDelete(PGLOBAL g);
// Members
JDBConn *Jcp; // Points to a JDBC connection class
JDBCCOL *Cnp; // Points to count(*) column
JDBCPARM Ops; // Additional parameters
- PSTRG Query; // Constructed SQL query
char *WrapName; // Points to Java wrapper name
- char *TableName; // Points to JDBC table name
- char *Schema; // Points to JDBC table Schema
- char *User; // User connect info
- char *Pwd; // Password connect info
- char *Catalog; // Points to JDBC table Catalog
- char *Srcdef; // The source table SQL definition
- char *Count; // Points to count(*) SQL statement
-//char *Where; // Points to local where clause
- char *Quote; // The identifier quoting character
- char *MulConn; // Used for multiple JDBC tables
- char *DBQ; // The address part of Connect string
- char *Qrystr; // The original query
- char Sep; // The decimal separator
- int Options; // Connect options
-//int Cto; // Connect timeout
-//int Qto; // Query timeout
- int Quoted; // The identifier quoting level
- int Fpos; // Position of last read record
- int Curpos; // Cursor position of last fetch
- int AftRows; // The number of affected rows
- int Rows; // Rowset size
- int CurNum; // Current buffer line number
- int Rbuf; // Number of lines read in buffer
- int BufSize; // Size of connect string buffer
- int Ncol; // The column number
- int Nparm; // The number of statement parameters
- int Memory; // 0: No 1: Alloc 2: Put 3: Get
-//bool Scrollable; // Use scrollable cursor --> in Ops
- bool Placed; // True for position reading
+//int Ncol; // The column number
bool Prepared; // True when using prepared statement
bool Werr; // Write error
bool Rerr; // Rewind error
- PQRYRES Qrp; // Points to storage result
}; // end of class TDBJDBC
/***********************************************************************/
/* Class JDBCCOL: JDBC access method column descriptor. */
/* This A.M. is used for JDBC tables. */
/***********************************************************************/
-class JDBCCOL : public COLBLK {
+class JDBCCOL : public EXTCOL {
friend class TDBJDBC;
public:
// Constructors
JDBCCOL(PCOLDEF cdp, PTDB tdbp, PCOL cprec, int i, PSZ am = "JDBC");
- JDBCCOL(JDBCCOL *colp, PTDB tdbp); // Constructor used in copy process
+ JDBCCOL(JDBCCOL *colp, PTDB tdbp); // Constructor used in copy process
// Implementation
- virtual int GetAmType(void) { return TYPE_AM_JDBC; }
-//SQLLEN *GetStrLen(void) { return StrLen; }
- int GetRank(void) { return Rank; }
-//PVBLK GetBlkp(void) {return Blkp;}
- void SetCrp(PCOLRES crp) { Crp = crp; }
+ virtual int GetAmType(void) { return TYPE_AM_JDBC; }
// Methods
- virtual bool SetBuffer(PGLOBAL g, PVAL value, bool ok, bool check);
- virtual void ReadColumn(PGLOBAL g);
- virtual void WriteColumn(PGLOBAL g);
-//void AllocateBuffers(PGLOBAL g, int rows);
-//void *GetBuffer(DWORD rows);
-//SWORD GetBuflen(void);
- // void Print(PGLOBAL g, FILE *, uint);
+//virtual bool SetBuffer(PGLOBAL g, PVAL value, bool ok, bool check);
+ virtual void ReadColumn(PGLOBAL g);
+ virtual void WriteColumn(PGLOBAL g);
protected:
- // Constructor used by GetMaxSize
- JDBCCOL(void);
+ // Constructor for count(*) column
+ JDBCCOL(void);
// Members
- //TIMESTAMP_STRUCT *Sqlbuf; // To get SQL_TIMESTAMP's
- PCOLRES Crp; // To storage result
- void *Bufp; // To extended buffer
- PVBLK Blkp; // To Value Block
- //char F_Date[12]; // Internal Date format
- PVAL To_Val; // To value used for Insert
-//SQLLEN *StrLen; // As returned by JDBC
-//SQLLEN Slen; // Used with Fetch
- int Rank; // Rank (position) number in the query
}; // end of class JDBCCOL
/***********************************************************************/
@@ -268,7 +191,7 @@ public:
JSRCCOL(PCOLDEF cdp, PTDB tdbp, PCOL cprec, int i, PSZ am = "JDBC");
// Implementation
- //virtual int GetAmType(void) {return TYPE_AM_JDBC;}
+ virtual int GetAmType(void) {return TYPE_AM_JDBC;}
// Methods
virtual void ReadColumn(PGLOBAL g);
diff --git a/storage/connect/tabjson.cpp b/storage/connect/tabjson.cpp
index 1b9ce8b64c9..1e11d454cfc 100644
--- a/storage/connect/tabjson.cpp
+++ b/storage/connect/tabjson.cpp
@@ -129,7 +129,7 @@ PQRYRES JSONColumns(PGLOBAL g, char *db, PTOS topt, bool info)
if (tdp->Pretty == 2) {
if (tdp->Zipped) {
#if defined(ZIP_SUPPORT)
- tjsp = new(g) TDBJSON(tdp, new(g) ZIPFAM(tdp));
+ tjsp = new(g) TDBJSON(tdp, new(g) UNZFAM(tdp));
#else // !ZIP_SUPPORT
sprintf(g->Message, MSG(NO_FEAT_SUPPORT), "ZIP");
return NULL;
@@ -151,7 +151,7 @@ PQRYRES JSONColumns(PGLOBAL g, char *db, PTOS topt, bool info)
if (tdp->Zipped) {
#if defined(ZIP_SUPPORT)
- tjnp = new(g)TDBJSN(tdp, new(g)ZIPFAM(tdp));
+ tjnp = new(g)TDBJSN(tdp, new(g)UNZFAM(tdp));
#else // !ZIP_SUPPORT
sprintf(g->Message, MSG(NO_FEAT_SUPPORT), "ZIP");
return NULL;
@@ -441,7 +441,14 @@ PTDB JSONDEF::GetTable(PGLOBAL g, MODE m)
if (Zipped) {
#if defined(ZIP_SUPPORT)
- txfp = new(g) ZIPFAM(this);
+ if (m == MODE_READ || m == MODE_UPDATE) {
+ txfp = new(g) UNZFAM(this);
+ } else if (m == MODE_INSERT) {
+ txfp = new(g) ZIPFAM(this);
+ } else {
+ strcpy(g->Message, "UPDATE/DELETE not supported for ZIP");
+ return NULL;
+ } // endif's m
#else // !ZIP_SUPPORT
sprintf(g->Message, MSG(NO_FEAT_SUPPORT), "ZIP");
return NULL;
@@ -479,7 +486,15 @@ PTDB JSONDEF::GetTable(PGLOBAL g, MODE m)
} else {
if (Zipped) {
#if defined(ZIP_SUPPORT)
- txfp = new(g)ZIPFAM(this);
+ if (m == MODE_READ || m == MODE_UPDATE) {
+ txfp = new(g) UNZFAM(this);
+ } else if (m == MODE_INSERT) {
+ strcpy(g->Message, "INSERT supported only for zipped JSON when pretty=0");
+ return NULL;
+ } else {
+ strcpy(g->Message, "UPDATE/DELETE not supported for ZIP");
+ return NULL;
+ } // endif's m
#else // !ZIP_SUPPORT
sprintf(g->Message, MSG(NO_FEAT_SUPPORT), "ZIP");
return NULL;
@@ -559,7 +574,7 @@ TDBJSN::TDBJSN(TDBJSN *tdbp) : TDBDOS(NULL, tdbp)
} // end of TDBJSN copy constructor
// Used for update
-PTDB TDBJSN::CopyOne(PTABS t)
+PTDB TDBJSN::Clone(PTABS t)
{
G = NULL;
PTDB tp;
@@ -574,7 +589,7 @@ PTDB TDBJSN::CopyOne(PTABS t)
} // endfor cp1
return tp;
- } // end of CopyOne
+ } // end of Clone
/***********************************************************************/
/* Allocate JSN column description block. */
@@ -1563,7 +1578,7 @@ TDBJSON::TDBJSON(PJTDB tdbp) : TDBJSN(tdbp)
} // end of TDBJSON copy constructor
// Used for update
-PTDB TDBJSON::CopyOne(PTABS t)
+PTDB TDBJSON::Clone(PTABS t)
{
PTDB tp;
PJCOL cp1, cp2;
@@ -1577,7 +1592,7 @@ PTDB TDBJSON::CopyOne(PTABS t)
} // endfor cp1
return tp;
- } // end of CopyOne
+ } // end of Clone
/***********************************************************************/
/* Make the document tree from the object path. */
diff --git a/storage/connect/tabjson.h b/storage/connect/tabjson.h
index c9d30d48f2a..924ce387900 100644
--- a/storage/connect/tabjson.h
+++ b/storage/connect/tabjson.h
@@ -82,7 +82,7 @@ public:
void SetG(PGLOBAL g) {G = g;}
// Methods
- virtual PTDB CopyOne(PTABS t);
+ virtual PTDB Clone(PTABS t);
virtual PCOL MakeCol(PGLOBAL g, PCOLDEF cdp, PCOL cprec, int n);
virtual PCOL InsertSpecialColumn(PCOL colp);
virtual int RowNumber(PGLOBAL g, bool b = FALSE)
@@ -188,7 +188,7 @@ class TDBJSON : public TDBJSN {
PJAR GetDoc(void) {return Doc;}
// Methods
- virtual PTDB CopyOne(PTABS t);
+ virtual PTDB Clone(PTABS t);
// Database routines
virtual int Cardinality(PGLOBAL g);
diff --git a/storage/connect/table.cpp b/storage/connect/table.cpp
index c21bb1660ea..916449be6c6 100644
--- a/storage/connect/table.cpp
+++ b/storage/connect/table.cpp
@@ -1,7 +1,7 @@
/************** Table C++ Functions Source Code File (.CPP) ************/
-/* Name: TABLE.CPP Version 2.7 */
+/* Name: TABLE.CPP Version 2.8 */
/* */
-/* (C) Copyright to the author Olivier BERTRAND 1999-2016 */
+/* (C) Copyright to the author Olivier BERTRAND 1999-2017 */
/* */
/* This file contains the TBX, TDB and OPJOIN classes functions. */
/***********************************************************************/
@@ -10,6 +10,7 @@
/* Include relevant MariaDB header file. */
/***********************************************************************/
#include "my_global.h"
+#include "sql_string.h"
/***********************************************************************/
/* Include required application header files */
@@ -40,8 +41,9 @@ void AddPointer(PTABS, void *);
/* TDB public constructors. */
/***********************************************************************/
TDB::TDB(PTABDEF tdp) : Tdb_No(++Tnum)
- {
- Use = USE_NO;
+{
+ To_Def = tdp;
+ Use = USE_NO;
To_Orig = NULL;
To_Filter = NULL;
To_CondFil = NULL;
@@ -49,14 +51,20 @@ TDB::TDB(PTABDEF tdp) : Tdb_No(++Tnum)
Name = (tdp) ? tdp->GetName() : NULL;
To_Table = NULL;
Columns = NULL;
- Degree = (tdp) ? tdp->GetDegree() : 0;
+ To_SetCols = NULL;
+ Degree = (tdp) ? tdp->GetDegree() : 0;
Mode = MODE_ANY;
Cardinal = -1;
- } // end of TDB standard constructor
+ MaxSize = -1;
+ Read_Only = (tdp) ? tdp->IsReadOnly() : false;
+ m_data_charset = (tdp) ? tdp->data_charset() : NULL;
+ csname = (tdp) ? tdp->csname : NULL;
+} // end of TDB standard constructor
TDB::TDB(PTDB tdbp) : Tdb_No(++Tnum)
- {
- Use = tdbp->Use;
+{
+ To_Def = tdbp->To_Def;
+ Use = tdbp->Use;
To_Orig = tdbp;
To_Filter = NULL;
To_CondFil = NULL;
@@ -64,12 +72,192 @@ TDB::TDB(PTDB tdbp) : Tdb_No(++Tnum)
Name = tdbp->Name;
To_Table = tdbp->To_Table;
Columns = NULL;
- Degree = tdbp->Degree;
+ To_SetCols = tdbp->To_SetCols; // ???
+ Degree = tdbp->Degree;
Mode = tdbp->Mode;
Cardinal = tdbp->Cardinal;
- } // end of TDB copy constructor
+ MaxSize = tdbp->MaxSize;
+ Read_Only = tdbp->IsReadOnly();
+ m_data_charset = tdbp->data_charset();
+ csname = tdbp->csname;
+} // end of TDB copy constructor
// Methods
+/***********************************************************************/
+/* Return the pointer on the charset of this table. */
+/***********************************************************************/
+CHARSET_INFO *TDB::data_charset(void)
+{
+ // If no DATA_CHARSET is specified, we assume that character
+ // set of the remote data is the same with CHARACTER SET
+ // definition of the SQL column.
+ return m_data_charset ? m_data_charset : &my_charset_bin;
+} // end of data_charset
+
+/***********************************************************************/
+/* Return the datapath of the DB this table belongs to. */
+/***********************************************************************/
+PSZ TDB::GetPath(void)
+{
+ return To_Def->GetPath();
+} // end of GetPath
+
+/***********************************************************************/
+/* Return true if name is a special column of this table. */
+/***********************************************************************/
+bool TDB::IsSpecial(PSZ name)
+{
+ for (PCOLDEF cdp = To_Def->GetCols(); cdp; cdp = cdp->GetNext())
+ if (!stricmp(cdp->GetName(), name) && (cdp->Flags & U_SPECIAL))
+ return true; // Special column to ignore while inserting
+
+ return false; // Not found or not special or not inserting
+} // end of IsSpecial
+
+/***********************************************************************/
+/* Initialize TDB based column description block construction. */
+/* name is used to call columns by name. */
+/* num is used by TBL to construct columns by index number. */
+/* Note: name=Null and num=0 for constructing all columns (select *) */
+/***********************************************************************/
+PCOL TDB::ColDB(PGLOBAL g, PSZ name, int num)
+{
+ int i;
+ PCOLDEF cdp;
+ PCOL cp, colp = NULL, cprec = NULL;
+
+ if (trace)
+ htrc("ColDB: am=%d colname=%s tabname=%s num=%d\n",
+ GetAmType(), SVP(name), Name, num);
+
+ for (cdp = To_Def->GetCols(), i = 1; cdp; cdp = cdp->GetNext(), i++)
+ if ((!name && !num) ||
+ (name && !stricmp(cdp->GetName(), name)) || num == i) {
+ /*****************************************************************/
+ /* Check for existence of desired column. */
+ /* Also find where to insert the new block. */
+ /*****************************************************************/
+ for (cp = Columns; cp; cp = cp->GetNext())
+ if ((num && cp->GetIndex() == i) ||
+ (name && !stricmp(cp->GetName(), name)))
+ break; // Found
+ else if (cp->GetIndex() < i)
+ cprec = cp;
+
+ if (trace)
+ htrc("cdp(%d).Name=%s cp=%p\n", i, cdp->GetName(), cp);
+
+ /*****************************************************************/
+ /* Now take care of Column Description Block. */
+ /*****************************************************************/
+ if (cp)
+ colp = cp;
+ else if (!(cdp->Flags & U_SPECIAL))
+ colp = MakeCol(g, cdp, cprec, i);
+ else if (Mode != MODE_INSERT)
+ colp = InsertSpcBlk(g, cdp);
+
+ if (trace)
+ htrc("colp=%p\n", colp);
+
+ if (name || num)
+ break;
+ else if (colp && !colp->IsSpecial())
+ cprec = colp;
+
+ } // endif Name
+
+ return (colp);
+} // end of ColDB
+
+/***********************************************************************/
+/* InsertSpecialColumn: Put a special column ahead of the column list.*/
+/***********************************************************************/
+PCOL TDB::InsertSpecialColumn(PCOL colp)
+{
+ if (!colp->IsSpecial())
+ return NULL;
+
+ colp->SetNext(Columns);
+ Columns = colp;
+ return colp;
+} // end of InsertSpecialColumn
+
+/***********************************************************************/
+/* Make a special COLBLK to insert in a table. */
+/***********************************************************************/
+PCOL TDB::InsertSpcBlk(PGLOBAL g, PCOLDEF cdp)
+{
+ //char *name = cdp->GetName();
+ char *name = cdp->GetFmt();
+ PCOLUMN cp;
+ PCOL colp;
+
+ cp = new(g)COLUMN(cdp->GetName());
+
+ if (!To_Table) {
+ strcpy(g->Message, "Cannot make special column: To_Table is NULL");
+ return NULL;
+ } else
+ cp->SetTo_Table(To_Table);
+
+ if (!stricmp(name, "FILEID") || !stricmp(name, "FDISK") ||
+ !stricmp(name, "FPATH") || !stricmp(name, "FNAME") ||
+ !stricmp(name, "FTYPE") || !stricmp(name, "SERVID")) {
+ if (!To_Def || !(To_Def->GetPseudo() & 2)) {
+ sprintf(g->Message, MSG(BAD_SPEC_COLUMN));
+ return NULL;
+ } // endif Pseudo
+
+ if (!stricmp(name, "FILEID"))
+ colp = new(g)FIDBLK(cp, OP_XX);
+ else if (!stricmp(name, "FDISK"))
+ colp = new(g)FIDBLK(cp, OP_FDISK);
+ else if (!stricmp(name, "FPATH"))
+ colp = new(g)FIDBLK(cp, OP_FPATH);
+ else if (!stricmp(name, "FNAME"))
+ colp = new(g)FIDBLK(cp, OP_FNAME);
+ else if (!stricmp(name, "FTYPE"))
+ colp = new(g)FIDBLK(cp, OP_FTYPE);
+ else
+ colp = new(g)SIDBLK(cp);
+
+ } else if (!stricmp(name, "TABID")) {
+ colp = new(g)TIDBLK(cp);
+ } else if (!stricmp(name, "PARTID")) {
+ colp = new(g)PRTBLK(cp);
+ //} else if (!stricmp(name, "CONID")) {
+ // colp = new(g) CIDBLK(cp);
+ } else if (!stricmp(name, "ROWID")) {
+ colp = new(g)RIDBLK(cp, false);
+ } else if (!stricmp(name, "ROWNUM")) {
+ colp = new(g)RIDBLK(cp, true);
+ } else {
+ sprintf(g->Message, MSG(BAD_SPECIAL_COL), name);
+ return NULL;
+ } // endif's name
+
+ if (!(colp = InsertSpecialColumn(colp))) {
+ sprintf(g->Message, MSG(BAD_SPECIAL_COL), name);
+ return NULL;
+ } // endif Insert
+
+ return (colp);
+} // end of InsertSpcBlk
+
+/***********************************************************************/
+/* Marks DOS/MAP table columns used in internal joins. */
+/* tdb2 is the top of tree or first tdb in chained tdb's and tdbp */
+/* points to the currently marked tdb. */
+/* Two questions here: exact meaning of U_J_INT ? */
+/* Why is the eventual reference to To_Key_Col not marked U_J_EXT ? */
+/***********************************************************************/
+void TDB::MarkDB(PGLOBAL, PTDB tdb2)
+{
+ if (trace)
+ htrc("DOS MarkDB: tdbp=%p tdb2=%p\n", this, tdb2);
+
+} // end of MarkDB
/***********************************************************************/
/* RowNumber: returns the current row ordinal number. */
@@ -86,7 +274,7 @@ PTDB TDB::Copy(PTABS t)
//PGLOBAL g = t->G; // Is this really useful ???
for (tdb1 = this; tdb1; tdb1 = tdb1->Next) {
- tp = tdb1->CopyOne(t);
+ tp = tdb1->Clone(t);
if (!outp)
outp = tp;
@@ -100,6 +288,15 @@ PTDB TDB::Copy(PTABS t)
return outp;
} // end of Copy
+/***********************************************************************/
+/* SetRecpos: Replace the table at the specified position. */
+/***********************************************************************/
+bool TDB::SetRecpos(PGLOBAL g, int)
+{
+ strcpy(g->Message, MSG(SETRECPOS_NIY));
+ return true;
+} // end of SetRecpos
+
void TDB::Print(PGLOBAL g, FILE *f, uint n)
{
PCOL cp;
@@ -135,34 +332,34 @@ void TDB::Print(PGLOBAL, char *ps, uint)
/***********************************************************************/
TDBASE::TDBASE(PTABDEF tdp) : TDB(tdp)
{
- To_Def = tdp;
+//To_Def = tdp;
To_Link = NULL;
To_Key_Col = NULL;
To_Kindex = NULL;
To_Xdp = NULL;
- To_SetCols = NULL;
+//To_SetCols = NULL;
Ftype = RECFM_NAF;
- MaxSize = -1;
+//MaxSize = -1;
Knum = 0;
- Read_Only = (tdp) ? tdp->IsReadOnly() : false;
- m_data_charset= (tdp) ? tdp->data_charset() : NULL;
- csname = (tdp) ? tdp->csname : NULL;
+//Read_Only = (tdp) ? tdp->IsReadOnly() : false;
+//m_data_charset= (tdp) ? tdp->data_charset() : NULL;
+//csname = (tdp) ? tdp->csname : NULL;
} // end of TDBASE constructor
TDBASE::TDBASE(PTDBASE tdbp) : TDB(tdbp)
{
- To_Def = tdbp->To_Def;
+//To_Def = tdbp->To_Def;
To_Link = tdbp->To_Link;
To_Key_Col = tdbp->To_Key_Col;
To_Kindex = tdbp->To_Kindex;
To_Xdp = tdbp->To_Xdp;
- To_SetCols = tdbp->To_SetCols; // ???
+//To_SetCols = tdbp->To_SetCols; // ???
Ftype = tdbp->Ftype;
- MaxSize = tdbp->MaxSize;
+//MaxSize = tdbp->MaxSize;
Knum = tdbp->Knum;
- Read_Only = tdbp->Read_Only;
- m_data_charset= tdbp->m_data_charset;
- csname = tdbp->csname;
+//Read_Only = tdbp->Read_Only;
+//m_data_charset= tdbp->m_data_charset;
+//csname = tdbp->csname;
} // end of TDBASE copy constructor
/***********************************************************************/
@@ -173,6 +370,7 @@ PCATLG TDBASE::GetCat(void)
return (To_Def) ? To_Def->GetCat() : NULL;
} // end of GetCat
+#if 0
/***********************************************************************/
/* Return the pointer on the charset of this table. */
/***********************************************************************/
@@ -334,6 +532,7 @@ PCOL TDBASE::InsertSpcBlk(PGLOBAL g, PCOLDEF cdp)
return (colp);
} // end of InsertSpcBlk
+#endif // 0
/***********************************************************************/
/* ResetTableOpt: Wrong for this table type. */
@@ -362,6 +561,7 @@ void TDBASE::ResetKindex(PGLOBAL g, PKXBASE kxp)
To_Kindex = kxp;
} // end of ResetKindex
+#if 0
/***********************************************************************/
/* SetRecpos: Replace the table at the specified position. */
/***********************************************************************/
@@ -370,6 +570,7 @@ bool TDBASE::SetRecpos(PGLOBAL g, int)
strcpy(g->Message, MSG(SETRECPOS_NIY));
return true;
} // end of SetRecpos
+#endif // 0
/***********************************************************************/
/* Methods */
@@ -379,6 +580,7 @@ void TDBASE::PrintAM(FILE *f, char *m)
fprintf(f, "%s AM(%d): mode=%d\n", m, GetAmType(), Mode);
} // end of PrintAM
+#if 0
/***********************************************************************/
/* Marks DOS/MAP table columns used in internal joins. */
/* tdb2 is the top of tree or first tdb in chained tdb's and tdbp */
@@ -392,6 +594,7 @@ void TDBASE::MarkDB(PGLOBAL, PTDB tdb2)
htrc("DOS MarkDB: tdbp=%p tdb2=%p\n", this, tdb2);
} // end of MarkDB
+#endif // 0
/* ---------------------------TDBCAT class --------------------------- */
diff --git a/storage/connect/tabmac.cpp b/storage/connect/tabmac.cpp
index e6e2abb54e2..bbaba591540 100644
--- a/storage/connect/tabmac.cpp
+++ b/storage/connect/tabmac.cpp
@@ -12,7 +12,7 @@
#include "global.h"
#include "plgdbsem.h"
//#include "catalog.h"
-#include "reldef.h"
+//#include "reldef.h"
#include "xtable.h"
#include "colblk.h"
#include "tabmac.h"
diff --git a/storage/connect/tabmac.h b/storage/connect/tabmac.h
index f9a66e82eaa..47565bb2541 100644
--- a/storage/connect/tabmac.h
+++ b/storage/connect/tabmac.h
@@ -52,7 +52,7 @@ class TDBMAC : public TDBASE {
//virtual PTDB Duplicate(PGLOBAL g) {return (PTDB)new(g) TDBMAC(g, this);}
// Methods
-//virtual PTDB CopyOne(PTABS t);
+//virtual PTDB Clone(PTABS t);
virtual int GetRecpos(void) {return N;}
virtual int RowNumber(PGLOBAL g, bool b = false) {return N;}
diff --git a/storage/connect/tabmul.cpp b/storage/connect/tabmul.cpp
index 22499801d07..78adde81d12 100644
--- a/storage/connect/tabmul.cpp
+++ b/storage/connect/tabmul.cpp
@@ -1,11 +1,11 @@
/************* TabMul C++ Program Source Code File (.CPP) **************/
/* PROGRAM NAME: TABMUL */
/* ------------- */
-/* Version 1.7 */
+/* Version 1.8 */
/* */
/* COPYRIGHT: */
/* ---------- */
-/* (C) Copyright to PlugDB Software Development 2003 - 2015 */
+/* (C) Copyright to PlugDB Software Development 2003 - 2017 */
/* Author: Olivier BERTRAND */
/* */
/* WHAT THIS PROGRAM DOES: */
@@ -73,7 +73,7 @@
/***********************************************************************/
/* TABMUL constructors. */
/***********************************************************************/
-TDBMUL::TDBMUL(PTDBASE tdbp) : TDBASE(tdbp->GetDef())
+TDBMUL::TDBMUL(PTDB tdbp) : TDBASE(tdbp->GetDef())
{
Tdbp = tdbp;
Filenames = NULL;
@@ -94,22 +94,22 @@ TDBMUL::TDBMUL(PTDBMUL tdbp) : TDBASE(tdbp)
} // end of TDBMUL copy constructor
// Method
-PTDB TDBMUL::CopyOne(PTABS t)
+PTDB TDBMUL::Clone(PTABS t)
{
PTDBMUL tp;
PGLOBAL g = t->G; // Is this really useful ???
tp = new(g) TDBMUL(this);
- tp->Tdbp = (PTDBASE)Tdbp->CopyOne(t);
+ tp->Tdbp = Tdbp->Clone(t);
tp->Columns = tp->Tdbp->GetColumns();
return tp;
- } // end of CopyOne
+ } // end of Clone
PTDB TDBMUL::Duplicate(PGLOBAL g)
{
PTDBMUL tmup = new(g) TDBMUL(this);
- tmup->Tdbp = (PTDBASE)Tdbp->Duplicate(g);
+ tmup->Tdbp = Tdbp->Duplicate(g);
return tmup;
} // end of Duplicate
@@ -658,7 +658,7 @@ TDBDIR::TDBDIR(PTDBDIR tdbp) : TDBASE(tdbp)
} // end of TDBDIR copy constructor
// Method
-PTDB TDBDIR::CopyOne(PTABS t)
+PTDB TDBDIR::Clone(PTABS t)
{
PTDB tp;
PGLOBAL g = t->G; // Is this really useful ???
@@ -666,7 +666,7 @@ PTDB TDBDIR::CopyOne(PTABS t)
tp = new(g) TDBDIR(this);
tp->SetColumns(Columns);
return tp;
- } // end of CopyOne
+ } // end of Clone
/***********************************************************************/
/* Initialize/get the components of the search file pattern. */
@@ -711,7 +711,7 @@ int TDBDIR::GetMaxSize(PGLOBAL g)
if (MaxSize < 0) {
int n = -1;
#if defined(__WIN__)
- intptr_t h;
+ int h;
// Start searching files in the target directory.
h = _findfirst(Path(g), &FileData);
@@ -974,7 +974,7 @@ TDBSDR::TDBSDR(PTDBSDR tdbp) : TDBDIR(tdbp)
} // end of TDBSDR copy constructor
// Method
-PTDB TDBSDR::CopyOne(PTABS t)
+PTDB TDBSDR::Clone(PTABS t)
{
PTDB tp;
PGLOBAL g = t->G; // Is this really useful ???
@@ -982,7 +982,7 @@ PTDB TDBSDR::CopyOne(PTABS t)
tp = new(g) TDBSDR(this);
tp->SetColumns(Columns);
return tp;
- } // end of CopyOne
+ } // end of Clone
/***********************************************************************/
/* SDR GetMaxSize: returns the number of retrieved files. */
@@ -1007,7 +1007,7 @@ int TDBSDR::FindInDir(PGLOBAL g)
// Start searching files in the target directory.
#if defined(__WIN__)
- intptr_t h = _findfirst(Path(g), &FileData);
+ int h = _findfirst(Path(g), &FileData);
if (h != -1) {
for (n = 1;; n++)
@@ -1251,7 +1251,7 @@ TDBDHR::TDBDHR(PTDBDHR tdbp) : TDBASE(tdbp)
} // end of TDBDHR copy constructor
// Method
-PTDB TDBDHR::CopyOne(PTABS t)
+PTDB TDBDHR::Clone(PTABS t)
{
PTDB tp;
PGLOBAL g = t->G; // Is this really useful ???
@@ -1259,7 +1259,7 @@ PTDB TDBDHR::CopyOne(PTABS t)
tp = new(g) TDBDHR(this);
tp->Columns = Columns;
return tp;
- } // end of CopyOne
+ } // end of Clone
/***********************************************************************/
/* Allocate DHR column description block. */
diff --git a/storage/connect/tabmul.h b/storage/connect/tabmul.h
index 53d7198eec7..51fa7f9000a 100644
--- a/storage/connect/tabmul.h
+++ b/storage/connect/tabmul.h
@@ -1,7 +1,7 @@
/*************** Tabmul H Declares Source Code File (.H) ***************/
-/* Name: TABMUL.H Version 1.4 */
+/* Name: TABMUL.H Version 1.5 */
/* */
-/* (C) Copyright to PlugDB Software Development 2003-2012 */
+/* (C) Copyright to PlugDB Software Development 2003-2017 */
/* Author: Olivier BERTRAND */
/* */
/* This file contains the TDBMUL and TDBDIR classes declares. */
@@ -28,7 +28,7 @@ class DllExport TDBMUL : public TDBASE {
//friend class MULCOL;
public:
// Constructor
- TDBMUL(PTDBASE tdbp);
+ TDBMUL(PTDB tdbp);
TDBMUL(PTDBMUL tdbp);
// Implementation
@@ -37,7 +37,7 @@ class DllExport TDBMUL : public TDBASE {
// Methods
virtual void ResetDB(void);
- virtual PTDB CopyOne(PTABS t);
+ virtual PTDB Clone(PTABS t);
virtual bool IsSame(PTDB tp) {return tp == (PTDB)Tdbp;}
virtual PSZ GetFile(PGLOBAL g) {return Tdbp->GetFile(g);}
virtual int GetRecpos(void) {return 0;}
@@ -61,7 +61,7 @@ class DllExport TDBMUL : public TDBASE {
protected:
// Members
- TDBASE *Tdbp; // Points to a (file) table class
+ PTDB Tdbp; // Points to a (file) table class
char* *Filenames; // Points to file names
int Rows; // Total rows of already read files
int Mul; // Type of multiple file list
@@ -112,7 +112,7 @@ class TDBDIR : public TDBASE {
{return (PTDB)new(g) TDBDIR(this);}
// Methods
- virtual PTDB CopyOne(PTABS t);
+ virtual PTDB Clone(PTABS t);
virtual int GetRecpos(void) {return iFile;}
// Database routines
@@ -134,7 +134,7 @@ class TDBDIR : public TDBASE {
int iFile; // Index of currently retrieved file
#if defined(__WIN__)
_finddata_t FileData; // Find data structure
- intptr_t Hsearch; // Search handle
+ intptr_t Hsearch; // Search handle
char Drive[_MAX_DRIVE]; // Drive name
#else // !__WIN__
struct stat Fileinfo; // File info structure
@@ -168,7 +168,7 @@ class TDBSDR : public TDBDIR {
{return (PTDB)new(g) TDBSDR(this);}
// Methods
- virtual PTDB CopyOne(PTABS t);
+ virtual PTDB Clone(PTABS t);
// Database routines
virtual int GetMaxSize(PGLOBAL g);
@@ -184,7 +184,7 @@ class TDBSDR : public TDBDIR {
struct _Sub_Dir *Next;
struct _Sub_Dir *Prev;
#if defined(__WIN__)
- intptr_t H; // Search handle
+ intptr_t H; // Search handle
#else // !__WIN__
DIR *D;
#endif // !__WIN__
diff --git a/storage/connect/tabmysql.cpp b/storage/connect/tabmysql.cpp
index 98a476bf94f..1a715819fc8 100644
--- a/storage/connect/tabmysql.cpp
+++ b/storage/connect/tabmysql.cpp
@@ -1,11 +1,11 @@
/************* TabMySQL C++ Program Source Code File (.CPP) *************/
/* PROGRAM NAME: TABMYSQL */
/* ------------- */
-/* Version 1.9 */
+/* Version 2.0 */
/* */
/* AUTHOR: */
/* ------- */
-/* Olivier BERTRAND 2007-2015 */
+/* Olivier BERTRAND 2007-2017 */
/* */
/* WHAT THIS PROGRAM DOES: */
/* ----------------------- */
@@ -54,9 +54,10 @@
#include "global.h"
#include "plgdbsem.h"
#include "xtable.h"
+#include "tabext.h"
#include "tabcol.h"
#include "colblk.h"
-#include "reldef.h"
+//#include "reldef.h"
#include "tabmysql.h"
#include "valblk.h"
#include "tabutil.h"
@@ -84,16 +85,16 @@ MYSQLDEF::MYSQLDEF(void)
{
Pseudo = 2; // SERVID is Ok but not ROWID
Hostname = NULL;
- Database = NULL;
- Tabname = NULL;
- Srcdef = NULL;
- Username = NULL;
- Password = NULL;
+//Tabschema = NULL;
+//Tabname = NULL;
+//Srcdef = NULL;
+//Username = NULL;
+//Password = NULL;
Portnumber = 0;
Isview = false;
Bind = false;
Delayed = false;
- Xsrc = false;
+//Xsrc = false;
Huge = false;
} // end of MYSQLDEF constructor
@@ -128,7 +129,7 @@ bool MYSQLDEF::GetServerInfo(PGLOBAL g, const char *server_name)
// TODO: We need to examine which of these can really be NULL
Hostname = PlugDup(g, server->host);
- Database = PlugDup(g, server->db);
+ Tabschema = PlugDup(g, server->db);
Username = PlugDup(g, server->username);
Password = PlugDup(g, server->password);
Portnumber = (server->port) ? server->port : GetDefaultPort();
@@ -200,7 +201,7 @@ bool MYSQLDEF::ParseURL(PGLOBAL g, char *url, bool b)
Tabname = (b) ? GetStringCatInfo(g, "Tabname", Name) : NULL;
if (trace)
- htrc("server: %s Tabname: %s", url, Tabname);
+ htrc("server: %s TableName: %s", url, Tabname);
Server = url;
return GetServerInfo(g, url);
@@ -253,10 +254,10 @@ bool MYSQLDEF::ParseURL(PGLOBAL g, char *url, bool b)
return true;
} // endif
- if ((Database = strchr(Hostname, '/'))) {
- *Database++ = 0;
+ if ((Tabschema = strchr(Hostname, '/'))) {
+ *Tabschema++ = 0;
- if ((Tabname = strchr(Database, '/'))) {
+ if ((Tabname = strchr(Tabschema, '/'))) {
*Tabname++ = 0;
// Make sure there's not an extra /
@@ -265,7 +266,7 @@ bool MYSQLDEF::ParseURL(PGLOBAL g, char *url, bool b)
return true;
} // endif /
- } // endif Tabname
+ } // endif TableName
} // endif database
@@ -283,8 +284,8 @@ bool MYSQLDEF::ParseURL(PGLOBAL g, char *url, bool b)
if (Hostname[0] == 0)
Hostname = (b) ? GetStringCatInfo(g, "Host", "localhost") : NULL;
- if (!Database || !*Database)
- Database = (b) ? GetStringCatInfo(g, "Database", "*") : NULL;
+ if (!Tabschema || !*Tabschema)
+ Tabschema = (b) ? GetStringCatInfo(g, "Database", "*") : NULL;
if (!Tabname || !*Tabname)
Tabname = (b) ? GetStringCatInfo(g, "Tabname", Name) : NULL;
@@ -320,7 +321,7 @@ bool MYSQLDEF::DefineAM(PGLOBAL g, LPCSTR am, int)
if (!url || !*url) {
// Not using the connection URL
Hostname = GetStringCatInfo(g, "Host", "localhost");
- Database = GetStringCatInfo(g, "Database", "*");
+ Tabschema = GetStringCatInfo(g, "Database", "*");
Tabname = GetStringCatInfo(g, "Name", Name); // Deprecated
Tabname = GetStringCatInfo(g, "Tabname", Tabname);
Username = GetStringCatInfo(g, "User", "*");
@@ -334,7 +335,7 @@ bool MYSQLDEF::DefineAM(PGLOBAL g, LPCSTR am, int)
Delayed = !!GetIntCatInfo("Delayed", 0);
} else {
// MYSQL access from a PROXY table
- Database = GetStringCatInfo(g, "Database", Schema ? Schema : PlugDup(g, "*"));
+ Tabschema = GetStringCatInfo(g, "Database", Tabschema ? Tabschema : PlugDup(g, "*"));
Isview = GetBoolCatInfo("View", false);
// We must get other connection parms from the calling table
@@ -348,12 +349,12 @@ bool MYSQLDEF::DefineAM(PGLOBAL g, LPCSTR am, int)
Portnumber = GetIntCatInfo("Port", GetDefaultPort());
Server = Hostname;
} else {
- char *locdb = Database;
+ char *locdb = Tabschema;
if (ParseURL(g, url))
return true;
- Database = locdb;
+ Tabschema = locdb;
} // endif url
Tabname = Name;
@@ -362,7 +363,7 @@ bool MYSQLDEF::DefineAM(PGLOBAL g, LPCSTR am, int)
if ((Srcdef = GetStringCatInfo(g, "Srcdef", NULL))) {
Read_Only = true;
Isview = true;
- } else if (CheckSelf(g, Hc->GetTable()->s, Hostname, Database,
+ } else if (CheckSelf(g, Hc->GetTable()->s, Hostname, Tabschema,
Tabname, Srcdef, Portnumber))
return true;
@@ -372,7 +373,7 @@ bool MYSQLDEF::DefineAM(PGLOBAL g, LPCSTR am, int)
// Specific for command executing tables
Xsrc = GetBoolCatInfo("Execsrc", false);
- Mxr = GetIntCatInfo("Maxerr", 0);
+ Maxerr = GetIntCatInfo("Maxerr", 0);
Huge = GetBoolCatInfo("Huge", false);
return false;
} // end of DefineAM
@@ -396,17 +397,17 @@ PTDB MYSQLDEF::GetTable(PGLOBAL g, MODE)
/***********************************************************************/
/* Implementation of the TDBMYSQL class. */
/***********************************************************************/
-TDBMYSQL::TDBMYSQL(PMYDEF tdp) : TDBASE(tdp)
+TDBMYSQL::TDBMYSQL(PMYDEF tdp) : TDBEXT(tdp)
{
if (tdp) {
Host = tdp->Hostname;
- Database = tdp->Database;
- Tabname = tdp->Tabname;
- Srcdef = tdp->Srcdef;
- User = tdp->Username;
- Pwd = tdp->Password;
+// Schema = tdp->Tabschema;
+// TableName = tdp->Tabname;
+// Srcdef = tdp->Srcdef;
+// User = tdp->Username;
+// Pwd = tdp->Password;
Server = tdp->Server;
- Qrystr = tdp->Qrystr;
+// Qrystr = tdp->Qrystr;
Quoted = MY_MAX(0, tdp->Quoted);
Port = tdp->Portnumber;
Isview = tdp->Isview;
@@ -415,14 +416,14 @@ TDBMYSQL::TDBMYSQL(PMYDEF tdp) : TDBASE(tdp)
Myc.m_Use = tdp->Huge;
} else {
Host = NULL;
- Database = NULL;
- Tabname = NULL;
- Srcdef = NULL;
- User = NULL;
- Pwd = NULL;
+// Schema = NULL;
+// TableName = NULL;
+// Srcdef = NULL;
+// User = NULL;
+// Pwd = NULL;
Server = NULL;
- Qrystr = NULL;
- Quoted = 0;
+// Qrystr = NULL;
+// Quoted = 0;
Port = 0;
Isview = false;
Prep = false;
@@ -430,39 +431,40 @@ TDBMYSQL::TDBMYSQL(PMYDEF tdp) : TDBASE(tdp)
} // endif tdp
Bind = NULL;
- Query = NULL;
+//Query = NULL;
Fetched = false;
m_Rc = RC_FX;
- AftRows = 0;
+//AftRows = 0;
N = -1;
- Nparm = 0;
+//Nparm = 0;
} // end of TDBMYSQL constructor
-TDBMYSQL::TDBMYSQL(PTDBMY tdbp) : TDBASE(tdbp)
+TDBMYSQL::TDBMYSQL(PTDBMY tdbp) : TDBEXT(tdbp)
{
Host = tdbp->Host;
- Database = tdbp->Database;
- Tabname = tdbp->Tabname;
- Srcdef = tdbp->Srcdef;
- User = tdbp->User;
- Pwd = tdbp->Pwd;
- Qrystr = tdbp->Qrystr;
- Quoted = tdbp->Quoted;
+//Schema = tdbp->Schema;
+//TableName = tdbp->TableName;
+//Srcdef = tdbp->Srcdef;
+//User = tdbp->User;
+//Pwd = tdbp->Pwd;
+//Qrystr = tdbp->Qrystr;
+//Quoted = tdbp->Quoted;
+ Server = tdbp->Server;
Port = tdbp->Port;
Isview = tdbp->Isview;
Prep = tdbp->Prep;
Delayed = tdbp->Delayed;
Bind = NULL;
- Query = tdbp->Query;
+//Query = tdbp->Query;
Fetched = tdbp->Fetched;
m_Rc = tdbp->m_Rc;
- AftRows = tdbp->AftRows;
+//AftRows = tdbp->AftRows;
N = tdbp->N;
- Nparm = tdbp->Nparm;
+//Nparm = tdbp->Nparm;
} // end of TDBMYSQL copy constructor
-// Is this really useful ???
-PTDB TDBMYSQL::CopyOne(PTABS t)
+// Is this really useful ??? --> Yes for UPDATE
+PTDB TDBMYSQL::Clone(PTABS t)
{
PTDB tp;
PCOL cp1, cp2;
@@ -477,7 +479,7 @@ PTDB TDBMYSQL::CopyOne(PTABS t)
} // endfor cp1
return tp;
- } // end of CopyOne
+ } // end of Clone
/***********************************************************************/
/* Allocate MYSQL column description block. */
@@ -504,10 +506,18 @@ bool TDBMYSQL::MakeSelect(PGLOBAL g, bool mx)
if (Query)
return false; // already done
- if (Srcdef) {
- Query = new(g)STRING(g, 0, Srcdef);
- return false;
- } // endif Srcdef
+ if (Srcdef) {
+ if (strstr(Srcdef, "%s")) {
+ char *fil;
+
+ fil = (To_CondFil) ? To_CondFil->Body : PlugDup(g, "1=1");
+ Query = new(g)STRING(g, strlen(Srcdef) + strlen(fil));
+ Query->SetLength(sprintf(Query->GetStr(), Srcdef, fil));
+ } else
+ Query = new(g)STRING(g, 0, Srcdef);
+
+ return false;
+ } // endif Srcdef
// Allocate the string used to contain Query
Query = new(g) STRING(g, 1023, "SELECT ");
@@ -540,7 +550,7 @@ bool TDBMYSQL::MakeSelect(PGLOBAL g, bool mx)
oom |= Query->Append(" FROM ");
oom |= Query->Append(tk);
- oom |= Query->Append(Tabname);
+ oom |= Query->Append(TableName);
oom |= Query->Append(tk);
len = Query->GetLength();
@@ -608,7 +618,7 @@ bool TDBMYSQL::MakeInsert(PGLOBAL g)
} // endif colp
// Below 40 is enough to contain the fixed part of the query
- len += (strlen(Tabname) + 40);
+ len += (strlen(TableName) + 40);
Query = new(g) STRING(g, len);
if (Delayed)
@@ -617,7 +627,7 @@ bool TDBMYSQL::MakeInsert(PGLOBAL g)
oom = Query->Set("INSERT INTO ");
oom |= Query->Append(tk);
- oom |= Query->Append(Tabname);
+ oom |= Query->Append(TableName);
oom |= Query->Append("` (");
for (colp = Columns; colp; colp = colp->GetNext()) {
@@ -653,11 +663,11 @@ bool TDBMYSQL::MakeInsert(PGLOBAL g)
/* MakeCommand: make the Update or Delete statement to send to the */
/* MySQL server. Limited to remote values and filtering. */
/***********************************************************************/
-int TDBMYSQL::MakeCommand(PGLOBAL g)
+bool TDBMYSQL::MakeCommand(PGLOBAL g)
{
Query = new(g) STRING(g, strlen(Qrystr) + 64);
- if (Quoted > 0 || stricmp(Name, Tabname)) {
+ if (Quoted > 0 || stricmp(Name, TableName)) {
char *p, *qrystr, name[68];
bool qtd = Quoted > 0;
@@ -678,29 +688,29 @@ int TDBMYSQL::MakeCommand(PGLOBAL g)
if (qtd && *(p-1) == ' ') {
oom |= Query->Append('`');
- oom |= Query->Append(Tabname);
+ oom |= Query->Append(TableName);
oom |= Query->Append('`');
} else
- oom |= Query->Append(Tabname);
+ oom |= Query->Append(TableName);
oom |= Query->Append(Qrystr + (p - qrystr) + strlen(name));
if (oom) {
strcpy(g->Message, "MakeCommand: Out of memory");
- return RC_FX;
+ return true;
} else
strlwr(strcpy(qrystr, Query->GetStr()));
} else {
sprintf(g->Message, "Cannot use this %s command",
(Mode == MODE_UPDATE) ? "UPDATE" : "DELETE");
- return RC_FX;
+ return true;
} // endif p
} else
(void)Query->Set(Qrystr);
- return RC_OK;
+ return false;
} // end of MakeCommand
#if 0
@@ -727,7 +737,7 @@ int TDBMYSQL::MakeUpdate(PGLOBAL g)
} // endif sscanf
assert(!stricmp(cmd, "update"));
- strcat(strcat(strcat(strcpy(Query, "UPDATE "), qc), Tabname), qc);
+ strcat(strcat(strcat(strcpy(Query, "UPDATE "), qc), TableName), qc);
strcat(Query, end);
return RC_OK;
} // end of MakeUpdate
@@ -754,7 +764,7 @@ int TDBMYSQL::MakeDelete(PGLOBAL g)
} // endif sscanf
assert(!stricmp(cmd, "delete") && !stricmp(from, "from"));
- strcat(strcat(strcat(strcpy(Query, "DELETE FROM "), qc), Tabname), qc);
+ strcat(strcat(strcat(strcpy(Query, "DELETE FROM "), qc), TableName), qc);
if (*end)
strcat(Query, end);
@@ -776,15 +786,15 @@ int TDBMYSQL::Cardinality(PGLOBAL g)
char query[96];
MYSQLC myc;
- if (myc.Open(g, Host, Database, User, Pwd, Port, csname))
+ if (myc.Open(g, Host, Schema, User, Pwd, Port, csname))
return -1;
strcpy(query, "SELECT COUNT(*) FROM ");
if (Quoted > 0)
- strcat(strcat(strcat(query, "`"), Tabname), "`");
+ strcat(strcat(strcat(query, "`"), TableName), "`");
else
- strcat(query, Tabname);
+ strcat(query, TableName);
Cardinal = myc.GetTableSize(g, query);
myc.Close();
@@ -794,6 +804,7 @@ int TDBMYSQL::Cardinality(PGLOBAL g)
return Cardinal;
} // end of Cardinality
+#if 0
/***********************************************************************/
/* MYSQL GetMaxSize: returns the maximum number of rows in the table. */
/***********************************************************************/
@@ -812,6 +823,7 @@ int TDBMYSQL::GetMaxSize(PGLOBAL g)
return MaxSize;
} // end of GetMaxSize
+#endif // 0
/***********************************************************************/
/* This a fake routine as ROWID does not exist in MySQL. */
@@ -872,7 +884,7 @@ bool TDBMYSQL::OpenDB(PGLOBAL g)
/* servers allowing concurency in getting results ??? */
/*********************************************************************/
if (!Myc.Connected()) {
- if (Myc.Open(g, Host, Database, User, Pwd, Port, csname))
+ if (Myc.Open(g, Host, Schema, User, Pwd, Port, csname))
return true;
} // endif Connected
@@ -931,14 +943,14 @@ bool TDBMYSQL::OpenDB(PGLOBAL g)
char cmd[64];
int w;
- sprintf(cmd, "ALTER TABLE `%s` DISABLE KEYS", Tabname);
+ sprintf(cmd, "ALTER TABLE `%s` DISABLE KEYS", TableName);
m_Rc = Myc.ExecSQL(g, cmd, &w); // may fail for some engines
} // endif m_Rc
} else
// m_Rc = (Mode == MODE_DELETE) ? MakeDelete(g) : MakeUpdate(g);
- m_Rc = MakeCommand(g);
+ m_Rc = (MakeCommand(g)) ? RC_FX : RC_OK;
if (m_Rc == RC_FX) {
Myc.Close();
@@ -1030,7 +1042,7 @@ int TDBMYSQL::SendCommand(PGLOBAL g)
if (Myc.ExecSQLcmd(g, Query->GetStr(), &w) == RC_NF) {
AftRows = Myc.m_Afrw;
- sprintf(g->Message, "%s: %d affected rows", Tabname, AftRows);
+ sprintf(g->Message, "%s: %d affected rows", TableName, AftRows);
PushWarning(g, this, 0); // 0 means a Note
if (trace)
@@ -1039,7 +1051,7 @@ int TDBMYSQL::SendCommand(PGLOBAL g)
if (w && Myc.ExecSQL(g, "SHOW WARNINGS") == RC_OK) {
// We got warnings from the remote server
while (Myc.Fetch(g, -1) == RC_OK) {
- sprintf(g->Message, "%s: (%s) %s", Tabname,
+ sprintf(g->Message, "%s: (%s) %s", TableName,
Myc.GetCharField(1), Myc.GetCharField(2));
PushWarning(g, this);
} // endwhile Fetch
@@ -1116,8 +1128,7 @@ int TDBMYSQL::ReadDB(PGLOBAL g)
int rc;
if (trace > 1)
- htrc("MySQL ReadDB: R%d Mode=%d key=%p link=%p Kindex=%p\n",
- GetTdb_No(), Mode, To_Key_Col, To_Link, To_Kindex);
+ htrc("MySQL ReadDB: R%d Mode=%d\n", GetTdb_No(), Mode);
if (Mode == MODE_UPDATE || Mode == MODE_DELETE)
return SendCommand(g);
@@ -1205,7 +1216,7 @@ void TDBMYSQL::CloseDB(PGLOBAL g)
PDBUSER dup = PlgGetUser(g);
dup->Step = "Enabling indexes";
- sprintf(cmd, "ALTER TABLE `%s` ENABLE KEYS", Tabname);
+ sprintf(cmd, "ALTER TABLE `%s` ENABLE KEYS", TableName);
Myc.m_Rows = -1; // To execute the query
m_Rc = Myc.ExecSQL(g, cmd, &w); // May fail for some engines
} // endif m_Rc
@@ -1463,7 +1474,7 @@ TDBMYEXC::TDBMYEXC(PMYDEF tdp) : TDBMYSQL(tdp)
Havew = false;
Isw = false;
Warnings = 0;
- Mxr = tdp->Mxr;
+ Mxr = tdp->Maxerr;
Nerr = 0;
} // end of TDBMYEXC constructor
@@ -1479,7 +1490,7 @@ TDBMYEXC::TDBMYEXC(PTDBMYX tdbp) : TDBMYSQL(tdbp)
} // end of TDBMYEXC copy constructor
// Is this really useful ???
-PTDB TDBMYEXC::CopyOne(PTABS t)
+PTDB TDBMYEXC::Clone(PTABS t)
{
PTDB tp;
PCOL cp1, cp2;
@@ -1494,7 +1505,7 @@ PTDB TDBMYEXC::CopyOne(PTABS t)
} // endfor cp1
return tp;
- } // end of CopyOne
+ } // end of Clone
/***********************************************************************/
/* Allocate MYSQL column description block. */
@@ -1565,7 +1576,7 @@ bool TDBMYEXC::OpenDB(PGLOBAL g)
/* servers allowing concurency in getting results ??? */
/*********************************************************************/
if (!Myc.Connected())
- if (Myc.Open(g, Host, Database, User, Pwd, Port))
+ if (Myc.Open(g, Host, Schema, User, Pwd, Port))
return true;
Use = USE_OPEN; // Do it now in case we are recursively called
@@ -1728,7 +1739,7 @@ void MYXCOL::WriteColumn(PGLOBAL)
TDBMCL::TDBMCL(PMYDEF tdp) : TDBCAT(tdp)
{
Host = tdp->Hostname;
- Db = tdp->Database;
+ Db = tdp->Tabschema;
Tab = tdp->Tabname;
User = tdp->Username;
Pwd = tdp->Password;
diff --git a/storage/connect/tabmysql.h b/storage/connect/tabmysql.h
index edb15b5cca6..050fa59259b 100644
--- a/storage/connect/tabmysql.h
+++ b/storage/connect/tabmysql.h
@@ -1,4 +1,4 @@
-// TDBMYSQL.H Olivier Bertrand 2007-2014
+// TDBMYSQL.H Olivier Bertrand 2007-2017
#include "myconn.h" // MySQL connection declares
typedef class MYSQLDEF *PMYDEF;
@@ -18,7 +18,7 @@ typedef class MYSQLC *PMYC;
/***********************************************************************/
/* MYSQL table. */
/***********************************************************************/
-class MYSQLDEF : public TABDEF {/* Logical table description */
+class MYSQLDEF : public EXTDEF {/* Logical table description */
friend class TDBMYSQL;
friend class TDBMYEXC;
friend class TDBMCL;
@@ -27,19 +27,18 @@ class MYSQLDEF : public TABDEF {/* Logical table description */
// Constructor
MYSQLDEF(void);
-
// Implementation
virtual const char *GetType(void) {return "MYSQL";}
inline PSZ GetHostname(void) {return Hostname;};
- inline PSZ GetDatabase(void) {return Database;};
- inline PSZ GetTabname(void) {return Tabname;}
- inline PSZ GetSrcdef(void) {return Srcdef;}
- inline PSZ GetUsername(void) {return Username;};
- inline PSZ GetPassword(void) {return Password;};
+//inline PSZ GetDatabase(void) {return Tabschema;};
+//inline PSZ GetTabname(void) {return Tabname;}
+//inline PSZ GetSrcdef(void) {return Srcdef;}
+//inline PSZ GetUsername(void) {return Username;};
+//inline PSZ GetPassword(void) {return Password;};
inline int GetPortnumber(void) {return Portnumber;}
// Methods
- virtual int Indexable(void) {return 2;}
+//virtual int Indexable(void) {return 2;}
virtual bool DefineAM(PGLOBAL g, LPCSTR am, int poff);
virtual PTDB GetTable(PGLOBAL g, MODE m);
bool ParseURL(PGLOBAL g, char *url, bool b = true);
@@ -48,27 +47,27 @@ class MYSQLDEF : public TABDEF {/* Logical table description */
protected:
// Members
PSZ Hostname; /* Host machine to use */
- PSZ Database; /* Database to be used by server */
- PSZ Tabname; /* External table name */
- PSZ Srcdef; /* The source table SQL definition */
- PSZ Username; /* User logon name */
- PSZ Password; /* Password logon info */
+//PSZ Tabschema; /* Database to be used by server */
+//PSZ Tabname; /* External table name */
+//PSZ Srcdef; /* The source table SQL definition */
+//PSZ Username; /* User logon name */
+//PSZ Password; /* Password logon info */
PSZ Server; /* PServerID */
- PSZ Qrystr; /* The original query */
+//PSZ Qrystr; /* The original query */
int Portnumber; /* MySQL port number (0 = default) */
- int Mxr; /* Maxerr for an Exec table */
- int Quoted; /* Identifier quoting level */
+//int Maxerr; /* Maxerr for an Exec table */
+//int Quoted; /* Identifier quoting level */
bool Isview; /* true if this table is a MySQL view */
bool Bind; /* Use prepared statement on insert */
bool Delayed; /* Delayed insert */
- bool Xsrc; /* Execution type */
+//bool Xsrc; /* Execution type */
bool Huge; /* True for big table */
}; // end of MYSQLDEF
/***********************************************************************/
/* This is the class declaration for the MYSQL table. */
/***********************************************************************/
-class TDBMYSQL : public TDBASE {
+class TDBMYSQL : public TDBEXT {
friend class MYSQLCOL;
public:
// Constructor
@@ -80,7 +79,7 @@ class TDBMYSQL : public TDBASE {
virtual PTDB Duplicate(PGLOBAL g) {return (PTDB)new(g) TDBMYSQL(this);}
// Methods
- virtual PTDB CopyOne(PTABS t);
+ virtual PTDB Clone(PTABS t);
//virtual int GetAffectedRows(void) {return AftRows;}
virtual int GetRecpos(void) {return N;}
virtual int GetProgMax(PGLOBAL g);
@@ -88,12 +87,12 @@ class TDBMYSQL : public TDBASE {
virtual int RowNumber(PGLOBAL g, bool b = false);
virtual bool IsView(void) {return Isview;}
virtual PSZ GetServer(void) {return Server;}
- void SetDatabase(LPCSTR db) {Database = (char*)db;}
+ void SetDatabase(LPCSTR db) {Schema = (char*)db;}
- // Database routines
+ // Schema routines
virtual PCOL MakeCol(PGLOBAL g, PCOLDEF cdp, PCOL cprec, int n);
virtual int Cardinality(PGLOBAL g);
- virtual int GetMaxSize(PGLOBAL g);
+//virtual int GetMaxSize(PGLOBAL g);
virtual bool OpenDB(PGLOBAL g);
virtual int ReadDB(PGLOBAL g);
virtual int WriteDB(PGLOBAL g);
@@ -111,7 +110,7 @@ class TDBMYSQL : public TDBASE {
bool MakeSelect(PGLOBAL g, bool mx);
bool MakeInsert(PGLOBAL g);
int BindColumns(PGLOBAL g);
- int MakeCommand(PGLOBAL g);
+ virtual bool MakeCommand(PGLOBAL g);
//int MakeUpdate(PGLOBAL g);
//int MakeDelete(PGLOBAL g);
int SendCommand(PGLOBAL g);
@@ -119,25 +118,25 @@ class TDBMYSQL : public TDBASE {
// Members
MYSQLC Myc; // MySQL connection class
MYSQL_BIND *Bind; // To the MySQL bind structure array
- PSTRG Query; // Constructed SQL query
+//PSTRG Query; // Constructed SQL query
char *Host; // Host machine to use
- char *User; // User logon info
- char *Pwd; // Password logon info
- char *Database; // Database to be used by server
- char *Tabname; // External table name
- char *Srcdef; // The source table SQL definition
+//char *User; // User logon info
+//char *Pwd; // Password logon info
+//char *Schema; // Database to be used by server
+//char *TableName; // External table name
+//char *Srcdef; // The source table SQL definition
char *Server; // The server ID
- char *Qrystr; // The original query
+//char *Qrystr; // The original query
bool Fetched; // True when fetch was done
bool Isview; // True if this table is a MySQL view
bool Prep; // Use prepared statement on insert
bool Delayed; // Use delayed insert
int m_Rc; // Return code from command
- int AftRows; // The number of affected rows
+//int AftRows; // The number of affected rows
int N; // The current table index
int Port; // MySQL port number (0 = default)
- int Nparm; // The number of statement parameters
- int Quoted; // The identifier quoting level
+//int Nparm; // The number of statement parameters
+//int Quoted; // The identifier quoting level
}; // end of class TDBMYSQL
/***********************************************************************/
@@ -162,9 +161,6 @@ class MYSQLCOL : public COLBLK {
bool FindRank(PGLOBAL g);
protected:
- // Default constructor not to be used
- MYSQLCOL(void) {}
-
// Members
MYSQL_BIND *Bind; // This column bind structure pointer
PVAL To_Val; // To value used for Update/Insert
@@ -187,7 +183,7 @@ class TDBMYEXC : public TDBMYSQL {
virtual PTDB Duplicate(PGLOBAL g) {return (PTDB)new(g) TDBMYEXC(this);}
// Methods
- virtual PTDB CopyOne(PTABS t);
+ virtual PTDB Clone(PTABS t);
virtual bool IsView(void) {return Isview;}
// Database routines
@@ -228,9 +224,6 @@ class MYXCOL : public MYSQLCOL {
virtual void WriteColumn(PGLOBAL g);
protected:
- // Default constructor not to be used
- MYXCOL(void) {}
-
// Members
char *Buffer; // To get returned message
int Flag; // Column content desc
diff --git a/storage/connect/taboccur.cpp b/storage/connect/taboccur.cpp
index 07e260154e0..07272d1b298 100644
--- a/storage/connect/taboccur.cpp
+++ b/storage/connect/taboccur.cpp
@@ -1,7 +1,7 @@
/************ TabOccur CPP Declares Source Code File (.CPP) ************/
-/* Name: TABOCCUR.CPP Version 1.1 */
+/* Name: TABOCCUR.CPP Version 1.2 */
/* */
-/* (C) Copyright to the author Olivier BERTRAND 2013 - 2015 */
+/* (C) Copyright to the author Olivier BERTRAND 2013 - 2017 */
/* */
/* OCCUR: Table that provides a view of a source table where the */
/* contain of several columns of the source table is placed in only */
@@ -39,12 +39,13 @@
/***********************************************************************/
#include "global.h"
#include "plgdbsem.h"
-#include "reldef.h"
+#include "xtable.h"
+#include "tabext.h"
+//#include "reldef.h"
#include "filamtxt.h"
#include "tabdos.h"
#include "tabcol.h"
#include "taboccur.h"
-#include "xtable.h"
#include "tabmysql.h"
#include "ha_connect.h"
diff --git a/storage/connect/tabodbc.cpp b/storage/connect/tabodbc.cpp
index f3ffc99ac15..488acdd330d 100644
--- a/storage/connect/tabodbc.cpp
+++ b/storage/connect/tabodbc.cpp
@@ -67,10 +67,11 @@
#include "plgdbsem.h"
#include "mycat.h"
#include "xtable.h"
+#include "tabext.h"
#include "odbccat.h"
#include "tabodbc.h"
#include "tabmul.h"
-#include "reldef.h"
+//#include "reldef.h"
#include "tabcol.h"
#include "valblk.h"
#include "ha_connect.h"
@@ -95,10 +96,9 @@ bool ExactInfo(void);
/***********************************************************************/
ODBCDEF::ODBCDEF(void)
{
- Connect = Tabname = Tabschema = Username = Password = NULL;
- Tabcat = Colpat = Srcdef = Qchar = Qrystr = Sep = NULL;
- Catver = Options = Cto = Qto = Quoted = Maxerr = Maxres = Memory = 0;
- Scrollable = Xsrc = UseCnc = false;
+ Connect = NULL;
+ Catver = 0;
+ UseCnc = false;
} // end of ODBCDEF constructor
/***********************************************************************/
@@ -113,47 +113,50 @@ bool ODBCDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
return true;
} // endif Connect
- Tabname = GetStringCatInfo(g, "Name",
- (Catfunc & (FNC_TABLE | FNC_COL)) ? NULL : Name);
- Tabname = GetStringCatInfo(g, "Tabname", Tabname);
- Tabschema = GetStringCatInfo(g, "Dbname", NULL);
- Tabschema = GetStringCatInfo(g, "Schema", Tabschema);
- Tabcat = GetStringCatInfo(g, "Qualifier", NULL);
- Tabcat = GetStringCatInfo(g, "Catalog", Tabcat);
- Username = GetStringCatInfo(g, "User", NULL);
- Password = GetStringCatInfo(g, "Password", NULL);
-
- if ((Srcdef = GetStringCatInfo(g, "Srcdef", NULL)))
- Read_Only = true;
-
- Qrystr = GetStringCatInfo(g, "Query_String", "?");
- Sep = GetStringCatInfo(g, "Separator", NULL);
+ if (EXTDEF::DefineAM(g, am, poff))
+ return true;
+
+ // Tabname = GetStringCatInfo(g, "Name",
+ // (Catfunc & (FNC_TABLE | FNC_COL)) ? NULL : Name);
+ // Tabname = GetStringCatInfo(g, "Tabname", Tabname);
+ // Tabschema = GetStringCatInfo(g, "Dbname", NULL);
+ // Tabschema = GetStringCatInfo(g, "Schema", Tabschema);
+ // Tabcat = GetStringCatInfo(g, "Qualifier", NULL);
+ // Tabcat = GetStringCatInfo(g, "Catalog", Tabcat);
+ //Username = GetStringCatInfo(g, "User", NULL);
+ // Password = GetStringCatInfo(g, "Password", NULL);
+
+ // if ((Srcdef = GetStringCatInfo(g, "Srcdef", NULL)))
+ // Read_Only = true;
+
+ // Qrystr = GetStringCatInfo(g, "Query_String", "?");
+ // Sep = GetStringCatInfo(g, "Separator", NULL);
Catver = GetIntCatInfo("Catver", 2);
- Xsrc = GetBoolCatInfo("Execsrc", FALSE);
- Maxerr = GetIntCatInfo("Maxerr", 0);
- Maxres = GetIntCatInfo("Maxres", 0);
- Quoted = GetIntCatInfo("Quoted", 0);
+ //Xsrc = GetBoolCatInfo("Execsrc", FALSE);
+ //Maxerr = GetIntCatInfo("Maxerr", 0);
+ //Maxres = GetIntCatInfo("Maxres", 0);
+ //Quoted = GetIntCatInfo("Quoted", 0);
Options = ODBConn::noOdbcDialog;
//Options = ODBConn::noOdbcDialog | ODBConn::useCursorLib;
Cto= GetIntCatInfo("ConnectTimeout", DEFAULT_LOGIN_TIMEOUT);
Qto= GetIntCatInfo("QueryTimeout", DEFAULT_QUERY_TIMEOUT);
- if ((Scrollable = GetBoolCatInfo("Scrollable", false)) && !Elemt)
- Elemt = 1; // Cannot merge SQLFetch and SQLExtendedFetch
+ //if ((Scrollable = GetBoolCatInfo("Scrollable", false)) && !Elemt)
+ // Elemt = 1; // Cannot merge SQLFetch and SQLExtendedFetch
- if (Catfunc == FNC_COL)
- Colpat = GetStringCatInfo(g, "Colpat", NULL);
+ //if (Catfunc == FNC_COL)
+ // Colpat = GetStringCatInfo(g, "Colpat", NULL);
- if (Catfunc == FNC_TABLE)
- Tabtyp = GetStringCatInfo(g, "Tabtype", NULL);
+ //if (Catfunc == FNC_TABLE)
+ // Tabtyp = GetStringCatInfo(g, "Tabtype", NULL);
UseCnc = GetBoolCatInfo("UseDSN", false);
// Memory was Boolean, it is now integer
- if (!(Memory = GetIntCatInfo("Memory", 0)))
- Memory = GetBoolCatInfo("Memory", false) ? 1 : 0;
+ //if (!(Memory = GetIntCatInfo("Memory", 0)))
+ // Memory = GetBoolCatInfo("Memory", false) ? 1 : 0;
- Pseudo = 2; // FILID is Ok but not ROWID
+ //Pseudo = 2; // FILID is Ok but not ROWID
return false;
} // end of DefineAM
@@ -162,7 +165,7 @@ bool ODBCDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
/***********************************************************************/
PTDB ODBCDEF::GetTable(PGLOBAL g, MODE m)
{
- PTDBASE tdbp = NULL;
+ PTDB tdbp = NULL;
/*********************************************************************/
/* Allocate a TDB of the proper type. */
@@ -200,103 +203,103 @@ PTDB ODBCDEF::GetTable(PGLOBAL g, MODE m)
/***********************************************************************/
/* Implementation of the TDBODBC class. */
/***********************************************************************/
-TDBODBC::TDBODBC(PODEF tdp) : TDBASE(tdp)
+TDBODBC::TDBODBC(PODEF tdp) : TDBEXT(tdp)
{
Ocp = NULL;
Cnp = NULL;
if (tdp) {
Connect = tdp->Connect;
- TableName = tdp->Tabname;
- Schema = tdp->Tabschema;
+ //TableName = tdp->Tabname;
+ //Schema = tdp->Tabschema;
Ops.User = tdp->Username;
Ops.Pwd = tdp->Password;
- Catalog = tdp->Tabcat;
- Srcdef = tdp->Srcdef;
- Qrystr = tdp->Qrystr;
- Sep = tdp->GetSep();
- Options = tdp->Options;
+ //Catalog = tdp->Tabcat;
+ //Srcdef = tdp->Srcdef;
+ //Qrystr = tdp->Qrystr;
+ //Sep = tdp->GetSep();
+ //Options = tdp->Options;
Ops.Cto = tdp->Cto;
Ops.Qto = tdp->Qto;
- Quoted = MY_MAX(0, tdp->GetQuoted());
- Rows = tdp->GetElemt();
+ //Quoted = MY_MAX(0, tdp->GetQuoted());
+ //Rows = tdp->GetElemt();
Catver = tdp->Catver;
- Memory = tdp->Memory;
- Scrollable = tdp->Scrollable;
+ //Memory = tdp->Memory;
+ //Scrollable = tdp->Scrollable;
Ops.UseCnc = tdp->UseCnc;
} else {
Connect = NULL;
- TableName = NULL;
- Schema = NULL;
+ //TableName = NULL;
+ //Schema = NULL;
Ops.User = NULL;
Ops.Pwd = NULL;
- Catalog = NULL;
- Srcdef = NULL;
- Qrystr = NULL;
- Sep = 0;
- Options = 0;
+ //Catalog = NULL;
+ //Srcdef = NULL;
+ //Qrystr = NULL;
+ //Sep = 0;
+ //Options = 0;
Ops.Cto = DEFAULT_LOGIN_TIMEOUT;
Ops.Qto = DEFAULT_QUERY_TIMEOUT;
- Quoted = 0;
- Rows = 0;
+ //Quoted = 0;
+ //Rows = 0;
Catver = 0;
- Memory = 0;
- Scrollable = false;
+ //Memory = 0;
+ //Scrollable = false;
Ops.UseCnc = false;
} // endif tdp
- Quote = NULL;
- Query = NULL;
- Count = NULL;
+ //Quote = NULL;
+ //Query = NULL;
+ //Count = NULL;
//Where = NULL;
- MulConn = NULL;
- DBQ = NULL;
- Qrp = NULL;
- Fpos = 0;
- Curpos = 0;
- AftRows = 0;
- CurNum = 0;
- Rbuf = 0;
- BufSize = 0;
- Nparm = 0;
- Placed = false;
+ //MulConn = NULL;
+ //DBQ = NULL;
+ //Qrp = NULL;
+ //Fpos = 0;
+ //Curpos = 0;
+ //AftRows = 0;
+ //CurNum = 0;
+ //Rbuf = 0;
+ //BufSize = 0;
+ //Nparm = 0;
+ //Placed = false;
} // end of TDBODBC standard constructor
-TDBODBC::TDBODBC(PTDBODBC tdbp) : TDBASE(tdbp)
+TDBODBC::TDBODBC(PTDBODBC tdbp) : TDBEXT(tdbp)
{
Ocp = tdbp->Ocp; // is that right ?
Cnp = tdbp->Cnp;
Connect = tdbp->Connect;
- TableName = tdbp->TableName;
- Schema = tdbp->Schema;
+ //TableName = tdbp->TableName;
+ //Schema = tdbp->Schema;
Ops = tdbp->Ops;
- Catalog = tdbp->Catalog;
- Srcdef = tdbp->Srcdef;
- Qrystr = tdbp->Qrystr;
- Memory = tdbp->Memory;
- Scrollable = tdbp->Scrollable;
- Quote = tdbp->Quote;
- Query = tdbp->Query;
- Count = tdbp->Count;
+ //Catalog = tdbp->Catalog;
+ //Srcdef = tdbp->Srcdef;
+ //Qrystr = tdbp->Qrystr;
+ //Memory = tdbp->Memory;
+ //Scrollable = tdbp->Scrollable;
+ //Quote = tdbp->Quote;
+ //Query = tdbp->Query;
+ //Count = tdbp->Count;
//Where = tdbp->Where;
- MulConn = tdbp->MulConn;
- DBQ = tdbp->DBQ;
- Options = tdbp->Options;
- Quoted = tdbp->Quoted;
- Rows = tdbp->Rows;
- Fpos = 0;
- Curpos = 0;
- AftRows = 0;
- CurNum = 0;
- Rbuf = 0;
- BufSize = tdbp->BufSize;
- Nparm = tdbp->Nparm;
- Qrp = tdbp->Qrp;
- Placed = false;
+ //MulConn = tdbp->MulConn;
+ //DBQ = tdbp->DBQ;
+ //Options = tdbp->Options;
+ //Quoted = tdbp->Quoted;
+ //Rows = tdbp->Rows;
+ //Fpos = 0;
+ //Curpos = 0;
+ //AftRows = 0;
+ //CurNum = 0;
+ //Rbuf = 0;
+ //BufSize = tdbp->BufSize;
+ //Nparm = tdbp->Nparm;
+ //Qrp = tdbp->Qrp;
+ //Placed = false;
} // end of TDBODBC copy constructor
// Method
-PTDB TDBODBC::CopyOne(PTABS t)
+PTDB TDBODBC::Clone(PTABS t)
{
PTDB tp;
PODBCCOL cp1, cp2;
@@ -386,6 +389,7 @@ void TDBODBC::SetFile(PGLOBAL g, PSZ fn)
DBQ = fn;
} // end of SetFile
+#if 0
/******************************************************************/
/* Convert an UTF-8 string to latin characters. */
/******************************************************************/
@@ -414,7 +418,15 @@ bool TDBODBC::MakeSQL(PGLOBAL g, bool cnt)
PCOL colp;
if (Srcdef) {
- Query = new(g)STRING(g, 0, Srcdef);
+ if (strstr(Srcdef, "%s")) {
+ char *fil;
+
+ fil = (To_CondFil) ? To_CondFil->Body : PlugDup(g, "1=1");
+ Query = new(g)STRING(g, strlen(Srcdef) + strlen(fil));
+ Query->SetLength(sprintf(Query->GetStr(), Srcdef, fil));
+ } else
+ Query = new(g)STRING(g, 0, Srcdef);
+
return false;
} // endif Srcdef
@@ -442,7 +454,8 @@ bool TDBODBC::MakeSQL(PGLOBAL g, bool cnt)
} else
oom |= Query->Append(buf);
- } // endif colp
+ ((PEXTCOL)colp)->SetRank(++Ncol);
+ } // endif colp
} else
// !Columns can occur for queries such that sql count(*) from...
@@ -458,10 +471,6 @@ bool TDBODBC::MakeSQL(PGLOBAL g, bool cnt)
if (Catalog && *Catalog)
catp = Catalog;
- // Following lines are commented because of MSDEV-10520
- // Indeed the schema in the tablep is the local table database and
- // is normally not related to the remote table database.
- // TODO: Try to remember why this was done and if it was useful in some case.
//if (tablep->GetSchema())
// schmp = (char*)tablep->GetSchema();
//else
@@ -516,6 +525,7 @@ bool TDBODBC::MakeSQL(PGLOBAL g, bool cnt)
return false;
} // end of MakeSQL
+#endif // 0
/***********************************************************************/
/* MakeInsert: make the Insert statement used with ODBC connection. */
@@ -536,7 +546,7 @@ bool TDBODBC::MakeInsert(PGLOBAL g)
// Column name can be encoded in UTF-8
Decode(colp->GetName(), buf, sizeof(buf));
len += (strlen(buf) + 6); // comma + quotes + valist
- ((PODBCCOL)colp)->Rank = ++Nparm;
+ ((PEXTCOL)colp)->SetRank(++Nparm);
} // endif colp
// Below 32 is enough to contain the fixed part of the query
@@ -555,7 +565,7 @@ bool TDBODBC::MakeInsert(PGLOBAL g)
if (schmp)
len += strlen(schmp) + 1;
- // Column name can be encoded in UTF-8
+ // Table name can be encoded in UTF-8
Decode(TableName, buf, sizeof(buf));
len += (strlen(buf) + 32);
Query = new(g) STRING(g, len, "INSERT INTO ");
@@ -634,6 +644,7 @@ bool TDBODBC::BindParameters(PGLOBAL g)
return false;
} // end of BindParameters
+#if 0
/***********************************************************************/
/* MakeCommand: make the Update or Delete statement to send to the */
/* MySQL server. Limited to remote values and filtering. */
@@ -664,19 +675,20 @@ bool TDBODBC::MakeCommand(PGLOBAL g)
// If so, it must be quoted in the original query
strlwr(strcat(strcat(strcpy(name, " "), Name), " "));
- if (!strstr(" update delete low_priority ignore quick from ", name))
- strlwr(strcpy(name, Name)); // Not a keyword
- else
- strlwr(strcat(strcat(strcpy(name, qc), Name), qc));
+ if (strstr(" update delete low_priority ignore quick from ", name)) {
+ strlwr(strcat(strcat(strcpy(name, qc), Name), qc));
+ k += 2;
+ } else
+ strlwr(strcpy(name, Name)); // Not a keyword
if ((p = strstr(qrystr, name))) {
for (i = 0; i < p - qrystr; i++)
stmt[i] = (Qrystr[i] == '`') ? *qc : Qrystr[i];
stmt[i] = 0;
- k = i + (int)strlen(Name);
+ k += i + (int)strlen(Name);
- if (qtd && *(p-1) == ' ')
+ if (qtd && *(p - 1) == ' ')
strcat(strcat(strcat(stmt, qc), TableName), qc);
else
strcat(stmt, TableName);
@@ -692,15 +704,14 @@ bool TDBODBC::MakeCommand(PGLOBAL g)
} else {
sprintf(g->Message, "Cannot use this %s command",
- (Mode == MODE_UPDATE) ? "UPDATE" : "DELETE");
- return false;
+ (Mode == MODE_UPDATE) ? "UPDATE" : "DELETE");
+ return true;
} // endif p
Query = new(g) STRING(g, 0, stmt);
return (!Query->GetSize());
} // end of MakeCommand
-#if 0
/***********************************************************************/
/* MakeUpdate: make the SQL statement to send to ODBC connection. */
/***********************************************************************/
@@ -818,6 +829,7 @@ int TDBODBC::Cardinality(PGLOBAL g)
return Cardinal;
} // end of Cardinality
+#if 0
/***********************************************************************/
/* ODBC GetMaxSize: returns table size estimate in number of lines. */
/***********************************************************************/
@@ -844,6 +856,7 @@ int TDBODBC::GetProgMax(PGLOBAL g)
{
return GetMaxSize(g);
} // end of GetProgMax
+#endif // 0
/***********************************************************************/
/* ODBC Access Method opening routine. */
@@ -981,6 +994,7 @@ bool TDBODBC::OpenDB(PGLOBAL g)
return false;
} // end of OpenDB
+#if 0
/***********************************************************************/
/* GetRecpos: return the position of last read record. */
/***********************************************************************/
@@ -988,6 +1002,7 @@ int TDBODBC::GetRecpos(void)
{
return Fpos;
} // end of GetRecpos
+#endif // 0
/***********************************************************************/
/* SetRecpos: set the position of next read record. */
@@ -1081,8 +1096,9 @@ int TDBODBC::ReadDB(PGLOBAL g)
int rc;
if (trace > 1)
- htrc("ODBC ReadDB: R%d Mode=%d key=%p link=%p Kindex=%p\n",
- GetTdb_No(), Mode, To_Key_Col, To_Link, To_Kindex);
+ htrc("ODBC ReadDB: R%d Mode=%d\n", GetTdb_No(), Mode);
+ //htrc("ODBC ReadDB: R%d Mode=%d key=%p link=%p Kindex=%p\n",
+ // GetTdb_No(), Mode, To_Key_Col, To_Link, To_Kindex);
if (Mode == MODE_UPDATE || Mode == MODE_DELETE) {
if (!Query && MakeCommand(g))
@@ -1102,11 +1118,11 @@ int TDBODBC::ReadDB(PGLOBAL g)
} // endif Mode
- if (To_Kindex) {
- // Direct access of ODBC tables is not implemented yet
- strcpy(g->Message, MSG(NO_ODBC_DIRECT));
- return RC_FX;
- } // endif To_Kindex
+ //if (To_Kindex) {
+ // // Direct access of ODBC tables is not implemented yet
+ // strcpy(g->Message, MSG(NO_ODBC_DIRECT));
+ // return RC_FX;
+ // } // endif To_Kindex
/*********************************************************************/
/* Now start the reading process. */
@@ -1212,70 +1228,58 @@ void TDBODBC::CloseDB(PGLOBAL g)
/* ODBCCOL public constructor. */
/***********************************************************************/
ODBCCOL::ODBCCOL(PCOLDEF cdp, PTDB tdbp, PCOL cprec, int i, PSZ am)
- : COLBLK(cdp, tdbp, i)
+ : EXTCOL(cdp, tdbp, cprec, i, am)
{
- if (cprec) {
- Next = cprec->GetNext();
- cprec->SetNext(this);
- } else {
- Next = tdbp->GetColumns();
- tdbp->SetColumns(this);
- } // endif cprec
-
// Set additional ODBC access method information for column.
- Crp = NULL;
-//Long = cdp->GetLong();
- Long = Precision;
+//Crp = NULL;
+//Long = Precision;
//strcpy(F_Date, cdp->F_Date);
- To_Val = NULL;
+//To_Val = NULL;
Slen = 0;
StrLen = &Slen;
Sqlbuf = NULL;
- Bufp = NULL;
- Blkp = NULL;
- Rank = 0; // Not known yet
-
- if (trace)
- htrc(" making new %sCOL C%d %s at %p\n", am, Index, Name, this);
-
+//Bufp = NULL;
+//Blkp = NULL;
+//Rank = 0; // Not known yet
} // end of ODBCCOL constructor
/***********************************************************************/
/* ODBCCOL private constructor. */
/***********************************************************************/
-ODBCCOL::ODBCCOL(void) : COLBLK()
+ODBCCOL::ODBCCOL(void) : EXTCOL()
{
- Crp = NULL;
- Buf_Type = TYPE_INT; // This is a count(*) column
- // Set additional Dos access method information for column.
- Long = sizeof(int);
- To_Val = NULL;
+//Crp = NULL;
+//Buf_Type = TYPE_INT; // This is a count(*) column
+//// Set additional Dos access method information for column.
+//Long = sizeof(int);
+//To_Val = NULL;
Slen = 0;
StrLen = &Slen;
Sqlbuf = NULL;
- Bufp = NULL;
- Blkp = NULL;
- Rank = 1;
+//Bufp = NULL;
+//Blkp = NULL;
+//Rank = 1;
} // end of ODBCCOL constructor
/***********************************************************************/
/* ODBCCOL constructor used for copying columns. */
/* tdbp is the pointer to the new table descriptor. */
/***********************************************************************/
-ODBCCOL::ODBCCOL(ODBCCOL *col1, PTDB tdbp) : COLBLK(col1, tdbp)
+ODBCCOL::ODBCCOL(ODBCCOL *col1, PTDB tdbp) : EXTCOL(col1, tdbp)
{
- Crp = col1->Crp;
- Long = col1->Long;
+//Crp = col1->Crp;
+//Long = col1->Long;
//strcpy(F_Date, col1->F_Date);
- To_Val = col1->To_Val;
+//To_Val = col1->To_Val;
Slen = col1->Slen;
StrLen = col1->StrLen;
Sqlbuf = col1->Sqlbuf;
- Bufp = col1->Bufp;
- Blkp = col1->Blkp;
- Rank = col1->Rank;
+//Bufp = col1->Bufp;
+//Blkp = col1->Blkp;
+//Rank = col1->Rank;
} // end of ODBCCOL copy constructor
+#if 0
/***********************************************************************/
/* SetBuffer: prepare a column block for write operation. */
/***********************************************************************/
@@ -1321,6 +1325,7 @@ bool ODBCCOL::SetBuffer(PGLOBAL g, PVAL value, bool ok, bool check)
Status = (ok) ? BUF_EMPTY : BUF_NO;
return false;
} // end of SetBuffer
+#endif // 0
/***********************************************************************/
/* ReadColumn: when SQLFetch is used there is nothing to do as the */
@@ -1526,7 +1531,7 @@ TDBXDBC::TDBXDBC(PTDBXDBC tdbp) : TDBODBC(tdbp)
Nerr = tdbp->Nerr;
} // end of TDBXDBC copy constructor
-PTDB TDBXDBC::CopyOne(PTABS t)
+PTDB TDBXDBC::Clone(PTABS t)
{
PTDB tp;
PXSRCCOL cp1, cp2;
diff --git a/storage/connect/tabodbc.h b/storage/connect/tabodbc.h
index aa6592d8abf..fcefad5647b 100644
--- a/storage/connect/tabodbc.h
+++ b/storage/connect/tabodbc.h
@@ -20,7 +20,7 @@ typedef class TDBSRC *PTDBSRC;
/***********************************************************************/
/* ODBC table. */
/***********************************************************************/
-class DllExport ODBCDEF : public TABDEF { /* Logical table description */
+class DllExport ODBCDEF : public EXTDEF { /* Logical table description */
friend class TDBODBC;
friend class TDBXDBC;
friend class TDBDRV;
@@ -33,14 +33,14 @@ public:
// Implementation
virtual const char *GetType(void) {return "ODBC";}
PSZ GetConnect(void) {return Connect;}
- PSZ GetTabname(void) {return Tabname;}
- PSZ GetTabschema(void) {return Tabschema;}
- PSZ GetTabcat(void) {return Tabcat;}
- PSZ GetSrcdef(void) {return Srcdef;}
- char GetSep(void) {return (Sep) ? *Sep : 0;}
- int GetQuoted(void) {return Quoted;}
+ //PSZ GetTabname(void) {return Tabname;}
+ //PSZ GetTabschema(void) {return Tabschema;}
+ //PSZ GetTabcat(void) {return Tabcat;}
+ //PSZ GetSrcdef(void) {return Srcdef;}
+ //char GetSep(void) {return (Sep) ? *Sep : 0;}
+ //int GetQuoted(void) {return Quoted;}
int GetCatver(void) {return Catver;}
- int GetOptions(void) {return Options;}
+ //int GetOptions(void) {return Options;}
// Methods
virtual int Indexable(void) {return 2;}
@@ -50,27 +50,27 @@ public:
protected:
// Members
PSZ Connect; /* ODBC connection string */
- PSZ Tabname; /* External table name */
- PSZ Tabschema; /* External table schema */
- PSZ Username; /* User connect name */
- PSZ Password; /* Password connect info */
- PSZ Tabcat; /* External table catalog */
- PSZ Tabtyp; /* Catalog table type */
- PSZ Colpat; /* Catalog column pattern */
- PSZ Srcdef; /* The source table SQL definition */
- PSZ Qchar; /* Identifier quoting character */
- PSZ Qrystr; /* The original query */
- PSZ Sep; /* Decimal separator */
+ //PSZ Tabname; /* External table name */
+ //PSZ Tabschema; /* External table schema */
+ //PSZ Username; /* User connect name */
+ //PSZ Password; /* Password connect info */
+ //PSZ Tabcat; /* External table catalog */
+ //PSZ Tabtyp; /* Catalog table type */
+ //PSZ Colpat; /* Catalog column pattern */
+ //PSZ Srcdef; /* The source table SQL definition */
+ //PSZ Qchar; /* Identifier quoting character */
+ //PSZ Qrystr; /* The original query */
+ //PSZ Sep; /* Decimal separator */
int Catver; /* ODBC version for catalog functions */
- int Options; /* Open connection options */
- int Cto; /* Open connection timeout */
- int Qto; /* Query (command) timeout */
- int Quoted; /* Identifier quoting level */
- int Maxerr; /* Maxerr for an Exec table */
- int Maxres; /* Maxres for a catalog table */
- int Memory; /* Put result set in memory */
- bool Scrollable; /* Use scrollable cursor */
- bool Xsrc; /* Execution type */
+ //int Options; /* Open connection options */
+ //int Cto; /* Open connection timeout */
+ //int Qto; /* Query (command) timeout */
+ //int Quoted; /* Identifier quoting level */
+ //int Maxerr; /* Maxerr for an Exec table */
+ //int Maxres; /* Maxres for a catalog table */
+ //int Memory; /* Put result set in memory */
+ //bool Scrollable; /* Use scrollable cursor */
+ //bool Xsrc; /* Execution type */
bool UseCnc; /* Use SQLConnect (!SQLDriverConnect) */
}; // end of ODBCDEF
@@ -81,7 +81,7 @@ public:
/* This is the ODBC Access Method class declaration for files from */
/* other DB drivers to be accessed via ODBC. */
/***********************************************************************/
-class TDBODBC : public TDBASE {
+class TDBODBC : public TDBEXT {
friend class ODBCCOL;
friend class ODBConn;
public:
@@ -95,8 +95,8 @@ class TDBODBC : public TDBASE {
{return (PTDB)new(g) TDBODBC(this);}
// Methods
- virtual PTDB CopyOne(PTABS t);
- virtual int GetRecpos(void);
+ virtual PTDB Clone(PTABS t);
+//virtual int GetRecpos(void);
virtual bool SetRecpos(PGLOBAL g, int recpos);
virtual PSZ GetFile(PGLOBAL g);
virtual void SetFile(PGLOBAL g, PSZ fn);
@@ -108,8 +108,8 @@ class TDBODBC : public TDBASE {
// Database routines
virtual PCOL MakeCol(PGLOBAL g, PCOLDEF cdp, PCOL cprec, int n);
virtual int Cardinality(PGLOBAL g);
- virtual int GetMaxSize(PGLOBAL g);
- virtual int GetProgMax(PGLOBAL g);
+//virtual int GetMaxSize(PGLOBAL g);
+//virtual int GetProgMax(PGLOBAL g);
virtual bool OpenDB(PGLOBAL g);
virtual int ReadDB(PGLOBAL g);
virtual int WriteDB(PGLOBAL g);
@@ -119,10 +119,10 @@ class TDBODBC : public TDBASE {
protected:
// Internal functions
- int Decode(char *utf, char *buf, size_t n);
- bool MakeSQL(PGLOBAL g, bool cnt);
+//int Decode(char *utf, char *buf, size_t n);
+//bool MakeSQL(PGLOBAL g, bool cnt);
bool MakeInsert(PGLOBAL g);
- bool MakeCommand(PGLOBAL g);
+//virtual bool MakeCommand(PGLOBAL g);
//bool MakeFilter(PGLOBAL g, bool c);
bool BindParameters(PGLOBAL g);
//char *MakeUpdate(PGLOBAL g);
@@ -132,46 +132,16 @@ class TDBODBC : public TDBASE {
ODBConn *Ocp; // Points to an ODBC connection class
ODBCCOL *Cnp; // Points to count(*) column
ODBCPARM Ops; // Additional parameters
- PSTRG Query; // Constructed SQL query
char *Connect; // Points to connection string
- char *TableName; // Points to ODBC table name
- char *Schema; // Points to ODBC table Schema
- char *User; // User connect info
- char *Pwd; // Password connect info
- char *Catalog; // Points to ODBC table Catalog
- char *Srcdef; // The source table SQL definition
- char *Count; // Points to count(*) SQL statement
-//char *Where; // Points to local where clause
- char *Quote; // The identifier quoting character
- char *MulConn; // Used for multiple ODBC tables
- char *DBQ; // The address part of Connect string
- char *Qrystr; // The original query
- char Sep; // The decimal separator
- int Options; // Connect options
- int Cto; // Connect timeout
- int Qto; // Query timeout
- int Quoted; // The identifier quoting level
- int Fpos; // Position of last read record
- int Curpos; // Cursor position of last fetch
- int AftRows; // The number of affected rows
- int Rows; // Rowset size
int Catver; // Catalog ODBC version
- int CurNum; // Current buffer line number
- int Rbuf; // Number of lines read in buffer
- int BufSize; // Size of connect string buffer
- int Nparm; // The number of statement parameters
- int Memory; // 0: No 1: Alloc 2: Put 3: Get
- bool Scrollable; // Use scrollable cursor
- bool Placed; // True for position reading
bool UseCnc; // Use SQLConnect (!SQLDriverConnect)
- PQRYRES Qrp; // Points to storage result
}; // end of class TDBODBC
/***********************************************************************/
/* Class ODBCCOL: ODBC access method column descriptor. */
/* This A.M. is used for ODBC tables. */
/***********************************************************************/
-class ODBCCOL : public COLBLK {
+class ODBCCOL : public EXTCOL {
friend class TDBODBC;
public:
// Constructors
@@ -181,12 +151,12 @@ class ODBCCOL : public COLBLK {
// Implementation
virtual int GetAmType(void) {return TYPE_AM_ODBC;}
SQLLEN *GetStrLen(void) {return StrLen;}
- int GetRank(void) {return Rank;}
+// int GetRank(void) {return Rank;}
// PVBLK GetBlkp(void) {return Blkp;}
- void SetCrp(PCOLRES crp) {Crp = crp;}
+// void SetCrp(PCOLRES crp) {Crp = crp;}
// Methods
- virtual bool SetBuffer(PGLOBAL g, PVAL value, bool ok, bool check);
+//virtual bool SetBuffer(PGLOBAL g, PVAL value, bool ok, bool check);
virtual void ReadColumn(PGLOBAL g);
virtual void WriteColumn(PGLOBAL g);
void AllocateBuffers(PGLOBAL g, int rows);
@@ -195,19 +165,19 @@ class ODBCCOL : public COLBLK {
// void Print(PGLOBAL g, FILE *, uint);
protected:
- // Constructor used by GetMaxSize
+ // Constructor for count(*) column
ODBCCOL(void);
// Members
TIMESTAMP_STRUCT *Sqlbuf; // To get SQL_TIMESTAMP's
- PCOLRES Crp; // To storage result
- void *Bufp; // To extended buffer
- PVBLK Blkp; // To Value Block
+//PCOLRES Crp; // To storage result
+//void *Bufp; // To extended buffer
+//PVBLK Blkp; // To Value Block
//char F_Date[12]; // Internal Date format
- PVAL To_Val; // To value used for Insert
+//PVAL To_Val; // To value used for Insert
SQLLEN *StrLen; // As returned by ODBC
SQLLEN Slen; // Used with Fetch
- int Rank; // Rank (position) number in the query
+//int Rank; // Rank (position) number in the query
}; // end of class ODBCCOL
/***********************************************************************/
@@ -228,28 +198,19 @@ class TDBXDBC : public TDBODBC {
{return (PTDB)new(g) TDBXDBC(this);}
// Methods
- virtual PTDB CopyOne(PTABS t);
-//virtual int GetRecpos(void);
-//virtual PSZ GetFile(PGLOBAL g);
-//virtual void SetFile(PGLOBAL g, PSZ fn);
-//virtual void ResetSize(void);
-//virtual int GetAffectedRows(void) {return AftRows;}
-//virtual PSZ GetServer(void) {return "ODBC";}
+ virtual PTDB Clone(PTABS t);
// Database routines
virtual PCOL MakeCol(PGLOBAL g, PCOLDEF cdp, PCOL cprec, int n);
-//virtual int GetProgMax(PGLOBAL g);
virtual int GetMaxSize(PGLOBAL g);
virtual bool OpenDB(PGLOBAL g);
virtual int ReadDB(PGLOBAL g);
virtual int WriteDB(PGLOBAL g);
virtual int DeleteDB(PGLOBAL g, int irc);
-//virtual void CloseDB(PGLOBAL g);
protected:
// Internal functions
PCMD MakeCMD(PGLOBAL g);
-//bool BindParameters(PGLOBAL g);
// Members
PCMD Cmdlist; // The commands to execute
diff --git a/storage/connect/tabpivot.cpp b/storage/connect/tabpivot.cpp
index 256b454741c..c6d32884417 100644
--- a/storage/connect/tabpivot.cpp
+++ b/storage/connect/tabpivot.cpp
@@ -1,11 +1,11 @@
/************ TabPivot C++ Program Source Code File (.CPP) *************/
/* PROGRAM NAME: TABPIVOT */
/* ------------- */
-/* Version 1.6 */
+/* Version 1.7 */
/* */
/* COPYRIGHT: */
/* ---------- */
-/* (C) Copyright to the author Olivier BERTRAND 2005-2015 */
+/* (C) Copyright to the author Olivier BERTRAND 2005-2017 */
/* */
/* WHAT THIS PROGRAM DOES: */
/* ----------------------- */
@@ -41,6 +41,7 @@
#include "global.h"
#include "plgdbsem.h"
#include "xtable.h"
+#include "tabext.h"
#include "tabcol.h"
#include "colblk.h"
#include "tabmysql.h"
@@ -883,7 +884,7 @@ SRCCOL::SRCCOL(PCOLDEF cdp, PTDB tdbp, PCOL cprec, int n)
/***********************************************************************/
/* Initialize the column as pointing to the source column. */
/***********************************************************************/
-bool SRCCOL::Init(PGLOBAL g, PTDBASE tp)
+bool SRCCOL::Init(PGLOBAL g, PTDB tp)
{
if (PRXCOL::Init(g, tp))
return true;
diff --git a/storage/connect/tabpivot.h b/storage/connect/tabpivot.h
index c397af05234..07d5c3e456b 100644
--- a/storage/connect/tabpivot.h
+++ b/storage/connect/tabpivot.h
@@ -183,7 +183,7 @@ class SRCCOL : public PRXCOL {
using PRXCOL::Init;
virtual void Reset(void) {}
void SetColumn(void);
- virtual bool Init(PGLOBAL g, PTDBASE tp);
+ virtual bool Init(PGLOBAL g, PTDB tp);
bool CompareLast(void);
protected:
diff --git a/storage/connect/tabsys.cpp b/storage/connect/tabsys.cpp
index 76890e84429..2ddd1c3c753 100644
--- a/storage/connect/tabsys.cpp
+++ b/storage/connect/tabsys.cpp
@@ -159,7 +159,7 @@ TDBINI::TDBINI(PTDBINI tdbp) : TDBASE(tdbp)
} // end of TDBINI copy constructor
// Is this really useful ???
-PTDB TDBINI::CopyOne(PTABS t)
+PTDB TDBINI::Clone(PTABS t)
{
PTDB tp;
PINICOL cp1, cp2;
@@ -173,7 +173,7 @@ PTDB TDBINI::CopyOne(PTABS t)
} // endfor cp1
return tp;
- } // end of CopyOne
+ } // end of Clone
/***********************************************************************/
/* Get the section list from the INI file. */
@@ -565,7 +565,7 @@ TDBXIN::TDBXIN(PTDBXIN tdbp) : TDBINI(tdbp)
} // end of TDBXIN copy constructor
// Is this really useful ???
-PTDB TDBXIN::CopyOne(PTABS t)
+PTDB TDBXIN::Clone(PTABS t)
{
PTDB tp;
PXINCOL cp1, cp2;
@@ -579,7 +579,7 @@ PTDB TDBXIN::CopyOne(PTABS t)
} // endfor cp1
return tp;
- } // end of CopyOne
+ } // end of Clone
/***********************************************************************/
/* Get the key list from the INI file. */
diff --git a/storage/connect/tabsys.h b/storage/connect/tabsys.h
index 6b454322906..ff1b8335690 100644
--- a/storage/connect/tabsys.h
+++ b/storage/connect/tabsys.h
@@ -57,7 +57,7 @@ class TDBINI : public TDBASE {
virtual PTDB Duplicate(PGLOBAL g) {return (PTDB)new(g) TDBINI(this);}
// Methods
- virtual PTDB CopyOne(PTABS t);
+ virtual PTDB Clone(PTABS t);
virtual int GetRecpos(void) {return N;}
virtual int GetProgCur(void) {return N;}
//virtual int GetAffectedRows(void) {return 0;}
@@ -136,7 +136,7 @@ class TDBXIN : public TDBINI {
virtual PTDB Duplicate(PGLOBAL g) {return (PTDB)new(g) TDBXIN(this);}
// Methods
- virtual PTDB CopyOne(PTABS t);
+ virtual PTDB Clone(PTABS t);
virtual int GetRecpos(void);
virtual bool SetRecpos(PGLOBAL g, int recpos);
virtual void ResetDB(void)
diff --git a/storage/connect/tabtbl.cpp b/storage/connect/tabtbl.cpp
index e3baf7c3da5..0bf3f6beb43 100644
--- a/storage/connect/tabtbl.cpp
+++ b/storage/connect/tabtbl.cpp
@@ -1,11 +1,11 @@
/************* TabTbl C++ Program Source Code File (.CPP) **************/
/* PROGRAM NAME: TABTBL */
/* ------------- */
-/* Version 1.7 */
+/* Version 1.8 */
/* */
/* COPYRIGHT: */
/* ---------- */
-/* (C) Copyright to PlugDB Software Development 2008-2016 */
+/* (C) Copyright to PlugDB Software Development 2008-2017 */
/* Author: Olivier BERTRAND */
/* */
/* WHAT THIS PROGRAM DOES: */
@@ -70,6 +70,7 @@
#include "tabcol.h"
#include "tabdos.h" // TDBDOS and DOSCOL class dcls
#include "tabtbl.h"
+#include "tabext.h"
#include "tabmysql.h"
#include "ha_connect.h"
@@ -411,9 +412,9 @@ void TDBTBL::ResetDB(void)
colp->COLBLK::Reset();
for (PTABLE tabp = Tablist; tabp; tabp = tabp->GetNext())
- ((PTDBASE)tabp->GetTo_Tdb())->ResetDB();
+ tabp->GetTo_Tdb()->ResetDB();
- Tdbp = (PTDBASE)Tablist->GetTo_Tdb();
+ Tdbp = Tablist->GetTo_Tdb();
Crp = 0;
} // end of ResetDB
@@ -458,7 +459,7 @@ bool TDBTBL::OpenDB(PGLOBAL g)
return TRUE;
if ((CurTable = Tablist)) {
- Tdbp = (PTDBASE)CurTable->GetTo_Tdb();
+ Tdbp = CurTable->GetTo_Tdb();
// Tdbp->SetMode(Mode);
// Tdbp->ResetDB();
// Tdbp->ResetSize();
@@ -515,7 +516,7 @@ int TDBTBL::ReadDB(PGLOBAL g)
/* Continue reading from next table file. */
/***************************************************************/
Tdbp->CloseDB(g);
- Tdbp = (PTDBASE)CurTable->GetTo_Tdb();
+ Tdbp = CurTable->GetTo_Tdb();
// Check and initialize the subtable columns
for (PCOL cp = Columns; cp; cp = cp->GetNext())
@@ -609,13 +610,13 @@ void TDBTBM::ResetDB(void)
// Local tables
for (PTABLE tabp = Tablist; tabp; tabp = tabp->GetNext())
- ((PTDBASE)tabp->GetTo_Tdb())->ResetDB();
+ tabp->GetTo_Tdb()->ResetDB();
// Remote tables
for (PTBMT tp = Tmp; tp; tp = tp->Next)
- ((PTDBASE)tp->Tap->GetTo_Tdb())->ResetDB();
+ tp->Tap->GetTo_Tdb()->ResetDB();
- Tdbp = (Tablist) ? (PTDBASE)Tablist->GetTo_Tdb() : NULL;
+ Tdbp = (Tablist) ? Tablist->GetTo_Tdb() : NULL;
Crp = 0;
} // end of ResetDB
@@ -716,7 +717,7 @@ bool TDBTBM::OpenDB(PGLOBAL g)
/* Proceed with local tables. */
/*********************************************************************/
if ((CurTable = Tablist)) {
- Tdbp = (PTDBASE)CurTable->GetTo_Tdb();
+ Tdbp = CurTable->GetTo_Tdb();
// Tdbp->SetMode(Mode);
// Check and initialize the subtable columns
@@ -808,7 +809,7 @@ int TDBTBM::ReadNextRemote(PGLOBAL g)
} // endif Curtable
- Tdbp = (PTDBASE)Cmp->Tap->GetTo_Tdb();
+ Tdbp = Cmp->Tap->GetTo_Tdb();
// Check and initialize the subtable columns
for (PCOL cp = Columns; cp; cp = cp->GetNext())
diff --git a/storage/connect/tabutil.cpp b/storage/connect/tabutil.cpp
index 4069cdbed2a..762c61bd1a1 100644
--- a/storage/connect/tabutil.cpp
+++ b/storage/connect/tabutil.cpp
@@ -1,7 +1,7 @@
/************* Tabutil cpp Declares Source Code File (.CPP) ************/
-/* Name: TABUTIL.CPP Version 1.1 */
+/* Name: TABUTIL.CPP Version 1.2 */
/* */
-/* (C) Copyright to the author Olivier BERTRAND 2013 - 2016 */
+/* (C) Copyright to the author Olivier BERTRAND 2013 - 2017 */
/* */
/* Utility function used by the PROXY, XCOL, OCCUR, and TBL tables. */
/***********************************************************************/
@@ -45,8 +45,9 @@
#include "myutil.h"
#include "valblk.h"
#include "resource.h"
-#include "reldef.h"
+//#include "reldef.h"
#include "xtable.h"
+#include "tabext.h"
#include "tabmysql.h"
#include "tabcol.h"
#include "tabutil.h"
@@ -356,7 +357,7 @@ TDBPRX::TDBPRX(PTDBPRX tdbp) : TDBASE(tdbp)
} // end of TDBPRX copy constructor
// Method
-PTDB TDBPRX::CopyOne(PTABS t)
+PTDB TDBPRX::Clone(PTABS t)
{
PTDB tp;
PPRXCOL cp1, cp2;
@@ -370,12 +371,12 @@ PTDB TDBPRX::CopyOne(PTABS t)
} // endfor cp1
return tp;
- } // end of CopyOne
+ } // end of Clone
/***********************************************************************/
/* Get the PTDB of the sub-table. */
/***********************************************************************/
-PTDBASE TDBPRX::GetSubTable(PGLOBAL g, PTABLE tabp, bool b)
+PTDB TDBPRX::GetSubTable(PGLOBAL g, PTABLE tabp, bool b)
{
const char *sp = NULL;
char *db, *name;
@@ -456,13 +457,13 @@ PTDBASE TDBPRX::GetSubTable(PGLOBAL g, PTABLE tabp, bool b)
if (trace && tdbp)
htrc("Subtable %s in %s\n",
- name, SVP(((PTDBASE)tdbp)->GetDef()->GetDB()));
+ name, SVP(tdbp->GetDef()->GetDB()));
err:
if (s)
free_table_share(s);
- return (PTDBASE)tdbp;
+ return tdbp;
} // end of GetSubTable
/***********************************************************************/
@@ -560,9 +561,9 @@ bool TDBPRX::OpenDB(PGLOBAL g)
/* its column blocks in mode write (required by XML tables). */
/*********************************************************************/
if (Mode == MODE_UPDATE) {
- PTDBASE utp;
+ PTDB utp;
- if (!(utp= (PTDBASE)Tdbp->Duplicate(g))) {
+ if (!(utp= Tdbp->Duplicate(g))) {
sprintf(g->Message, MSG(INV_UPDT_TABLE), Tdbp->GetName());
return true;
} // endif tp
@@ -681,7 +682,7 @@ char *PRXCOL::Decode(PGLOBAL g, const char *cnm)
/* PRXCOL initialization routine. */
/* Look for the matching column in the object table. */
/***********************************************************************/
-bool PRXCOL::Init(PGLOBAL g, PTDBASE tp)
+bool PRXCOL::Init(PGLOBAL g, PTDB tp)
{
if (!tp)
tp = ((PTDBPRX)To_Tdb)->Tdbp;
diff --git a/storage/connect/tabutil.h b/storage/connect/tabutil.h
index b320d169b36..8e56aecff86 100644
--- a/storage/connect/tabutil.h
+++ b/storage/connect/tabutil.h
@@ -67,7 +67,7 @@ class DllExport TDBPRX : public TDBASE {
{return (PTDB)new(g) TDBPRX(this);}
// Methods
- virtual PTDB CopyOne(PTABS t);
+ virtual PTDB Clone(PTABS t);
virtual int GetRecpos(void) {return Tdbp->GetRecpos();}
virtual void ResetDB(void) {Tdbp->ResetDB();}
virtual int RowNumber(PGLOBAL g, bool b = FALSE);
@@ -83,12 +83,12 @@ class DllExport TDBPRX : public TDBASE {
virtual int WriteDB(PGLOBAL g);
virtual int DeleteDB(PGLOBAL g, int irc);
virtual void CloseDB(PGLOBAL g) {if (Tdbp) Tdbp->CloseDB(g);}
- PTDBASE GetSubTable(PGLOBAL g, PTABLE tabp, bool b = false);
+ PTDB GetSubTable(PGLOBAL g, PTABLE tabp, bool b = false);
void RemoveNext(PTABLE tp);
protected:
// Members
- PTDBASE Tdbp; // The object table
+ PTDB Tdbp; // The object table
}; // end of class TDBPRX
/***********************************************************************/
@@ -115,7 +115,7 @@ class DllExport PRXCOL : public COLBLK {
{return false;}
virtual void ReadColumn(PGLOBAL g);
virtual void WriteColumn(PGLOBAL g);
- virtual bool Init(PGLOBAL g, PTDBASE tp);
+ virtual bool Init(PGLOBAL g, PTDB tp);
protected:
char *Decode(PGLOBAL g, const char *cnm);
diff --git a/storage/connect/tabvct.cpp b/storage/connect/tabvct.cpp
index e788529075f..282fb55a43c 100644
--- a/storage/connect/tabvct.cpp
+++ b/storage/connect/tabvct.cpp
@@ -241,7 +241,7 @@ PTDB VCTDEF::GetTable(PGLOBAL g, MODE mode)
/*********************************************************************/
if (mode != MODE_INSERT)
if (tdbp->GetBlockValues(g))
- PushWarning(g, (PTDBASE)tdbp);
+ PushWarning(g, tdbp);
// return NULL; // causes a crash when deleting index
return tdbp;
@@ -263,7 +263,7 @@ TDBVCT::TDBVCT(PGLOBAL g, PTDBVCT tdbp) : TDBFIX(g, tdbp)
} // end of TDBVCT copy constructor
// Method
-PTDB TDBVCT::CopyOne(PTABS t)
+PTDB TDBVCT::Clone(PTABS t)
{
PTDB tp;
PVCTCOL cp1, cp2;
@@ -277,7 +277,7 @@ PTDB TDBVCT::CopyOne(PTABS t)
} // endfor cp1
return tp;
- } // end of CopyOne
+ } // end of Clone
/***********************************************************************/
/* Allocate VCT column description block. */
diff --git a/storage/connect/tabvct.h b/storage/connect/tabvct.h
index 8ad3c8e21be..189a9ae2221 100644
--- a/storage/connect/tabvct.h
+++ b/storage/connect/tabvct.h
@@ -68,7 +68,7 @@ class DllExport TDBVCT : public TDBFIX {
bool IsSplit(void) {return ((VCTDEF*)To_Def)->Split;}
// Methods
- virtual PTDB CopyOne(PTABS t);
+ virtual PTDB Clone(PTABS t);
virtual bool IsUsingTemp(PGLOBAL g);
// Database routines
diff --git a/storage/connect/tabvir.cpp b/storage/connect/tabvir.cpp
index 356fc981357..155c71fe268 100644
--- a/storage/connect/tabvir.cpp
+++ b/storage/connect/tabvir.cpp
@@ -20,7 +20,7 @@
#include "plgdbsem.h"
#include "filter.h"
#include "xtable.h"
-#include "reldef.h"
+//#include "reldef.h"
#include "colblk.h"
#include "mycat.h" // for FNC_COL
#include "tabvir.h"
diff --git a/storage/connect/tabwmi.cpp b/storage/connect/tabwmi.cpp
index 98a44b9d635..4871a1d66dc 100644
--- a/storage/connect/tabwmi.cpp
+++ b/storage/connect/tabwmi.cpp
@@ -1,5 +1,5 @@
/***********************************************************************/
-/* TABWMI: Author Olivier Bertrand -- PlugDB -- 2012 - 2013 */
+/* TABWMI: Author Olivier Bertrand -- PlugDB -- 2012 - 2017 */
/* TABWMI: Virtual table to get WMI information. */
/***********************************************************************/
#if !defined(__WIN__)
@@ -11,8 +11,9 @@
#include "global.h"
#include "plgdbsem.h"
#include "mycat.h"
-#include "reldef.h"
+//#include "reldef.h"
#include "xtable.h"
+#include "tabext.h"
#include "colblk.h"
//#include "filter.h"
//#include "xindex.h"
@@ -62,7 +63,7 @@ PWMIUT InitWMI(PGLOBAL g, char *nsp, char *classname)
if (FAILED(res)) {
sprintf(g->Message, "Failed to initialize COM library. "
- "Error code = %p", res);
+ "Error code = %x", res);
return NULL;
} // endif res
@@ -85,7 +86,7 @@ PWMIUT InitWMI(PGLOBAL g, char *nsp, char *classname)
(void**) &loc);
if (FAILED(res)) {
sprintf(g->Message, "Failed to create Locator. "
- "Error code = %p", res);
+ "Error code = %x", res);
CoUninitialize();
return NULL;
} // endif res
@@ -94,7 +95,7 @@ PWMIUT InitWMI(PGLOBAL g, char *nsp, char *classname)
NULL, NULL, NULL, 0, NULL, NULL, &wp->Svc);
if (FAILED(res)) {
- sprintf(g->Message, "Could not connect. Error code = %p", res);
+ sprintf(g->Message, "Could not connect. Error code = %x", res);
loc->Release();
CoUninitialize();
return NULL;
@@ -423,7 +424,7 @@ bool TDBWMI::Initialize(PGLOBAL g)
if (FAILED(Res)) {
sprintf(g->Message, "Failed to initialize COM library. "
- "Error code = %p", Res);
+ "Error code = %x", Res);
return true; // Program has failed.
} // endif Res
@@ -436,7 +437,7 @@ bool TDBWMI::Initialize(PGLOBAL g)
if (FAILED(Res)) {
sprintf(g->Message, "Failed to create Locator. "
- "Error code = %p", Res);
+ "Error code = %x", Res);
CoUninitialize();
return true; // Program has failed.
} // endif Res
@@ -448,7 +449,7 @@ bool TDBWMI::Initialize(PGLOBAL g)
NULL, NULL,0, NULL, 0, 0, &Svc);
if (FAILED(Res)) {
- sprintf(g->Message, "Could not connect. Error code = %p", Res);
+ sprintf(g->Message, "Could not connect. Error code = %x", Res);
loc->Release();
CoUninitialize();
return true; // Program has failed.
@@ -463,7 +464,7 @@ bool TDBWMI::Initialize(PGLOBAL g)
RPC_C_IMP_LEVEL_IMPERSONATE, NULL, EOAC_NONE);
if (FAILED(Res)) {
- sprintf(g->Message, "Could not set proxy. Error code = 0x", Res);
+ sprintf(g->Message, "Could not set proxy. Error code = %x", Res);
Svc->Release();
CoUninitialize();
return true; // Program has failed.
@@ -573,7 +574,7 @@ bool TDBWMI::GetWMIInfo(PGLOBAL g)
NULL, &Enumerator);
if (FAILED(Rc)) {
- sprintf(g->Message, "Query %s failed. Error code = %p", cmd, Rc);
+ sprintf(g->Message, "Query %s failed. Error code = %x", cmd, Rc);
Svc->Release();
CoUninitialize();
return true; // Program has failed.
diff --git a/storage/connect/tabxcl.cpp b/storage/connect/tabxcl.cpp
index add61431493..93a24accc3c 100644
--- a/storage/connect/tabxcl.cpp
+++ b/storage/connect/tabxcl.cpp
@@ -1,7 +1,7 @@
/************* TabXcl CPP Declares Source Code File (.CPP) *************/
/* Name: TABXCL.CPP Version 1.0 */
/* */
-/* (C) Copyright to the author Olivier BERTRAND 2013 */
+/* (C) Copyright to the author Olivier BERTRAND 2013-2017 */
/* */
/* XCOL: Table having one column containing several values */
/* comma separated. When creating the table, the name of the X */
@@ -45,12 +45,12 @@
#include "plgdbsem.h"
#include "plgcnx.h" // For DB types
#include "resource.h"
-#include "reldef.h"
+#include "xtable.h"
+#include "tabext.h"
#include "filamtxt.h"
#include "tabdos.h"
#include "tabcol.h"
#include "tabxcl.h"
-#include "xtable.h"
#include "tabmysql.h"
#include "ha_connect.h"
@@ -246,7 +246,7 @@ XCLCOL::XCLCOL(PCOLDEF cdp, PTDB tdbp, PCOL cprec, int i)
/* XCLCOL initialization routine. */
/* Allocate Cbuf that will contain the Colp value. */
/***********************************************************************/
-bool XCLCOL::Init(PGLOBAL g, PTDBASE tp)
+bool XCLCOL::Init(PGLOBAL g, PTDB tp)
{
if (PRXCOL::Init(g, tp))
return true;
diff --git a/storage/connect/tabxcl.h b/storage/connect/tabxcl.h
index 291f0b4263a..fde000ee709 100644
--- a/storage/connect/tabxcl.h
+++ b/storage/connect/tabxcl.h
@@ -91,7 +91,7 @@ class XCLCOL : public PRXCOL {
using PRXCOL::Init;
virtual void Reset(void) {} // Evaluated only by TDBXCL
virtual void ReadColumn(PGLOBAL g);
- virtual bool Init(PGLOBAL g, PTDBASE tp = NULL);
+ virtual bool Init(PGLOBAL g, PTDB tp = NULL);
protected:
// Default constructor not to be used
diff --git a/storage/connect/tabxml.cpp b/storage/connect/tabxml.cpp
index 3b8229fcf51..52cf3d3812f 100644
--- a/storage/connect/tabxml.cpp
+++ b/storage/connect/tabxml.cpp
@@ -42,7 +42,7 @@
/***********************************************************************/
#include "global.h"
#include "plgdbsem.h"
-#include "reldef.h"
+//#include "reldef.h"
#include "xtable.h"
#include "colblk.h"
#include "mycat.h"
@@ -537,6 +537,11 @@ PTDB XMLDEF::GetTable(PGLOBAL g, MODE m)
if (Catfunc == FNC_COL)
return new(g) TDBXCT(this);
+ if (Zipped && !(m == MODE_READ || m == MODE_ANY)) {
+ strcpy(g->Message, "ZIpped XML tables are read only");
+ return NULL;
+ } // endif Zipped
+
PTDBASE tdbp = new(g) TDBXML(this);
if (Multiple)
@@ -655,7 +660,7 @@ TDBXML::TDBXML(PTDBXML tdbp) : TDBASE(tdbp)
} // end of TDBXML copy constructor
// Used for update
-PTDB TDBXML::CopyOne(PTABS t)
+PTDB TDBXML::Clone(PTABS t)
{
PTDB tp;
PXMLCOL cp1, cp2;
@@ -669,7 +674,7 @@ PTDB TDBXML::CopyOne(PTABS t)
} // endfor cp1
return tp;
- } // end of CopyOne
+ } // end of Clone
/***********************************************************************/
/* Allocate XML column description block. */
@@ -926,7 +931,7 @@ bool TDBXML::Initialize(PGLOBAL g)
if (rc)
sprintf(g->Message, "%s: %s", MSG(COM_ERROR), buf);
else
- sprintf(g->Message, "%s hr=%p", MSG(COM_ERROR), e.Error());
+ sprintf(g->Message, "%s hr=%x", MSG(COM_ERROR), e.Error());
goto error;
#endif // __WIN__
diff --git a/storage/connect/tabxml.h b/storage/connect/tabxml.h
index 6c586d79dec..65b353072cb 100644
--- a/storage/connect/tabxml.h
+++ b/storage/connect/tabxml.h
@@ -71,7 +71,7 @@ class DllExport TDBXML : public TDBASE {
virtual PTDB Duplicate(PGLOBAL g) {return (PTDB)new(g) TDBXML(this);}
// Methods
- virtual PTDB CopyOne(PTABS t);
+ virtual PTDB Clone(PTABS t);
virtual int GetRecpos(void);
virtual int GetProgCur(void) {return N;}
virtual PSZ GetFile(PGLOBAL g) {return Xfile;}
diff --git a/storage/connect/tabzip.cpp b/storage/connect/tabzip.cpp
index 11f414ee154..b91059a3843 100644
--- a/storage/connect/tabzip.cpp
+++ b/storage/connect/tabzip.cpp
@@ -70,8 +70,12 @@ PCOL TDBZIP::MakeCol(PGLOBAL g, PCOLDEF cdp, PCOL cprec, int n)
/* param: filename path and the filename of the zip file to open. */
/* return: true if open, false otherwise. */
/***********************************************************************/
-bool TDBZIP::open(PGLOBAL g, const char *filename)
+bool TDBZIP::open(PGLOBAL g, const char *fn)
{
+ char filename[_MAX_PATH];
+
+ PlugSetPath(filename, fn, GetPath());
+
if (!zipfile && !(zipfile = unzOpen64(filename)))
sprintf(g->Message, "Zipfile open error");
@@ -102,7 +106,7 @@ int TDBZIP::Cardinality(PGLOBAL g)
unz_global_info64 ginfo;
int err = unzGetGlobalInfo64(zipfile, &ginfo);
- Cardinal = (err == UNZ_OK) ? ginfo.number_entry : 0;
+ Cardinal = (err == UNZ_OK) ? (int)ginfo.number_entry : 0;
} else
Cardinal = 0;
@@ -221,6 +225,14 @@ void ZIPCOL::ReadColumn(PGLOBAL g)
case 3:
Value->SetValue((int)Tdbz->finfo.compression_method);
break;
+ case 4:
+ Tdbz->finfo.tmu_date.tm_year -= 1900;
+
+ if (((DTVAL*)Value)->MakeTime((tm*)&Tdbz->finfo.tmu_date))
+ Value->SetNull(true);
+
+ Tdbz->finfo.tmu_date.tm_year += 1900;
+ break;
default:
Value->SetValue_psz((PSZ)Tdbz->fn);
} // endswitch flag
diff --git a/storage/connect/tabzip.h b/storage/connect/tabzip.h
index 6f1735258e7..dcec3475371 100644
--- a/storage/connect/tabzip.h
+++ b/storage/connect/tabzip.h
@@ -20,7 +20,7 @@ typedef class ZIPCOL *PZIPCOL;
/***********************************************************************/
class DllExport ZIPDEF : public DOSDEF { /* Table description */
friend class TDBZIP;
- friend class ZIPFAM;
+ friend class UNZFAM;
public:
// Constructor
ZIPDEF(void) {}
diff --git a/storage/connect/user_connect.cc b/storage/connect/user_connect.cc
index 34d192361a5..ca3557666a4 100644
--- a/storage/connect/user_connect.cc
+++ b/storage/connect/user_connect.cc
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
/**
@file user_connect.cc
diff --git a/storage/connect/user_connect.h b/storage/connect/user_connect.h
index 7f37973f378..a883eb85934 100644
--- a/storage/connect/user_connect.h
+++ b/storage/connect/user_connect.h
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
/** @file user_connect.h
diff --git a/storage/connect/value.h b/storage/connect/value.h
index a670ade4c28..14a568c3549 100644
--- a/storage/connect/value.h
+++ b/storage/connect/value.h
@@ -271,7 +271,7 @@ class DllExport TYPVAL<PSZ>: public VALUE {
virtual void Reset(void) {*Strp = 0;}
virtual int GetValLen(void) {return Len;};
virtual int GetValPrec() {return (Ci) ? 1 : 0;}
- virtual int GetSize(void) {return (Strp) ? strlen(Strp) : 0;}
+ virtual int GetSize(void) {return (Strp) ? (int)strlen(Strp) : 0;}
virtual PSZ GetCharValue(void) {return Strp;}
virtual char GetTinyValue(void);
virtual uchar GetUTinyValue(void);
diff --git a/storage/connect/xindex.cpp b/storage/connect/xindex.cpp
index a2cf4e77b80..15fb71ab88a 100755
--- a/storage/connect/xindex.cpp
+++ b/storage/connect/xindex.cpp
@@ -81,7 +81,7 @@ int PlgMakeIndex(PGLOBAL g, PSZ name, PIXDEF pxdf, bool add)
{
int rc;
PTABLE tablep;
- PTDBASE tdbp;
+ PTDB tdbp;
PCATLG cat = PlgGetCatalog(g, true);
/*********************************************************************/
@@ -89,12 +89,12 @@ int PlgMakeIndex(PGLOBAL g, PSZ name, PIXDEF pxdf, bool add)
/*********************************************************************/
tablep = new(g) XTAB(name);
- if (!(tdbp = (PTDBASE)cat->GetTable(g, tablep)))
+ if (!(tdbp = cat->GetTable(g, tablep)))
rc = RC_NF;
else if (!tdbp->GetDef()->Indexable()) {
sprintf(g->Message, MSG(TABLE_NO_INDEX), name);
rc = RC_NF;
- } else if ((rc = tdbp->MakeIndex(g, pxdf, add)) == RC_INFO)
+ } else if ((rc = ((PTDBASE)tdbp)->MakeIndex(g, pxdf, add)) == RC_INFO)
rc = RC_OK; // No or remote index
return rc;
@@ -2738,7 +2738,7 @@ bool XHUGE::Read(PGLOBAL g, void *buf, int n, int size)
} // endif nbr
} else {
- char *buf[256];
+ char buf[256];
DWORD drc = GetLastError();
FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM |
diff --git a/storage/connect/xindex.h b/storage/connect/xindex.h
index ef2e934e5ee..2d10d72722e 100644
--- a/storage/connect/xindex.h
+++ b/storage/connect/xindex.h
@@ -184,7 +184,7 @@ class DllExport XXBASE : public CSORT, public BLOCK {
virtual bool IsRandom(void) {return true;}
virtual bool IsDynamic(void) {return Dynamic;}
virtual void SetDynamic(bool dyn) {Dynamic = dyn;}
- virtual bool HaveSame(void) {return false;}
+//virtual bool HaveSame(void) {return false;}
virtual int GetCurPos(void) {return Cur_K;}
virtual void SetNval(int n) {assert(n == 1);}
virtual void SetOp(OPVAL op) {Op = op;}
@@ -256,7 +256,7 @@ class DllExport XINDEX : public XXBASE {
// Implementation
virtual IDT GetType(void) {return TYPE_IDX_INDX;}
virtual bool IsMul(void) {return (Nval < Nk) ? true : Mul;}
- virtual bool HaveSame(void) {return Op == OP_SAME;}
+//virtual bool HaveSame(void) {return Op == OP_SAME;}
virtual int GetCurPos(void) {return (Pex) ? Pex[Cur_K] : Cur_K;}
virtual void SetNval(int n) {Nval = n;}
int GetMaxSame(void) {return MaxSame;}
diff --git a/storage/connect/xobject.h b/storage/connect/xobject.h
index d78cd09f9a4..8f6c23c4aeb 100644
--- a/storage/connect/xobject.h
+++ b/storage/connect/xobject.h
@@ -127,7 +127,8 @@ class DllExport STRING : public BLOCK {
// Implementation
inline int GetLength(void) {return (int)Length;}
- inline PSZ GetStr(void) {return Strp;}
+ inline void SetLength(uint n) {Length = n;}
+ inline PSZ GetStr(void) {return Strp;}
inline uint32 GetSize(void) {return Size;}
// Methods
diff --git a/storage/connect/xtable.h b/storage/connect/xtable.h
index e18a08a54b8..4aeea05946a 100644
--- a/storage/connect/xtable.h
+++ b/storage/connect/xtable.h
@@ -1,7 +1,7 @@
/**************** Table H Declares Source Code File (.H) ***************/
-/* Name: TABLE.H Version 2.3 */
+/* Name: TABLE.H Version 2.4 */
/* */
-/* (C) Copyright to the author Olivier BERTRAND 1999-2015 */
+/* (C) Copyright to the author Olivier BERTRAND 1999-2017 */
/* */
/* This file contains the TBX, OPJOIN and TDB class definitions. */
/***********************************************************************/
@@ -17,6 +17,7 @@
#include "block.h"
#include "colblk.h"
#include "m_ctype.h"
+#include "reldef.h"
typedef class CMD *PCMD;
typedef struct st_key_range key_range;
@@ -32,24 +33,30 @@ class CMD : public BLOCK {
char *Cmd;
}; // end of class CMD
+#if 0
// Condition filter structure
class CONDFIL : public BLOCK {
public:
// Constructor
CONDFIL(const Item *cond, uint idx, AMT type)
{
- Cond = cond; Idx = idx; Type = type; Body = NULL; Op = OP_XX; Cmds = NULL;
+ Cond = cond; Idx = idx; Type = type; Op = OP_XX;
+ Cmds = NULL; All = true; Body = NULL, Having = NULL;
}
// Members
const Item *Cond;
AMT Type;
uint Idx;
- char *Body;
OPVAL Op;
PCMD Cmds;
+ bool All;
+ char *Body;
+ char *Having;
}; // end of class CONDFIL
+#endif // 0
+typedef class EXTCOL *PEXTCOL;
typedef class CONDFIL *PCFIL;
typedef class TDBCAT *PTDBCAT;
typedef class CATCOL *PCATCOL;
@@ -64,47 +71,61 @@ class DllExport TDB: public BLOCK { // Table Descriptor Block.
TDB(PTDB tdbp);
// Implementation
- static void SetTnum(int n) {Tnum = n;}
- inline PTDB GetOrig(void) {return To_Orig;}
- inline TUSE GetUse(void) {return Use;}
- inline PCFIL GetCondFil(void) {return To_CondFil;}
- inline LPCSTR GetName(void) {return Name;}
- inline PTABLE GetTable(void) {return To_Table;}
- inline PCOL GetColumns(void) {return Columns;}
- inline int GetDegree(void) {return Degree;}
- inline MODE GetMode(void) {return Mode;}
- inline PFIL GetFilter(void) {return To_Filter;}
- inline void SetFilter(PFIL fp) {To_Filter = fp;}
- inline void SetOrig(PTDB txp) {To_Orig = txp;}
- inline void SetUse(TUSE n) {Use = n;}
- inline void SetCondFil(PCFIL cfp) {To_CondFil = cfp;}
- inline void SetNext(PTDB tdbp) {Next = tdbp;}
- inline void SetName(LPCSTR name) {Name = name;}
- inline void SetTable(PTABLE tablep) {To_Table = tablep;}
- inline void SetColumns(PCOL colp) {Columns = colp;}
- inline void SetDegree(int degree) {Degree = degree;}
- inline void SetMode(MODE mode) {Mode = mode;}
+ static void SetTnum(int n) {Tnum = n;}
+ inline PTABDEF GetDef(void) {return To_Def;}
+ inline PTDB GetOrig(void) {return To_Orig;}
+ inline TUSE GetUse(void) {return Use;}
+ inline PCFIL GetCondFil(void) {return To_CondFil;}
+ inline LPCSTR GetName(void) {return Name;}
+ inline PTABLE GetTable(void) {return To_Table;}
+ inline PCOL GetColumns(void) {return Columns;}
+ inline int GetDegree(void) {return Degree;}
+ inline MODE GetMode(void) {return Mode;}
+ inline PFIL GetFilter(void) {return To_Filter;}
+ inline PCOL GetSetCols(void) {return To_SetCols;}
+ inline void SetSetCols(PCOL colp) {To_SetCols = colp;}
+ inline void SetFilter(PFIL fp) {To_Filter = fp;}
+ inline void SetOrig(PTDB txp) {To_Orig = txp;}
+ inline void SetUse(TUSE n) {Use = n;}
+ inline void SetCondFil(PCFIL cfp) {To_CondFil = cfp;}
+ inline void SetNext(PTDB tdbp) {Next = tdbp;}
+ inline void SetName(LPCSTR name) {Name = name;}
+ inline void SetTable(PTABLE tablep) {To_Table = tablep;}
+ inline void SetColumns(PCOL colp) {Columns = colp;}
+ inline void SetDegree(int degree) {Degree = degree;}
+ inline void SetMode(MODE mode) {Mode = mode;}
// Properties
- virtual AMT GetAmType(void) {return TYPE_AM_ERROR;}
- virtual int GetTdb_No(void) {return Tdb_No;}
- virtual PTDB GetNext(void) {return Next;}
- virtual PCATLG GetCat(void) {return NULL;}
- virtual void SetAbort(bool) {;}
+ virtual AMT GetAmType(void) {return TYPE_AM_ERROR;}
+ virtual bool IsRemote(void) {return false;}
+ virtual bool IsIndexed(void) {return false;}
+ virtual int GetTdb_No(void) {return Tdb_No;}
+ virtual PTDB GetNext(void) {return Next;}
+ virtual PCATLG GetCat(void) {return NULL;}
+ virtual void SetAbort(bool) {;}
+ virtual PKXBASE GetKindex(void) {return NULL;}
// Methods
virtual bool IsSame(PTDB tp) {return tp == this;}
- virtual bool IsSpecial(PSZ name) = 0;
- virtual bool GetBlockValues(PGLOBAL) {return false;}
+ virtual bool IsSpecial(PSZ name);
+ virtual bool IsReadOnly(void) {return Read_Only;}
+ virtual bool IsView(void) {return FALSE;}
+ virtual PSZ GetPath(void);
+ virtual RECFM GetFtype(void) {return RECFM_NAF;}
+ virtual bool GetBlockValues(PGLOBAL) { return false; }
virtual int Cardinality(PGLOBAL) {return 0;}
- virtual int GetMaxSize(PGLOBAL) = 0;
+ virtual int GetRecpos(void) = 0;
+ virtual bool SetRecpos(PGLOBAL g, int recpos);
+ virtual int GetMaxSize(PGLOBAL) = 0;
virtual int GetProgMax(PGLOBAL) = 0;
- virtual int GetProgCur(void) = 0;
- virtual int RowNumber(PGLOBAL g, bool b = false);
- virtual bool IsReadOnly(void) {return true;}
- virtual const CHARSET_INFO *data_charset() {return NULL;}
+ virtual int GetProgCur(void) {return GetRecpos();}
+ virtual PSZ GetFile(PGLOBAL) {return "Not a file";}
+ virtual void SetFile(PGLOBAL, PSZ) {}
+ virtual void ResetDB(void) {}
+ virtual void ResetSize(void) {MaxSize = -1;}
+ virtual int RowNumber(PGLOBAL g, bool b = false);
virtual PTDB Duplicate(PGLOBAL) {return NULL;}
- virtual PTDB CopyOne(PTABS) {return this;}
+ virtual PTDB Clone(PTABS) {return this;}
virtual PTDB Copy(PTABS t);
virtual void PrintAM(FILE *f, char *m)
{fprintf(f, "%s AM(%d)\n", m, GetAmType());}
@@ -112,10 +133,15 @@ class DllExport TDB: public BLOCK { // Table Descriptor Block.
virtual void Print(PGLOBAL g, char *ps, uint z);
virtual PSZ GetServer(void) = 0;
virtual int GetBadLines(void) {return 0;}
+ virtual CHARSET_INFO *data_charset(void);
- // Database pure virtual routines
- virtual PCOL ColDB(PGLOBAL g, PSZ name, int num) = 0;
- virtual void MarkDB(PGLOBAL, PTDB) = 0;
+ // Database routines
+ virtual PCOL ColDB(PGLOBAL g, PSZ name, int num);
+ virtual PCOL MakeCol(PGLOBAL, PCOLDEF, PCOL, int)
+ {assert(false); return NULL;}
+ virtual PCOL InsertSpecialColumn(PCOL colp);
+ virtual PCOL InsertSpcBlk(PGLOBAL g, PCOLDEF cdp);
+ virtual void MarkDB(PGLOBAL g, PTDB tdb2);
virtual bool OpenDB(PGLOBAL) = 0;
virtual int ReadDB(PGLOBAL) = 0;
virtual int WriteDB(PGLOBAL) = 0;
@@ -126,20 +152,26 @@ class DllExport TDB: public BLOCK { // Table Descriptor Block.
protected:
// Members
- PTDB To_Orig; // Pointer to original if it is a copy
- TUSE Use;
- PFIL To_Filter;
- PCFIL To_CondFil; // To condition filter structure
- static int Tnum; // Used to generate Tdb_no's
- const int Tdb_No; // GetTdb_No() is always 0 for OPJOIN
- PTDB Next; // Next in linearized queries
- PTABLE To_Table; // Points to the XTAB object
- LPCSTR Name; // Table name
- PCOL Columns; // Points to the first column of the table
- MODE Mode; // 10 Read, 30 Update, 40 Insert, 50 Delete
- int Degree; // Number of columns
- int Cardinal; // Table number of rows
- }; // end of class TDB
+ PTDB To_Orig; // Pointer to original if it is a copy
+ PTABDEF To_Def; // Points to catalog description block
+ TUSE Use;
+ PFIL To_Filter;
+ PCFIL To_CondFil; // To condition filter structure
+ static int Tnum; // Used to generate Tdb_no's
+ const int Tdb_No; // GetTdb_No() is always 0 for OPJOIN
+ PTDB Next; // Next in linearized queries
+ PTABLE To_Table; // Points to the XTAB object
+ LPCSTR Name; // Table name
+ PCOL Columns; // Points to the first column of the table
+ PCOL To_SetCols; // Points to updated columns
+ MODE Mode; // 10 Read, 30 Update, 40 Insert, 50 Delete
+ int Degree; // Number of columns
+ int Cardinal; // Table number of rows
+ int MaxSize; // Max size in number of lines
+ bool Read_Only; // True for read only tables
+ const CHARSET_INFO *m_data_charset;
+ const char *csname; // Table charset name
+}; // end of class TDB
/***********************************************************************/
/* This is the base class for all query tables (except decode). */
@@ -155,50 +187,50 @@ class DllExport TDBASE : public TDB {
// Implementation
inline int GetKnum(void) {return Knum;}
- inline PTABDEF GetDef(void) {return To_Def;}
- inline PKXBASE GetKindex(void) {return To_Kindex;}
- inline PCOL GetSetCols(void) {return To_SetCols;}
- inline void SetSetCols(PCOL colp) {To_SetCols = colp;}
+//inline PTABDEF GetDef(void) {return To_Def;}
+//inline PCOL GetSetCols(void) {return To_SetCols;}
+//inline void SetSetCols(PCOL colp) {To_SetCols = colp;}
inline void SetKey_Col(PCOL *cpp) {To_Key_Col = cpp;}
inline void SetXdp(PIXDEF xdp) {To_Xdp = xdp;}
inline void SetKindex(PKXBASE kxp) {To_Kindex = kxp;}
// Properties
- void ResetKindex(PGLOBAL g, PKXBASE kxp);
+ virtual PKXBASE GetKindex(void) {return To_Kindex;}
+ void ResetKindex(PGLOBAL g, PKXBASE kxp);
PCOL Key(int i) {return (To_Key_Col) ? To_Key_Col[i] : NULL;}
// Methods
virtual bool IsUsingTemp(PGLOBAL) {return false;}
- virtual bool IsIndexed(void) {return false;}
- virtual bool IsSpecial(PSZ name);
+//virtual bool IsIndexed(void) {return false;}
+//virtual bool IsSpecial(PSZ name);
virtual PCATLG GetCat(void);
- virtual PSZ GetPath(void);
+//virtual PSZ GetPath(void);
virtual void PrintAM(FILE *f, char *m);
- virtual RECFM GetFtype(void) {return RECFM_NAF;}
+//virtual RECFM GetFtype(void) {return RECFM_NAF;}
//virtual int GetAffectedRows(void) {return -1;}
- virtual int GetRecpos(void) = 0;
- virtual bool SetRecpos(PGLOBAL g, int recpos);
- virtual bool IsReadOnly(void) {return Read_Only;}
- virtual bool IsView(void) {return FALSE;}
- virtual CHARSET_INFO *data_charset(void);
+//virtual int GetRecpos(void) = 0;
+//virtual bool SetRecpos(PGLOBAL g, int recpos);
+//virtual bool IsReadOnly(void) {return Read_Only;}
+//virtual bool IsView(void) {return FALSE;}
+//virtual CHARSET_INFO *data_charset(void);
virtual int GetProgMax(PGLOBAL g) {return GetMaxSize(g);}
- virtual int GetProgCur(void) {return GetRecpos();}
- virtual PSZ GetFile(PGLOBAL) {return "Not a file";}
- virtual int GetRemote(void) {return 0;}
- virtual void SetFile(PGLOBAL, PSZ) {}
- virtual void ResetDB(void) {}
- virtual void ResetSize(void) {MaxSize = -1;}
+//virtual int GetProgCur(void) {return GetRecpos();}
+//virtual PSZ GetFile(PGLOBAL) {return "Not a file";}
+//virtual int GetRemote(void) {return 0;}
+//virtual void SetFile(PGLOBAL, PSZ) {}
+//virtual void ResetDB(void) {}
+//virtual void ResetSize(void) {MaxSize = -1;}
virtual void RestoreNrec(void) {}
virtual int ResetTableOpt(PGLOBAL g, bool dop, bool dox);
virtual PSZ GetServer(void) {return "Current";}
// Database routines
- virtual PCOL ColDB(PGLOBAL g, PSZ name, int num);
- virtual PCOL MakeCol(PGLOBAL, PCOLDEF, PCOL, int)
- {assert(false); return NULL;}
- virtual PCOL InsertSpecialColumn(PCOL colp);
- virtual PCOL InsertSpcBlk(PGLOBAL g, PCOLDEF cdp);
- virtual void MarkDB(PGLOBAL g, PTDB tdb2);
+//virtual PCOL ColDB(PGLOBAL g, PSZ name, int num);
+//virtual PCOL MakeCol(PGLOBAL, PCOLDEF, PCOL, int)
+// {assert(false); return NULL;}
+//virtual PCOL InsertSpecialColumn(PCOL colp);
+//virtual PCOL InsertSpcBlk(PGLOBAL g, PCOLDEF cdp);
+//virtual void MarkDB(PGLOBAL g, PTDB tdb2);
virtual int MakeIndex(PGLOBAL g, PIXDEF, bool)
{strcpy(g->Message, "Remote index"); return RC_INFO;}
virtual bool ReadKey(PGLOBAL, OPVAL, const key_range *)
@@ -209,19 +241,19 @@ class DllExport TDBASE : public TDB {
"This function should not be called for this table"); return true;}
// Members
- PTABDEF To_Def; // Points to catalog description block
+//PTABDEF To_Def; // Points to catalog description block
PXOB *To_Link; // Points to column of previous relations
PCOL *To_Key_Col; // Points to key columns in current file
PKXBASE To_Kindex; // Points to table key index
PIXDEF To_Xdp; // To the index definition block
- PCOL To_SetCols; // Points to updated columns
+//PCOL To_SetCols; // Points to updated columns
RECFM Ftype; // File type: 0-var 1-fixed 2-binary (VCT)
- int MaxSize; // Max size in number of lines
+//int MaxSize; // Max size in number of lines
int Knum; // Size of key arrays
- bool Read_Only; // True for read only tables
- const CHARSET_INFO *m_data_charset;
- const char *csname; // Table charset name
- }; // end of class TDBASE
+//bool Read_Only; // True for read only tables
+//const CHARSET_INFO *m_data_charset;
+//const char *csname; // Table charset name
+}; // end of class TDBASE
/***********************************************************************/
/* The abstract base class declaration for the catalog tables. */
@@ -243,7 +275,8 @@ class DllExport TDBCAT : public TDBASE {
// Database routines
virtual PCOL MakeCol(PGLOBAL g, PCOLDEF cdp, PCOL cprec, int n);
- virtual int GetMaxSize(PGLOBAL g);
+ virtual int Cardinality(PGLOBAL) {return 10;} // To avoid assert
+ virtual int GetMaxSize(PGLOBAL g);
virtual bool OpenDB(PGLOBAL g);
virtual int ReadDB(PGLOBAL g);
virtual int WriteDB(PGLOBAL g);
@@ -275,7 +308,7 @@ class DllExport CATCOL : public COLBLK {
virtual int GetAmType(void) {return TYPE_AM_ODBC;}
// Methods
- virtual void ReadColumn(PGLOBAL g);
+ virtual void ReadColumn(PGLOBAL g);
protected:
CATCOL(void) {} // Default constructor not to be used
diff --git a/storage/connect/zip.c b/storage/connect/zip.c
index ea54853e858..4bbe31ab7dd 100644
--- a/storage/connect/zip.c
+++ b/storage/connect/zip.c
@@ -637,7 +637,7 @@ local ZPOS64_T zip64local_SearchCentralDir64(const zlib_filefunc64_32_def* pzlib
return relativeOffset;
}
-int LoadCentralDirectoryRecord(zip64_internal* pziinit)
+static int LoadCentralDirectoryRecord(zip64_internal* pziinit)
{
int err=ZIP_OK;
ZPOS64_T byte_before_the_zipfile;/* byte before the zipfile, (>0 for sfx)*/
@@ -846,7 +846,7 @@ int LoadCentralDirectoryRecord(zip64_internal* pziinit)
/************************************************************/
-extern zipFile ZEXPORT zipOpen3 (const void *pathname, int append, zipcharpc* globalcomment, zlib_filefunc64_32_def* pzlib_filefunc64_32_def)
+static zipFile zipOpen3 (const void *pathname, int append, zipcharpc* globalcomment, zlib_filefunc64_32_def* pzlib_filefunc64_32_def)
{
zip64_internal ziinit;
zip64_internal* zi;
@@ -955,7 +955,7 @@ extern zipFile ZEXPORT zipOpen64 (const void* pathname, int append)
return zipOpen3(pathname,append,NULL,NULL);
}
-int Write_LocalFileHeader(zip64_internal* zi, const char* filename, uInt size_extrafield_local, const void* extrafield_local)
+static int Write_LocalFileHeader(zip64_internal* zi, const char* filename, uInt size_extrafield_local, const void* extrafield_local)
{
/* write the local header */
int err;
@@ -1752,7 +1752,7 @@ extern int ZEXPORT zipCloseFileInZip (zipFile file)
return zipCloseFileInZipRaw (file,0,0);
}
-int Write_Zip64EndOfCentralDirectoryLocator(zip64_internal* zi, ZPOS64_T zip64eocd_pos_inzip)
+static int Write_Zip64EndOfCentralDirectoryLocator(zip64_internal* zi, ZPOS64_T zip64eocd_pos_inzip)
{
int err = ZIP_OK;
ZPOS64_T pos = zip64eocd_pos_inzip - zi->add_position_when_writting_offset;
@@ -1774,7 +1774,7 @@ int Write_Zip64EndOfCentralDirectoryLocator(zip64_internal* zi, ZPOS64_T zip64eo
return err;
}
-int Write_Zip64EndOfCentralDirectoryRecord(zip64_internal* zi, uLong size_centraldir, ZPOS64_T centraldir_pos_inzip)
+static int Write_Zip64EndOfCentralDirectoryRecord(zip64_internal* zi, uLong size_centraldir, ZPOS64_T centraldir_pos_inzip)
{
int err = ZIP_OK;
@@ -1813,7 +1813,7 @@ int Write_Zip64EndOfCentralDirectoryRecord(zip64_internal* zi, uLong size_centra
}
return err;
}
-int Write_EndOfCentralDirectoryRecord(zip64_internal* zi, uLong size_centraldir, ZPOS64_T centraldir_pos_inzip)
+static int Write_EndOfCentralDirectoryRecord(zip64_internal* zi, uLong size_centraldir, ZPOS64_T centraldir_pos_inzip)
{
int err = ZIP_OK;
@@ -1861,7 +1861,7 @@ int Write_EndOfCentralDirectoryRecord(zip64_internal* zi, uLong size_centraldir,
return err;
}
-int Write_GlobalComment(zip64_internal* zi, const char* global_comment)
+static int Write_GlobalComment(zip64_internal* zi, const char* global_comment)
{
int err = ZIP_OK;
uInt size_global_comment = 0;
diff --git a/storage/innobase/btr/btr0cur.cc b/storage/innobase/btr/btr0cur.cc
index 7d93c495aa0..c15784a97a4 100644
--- a/storage/innobase/btr/btr0cur.cc
+++ b/storage/innobase/btr/btr0cur.cc
@@ -3519,8 +3519,6 @@ btr_cur_update_alloc_zip_func(
const page_t* page = page_cur_get_page(cursor);
ut_ad(page_zip == page_cur_get_page_zip(cursor));
-
- ut_ad(page_zip);
ut_ad(!dict_index_is_ibuf(index));
ut_ad(rec_offs_validate(page_cur_get_rec(cursor), index, offsets));
@@ -6267,7 +6265,6 @@ btr_cur_disown_inherited_fields(
ut_ad(rec_offs_validate(rec, index, offsets));
ut_ad(!rec_offs_comp(offsets) || !rec_get_node_ptr_flag(rec));
ut_ad(rec_offs_any_extern(offsets));
- ut_ad(mtr);
for (i = 0; i < rec_offs_n_fields(offsets); i++) {
if (rec_offs_nth_extern(offsets, i)
@@ -6329,9 +6326,6 @@ btr_push_update_extern_fields(
ulint n;
const upd_field_t* uf;
- ut_ad(tuple);
- ut_ad(update);
-
uf = update->fields;
n = upd_get_n_fields(update);
@@ -6625,7 +6619,6 @@ btr_store_big_rec_extern_fields(
ut_ad(rec_offs_validate(rec, index, offsets));
ut_ad(rec_offs_any_extern(offsets));
- ut_ad(btr_mtr);
ut_ad(mtr_memo_contains_flagged(btr_mtr, dict_index_get_lock(index),
MTR_MEMO_X_LOCK | MTR_MEMO_SX_LOCK));
ut_ad(mtr_is_block_fix(
diff --git a/storage/innobase/btr/btr0scrub.cc b/storage/innobase/btr/btr0scrub.cc
index c30227ef085..4cb46dd415f 100644
--- a/storage/innobase/btr/btr0scrub.cc
+++ b/storage/innobase/btr/btr0scrub.cc
@@ -118,21 +118,33 @@ log_scrub_failure(
Lock dict mutexes */
static
bool
-btr_scrub_lock_dict_func(ulint space, bool lock_to_close_table,
+btr_scrub_lock_dict_func(ulint space_id, bool lock_to_close_table,
const char * file, uint line)
{
time_t start = time(0);
time_t last = start;
+ /* FIXME: this is not the proper way of doing things. The
+ dict_sys->mutex should not be held by any thread for longer
+ than a few microseconds. It must not be held during I/O,
+ for example. So, what is the purpose for this busy-waiting?
+ This function should be rewritten as part of MDEV-8139:
+ Fix scrubbing tests. */
+
while (mutex_enter_nowait(&(dict_sys->mutex))) {
/* if we lock to close a table, we wait forever
* if we don't lock to close a table, we check if space
* is closing, and then instead give up
*/
if (lock_to_close_table == false) {
- if (fil_crypt_is_closing(space)) {
+ fil_space_t* space = fil_space_acquire(space_id);
+ if (!space || space->stop_new_ops) {
+ if (space) {
+ fil_space_release(space);
+ }
return false;
}
+ fil_space_release(space);
}
os_thread_sleep(250000);
@@ -141,9 +153,10 @@ btr_scrub_lock_dict_func(ulint space, bool lock_to_close_table,
if (now >= last + 30) {
fprintf(stderr,
"WARNING: %s:%u waited %lu seconds for"
- " dict_sys lock, space: %lu"
+ " dict_sys lock, space: " ULINTPF
" lock_to_close_table: %u\n",
- file, line, (unsigned long)(now - start), space,
+ file, line, (unsigned long)(now - start),
+ space_id,
lock_to_close_table);
last = now;
@@ -189,16 +202,24 @@ void
btr_scrub_table_close_for_thread(
btr_scrub_t *scrub_data)
{
- if (scrub_data->current_table == NULL)
+ if (scrub_data->current_table == NULL) {
return;
+ }
- bool lock_for_close = true;
- btr_scrub_lock_dict(scrub_data->space, lock_for_close);
+ fil_space_t* space = fil_space_acquire(scrub_data->space);
- /* perform the actual closing */
- btr_scrub_table_close(scrub_data->current_table);
+ /* If tablespace is not marked as stopping perform
+ the actual close. */
+ if (space && !space->is_stopping()) {
+ mutex_enter(&dict_sys->mutex);
+ /* perform the actual closing */
+ btr_scrub_table_close(scrub_data->current_table);
+ mutex_exit(&dict_sys->mutex);
+ }
- btr_scrub_unlock_dict();
+ if (space) {
+ fil_space_release(space);
+ }
scrub_data->current_table = NULL;
scrub_data->current_index = NULL;
diff --git a/storage/innobase/buf/buf0buf.cc b/storage/innobase/buf/buf0buf.cc
index 93e0bebfe4e..11fe77d75de 100644
--- a/storage/innobase/buf/buf0buf.cc
+++ b/storage/innobase/buf/buf0buf.cc
@@ -403,22 +403,17 @@ buf_pool_register_chunk(
chunk->blocks->frame, chunk));
}
+/** Decrypt a page.
+@param[in,out] bpage Page control block
+@return whether the operation was successful */
+static
+bool
+buf_page_decrypt_after_read(buf_page_t* bpage);
+
/* prototypes for new functions added to ha_innodb.cc */
trx_t* innobase_get_trx();
/********************************************************************//**
-Check if page is maybe compressed, encrypted or both when we encounter
-corrupted page. Note that we can't be 100% sure if page is corrupted
-or decrypt/decompress just failed.
-*/
-static
-ibool
-buf_page_check_corrupt(
-/*===================*/
- buf_page_t* bpage); /*!< in/out: buffer page read from
- disk */
-
-/********************************************************************//**
Gets the smallest oldest_modification lsn for any page in the pool. Returns
zero if all modified pages have been flushed to disk.
@return oldest modification in pool, zero if none */
@@ -611,7 +606,6 @@ buf_page_is_zeroes(
@param[in] curr_algo current checksum algorithm
@param[in] use_legacy_big_endian use legacy big endian algorithm
@return true if the page is in crc32 checksum format. */
-UNIV_INLINE
bool
buf_page_is_checksum_valid_crc32(
const byte* read_buf,
@@ -670,7 +664,6 @@ invalid:
@param[in] log_file file pointer to log_file
@param[in] curr_algo current checksum algorithm
@return true if the page is in innodb checksum format. */
-UNIV_INLINE
bool
buf_page_is_checksum_valid_innodb(
const byte* read_buf,
@@ -767,7 +760,6 @@ buf_page_is_checksum_valid_innodb(
@param[in] log_file file pointer to log_file
@param[in] curr_algo current checksum algorithm
@return true if the page is in none checksum format. */
-UNIV_INLINE
bool
buf_page_is_checksum_valid_none(
const byte* read_buf,
@@ -792,7 +784,7 @@ buf_page_is_checksum_valid_none(
<< " lsn " << mach_read_from_4(read_buf
+ FIL_PAGE_LSN));
}
-#endif
+#endif /* DBUG_OFF */
#ifdef UNIV_INNOCHECKSUM
if (is_log_enabled
@@ -806,7 +798,6 @@ buf_page_is_checksum_valid_none(
}
#endif /* UNIV_INNOCHECKSUM */
-
return(checksum_field1 == checksum_field2
&& checksum_field1 == BUF_NO_CHECKSUM_MAGIC);
}
@@ -816,18 +807,18 @@ buf_page_is_checksum_valid_none(
the LSN
@param[in] read_buf database page
@param[in] page_size page size
-@param[in] skip_checksum if true, skip checksum
+@param[in] space tablespace
@param[in] page_no page number of given read_buf
@param[in] strict_check true if strict-check option is enabled
@param[in] is_log_enabled true if log option is enabled
@param[in] log_file file pointer to log_file
@return TRUE if corrupted */
-ibool
+bool
buf_page_is_corrupted(
bool check_lsn,
const byte* read_buf,
const page_size_t& page_size,
- bool skip_checksum
+ const fil_space_t* space
#ifdef UNIV_INNOCHECKSUM
,uintmax_t page_no,
bool strict_check,
@@ -838,40 +829,35 @@ buf_page_is_corrupted(
{
ulint checksum_field1;
ulint checksum_field2;
- bool no_checksum = false;
#ifndef UNIV_INNOCHECKSUM
- ulint space_id = mach_read_from_4(
- read_buf + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID);
- ulint page_type = mach_read_from_4(
- read_buf + FIL_PAGE_TYPE);
- no_checksum = (page_type == FIL_PAGE_PAGE_COMPRESSED ||
- page_type == FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED);
- fil_space_crypt_t* crypt_data = fil_space_get_crypt_data(space_id);
+ DBUG_EXECUTE_IF("buf_page_import_corrupt_failure", return(true); );
- /* Page is encrypted if encryption information is found from
- tablespace and page contains used key_version. This is true
- also for pages first compressed and then encrypted. */
- if (crypt_data &&
- crypt_data->type != CRYPT_SCHEME_UNENCRYPTED &&
- fil_page_is_encrypted(read_buf)) {
- no_checksum = true;
- }
+ ulint page_type = mach_read_from_2(
+ read_buf + FIL_PAGE_TYPE);
- /* Return early if there is no checksum or END_LSN */
- if (no_checksum) {
- return (FALSE);
+ /* We can trust page type if page compression is set on tablespace
+ flags because page compression flag means file must have been
+ created with 10.1 (later than 5.5 code base). In 10.1 page
+ compressed tables do not contain post compression checksum and
+ FIL_PAGE_END_LSN_OLD_CHKSUM field stored. Note that space can
+ be null if we are in fil_check_first_page() and first page
+ is not compressed or encrypted. Page checksum is verified
+ after decompression (i.e. normally pages are already
+ decompressed at this stage). */
+ if ((page_type == FIL_PAGE_PAGE_COMPRESSED ||
+ page_type == FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED)
+ && space && FSP_FLAGS_HAS_PAGE_COMPRESSION(space->flags)) {
+ return(false);
}
#else
if (mach_read_from_4(read_buf+FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION) != 0
|| mach_read_from_2(read_buf+FIL_PAGE_TYPE) == FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED) {
- no_checksum= true;
+ return(false);
}
-
#endif
- DBUG_EXECUTE_IF("buf_page_import_corrupt_failure", return(TRUE); );
- if (!no_checksum && !page_size.is_compressed()
+ if (!page_size.is_compressed()
&& memcmp(read_buf + FIL_PAGE_LSN + 4,
read_buf + page_size.logical()
- FIL_PAGE_END_LSN_OLD_CHKSUM + 4, 4)) {
@@ -886,7 +872,7 @@ buf_page_is_corrupted(
<< mach_read_from_4(read_buf + UNIV_PAGE_SIZE - FIL_PAGE_END_LSN_OLD_CHKSUM + 4)
<< " do not match";
#endif
- return(TRUE);
+ return(true);
}
#ifndef UNIV_INNOCHECKSUM
@@ -923,9 +909,8 @@ buf_page_is_corrupted(
/* Check whether the checksum fields have correct values */
- if (srv_checksum_algorithm == SRV_CHECKSUM_ALGORITHM_NONE
- || skip_checksum) {
- return(FALSE);
+ if (srv_checksum_algorithm == SRV_CHECKSUM_ALGORITHM_NONE) {
+ return(false);
}
if (page_size.is_compressed()) {
@@ -984,7 +969,7 @@ buf_page_is_corrupted(
" is empty and uncorrupted\n",
page_no);
}
- return(FALSE);
+ return(false);
}
#else
return(i < page_size.logical());
@@ -1013,7 +998,7 @@ buf_page_is_corrupted(
page_no, is_log_enabled, log_file, curr_algo,
#endif /* UNIV_INNOCHECKSUM */
false)) {
- return(FALSE);
+ return(false);
}
if (buf_page_is_checksum_valid_none(read_buf,
@@ -1048,7 +1033,7 @@ buf_page_is_corrupted(
checksum_field1);
}
#endif /* UNIV_INNOCHECKSUM */
- return(FALSE);
+ return(false);
}
/* We need to check whether the stored checksum matches legacy
@@ -1064,7 +1049,7 @@ buf_page_is_corrupted(
#endif /* UNIV_INNOCHECKSUM */
true)) {
- return(FALSE);
+ return(false);
}
legacy_checksum_checked = true;
}
@@ -1083,7 +1068,7 @@ buf_page_is_corrupted(
page_id);
}
#endif /* UNIV_INNOCHECKSUM */
- return(FALSE);
+ return(false);
}
/* If legacy checksum is not checked, do it now. */
@@ -1095,7 +1080,7 @@ buf_page_is_corrupted(
true)) {
legacy_big_endian_checksum = true;
- return(FALSE);
+ return(false);
}
#ifdef UNIV_INNOCHECKSUM
@@ -1105,7 +1090,7 @@ buf_page_is_corrupted(
page_no);
}
#endif /* UNIV_INNOCHECKSUM */
- return(TRUE);
+ return(true);
case SRV_CHECKSUM_ALGORITHM_INNODB:
case SRV_CHECKSUM_ALGORITHM_STRICT_INNODB:
@@ -1116,7 +1101,7 @@ buf_page_is_corrupted(
, page_no, is_log_enabled, log_file, curr_algo
#endif /* UNIV_INNOCHECKSUM */
)) {
- return(FALSE);
+ return(false);
}
if (buf_page_is_checksum_valid_none(read_buf,
@@ -1150,7 +1135,7 @@ buf_page_is_corrupted(
checksum_field1);
}
#endif /* UNIV_INNOCHECKSUM */
- return(FALSE);
+ return(false);
}
#ifdef UNIV_INNOCHECKSUM
@@ -1175,7 +1160,7 @@ buf_page_is_corrupted(
}
#endif /* UNIV_INNOCHECKSUM */
- return(FALSE);
+ return(false);
}
#ifdef UNIV_INNOCHECKSUM
@@ -1185,7 +1170,7 @@ buf_page_is_corrupted(
page_no);
}
#endif /* UNIV_INNOCHECKSUM */
- return(TRUE);
+ return(true);
case SRV_CHECKSUM_ALGORITHM_STRICT_NONE:
@@ -1216,7 +1201,7 @@ buf_page_is_corrupted(
SRV_CHECKSUM_ALGORITHM_CRC32,
page_id);
#endif /* UNIV_INNOCHECKSUM */
- return(FALSE);
+ return(false);
}
if (buf_page_is_checksum_valid_innodb(read_buf,
@@ -1230,7 +1215,7 @@ buf_page_is_corrupted(
SRV_CHECKSUM_ALGORITHM_INNODB,
page_id);
#endif /* UNIV_INNOCHECKSUM */
- return(FALSE);
+ return(false);
}
#ifdef UNIV_INNOCHECKSUM
@@ -1240,17 +1225,17 @@ buf_page_is_corrupted(
page_no);
}
#endif /* UNIV_INNOCHECKSUM */
- return(TRUE);
+ return(true);
case SRV_CHECKSUM_ALGORITHM_NONE:
- /* should have returned FALSE earlier */
+ /* should have returned false earlier */
break;
/* no default so the compiler will emit a warning if new enum
is added and not handled here */
}
ut_error;
- return(FALSE);
+ return(false);
}
#ifndef UNIV_INNOCHECKSUM
@@ -1388,8 +1373,7 @@ buf_page_print(
case FIL_PAGE_INDEX:
case FIL_PAGE_RTREE:
index_id = btr_page_get_index_id(read_buf);
- ib::error() <<
- "InnoDB: Page may be an index page where"
+ ib::info() << "Page may be an index page where"
" index id is " << index_id;
index = dict_index_find_on_id_low(index_id);
@@ -1521,11 +1505,7 @@ buf_block_init(
block->page.io_fix = BUF_IO_NONE;
block->page.flush_observer = NULL;
block->page.key_version = 0;
- block->page.page_encrypted = false;
- block->page.page_compressed = false;
block->page.encrypted = false;
- block->page.stored_checksum = BUF_NO_CHECKSUM_MAGIC;
- block->page.calculated_checksum = BUF_NO_CHECKSUM_MAGIC;
block->page.real_size = 0;
block->page.write_size = 0;
block->modify_clock = 0;
@@ -4365,14 +4345,14 @@ loop:
} else if (retries < BUF_PAGE_READ_MAX_RETRIES) {
++retries;
- bool corrupted = true;
+ bool corrupted = false;
if (bpage) {
corrupted = buf_page_check_corrupt(bpage);
}
/* Do not try again for encrypted pages */
- if (!corrupted) {
+ if (corrupted && bpage->encrypted) {
BPageMutex* pmutex = buf_page_get_mutex(bpage);
buf_pool = buf_pool_from_bpage(bpage);
@@ -4400,13 +4380,13 @@ loop:
retries = BUF_PAGE_READ_MAX_RETRIES;
);
} else {
- bool corrupted = true;
+ bool corrupted = false;
if (bpage) {
corrupted = buf_page_check_corrupt(bpage);
}
- if (corrupted) {
+ if (corrupted && !bpage->encrypted) {
ib::fatal() << "Unable to read page " << page_id
<< " into the buffer pool after "
<< BUF_PAGE_READ_MAX_RETRIES << " attempts."
@@ -5208,10 +5188,6 @@ buf_page_init_low(
bpage->oldest_modification = 0;
bpage->write_size = 0;
bpage->key_version = 0;
- bpage->stored_checksum = BUF_NO_CHECKSUM_MAGIC;
- bpage->calculated_checksum = BUF_NO_CHECKSUM_MAGIC;
- bpage->page_encrypted = false;
- bpage->page_compressed = false;
bpage->encrypted = false;
bpage->real_size = 0;
bpage->slot = NULL;
@@ -5861,81 +5837,76 @@ buf_mark_space_corrupt(
Check if page is maybe compressed, encrypted or both when we encounter
corrupted page. Note that we can't be 100% sure if page is corrupted
or decrypt/decompress just failed.
-*/
-static
-ibool
+@param[in,out] bpage Page
+@return true if page corrupted, false if not */
+UNIV_INTERN
+bool
buf_page_check_corrupt(
-/*===================*/
- buf_page_t* bpage) /*!< in/out: buffer page read from disk */
+ buf_page_t* bpage)
{
byte* dst_frame = (bpage->zip.data) ? bpage->zip.data :
((buf_block_t*) bpage)->frame;
- bool page_compressed = bpage->page_encrypted;
- ulint stored_checksum = bpage->stored_checksum;
- ulint calculated_checksum = bpage->calculated_checksum;
- bool page_compressed_encrypted = bpage->page_compressed;
- ulint space_id = mach_read_from_4(
- dst_frame + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID);
- fil_space_crypt_t* crypt_data = fil_space_get_crypt_data(space_id);
- fil_space_t* space = fil_space_found_by_id(space_id);
- bool corrupted = true;
- ulint key_version = bpage->key_version;
-
- if (key_version != 0 || page_compressed_encrypted) {
+ fil_space_t* space = fil_space_acquire_silent(bpage->id.space());
+ bool still_encrypted = false;
+ bool corrupted = false;
+ fil_space_crypt_t* crypt_data = space ? space->crypt_data : NULL;
+
+ /* In buf_decrypt_after_read we have either decrypted the page if
+ page post encryption checksum matches and used key_id is found
+ from the encryption plugin. If checksum did not match page was
+ not decrypted and it could be either encrypted and corrupted
+ or corrupted or good page. If we decrypted, there page could
+ still be corrupted if used key does not match. */
+ still_encrypted = crypt_data
+ && crypt_data->type != CRYPT_SCHEME_UNENCRYPTED
+ && !bpage->encrypted
+ && fil_space_verify_crypt_checksum(dst_frame, bpage->size,
+ bpage->id.space(),
+ bpage->id.page_no());
+
+ if (!still_encrypted) {
+ /* If traditional checksums match, we assume that page is
+ not anymore encrypted. */
+ corrupted = buf_page_is_corrupted(
+ true, dst_frame, bpage->size, space);
+
+ if (!corrupted) {
+ bpage->encrypted = false;
+ }
+ }
+
+ /* Pages that we think are unencrypted but do not match the checksum
+ checks could be corrupted or encrypted or both. */
+ if (corrupted && !bpage->encrypted) {
+ /* An error will be reported by
+ buf_page_io_complete(). */
+ } else if (still_encrypted || (bpage->encrypted && corrupted)) {
bpage->encrypted = true;
- }
+ corrupted = true;
- if (key_version != 0 ||
- (crypt_data && crypt_data->type != CRYPT_SCHEME_UNENCRYPTED) ||
- page_compressed || page_compressed_encrypted) {
+ ib::error()
+ << "The page " << bpage->id << " in file "
+ << (space && space->name ? space->name : "NULL")
+ << " cannot be decrypted.";
- /* Page is really corrupted if post encryption stored
- checksum does not match calculated checksum after page was
- read. For pages compressed and then encrypted, there is no
- checksum. */
- corrupted = (!page_compressed_encrypted && stored_checksum != calculated_checksum);
+ ib::info()
+ << "However key management plugin or used key_version "
+ << bpage->key_version << " is not found or"
+ " used encryption algorithm or method does not match.";
- if (corrupted) {
- ib::error() << (page_compressed_encrypted ? "Maybe corruption" : "Corruption")
- << ": Block in space_id " << space_id
- << " in file " << (space ? space->name : "NULL")
- << " corrupted.";
-
- ib::error() << "Page based on contents "
- << ((key_version == 0 && page_compressed_encrypted == false) ? "not" : "maybe")
- << " encrypted.";
-
- if (stored_checksum != BUF_NO_CHECKSUM_MAGIC ||
- calculated_checksum != BUF_NO_CHECKSUM_MAGIC) {
- ib::error() << "Page stored checksum " << stored_checksum
- << " but calculated checksum "
- << calculated_checksum << " .";
- }
-
- ib::error() << "Reason could be that key_version " << key_version
- << " in page or in crypt_data " << crypt_data
- << " could not be found.";
- ib::error() << "Reason could be also that key management plugin is not found or"
- " used encryption algorithm or method does not match.";
- ib::error() << "Based on page page compressed"
- << page_compressed
- << ", compressed and encrypted "
- << page_compressed_encrypted << " .";
- } else {
- ib::error() << "Block in space_id "
- << space_id
- << " in file "
- << (space ? space->name : "NULL")
- << " encrypted.";
- ib::error() << "However key management plugin or used key_id "
- << key_version
- << " is not found or"
- << " used encryption algorithm or method does not match.";
- ib::error() << "Marking tablespace as missing. You may drop this table or"
- << " install correct key management plugin and key file.";
+ if (bpage->id.space() != TRX_SYS_SPACE) {
+ ib::info()
+ << "Marking tablespace as missing."
+ " You may drop this table or"
+ " install correct key management plugin"
+ " and key file.";
}
}
+ if (space) {
+ fil_space_release(space);
+ }
+
return corrupted;
}
@@ -5955,6 +5926,9 @@ buf_page_io_complete(
buf_pool_t* buf_pool = buf_pool_from_bpage(bpage);
const ibool uncompressed = (buf_page_get_state(bpage)
== BUF_BLOCK_FILE_PAGE);
+ byte* frame = NULL;
+ bool corrupted = false;
+
ut_a(buf_page_in_file(bpage));
/* We do not need protect io_fix here by mutex to read
@@ -5969,24 +5943,15 @@ buf_page_io_complete(
if (io_type == BUF_IO_READ) {
ulint read_page_no;
ulint read_space_id;
- byte* frame = NULL;
ut_ad(bpage->zip.data != NULL || ((buf_block_t*)bpage)->frame != NULL);
- if (!buf_page_decrypt_after_read(bpage)) {
- /* encryption error! */
- if (bpage->size.is_compressed()) {
- frame = bpage->zip.data;
- } else {
- frame = ((buf_block_t*) bpage)->frame;
- }
-
- ib::info() << "Page "
- << bpage->id
- << " encryption error key_version "
- << bpage->key_version;
+ buf_page_decrypt_after_read(bpage);
- goto database_corrupted;
+ if (bpage->size.is_compressed()) {
+ frame = bpage->zip.data;
+ } else {
+ frame = ((buf_block_t*) bpage)->frame;
}
if (bpage->size.is_compressed()) {
@@ -6040,12 +6005,11 @@ buf_page_io_complete(
<< ", should be " << bpage->id;
}
- /* From version 3.23.38 up we store the page checksum
- to the 4 first bytes of the page end lsn field */
- if (buf_page_is_corrupted(
- true, frame, bpage->size,
- fsp_is_checksum_disabled(bpage->id.space()))) {
+ corrupted = buf_page_check_corrupt(bpage);
+
+database_corrupted:
+ if (corrupted) {
/* Not a real corruption if it was triggered by
error injection */
DBUG_EXECUTE_IF(
@@ -6058,21 +6022,25 @@ buf_page_io_complete(
"corruption";
return(true);
}
- goto page_not_corrupt;);
-database_corrupted:
- bool corrupted = buf_page_check_corrupt(bpage);
+ goto page_not_corrupt;
+ );
- /* Compressed and encrypted pages are basically gibberish avoid
- printing the contents. */
- if (corrupted) {
+ if (!bpage->encrypted) {
+ fil_system_enter();
+ fil_space_t* space = fil_space_get_by_id(bpage->id.space());
+ fil_system_exit();
ib::error()
<< "Database page corruption on disk"
- " or a failed file read of page "
- << bpage->id
+ " or a failed file read of tablespace "
+ << (space->name ? space->name : "NULL")
+ << " page " << bpage->id
<< ". You may have to recover from "
<< "a backup.";
+ buf_page_print(frame, bpage->size,
+ BUF_PAGE_PRINT_NO_CRASH);
+
ib::info()
<< "It is also possible that your"
" operating system has corrupted"
@@ -6095,13 +6063,9 @@ database_corrupted:
if (bpage->id.space() > TRX_SYS_SPACE
&& buf_mark_space_corrupt(bpage)) {
-
return(false);
} else {
- corrupted = buf_page_check_corrupt(bpage);
- ulint key_version = bpage->key_version;
-
- if (corrupted) {
+ if (!bpage->encrypted) {
ib::fatal()
<< "Aborting because of a"
" corrupt database page in"
@@ -6111,16 +6075,20 @@ database_corrupted:
" as corrupt.";
}
- ib_push_warning((void *)NULL, DB_DECRYPTION_FAILED,
- "Table in tablespace %u encrypted."
- "However key management plugin or used key_id %u is not found or"
+ ib_push_warning(innobase_get_trx(), DB_DECRYPTION_FAILED,
+ "Table in tablespace %lu encrypted."
+ "However key management plugin or used key_id %lu is not found or"
" used encryption algorithm or method does not match."
" Can't continue opening the table.",
- bpage->id.space(), key_version);
+ bpage->id.space(), bpage->key_version);
- buf_page_print(frame, bpage->size, BUF_PAGE_PRINT_NO_CRASH);
+ if (bpage->encrypted && bpage->id.space() > TRX_SYS_SPACE) {
+ buf_mark_space_corrupt(bpage);
+ } else {
+ ut_error;
+ }
- return (false);
+ return(false);
}
}
}
@@ -6145,18 +6113,23 @@ database_corrupted:
&& fil_page_get_type(frame) == FIL_PAGE_INDEX
&& page_is_leaf(frame)) {
- if (bpage && bpage->encrypted) {
- fprintf(stderr,
- "InnoDB: Warning: Table in tablespace %u encrypted."
- "However key management plugin or used key_id %u is not found or"
+ if (bpage && bpage->encrypted) {
+ ib::warn()
+ << "Table in tablespace "
+ << bpage->id.space()
+ << " encrypted. However key "
+ "management plugin or used "
+ << "key_version " << bpage->key_version
+ << "is not found or"
" used encryption algorithm or method does not match."
- " Can't continue opening the table.\n",
- bpage->id.space(), bpage->key_version);
+ " Can't continue opening the table.";
} else {
+
ibuf_merge_or_delete_for_page(
(buf_block_t*) bpage, bpage->id,
&bpage->size, TRUE);
}
+
}
} else {
/* io_type == BUF_IO_WRITE */
@@ -6273,11 +6246,9 @@ buf_all_freed_instance(
const buf_block_t* block = buf_chunk_not_freed(chunk);
- if (UNIV_LIKELY_NULL(block)) {
- if (block->page.key_version == 0) {
- ib::fatal() << "Page " << block->page.id
- << " still fixed or dirty";
- }
+ if (UNIV_LIKELY_NULL(block) && block->page.key_version == 0) {
+ ib::fatal() << "Page " << block->page.id
+ << " still fixed or dirty";
}
}
@@ -7403,20 +7374,18 @@ buf_pool_reserve_tmp_slot(
/********************************************************************//**
Encrypts a buffer page right before it's flushed to disk
+@param[in,out] bpage Page control block
+@param[in,out] src_frame Source page
+@param[in] space_id Tablespace id
+@return either unencrypted source page or decrypted page.
*/
+UNIV_INTERN
byte*
buf_page_encrypt_before_write(
-/*==========================*/
- buf_page_t* bpage, /*!< in/out: buffer page to be flushed */
- byte* src_frame, /*!< in: src frame */
- ulint space_id) /*!< in: space id */
+ buf_page_t* bpage,
+ byte* src_frame,
+ ulint space_id)
{
- fil_space_crypt_t* crypt_data = fil_space_get_crypt_data(space_id);
- const page_size_t& page_size = bpage->size;
- buf_pool_t* buf_pool = buf_pool_from_bpage(bpage);
- bool page_compressed = fil_space_is_page_compressed(space_id);
- bool encrypted = true;
-
bpage->real_size = UNIV_PAGE_SIZE;
fil_page_type_validate(src_frame);
@@ -7433,7 +7402,21 @@ buf_page_encrypt_before_write(
return src_frame;
}
- if (crypt_data != NULL && crypt_data->not_encrypted()) {
+ fil_space_t* space = fil_space_acquire_silent(space_id);
+
+ /* Tablespace must exist during write operation */
+ if (!space) {
+ /* This could be true on discard if we have injected a error
+ case e.g. in innodb.innodb-wl5522-debug-zip so that space
+ is already marked as stop_new_ops = true. */
+ return src_frame;
+ }
+
+ const page_size_t page_size(space->flags);
+ fil_space_crypt_t* crypt_data = space->crypt_data;
+ bool encrypted = true;
+
+ if (space->crypt_data != NULL && space->crypt_data->not_encrypted()) {
/* Encryption is disabled */
encrypted = false;
}
@@ -7450,11 +7433,15 @@ buf_page_encrypt_before_write(
encrypted = false;
}
+ bool page_compressed = fil_space_is_page_compressed(bpage->id.space());
+
if (!encrypted && !page_compressed) {
/* No need to encrypt or page compress the page */
+ fil_space_release(space);
return src_frame;
}
+ buf_pool_t* buf_pool = buf_pool_from_bpage(bpage);
/* Find free slot from temporary memory array */
buf_tmp_buffer_t* slot = buf_pool_reserve_tmp_slot(buf_pool, page_compressed);
slot->out_buf = NULL;
@@ -7464,11 +7451,10 @@ buf_page_encrypt_before_write(
if (!page_compressed) {
/* Encrypt page content */
- byte* tmp = fil_space_encrypt(space_id,
+ byte* tmp = fil_space_encrypt(space,
bpage->id.page_no(),
bpage->newest_modification,
src_frame,
- page_size,
dst_frame);
uint32_t key_version = mach_read_from_4(
@@ -7507,32 +7493,29 @@ buf_page_encrypt_before_write(
if(encrypted) {
/* And then we encrypt the page content */
- tmp = fil_space_encrypt(space_id,
+ tmp = fil_space_encrypt(space,
bpage->id.page_no(),
bpage->newest_modification,
tmp,
- page_size,
dst_frame);
}
slot->out_buf = dst_frame = tmp;
}
-#ifdef UNIV_DEBUG
- fil_page_type_validate(dst_frame);
-#endif
+ ut_d(fil_page_type_validate(dst_frame));
+ fil_space_release(space);
// return dst_frame which will be written
return dst_frame;
}
-/********************************************************************//**
-Decrypt page after it has been read from disk
-*/
-ibool
-buf_page_decrypt_after_read(
-/*========================*/
- buf_page_t* bpage) /*!< in/out: buffer page read from disk */
+/** Decrypt a page.
+@param[in,out] bpage Page control block
+@return whether the operation was successful */
+static
+bool
+buf_page_decrypt_after_read(buf_page_t* bpage)
{
bool compressed = bpage->size.is_compressed();
const page_size_t& size = bpage->size;
@@ -7544,61 +7527,29 @@ buf_page_decrypt_after_read(
bool page_compressed_encrypted = fil_page_is_compressed_encrypted(dst_frame);
buf_pool_t* buf_pool = buf_pool_from_bpage(bpage);
bool success = true;
- ulint space_id = mach_read_from_4(
- dst_frame + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID);
- fil_space_crypt_t* crypt_data = fil_space_get_crypt_data(space_id);
-
- /* Page is encrypted if encryption information is found from
- tablespace and page contains used key_version. This is true
- also for pages first compressed and then encrypted. */
- if (!crypt_data ||
- (crypt_data &&
- crypt_data->type == CRYPT_SCHEME_UNENCRYPTED &&
- key_version != 0)) {
- byte* frame = NULL;
-
- if (bpage->size.is_compressed()) {
- frame = bpage->zip.data;
- } else {
- frame = ((buf_block_t*) bpage)->frame;
- }
-
- /* If page is not corrupted at this point, page can't be
- encrypted, thus set key_version to 0. If page is corrupted,
- we assume at this point that it is encrypted as page
- contained key_version != 0. Note that page could still be
- really corrupted. This we will find out after decrypt by
- checking page checksums. */
- if (!buf_page_is_corrupted(false, frame, bpage->size, false)) {
- key_version = 0;
- }
- }
-
- /* If page is encrypted read post-encryption checksum */
- if (!page_compressed_encrypted && key_version != 0) {
- bpage->stored_checksum = mach_read_from_4(dst_frame + + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION + 4);
- }
- ut_ad(bpage->key_version == 0);
+ bpage->key_version = key_version;
if (bpage->id.page_no() == 0) {
/* File header pages are not encrypted/compressed */
- return (TRUE);
+ return (true);
}
- /* Store these for corruption check */
- bpage->key_version = key_version;
- bpage->page_encrypted = page_compressed_encrypted;
- bpage->page_compressed = page_compressed;
+ FilSpace space(bpage->id.space());
+
+ /* Page is encrypted if encryption information is found from
+ tablespace and page contains used key_version. This is true
+ also for pages first compressed and then encrypted. */
+ if (!space()->crypt_data) {
+ key_version = 0;
+ }
if (page_compressed) {
/* the page we read is unencrypted */
/* Find free slot from temporary memory array */
buf_tmp_buffer_t* slot = buf_pool_reserve_tmp_slot(buf_pool, page_compressed);
-#ifdef UNIV_DEBUG
- fil_page_type_validate(dst_frame);
-#endif
+ ut_d(fil_page_type_validate(dst_frame));
/* decompress using comp_buf to dst_frame */
fil_decompress_page(slot->comp_buf,
@@ -7610,40 +7561,35 @@ buf_page_decrypt_after_read(
slot->reserved = false;
key_version = 0;
-#ifdef UNIV_DEBUG
- fil_page_type_validate(dst_frame);
-#endif
+ ut_d(fil_page_type_validate(dst_frame));
} else {
buf_tmp_buffer_t* slot = NULL;
if (key_version) {
+ /* Verify encryption checksum before we even try to
+ decrypt. */
+ if (!fil_space_verify_crypt_checksum(
+ dst_frame, size,
+ bpage->id.space(), bpage->id.page_no())) {
+ return (false);
+ }
+
/* Find free slot from temporary memory array */
slot = buf_pool_reserve_tmp_slot(buf_pool, page_compressed);
-#ifdef UNIV_DEBUG
- fil_page_type_validate(dst_frame);
-#endif
-
- /* Calculate checksum before decrypt, this will be
- used later to find out if incorrect key was used. */
- if (!page_compressed_encrypted) {
- bpage->calculated_checksum = fil_crypt_calculate_checksum(size, dst_frame);
- }
+ ut_d(fil_page_type_validate(dst_frame));
/* decrypt using crypt_buf to dst_frame */
- byte* res = fil_space_decrypt(bpage->id.space(),
+ byte* res = fil_space_decrypt(space,
slot->crypt_buf,
- size,
- dst_frame);
-
+ dst_frame,
+ &bpage->encrypted);
if (!res) {
- bpage->encrypted = true;
success = false;
}
-#ifdef UNIV_DEBUG
- fil_page_type_validate(dst_frame);
-#endif
+
+ ut_d(fil_page_type_validate(dst_frame));
}
if (page_compressed_encrypted && success) {
@@ -7651,18 +7597,13 @@ buf_page_decrypt_after_read(
slot = buf_pool_reserve_tmp_slot(buf_pool, page_compressed);
}
-#ifdef UNIV_DEBUG
- fil_page_type_validate(dst_frame);
-#endif
+ ut_d(fil_page_type_validate(dst_frame));
/* decompress using comp_buf to dst_frame */
fil_decompress_page(slot->comp_buf,
dst_frame,
size.logical(),
&bpage->write_size);
-
-#ifdef UNIV_DEBUG
- fil_page_type_validate(dst_frame);
-#endif
+ ut_d(fil_page_type_validate(dst_frame));
}
/* Mark this slot as free */
@@ -7671,8 +7612,6 @@ buf_page_decrypt_after_read(
}
}
- bpage->key_version = key_version;
-
return (success);
}
diff --git a/storage/innobase/buf/buf0dblwr.cc b/storage/innobase/buf/buf0dblwr.cc
index c4f2280a1f2..c0cf26b869c 100644
--- a/storage/innobase/buf/buf0dblwr.cc
+++ b/storage/innobase/buf/buf0dblwr.cc
@@ -392,13 +392,7 @@ buf_dblwr_init_or_load_pages(
doublewrite = read_buf + TRX_SYS_DOUBLEWRITE;
- if (mach_read_from_4(read_buf + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION) != 0) {
- byte* tmp = fil_space_decrypt((ulint)TRX_SYS_SPACE,
- read_buf + UNIV_PAGE_SIZE,
- univ_page_size, /* page size */
- read_buf);
- doublewrite = tmp + TRX_SYS_DOUBLEWRITE;
- }
+ /* TRX_SYS_PAGE_NO is not encrypted see fil_crypt_rotate_page() */
if (mach_read_from_4(doublewrite + TRX_SYS_DOUBLEWRITE_MAGIC)
== TRX_SYS_DOUBLEWRITE_MAGIC_N) {
@@ -614,9 +608,9 @@ buf_dblwr_process(void)
}
if (fil_space_verify_crypt_checksum(
- read_buf, page_size)
+ read_buf, page_size, space_id, page_no)
|| !buf_page_is_corrupted(
- true, read_buf, page_size, false)) {
+ true, read_buf, page_size, space)) {
/* The page is good; there is no need
to consult the doublewrite buffer. */
continue;
@@ -638,8 +632,9 @@ buf_dblwr_process(void)
NULL, page, UNIV_PAGE_SIZE, NULL, true);
}
- if (!fil_space_verify_crypt_checksum(page, page_size)
- && buf_page_is_corrupted(true, page, page_size, false)) {
+ if (!fil_space_verify_crypt_checksum(page, page_size,
+ space_id, page_no)
+ && buf_page_is_corrupted(true, page, page_size, space)) {
if (!is_all_zero) {
ib::warn() << "A doublewrite copy of page "
<< page_id << " is corrupted.";
diff --git a/storage/innobase/buf/buf0dump.cc b/storage/innobase/buf/buf0dump.cc
index 873f4ea438a..f7883ded070 100644
--- a/storage/innobase/buf/buf0dump.cc
+++ b/storage/innobase/buf/buf0dump.cc
@@ -703,7 +703,7 @@ buf_load()
if tablespace is encrypted we cant use it. */
if (space == NULL ||
(space && space->crypt_data &&
- space->crypt_data->encryption != FIL_SPACE_ENCRYPTION_OFF &&
+ space->crypt_data->encryption != FIL_ENCRYPTION_OFF &&
space->crypt_data->type != CRYPT_SCHEME_UNENCRYPTED)) {
continue;
}
diff --git a/storage/innobase/buf/buf0flu.cc b/storage/innobase/buf/buf0flu.cc
index ae33334ca17..a0ed243d74b 100644
--- a/storage/innobase/buf/buf0flu.cc
+++ b/storage/innobase/buf/buf0flu.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2013, 2017, MariaDB Corporation. All Rights Reserved.
+Copyright (c) 2013, 2017, MariaDB Corporation.
Copyright (c) 2013, 2014, Fusion-io
This program is free software; you can redistribute it and/or modify it under
@@ -893,6 +893,9 @@ buf_flush_init_for_writing(
newest_lsn);
if (skip_checksum) {
+ ut_ad(block == NULL
+ || block->page.id.space() == SRV_TMP_SPACE_ID);
+ ut_ad(page_get_space_id(page) == SRV_TMP_SPACE_ID);
mach_write_to_4(page + FIL_PAGE_SPACE_OR_CHKSUM, checksum);
} else {
if (block != NULL && UNIV_PAGE_SIZE == 16384) {
@@ -1005,7 +1008,8 @@ buf_flush_write_block_low(
{
page_t* frame = NULL;
ulint space_id = bpage->id.space();
- bool atomic_writes = fil_space_get_atomic_writes(space_id);
+ const bool is_temp = fsp_is_system_temporary(space_id);
+ bool atomic_writes = is_temp || fil_space_get_atomic_writes(space_id);
#ifdef UNIV_DEBUG
buf_pool_t* buf_pool = buf_pool_from_bpage(bpage);
@@ -1068,8 +1072,7 @@ buf_flush_write_block_low(
reinterpret_cast<const buf_block_t*>(bpage),
reinterpret_cast<const buf_block_t*>(bpage)->frame,
bpage->zip.data ? &bpage->zip : NULL,
- bpage->newest_modification,
- fsp_is_checksum_disabled(bpage->id.space()));
+ bpage->newest_modification, is_temp);
break;
}
@@ -1082,7 +1085,6 @@ buf_flush_write_block_low(
if (!srv_use_doublewrite_buf
|| buf_dblwr == NULL
|| srv_read_only_mode
- || fsp_is_system_temporary(bpage->id.space())
|| atomic_writes) {
ut_ad(!srv_read_only_mode
diff --git a/storage/innobase/dict/dict0crea.cc b/storage/innobase/dict/dict0crea.cc
index 90dba680f25..c1bd5c2d368 100644
--- a/storage/innobase/dict/dict0crea.cc
+++ b/storage/innobase/dict/dict0crea.cc
@@ -447,7 +447,7 @@ dict_build_tablespace_for_table(
err = fil_ibd_create(
space, table->name.m_name, filepath, fsp_flags,
FIL_IBD_FILE_INITIAL_SIZE,
- node ? node->mode : FIL_SPACE_ENCRYPTION_DEFAULT,
+ node ? node->mode : FIL_ENCRYPTION_DEFAULT,
node ? node->key_id : FIL_DEFAULT_ENCRYPTION_KEY);
ut_free(filepath);
diff --git a/storage/innobase/dict/dict0dict.cc b/storage/innobase/dict/dict0dict.cc
index dc64163bee3..d7fcbdf3906 100644
--- a/storage/innobase/dict/dict0dict.cc
+++ b/storage/innobase/dict/dict0dict.cc
@@ -6096,7 +6096,6 @@ dict_set_corrupted(
row_mysql_lock_data_dictionary(trx);
}
- ut_ad(index);
ut_ad(mutex_own(&dict_sys->mutex));
ut_ad(!dict_table_is_comp(dict_sys->sys_tables));
ut_ad(!dict_table_is_comp(dict_sys->sys_indexes));
diff --git a/storage/innobase/dict/dict0stats_bg.cc b/storage/innobase/dict/dict0stats_bg.cc
index 1c998eb6ff4..4ffee160c9f 100644
--- a/storage/innobase/dict/dict0stats_bg.cc
+++ b/storage/innobase/dict/dict0stats_bg.cc
@@ -46,10 +46,10 @@ os_event_t dict_stats_event;
/** Variable to initiate shutdown the dict stats thread. Note we don't
use 'srv_shutdown_state' because we want to shutdown dict stats thread
before purge thread. */
-bool dict_stats_start_shutdown = false;
+bool dict_stats_start_shutdown;
/** Event to wait for shutdown of the dict stats thread */
-os_event_t dict_stats_shutdown_event = NULL;
+os_event_t dict_stats_shutdown_event;
#ifdef UNIV_DEBUG
/** Used by SET GLOBAL innodb_dict_stats_disabled_debug = 1; */
diff --git a/storage/innobase/fil/fil0crypt.cc b/storage/innobase/fil/fil0crypt.cc
index ccec6191ed4..a61d7439e2c 100644
--- a/storage/innobase/fil/fil0crypt.cc
+++ b/storage/innobase/fil/fil0crypt.cc
@@ -39,7 +39,6 @@ Modified Jan Lindström jan.lindstrom@mariadb.com
#include "fsp0fsp.h"
#include "fil0pagecompress.h"
#include "ha_prototypes.h" // IB_LOG_
-
#include <my_crypt.h>
/** Mutex for keys */
@@ -57,7 +56,7 @@ UNIV_INTERN uint srv_n_fil_crypt_threads = 0;
UNIV_INTERN uint srv_n_fil_crypt_threads_started = 0;
/** At this age or older a space/page will be rotated */
-UNIV_INTERN uint srv_fil_crypt_rotate_key_age = 1;
+UNIV_INTERN uint srv_fil_crypt_rotate_key_age;
/** Event to signal FROM the key rotation threads. */
static os_event_t fil_crypt_event;
@@ -65,11 +64,11 @@ static os_event_t fil_crypt_event;
/** Event to signal TO the key rotation threads. */
UNIV_INTERN os_event_t fil_crypt_threads_event;
-/** Event for waking up threads throttle */
+/** Event for waking up threads throttle. */
static os_event_t fil_crypt_throttle_sleep_event;
-/** Mutex for key rotation threads */
-static ib_mutex_t fil_crypt_threads_mutex;
+/** Mutex for key rotation threads. */
+UNIV_INTERN ib_mutex_t fil_crypt_threads_mutex;
/** Variable ensuring only 1 thread at time does initial conversion */
static bool fil_crypt_start_converting = false;
@@ -89,9 +88,12 @@ extern uint srv_background_scrub_data_check_interval;
static fil_crypt_stat_t crypt_stat;
static ib_mutex_t crypt_stat_mutex;
+/** Is background scrubbing enabled, defined on btr0scrub.cc */
+extern my_bool srv_background_scrub_data_uncompressed;
+extern my_bool srv_background_scrub_data_compressed;
+
static bool
fil_crypt_needs_rotation(
-/*=====================*/
fil_encryption_t encrypt_mode, /*!< in: Encryption
mode */
uint key_version, /*!< in: Key version */
@@ -103,7 +105,6 @@ Init space crypt */
UNIV_INTERN
void
fil_space_crypt_init()
-/*==================*/
{
mutex_create(LATCH_ID_FIL_CRYPT_MUTEX, &fil_crypt_key_mutex);
@@ -118,7 +119,6 @@ Cleanup space crypt */
UNIV_INTERN
void
fil_space_crypt_cleanup()
-/*=====================*/
{
os_event_destroy(fil_crypt_throttle_sleep_event);
mutex_free(&fil_crypt_key_mutex);
@@ -129,7 +129,7 @@ fil_space_crypt_cleanup()
Get latest key version from encryption plugin.
@return key version or ENCRYPTION_KEY_VERSION_INVALID */
uint
-fil_space_crypt_struct::key_get_latest_version(void)
+fil_space_crypt_t::key_get_latest_version(void)
{
uint key_version = key_found;
@@ -143,12 +143,12 @@ fil_space_crypt_struct::key_get_latest_version(void)
}
/******************************************************************
-Get the latest(key-version), waking the encrypt thread, if needed */
+Get the latest(key-version), waking the encrypt thread, if needed
+@param[in,out] crypt_data Crypt data */
static inline
uint
fil_crypt_get_latest_key_version(
-/*=============================*/
- fil_space_crypt_t* crypt_data) /*!< in: crypt data */
+ fil_space_crypt_t* crypt_data)
{
ut_ad(crypt_data != NULL);
@@ -187,28 +187,29 @@ crypt_data_scheme_locker(
/******************************************************************
Create a fil_space_crypt_t object
+@param[in] type CRYPT_SCHEME_UNENCRYPTE or
+ CRYPT_SCHEME_1
+@param[in] encrypt_mode FIL_ENCRYPTION_DEFAULT or
+ FIL_ENCRYPTION_ON or
+ FIL_ENCRYPTION_OFF
+@param[in] min_key_version key_version or 0
+@param[in] key_id Used key id
@return crypt object */
static
fil_space_crypt_t*
fil_space_create_crypt_data(
-/*========================*/
uint type,
fil_encryption_t encrypt_mode,
uint min_key_version,
- uint key_id,
- ulint offset)
+ uint key_id)
{
- const uint sz = sizeof(fil_space_crypt_t);
- void* buf = ut_zalloc_nokey(sz);
fil_space_crypt_t* crypt_data = NULL;
-
- if (buf) {
+ if (void* buf = ut_zalloc_nokey(sizeof(fil_space_crypt_t))) {
crypt_data = new(buf)
- fil_space_crypt_struct(
+ fil_space_crypt_t(
type,
min_key_version,
key_id,
- offset,
encrypt_mode);
}
@@ -217,25 +218,30 @@ fil_space_create_crypt_data(
/******************************************************************
Create a fil_space_crypt_t object
+@param[in] encrypt_mode FIL_ENCRYPTION_DEFAULT or
+ FIL_ENCRYPTION_ON or
+ FIL_ENCRYPTION_OFF
+
+@param[in] key_id Encryption key id
@return crypt object */
UNIV_INTERN
fil_space_crypt_t*
fil_space_create_crypt_data(
-/*========================*/
- fil_encryption_t encrypt_mode, /*!< in: encryption mode */
- uint key_id) /*!< in: encryption key id */
+ fil_encryption_t encrypt_mode,
+ uint key_id)
{
- return (fil_space_create_crypt_data(0, encrypt_mode, 0, key_id, 0));
+ return (fil_space_create_crypt_data(0, encrypt_mode, 0, key_id));
}
/******************************************************************
-Merge fil_space_crypt_t object */
+Merge fil_space_crypt_t object
+@param[in,out] dst Destination cryp data
+@param[in] src Source crypt data */
UNIV_INTERN
void
fil_space_merge_crypt_data(
-/*=======================*/
- fil_space_crypt_t* dst,/*!< out: Crypt data */
- const fil_space_crypt_t* src)/*!< in: Crypt data */
+ fil_space_crypt_t* dst,
+ const fil_space_crypt_t* src)
{
mutex_enter(&dst->mutex);
@@ -250,62 +256,44 @@ fil_space_merge_crypt_data(
dst->type = src->type;
dst->min_key_version = src->min_key_version;
dst->keyserver_requests += src->keyserver_requests;
- dst->closing = src->closing;
mutex_exit(&dst->mutex);
}
-/******************************************************************
-Read crypt data from a page (0)
-@return crypt data from page 0. */
+/** Initialize encryption parameters from a tablespace header page.
+@param[in] page_size page size of the tablespace
+@param[in] page first page of the tablespace
+@return crypt data from page 0
+@retval NULL if not present or not valid */
UNIV_INTERN
fil_space_crypt_t*
-fil_space_read_crypt_data(
-/*======================*/
- ulint space, /*!< in: file space id*/
- const byte* page, /*!< in: page 0 */
- ulint offset) /*!< in: offset */
+fil_space_read_crypt_data(const page_size_t& page_size, const byte* page)
{
+ const ulint offset = FSP_HEADER_OFFSET
+ + fsp_header_get_encryption_offset(page_size);
+
if (memcmp(page + offset, CRYPT_MAGIC, MAGIC_SZ) != 0) {
/* Crypt data is not stored. */
return NULL;
}
ulint type = mach_read_from_1(page + offset + MAGIC_SZ + 0);
+ ulint iv_length = mach_read_from_1(page + offset + MAGIC_SZ + 1);
+ fil_space_crypt_t* crypt_data;
- if (! (type == CRYPT_SCHEME_UNENCRYPTED ||
- type == CRYPT_SCHEME_1)) {
+ if (!(type == CRYPT_SCHEME_UNENCRYPTED ||
+ type == CRYPT_SCHEME_1)
+ || iv_length != sizeof crypt_data->iv) {
ib::error() << "Found non sensible crypt scheme: "
- << type << " for space: "
- << space << " offset: "
+ << type << "," << iv_length << " for space: "
+ << page_get_space_id(page) << " offset: "
<< offset << " bytes: ["
- << page[offset + 0 + MAGIC_SZ]
- << page[offset + 1 + MAGIC_SZ]
- << page[offset + 2 + MAGIC_SZ]
- << page[offset + 3 + MAGIC_SZ]
- << page[offset + 4 + MAGIC_SZ]
- << page[offset + 5 + MAGIC_SZ]
- << "].";
- ut_error;
- }
-
- fil_space_crypt_t* crypt_data;
- ulint iv_length = mach_read_from_1(page + offset + MAGIC_SZ + 1);
-
- if (! (iv_length == sizeof(crypt_data->iv))) {
- ib::error() << "Found non sensible iv length: "
- << iv_length << " for space: "
- << space << " offset: "
- << offset << " type: "
- << type << " bytes: ["
- << page[offset + 0 + MAGIC_SZ]
- << page[offset + 1 + MAGIC_SZ]
<< page[offset + 2 + MAGIC_SZ]
<< page[offset + 3 + MAGIC_SZ]
<< page[offset + 4 + MAGIC_SZ]
<< page[offset + 5 + MAGIC_SZ]
<< "].";
- ut_error;
+ return NULL;
}
uint min_key_version = mach_read_from_4
@@ -329,45 +317,42 @@ fil_space_read_crypt_data(
}
/******************************************************************
-Free a crypt data object */
+Free a crypt data object
+@param[in,out] crypt_data crypt data to be freed */
UNIV_INTERN
void
fil_space_destroy_crypt_data(
-/*=========================*/
- fil_space_crypt_t **crypt_data) /*!< out: crypt data */
+ fil_space_crypt_t **crypt_data)
{
if (crypt_data != NULL && (*crypt_data) != NULL) {
mutex_enter(&fil_crypt_threads_mutex);
fil_space_crypt_t* c = *crypt_data;
- c->~fil_space_crypt_struct();
- ut_free(c);
*crypt_data = NULL;
mutex_exit(&fil_crypt_threads_mutex);
+ if (c) {
+ c->~fil_space_crypt_t();
+ ut_free(c);
+ }
}
}
/******************************************************************
-Write crypt data to a page (0) */
-static
+Write crypt data to a page (0)
+@param[in] space tablespace
+@param[in,out] page0 first page of the tablespace
+@param[in,out] mtr mini-transaction */
+UNIV_INTERN
void
-fil_space_write_crypt_data_low(
-/*===========================*/
- fil_space_crypt_t* crypt_data, /*<! out: crypt data */
- ulint type, /*<! in: crypt scheme */
- byte* page, /*<! in: page 0 */
- ulint offset, /*<! in: offset */
- ulint maxsize, /*<! in: size of crypt data */
- mtr_t* mtr) /*<! in: minitransaction */
+fil_space_crypt_t::write_page0(
+ const fil_space_t* space,
+ byte* page,
+ mtr_t* mtr)
{
- ut_a(offset > 0 && offset < UNIV_PAGE_SIZE);
- ulint space_id = mach_read_from_4(
- page + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID);
- const uint len = sizeof(crypt_data->iv);
- const uint min_key_version = crypt_data->min_key_version;
- const uint key_id = crypt_data->key_id;
- const fil_encryption_t encryption = crypt_data->encryption;
- crypt_data->page0_offset = offset;
- ut_a(2 + len + 4 + 1 + 4 + MAGIC_SZ < maxsize);
+ ut_ad(this == space->crypt_data);
+ const uint len = sizeof(iv);
+ const ulint offset = FSP_HEADER_OFFSET
+ + fsp_header_get_encryption_offset(page_size_t(space->flags));
+ page0_offset = offset;
/*
redo log this as bytewise updates to page 0
@@ -377,7 +362,7 @@ fil_space_write_crypt_data_low(
mlog_write_string(page + offset, CRYPT_MAGIC, MAGIC_SZ, mtr);
mlog_write_ulint(page + offset + MAGIC_SZ + 0, type, MLOG_1BYTE, mtr);
mlog_write_ulint(page + offset + MAGIC_SZ + 1, len, MLOG_1BYTE, mtr);
- mlog_write_string(page + offset + MAGIC_SZ + 2, crypt_data->iv, len,
+ mlog_write_string(page + offset + MAGIC_SZ + 2, iv, len,
mtr);
mlog_write_ulint(page + offset + MAGIC_SZ + 2 + len, min_key_version,
MLOG_4BYTES, mtr);
@@ -393,7 +378,7 @@ fil_space_write_crypt_data_low(
page,
MLOG_FILE_WRITE_CRYPT_DATA,
log_ptr, mtr);
- mach_write_to_4(log_ptr, space_id);
+ mach_write_to_4(log_ptr, space->id);
log_ptr += 4;
mach_write_to_2(log_ptr, offset);
log_ptr += 2;
@@ -409,44 +394,61 @@ fil_space_write_crypt_data_low(
log_ptr += 1;
mlog_close(mtr, log_ptr);
- mlog_catenate_string(mtr, crypt_data->iv, len);
+ mlog_catenate_string(mtr, iv, len);
}
}
/******************************************************************
-Write crypt data to a page (0) */
-UNIV_INTERN
-void
-fil_space_write_crypt_data(
-/*=======================*/
- ulint space, /*<! in: file space */
- byte* page, /*<! in: page 0 */
- ulint offset, /*<! in: offset */
- ulint maxsize, /*<! in: size of crypt data */
- mtr_t* mtr) /*<! in: minitransaction */
+Set crypt data for a tablespace
+@param[in,out] space Tablespace
+@param[in,out] crypt_data Crypt data to be set
+@return crypt_data in tablespace */
+static
+fil_space_crypt_t*
+fil_space_set_crypt_data(
+ fil_space_t* space,
+ fil_space_crypt_t* crypt_data)
{
- fil_space_crypt_t* crypt_data = fil_space_get_crypt_data(space);
+ fil_space_crypt_t* free_crypt_data = NULL;
+ fil_space_crypt_t* ret_crypt_data = NULL;
+
+ /* Provided space is protected using fil_space_acquire()
+ from concurrent operations. */
+ if (space->crypt_data != NULL) {
+ /* There is already crypt data present,
+ merge new crypt_data */
+ fil_space_merge_crypt_data(space->crypt_data,
+ crypt_data);
+ ret_crypt_data = space->crypt_data;
+ free_crypt_data = crypt_data;
+ } else {
+ space->crypt_data = crypt_data;
+ ret_crypt_data = space->crypt_data;
+ }
- /* If no crypt data is stored on memory cache for this space,
- then do not continue writing crypt data to page 0. */
- if (crypt_data == NULL) {
- return;
+ if (free_crypt_data != NULL) {
+ /* there was already crypt data present and the new crypt
+ * data provided as argument to this function has been merged
+ * into that => free new crypt data
+ */
+ fil_space_destroy_crypt_data(&free_crypt_data);
}
- fil_space_write_crypt_data_low(crypt_data, crypt_data->type,
- page, offset, maxsize, mtr);
+ return ret_crypt_data;
}
/******************************************************************
Parse a MLOG_FILE_WRITE_CRYPT_DATA log entry
+@param[in] ptr Log entry start
+@param[in] end_ptr Log entry end
+@param[in] block buffer block
@return position on log buffer */
UNIV_INTERN
-byte*
+const byte*
fil_parse_write_crypt_data(
-/*=======================*/
- byte* ptr, /*!< in: Log entry start */
- byte* end_ptr,/*!< in: Log entry end */
- buf_block_t* block) /*!< in: buffer block */
+ const byte* ptr,
+ const byte* end_ptr,
+ const buf_block_t* block)
{
/* check that redo log entry is complete */
uint entry_size =
@@ -458,7 +460,7 @@ fil_parse_write_crypt_data(
4 + // size of key_id
1; // fil_encryption_t
- if ((uint) (end_ptr - ptr) < entry_size){
+ if (ptr + entry_size > end_ptr) {
return NULL;
}
@@ -484,7 +486,7 @@ fil_parse_write_crypt_data(
fil_encryption_t encryption = (fil_encryption_t)mach_read_from_1(ptr);
ptr +=1;
- if ((uint) (end_ptr - ptr) < len) {
+ if (ptr + len > end_ptr) {
return NULL;
}
@@ -497,56 +499,40 @@ fil_parse_write_crypt_data(
ptr += len;
/* update fil_space memory cache with crypt_data */
- fil_space_set_crypt_data(space_id, crypt_data);
+ fil_space_t* space = fil_space_acquire_silent(space_id);
- return ptr;
-}
+ if (space) {
+ crypt_data = fil_space_set_crypt_data(space, crypt_data);
+ fil_space_release(space);
+ }
-/******************************************************************
-Clear crypt data from a page (0) */
-UNIV_INTERN
-void
-fil_space_clear_crypt_data(
-/*=======================*/
- byte* page, /*!< in/out: Page 0 */
- ulint offset) /*!< in: Offset */
-{
- //TODO(jonaso): pass crypt-data and read len from there
- ulint len = CRYPT_SCHEME_1_IV_LEN;
- ulint size =
- sizeof(CRYPT_MAGIC) +
- 1 + // type
- 1 + // len
- len + // iv
- 4 + // min key version
- 4 + // key id
- 1; // fil_encryption_t
- memset(page + offset, 0, size);
+ return ptr;
}
-/******************************************************************
-Encrypt a buffer */
+/** Encrypt a buffer.
+@param[in,out] crypt_data Crypt data
+@param[in] space space_id
+@param[in] offset Page offset
+@param[in] lsn Log sequence number
+@param[in] src_frame Page to encrypt
+@param[in] page_size Page size
+@param[in,out] dst_frame Output buffer
+@return encrypted buffer or NULL */
UNIV_INTERN
byte*
fil_encrypt_buf(
-/*============*/
- fil_space_crypt_t* crypt_data, /*!< in: crypt data */
- ulint space, /*!< in: Space id */
- ulint offset, /*!< in: Page offset */
- lsn_t lsn, /*!< in: lsn */
- byte* src_frame, /*!< in: Source page to be encrypted */
- const page_size_t& page_size, /*!< in: page size */
- byte* dst_frame) /*!< in: outbut buffer */
+ fil_space_crypt_t* crypt_data,
+ ulint space,
+ ulint offset,
+ lsn_t lsn,
+ const byte* src_frame,
+ const page_size_t& page_size,
+ byte* dst_frame)
{
ulint size = page_size.physical();
uint key_version = fil_crypt_get_latest_key_version(crypt_data);
- if (key_version == ENCRYPTION_KEY_VERSION_INVALID) {
- ib::error() << "Unknown key id: "
- << crypt_data->key_id
- << " Can't continue!";
- ut_error;
- }
+ ut_a(key_version != ENCRYPTION_KEY_VERSION_INVALID);
ulint orig_page_type = mach_read_from_2(src_frame+FIL_PAGE_TYPE);
ibool page_compressed = (orig_page_type == FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED);
@@ -576,14 +562,8 @@ fil_encrypt_buf(
int rc = encryption_scheme_encrypt(src, srclen, dst, &dstlen,
crypt_data, key_version,
space, offset, lsn);
-
- if (! ((rc == MY_AES_OK) && ((ulint) dstlen == srclen))) {
- ib::error() << "Unable to encrypt data-block "
- << " src: " << src << " srclen: " << srclen
- << " buf: " << dst << " buflen: " << dstlen
- << " return-code: "<< rc << " Can't continue!";
- ut_error;
- }
+ ut_a(rc == MY_AES_OK);
+ ut_a(dstlen == srclen);
/* For compressed tables we do not store the FIL header because
the whole page is not stored to the disk. In compressed tables only
@@ -596,7 +576,8 @@ fil_encrypt_buf(
FIL_PAGE_DATA_END);
} else {
/* Clean up rest of buffer */
- memset(dst_frame+header_len+srclen, 0, page_size.physical() - (header_len+srclen));
+ memset(dst_frame+header_len+srclen, 0,
+ page_size.physical() - (header_len + srclen));
}
/* handle post encryption checksum */
@@ -607,46 +588,50 @@ fil_encrypt_buf(
// store the post-encryption checksum after the key-version
mach_write_to_4(dst_frame + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION + 4, checksum);
+ ut_ad(fil_space_verify_crypt_checksum(dst_frame, page_size,
+ space, offset));
+
srv_stats.pages_encrypted.inc();
return dst_frame;
}
/******************************************************************
-Encrypt a page */
+Encrypt a page
+
+@param[in] space Tablespace
+@param[in] offset Page offset
+@param[in] lsn Log sequence number
+@param[in] src_frame Page to encrypt
+@param[in,out] dst_frame Output buffer
+@return encrypted buffer or NULL */
UNIV_INTERN
byte*
fil_space_encrypt(
-/*==============*/
- ulint space, /*!< in: Space id */
- ulint offset, /*!< in: Page offset */
- lsn_t lsn, /*!< in: lsn */
- byte* src_frame, /*!< in: Source page to be encrypted */
- const page_size_t& page_size, /*!< in: page size */
- byte* dst_frame) /*!< in: outbut buffer */
+ const fil_space_t* space,
+ ulint offset,
+ lsn_t lsn,
+ byte* src_frame,
+ byte* dst_frame)
{
- fil_space_crypt_t* crypt_data = NULL;
-
- ulint orig_page_type = mach_read_from_2(src_frame+FIL_PAGE_TYPE);
-
- if (orig_page_type == FIL_PAGE_TYPE_FSP_HDR ||
- orig_page_type == FIL_PAGE_TYPE_XDES ||
- orig_page_type == FIL_PAGE_RTREE) {
+ switch (mach_read_from_2(src_frame+FIL_PAGE_TYPE)) {
+ case FIL_PAGE_TYPE_FSP_HDR:
+ case FIL_PAGE_TYPE_XDES:
+ case FIL_PAGE_RTREE:
/* File space header, extent descriptor or spatial index
are not encrypted. */
return src_frame;
}
- /* Get crypt data from file space */
- crypt_data = fil_space_get_crypt_data(space);
-
- if (crypt_data == NULL) {
- return src_frame;
+ if (!space->crypt_data || !space->crypt_data->is_encrypted()) {
+ return (src_frame);
}
- ut_a(crypt_data != NULL && crypt_data->is_encrypted());
-
- byte* tmp = fil_encrypt_buf(crypt_data, space, offset, lsn, src_frame, page_size, dst_frame);
+ fil_space_crypt_t* crypt_data = space->crypt_data;
+ const page_size_t page_size(space->flags);
+ ut_ad(space->n_pending_ops);
+ byte* tmp = fil_encrypt_buf(crypt_data, space->id, offset, lsn,
+ src_frame, page_size, dst_frame);
#ifdef UNIV_DEBUG
if (tmp) {
@@ -666,7 +651,7 @@ fil_space_encrypt(
src = uncomp_mem;
}
- bool corrupted1 = buf_page_is_corrupted(true, src, page_size, fsp_is_checksum_disabled(space));
+ bool corrupted1 = buf_page_is_corrupted(true, src, page_size, space);
bool ok = fil_space_decrypt(crypt_data, tmp_mem, page_size, tmp, &err);
/* Need to decompress the page if it was also compressed */
@@ -675,18 +660,17 @@ fil_space_encrypt(
fil_decompress_page(tmp_mem, comp_mem, page_size.physical(), NULL);
}
- bool corrupted = buf_page_is_corrupted(true, tmp_mem, page_size, fsp_is_checksum_disabled(space));
+ bool corrupted = buf_page_is_corrupted(true, tmp_mem, page_size, space);
bool different = memcmp(src, tmp_mem, page_size.physical());
if (!ok || corrupted || corrupted1 || err != DB_SUCCESS || different) {
- fprintf(stderr, "JAN: ok %d corrupted %d corrupted1 %d err %d different %d\n", ok , corrupted, corrupted1, err, different);
- fprintf(stderr, "JAN1: src_frame\n");
+ fprintf(stderr, "ok %d corrupted %d corrupted1 %d err %d different %d\n", ok , corrupted, corrupted1, err, different);
+ fprintf(stderr, "src_frame\n");
buf_page_print(src_frame, page_size, BUF_PAGE_PRINT_NO_CRASH);
- fprintf(stderr, "JAN2: encrypted_frame\n");
+ fprintf(stderr, "encrypted_frame\n");
buf_page_print(tmp, page_size, BUF_PAGE_PRINT_NO_CRASH);
- fprintf(stderr, "JAN1: decrypted_frame\n");
- buf_page_print(tmp_mem, page_size, BUF_PAGE_PRINT_NO_CRASH);
- ut_error;
+ fprintf(stderr, "decrypted_frame\n");
+ buf_page_print(tmp_mem, page_size, 0);
}
free(tmp_mem);
@@ -704,45 +688,21 @@ fil_space_encrypt(
return tmp;
}
-/*********************************************************************
-Check if extra buffer shall be allocated for decrypting after read
-@return true if fil space has encryption data. */
-UNIV_INTERN
-bool
-fil_space_check_encryption_read(
-/*=============================*/
- ulint space) /*!< in: tablespace id */
-{
- fil_space_crypt_t* crypt_data = fil_space_get_crypt_data(space);
-
- if (crypt_data == NULL) {
- return false;
- }
-
- if (crypt_data->type == CRYPT_SCHEME_UNENCRYPTED) {
- return false;
- }
-
- if (crypt_data->not_encrypted()) {
- return false;
- }
-
- return true;
-}
-
-/******************************************************************
-Decrypt a page
+/** Decrypt a page.
+@param[in] crypt_data crypt_data
+@param[in] tmp_frame Temporary buffer
+@param[in] page_size Page size
+@param[in,out] src_frame Page to decrypt
+@param[out] err DB_SUCCESS or DB_DECRYPTION_FAILED
@return true if page decrypted, false if not.*/
UNIV_INTERN
bool
fil_space_decrypt(
-/*==============*/
- fil_space_crypt_t* crypt_data, /*!< in: crypt data */
- byte* tmp_frame, /*!< in: temporary buffer */
- const page_size_t& page_size, /*!< in: page size */
- byte* src_frame, /*!< in: out: page buffer */
- dberr_t* err) /*!< in: out: DB_SUCCESS or
- error code */
+ fil_space_crypt_t* crypt_data,
+ byte* tmp_frame,
+ const page_size_t& page_size,
+ byte* src_frame,
+ dberr_t* err)
{
ulint page_type = mach_read_from_2(src_frame+FIL_PAGE_TYPE);
uint key_version = mach_read_from_4(src_frame + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION);
@@ -750,6 +710,7 @@ fil_space_decrypt(
ulint offset = mach_read_from_4(src_frame + FIL_PAGE_OFFSET);
ulint space = mach_read_from_4(src_frame + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID);
ib_uint64_t lsn = mach_read_from_8(src_frame + FIL_PAGE_LSN);
+
*err = DB_SUCCESS;
if (key_version == ENCRYPTION_KEY_NOT_ENCRYPTED) {
@@ -764,12 +725,12 @@ fil_space_decrypt(
first page in a system tablespace
data file (ibdata*, not *.ibd), if not
clear it. */
-#ifdef UNIV_DEBUG
- ib::warn()
- << "Page on space "<< space << " offset " << offset
- << " has key_version " << key_version
- << " when it shoud be undefined.";
-#endif
+
+ DBUG_LOG("crypt",
+ "Page " << page_id_t(space, offset)
+ << " carries key_version " << key_version
+ << " (should be undefined)");
+
mach_write_to_4(src_frame + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION, 0);
}
@@ -809,12 +770,11 @@ fil_space_decrypt(
return false;
}
- ib::error() << "Unable to decrypt data-block "
+ ib::fatal() << "Unable to decrypt data-block "
<< " src: " << src << "srclen: "
<< srclen << " buf: " << dst << "buflen: "
<< dstlen << " return-code: " << rc
<< " Can't continue!";
- ut_error;
}
/* For compressed tables we do not store the FIL header because
@@ -836,31 +796,36 @@ fil_space_decrypt(
return true; /* page was decrypted */
}
-/******************************************************************
-Decrypt a page
-@return encrypted page, or original not encrypted page if encryption is
-not needed. */
+/**
+Decrypt a page.
+@param[in] space Tablespace
+@param[in] tmp_frame Temporary buffer used for decrypting
+@param[in,out] src_frame Page to decrypt
+@param[out] decrypted true if page was decrypted
+@return decrypted page, or original not encrypted page if decryption is
+not needed.*/
UNIV_INTERN
byte*
fil_space_decrypt(
-/*==============*/
- ulint space, /*!< in: Fil space id */
- byte* tmp_frame, /*!< in: temporary buffer */
- const page_size_t& page_size, /*!< in: page size */
- byte* src_frame) /*!< in/out: page buffer */
+ const fil_space_t* space,
+ byte* tmp_frame,
+ byte* src_frame,
+ bool* decrypted)
{
dberr_t err = DB_SUCCESS;
byte* res = NULL;
+ const page_size_t page_size(space->flags);
+ *decrypted = false;
+
+ ut_ad(space->crypt_data != NULL && space->crypt_data->is_encrypted());
+ ut_ad(space->n_pending_ops > 0);
- bool encrypted = fil_space_decrypt(
- fil_space_get_crypt_data(space),
- tmp_frame,
- page_size,
- src_frame,
- &err);
+ bool encrypted = fil_space_decrypt(space->crypt_data, tmp_frame,
+ page_size, src_frame, &err);
if (err == DB_SUCCESS) {
if (encrypted) {
+ *decrypted = true;
/* Copy the decrypted page back to page buffer, not
really any other options. */
memcpy(src_frame, tmp_frame, page_size.physical());
@@ -874,14 +839,15 @@ fil_space_decrypt(
/******************************************************************
Calculate post encryption checksum
+@param[in] page_size page size
+@param[in] dst_frame Block where checksum is calculated
@return page checksum or BUF_NO_CHECKSUM_MAGIC
not needed. */
UNIV_INTERN
ulint
fil_crypt_calculate_checksum(
-/*=========================*/
- const page_size_t& page_size, /*!< in: page size */
- byte* dst_frame) /*!< in: page where to calculate */
+ const page_size_t& page_size,
+ const byte* dst_frame)
{
ib_uint32_t checksum = 0;
srv_checksum_algorithm_t algorithm =
@@ -929,12 +895,13 @@ struct key_state_t {
};
/***********************************************************************
-Copy global key state */
+Copy global key state
+@param[in,out] new_state key state
+@param[in] crypt_data crypt data */
static void
fil_crypt_get_key_state(
-/*====================*/
- key_state_t* new_state, /*!< out: key state */
- fil_space_crypt_t* crypt_data) /*!< in, out: crypt_data */
+ key_state_t* new_state,
+ fil_space_crypt_t* crypt_data)
{
if (srv_encrypt_tables) {
new_state->key_version = crypt_data->key_get_latest_version();
@@ -949,15 +916,17 @@ fil_crypt_get_key_state(
/***********************************************************************
Check if a key needs rotation given a key_state
+@param[in] encrypt_mode Encryption mode
+@param[in] key_version Current key version
+@param[in] latest_key_version Latest key version
+@param[in] rotate_key_age when to rotate
@return true if key needs rotation, false if not */
static bool
fil_crypt_needs_rotation(
-/*=====================*/
- fil_encryption_t encrypt_mode, /*!< in: Encryption
- mode */
- uint key_version, /*!< in: Key version */
- uint latest_key_version, /*!< in: Latest key version */
- uint rotate_key_age) /*!< in: When to rotate */
+ fil_encryption_t encrypt_mode,
+ uint key_version,
+ uint latest_key_version,
+ uint rotate_key_age)
{
if (key_version == ENCRYPTION_KEY_VERSION_INVALID) {
return false;
@@ -970,7 +939,7 @@ fil_crypt_needs_rotation(
}
if (latest_key_version == 0 && key_version != 0) {
- if (encrypt_mode == FIL_SPACE_ENCRYPTION_DEFAULT) {
+ if (encrypt_mode == FIL_ENCRYPTION_DEFAULT) {
/* this is rotation encrypted => unencrypted */
return true;
}
@@ -987,59 +956,34 @@ fil_crypt_needs_rotation(
}
/***********************************************************************
-Check if a space is closing (i.e just before drop)
-@return true if space is closing, false if not. */
-UNIV_INTERN
-bool
-fil_crypt_is_closing(
-/*=================*/
- ulint space) /*!< in: FIL space id */
-{
- bool closing=true;
- fil_space_crypt_t *crypt_data = fil_space_get_crypt_data(space);
-
- if (crypt_data) {
- closing = crypt_data->is_closing(false);
- }
-
- return closing;
-}
-
-/***********************************************************************
Start encrypting a space
-@return true if a pending op (fil_inc_pending_ops/fil_decr_pending_ops) is held
-*/
+@param[in,out] space Tablespace
+@return true if a recheck is needed */
static
bool
fil_crypt_start_encrypting_space(
-/*=============================*/
- ulint space, /*!< in: FIL space id */
- bool* recheck)/*!< out: true if recheck needed */
+ fil_space_t* space)
{
-
- /* we have a pending op when entering function */
- bool pending_op = true;
-
+ bool recheck = false;
mutex_enter(&fil_crypt_threads_mutex);
- fil_space_crypt_t *crypt_data = fil_space_get_crypt_data(space);
- ibool page_encrypted = (crypt_data != NULL);
+ fil_space_crypt_t *crypt_data = space->crypt_data;
- /*If spage is not encrypted and encryption is not enabled, then
+ /* If space is not encrypted and encryption is not enabled, then
do not continue encrypting the space. */
- if (!page_encrypted && !srv_encrypt_tables) {
+ if (!crypt_data && !srv_encrypt_tables) {
mutex_exit(&fil_crypt_threads_mutex);
- return pending_op;
+ return false;
}
if (crypt_data != NULL || fil_crypt_start_converting) {
/* someone beat us to it */
if (fil_crypt_start_converting) {
- *recheck = true;
+ recheck = true;
}
mutex_exit(&fil_crypt_threads_mutex);
- return pending_op;
+ return recheck;
}
/* NOTE: we need to write and flush page 0 before publishing
@@ -1048,10 +992,11 @@ fil_crypt_start_encrypting_space(
* crypt data in page 0 */
/* 1 - create crypt data */
- crypt_data = fil_space_create_crypt_data(FIL_SPACE_ENCRYPTION_DEFAULT, FIL_DEFAULT_ENCRYPTION_KEY);
+ crypt_data = fil_space_create_crypt_data(FIL_ENCRYPTION_DEFAULT, FIL_DEFAULT_ENCRYPTION_KEY);
+
if (crypt_data == NULL) {
mutex_exit(&fil_crypt_threads_mutex);
- return pending_op;
+ return false;
}
crypt_data->type = CRYPT_SCHEME_UNENCRYPTED;
@@ -1069,92 +1014,42 @@ fil_crypt_start_encrypting_space(
do
{
- if (fil_crypt_is_closing(space) ||
- fil_space_found_by_id(space) == NULL) {
- break;
- }
-
mtr_t mtr;
mtr_start(&mtr);
/* 2 - get page 0 */
- ulint offset = 0;
- const page_id_t page_id(space, offset);
- bool tsfound;
- const page_size_t page_size = fil_space_get_page_size(space, &tsfound);
dberr_t err = DB_SUCCESS;
- buf_block_t* block = buf_page_get_gen(page_id, page_size,
- RW_X_LATCH,
- NULL,
- BUF_GET,
- __FILE__, __LINE__,
- &mtr, &err);
-
- if (fil_crypt_is_closing(space) ||
- fil_space_found_by_id(space) == NULL ||
- err != DB_SUCCESS) {
- mtr_commit(&mtr);
- break;
- }
+ buf_block_t* block = buf_page_get_gen(
+ page_id_t(space->id, 0), page_size_t(space->flags),
+ RW_X_LATCH, NULL, BUF_GET,
+ __FILE__, __LINE__,
+ &mtr, &err);
+
- /* 3 - compute location to store crypt data */
+ /* 3 - write crypt data to page 0 */
byte* frame = buf_block_get_frame(block);
- ut_ad(crypt_data);
- crypt_data->page0_offset = FSP_HEADER_OFFSET
- + fsp_header_get_encryption_offset(page_size);
- const ulint maxsize = page_size.logical()
- - crypt_data->page0_offset - FIL_PAGE_DATA_END;
-
- /* 4 - write crypt data to page 0 */
- fil_space_write_crypt_data_low(crypt_data,
- CRYPT_SCHEME_1,
- frame,
- crypt_data->page0_offset,
- maxsize, &mtr);
+ crypt_data->type = CRYPT_SCHEME_1;
+ crypt_data->write_page0(space, frame, &mtr);
mtr_commit(&mtr);
- if (fil_crypt_is_closing(space) ||
- fil_space_found_by_id(space) == NULL) {
- break;
- }
-
/* record lsn of update */
lsn_t end_lsn = mtr.commit_lsn();
/* 4 - sync tablespace before publishing crypt data */
- /* release "lock" while syncing */
- fil_decr_pending_ops(space);
- pending_op = false;
-
bool success = false;
- ulint n_pages = 0;
ulint sum_pages = 0;
+
do {
+ ulint n_pages = 0;
success = buf_flush_lists(ULINT_MAX, end_lsn, &n_pages);
buf_flush_wait_batch_end(NULL, BUF_FLUSH_LIST);
sum_pages += n_pages;
- } while (!success &&
- !fil_crypt_is_closing(space) &&
- !fil_space_found_by_id(space));
-
- /* try to reacquire pending op */
- if (fil_inc_pending_ops(space, true)) {
- break;
- }
-
- /* pending op reacquired! */
- pending_op = true;
-
- if (fil_crypt_is_closing(space) ||
- fil_space_found_by_id(space) == NULL) {
- break;
- }
+ } while (!success);
/* 5 - publish crypt data */
mutex_enter(&fil_crypt_threads_mutex);
- ut_ad(crypt_data);
mutex_enter(&crypt_data->mutex);
crypt_data->type = CRYPT_SCHEME_1;
ut_a(crypt_data->rotate_state.active_threads == 1);
@@ -1165,10 +1060,9 @@ fil_crypt_start_encrypting_space(
mutex_exit(&crypt_data->mutex);
mutex_exit(&fil_crypt_threads_mutex);
- return pending_op;
+ return recheck;
} while (0);
- ut_ad(crypt_data);
mutex_enter(&crypt_data->mutex);
ut_a(crypt_data->rotate_state.active_threads == 1);
crypt_data->rotate_state.active_threads = 0;
@@ -1178,7 +1072,7 @@ fil_crypt_start_encrypting_space(
fil_crypt_start_converting = false;
mutex_exit(&fil_crypt_threads_mutex);
- return pending_op;
+ return recheck;
}
/** State of a rotation thread */
@@ -1192,7 +1086,7 @@ struct rotate_thread_t {
uint thread_no;
bool first; /*!< is position before first space */
- ulint space; /*!< current space */
+ fil_space_t* space; /*!< current space or NULL */
ulint offset; /*!< current offset */
ulint batch; /*!< #pages to rotate */
uint min_key_version_found;/*!< min key version found but not rotated */
@@ -1228,54 +1122,41 @@ struct rotate_thread_t {
/***********************************************************************
Check if space needs rotation given a key_state
+@param[in,out] state Key rotation state
+@param[in,out] key_state Key state
+@param[in,out] recheck needs recheck ?
@return true if space needs key rotation */
static
bool
fil_crypt_space_needs_rotation(
-/*===========================*/
- rotate_thread_t* state, /*!< in: Key rotation state */
- key_state_t* key_state, /*!< in: Key state */
- bool* recheck) /*!< out: needs recheck ? */
+ rotate_thread_t* state,
+ key_state_t* key_state,
+ bool* recheck)
{
- ulint space = state->space;
+ fil_space_t* space = state->space;
- /* Make sure that tablespace is found and it is normal tablespace */
- if (fil_space_found_by_id(space) == NULL ||
- fil_space_get_type(space) != FIL_TYPE_TABLESPACE) {
+ /* Make sure that tablespace is normal tablespace */
+ if (space->purpose != FIL_TYPE_TABLESPACE) {
return false;
}
- if (fil_inc_pending_ops(space, true)) {
- /* tablespace being dropped */
- return false;
- }
+ ut_ad(space->n_pending_ops > 0);
- /* keep track of if we have pending op */
- bool pending_op = true;
-
- fil_space_crypt_t *crypt_data = fil_space_get_crypt_data(space);
+ fil_space_crypt_t *crypt_data = space->crypt_data;
if (crypt_data == NULL) {
/**
* space has no crypt data
* start encrypting it...
*/
- pending_op = fil_crypt_start_encrypting_space(space, recheck);
-
- crypt_data = fil_space_get_crypt_data(space);
+ *recheck = fil_crypt_start_encrypting_space(space);
+ crypt_data = space->crypt_data;
if (crypt_data == NULL) {
- if (pending_op) {
- fil_decr_pending_ops(space);
- }
return false;
}
crypt_data->key_get_latest_version();
-
- if (!crypt_data->is_key_found()) {
- return false;
- }
}
/* If used key_id is not found from encryption plugin we can't
@@ -1295,7 +1176,7 @@ fil_crypt_space_needs_rotation(
}
/* prevent threads from starting to rotate space */
- if (crypt_data->is_closing(true)) {
+ if (space->is_stopping()) {
break;
}
@@ -1319,39 +1200,39 @@ fil_crypt_space_needs_rotation(
key_state->key_version, key_state->rotate_key_age);
crypt_data->rotate_state.scrubbing.is_active =
- btr_scrub_start_space(space, &state->scrub_data);
+ btr_scrub_start_space(space->id, &state->scrub_data);
time_t diff = time(0) - crypt_data->rotate_state.scrubbing.
last_scrub_completed;
bool need_scrubbing =
+ (srv_background_scrub_data_uncompressed ||
+ srv_background_scrub_data_compressed) &&
crypt_data->rotate_state.scrubbing.is_active
- && diff >= (time_t) srv_background_scrub_data_interval;
+ && diff >= 0
+ && ulint(diff) >= srv_background_scrub_data_interval;
if (need_key_rotation == false && need_scrubbing == false) {
break;
}
mutex_exit(&crypt_data->mutex);
- /* NOTE! fil_decr_pending_ops is performed outside */
+
return true;
} while (0);
mutex_exit(&crypt_data->mutex);
- if (pending_op) {
- fil_decr_pending_ops(space);
- }
return false;
}
/***********************************************************************
-Update global statistics with thread statistics */
+Update global statistics with thread statistics
+@param[in,out] state key rotation statistics */
static void
fil_crypt_update_total_stat(
-/*========================*/
- rotate_thread_t *state) /*!< in: Key rotation status */
+ rotate_thread_t *state)
{
mutex_enter(&crypt_stat_mutex);
crypt_stat.pages_read_from_cache +=
@@ -1375,15 +1256,19 @@ fil_crypt_update_total_stat(
/***********************************************************************
Allocate iops to thread from global setting,
used before starting to rotate a space.
+@param[in,out] state Rotation state
@return true if allocation succeeded, false if failed */
static
bool
fil_crypt_alloc_iops(
-/*=================*/
- rotate_thread_t *state) /*!< in: Key rotation status */
+ rotate_thread_t *state)
{
ut_ad(state->allocated_iops == 0);
+ /* We have not yet selected the space to rotate, thus
+ state might not contain space and we can't check
+ its status yet. */
+
uint max_iops = state->estimated_max_iops;
mutex_enter(&fil_crypt_threads_mutex);
@@ -1409,12 +1294,12 @@ fil_crypt_alloc_iops(
/***********************************************************************
Reallocate iops to thread,
-used when inside a space */
+used when inside a space
+@param[in,out] state Rotation state */
static
void
fil_crypt_realloc_iops(
-/*===================*/
- rotate_thread_t *state) /*!< in: Key rotation status */
+ rotate_thread_t *state)
{
ut_a(state->allocated_iops > 0);
@@ -1423,13 +1308,12 @@ fil_crypt_realloc_iops(
uint avg_wait_time_us =
state->sum_waited_us / state->cnt_waited;
-#if DEBUG_KEYROTATION_THROTTLING
- ib_logf(IB_LOG_LEVEL_INFO,
- "thr_no: %u - update estimated_max_iops from %u to %u.",
+ DBUG_PRINT("ib_crypt",
+ ("thr_no: %u - update estimated_max_iops from %u to %u.",
state->thread_no,
state->estimated_max_iops,
- 1000000 / avg_wait_time_us);
-#endif
+ 1000000 / avg_wait_time_us));
+
if (avg_wait_time_us == 0) {
avg_wait_time_us = 1; // prevent division by zero
}
@@ -1438,12 +1322,11 @@ fil_crypt_realloc_iops(
state->cnt_waited = 0;
state->sum_waited_us = 0;
} else {
-#if DEBUG_KEYROTATION_THROTTLING
- ib_logf(IB_LOG_LEVEL_INFO,
- "thr_no: %u only waited %lu%% skip re-estimate.",
+
+ DBUG_PRINT("ib_crypt",
+ ("thr_no: %u only waited %lu%% skip re-estimate.",
state->thread_no,
- (100 * state->cnt_waited) / state->batch);
-#endif
+ (100 * state->cnt_waited) / state->batch));
}
if (state->estimated_max_iops <= state->allocated_iops) {
@@ -1469,8 +1352,9 @@ fil_crypt_realloc_iops(
state->allocated_iops ++;
n_fil_crypt_iops_allocated ++;
}
- mutex_exit(&fil_crypt_threads_mutex);
+
os_event_set(fil_crypt_threads_event);
+ mutex_exit(&fil_crypt_threads_mutex);
}
} else {
/* see if there are more to get */
@@ -1487,13 +1371,13 @@ fil_crypt_realloc_iops(
}
n_fil_crypt_iops_allocated += extra;
state->allocated_iops += extra;
-#if DEBUG_KEYROTATION_THROTTLING
- ib_logf(IB_LOG_LEVEL_INFO,
- "thr_no: %u increased iops from %u to %u.",
+
+ DBUG_PRINT("ib_crypt",
+ ("thr_no: %u increased iops from %u to %u.",
state->thread_no,
state->allocated_iops - extra,
- state->allocated_iops);
-#endif
+ state->allocated_iops));
+
}
mutex_exit(&fil_crypt_threads_mutex);
}
@@ -1502,12 +1386,12 @@ fil_crypt_realloc_iops(
}
/***********************************************************************
-Return allocated iops to global */
+Return allocated iops to global
+@param[in,out] state Rotation state */
static
void
fil_crypt_return_iops(
-/*==================*/
- rotate_thread_t *state) /*!< in: Key rotation status */
+ rotate_thread_t *state)
{
if (state->allocated_iops > 0) {
uint iops = state->allocated_iops;
@@ -1520,25 +1404,27 @@ fil_crypt_return_iops(
ut_ad(0);
iops = 0;
}
+
n_fil_crypt_iops_allocated -= iops;
- mutex_exit(&fil_crypt_threads_mutex);
state->allocated_iops = 0;
os_event_set(fil_crypt_threads_event);
+ mutex_exit(&fil_crypt_threads_mutex);
}
fil_crypt_update_total_stat(state);
}
/***********************************************************************
-Search for a space needing rotation */
-UNIV_INTERN
+Search for a space needing rotation
+@param[in,out] key_state Key state
+@param[in,out] state Rotation state
+@param[in,out] recheck recheck ? */
+static
bool
fil_crypt_find_space_to_rotate(
-/*===========================*/
- key_state_t* key_state, /*!< in: Key state */
- rotate_thread_t* state, /*!< in: Key rotation state */
- bool* recheck) /*!< out: true if recheck
- needed */
+ key_state_t* key_state,
+ rotate_thread_t* state,
+ bool* recheck)
{
/* we need iops to start rotating */
while (!state->should_shutdown() && !fil_crypt_alloc_iops(state)) {
@@ -1547,30 +1433,44 @@ fil_crypt_find_space_to_rotate(
}
if (state->should_shutdown()) {
+ if (state->space) {
+ fil_space_release(state->space);
+ state->space = NULL;
+ }
return false;
}
if (state->first) {
state->first = false;
- state->space = fil_get_first_space_safe();
- } else {
- state->space = fil_get_next_space_safe(state->space);
+ if (state->space) {
+ fil_space_release(state->space);
+ }
+ state->space = NULL;
}
- while (!state->should_shutdown() && state->space != ULINT_UNDEFINED) {
- fil_space_t* space = fil_space_found_by_id(state->space);
+ /* If key rotation is enabled (default) we iterate all tablespaces.
+ If key rotation is not enabled we iterate only the tablespaces
+ added to keyrotation list. */
+ if (srv_fil_crypt_rotate_key_age) {
+ state->space = fil_space_next(state->space);
+ } else {
+ state->space = fil_space_keyrotate_next(state->space);
+ }
- if (space) {
- if (fil_crypt_space_needs_rotation(state, key_state, recheck)) {
- ut_ad(key_state->key_id);
- /* init state->min_key_version_found before
- * starting on a space */
- state->min_key_version_found = key_state->key_version;
- return true;
- }
+ while (!state->should_shutdown() && state->space) {
+ if (fil_crypt_space_needs_rotation(state, key_state, recheck)) {
+ ut_ad(key_state->key_id);
+ /* init state->min_key_version_found before
+ * starting on a space */
+ state->min_key_version_found = key_state->key_version;
+ return true;
}
- state->space = fil_get_next_space_safe(state->space);
+ if (srv_fil_crypt_rotate_key_age) {
+ state->space = fil_space_next(state->space);
+ } else {
+ state->space = fil_space_keyrotate_next(state->space);
+ }
}
/* if we didn't find any space return iops */
@@ -1581,16 +1481,16 @@ fil_crypt_find_space_to_rotate(
}
/***********************************************************************
-Start rotating a space */
+Start rotating a space
+@param[in] key_state Key state
+@param[in,out] state Rotation state */
static
void
fil_crypt_start_rotate_space(
-/*=========================*/
- const key_state_t* key_state, /*!< in: Key state */
- rotate_thread_t* state) /*!< in: Key rotation state */
+ const key_state_t* key_state,
+ rotate_thread_t* state)
{
- ulint space = state->space;
- fil_space_crypt_t *crypt_data = fil_space_get_crypt_data(space);
+ fil_space_crypt_t *crypt_data = state->space->crypt_data;
ut_ad(crypt_data);
mutex_enter(&crypt_data->mutex);
@@ -1601,8 +1501,9 @@ fil_crypt_start_rotate_space(
crypt_data->rotate_state.next_offset = 1; // skip page 0
/* no need to rotate beyond current max
* if space extends, it will be encrypted with newer version */
- crypt_data->rotate_state.max_offset = fil_space_get_size(space);
-
+ /* FIXME: max_offset could be removed and instead
+ space->size consulted.*/
+ crypt_data->rotate_state.max_offset = state->space->size;
crypt_data->rotate_state.end_lsn = 0;
crypt_data->rotate_state.min_key_version_found =
key_state->key_version;
@@ -1630,26 +1531,34 @@ fil_crypt_start_rotate_space(
/***********************************************************************
Search for batch of pages needing rotation
+@param[in] key_state Key state
+@param[in,out] state Rotation state
@return true if page needing key rotation found, false if not found */
static
bool
fil_crypt_find_page_to_rotate(
-/*==========================*/
- const key_state_t* key_state, /*!< in: Key state */
- rotate_thread_t* state) /*!< in: Key rotation state */
+ const key_state_t* key_state,
+ rotate_thread_t* state)
{
ulint batch = srv_alloc_time * state->allocated_iops;
- ulint space = state->space;
- fil_space_crypt_t *crypt_data = fil_space_get_crypt_data(space);
+ fil_space_t* space = state->space;
+
+ ut_ad(!space || space->n_pending_ops > 0);
+
+ /* If space is marked to be dropped stop rotation. */
+ if (!space || space->is_stopping()) {
+ return false;
+ }
+
+ fil_space_crypt_t *crypt_data = space->crypt_data;
/* Space might already be dropped */
if (crypt_data) {
mutex_enter(&crypt_data->mutex);
ut_ad(key_state->key_id == crypt_data->key_id);
- if (!crypt_data->is_closing(true) &&
- crypt_data->rotate_state.next_offset <
- crypt_data->rotate_state.max_offset) {
+ if (crypt_data->rotate_state.next_offset <
+ crypt_data->rotate_state.max_offset) {
state->offset = crypt_data->rotate_state.next_offset;
ulint remaining = crypt_data->rotate_state.max_offset -
@@ -1674,79 +1583,64 @@ fil_crypt_find_page_to_rotate(
/***********************************************************************
Check if a page is uninitialized (doesn't need to be rotated)
-@return true if page is uninitialized, false if not.*/
-static
+@param[in] frame Page to check
+@param[in] page_size Page size
+@return true if page is uninitialized, false if not. */
+static inline
bool
fil_crypt_is_page_uninitialized(
-/*============================*/
- const byte* frame, /*!< in: Page */
- const page_size_t& page_size) /*!< in: page size */
+ const byte *frame,
+ const page_size_t& page_size)
{
- if (fil_page_get_type(frame) == FIL_PAGE_TYPE_ALLOCATED) {
- /* empty pages aren't encrypted */
- return true;
- }
-
- if (page_size.is_compressed()) {
- ulint stored_checksum = mach_read_from_4(
- frame + FIL_PAGE_SPACE_OR_CHKSUM);
- /* empty pages aren't encrypted */
- if (stored_checksum == 0) {
- return true;
- }
- } else {
- ulint size = page_size.logical();
- ulint checksum_field1 = mach_read_from_4(
- frame + FIL_PAGE_SPACE_OR_CHKSUM);
- ulint checksum_field2 = mach_read_from_4(
- frame + size - FIL_PAGE_END_LSN_OLD_CHKSUM);
- /* empty pages are not encrypted */
- if (checksum_field1 == 0 && checksum_field2 == 0
- && mach_read_from_4(frame + FIL_PAGE_LSN) == 0) {
- return true;
- }
- }
- return false;
+ return (buf_page_is_zeroes(frame, page_size));
}
-#define fil_crypt_get_page_throttle(state,space,page_size,offset,mtr,sleeptime_ms) \
- fil_crypt_get_page_throttle_func(state, space, page_size, offset, mtr, \
+#define fil_crypt_get_page_throttle(state,offset,mtr,sleeptime_ms) \
+ fil_crypt_get_page_throttle_func(state, offset, mtr, \
sleeptime_ms, __FILE__, __LINE__)
/***********************************************************************
Get a page and compute sleep time
-@return page */
+@param[in,out] state Rotation state
+@param[in] offset Page offset
+@param[in,out] mtr Minitransaction
+@param[out] sleeptime_ms Sleep time
+@param[in] file File where called
+@param[in] line Line where called
+@return page or NULL*/
static
buf_block_t*
fil_crypt_get_page_throttle_func(
-/*=============================*/
- rotate_thread_t* state, /*!< in/out: Key rotation state */
- ulint space, /*!< in: FIL space id */
- const page_size_t& page_size, /*!< in: page size */
- ulint offset, /*!< in: page offsett */
- mtr_t* mtr, /*!< in/out: minitransaction */
- ulint* sleeptime_ms, /*!< out: sleep time */
- const char* file, /*!< in: file name */
- unsigned line) /*!< in: file line */
+ rotate_thread_t* state,
+ ulint offset,
+ mtr_t* mtr,
+ ulint* sleeptime_ms,
+ const char* file,
+ ulint line)
{
- const page_id_t& page_id = page_id_t(space, offset);
- dberr_t err = DB_SUCCESS;
- buf_block_t* block = NULL;
+ fil_space_t* space = state->space;
+ const page_size_t page_size = page_size_t(space->flags);
+ const page_id_t page_id(space->id, offset);
+ ut_ad(space->n_pending_ops > 0);
- // JAN: TODO:
- // buf_block_t* block = buf_page_try_get_func(page_id, file, line, mtr);
+ /* Before reading from tablespace we need to make sure that
+ the tablespace is not about to be dropped or truncated. */
+ if (space->is_stopping()) {
+ return NULL;
+ }
+ dberr_t err = DB_SUCCESS;
+ buf_block_t* block = buf_page_get_gen(page_id, page_size, RW_X_LATCH,
+ NULL,
+ BUF_PEEK_IF_IN_POOL, file, line,
+ mtr, &err);
if (block != NULL) {
/* page was in buffer pool */
state->crypt_stat.pages_read_from_cache++;
return block;
}
- /* Before reading from tablespace we need to make sure that
- tablespace exists and is not is just being dropped. */
-
- if (fil_crypt_is_closing(space) ||
- fil_space_found_by_id(space) == NULL) {
+ if (space->is_stopping()) {
return NULL;
}
@@ -1756,7 +1650,7 @@ fil_crypt_get_page_throttle_func(
block = buf_page_get_gen(page_id, page_size,
RW_X_LATCH,
NULL, BUF_GET_POSSIBLY_FREED,
- file, line, mtr, &err);
+ file, line, mtr, &err);
uintmax_t end = ut_time_us(NULL);
if (end < start) {
@@ -1779,6 +1673,7 @@ fil_crypt_get_page_throttle_func(
}
*sleeptime_ms += add_sleeptime_ms;
+
return block;
}
@@ -1788,26 +1683,32 @@ Get block and allocation status
note: innodb locks fil_space_latch and then block when allocating page
but locks block and then fil_space_latch when freeing page.
-@return block
+
+@param[in,out] state Rotation state
+@param[in] offset Page offset
+@param[in,out] mtr Minitransaction
+@param[out] allocation_status Allocation status
+@param[out] sleeptime_ms Sleep time
+@return block or NULL
*/
static
buf_block_t*
btr_scrub_get_block_and_allocation_status(
-/*======================================*/
- rotate_thread_t* state, /*!< in/out: Key rotation state */
- ulint space, /*!< in: FIL space id */
- const page_size_t& page_size, /*!< in: page size */
- ulint offset, /*!< in: page offsett */
- mtr_t* mtr, /*!< in/out: minitransaction
- */
+ rotate_thread_t* state,
+ ulint offset,
+ mtr_t* mtr,
btr_scrub_page_allocation_status_t *allocation_status,
- /*!< in/out: allocation status */
- ulint* sleeptime_ms) /*!< out: sleep time */
+ ulint* sleeptime_ms)
{
mtr_t local_mtr;
buf_block_t *block = NULL;
+ fil_space_t* space = state->space;
+
+ ut_ad(space->n_pending_ops > 0);
+
mtr_start(&local_mtr);
- *allocation_status = fsp_page_is_free(space, offset, &local_mtr) ?
+
+ *allocation_status = fsp_page_is_free(space->id, offset, &local_mtr) ?
BTR_SCRUB_PAGE_FREE :
BTR_SCRUB_PAGE_ALLOCATED;
@@ -1815,7 +1716,6 @@ btr_scrub_get_block_and_allocation_status(
/* this is easy case, we lock fil_space_latch first and
then block */
block = fil_crypt_get_page_throttle(state,
- space, page_size,
offset, mtr,
sleeptime_ms);
mtr_commit(&local_mtr);
@@ -1832,7 +1732,6 @@ btr_scrub_get_block_and_allocation_status(
*/
block = fil_crypt_get_page_throttle(state,
- space, page_size,
offset, mtr,
sleeptime_ms);
}
@@ -1842,22 +1741,29 @@ btr_scrub_get_block_and_allocation_status(
/***********************************************************************
-Rotate one page */
+Rotate one page
+@param[in,out] key_state Key state
+@param[in,out] state Rotation state */
static
void
fil_crypt_rotate_page(
-/*==================*/
- const key_state_t* key_state, /*!< in: Key state */
- rotate_thread_t* state) /*!< in: Key rotation state */
+ const key_state_t* key_state,
+ rotate_thread_t* state)
{
- ulint space = state->space;
+ fil_space_t*space = state->space;
+ ulint space_id = space->id;
ulint offset = state->offset;
- bool tsfound;
- const page_size_t page_size = fil_space_get_page_size(space, &tsfound);
ulint sleeptime_ms = 0;
+ fil_space_crypt_t *crypt_data = space->crypt_data;
+ const page_size_t page_size = page_size_t(space->flags);
- /* check if tablespace is closing before reading page */
- if (fil_crypt_is_closing(space) || fil_space_found_by_id(space) == NULL) {
+ ut_ad(space->n_pending_ops > 0);
+
+ /* In fil_crypt_thread where key rotation is done we have
+ acquired space and checked that this space is not yet
+ marked to be dropped. Similarly, in fil_crypt_find_page_to_rotate().
+ Check here also to give DROP TABLE or similar a change. */
+ if (space->is_stopping()) {
return;
}
@@ -1869,7 +1775,6 @@ fil_crypt_rotate_page(
mtr_t mtr;
mtr_start(&mtr);
buf_block_t* block = fil_crypt_get_page_throttle(state,
- space, page_size,
offset, &mtr,
&sleeptime_ms);
@@ -1881,9 +1786,8 @@ fil_crypt_rotate_page(
uint kv = block->page.key_version;
/* check if tablespace is closing after reading page */
- if (!fil_crypt_is_closing(space)) {
+ if (space->is_stopping()) {
byte* frame = buf_block_get_frame(block);
- fil_space_crypt_t *crypt_data = fil_space_get_crypt_data(space);
if (kv == 0 &&
fil_crypt_is_page_uninitialized(frame, page_size)) {
@@ -1903,7 +1807,7 @@ fil_crypt_rotate_page(
/* force rotation by dummy updating page */
mlog_write_ulint(frame +
FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID,
- space, MLOG_4BYTES, &mtr);
+ space_id, MLOG_4BYTES, &mtr);
/* update block */
block->page.key_version = key_state->key_version;
@@ -1937,7 +1841,7 @@ fil_crypt_rotate_page(
btr_scrub_page_allocation_status_t allocated;
block = btr_scrub_get_block_and_allocation_status(
- state, space, page_size, offset, &mtr,
+ state, offset, &mtr,
&allocated,
&sleeptime_ms);
@@ -1951,7 +1855,7 @@ fil_crypt_rotate_page(
/* we need to refetch it once more now that we have
* index locked */
block = btr_scrub_get_block_and_allocation_status(
- state, space, page_size, offset, &mtr,
+ state, offset, &mtr,
&allocated,
&sleeptime_ms);
@@ -1982,7 +1886,6 @@ fil_crypt_rotate_page(
if (needs_scrubbing == BTR_SCRUB_TURNED_OFF) {
/* if we just detected that scrubbing was turned off
* update global state to reflect this */
- fil_space_crypt_t *crypt_data = fil_space_get_crypt_data(space);
ut_ad(crypt_data);
mutex_enter(&crypt_data->mutex);
crypt_data->rotate_state.scrubbing.is_active = false;
@@ -2010,17 +1913,20 @@ fil_crypt_rotate_page(
}
/***********************************************************************
-Rotate a batch of pages */
+Rotate a batch of pages
+@param[in,out] key_state Key state
+@param[in,out] state Rotation state */
static
void
fil_crypt_rotate_pages(
-/*===================*/
- const key_state_t* key_state, /*!< in: Key state */
- rotate_thread_t* state) /*!< in: Key rotation state */
+ const key_state_t* key_state,
+ rotate_thread_t* state)
{
- ulint space = state->space;
+ ulint space = state->space->id;
ulint end = state->offset + state->batch;
+ ut_ad(state->space->n_pending_ops > 0);
+
for (; state->offset < end; state->offset++) {
/* we can't rotate pages in dblwr buffer as
@@ -2041,20 +1947,23 @@ fil_crypt_rotate_pages(
}
/***********************************************************************
-Flush rotated pages and then update page 0 */
+Flush rotated pages and then update page 0
+
+@param[in,out] state rotation state */
static
void
fil_crypt_flush_space(
-/*==================*/
- rotate_thread_t* state, /*!< in: Key rotation state */
- ulint space) /*!< in: FIL space id */
+ rotate_thread_t* state)
{
- fil_space_crypt_t *crypt_data = fil_space_get_crypt_data(space);
+ fil_space_t* space = state->space;
+ fil_space_crypt_t *crypt_data = space->crypt_data;
+
+ ut_ad(space->n_pending_ops > 0);
/* flush tablespace pages so that there are no pages left with old key */
lsn_t end_lsn = crypt_data->rotate_state.end_lsn;
- if (end_lsn > 0 && !fil_crypt_is_closing(space)) {
+ if (end_lsn > 0 && !space->is_stopping()) {
bool success = false;
ulint n_pages = 0;
ulint sum_pages = 0;
@@ -2064,7 +1973,7 @@ fil_crypt_flush_space(
success = buf_flush_lists(ULINT_MAX, end_lsn, &n_pages);
buf_flush_wait_batch_end(NULL, BUF_FLUSH_LIST);
sum_pages += n_pages;
- } while (!success && !fil_crypt_is_closing(space));
+ } while (!success && !space->is_stopping());
uintmax_t end = ut_time_us(NULL);
@@ -2082,48 +1991,38 @@ fil_crypt_flush_space(
}
/* update page 0 */
- if (!fil_crypt_is_closing(space)) {
- mtr_t mtr;
- mtr_start(&mtr);
- ulint offset = 0; // page 0
- const page_id_t page_id(space, offset);
- bool tsfound;
- const page_size_t page_size = fil_space_get_page_size(space, &tsfound);
- dberr_t err = DB_SUCCESS;
-
- buf_block_t* block = buf_page_get_gen(page_id, page_size,
- RW_X_LATCH, NULL, BUF_GET,
- __FILE__, __LINE__, &mtr, &err);
-
- if (block && err == DB_SUCCESS) {
- byte* frame = buf_block_get_frame(block);
-
- crypt_data->page0_offset = FSP_HEADER_OFFSET
- + fsp_header_get_encryption_offset(page_size);
+ mtr_t mtr;
+ mtr.start();
- fil_space_write_crypt_data(space, frame,
- crypt_data->page0_offset,
- ULINT_MAX, &mtr);
- }
+ dberr_t err;
- mtr_commit(&mtr);
+ if (buf_block_t* block = buf_page_get_gen(
+ page_id_t(space->id, 0), page_size_t(space->flags),
+ RW_X_LATCH, NULL, BUF_GET,
+ __FILE__, __LINE__, &mtr, &err)) {
+ crypt_data->write_page0(space, block->frame, &mtr);
}
+
+ mtr.commit();
}
/***********************************************************************
-Complete rotating a space */
+Complete rotating a space
+@param[in,out] key_state Key state
+@param[in,out] state Rotation state */
static
void
fil_crypt_complete_rotate_space(
-/*============================*/
- const key_state_t* key_state, /*!< in: Key state */
- rotate_thread_t* state) /*!< in: Key rotation state */
+ const key_state_t* key_state,
+ rotate_thread_t* state)
{
- ulint space = state->space;
- fil_space_crypt_t *crypt_data = fil_space_get_crypt_data(space);
+ fil_space_crypt_t *crypt_data = state->space->crypt_data;
+
+ ut_ad(crypt_data);
+ ut_ad(state->space->n_pending_ops > 0);
/* Space might already be dropped */
- if (crypt_data != NULL && !crypt_data->is_closing(false)) {
+ if (!state->space->is_stopping()) {
mutex_enter(&crypt_data->mutex);
/**
@@ -2181,9 +2080,8 @@ fil_crypt_complete_rotate_space(
}
if (should_flush) {
- fil_crypt_flush_space(state, space);
+ fil_crypt_flush_space(state);
- ut_ad(crypt_data);
mutex_enter(&crypt_data->mutex);
crypt_data->rotate_state.flushing = false;
mutex_exit(&crypt_data->mutex);
@@ -2206,8 +2104,8 @@ DECLARE_THREAD(fil_crypt_thread)(
mutex_enter(&fil_crypt_threads_mutex);
uint thread_no = srv_n_fil_crypt_threads_started;
srv_n_fil_crypt_threads_started++;
- mutex_exit(&fil_crypt_threads_mutex);
os_event_set(fil_crypt_event); /* signal that we started */
+ mutex_exit(&fil_crypt_threads_mutex);
/* state of this thread */
rotate_thread_t thr(thread_no);
@@ -2227,6 +2125,7 @@ DECLARE_THREAD(fil_crypt_thread)(
* i.e either new key version of change or
* new rotate_key_age */
os_event_reset(fil_crypt_threads_event);
+
if (os_event_wait_time(fil_crypt_threads_event, 1000000) == 0) {
break;
}
@@ -2240,7 +2139,12 @@ DECLARE_THREAD(fil_crypt_thread)(
time_t waited = time(0) - wait_start;
- if (waited >= (time_t) srv_background_scrub_data_check_interval) {
+ /* Break if we have waited the background scrub
+ internal and background scrubbing is enabled */
+ if (waited >= 0
+ && ulint(waited) >= srv_background_scrub_data_check_interval
+ && (srv_background_scrub_data_uncompressed
+ || srv_background_scrub_data_compressed)) {
break;
}
}
@@ -2255,29 +2159,32 @@ DECLARE_THREAD(fil_crypt_thread)(
/* we found a space to rotate */
fil_crypt_start_rotate_space(&new_state, &thr);
- /* decrement pending ops that was incremented in
- * fil_crypt_space_needs_rotation
- * (called from fil_crypt_find_space_to_rotate),
- * this makes sure that tablespace won't be dropped
- * just after we decided to start processing it. */
- fil_decr_pending_ops(thr.space);
-
/* iterate all pages (cooperativly with other threads) */
- while (!thr.should_shutdown() &&
+ while (!thr.should_shutdown() && thr.space &&
fil_crypt_find_page_to_rotate(&new_state, &thr)) {
/* rotate a (set) of pages */
fil_crypt_rotate_pages(&new_state, &thr);
+ /* If space is marked as stopping, release
+ space and stop rotation. */
+ if (thr.space->is_stopping()) {
+ fil_space_release(thr.space);
+ thr.space = NULL;
+ break;
+ }
+
/* realloc iops */
fil_crypt_realloc_iops(&thr);
}
/* complete rotation */
- fil_crypt_complete_rotate_space(&new_state, &thr);
+ if (thr.space) {
+ fil_crypt_complete_rotate_space(&new_state, &thr);
+ }
/* force key state refresh */
- new_state.key_id= 0;
+ new_state.key_id = 0;
/* return iops */
fil_crypt_return_iops(&thr);
@@ -2287,10 +2194,16 @@ DECLARE_THREAD(fil_crypt_thread)(
/* return iops if shutting down */
fil_crypt_return_iops(&thr);
+ /* release current space if shutting down */
+ if (thr.space) {
+ fil_space_release(thr.space);
+ thr.space = NULL;
+ }
+
mutex_enter(&fil_crypt_threads_mutex);
srv_n_fil_crypt_threads_started--;
- mutex_exit(&fil_crypt_threads_mutex);
os_event_set(fil_crypt_event); /* signal that we stopped */
+ mutex_exit(&fil_crypt_threads_mutex);
/* We count the number of threads in os_thread_exit(). A created
thread should always use that to exit and not use return() to exit. */
@@ -2301,17 +2214,19 @@ DECLARE_THREAD(fil_crypt_thread)(
}
/*********************************************************************
-Adjust thread count for key rotation */
+Adjust thread count for key rotation
+@param[in] enw_cnt Number of threads to be used */
UNIV_INTERN
void
fil_crypt_set_thread_cnt(
-/*=====================*/
- uint new_cnt) /*!< in: New key rotation thread count */
+ const uint new_cnt)
{
if (!fil_crypt_threads_inited) {
fil_crypt_threads_init();
}
+ mutex_enter(&fil_crypt_threads_mutex);
+
if (new_cnt > srv_n_fil_crypt_threads) {
uint add = new_cnt - srv_n_fil_crypt_threads;
srv_n_fil_crypt_threads = new_cnt;
@@ -2328,6 +2243,8 @@ fil_crypt_set_thread_cnt(
os_event_set(fil_crypt_threads_event);
}
+ mutex_exit(&fil_crypt_threads_mutex);
+
while(srv_n_fil_crypt_threads_started != srv_n_fil_crypt_threads) {
os_event_reset(fil_crypt_event);
os_event_wait_time(fil_crypt_event, 1000000);
@@ -2335,39 +2252,39 @@ fil_crypt_set_thread_cnt(
}
/*********************************************************************
-Adjust max key age */
+Adjust max key age
+@param[in] val New max key age */
UNIV_INTERN
void
fil_crypt_set_rotate_key_age(
-/*=========================*/
- uint val) /*!< in: New max key age */
+ uint val)
{
srv_fil_crypt_rotate_key_age = val;
os_event_set(fil_crypt_threads_event);
}
/*********************************************************************
-Adjust rotation iops */
+Adjust rotation iops
+@param[in] val New max roation iops */
UNIV_INTERN
void
fil_crypt_set_rotation_iops(
-/*========================*/
- uint val) /*!< in: New iops setting */
+ uint val)
{
srv_n_fil_crypt_iops = val;
os_event_set(fil_crypt_threads_event);
}
/*********************************************************************
-Adjust encrypt tables */
+Adjust encrypt tables
+@param[in] val New setting for innodb-encrypt-tables */
UNIV_INTERN
void
fil_crypt_set_encrypt_tables(
-/*=========================*/
- uint val) /*!< in: New srv_encrypt_tables setting */
+ uint val)
{
- srv_encrypt_tables = val;
- os_event_set(fil_crypt_threads_event);
+ srv_encrypt_tables = val;
+ os_event_set(fil_crypt_threads_event);
}
/*********************************************************************
@@ -2375,7 +2292,6 @@ Init threads for key rotation */
UNIV_INTERN
void
fil_crypt_threads_init()
-/*====================*/
{
if (!fil_crypt_threads_inited) {
fil_crypt_event = os_event_create(0);
@@ -2395,7 +2311,6 @@ Clean up key rotation threads resources */
UNIV_INTERN
void
fil_crypt_threads_cleanup()
-/*=======================*/
{
if (!fil_crypt_threads_inited) {
return;
@@ -2408,62 +2323,26 @@ fil_crypt_threads_cleanup()
}
/*********************************************************************
-Mark a space as closing */
+Wait for crypt threads to stop accessing space
+@param[in] space Tablespace */
UNIV_INTERN
void
-fil_space_crypt_mark_space_closing(
-/*===============================*/
- ulint space, /*!< in: tablespace id */
- fil_space_crypt_t* crypt_data) /*!< in: crypt_data or NULL */
+fil_space_crypt_close_tablespace(
+ const fil_space_t* space)
{
- if (!fil_crypt_threads_inited) {
- return;
- }
-
- mutex_enter(&fil_crypt_threads_mutex);
+ fil_space_crypt_t* crypt_data = space->crypt_data;
if (!crypt_data) {
- crypt_data = fil_space_get_crypt_data(space);
- }
-
- if (crypt_data == NULL) {
- mutex_exit(&fil_crypt_threads_mutex);
- return;
- }
-
- mutex_enter(&crypt_data->mutex);
- mutex_exit(&fil_crypt_threads_mutex);
- crypt_data->closing = true;
- mutex_exit(&crypt_data->mutex);
-}
-
-/*********************************************************************
-Wait for crypt threads to stop accessing space */
-UNIV_INTERN
-void
-fil_space_crypt_close_tablespace(
-/*=============================*/
- ulint space) /*!< in: Space id */
-{
- if (!srv_encrypt_tables) {
return;
}
mutex_enter(&fil_crypt_threads_mutex);
- fil_space_crypt_t* crypt_data = fil_space_get_crypt_data(space);
-
- if (crypt_data == NULL || crypt_data->is_closing(false)) {
- mutex_exit(&fil_crypt_threads_mutex);
- return;
- }
-
time_t start = time(0);
time_t last = start;
mutex_enter(&crypt_data->mutex);
mutex_exit(&fil_crypt_threads_mutex);
- crypt_data->closing = true;
uint cnt = crypt_data->rotate_state.active_threads;
bool flushing = crypt_data->rotate_state.flushing;
@@ -2473,8 +2352,10 @@ fil_space_crypt_close_tablespace(
/* release dict mutex so that scrub threads can release their
* table references */
dict_mutex_exit_for_mysql();
+
/* wakeup throttle (all) sleepers */
os_event_set(fil_crypt_throttle_sleep_event);
+
os_thread_sleep(20000);
dict_mutex_enter_for_mysql();
mutex_enter(&crypt_data->mutex);
@@ -2487,7 +2368,7 @@ fil_space_crypt_close_tablespace(
ib::warn() << "Waited "
<< now - start
<< " seconds to drop space: "
- << space << ".";
+ << space->name << ".";
last = now;
}
}
@@ -2497,22 +2378,23 @@ fil_space_crypt_close_tablespace(
/*********************************************************************
Get crypt status for a space (used by information_schema)
-return 0 if crypt data present */
+@param[in] space Tablespace
+@param[out] status Crypt status */
UNIV_INTERN
-int
+void
fil_space_crypt_get_status(
-/*=======================*/
- ulint id, /*!< in: space id */
- struct fil_space_crypt_status_t* status) /*!< out: status */
+ const fil_space_t* space,
+ struct fil_space_crypt_status_t* status)
{
- fil_space_crypt_t* crypt_data = fil_space_get_crypt_data(id);
-
memset(status, 0, sizeof(*status));
+ ut_ad(space->n_pending_ops > 0);
+ fil_space_crypt_t* crypt_data = space->crypt_data;
+ status->space = space->id;
+
if (crypt_data != NULL) {
- status->space = id;
- status->scheme = crypt_data->type;
mutex_enter(&crypt_data->mutex);
+ status->scheme = crypt_data->type;
status->keyserver_requests = crypt_data->keyserver_requests;
status->min_key_version = crypt_data->min_key_version;
status->key_id = crypt_data->key_id;
@@ -2526,8 +2408,6 @@ fil_space_crypt_get_status(
crypt_data->rotate_state.next_offset;
status->rotate_max_page_number =
crypt_data->rotate_state.max_offset;
- } else {
- status->rotating = false;
}
mutex_exit(&crypt_data->mutex);
@@ -2535,25 +2415,17 @@ fil_space_crypt_get_status(
if (srv_encrypt_tables || crypt_data->min_key_version) {
status->current_key_version =
fil_crypt_get_latest_key_version(crypt_data);
- } else {
- status->current_key_version = 0;
- }
- } else {
- if (srv_encrypt_tables) {
- os_event_set(fil_crypt_threads_event);
}
}
-
- return crypt_data == NULL ? 1 : 0;
}
/*********************************************************************
-Return crypt statistics */
+Return crypt statistics
+@param[out] stat Crypt statistics */
UNIV_INTERN
void
fil_crypt_total_stat(
-/*=================*/
- fil_crypt_stat_t *stat) /*!< out: Crypt statistics */
+ fil_crypt_stat_t *stat)
{
mutex_enter(&crypt_stat_mutex);
*stat = crypt_stat;
@@ -2562,23 +2434,24 @@ fil_crypt_total_stat(
/*********************************************************************
Get scrub status for a space (used by information_schema)
-return 0 if data found */
+
+@param[in] space Tablespace
+@param[out] status Scrub status */
UNIV_INTERN
-int
+void
fil_space_get_scrub_status(
-/*=======================*/
- ulint id, /*!< in: space id */
- struct fil_space_scrub_status_t* status) /*!< out: status */
+ const fil_space_t* space,
+ struct fil_space_scrub_status_t* status)
{
- fil_space_crypt_t* crypt_data = fil_space_get_crypt_data(id);
-
memset(status, 0, sizeof(*status));
+ ut_ad(space->n_pending_ops > 0);
+ fil_space_crypt_t* crypt_data = space->crypt_data;
+
+ status->space = space->id;
+
if (crypt_data != NULL) {
- bool tsfound;
- const page_size_t page_size = fil_space_get_page_size(id, &tsfound);
- status->space = id;
- status->compressed = page_size.is_compressed();
+ status->compressed = FSP_FLAGS_GET_ZIP_SSIZE(space->flags) > 0;
mutex_enter(&crypt_data->mutex);
status->last_scrub_completed =
crypt_data->rotate_state.scrubbing.last_scrub_completed;
@@ -2593,102 +2466,168 @@ fil_space_get_scrub_status(
crypt_data->rotate_state.next_offset;
status->current_scrub_max_page_number =
crypt_data->rotate_state.max_offset;
- } else {
- status->scrubbing = false;
}
mutex_exit(&crypt_data->mutex);
}
-
- return crypt_data == NULL ? 1 : 0;
}
#endif /* UNIV_INNOCHECKSUM */
-/*********************************************************************
-Verify checksum for a page (iff it's encrypted)
-NOTE: currently this function can only be run in single threaded mode
-as it modifies srv_checksum_algorithm (temporarily)
-@param[in] src_fame page to verify
-@param[in] page_size page_size
-@param[in] page_no page number of given read_buf
-@param[in] strict_check true if strict-check option is enabled
+/**
+Verify that post encryption checksum match calculated checksum.
+This function should be called only if tablespace contains crypt_data
+metadata (this is strong indication that tablespace is encrypted).
+Function also verifies that traditional checksum does not match
+calculated checksum as if it does page could be valid unencrypted,
+encrypted, or corrupted.
+
+@param[in,out] page page frame (checksum is temporarily modified)
+@param[in] page_size page size
+@param[in] space tablespace identifier
+@param[in] offset page number
@return true if page is encrypted AND OK, false otherwise */
UNIV_INTERN
bool
fil_space_verify_crypt_checksum(
-/*============================*/
- const byte* src_frame, /*!< in: page the verify */
- const page_size_t& page_size /*!< in: page size */
+ byte* page,
+ const page_size_t& page_size,
#ifdef UNIV_INNOCHECKSUM
- ,uintmax_t page_no,
- bool strict_check
+ bool strict_check, /*!< --strict-check */
+ FILE* log_file, /*!< --log */
#endif /* UNIV_INNOCHECKSUM */
-)
+ ulint space,
+ ulint offset)
{
- // key version
- uint key_version = mach_read_from_4(
- src_frame + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION);
+ uint key_version = mach_read_from_4(page+ FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION);
+ /* If page is not encrypted, return false */
if (key_version == 0) {
- return false; // unencrypted page
+ return false;
}
- /* "trick" the normal checksum routines by storing the post-encryption
- * checksum into the normal checksum field allowing for reuse of
- * the normal routines */
+ srv_checksum_algorithm_t algorithm =
+ static_cast<srv_checksum_algorithm_t>(srv_checksum_algorithm);
+ /* If no checksum is used, can't continue checking. */
+ if (algorithm == SRV_CHECKSUM_ALGORITHM_NONE) {
+ return(true);
+ }
- // post encryption checksum
- ib_uint32_t stored_post_encryption = mach_read_from_4(
- src_frame + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION + 4);
+ /* Read stored post encryption checksum. */
+ ib_uint32_t checksum = mach_read_from_4(
+ page + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION + 4);
- // save pre encryption checksum for restore in end of this function
- ib_uint32_t stored_pre_encryption = mach_read_from_4(
- src_frame + FIL_PAGE_SPACE_OR_CHKSUM);
+ /* Declare empty pages non-corrupted */
+ if (checksum == 0
+ && *reinterpret_cast<const ib_uint64_t*>(page + FIL_PAGE_LSN) == 0
+ && buf_page_is_zeroes(page, page_size)) {
+ return(true);
+ }
- ib_uint32_t checksum_field2 = mach_read_from_4(
- src_frame + UNIV_PAGE_SIZE - FIL_PAGE_END_LSN_OLD_CHKSUM);
+ /* Compressed and encrypted pages do not have checksum. Assume not
+ corrupted. Page verification happens after decompression in
+ buf_page_io_complete() using buf_page_is_corrupted(). */
+ if (mach_read_from_2(page+FIL_PAGE_TYPE) == FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED) {
+ return (true);
+ }
- /** prepare frame for usage of normal checksum routines */
- mach_write_to_4(const_cast<byte*>(src_frame) + FIL_PAGE_SPACE_OR_CHKSUM,
- stored_post_encryption);
+ /* Compressed pages use different checksum method. We first store
+ the post encryption checksum on checksum location and after function
+ restore the original. */
+ if (page_size.is_compressed()) {
+ ib_uint32_t old = static_cast<ib_uint32_t>(mach_read_from_4(
+ page + FIL_PAGE_SPACE_OR_CHKSUM));
- /* NOTE: this function is (currently) only run when restoring
- * dblwr-buffer, server is single threaded so it's safe to modify
- * srv_checksum_algorithm */
- srv_checksum_algorithm_t save_checksum_algorithm =
- (srv_checksum_algorithm_t)srv_checksum_algorithm;
+ mach_write_to_4(page + FIL_PAGE_SPACE_OR_CHKSUM, checksum);
- if (!page_size.is_compressed() &&
- (save_checksum_algorithm == SRV_CHECKSUM_ALGORITHM_STRICT_INNODB ||
- save_checksum_algorithm == SRV_CHECKSUM_ALGORITHM_INNODB)) {
- /* handle ALGORITHM_INNODB specially,
- * "downgrade" to ALGORITHM_INNODB and store BUF_NO_CHECKSUM_MAGIC
- * checksum_field2 is sort of pointless anyway...
- */
- srv_checksum_algorithm = SRV_CHECKSUM_ALGORITHM_INNODB;
- mach_write_to_4(const_cast<byte*>(src_frame) +
- UNIV_PAGE_SIZE - FIL_PAGE_END_LSN_OLD_CHKSUM,
- BUF_NO_CHECKSUM_MAGIC);
+ bool valid = page_zip_verify_checksum(page,
+ page_size.physical()
+#ifdef UNIV_INNOCHECKSUM
+ , offset,
+ strict_check,
+ log_file != NULL,
+ log_file
+#endif
+ );
+
+ mach_write_to_4(page + FIL_PAGE_SPACE_OR_CHKSUM, old);
+
+ return (valid);
}
- /* verify checksums */
- bool corrupted = buf_page_is_corrupted(false, src_frame,
- page_size, false
-#ifdef UNIV_INNOCHECKSUM
- ,page_no, strict_check, false, NULL
-#endif /* UNIV_INNOCHECKSUM */
- );
+ /* If stored checksum matches one of the calculated checksums
+ page is not corrupted. */
+
+ ib_uint32_t cchecksum1 = buf_calc_page_crc32(page);
+ ib_uint32_t cchecksum2 = (ib_uint32_t) buf_calc_page_new_checksum(
+ page);
+ bool encrypted = (checksum == cchecksum1 || checksum == cchecksum2
+ || checksum == BUF_NO_CHECKSUM_MAGIC);
+
+ /* MySQL 5.6 and MariaDB 10.0 and 10.1 will write an LSN to the
+ first page of each system tablespace file at
+ FIL_PAGE_FILE_FLUSH_LSN offset. On other pages and in other files,
+ the field might have been uninitialized until MySQL 5.5. In MySQL 5.7
+ (and MariaDB Server 10.2.2) WL#7990 stopped writing the field for other
+ than page 0 of the system tablespace.
- /** restore frame & algorithm */
- srv_checksum_algorithm = save_checksum_algorithm;
+ Starting from MariaDB 10.1 the field has been repurposed for
+ encryption key_version.
- mach_write_to_4(const_cast<byte*>(src_frame) +
- FIL_PAGE_SPACE_OR_CHKSUM,
- stored_pre_encryption);
+ Starting with MySQL 5.7 (and MariaDB Server 10.2), the
+ field has been repurposed for SPATIAL INDEX pages for
+ FIL_RTREE_SPLIT_SEQ_NUM.
- mach_write_to_4(const_cast<byte*>(src_frame) +
- UNIV_PAGE_SIZE - FIL_PAGE_END_LSN_OLD_CHKSUM,
- checksum_field2);
+ Note that FIL_PAGE_FILE_FLUSH_LSN is not included in the InnoDB page
+ checksum.
+
+ Thus, FIL_PAGE_FILE_FLUSH_LSN could contain any value. While the
+ field would usually be 0 for pages that are not encrypted, we cannot
+ assume that a nonzero value means that the page is encrypted.
+ Therefore we must validate the page both as encrypted and unencrypted
+ when FIL_PAGE_FILE_FLUSH_LSN does not contain 0.
+ */
+
+ ulint checksum1 = mach_read_from_4(
+ page + FIL_PAGE_SPACE_OR_CHKSUM);
+
+ ulint checksum2 = mach_read_from_4(
+ page + UNIV_PAGE_SIZE - FIL_PAGE_END_LSN_OLD_CHKSUM);
+
+#ifdef UNIV_INNOCHECKSUM
+# define CKARGS page, checksum1, checksum2, \
+ offset, log_file != NULL, log_file, algorithm
+#else
+# define CKARGS page, checksum1, checksum2
+#endif
+
+ bool valid = buf_page_is_checksum_valid_crc32(
+ CKARGS, false
+ /* FIXME: also try the original crc32 that was
+ buggy on big-endian architectures? */)
+ || buf_page_is_checksum_valid_innodb(CKARGS);
+#undef CKARGS
+
+ if (encrypted && valid) {
+ /* If page is encrypted and traditional checksums match,
+ page could be still encrypted, or not encrypted and valid or
+ corrupted. */
+#ifdef UNIV_INNOCHECKSUM
+ fprintf(log_file ? log_file : stderr,
+ "Page " ULINTPF ":" ULINTPF " may be corrupted."
+ " Post encryption checksum %u"
+ " stored [" ULINTPF ":" ULINTPF "] key_version %u\n",
+ space, offset, checksum, checksum1, checksum2,
+ key_version);
+#else /* UNIV_INNOCHECKSUM */
+ ib::error()
+ << " Page " << space << ":" << offset
+ << " may be corrupted."
+ " Post encryption checksum " << checksum
+ << " stored [" << checksum1 << ":" << checksum2
+ << "] key_version " << key_version;
+#endif
+ encrypted = false;
+ }
- return (!corrupted);
+ return(encrypted);
}
diff --git a/storage/innobase/fil/fil0fil.cc b/storage/innobase/fil/fil0fil.cc
index 9413a2b3cba..b38899e6de4 100644
--- a/storage/innobase/fil/fil0fil.cc
+++ b/storage/innobase/fil/fil0fil.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
-Copyright (c) 1995, 2016, Oracle and/or its affiliates.
-Copyright (c) 2013, 2017, MariaDB Corporation.
+Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
+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
@@ -153,7 +153,11 @@ fil_addr_t fil_addr_null = {FIL_NULL, 0};
/** The tablespace memory cache. This variable is NULL before the module is
initialized. */
-fil_system_t* fil_system = NULL;
+UNIV_INTERN fil_system_t* fil_system = NULL;
+
+/** At this age or older a space/page will be rotated */
+UNIV_INTERN extern uint srv_fil_crypt_rotate_key_age;
+UNIV_INTERN extern ib_mutex_t fil_crypt_threads_mutex;
/** Determine if user has explicitly disabled fsync(). */
# define fil_buffering_disabled(s) \
@@ -241,18 +245,12 @@ fil_node_prepare_for_io(
fil_system_t* system, /*!< in: tablespace memory cache */
fil_space_t* space); /*!< in: space */
-/**
-Updates the data structures when an i/o operation finishes. Updates the
-pending i/o's field in the node appropriately.
+/** Update the data structures when an i/o operation finishes.
@param[in,out] node file node
-@param[in,out] system tablespace instance
@param[in] type IO context */
static
void
-fil_node_complete_io(
- fil_node_t* node,
- fil_system_t* system,
- const IORequest& type);
+fil_node_complete_io(fil_node_t* node, const IORequest& type);
/** Reads data from a space to a buffer. Remember that the possible incomplete
blocks at the end of file are ignored: they are not taken into account when
@@ -654,6 +652,18 @@ retry:
page, FSP_FREE_LIMIT);
const ulint free_len = flst_get_len(
FSP_HEADER_OFFSET + FSP_FREE + page);
+
+ /* Try to read crypt_data from page 0 if it is not yet
+ read. FIXME: Remove page_0_crypt_read, and simply ensure in
+ fil_space_t object creation that node->size==0 if and only
+ if the crypt_data is not known and must be read. */
+ if (!space->page_0_crypt_read) {
+ space->page_0_crypt_read = true;
+ ut_ad(space->crypt_data == NULL);
+ space->crypt_data = fil_space_read_crypt_data(
+ page_size_t(space->flags), page);
+ }
+
ut_free(buf2);
os_file_close(node->handle);
@@ -993,61 +1003,6 @@ skip_flush:
space->n_pending_flushes--;
}
-/**
-Fill the pages with NULs
-@param[in] node File node
-@param[in] page_size physical page size
-@param[in] start Offset from the start of the file in bytes
-@param[in] len Length in bytes
-@param[in] read_only_mode
- if true, then read only mode checks are enforced.
-@return DB_SUCCESS or error code */
-static
-dberr_t
-fil_write_zeros(
- const fil_node_t* node,
- ulint page_size,
- os_offset_t start,
- ulint len,
- bool read_only_mode)
-{
- ut_a(len > 0);
-
- /* Extend at most 1M at a time */
- ulint n_bytes = ut_min(static_cast<ulint>(1024 * 1024), len);
- byte* ptr = reinterpret_cast<byte*>(ut_zalloc_nokey(n_bytes
- + page_size));
- byte* buf = reinterpret_cast<byte*>(ut_align(ptr, page_size));
-
- os_offset_t offset = start;
- dberr_t err = DB_SUCCESS;
- const os_offset_t end = start + len;
- IORequest request(IORequest::WRITE);
-
- while (offset < end) {
- err = os_aio(
- request, OS_AIO_SYNC, node->name,
- node->handle, buf, offset, n_bytes, read_only_mode,
- NULL, NULL);
-
- if (err != DB_SUCCESS) {
- break;
- }
-
- offset += n_bytes;
-
- n_bytes = ut_min(n_bytes, static_cast<ulint>(end - offset));
-
- DBUG_EXECUTE_IF("ib_crash_during_tablespace_extension",
- DBUG_SUICIDE(););
- }
-
- ut_free(ptr);
-
- return(err);
-}
-
-
/** Try to extend a tablespace.
@param[in,out] space tablespace to be extended
@param[in,out] node last file of the tablespace
@@ -1098,79 +1053,177 @@ fil_space_extend_must_retry(
ut_ad(size > space->size);
- ulint pages_added = size - space->size;
+ ulint last_page_no = space->size;
+ const ulint file_start_page_no = last_page_no - node->size;
+
+ /* Determine correct file block size */
+ if (node->block_size == 0) {
+ node->block_size = os_file_get_block_size(
+ node->handle, node->name);
+ }
+
const page_size_t pageSize(space->flags);
const ulint page_size = pageSize.physical();
- os_offset_t start = os_file_get_size(node->handle);
- ut_a(start != (os_offset_t) -1);
- start &= ~(page_size - 1);
- const os_offset_t end
- = (node->size + pages_added) * page_size;
+#ifdef _WIN32
+ /* Logically or physically extend the file with zero bytes,
+ depending on whether it is sparse. */
- *success = end <= start;
+ /* FIXME: Call DeviceIoControl(node->handle, FSCTL_SET_SPARSE, ...)
+ when opening a file when FSP_FLAGS_HAS_PAGE_COMPRESSION(). */
+ {
+ FILE_END_OF_FILE_INFO feof;
+ /* fil_read_first_page() expects UNIV_PAGE_SIZE bytes.
+ fil_node_open_file() expects at least 4 * UNIV_PAGE_SIZE bytes.
+ Do not shrink short ROW_FORMAT=COMPRESSED files. */
+ feof.EndOfFile.QuadPart = std::max(
+ os_offset_t(size - file_start_page_no) * page_size,
+ os_offset_t(FIL_IBD_FILE_INITIAL_SIZE
+ * UNIV_PAGE_SIZE));
+ *success = SetFileInformationByHandle(node->handle,
+ FileEndOfFileInfo,
+ &feof, sizeof feof);
+ if (!*success) {
+ ib::error() << "extending file '" << node->name
+ << "' from "
+ << os_offset_t(node->size) * page_size
+ << " to " << feof.EndOfFile.QuadPart
+ << " bytes failed with " << GetLastError();
+ } else {
+ last_page_no = size;
+ }
+ }
+#else
+ /* We will logically extend the file with ftruncate() if
+ page_compression is enabled, because the file is expected to
+ be sparse in that case. Make sure that ftruncate() can deal
+ with large files. */
+ const bool is_sparse = sizeof(off_t) >= 8
+ && FSP_FLAGS_HAS_PAGE_COMPRESSION(space->flags);
+
+ if (is_sparse) {
+ /* fil_read_first_page() expects UNIV_PAGE_SIZE bytes.
+ fil_node_open_file() expects at least 4 * UNIV_PAGE_SIZE bytes.
+ Do not shrink short ROW_FORMAT=COMPRESSED files. */
+ off_t s = std::max(off_t(size - file_start_page_no)
+ * off_t(page_size),
+ off_t(FIL_IBD_FILE_INITIAL_SIZE
+ * UNIV_PAGE_SIZE));
+ *success = !ftruncate(node->handle, s);
+ if (!*success) {
+ ib::error() << "ftruncate of file '" << node->name
+ << "' from "
+ << os_offset_t(last_page_no
+ - file_start_page_no)
+ * page_size << " to " << os_offset_t(s)
+ << " bytes failed with " << errno;
+ } else {
+ last_page_no = size;
+ }
+ } else {
+ const os_offset_t start_offset
+ = os_offset_t(last_page_no - file_start_page_no)
+ * page_size;
+ const ulint n_pages = size - last_page_no;
+ const os_offset_t len = os_offset_t(n_pages) * page_size;
+# ifdef HAVE_POSIX_FALLOCATE
+ int err;
+ do {
+ err = posix_fallocate(node->handle, start_offset, len);
+ } while (err == EINTR
+ && srv_shutdown_state == SRV_SHUTDOWN_NONE);
+
+ if (err != EINVAL) {
+
+ *success = !err;
+ if (!*success) {
+ ib::error() << "extending file '" << node->name
+ << "' from "
+ << start_offset
+ << " to " << len + start_offset
+ << " bytes failed with: " << err;
+ }
+ } else
+# endif /* HAVE_POSIX_FALLOCATE */
+ {
+ /* Extend at most 1 megabyte pages at a time */
+ ulint n_bytes = std::min(ulint(1) << 20, n_pages)
+ * page_size;
+ byte* buf2 = static_cast<byte*>(
+ calloc(1, n_bytes + page_size));
+ *success = buf2 != NULL;
+ if (!buf2) {
+ ib::error() << "Cannot allocate "
+ << n_bytes + page_size
+ << " bytes to extend file";
+ }
+ byte* const buf = static_cast<byte*>(
+ ut_align(buf2, page_size));
+ IORequest request(IORequest::WRITE);
- if (!*success) {
- DBUG_EXECUTE_IF("ib_crash_during_tablespace_extension",
- DBUG_SUICIDE(););
-#ifdef HAVE_POSIX_FALLOCATE
- /* On Linux, FusionIO atomic writes cannot extend
- files, so we must use posix_fallocate(). */
- int ret = posix_fallocate(node->handle, start,
- end - start);
-
- /* EINVAL means that fallocate() is not supported.
- One known case is Linux ext3 file system with O_DIRECT. */
- if (ret == 0) {
- } else if (ret != EINVAL) {
- ib::error()
- << "posix_fallocate(): Failed to preallocate"
- " data for file "
- << node->name << ", desired size "
- << end << " bytes."
- " Operating system error number "
- << ret << ". Check"
- " that the disk is not full or a disk quota"
- " exceeded. Some operating system error"
- " numbers are described at " REFMAN
- "operating-system-error-codes.html";
- } else
-#endif
- if (DB_SUCCESS != fil_write_zeros(
- node, page_size, start,
- static_cast<ulint>(end - start),
- space->purpose == FIL_TYPE_TEMPORARY
- && srv_read_only_mode)) {
- ib::warn()
- << "Error while writing " << end - start
- << " zeroes to " << node->name
- << " starting at offset " << start;
- }
+ os_offset_t offset = start_offset;
+ const os_offset_t end = start_offset + len;
+ const bool read_only_mode = space->purpose
+ == FIL_TYPE_TEMPORARY && srv_read_only_mode;
- /* Check how many pages actually added */
- os_offset_t actual_end = os_file_get_size(node->handle);
- ut_a(actual_end != static_cast<os_offset_t>(-1));
- ut_a(actual_end >= start);
+ while (*success && offset < end) {
+ dberr_t err = os_aio(
+ request, OS_AIO_SYNC, node->name,
+ node->handle, buf, offset, n_bytes,
+ read_only_mode, NULL, NULL);
- *success = end >= actual_end;
- pages_added = static_cast<ulint>(
- (std::min(actual_end, end) - start) / page_size);
- }
+ if (err != DB_SUCCESS) {
+ *success = false;
+ ib::error() << "writing zeroes to file '"
+ << node->name << "' from "
+ << offset << " to " << offset + n_bytes
+ << " bytes failed with: "
+ << ut_strerr(err);
+ break;
+ }
- os_has_said_disk_full = !*success;
+ offset += n_bytes;
- mutex_enter(&fil_system->mutex);
+ n_bytes = std::min(n_bytes,
+ static_cast<ulint>(end - offset));
+ }
- space->size += pages_added;
+ free(buf2);
+ }
+
+ os_has_said_disk_full = *success;
+ if (*success) {
+ last_page_no = size;
+ } else {
+ /* Let us measure the size of the file
+ to determine how much we were able to
+ extend it */
+ os_offset_t fsize = os_file_get_size(node->handle);
+ ut_a(fsize != os_offset_t(-1));
+
+ last_page_no = ulint(fsize / page_size)
+ + file_start_page_no;
+ }
+ }
+#endif
+ mutex_enter(&fil_system->mutex);
ut_a(node->being_extended);
node->being_extended = false;
- node->size += pages_added;
+ ut_a(last_page_no - file_start_page_no >= node->size);
+
+ ulint file_size = last_page_no - file_start_page_no;
+ space->size += file_size - node->size;
+ node->size = file_size;
const ulint pages_in_MiB = node->size
& ~((1 << (20 - UNIV_PAGE_SIZE_SHIFT)) - 1);
- fil_node_complete_io(node, fil_system, IORequestWrite);
+ fil_node_complete_io(node,
+#ifndef _WIN32
+ !is_sparse ? IORequestWrite :
+#endif /* _WIN32 */
+ IORequestRead);
/* Keep the last data file size info up to date, rounded to
full megabytes */
@@ -1423,6 +1476,12 @@ fil_space_detach(
UT_LIST_REMOVE(fil_system->unflushed_spaces, space);
}
+ if (space->is_in_rotation_list) {
+ space->is_in_rotation_list = false;
+
+ UT_LIST_REMOVE(fil_system->rotation_list, space);
+ }
+
UT_LIST_REMOVE(fil_system->space_list, space);
ut_a(space->magic_n == FIL_SPACE_MAGIC_N);
@@ -1518,22 +1577,25 @@ fil_space_free(
}
/** Create a space memory object and put it to the fil_system hash table.
-The tablespace name is independent from the tablespace file-name.
Error messages are issued to the server log.
-@param[in] name Tablespace name
-@param[in] id Tablespace identifier
-@param[in] flags Tablespace flags
-@param[in] purpose Tablespace purpose
+@param[in] name tablespace name
+@param[in] id tablespace identifier
+@param[in] flags tablespace flags
+@param[in] purpose tablespace purpose
+@param[in,out] crypt_data encryption information
+@param[in] create_table whether this is CREATE TABLE
+@param[in] mode encryption mode
@return pointer to created tablespace, to be filled in with fil_node_create()
@retval NULL on failure (such as when the same tablespace exists) */
fil_space_t*
fil_space_create(
- const char* name,
- ulint id,
- ulint flags,
- fil_type_t purpose,
- fil_space_crypt_t* crypt_data, /*!< in: crypt data */
- bool create_table) /*!< in: true if create table */
+ const char* name,
+ ulint id,
+ ulint flags,
+ fil_type_t purpose,
+ fil_space_crypt_t* crypt_data,
+ bool create_table,
+ fil_encryption_t mode)
{
fil_space_t* space;
@@ -1595,7 +1657,6 @@ fil_space_create(
space->flags = flags;
space->magic_n = FIL_SPACE_MAGIC_N;
-
space->crypt_data = crypt_data;
/* In create table we write page 0 so we have already
@@ -1635,7 +1696,23 @@ fil_space_create(
fil_system->max_assigned_id = id;
}
- mutex_exit(&fil_system->mutex);
+ /* Inform key rotation that there could be something
+ to do */
+ if (purpose == FIL_TYPE_TABLESPACE
+ && !srv_fil_crypt_rotate_key_age && fil_crypt_threads_event &&
+ (mode == FIL_ENCRYPTION_ON || mode == FIL_ENCRYPTION_OFF ||
+ srv_encrypt_tables)) {
+ /* Key rotation is not enabled, need to inform background
+ encryption threads. */
+ UT_LIST_ADD_LAST(fil_system->rotation_list, space);
+ space->is_in_rotation_list = true;
+ mutex_exit(&fil_system->mutex);
+ mutex_enter(&fil_crypt_threads_mutex);
+ os_event_set(fil_crypt_threads_event);
+ mutex_exit(&fil_crypt_threads_mutex);
+ } else {
+ mutex_exit(&fil_system->mutex);
+ }
return(space);
}
@@ -1750,7 +1827,7 @@ fil_space_get_space(
return(NULL);
}
- fil_node_complete_io(node, fil_system, IORequestRead);
+ fil_node_complete_io(node, IORequestRead);
}
return(space);
@@ -1972,6 +2049,7 @@ fil_init(
UT_LIST_INIT(fil_system->LRU, &fil_node_t::LRU);
UT_LIST_INIT(fil_system->space_list, &fil_space_t::space_list);
+ UT_LIST_INIT(fil_system->rotation_list, &fil_space_t::rotation_list);
UT_LIST_INIT(fil_system->unflushed_spaces,
&fil_space_t::unflushed_spaces);
UT_LIST_INIT(fil_system->named_spaces, &fil_space_t::named_spaces);
@@ -2546,9 +2624,7 @@ fil_recreate_tablespace(
page_zip.m_start =
#endif /* UNIV_DEBUG */
page_zip.m_end = page_zip.m_nonempty = page_zip.n_blobs = 0;
- buf_flush_init_for_writing(
- NULL, page, &page_zip, 0,
- fsp_is_checksum_disabled(space_id));
+ buf_flush_init_for_writing(NULL, page, &page_zip, 0);
err = fil_write(page_id_t(space_id, 0), page_size, 0,
page_size.physical(), page_zip.data);
@@ -2611,7 +2687,7 @@ fil_recreate_tablespace(
ut_ad(!page_size.is_compressed());
buf_flush_init_for_writing(
- block, page, NULL, recv_lsn, false);
+ block, page, NULL, recv_lsn);
err = fil_write(cur_page_id, page_size, 0,
page_size.physical(), page);
@@ -2625,8 +2701,7 @@ fil_recreate_tablespace(
buf_block_get_page_zip(block);
buf_flush_init_for_writing(
- block, page, page_zip, recv_lsn,
- fsp_is_checksum_disabled(space_id));
+ block, page, page_zip, recv_lsn);
err = fil_write(cur_page_id, page_size, 0,
page_size.physical(),
@@ -2854,16 +2929,22 @@ fil_check_pending_operations(
mutex_enter(&fil_system->mutex);
fil_space_t* sp = fil_space_get_by_id(id);
+
if (sp) {
sp->stop_new_ops = true;
+ if (sp->crypt_data) {
+ sp->n_pending_ops++;
+ mutex_exit(&fil_system->mutex);
+ fil_space_crypt_close_tablespace(sp);
+ mutex_enter(&fil_system->mutex);
+ ut_ad(sp->n_pending_ops > 0);
+ sp->n_pending_ops--;
+ }
}
- mutex_exit(&fil_system->mutex);
/* Check for pending operations. */
do {
- mutex_enter(&fil_system->mutex);
-
sp = fil_space_get_by_id(id);
count = fil_check_pending_ops(sp, count);
@@ -2874,15 +2955,14 @@ fil_check_pending_operations(
os_thread_sleep(20000);
}
+ mutex_enter(&fil_system->mutex);
} while (count > 0);
/* Check for pending IO. */
*path = 0;
- do {
- mutex_enter(&fil_system->mutex);
-
+ for (;;) {
sp = fil_space_get_by_id(id);
if (sp == NULL) {
@@ -2900,11 +2980,13 @@ fil_check_pending_operations(
mutex_exit(&fil_system->mutex);
- if (count > 0) {
- os_thread_sleep(20000);
+ if (count == 0) {
+ break;
}
- } while (count > 0);
+ os_thread_sleep(20000);
+ mutex_enter(&fil_system->mutex);
+ }
ut_ad(sp);
@@ -3801,9 +3883,7 @@ fil_ibd_create(
if (!page_size.is_compressed()) {
- buf_flush_init_for_writing(
- NULL, page, NULL, 0,
- fsp_is_checksum_disabled(space_id));
+ buf_flush_init_for_writing(NULL, page, NULL, 0);
err = os_file_write(
request, path, file, page, 0, page_size.physical());
@@ -3817,9 +3897,7 @@ fil_ibd_create(
page_zip.m_end = page_zip.m_nonempty =
page_zip.n_blobs = 0;
- buf_flush_init_for_writing(
- NULL, page, &page_zip, 0,
- fsp_is_checksum_disabled(space_id));
+ buf_flush_init_for_writing(NULL, page, &page_zip, 0);
err = os_file_write(
request, path, file, page_zip.data, 0,
@@ -3863,13 +3941,13 @@ fil_ibd_create(
/* Create crypt data if the tablespace is either encrypted or user has
requested it to remain unencrypted. */
- if (mode == FIL_SPACE_ENCRYPTION_ON || mode == FIL_SPACE_ENCRYPTION_OFF ||
+ if (mode == FIL_ENCRYPTION_ON || mode == FIL_ENCRYPTION_OFF ||
srv_encrypt_tables) {
crypt_data = fil_space_create_crypt_data(mode, key_id);
}
space = fil_space_create(name, space_id, flags, FIL_TYPE_TABLESPACE,
- crypt_data, true);
+ crypt_data, true, mode);
fil_node_t* node = NULL;
@@ -4957,19 +5035,14 @@ fil_node_prepare_for_io(
return(true);
}
-/********************************************************************//**
-Updates the data structures when an i/o operation finishes. Updates the
-pending i/o's field in the node appropriately. */
+/** Update the data structures when an i/o operation finishes.
+@param[in,out] node file node
+@param[in] type IO context */
static
void
-fil_node_complete_io(
-/*=================*/
- fil_node_t* node, /*!< in: file node */
- fil_system_t* system, /*!< in: tablespace memory cache */
- const IORequest&type) /*!< in: IO_TYPE_*, marks the node as
- modified if TYPE_IS_WRITE() */
+fil_node_complete_io(fil_node_t* node, const IORequest& type)
{
- ut_ad(mutex_own(&system->mutex));
+ ut_ad(mutex_own(&fil_system->mutex));
ut_a(node->n_pending > 0);
--node->n_pending;
@@ -4981,9 +5054,9 @@ fil_node_complete_io(
ut_ad(!srv_read_only_mode
|| fsp_is_system_temporary(node->space->id));
- ++system->modification_counter;
+ ++fil_system->modification_counter;
- node->modification_counter = system->modification_counter;
+ node->modification_counter = fil_system->modification_counter;
if (fil_buffering_disabled(node->space)) {
@@ -4998,14 +5071,14 @@ fil_node_complete_io(
node->space->is_in_unflushed_spaces = true;
UT_LIST_ADD_FIRST(
- system->unflushed_spaces, node->space);
+ fil_system->unflushed_spaces, node->space);
}
}
if (node->n_pending == 0 && fil_space_belongs_in_lru(node->space)) {
/* The node must be put back to the LRU list */
- UT_LIST_ADD_FIRST(system->LRU, node);
+ UT_LIST_ADD_FIRST(fil_system->LRU, node);
}
}
@@ -5247,7 +5320,7 @@ fil_io(
/* If we can tolerate the non-existent pages, we
should return with DB_ERROR and let caller decide
what to do. */
- fil_node_complete_io(node, fil_system, req_type);
+ fil_node_complete_io(node, req_type);
mutex_exit(&fil_system->mutex);
return(DB_ERROR);
}
@@ -5320,7 +5393,7 @@ fil_io(
mutex_enter(&fil_system->mutex);
- fil_node_complete_io(node, fil_system, req_type);
+ fil_node_complete_io(node, req_type);
mutex_exit(&fil_system->mutex);
@@ -5360,7 +5433,7 @@ fil_aio_wait(
mutex_enter(&fil_system->mutex);
- fil_node_complete_io(node, fil_system, type);
+ fil_node_complete_io(node, type);
mutex_exit(&fil_system->mutex);
@@ -5793,7 +5866,8 @@ fil_iterate(
|| page_type == FIL_PAGE_PAGE_COMPRESSED);
/* If tablespace is encrypted, we need to decrypt
- the page. */
+ the page. Note that tablespaces are not in
+ fil_system during import. */
if (encrypted) {
decrypted = fil_space_decrypt(
iter.crypt_data,
@@ -6070,9 +6144,7 @@ fil_tablespace_iterate(
/* read (optional) crypt data */
iter.crypt_data = fil_space_read_crypt_data(
- 0, page, FSP_HEADER_OFFSET
- + fsp_header_get_encryption_offset(
- callback.get_page_size()));
+ callback.get_page_size(), page);
if (err == DB_SUCCESS) {
@@ -6107,10 +6179,12 @@ fil_tablespace_iterate(
err = fil_iterate(iter, block, callback);
+ if (iter.crypt_data) {
+ fil_space_destroy_crypt_data(&iter.crypt_data);
+ }
+
ut_free(io_buffer);
ut_free(crypt_io_buffer);
-
- fil_space_destroy_crypt_data(&iter.crypt_data);
}
}
@@ -6618,269 +6692,138 @@ fil_space_t::release_free_extents(ulint n_reserved)
n_reserved_extents -= n_reserved;
}
-/******************************************************************
-Get crypt data for a tablespace */
-UNIV_INTERN
-fil_space_crypt_t*
-fil_space_get_crypt_data(
-/*=====================*/
- ulint id) /*!< in: space id */
+/** Return the next fil_space_t.
+Once started, the caller must keep calling this until it returns NULL.
+fil_space_acquire() and fil_space_release() are invoked here which
+blocks a concurrent operation from dropping the tablespace.
+@param[in] prev_space Pointer to the previous fil_space_t.
+If NULL, use the first fil_space_t on fil_system->space_list.
+@return pointer to the next fil_space_t.
+@retval NULL if this was the last*/
+fil_space_t*
+fil_space_next(
+ fil_space_t* prev_space)
{
- fil_space_t* space;
- fil_space_crypt_t* crypt_data = NULL;
-
- ut_ad(fil_system);
+ fil_space_t* space=prev_space;
mutex_enter(&fil_system->mutex);
- space = fil_space_get_by_id(id);
+ if (prev_space == NULL) {
+ space = UT_LIST_GET_FIRST(fil_system->space_list);
- mutex_exit(&fil_system->mutex);
+ /* We can trust that space is not NULL because at least the
+ system tablespace is always present and loaded first. */
+ space->n_pending_ops++;
+ } else {
+ ut_ad(space->n_pending_ops > 0);
- if (space != NULL) {
- /* If we have not yet read the page0
- of this tablespace we will do it now. */
- if (!space->crypt_data && !space->page_0_crypt_read) {
- ulint space_id = space->id;
- fil_node_t* node;
-
- ut_a(space->crypt_data == NULL);
- node = UT_LIST_GET_FIRST(space->chain);
-
- byte *buf = static_cast<byte*>(ut_malloc(2 * UNIV_PAGE_SIZE, PSI_INSTRUMENT_ME));
- 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 offset = FSP_HEADER_OFFSET
- + fsp_header_get_encryption_offset(
- page_size_t(space->flags));
- space->crypt_data = fil_space_read_crypt_data(space_id, page, offset);
- ut_free(buf);
-
- DBUG_LOG("crypt",
- "Read page 0 from"
- << " tablespace " << space_id
- << " name " << space->name
- << " key_id " << (space->crypt_data
- ? space->crypt_data->key_id
- : 0)
- << " encryption "
- << (space->crypt_data
- ? space->crypt_data->encryption : 0)
- << " handle " << node->handle);
-
- ut_a(space->id == space_id);
+ /* Move on to the next fil_space_t */
+ space->n_pending_ops--;
+ space = UT_LIST_GET_NEXT(space_list, space);
- space->page_0_crypt_read = true;
+ /* Skip spaces that are being created by
+ fil_ibd_create(), or dropped, or !tablespace. */
+ while (space != NULL
+ && (UT_LIST_GET_LEN(space->chain) == 0
+ || space->stop_new_ops
+ || space->purpose != FIL_TYPE_TABLESPACE)) {
+ space = UT_LIST_GET_NEXT(space_list, space);
}
- crypt_data = space->crypt_data;
-
- if (!space->page_0_crypt_read) {
- ib::warn() << "Space " << space->id << " name "
- << space->name << " contains encryption "
- << (space->crypt_data ? space->crypt_data->encryption : 0)
- << " information for key_id "
- << (space->crypt_data ? space->crypt_data->key_id : 0)
- << " but page0 is not read.";
+ if (space != NULL) {
+ space->n_pending_ops++;
}
}
- return(crypt_data);
-}
-
-/*******************************************************************//**
-Increments the count of pending operation, if space is not being deleted.
-@return TRUE if being deleted, and operation should be skipped */
-UNIV_INTERN
-ibool
-fil_inc_pending_ops(
-/*================*/
- ulint id, /*!< in: space id */
- ibool print_err) /*!< in: need to print error or not */
-{
- fil_space_t* space;
-
- mutex_enter(&fil_system->mutex);
-
- space = fil_space_get_by_id(id);
-
- if (space == NULL) {
- if (print_err) {
- fprintf(stderr,
- "InnoDB: Error: trying to do an operation on a"
- " dropped tablespace %lu\n",
- (ulong) id);
- }
- }
-
- if (space == NULL || space->stop_new_ops) {
- mutex_exit(&fil_system->mutex);
-
- return(TRUE);
- }
-
- space->n_pending_ops++;
-
mutex_exit(&fil_system->mutex);
- return(FALSE);
+ return(space);
}
-/*******************************************************************//**
-Decrements the count of pending operations. */
-UNIV_INTERN
+/**
+Remove space from key rotation list if there are no more
+pending operations.
+@param[in,out] space Tablespace */
+static
void
-fil_decr_pending_ops(
-/*=================*/
- ulint id) /*!< in: space id */
+fil_space_remove_from_keyrotation(fil_space_t* space)
{
- fil_space_t* space;
-
- mutex_enter(&fil_system->mutex);
-
- space = fil_space_get_by_id(id);
-
- if (space == NULL) {
- fprintf(stderr,
- "InnoDB: Error: decrementing pending operation"
- " of a dropped tablespace %lu\n",
- (ulong) id);
- }
+ ut_ad(mutex_own(&fil_system->mutex));
+ ut_ad(space);
- if (space != NULL) {
- space->n_pending_ops--;
+ if (space->n_pending_ops == 0 && space->is_in_rotation_list) {
+ space->is_in_rotation_list = false;
+ ut_a(UT_LIST_GET_LEN(fil_system->rotation_list) > 0);
+ UT_LIST_REMOVE(fil_system->rotation_list, space);
}
-
- mutex_exit(&fil_system->mutex);
}
-/******************************************************************
-Set crypt data for a tablespace */
-UNIV_INTERN
-fil_space_crypt_t*
-fil_space_set_crypt_data(
-/*=====================*/
- ulint id, /*!< in: space id */
- fil_space_crypt_t* crypt_data) /*!< in: crypt data */
-{
- fil_space_t* space;
- fil_space_crypt_t* free_crypt_data = NULL;
- fil_space_crypt_t* ret_crypt_data = NULL;
- ut_ad(fil_system);
+/** Return the next fil_space_t from key rotation list.
+Once started, the caller must keep calling this until it returns NULL.
+fil_space_acquire() and fil_space_release() are invoked here which
+blocks a concurrent operation from dropping the tablespace.
+@param[in] prev_space Pointer to the previous fil_space_t.
+If NULL, use the first fil_space_t on fil_system->space_list.
+@return pointer to the next fil_space_t.
+@retval NULL if this was the last*/
+fil_space_t*
+fil_space_keyrotate_next(
+ fil_space_t* prev_space)
+{
+ fil_space_t* space = prev_space;
+ fil_space_t* old = NULL;
mutex_enter(&fil_system->mutex);
- space = fil_space_get_by_id(id);
-
- if (space != NULL) {
- if (space->crypt_data != NULL) {
- /* Here we need to release fil_system mutex to
- avoid mutex deadlock assertion. Here we would
- taje mutexes in order fil_system, crypt_data and
- in fil_crypt_start_encrypting_space we would
- take them in order crypt_data, fil_system
- at fil_space_get_flags -> fil_space_get_space */
- mutex_exit(&fil_system->mutex);
- fil_space_merge_crypt_data(space->crypt_data,
- crypt_data);
- ret_crypt_data = space->crypt_data;
- free_crypt_data = crypt_data;
- } else {
- space->crypt_data = crypt_data;
- ret_crypt_data = space->crypt_data;
- mutex_exit(&fil_system->mutex);
+ if (UT_LIST_GET_LEN(fil_system->rotation_list) == 0) {
+ if (space) {
+ ut_ad(space->n_pending_ops > 0);
+ space->n_pending_ops--;
+ fil_space_remove_from_keyrotation(space);
}
- } else {
- /* there is a small risk that tablespace has been deleted */
- free_crypt_data = crypt_data;
mutex_exit(&fil_system->mutex);
+ return(NULL);
}
- if (free_crypt_data != NULL) {
- /* there was already crypt data present and the new crypt
- * data provided as argument to this function has been merged
- * into that => free new crypt data
- */
- fil_space_destroy_crypt_data(&free_crypt_data);
- }
-
- return ret_crypt_data;
-}
+ if (prev_space == NULL) {
+ space = UT_LIST_GET_FIRST(fil_system->rotation_list);
-/******************************************************************
-Get id of first tablespace that has node or ULINT_UNDEFINED if none */
-UNIV_INTERN
-ulint
-fil_get_first_space_safe()
-/*======================*/
-{
- ulint out_id = ULINT_UNDEFINED;
- fil_space_t* space;
+ /* We can trust that space is not NULL because we
+ checked list length above */
+ } else {
+ ut_ad(space->n_pending_ops > 0);
- mutex_enter(&fil_system->mutex);
+ /* Move on to the next fil_space_t */
+ space->n_pending_ops--;
- space = UT_LIST_GET_FIRST(fil_system->space_list);
- if (space != NULL) {
- do
- {
- if (!space->stop_new_ops && UT_LIST_GET_LEN(space->chain) > 0) {
- out_id = space->id;
- break;
- }
+ old = space;
+ space = UT_LIST_GET_NEXT(rotation_list, space);
- space = UT_LIST_GET_NEXT(space_list, space);
- } while (space != NULL);
+ fil_space_remove_from_keyrotation(old);
}
- mutex_exit(&fil_system->mutex);
-
- return out_id;
-}
-
-/******************************************************************
-Get id of next tablespace that has node or ULINT_UNDEFINED if none */
-UNIV_INTERN
-ulint
-fil_get_next_space_safe(
-/*====================*/
- ulint id) /*!< in: previous space id */
-{
- bool found;
- fil_space_t* space;
- ulint out_id = ULINT_UNDEFINED;
-
- mutex_enter(&fil_system->mutex);
+ /* Skip spaces that are being created by fil_ibd_create(),
+ or dropped or truncated. Note that rotation_list contains only
+ space->purpose == FIL_TYPE_TABLESPACE. */
+ while (space != NULL
+ && (UT_LIST_GET_LEN(space->chain) == 0
+ || space->is_stopping())) {
- space = fil_space_get_by_id(id);
- if (space == NULL) {
- /* we didn't find it...search for space with space->id > id */
- found = false;
- space = UT_LIST_GET_FIRST(fil_system->space_list);
- } else {
- /* we found it, take next available space */
- found = true;
+ old = space;
+ space = UT_LIST_GET_NEXT(rotation_list, space);
+ fil_space_remove_from_keyrotation(old);
}
- while ((space = UT_LIST_GET_NEXT(space_list, space)) != NULL) {
-
- if (!found && space->id <= id)
- continue;
-
- if (!space->stop_new_ops) {
- /* inc reference to prevent drop */
- out_id = space->id;
- break;
- }
+ if (space != NULL) {
+ space->n_pending_ops++;
}
mutex_exit(&fil_system->mutex);
- return out_id;
+ return(space);
}
-
/********************************************************************//**
Find correct node from file space
@return node */
@@ -6981,26 +6924,6 @@ fil_space_found_by_id(
return space;
}
-/****************************************************************//**
-Acquire fil_system mutex */
-void
-fil_system_enter(void)
-/*==================*/
-{
- ut_ad(!mutex_own(&fil_system->mutex));
- mutex_enter(&fil_system->mutex);
-}
-
-/****************************************************************//**
-Release fil_system mutex */
-void
-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
diff --git a/storage/innobase/fil/fil0pagecompress.cc b/storage/innobase/fil/fil0pagecompress.cc
index 1eb9ec37f5d..39a02aa40df 100644
--- a/storage/innobase/fil/fil0pagecompress.cc
+++ b/storage/innobase/fil/fil0pagecompress.cc
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (C) 2013, 2017, 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
@@ -309,9 +309,8 @@ fil_compress_page(
fil_decompress_page(uncomp_page, comp_page, len, NULL);
- if(buf_page_is_corrupted(false, uncomp_page, page_size, false)) {
- buf_page_print(uncomp_page, page_size, BUF_PAGE_PRINT_NO_CRASH);
- ut_error;
+ if (buf_page_is_corrupted(false, uncomp_page, page_size, space)) {
+ buf_page_print(uncomp_page, page_size, 0);
}
ut_free(comp_page);
@@ -657,7 +656,5 @@ err_exit:
<< " compression method: "
<< fil_get_compression_alg_name(compression_alg) << ".";
- buf_page_print(buf, page_size, BUF_PAGE_PRINT_NO_CRASH);
-
- ut_error;
+ buf_page_print(buf, page_size, 0);
}
diff --git a/storage/innobase/fsp/fsp0file.cc b/storage/innobase/fsp/fsp0file.cc
index 74c153a65d5..b8ad49a254f 100644
--- a/storage/innobase/fsp/fsp0file.cc
+++ b/storage/innobase/fsp/fsp0file.cc
@@ -372,9 +372,7 @@ Datafile::read_first_page(bool read_only_mode)
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(ps));
+ m_crypt_info = fil_space_read_crypt_data(ps, m_first_page);
return(err);
}
@@ -574,9 +572,7 @@ Datafile::validate_first_page(lsn_t* flush_lsn)
/* The space_id can be most anything, except -1. */
error_txt = "A bad Space ID was found";
- } else if (buf_page_is_corrupted(
- false, m_first_page, page_size,
- fsp_is_checksum_disabled(m_space_id))) {
+ } else if (buf_page_is_corrupted(false, m_first_page, page_size)) {
/* Look for checksum and other corruptions. */
error_txt = "Checksum mismatch";
@@ -701,7 +697,7 @@ Datafile::find_space_id()
equal to univ_page_size.physical(). */
if (page_size == univ_page_size.physical()) {
noncompressed_ok = !buf_page_is_corrupted(
- false, page, univ_page_size, false);
+ false, page, univ_page_size, NULL);
}
bool compressed_ok = false;
@@ -721,7 +717,7 @@ Datafile::find_space_id()
true);
compressed_ok = !buf_page_is_corrupted(
- false, page, compr_page_size, false);
+ false, page, compr_page_size, NULL);
}
if (noncompressed_ok || compressed_ok) {
diff --git a/storage/innobase/fsp/fsp0fsp.cc b/storage/innobase/fsp/fsp0fsp.cc
index d37e3348820..57b6c8de825 100644
--- a/storage/innobase/fsp/fsp0fsp.cc
+++ b/storage/innobase/fsp/fsp0fsp.cc
@@ -176,16 +176,6 @@ fsp_get_space_header(
return(header);
}
-/** Check if checksum is disabled for the given space.
-@param[in] space_id tablespace ID
-@return true if checksum is disabled for given space. */
-bool
-fsp_is_checksum_disabled(
- ulint space_id)
-{
- return(fsp_is_system_temporary(space_id));
-}
-
#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
@@ -770,11 +760,9 @@ fsp_header_init(
}
}
- ulint offset = FSP_HEADER_OFFSET
- + fsp_header_get_encryption_offset(page_size);
- fil_space_write_crypt_data(space_id, page, offset,
- page_size.logical()
- - offset - FIL_PAGE_DATA_END, mtr);
+ if (space->crypt_data) {
+ space->crypt_data->write_page0(space, page, mtr);
+ }
return(true);
}
@@ -1065,8 +1053,6 @@ fsp_fill_free_list(
ulint frag_n_used;
ulint i;
- ut_ad(header != NULL);
- ut_ad(mtr != NULL);
ut_ad(page_offset(header) == FSP_HEADER_OFFSET);
ut_d(fsp_space_modify_check(space, mtr));
@@ -1379,7 +1365,7 @@ initialized (may be the same as mtr)
@retval block rw_lock_x_lock_count(&block->lock) == 1 if allocation succeeded
(init_mtr == mtr, or the page was not previously freed in mtr)
@retval block (not allocated or initialized) otherwise */
-static MY_ATTRIBUTE((warn_unused_result))
+static MY_ATTRIBUTE((warn_unused_result, nonnull))
buf_block_t*
fsp_alloc_free_page(
fil_space_t* space,
@@ -1395,9 +1381,6 @@ fsp_alloc_free_page(
ulint free;
const ulint space_id = space->id;
- ut_ad(mtr);
- ut_ad(init_mtr);
-
ut_d(fsp_space_modify_check(space, mtr));
header = fsp_get_space_header(space, page_size, mtr);
@@ -2434,7 +2417,6 @@ fseg_alloc_free_page_low(
ulint n;
const ulint space_id = space->id;
- ut_ad(mtr);
ut_ad((direction >= FSP_UP) && (direction <= FSP_NO_DIR));
ut_ad(mach_read_from_4(seg_inode + FSEG_MAGIC_N)
== FSEG_MAGIC_N_VALUE);
@@ -2816,7 +2798,7 @@ fsp_reserve_free_extents(
ulint size;
ulint n_free;
ulint n_free_up;
- ulint reserve= 0;
+ ulint reserve;
size_t total_reserved = 0;
ulint rounds = 0;
ulint n_pages_added = 0;
@@ -2890,6 +2872,7 @@ try_again:
break;
case FSP_CLEANING:
case FSP_BLOB:
+ reserve = 0;
break;
default:
ut_error;
diff --git a/storage/innobase/fsp/fsp0sysspace.cc b/storage/innobase/fsp/fsp0sysspace.cc
index 6f7d09b6faa..974140fe565 100644
--- a/storage/innobase/fsp/fsp0sysspace.cc
+++ b/storage/innobase/fsp/fsp0sysspace.cc
@@ -935,7 +935,7 @@ SysTablespace::open_or_create(
/* Create default crypt info for system
tablespace if it does not yet exists. */
m_crypt_info = fil_space_create_crypt_data(
- FIL_SPACE_ENCRYPTION_DEFAULT,
+ FIL_ENCRYPTION_DEFAULT,
FIL_DEFAULT_ENCRYPTION_KEY);
}
diff --git a/storage/innobase/fts/fts0fts.cc b/storage/innobase/fts/fts0fts.cc
index 58924724ef1..a7d09b5dd47 100644
--- a/storage/innobase/fts/fts0fts.cc
+++ b/storage/innobase/fts/fts0fts.cc
@@ -1798,7 +1798,7 @@ fts_create_one_common_table(
}
error = row_create_table_for_mysql(new_table, trx, false,
- FIL_SPACE_ENCRYPTION_DEFAULT, FIL_DEFAULT_ENCRYPTION_KEY);
+ FIL_ENCRYPTION_DEFAULT, FIL_DEFAULT_ENCRYPTION_KEY);
if (error == DB_SUCCESS) {
@@ -2015,7 +2015,7 @@ fts_create_one_index_table(
FTS_INDEX_ILIST_LEN);
error = row_create_table_for_mysql(new_table, trx, false,
- FIL_SPACE_ENCRYPTION_DEFAULT, FIL_DEFAULT_ENCRYPTION_KEY);
+ FIL_ENCRYPTION_DEFAULT, FIL_DEFAULT_ENCRYPTION_KEY);
if (error == DB_SUCCESS) {
dict_index_t* index = dict_mem_index_create(
diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
index 79056f949ba..869864e303c 100644
--- a/storage/innobase/handler/ha_innodb.cc
+++ b/storage/innobase/handler/ha_innodb.cc
@@ -1184,6 +1184,9 @@ static SHOW_VAR innodb_status_variables[]= {
{"encryption_rotation_estimated_iops",
(char*) &export_vars.innodb_encryption_rotation_estimated_iops,
SHOW_LONG},
+ {"encryption_key_rotation_list_length",
+ (char*)&export_vars.innodb_key_rotation_list_length,
+ SHOW_LONGLONG},
/* scrubing */
{"scrub_background_page_reorganizations",
@@ -1936,6 +1939,15 @@ thd_has_edited_nontrans_tables(
return((ibool) thd_non_transactional_update(thd));
}
+/* Return high resolution timestamp for the start of the current query */
+UNIV_INTERN
+unsigned long long
+thd_query_start_micro(
+ const THD* thd) /*!< in: thread handle */
+{
+ return thd_start_utime(thd);
+}
+
/******************************************************************//**
Returns true if the thread is executing a SELECT statement.
@return true if thd is executing SELECT */
@@ -12402,7 +12414,7 @@ create_table_info_t::check_table_options()
enum row_type row_format = m_form->s->row_type;
ha_table_option_struct *options= m_form->s->option_struct;
fil_encryption_t encrypt = (fil_encryption_t)options->encryption;
- bool should_encrypt = (encrypt == FIL_SPACE_ENCRYPTION_ON);
+ bool should_encrypt = (encrypt == FIL_ENCRYPTION_ON);
/* Currently we do not support encryption for
spatial indexes thus do not allow creating table with forced
@@ -12418,7 +12430,7 @@ create_table_info_t::check_table_options()
}
}
- if (encrypt != FIL_SPACE_ENCRYPTION_DEFAULT && !m_allow_file_per_table) {
+ if (encrypt != FIL_ENCRYPTION_DEFAULT && !m_allow_file_per_table) {
push_warning(
m_thd, Sql_condition::WARN_LEVEL_WARN,
HA_WRONG_CREATE_OPTION,
@@ -12426,7 +12438,7 @@ create_table_info_t::check_table_options()
return "ENCRYPTED";
}
- if (encrypt == FIL_SPACE_ENCRYPTION_OFF && srv_encrypt_tables == 2) {
+ if (encrypt == FIL_ENCRYPTION_OFF && srv_encrypt_tables == 2) {
push_warning(
m_thd, Sql_condition::WARN_LEVEL_WARN,
HA_WRONG_CREATE_OPTION,
@@ -12507,8 +12519,8 @@ create_table_info_t::check_table_options()
}
/* If encryption is set up make sure that used key_id is found */
- if (encrypt == FIL_SPACE_ENCRYPTION_ON ||
- (encrypt == FIL_SPACE_ENCRYPTION_DEFAULT && srv_encrypt_tables)) {
+ if (encrypt == FIL_ENCRYPTION_ON ||
+ (encrypt == FIL_ENCRYPTION_DEFAULT && srv_encrypt_tables)) {
if (!encryption_key_id_exists((unsigned int)options->encryption_key_id)) {
push_warning_printf(
m_thd, Sql_condition::WARN_LEVEL_WARN,
@@ -12521,7 +12533,7 @@ create_table_info_t::check_table_options()
}
/* Ignore nondefault key_id if encryption is set off */
- if (encrypt == FIL_SPACE_ENCRYPTION_OFF &&
+ if (encrypt == FIL_ENCRYPTION_OFF &&
options->encryption_key_id != THDVAR(m_thd, default_encryption_key_id)) {
push_warning_printf(
m_thd, Sql_condition::WARN_LEVEL_WARN,
@@ -12534,7 +12546,7 @@ create_table_info_t::check_table_options()
/* If default encryption is used make sure that used kay is found
from key file. */
- if (encrypt == FIL_SPACE_ENCRYPTION_DEFAULT &&
+ if (encrypt == FIL_ENCRYPTION_DEFAULT &&
!srv_encrypt_tables &&
options->encryption_key_id != FIL_DEFAULT_ENCRYPTION_KEY) {
if (!encryption_key_id_exists((unsigned int)options->encryption_key_id)) {
@@ -20290,22 +20302,24 @@ wsrep_innobase_kill_one_trx(
if (!thd) {
DBUG_PRINT("wsrep", ("no thd for conflicting lock"));
- WSREP_WARN("no THD for trx: %lu", (ulong) victim_trx->id);
+ WSREP_WARN("no THD for trx: " TRX_ID_FMT, victim_trx->id);
DBUG_RETURN(1);
}
if (!bf_thd) {
DBUG_PRINT("wsrep", ("no BF thd for conflicting lock"));
- WSREP_WARN("no BF THD for trx: %lu", (bf_trx) ? (ulong) bf_trx->id : (ulong) 0);
+ WSREP_WARN("no BF THD for trx: " TRX_ID_FMT,
+ bf_trx ? bf_trx->id : 0);
DBUG_RETURN(1);
}
WSREP_LOG_CONFLICT(bf_thd, thd, TRUE);
- WSREP_DEBUG("BF kill (%lu, seqno: %lld), victim: (%lu) trx: %llu",
+ WSREP_DEBUG("BF kill (%lu, seqno: %lld), victim: (%lu) trx: "
+ TRX_ID_FMT,
signal, (long long)bf_seqno,
thd_get_thread_id(thd),
- (ulonglong) victim_trx->id);
+ victim_trx->id);
WSREP_DEBUG("Aborting query: %s",
(thd && wsrep_thd_query(thd)) ? wsrep_thd_query(thd) : "void");
@@ -20322,15 +20336,15 @@ wsrep_innobase_kill_one_trx(
if (wsrep_thd_query_state(thd) == QUERY_EXITING) {
- WSREP_DEBUG("kill trx EXITING for %llu",
- (ulonglong) victim_trx->id);
+ WSREP_DEBUG("kill trx EXITING for " TRX_ID_FMT,
+ victim_trx->id);
wsrep_thd_UNLOCK(thd);
DBUG_RETURN(0);
}
if (wsrep_thd_exec_mode(thd) != LOCAL_STATE) {
- WSREP_DEBUG("withdraw for BF trx: %llu, state: %d",
- (longlong) victim_trx->id,
+ WSREP_DEBUG("withdraw for BF trx: " TRX_ID_FMT ", state: %d",
+ victim_trx->id,
wsrep_thd_get_conflict_state(thd));
}
@@ -20339,8 +20353,8 @@ wsrep_innobase_kill_one_trx(
wsrep_thd_set_conflict_state(thd, MUST_ABORT);
break;
case MUST_ABORT:
- WSREP_DEBUG("victim %llu in MUST ABORT state",
- (longlong) victim_trx->id);
+ WSREP_DEBUG("victim " TRX_ID_FMT " in MUST ABORT state",
+ victim_trx->id);
wsrep_thd_UNLOCK(thd);
wsrep_thd_awake(thd, signal);
DBUG_RETURN(0);
@@ -20348,9 +20362,8 @@ wsrep_innobase_kill_one_trx(
case ABORTED:
case ABORTING: // fall through
default:
- WSREP_DEBUG("victim %llu in state %d",
- (longlong) victim_trx->id,
- wsrep_thd_get_conflict_state(thd));
+ WSREP_DEBUG("victim " TRX_ID_FMT " in state %d",
+ victim_trx->id, wsrep_thd_get_conflict_state(thd));
wsrep_thd_UNLOCK(thd);
DBUG_RETURN(0);
break;
@@ -20362,8 +20375,8 @@ wsrep_innobase_kill_one_trx(
WSREP_DEBUG("kill query for: %ld",
thd_get_thread_id(thd));
- WSREP_DEBUG("kill trx QUERY_COMMITTING for %llu",
- (longlong) victim_trx->id);
+ WSREP_DEBUG("kill trx QUERY_COMMITTING for " TRX_ID_FMT,
+ victim_trx->id);
if (wsrep_thd_exec_mode(thd) == REPL_RECV) {
wsrep_abort_slave_trx(bf_seqno,
@@ -20377,8 +20390,9 @@ wsrep_innobase_kill_one_trx(
switch (rcode) {
case WSREP_WARNING:
- WSREP_DEBUG("cancel commit warning: %llu",
- (ulonglong) victim_trx->id);
+ WSREP_DEBUG("cancel commit warning: "
+ TRX_ID_FMT,
+ victim_trx->id);
wsrep_thd_UNLOCK(thd);
wsrep_thd_awake(thd, signal);
DBUG_RETURN(1);
@@ -20387,9 +20401,9 @@ wsrep_innobase_kill_one_trx(
break;
default:
WSREP_ERROR(
- "cancel commit bad exit: %d %llu",
- rcode,
- (ulonglong) victim_trx->id);
+ "cancel commit bad exit: %d "
+ TRX_ID_FMT,
+ rcode, victim_trx->id);
/* unable to interrupt, must abort */
/* note: kill_mysql() will block, if we cannot.
* kill the lock holder first.
@@ -20405,8 +20419,8 @@ wsrep_innobase_kill_one_trx(
/* it is possible that victim trx is itself waiting for some
* other lock. We need to cancel this waiting
*/
- WSREP_DEBUG("kill trx QUERY_EXEC for %llu",
- (ulonglong) victim_trx->id);
+ WSREP_DEBUG("kill trx QUERY_EXEC for " TRX_ID_FMT,
+ victim_trx->id);
victim_trx->lock.was_chosen_as_deadlock_victim= TRUE;
@@ -20443,7 +20457,7 @@ wsrep_innobase_kill_one_trx(
break;
case QUERY_IDLE:
{
- WSREP_DEBUG("kill IDLE for %llu", (ulonglong) victim_trx->id);
+ WSREP_DEBUG("kill IDLE for " TRX_ID_FMT, victim_trx->id);
if (wsrep_thd_exec_mode(thd) == REPL_RECV) {
WSREP_DEBUG("kill BF IDLE, seqno: %lld",
@@ -21749,10 +21763,11 @@ static MYSQL_SYSVAR_UINT(encryption_rotate_key_age,
PLUGIN_VAR_RQCMDARG,
"Key rotation - re-encrypt in background "
"all pages that were encrypted with a key that "
- "many (or more) versions behind",
+ "many (or more) versions behind. Value 0 indicates "
+ "that key rotation is disabled.",
NULL,
innodb_encryption_rotate_key_age_update,
- srv_fil_crypt_rotate_key_age, 0, UINT_MAX32, 0);
+ 1, 0, UINT_MAX32, 0);
static MYSQL_SYSVAR_UINT(encryption_rotation_iops, srv_n_fil_crypt_iops,
PLUGIN_VAR_RQCMDARG,
@@ -22992,8 +23007,9 @@ innodb_encrypt_tables_validate(
for update function */
struct st_mysql_value* value) /*!< in: incoming string */
{
- if (check_sysvar_enum(thd, var, save, value))
+ if (check_sysvar_enum(thd, var, save, value)) {
return 1;
+ }
ulong encrypt_tables = *(ulong*)save;
@@ -23005,6 +23021,17 @@ innodb_encrypt_tables_validate(
"encryption plugin is not available");
return 1;
}
+
+ if (!srv_fil_crypt_rotate_key_age) {
+ const char *msg = (encrypt_tables ? "enable" : "disable");
+ push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
+ HA_ERR_UNSUPPORTED,
+ "InnoDB: cannot %s encryption, "
+ "innodb_encryption_rotate_key_age=0"
+ " i.e. key rotation disabled", msg);
+ return 1;
+ }
+
return 0;
}
diff --git a/storage/innobase/handler/ha_innodb.h b/storage/innobase/handler/ha_innodb.h
index 49eb150036b..463717ee6b2 100644
--- a/storage/innobase/handler/ha_innodb.h
+++ b/storage/innobase/handler/ha_innodb.h
@@ -549,6 +549,14 @@ int thd_slave_thread(const MYSQL_THD thd);
@retval 1 the user thread is running a non-transactional update */
int thd_non_transactional_update(const MYSQL_THD thd);
+/** Get high resolution timestamp for the current query start time.
+The timestamp is not anchored to any specific point in time,
+but can be used for comparison.
+@param thd user thread
+@retval timestamp in microseconds precision
+*/
+unsigned long long thd_start_utime(const MYSQL_THD thd);
+
/** Get the user thread's binary logging format
@param thd user thread
@return Value to be used as index into the binlog_format_names array */
@@ -1022,4 +1030,3 @@ ib_push_frm_error(
TABLE* table, /*!< in: MySQL table */
ulint n_keys, /*!< in: InnoDB #keys */
bool push_warning); /*!< in: print warning ? */
-
diff --git a/storage/innobase/handler/handler0alter.cc b/storage/innobase/handler/handler0alter.cc
index 82fa4b724f4..fd61db9725d 100644
--- a/storage/innobase/handler/handler0alter.cc
+++ b/storage/innobase/handler/handler0alter.cc
@@ -4532,9 +4532,11 @@ prepare_inplace_alter_table_dict(
ulint space_id = 0;
ulint z = 0;
ulint key_id = FIL_DEFAULT_ENCRYPTION_KEY;
- fil_encryption_t mode = FIL_SPACE_ENCRYPTION_DEFAULT;
+ fil_encryption_t mode = FIL_ENCRYPTION_DEFAULT;
- crypt_data = fil_space_get_crypt_data(ctx->prebuilt->table->space);
+ fil_space_t* space = fil_space_acquire(ctx->prebuilt->table->space);
+ crypt_data = space->crypt_data;
+ fil_space_release(space);
if (crypt_data) {
key_id = crypt_data->key_id;
diff --git a/storage/innobase/handler/i_s.cc b/storage/innobase/handler/i_s.cc
index dd43a52ae66..6bf16573efd 100644
--- a/storage/innobase/handler/i_s.cc
+++ b/storage/innobase/handler/i_s.cc
@@ -8560,22 +8560,31 @@ static ST_FIELD_INFO innodb_tablespaces_encryption_fields_info[] =
STRUCT_FLD(old_name, ""),
STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+#define TABLESPACES_ENCRYPTION_ROTATING_OR_FLUSHING 9
+ {STRUCT_FLD(field_name, "ROTATING_OR_FLUSHING"),
+ STRUCT_FLD(field_length, 1),
+ STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
+ STRUCT_FLD(value, 0),
+ STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
+ STRUCT_FLD(old_name, ""),
+ STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+
END_OF_ST_FIELD_INFO
};
/**********************************************************************//**
Function to fill INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION
-with information collected by scanning SYS_TABLESPACES table and then use
-fil_space()
+with information collected by scanning SYS_TABLESPACES table.
+@param[in] thd thread handle
+@param[in] space Tablespace
+@param[in] table_to_fill I_S table to fill
@return 0 on success */
static
int
i_s_dict_fill_tablespaces_encryption(
-/*==========================*/
- THD* thd, /*!< in: thread */
- ulint space, /*!< in: space ID */
- const char* name, /*!< in: tablespace name */
- TABLE* table_to_fill) /*!< in/out: fill this table */
+ THD* thd,
+ fil_space_t* space,
+ TABLE* table_to_fill)
{
Field** fields;
struct fil_space_crypt_status_t status;
@@ -8585,10 +8594,11 @@ i_s_dict_fill_tablespaces_encryption(
fields = table_to_fill->field;
fil_space_crypt_get_status(space, &status);
- OK(fields[TABLESPACES_ENCRYPTION_SPACE]->store(space));
+
+ OK(fields[TABLESPACES_ENCRYPTION_SPACE]->store(space->id));
OK(field_store_string(fields[TABLESPACES_ENCRYPTION_NAME],
- name));
+ space->name));
OK(fields[TABLESPACES_ENCRYPTION_ENCRYPTION_SCHEME]->store(
status.scheme));
@@ -8600,6 +8610,9 @@ i_s_dict_fill_tablespaces_encryption(
status.current_key_version));
OK(fields[TABLESPACES_ENCRYPTION_CURRENT_KEY_ID]->store(
status.key_id));
+ OK(fields[TABLESPACES_ENCRYPTION_ROTATING_OR_FLUSHING]->store(
+ (status.rotating || status.flushing) ? 1 : 0));
+
if (status.rotating) {
fields[TABLESPACES_ENCRYPTION_KEY_ROTATION_PAGE_NUMBER]->set_notnull();
OK(fields[TABLESPACES_ENCRYPTION_KEY_ROTATION_PAGE_NUMBER]->store(
@@ -8613,6 +8626,7 @@ i_s_dict_fill_tablespaces_encryption(
fields[TABLESPACES_ENCRYPTION_KEY_ROTATION_MAX_PAGE_NUMBER]
->set_null();
}
+
OK(schema_table_store_record(thd, table_to_fill));
DBUG_RETURN(0);
@@ -8652,30 +8666,36 @@ i_s_tablespaces_encryption_fill_table(
while (rec) {
const char* err_msg;
- ulint space;
+ ulint space_id;
const char* name;
ulint flags;
/* Extract necessary information from a SYS_TABLESPACES row */
err_msg = dict_process_sys_tablespaces(
- heap, rec, &space, &name, &flags);
+ heap, rec, &space_id, &name, &flags);
mtr_commit(&mtr);
mutex_exit(&dict_sys->mutex);
- if (space == 0) {
+ if (space_id == 0) {
found_space_0 = true;
}
- if (!err_msg) {
+ fil_space_t* space = fil_space_acquire_silent(space_id);
+
+ if (!err_msg && space) {
i_s_dict_fill_tablespaces_encryption(
- thd, space, name, tables->table);
+ thd, space, tables->table);
} else {
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
ER_CANT_FIND_SYSTEM_REC, "%s",
err_msg);
}
+ if (space) {
+ fil_space_release(space);
+ }
+
mem_heap_empty(heap);
/* Get the next record */
@@ -8691,10 +8711,13 @@ i_s_tablespaces_encryption_fill_table(
if (found_space_0 == false) {
/* space 0 does for what ever unknown reason not show up
* in iteration above, add it manually */
- ulint space = 0;
- const char* name = NULL;
+
+ fil_space_t* space = fil_space_acquire_silent(0);
+
i_s_dict_fill_tablespaces_encryption(
- thd, space, name, tables->table);
+ thd, space, tables->table);
+
+ fil_space_release(space);
}
DBUG_RETURN(0);
@@ -8845,22 +8868,32 @@ static ST_FIELD_INFO innodb_tablespaces_scrubbing_fields_info[] =
STRUCT_FLD(old_name, ""),
STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+#define TABLESPACES_ENCRYPTION_ROTATING_OR_FLUSHING 9
+ {STRUCT_FLD(field_name, "ROTATING_OR_FLUSHING"),
+ STRUCT_FLD(field_length, MY_INT32_NUM_DECIMAL_DIGITS),
+ STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
+ STRUCT_FLD(value, 0),
+ STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
+ STRUCT_FLD(old_name, ""),
+ STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+
END_OF_ST_FIELD_INFO
};
/**********************************************************************//**
Function to fill INFORMATION_SCHEMA.INNODB_TABLESPACES_SCRUBBING
-with information collected by scanning SYS_TABLESPACES table and then use
-fil_space()
+with information collected by scanning SYS_TABLESPACES table and
+fil_space.
+@param[in] thd Thread handle
+@param[in] space Tablespace
+@param[in] table_to_fill I_S table
@return 0 on success */
static
int
i_s_dict_fill_tablespaces_scrubbing(
-/*==========================*/
- THD* thd, /*!< in: thread */
- ulint space, /*!< in: space ID */
- const char* name, /*!< in: tablespace name */
- TABLE* table_to_fill) /*!< in/out: fill this table */
+ THD* thd,
+ fil_space_t* space,
+ TABLE* table_to_fill)
{
Field** fields;
struct fil_space_scrub_status_t status;
@@ -8870,10 +8903,11 @@ i_s_dict_fill_tablespaces_scrubbing(
fields = table_to_fill->field;
fil_space_get_scrub_status(space, &status);
- OK(fields[TABLESPACES_SCRUBBING_SPACE]->store(space));
+
+ OK(fields[TABLESPACES_SCRUBBING_SPACE]->store(space->id));
OK(field_store_string(fields[TABLESPACES_SCRUBBING_NAME],
- name));
+ space->name));
OK(fields[TABLESPACES_SCRUBBING_COMPRESSED]->store(
status.compressed ? 1 : 0));
@@ -8893,6 +8927,7 @@ i_s_dict_fill_tablespaces_scrubbing(
TABLESPACES_SCRUBBING_CURRENT_SCRUB_ACTIVE_THREADS,
TABLESPACES_SCRUBBING_CURRENT_SCRUB_PAGE_NUMBER,
TABLESPACES_SCRUBBING_CURRENT_SCRUB_MAX_PAGE_NUMBER };
+
if (status.scrubbing) {
for (uint i = 0; i < array_elements(field_numbers); i++) {
fields[field_numbers[i]]->set_notnull();
@@ -8912,6 +8947,7 @@ i_s_dict_fill_tablespaces_scrubbing(
fields[field_numbers[i]]->set_null();
}
}
+
OK(schema_table_store_record(thd, table_to_fill));
DBUG_RETURN(0);
@@ -8951,30 +8987,36 @@ i_s_tablespaces_scrubbing_fill_table(
while (rec) {
const char* err_msg;
- ulint space;
+ ulint space_id;
const char* name;
ulint flags;
/* Extract necessary information from a SYS_TABLESPACES row */
err_msg = dict_process_sys_tablespaces(
- heap, rec, &space, &name, &flags);
+ heap, rec, &space_id, &name, &flags);
mtr_commit(&mtr);
mutex_exit(&dict_sys->mutex);
- if (space == 0) {
+ if (space_id == 0) {
found_space_0 = true;
}
- if (!err_msg) {
+ fil_space_t* space = fil_space_acquire_silent(space_id);
+
+ if (!err_msg && space) {
i_s_dict_fill_tablespaces_scrubbing(
- thd, space, name, tables->table);
+ thd, space, tables->table);
} else {
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
ER_CANT_FIND_SYSTEM_REC, "%s",
err_msg);
}
+ if (space) {
+ fil_space_release(space);
+ }
+
mem_heap_empty(heap);
/* Get the next record */
@@ -8990,10 +9032,12 @@ i_s_tablespaces_scrubbing_fill_table(
if (found_space_0 == false) {
/* space 0 does for what ever unknown reason not show up
* in iteration above, add it manually */
- ulint space = 0;
- const char* name = NULL;
+ fil_space_t* space = fil_space_acquire_silent(0);
+
i_s_dict_fill_tablespaces_scrubbing(
- thd, space, name, tables->table);
+ thd, space, tables->table);
+
+ fil_space_release(space);
}
DBUG_RETURN(0);
diff --git a/storage/innobase/ibuf/ibuf0ibuf.cc b/storage/innobase/ibuf/ibuf0ibuf.cc
index 7dee46dc4a9..2fde0cb23b9 100644
--- a/storage/innobase/ibuf/ibuf0ibuf.cc
+++ b/storage/innobase/ibuf/ibuf0ibuf.cc
@@ -4458,7 +4458,6 @@ ibuf_merge_or_delete_for_page(
ulint volume = 0;
#endif /* UNIV_IBUF_DEBUG */
page_zip_des_t* page_zip = NULL;
- fil_space_t* space = NULL;
bool corruption_noticed = false;
mtr_t mtr;
@@ -4489,6 +4488,8 @@ ibuf_merge_or_delete_for_page(
return;
}
+ fil_space_t* space;
+
if (update_ibuf_bitmap) {
ut_ad(page_size != NULL);
@@ -4500,10 +4501,9 @@ ibuf_merge_or_delete_for_page(
space = fil_space_acquire(page_id.space());
- if (space == NULL) {
- /* Do not try to read the bitmap page from space;
- just delete the ibuf records for the page */
-
+ if (UNIV_UNLIKELY(!space)) {
+ /* Do not try to read the bitmap page from the
+ non-existent tablespace, delete the ibuf records */
block = NULL;
update_ibuf_bitmap = FALSE;
} else {
@@ -4536,6 +4536,8 @@ ibuf_merge_or_delete_for_page(
|| fsp_descr_page(page_id, *page_size))) {
return;
+ } else {
+ space = NULL;
}
heap = mem_heap_create(512);
@@ -4566,9 +4568,6 @@ ibuf_merge_or_delete_for_page(
" insert buffer merge for this page. Please"
" run CHECK TABLE on your tables to determine"
" if they are corrupt after this.";
-
- ib::error() << "Please submit a detailed bug"
- " report to http://bugs.mysql.com";
ut_ad(0);
}
}
@@ -4788,15 +4787,17 @@ reset_bit:
}
ibuf_mtr_commit(&mtr);
+
+ if (space) {
+ fil_space_release(space);
+ }
+
btr_pcur_close(&pcur);
mem_heap_free(heap);
my_atomic_addlint(&ibuf->n_merges, 1);
ibuf_add_ops(ibuf->n_merged_ops, mops);
ibuf_add_ops(ibuf->n_discarded_ops, dops);
- if (space != NULL) {
- fil_space_release(space);
- }
#ifdef UNIV_IBUF_COUNT_DEBUG
ut_a(ibuf_count_get(page_id) == 0);
diff --git a/storage/innobase/include/buf0buf.h b/storage/innobase/include/buf0buf.h
index d9243c6627c..3aab242606d 100644
--- a/storage/innobase/include/buf0buf.h
+++ b/storage/innobase/include/buf0buf.h
@@ -30,7 +30,6 @@ Created 11/5/1995 Heikki Tuuri
/** Magic value to use instead of checksums when they are disabled */
#define BUF_NO_CHECKSUM_MAGIC 0xDEADBEEFUL
-#include "univ.i"
#include "fil0fil.h"
#include "mtr0types.h"
#include "buf0types.h"
@@ -766,6 +765,87 @@ buf_block_unfix(
# endif /* UNIV_DEBUG */
#endif /* !UNIV_INNOCHECKSUM */
+/** Checks if the page is in crc32 checksum format.
+@param[in] read_buf database page
+@param[in] checksum_field1 new checksum field
+@param[in] checksum_field2 old checksum field
+@param[in] page_no page number of given read_buf
+@param[in] is_log_enabled true if log option is enabled
+@param[in] log_file file pointer to log_file
+@param[in] curr_algo current checksum algorithm
+@param[in] use_legacy_big_endian use legacy big endian algorithm
+@return true if the page is in crc32 checksum format. */
+bool
+buf_page_is_checksum_valid_crc32(
+ const byte* read_buf,
+ ulint checksum_field1,
+ ulint checksum_field2,
+#ifdef UNIV_INNOCHECKSUM
+ uintmax_t page_no,
+ bool is_log_enabled,
+ FILE* log_file,
+ const srv_checksum_algorithm_t curr_algo,
+#endif /* UNIV_INNOCHECKSUM */
+ bool use_legacy_big_endian)
+ MY_ATTRIBUTE((nonnull(1), warn_unused_result));
+
+/** Checks if the page is in innodb checksum format.
+@param[in] read_buf database page
+@param[in] checksum_field1 new checksum field
+@param[in] checksum_field2 old checksum field
+@param[in] page_no page number of given read_buf
+@param[in] is_log_enabled true if log option is enabled
+@param[in] log_file file pointer to log_file
+@param[in] curr_algo current checksum algorithm
+@return true if the page is in innodb checksum format. */
+bool
+buf_page_is_checksum_valid_innodb(
+ const byte* read_buf,
+ ulint checksum_field1,
+ ulint checksum_field2
+#ifdef UNIV_INNOCHECKSUM
+ ,uintmax_t page_no,
+ bool is_log_enabled,
+ FILE* log_file,
+ const srv_checksum_algorithm_t curr_algo
+#endif /* UNIV_INNOCHECKSUM */
+ )
+ MY_ATTRIBUTE((nonnull(1), warn_unused_result));
+
+/** Checks if the page is in none checksum format.
+@param[in] read_buf database page
+@param[in] checksum_field1 new checksum field
+@param[in] checksum_field2 old checksum field
+@param[in] page_no page number of given read_buf
+@param[in] is_log_enabled true if log option is enabled
+@param[in] log_file file pointer to log_file
+@param[in] curr_algo current checksum algorithm
+@return true if the page is in none checksum format. */
+bool
+buf_page_is_checksum_valid_none(
+ const byte* read_buf,
+ ulint checksum_field1,
+ ulint checksum_field2
+#ifdef UNIV_INNOCHECKSUM
+ ,uintmax_t page_no,
+ bool is_log_enabled,
+ FILE* log_file,
+ const srv_checksum_algorithm_t curr_algo
+#endif /* UNIV_INNOCHECKSUM */
+ )
+ MY_ATTRIBUTE((nonnull(1), warn_unused_result));
+
+/********************************************************************//**
+Check if page is maybe compressed, encrypted or both when we encounter
+corrupted page. Note that we can't be 100% sure if page is corrupted
+or decrypt/decompress just failed.
+@param[in] bpage Page
+@return true if page corrupted, false if not */
+bool
+buf_page_check_corrupt(
+ buf_page_t* bpage) /*!< in/out: buffer page read from disk */
+ MY_ATTRIBUTE((nonnull, warn_unused_result));
+
/** Checks if a page contains only zeroes.
@param[in] read_buf database page
@param[in] page_size page size
@@ -780,23 +860,23 @@ buf_page_is_zeroes(
the LSN
@param[in] read_buf database page
@param[in] page_size page size
-@param[in] skip_checksum if true, skip checksum
+@param[in] space tablespace
@param[in] page_no page number of given read_buf
@param[in] strict_check true if strict-check option is enabled
@param[in] is_log_enabled true if log option is enabled
@param[in] log_file file pointer to log_file
-@return TRUE if corrupted */
-ibool
+@return whether the page is corrupted */
+bool
buf_page_is_corrupted(
bool check_lsn,
const byte* read_buf,
const page_size_t& page_size,
- bool skip_checksum
+ const fil_space_t* space = NULL
#ifdef UNIV_INNOCHECKSUM
- ,uintmax_t page_no,
- bool strict_check,
- bool is_log_enabled,
- FILE* log_file
+ ,uintmax_t page_no = 0,
+ bool strict_check = false,
+ bool is_log_enabled = false,
+ FILE* log_file = NULL
#endif /* UNIV_INNOCHECKSUM */
) MY_ATTRIBUTE((warn_unused_result));
#ifndef UNIV_INNOCHECKSUM
@@ -1476,37 +1556,6 @@ buf_page_encrypt_before_write(
byte* frame, /*!< in: src frame */
ulint space_id); /*!< in: space id */
-/**********************************************************************
-The hook that is called after page is written to disk.
-The function releases any resources needed for encryption that was allocated
-in buf_page_encrypt_before_write */
-UNIV_INTERN
-ibool
-buf_page_encrypt_after_write(
-/*=========================*/
- buf_page_t* page); /*!< in/out: buffer page that was flushed */
-
-/********************************************************************//**
-The hook that is called just before a page is read from disk.
-The function allocates memory that is used to temporarily store disk content
-before getting decrypted */
-UNIV_INTERN
-byte*
-buf_page_decrypt_before_read(
-/*=========================*/
- buf_page_t* page, /*!< in/out: buffer page read from disk */
- ulint zip_size); /*!< in: compressed page size, or 0 */
-
-/********************************************************************//**
-The hook that is called just after a page is read from disk.
-The function decrypt disk content into buf_page_t and releases the
-temporary buffer that was allocated in buf_page_decrypt_before_read */
-UNIV_INTERN
-ibool
-buf_page_decrypt_after_read(
-/*========================*/
- buf_page_t* page); /*!< in/out: buffer page read from disk */
-
/** @brief The temporary memory structure.
NOTE! The definition appears here only for other modules of this
@@ -1589,14 +1638,8 @@ public:
operation needed. */
unsigned key_version; /*!< key version for this block */
- bool page_encrypted; /*!< page is page encrypted */
- bool page_compressed;/*!< page is page compressed */
- ulint stored_checksum;/*!< stored page checksum if page
- encrypted */
- bool encrypted; /*!< page is still encrypted */
- ulint calculated_checksum;
- /*!< calculated checksum if page
- encrypted */
+ bool encrypted; /*!< page is still encrypted */
+
ulint real_size; /*!< Real size of the page
Normal pages == UNIV_PAGE_SIZE
page compressed pages, payload
diff --git a/storage/innobase/include/buf0flu.h b/storage/innobase/include/buf0flu.h
index 337a5417c12..d3a83b62a46 100644
--- a/storage/innobase/include/buf0flu.h
+++ b/storage/innobase/include/buf0flu.h
@@ -88,7 +88,7 @@ buf_flush_init_for_writing(
byte* page,
void* page_zip_,
lsn_t newest_lsn,
- bool skip_checksum);
+ bool skip_checksum = false);
# if defined UNIV_DEBUG || defined UNIV_IBUF_DEBUG
/********************************************************************//**
diff --git a/storage/innobase/include/dict0dict.ic b/storage/innobase/include/dict0dict.ic
index 061153589c8..580118f2fdd 100644
--- a/storage/innobase/include/dict0dict.ic
+++ b/storage/innobase/include/dict0dict.ic
@@ -295,7 +295,6 @@ dict_index_is_clust(
/*================*/
const dict_index_t* index) /*!< in: index */
{
- ut_ad(index);
ut_ad(index->magic_n == DICT_INDEX_MAGIC_N);
return(index->type & DICT_CLUSTERED);
@@ -322,7 +321,6 @@ dict_index_is_unique(
/*=================*/
const dict_index_t* index) /*!< in: index */
{
- ut_ad(index);
ut_ad(index->magic_n == DICT_INDEX_MAGIC_N);
return(index->type & DICT_UNIQUE);
@@ -337,7 +335,6 @@ dict_index_is_univ(
/*===============*/
const dict_index_t* index) /*!< in: index */
{
- ut_ad(index);
ut_ad(index->magic_n == DICT_INDEX_MAGIC_N);
return(index->type & DICT_UNIVERSAL);
@@ -398,7 +395,6 @@ dict_index_is_sec_or_ibuf(
{
ulint type;
- ut_ad(index);
ut_ad(index->magic_n == DICT_INDEX_MAGIC_N);
type = index->type;
@@ -417,7 +413,6 @@ dict_table_get_n_user_cols(
/*=======================*/
const dict_table_t* table) /*!< in: table */
{
- ut_ad(table);
ut_ad(table->magic_n == DICT_TABLE_MAGIC_N);
return(table->n_cols - dict_table_get_n_sys_cols(table));
@@ -449,7 +444,6 @@ dict_table_get_n_cols(
/*==================*/
const dict_table_t* table) /*!< in: table */
{
- ut_ad(table);
ut_ad(table->magic_n == DICT_TABLE_MAGIC_N);
return(table->n_cols);
@@ -1686,7 +1680,6 @@ dict_index_is_corrupted(
/*====================*/
const dict_index_t* index) /*!< in: index */
{
- ut_ad(index);
ut_ad(index->magic_n == DICT_INDEX_MAGIC_N);
return((index->type & DICT_CORRUPT)
diff --git a/storage/innobase/include/fil0crypt.h b/storage/innobase/include/fil0crypt.h
index d6a6ecb1538..831d61445d8 100644
--- a/storage/innobase/include/fil0crypt.h
+++ b/storage/innobase/include/fil0crypt.h
@@ -26,6 +26,8 @@ Created 04/01/2015 Jan Lindström
#ifndef fil0crypt_h
#define fil0crypt_h
+#ifndef UNIV_INNOCHECKSUM
+
#include "os0event.h"
#include "my_crypt.h"
@@ -40,14 +42,6 @@ static const unsigned char CRYPT_MAGIC[MAGIC_SZ] = {
/* This key will be used if nothing else is given */
#define FIL_DEFAULT_ENCRYPTION_KEY ENCRYPTION_KEY_SYSTEM_DATA
-/** Enum values for encryption table option */
-typedef enum {
- FIL_SPACE_ENCRYPTION_DEFAULT = 0, /* Tablespace encrypted if
- srv_encrypt_tables = ON */
- FIL_SPACE_ENCRYPTION_ON = 1, /* Tablespace is encrypted always */
- FIL_SPACE_ENCRYPTION_OFF = 2 /* Tablespace is not encrypted */
-} fil_encryption_t;
-
extern os_event_t fil_crypt_threads_event;
/**
@@ -107,23 +101,21 @@ struct fil_space_rotate_state_t
} scrubbing;
};
-struct fil_space_crypt_struct : st_encryption_scheme
+struct fil_space_crypt_t : st_encryption_scheme
{
public:
/** Constructor. Does not initialize the members!
The object is expected to be placed in a buffer that
has been zero-initialized. */
- fil_space_crypt_struct(
+ fil_space_crypt_t(
uint new_type,
uint new_min_key_version,
uint new_key_id,
- ulint offset,
fil_encryption_t new_encryption)
: st_encryption_scheme(),
min_key_version(new_min_key_version),
- page0_offset(offset),
+ page0_offset(0),
encryption(new_encryption),
- closing(false),
key_found(),
rotate_state()
{
@@ -134,9 +126,9 @@ struct fil_space_crypt_struct : st_encryption_scheme
locker = crypt_data_scheme_locker;
type = new_type;
- if (new_encryption == FIL_SPACE_ENCRYPTION_OFF ||
+ if (new_encryption == FIL_ENCRYPTION_OFF ||
(!srv_encrypt_tables &&
- new_encryption == FIL_SPACE_ENCRYPTION_DEFAULT)) {
+ new_encryption == FIL_ENCRYPTION_DEFAULT)) {
type = CRYPT_SCHEME_UNENCRYPTED;
} else {
type = CRYPT_SCHEME_1;
@@ -145,9 +137,8 @@ struct fil_space_crypt_struct : st_encryption_scheme
}
/** Destructor */
- ~fil_space_crypt_struct()
+ ~fil_space_crypt_t()
{
- closing = true;
mutex_free(&mutex);
}
@@ -165,45 +156,37 @@ struct fil_space_crypt_struct : st_encryption_scheme
/** Returns true if tablespace should be encrypted */
bool should_encrypt() const {
- return ((encryption == FIL_SPACE_ENCRYPTION_ON) ||
+ return ((encryption == FIL_ENCRYPTION_ON) ||
(srv_encrypt_tables &&
- encryption == FIL_SPACE_ENCRYPTION_DEFAULT));
+ encryption == FIL_ENCRYPTION_DEFAULT));
}
/** Return true if tablespace is encrypted. */
bool is_encrypted() const {
- return (encryption != FIL_SPACE_ENCRYPTION_OFF);
+ return (encryption != FIL_ENCRYPTION_OFF);
}
/** Return true if default tablespace encryption is used, */
bool is_default_encryption() const {
- return (encryption == FIL_SPACE_ENCRYPTION_DEFAULT);
+ return (encryption == FIL_ENCRYPTION_DEFAULT);
}
/** Return true if tablespace is not encrypted. */
bool not_encrypted() const {
- return (encryption == FIL_SPACE_ENCRYPTION_OFF);
+ return (encryption == FIL_ENCRYPTION_OFF);
}
- /** Is this tablespace closing. */
- bool is_closing(bool is_fixed) {
- bool closed;
- if (!is_fixed) {
- mutex_enter(&mutex);
- }
- closed = closing;
- if (!is_fixed) {
- mutex_exit(&mutex);
- }
- return closed;
- }
+ /** Write crypt data to a page (0)
+ @param[in] space tablespace
+ @param[in,out] page0 first page of the tablespace
+ @param[in,out] mtr mini-transaction */
+ void write_page0(const fil_space_t* space, byte* page0, mtr_t* mtr);
uint min_key_version; // min key version for this space
ulint page0_offset; // byte offset on page 0 for crypt data
fil_encryption_t encryption; // Encryption setup
ib_mutex_t mutex; // mutex protecting following variables
- bool closing; // is tablespace being closed
/** Return code from encryption_key_get_latest_version.
If ENCRYPTION_KEY_VERSION_INVALID encryption plugin
@@ -215,324 +198,306 @@ struct fil_space_crypt_struct : st_encryption_scheme
fil_space_rotate_state_t rotate_state;
};
-/* structure containing encryption specification */
-typedef struct fil_space_crypt_struct fil_space_crypt_t;
+/** Status info about encryption */
+struct fil_space_crypt_status_t {
+ ulint space; /*!< tablespace id */
+ ulint scheme; /*!< encryption scheme */
+ uint min_key_version; /*!< min key version */
+ uint current_key_version;/*!< current key version */
+ uint keyserver_requests;/*!< no of key requests to key server */
+ ulint key_id; /*!< current key_id */
+ bool rotating; /*!< is key rotation ongoing */
+ bool flushing; /*!< is flush at end of rotation ongoing */
+ ulint rotate_next_page_number; /*!< next page if key rotating */
+ ulint rotate_max_page_number; /*!< max page if key rotating */
+};
+
+/** Statistics about encryption key rotation */
+struct fil_crypt_stat_t {
+ ulint pages_read_from_cache;
+ ulint pages_read_from_disk;
+ ulint pages_modified;
+ ulint pages_flushed;
+ ulint estimated_iops;
+};
+
+/** Status info about scrubbing */
+struct fil_space_scrub_status_t {
+ ulint space; /*!< tablespace id */
+ bool compressed; /*!< is space compressed */
+ time_t last_scrub_completed; /*!< when was last scrub completed */
+ bool scrubbing; /*!< is scrubbing ongoing */
+ time_t current_scrub_started; /*!< when started current scrubbing */
+ ulint current_scrub_active_threads; /*!< current scrub active threads */
+ ulint current_scrub_page_number; /*!< current scrub page no */
+ ulint current_scrub_max_page_number; /*!< current scrub max page no */
+};
/*********************************************************************
-Init global resources needed for tablespace encryption/decryption */
+Init space crypt */
UNIV_INTERN
void
fil_space_crypt_init();
/*********************************************************************
-Cleanup global resources needed for tablespace encryption/decryption */
+Cleanup space crypt */
UNIV_INTERN
void
fil_space_crypt_cleanup();
-/*********************************************************************
-Create crypt data, i.e data that is used for a single tablespace */
-UNIV_INTERN
-fil_space_crypt_t *
-fil_space_create_crypt_data(
-/*========================*/
- fil_encryption_t encrypt_mode, /*!< in: encryption mode */
- uint key_id) /*!< in: encryption key id */
- __attribute__((warn_unused_result));
-
-/*********************************************************************
-Destroy crypt data */
-UNIV_INTERN
-void
-fil_space_destroy_crypt_data(
-/*=========================*/
- fil_space_crypt_t **crypt_data); /*!< in/out: crypt data */
-
-/*********************************************************************
-Get crypt data for a space*/
-UNIV_INTERN
-fil_space_crypt_t *
-fil_space_get_crypt_data(
-/*=====================*/
- ulint space); /*!< in: tablespace id */
+/**
+Create a fil_space_crypt_t object
+@param[in] encrypt_mode FIL_ENCRYPTION_DEFAULT or
+ FIL_ENCRYPTION_ON or
+ FIL_ENCRYPTION_OFF
-/*********************************************************************
-Set crypt data for a space*/
+@param[in] key_id Encryption key id
+@return crypt object */
UNIV_INTERN
fil_space_crypt_t*
-fil_space_set_crypt_data(
-/*=====================*/
- ulint space, /*!< in: tablespace id */
- fil_space_crypt_t* crypt_data); /*!< in: crypt data to set */
+fil_space_create_crypt_data(
+ fil_encryption_t encrypt_mode,
+ uint key_id)
+ MY_ATTRIBUTE((warn_unused_result));
-/*********************************************************************
-Merge crypt data */
+/******************************************************************
+Merge fil_space_crypt_t object
+@param[in,out] dst Destination cryp data
+@param[in] src Source crypt data */
UNIV_INTERN
void
fil_space_merge_crypt_data(
-/*=======================*/
- fil_space_crypt_t* dst_crypt_data, /*!< in: crypt_data */
- const fil_space_crypt_t* src_crypt_data); /*!< in: crypt data */
-
-/*********************************************************************
-Read crypt data from buffer page */
+ fil_space_crypt_t* dst,
+ const fil_space_crypt_t* src);
+
+/** Initialize encryption parameters from a tablespace header page.
+@param[in] page_size page size of the tablespace
+@param[in] page first page of the tablespace
+@return crypt data from page 0
+@retval NULL if not present or not valid */
UNIV_INTERN
-fil_space_crypt_t *
-fil_space_read_crypt_data(
-/*======================*/
- ulint space, /*!< in: tablespace id */
- const byte* page, /*!< in: buffer page */
- ulint offset); /*!< in: offset where crypt data is stored */
+fil_space_crypt_t*
+fil_space_read_crypt_data(const page_size_t& page_size, const byte* page)
+ MY_ATTRIBUTE((nonnull, warn_unused_result));
-/*********************************************************************
-Write crypt data to buffer page */
+/**
+Free a crypt data object
+@param[in,out] crypt_data crypt data to be freed */
UNIV_INTERN
void
-fil_space_write_crypt_data(
-/*=======================*/
- ulint space, /*!< in: tablespace id */
- byte* page, /*!< in: buffer page */
- ulint offset, /*!< in: offset where to store data */
- ulint maxsize, /*!< in: max space available to store crypt data in */
- mtr_t * mtr); /*!< in: mini-transaction */
+fil_space_destroy_crypt_data(
+ fil_space_crypt_t **crypt_data);
-/*********************************************************************
-Clear crypt data from page 0 (used for import tablespace) */
+/******************************************************************
+Parse a MLOG_FILE_WRITE_CRYPT_DATA log entry
+@param[in] ptr Log entry start
+@param[in] end_ptr Log entry end
+@param[in] block buffer block
+@return position on log buffer */
UNIV_INTERN
-void
-fil_space_clear_crypt_data(
-/*=======================*/
- byte* page, /*!< in: buffer page */
- ulint offset); /*!< in: offset where crypt data is stored */
+const byte*
+fil_parse_write_crypt_data(
+ const byte* ptr,
+ const byte* end_ptr,
+ const buf_block_t* block)
+ MY_ATTRIBUTE((warn_unused_result));
+
+/** Encrypt a buffer.
+@param[in,out] crypt_data Crypt data
+@param[in] space space_id
+@param[in] offset Page offset
+@param[in] lsn Log sequence number
+@param[in] src_frame Page to encrypt
+@param[in] page_size Page size
+@param[in,out] dst_frame Output buffer
+@return encrypted buffer or NULL */
+byte*
+fil_encrypt_buf(
+ fil_space_crypt_t* crypt_data,
+ ulint space,
+ ulint offset,
+ lsn_t lsn,
+ const byte* src_frame,
+ const page_size_t& page_size,
+ byte* dst_frame)
+ MY_ATTRIBUTE((warn_unused_result));
-/*********************************************************************
-Parse crypt data log record */
+/**
+Encrypt a page.
+
+@param[in] space Tablespace
+@param[in] offset Page offset
+@param[in] lsn Log sequence number
+@param[in] src_frame Page to encrypt
+@param[in,out] dst_frame Output buffer
+@return encrypted buffer or NULL */
UNIV_INTERN
byte*
-fil_parse_write_crypt_data(
-/*=======================*/
- byte* ptr, /*!< in: start of log record */
- byte* end_ptr, /*!< in: end of log record */
- buf_block_t*); /*!< in: buffer page to apply record to */
+fil_space_encrypt(
+ const fil_space_t* space,
+ ulint offset,
+ lsn_t lsn,
+ byte* src_frame,
+ byte* dst_frame)
+ MY_ATTRIBUTE((warn_unused_result));
-/*********************************************************************
-Check if extra buffer shall be allocated for decrypting after read */
+/**
+Decrypt a page.
+@param[in,out] crypt_data crypt_data
+@param[in] tmp_frame Temporary buffer
+@param[in] page_size Page size
+@param[in,out] src_frame Page to decrypt
+@param[out] err DB_SUCCESS or error
+@return true if page decrypted, false if not.*/
UNIV_INTERN
bool
-fil_space_check_encryption_read(
-/*============================*/
- ulint space) /*!< in: tablespace id */
- __attribute__((warn_unused_result));
+fil_space_decrypt(
+ fil_space_crypt_t* crypt_data,
+ byte* tmp_frame,
+ const page_size_t& page_size,
+ byte* src_frame,
+ dberr_t* err);
/******************************************************************
Decrypt a page
-@return true if page is decrypted, false if not. */
-UNIV_INTERN
-bool
-fil_space_decrypt(
-/*==============*/
- fil_space_crypt_t* crypt_data, /*!< in: crypt data */
- byte* tmp_frame, /*!< in: temporary buffer */
- const page_size_t& page_size, /*!< in: page size */
- byte* src_frame, /*!< in:out: page buffer */
- dberr_t* err) /*!< in: out: DB_SUCCESS or
- error code */
- __attribute__((warn_unused_result));
-
-/*********************************************************************
-Encrypt buffer page
-@return encrypted page, or original not encrypted page if encrypt
-is not needed. */
-UNIV_INTERN
-byte*
-fil_space_encrypt(
-/*==============*/
- ulint space, /*!< in: tablespace id */
- ulint offset, /*!< in: page no */
- lsn_t lsn, /*!< in: page lsn */
- byte* src_frame, /*!< in: page frame */
- const page_size_t& page_size, /*!< in: page size */
- byte* dst_frame) /*!< in: where to encrypt to */
- __attribute__((warn_unused_result));
-
-/*********************************************************************
-Decrypt buffer page
-@return decrypted page, or original not encrypted page if decrypt is
+@param[in] space Tablespace
+@param[in] tmp_frame Temporary buffer used for decrypting
+@param[in,out] src_frame Page to decrypt
+@param[out] decrypted true if page was decrypted
+@return decrypted page, or original not encrypted page if decryption is
not needed.*/
UNIV_INTERN
byte*
fil_space_decrypt(
-/*==============*/
- ulint space, /*!< in: tablespace id */
- byte* src_frame, /*!< in: page frame */
- const page_size_t& page_size, /*!< in: page size */
- byte* dst_frame) /*!< in: where to decrypt to */
- __attribute__((warn_unused_result));
+ const fil_space_t* space,
+ byte* tmp_frame,
+ byte* src_frame,
+ bool* decrypted)
+ MY_ATTRIBUTE((warn_unused_result));
-/*********************************************************************
-fil_space_verify_crypt_checksum
-NOTE: currently this function can only be run in single threaded mode
-as it modifies srv_checksum_algorithm (temporarily)
-@return true if page is encrypted AND OK, false otherwise */
+/******************************************************************
+Calculate post encryption checksum
+@param[in] page_size page size
+@param[in] dst_frame Block where checksum is calculated
+@return page checksum or BUF_NO_CHECKSUM_MAGIC
+not needed. */
UNIV_INTERN
-bool
-fil_space_verify_crypt_checksum(
-/*============================*/
- const byte* src_frame,/*!< in: page frame */
- const page_size_t& page_size) /*!< in: page size */
- __attribute__((warn_unused_result));
+ulint
+fil_crypt_calculate_checksum(
+ const page_size_t& page_size,
+ const byte* dst_frame)
+ MY_ATTRIBUTE((warn_unused_result));
/*********************************************************************
-Init threads for key rotation */
+Adjust thread count for key rotation
+@param[in] enw_cnt Number of threads to be used */
UNIV_INTERN
void
-fil_crypt_threads_init();
+fil_crypt_set_thread_cnt(
+ uint new_cnt);
/*********************************************************************
-Set thread count (e.g start or stops threads) used for key rotation */
+Adjust max key age
+@param[in] val New max key age */
UNIV_INTERN
void
-fil_crypt_set_thread_cnt(
-/*=====================*/
- uint new_cnt); /*!< in: requested #threads */
+fil_crypt_set_rotate_key_age(
+ uint val);
/*********************************************************************
-Cleanup resources for threads for key rotation */
+Adjust rotation iops
+@param[in] val New max roation iops */
UNIV_INTERN
void
-fil_crypt_threads_cleanup();
+fil_crypt_set_rotation_iops(
+ uint val);
/*********************************************************************
-Set rotate key age */
+Adjust encrypt tables
+@param[in] val New setting for innodb-encrypt-tables */
UNIV_INTERN
void
-fil_crypt_set_rotate_key_age(
-/*=========================*/
- uint rotate_age); /*!< in: requested rotate age */
+fil_crypt_set_encrypt_tables(
+ uint val);
/*********************************************************************
-Set rotation threads iops */
+Init threads for key rotation */
UNIV_INTERN
void
-fil_crypt_set_rotation_iops(
-/*========================*/
- uint iops); /*!< in: requested iops */
+fil_crypt_threads_init();
/*********************************************************************
-Mark a space as closing */
+Clean up key rotation threads resources */
UNIV_INTERN
void
-fil_space_crypt_mark_space_closing(
-/*===============================*/
- ulint space, /*!< in: tablespace id */
- fil_space_crypt_t* crypt_data); /*!< in: crypt_data or NULL */
+fil_crypt_threads_cleanup();
/*********************************************************************
-Wait for crypt threads to stop accessing space */
+Wait for crypt threads to stop accessing space
+@param[in] space Tablespace */
UNIV_INTERN
void
fil_space_crypt_close_tablespace(
-/*=============================*/
- ulint space); /*!< in: tablespace id */
-
-/** Struct for retreiving info about encryption */
-struct fil_space_crypt_status_t {
- ulint space; /*!< tablespace id */
- ulint scheme; /*!< encryption scheme */
- uint min_key_version; /*!< min key version */
- uint current_key_version;/*!< current key version */
- uint keyserver_requests;/*!< no of key requests to key server */
- ulint key_id; /*!< current key_id */
- bool rotating; /*!< is key rotation ongoing */
- bool flushing; /*!< is flush at end of rotation ongoing */
- ulint rotate_next_page_number; /*!< next page if key rotating */
- ulint rotate_max_page_number; /*!< max page if key rotating */
-};
+ const fil_space_t* space);
/*********************************************************************
-Get crypt status for a space
-@return 0 if crypt data found */
+Get crypt status for a space (used by information_schema)
+@param[in] space Tablespace
+@param[out] status Crypt status
+return 0 if crypt data present */
UNIV_INTERN
-int
+void
fil_space_crypt_get_status(
-/*=======================*/
- ulint id, /*!< in: space id */
- struct fil_space_crypt_status_t * status); /*!< out: status */
-
-/** Struct for retreiving statistics about encryption key rotation */
-struct fil_crypt_stat_t {
- ulint pages_read_from_cache;
- ulint pages_read_from_disk;
- ulint pages_modified;
- ulint pages_flushed;
- ulint estimated_iops;
-};
+ const fil_space_t* space,
+ struct fil_space_crypt_status_t* status);
/*********************************************************************
-Get crypt rotation statistics */
+Return crypt statistics
+@param[out] stat Crypt statistics */
UNIV_INTERN
void
fil_crypt_total_stat(
-/*==================*/
- fil_crypt_stat_t* stat); /*!< out: crypt stat */
-
-/** Struct for retreiving info about scrubbing */
-struct fil_space_scrub_status_t {
- ulint space; /*!< tablespace id */
- bool compressed; /*!< is space compressed */
- time_t last_scrub_completed; /*!< when was last scrub completed */
- bool scrubbing; /*!< is scrubbing ongoing */
- time_t current_scrub_started; /*!< when started current scrubbing */
- ulint current_scrub_active_threads; /*!< current scrub active threads */
- ulint current_scrub_page_number; /*!< current scrub page no */
- ulint current_scrub_max_page_number; /*!< current scrub max page no */
-};
+ fil_crypt_stat_t *stat);
-/*********************************************************************
-Get scrub status for a space
-@return 0 if no scrub info found */
-UNIV_INTERN
-int
-fil_space_get_scrub_status(
-/*=======================*/
- ulint id, /*!< in: space id */
- struct fil_space_scrub_status_t * status); /*!< out: status */
+/**
+Get scrub status for a space (used by information_schema)
-/*********************************************************************
-Adjust encrypt tables */
+@param[in] space Tablespace
+@param[out] status Scrub status
+return 0 if data found */
UNIV_INTERN
void
-fil_crypt_set_encrypt_tables(
-/*=========================*/
- uint val); /*!< in: New srv_encrypt_tables setting */
+fil_space_get_scrub_status(
+ const fil_space_t* space,
+ fil_space_scrub_status_t* status);
-/******************************************************************
-Encrypt a buffer */
-UNIV_INTERN
-byte*
-fil_encrypt_buf(
-/*============*/
- fil_space_crypt_t* crypt_data, /*!< in: crypt data */
- ulint space, /*!< in: Space id */
- ulint offset, /*!< in: Page offset */
- lsn_t lsn, /*!< in: lsn */
- byte* src_frame, /*!< in: Source page to be encrypted */
- const page_size_t& page_size, /*!< in: page size */
- byte* dst_frame) /*!< in: outbut buffer */
- __attribute__((warn_unused_result));
+#include "fil0crypt.ic"
+#endif /* !UNIV_INNOCHECKSUM */
-/******************************************************************
-Calculate post encryption checksum
-@return page checksum or BUF_NO_CHECKSUM_MAGIC
-not needed. */
+/**
+Verify that post encryption checksum match calculated checksum.
+This function should be called only if tablespace contains crypt_data
+metadata (this is strong indication that tablespace is encrypted).
+Function also verifies that traditional checksum does not match
+calculated checksum as if it does page could be valid unencrypted,
+encrypted, or corrupted.
+
+@param[in,out] page page frame (checksum is temporarily modified)
+@param[in] page_size page size
+@param[in] space tablespace identifier
+@param[in] offset page number
+@return true if page is encrypted AND OK, false otherwise */
UNIV_INTERN
-ulint
-fil_crypt_calculate_checksum(
-/*=========================*/
- const page_size_t& page_size, /*!< in: page size */
- byte* dst_frame) /*!< in: page where to calculate */
- __attribute__((warn_unused_result));
-
-#include "fil0crypt.ic"
+bool
+fil_space_verify_crypt_checksum(
+ byte* page,
+ const page_size_t& page_size,
+#ifdef UNIV_INNOCHECKSUM
+ bool strict_check, /*!< --strict-check */
+ FILE* log_file, /*!< --log */
+#endif /* UNIV_INNOCHECKSUM */
+ ulint space,
+ ulint offset)
+ MY_ATTRIBUTE((warn_unused_result));
#endif /* fil0crypt_h */
diff --git a/storage/innobase/include/fil0crypt.ic b/storage/innobase/include/fil0crypt.ic
index fe3a21f0643..6b83521cdde 100644
--- a/storage/innobase/include/fil0crypt.ic
+++ b/storage/innobase/include/fil0crypt.ic
@@ -36,38 +36,6 @@ fil_page_is_encrypted(
}
/*******************************************************************//**
-Find out whether the page can be decrypted.
-The function for decrypting the page should already be executed before this.
-@return 1 if key provider not available or key is not available
- 0 if decryption should be possible
-*/
-UNIV_INLINE
-bool
-fil_page_encryption_status(
-/*===================*/
- const byte *buf, /*!< in: page */
- ulint space_id) /*!< in: space_id */
-{
- fil_space_crypt_t *crypt_data = fil_space_get_crypt_data(space_id);
- ulint page_type = mach_read_from_2(buf+FIL_PAGE_TYPE);
-
- if (page_type == FIL_PAGE_TYPE_FSP_HDR) {
- if (crypt_data != NULL) {
- if (!encryption_key_id_exists(crypt_data->key_id)) {
- /* accessing table would surely fail, because no key or no key provider available */
- return 1;
- }
- }
- } else {
- unsigned key = mach_read_from_4(buf + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION);
- if (!encryption_key_version_exists(crypt_data->key_id, key)) {
- return 1;
- }
- }
- return 0;
-}
-
-/*******************************************************************//**
Get current encryption mode from crypt_data.
@return string representation */
UNIV_INLINE
@@ -76,22 +44,16 @@ fil_crypt_get_mode(
/*===============*/
const fil_space_crypt_t* crypt_data)
{
- ut_ad(crypt_data != NULL);
-
- switch(crypt_data->encryption) {
- case FIL_SPACE_ENCRYPTION_DEFAULT:
+ switch (crypt_data->encryption) {
+ case FIL_ENCRYPTION_DEFAULT:
return("Default tablespace encryption mode");
- break;
- case FIL_SPACE_ENCRYPTION_ON:
+ case FIL_ENCRYPTION_ON:
return("Tablespace encrypted");
- break;
- case FIL_SPACE_ENCRYPTION_OFF:
+ case FIL_ENCRYPTION_OFF:
return("Tablespace not encrypted");
- break;
- default:
- ut_error;
}
+ ut_error;
return ("NULL");
}
diff --git a/storage/innobase/include/fil0fil.h b/storage/innobase/include/fil0fil.h
index 66d79bd24b5..abd9ff9a9ed 100644
--- a/storage/innobase/include/fil0fil.h
+++ b/storage/innobase/include/fil0fil.h
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2017, 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
@@ -28,6 +28,8 @@ Created 10/25/1995 Heikki Tuuri
#define fil0fil_h
#include "univ.i"
+struct fil_space_t;
+
#ifndef UNIV_INNOCHECKSUM
#include "log0recv.h"
@@ -43,11 +45,11 @@ struct trx_t;
class page_id_t;
class truncate_t;
-/* structure containing encryption specification */
-typedef struct fil_space_crypt_struct fil_space_crypt_t;
-
typedef std::list<char*, ut_allocator<char*> > space_name_list_t;
+/** Structure containing encryption specification */
+struct fil_space_crypt_t;
+
/** File types */
enum fil_type_t {
/** temporary tablespace (temporary undo log or tables) */
@@ -163,9 +165,13 @@ struct fil_space_t {
unflushed_spaces */
UT_LIST_NODE_T(fil_space_t) space_list;
/*!< list of all spaces */
+ /** other tablespaces needing key rotation */
+ UT_LIST_NODE_T(fil_space_t) rotation_list;
+ /** whether this tablespace needs key rotation */
+ bool is_in_rotation_list;
/** MariaDB encryption data */
- fil_space_crypt_t* crypt_data;
+ fil_space_crypt_t* crypt_data;
/** tablespace crypt data has been read */
bool page_0_crypt_read;
@@ -173,11 +179,8 @@ struct fil_space_t {
/** True if we have already printed compression failure */
bool printed_compression_failure;
- /** True if page 0 of tablespace is read */
- bool read_page0;
-
- /** True if the device this filespace is on supports atomic writes */
- bool atomic_write_supported;
+ /** True if the device this filespace is on supports atomic writes */
+ bool atomic_write_supported;
/** Release the reserved free extents.
@param[in] n_reserved number of reserved extents */
@@ -188,6 +191,13 @@ struct fil_space_t {
bool punch_hole;
ulint magic_n;/*!< FIL_SPACE_MAGIC_N */
+
+ /** @return whether the tablespace is about to be dropped or
+ truncated */
+ bool is_stopping() const
+ {
+ return stop_new_ops || is_being_truncated;
+ }
};
/** Value of fil_space_t::magic_n */
@@ -419,6 +429,16 @@ index */
#ifndef UNIV_INNOCHECKSUM
+/** Enum values for encryption table option */
+enum fil_encryption_t {
+ /** Encrypted if innodb_encrypt_tables=ON (srv_encrypt_tables) */
+ FIL_ENCRYPTION_DEFAULT,
+ /** Encrypted */
+ FIL_ENCRYPTION_ON,
+ /** Not encrypted */
+ FIL_ENCRYPTION_OFF
+};
+
/** The number of fsyncs done to the log */
extern ulint fil_n_log_flushes;
@@ -490,6 +510,10 @@ struct fil_system_t {
record has been written since
the latest redo log checkpoint.
Protected only by log_sys->mutex. */
+ UT_LIST_BASE_NODE_T(fil_space_t) rotation_list;
+ /*!< list of all file spaces needing
+ key rotation.*/
+
ibool space_id_reuse_warned;
/* !< TRUE if fil_space_create()
has issued a warning about
@@ -558,22 +582,25 @@ fil_node_create(
MY_ATTRIBUTE((warn_unused_result));
/** Create a space memory object and put it to the fil_system hash table.
-The tablespace name is independent from the tablespace file-name.
Error messages are issued to the server log.
-@param[in] name tablespace name
-@param[in] id tablespace identifier
-@param[in] flags tablespace flags
-@param[in] purpose tablespace purpose
+@param[in] name tablespace name
+@param[in] id tablespace identifier
+@param[in] flags tablespace flags
+@param[in] purpose tablespace purpose
+@param[in,out] crypt_data encryption information
+@param[in] create_table whether this is CREATE TABLE
+@param[in] mode encryption mode
@return pointer to created tablespace, to be filled in with fil_node_create()
@retval NULL on failure (such as when the same tablespace exists) */
fil_space_t*
fil_space_create(
- const char* name,
- ulint id,
- ulint flags,
- fil_type_t purpose, /*!< in: FIL_TABLESPACE, or FIL_LOG if log */
- fil_space_crypt_t* crypt_data, /*!< in: crypt data */
- bool create_table) /*!< in: true if create table */
+ const char* name,
+ ulint id,
+ ulint flags,
+ fil_type_t purpose,
+ fil_space_crypt_t* crypt_data,
+ bool create_table,
+ fil_encryption_t mode = FIL_ENCRYPTION_DEFAULT)
MY_ATTRIBUTE((warn_unused_result));
/*******************************************************************//**
@@ -730,6 +757,32 @@ void
fil_space_release(
fil_space_t* space);
+/** Return the next fil_space_t.
+Once started, the caller must keep calling this until it returns NULL.
+fil_space_acquire() and fil_space_release() are invoked here which
+blocks a concurrent operation from dropping the tablespace.
+@param[in,out] prev_space Pointer to the previous fil_space_t.
+If NULL, use the first fil_space_t on fil_system->space_list.
+@return pointer to the next fil_space_t.
+@retval NULL if this was the last */
+fil_space_t*
+fil_space_next(
+ fil_space_t* prev_space)
+ MY_ATTRIBUTE((warn_unused_result));
+
+/** Return the next fil_space_t from key rotation list.
+Once started, the caller must keep calling this until it returns NULL.
+fil_space_acquire() and fil_space_release() are invoked here which
+blocks a concurrent operation from dropping the tablespace.
+@param[in,out] prev_space Pointer to the previous fil_space_t.
+If NULL, use the first fil_space_t on fil_system->space_list.
+@return pointer to the next fil_space_t.
+@retval NULL if this was the last*/
+fil_space_t*
+fil_space_keyrotate_next(
+ fil_space_t* prev_space)
+ MY_ATTRIBUTE((warn_unused_result));
+
/** Wrapper with reference-counting for a fil_space_t. */
class FilSpace
{
@@ -1420,16 +1473,10 @@ fil_mtr_rename_log(
mtr_t* mtr)
MY_ATTRIBUTE((warn_unused_result));
-/****************************************************************//**
-Acquire fil_system mutex */
-void
-fil_system_enter(void);
-/*==================*/
-/****************************************************************//**
-Release fil_system mutex */
-void
-fil_system_exit(void);
-/*==================*/
+/** Acquire the fil_system mutex. */
+#define fil_system_enter() mutex_enter(&fil_system->mutex)
+/** Release the fil_system mutex. */
+#define fil_system_exit() mutex_exit(&fil_system->mutex)
/*******************************************************************//**
Returns the table space by a given id, NULL if not found. */
@@ -1445,36 +1492,6 @@ fil_space_get_by_id(
/*================*/
ulint id); /*!< in: space id */
-/******************************************************************
-Get id of first tablespace or ULINT_UNDEFINED if none */
-UNIV_INTERN
-ulint
-fil_get_first_space();
-/*=================*/
-
-/******************************************************************
-Get id of next tablespace or ULINT_UNDEFINED if none */
-UNIV_INTERN
-ulint
-fil_get_next_space(
- ulint id); /*!< in: space id */
-
-/******************************************************************
-Get id of first tablespace that has node or ULINT_UNDEFINED if none */
-UNIV_INTERN
-ulint
-fil_get_first_space_safe();
-/*======================*/
-
-/******************************************************************
-Get id of next tablespace that has node or ULINT_UNDEFINED if none */
-UNIV_INTERN
-ulint
-fil_get_next_space_safe(
-/*====================*/
- ulint id); /*!< in: previous space id */
-
-
/*******************************************************************//**
by redo log.
@param[in,out] space tablespace */
diff --git a/storage/innobase/include/fsp0types.h b/storage/innobase/include/fsp0types.h
index ec33f2e4d10..cd2a07af4f0 100644
--- a/storage/innobase/include/fsp0types.h
+++ b/storage/innobase/include/fsp0types.h
@@ -197,13 +197,6 @@ fsp_is_system_temporary(ulint space_id)
return(space_id == SRV_TMP_SPACE_ID);
}
-/** Check if checksum is disabled for the given space.
-@param[in] space_id verify is checksum is enabled for given space.
-@return true if checksum is disabled for given space. */
-bool
-fsp_is_checksum_disabled(
- ulint space_id);
-
#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
diff --git a/storage/innobase/include/ha_prototypes.h b/storage/innobase/include/ha_prototypes.h
index f4446ca32d2..6992f4a6689 100644
--- a/storage/innobase/include/ha_prototypes.h
+++ b/storage/innobase/include/ha_prototypes.h
@@ -137,6 +137,13 @@ thd_has_edited_nontrans_tables(
/*===========================*/
THD* thd); /*!< in: thread handle */
+/**
+Get high resolution timestamp for the current query start time.
+
+@retval timestamp in microseconds precision
+*/
+unsigned long long thd_query_start_micro(const MYSQL_THD thd);
+
/*************************************************************//**
Prints info of a THD object (== user session thread) to the given file. */
void
diff --git a/storage/innobase/include/mach0data.ic b/storage/innobase/include/mach0data.ic
index 6c879b38354..34d375aa1e8 100644
--- a/storage/innobase/include/mach0data.ic
+++ b/storage/innobase/include/mach0data.ic
@@ -38,7 +38,6 @@ mach_write_to_1(
byte* b, /*!< in: pointer to byte where to store */
ulint n) /*!< in: ulint integer to be stored, >= 0, < 256 */
{
- ut_ad(b);
ut_ad((n & ~0xFFUL) == 0);
b[0] = (byte) n;
@@ -56,7 +55,6 @@ mach_write_to_2(
byte* b, /*!< in: pointer to two bytes where to store */
ulint n) /*!< in: ulint integer to be stored */
{
- ut_ad(b);
ut_ad((n & ~0xFFFFUL) == 0);
b[0] = (byte)(n >> 8);
@@ -71,7 +69,6 @@ uint8_t
mach_read_from_1(
const byte* b)
{
- ut_ad(b);
return(uint8_t(*b));
}
@@ -130,7 +127,6 @@ mach_write_to_3(
byte* b, /*!< in: pointer to 3 bytes where to store */
ulint n) /*!< in: ulint integer to be stored */
{
- ut_ad(b);
ut_ad((n & ~0xFFFFFFUL) == 0);
b[0] = (byte)(n >> 16);
@@ -147,7 +143,6 @@ uint32_t
mach_read_from_3(
const byte* b)
{
- ut_ad(b);
return( (static_cast<uint32_t>(b[0]) << 16)
| (static_cast<uint32_t>(b[1]) << 8)
| static_cast<uint32_t>(b[2])
@@ -165,8 +160,6 @@ mach_write_to_4(
byte* b, /*!< in: pointer to four bytes where to store */
ulint n) /*!< in: ulint integer to be stored */
{
- ut_ad(b);
-
b[0] = (byte)(n >> 24);
b[1] = (byte)(n >> 16);
b[2] = (byte)(n >> 8);
@@ -182,7 +175,6 @@ uint32_t
mach_read_from_4(
const byte* b)
{
- ut_ad(b);
return( (static_cast<uint32_t>(b[0]) << 24)
| (static_cast<uint32_t>(b[1]) << 16)
| (static_cast<uint32_t>(b[2]) << 8)
@@ -207,8 +199,6 @@ mach_write_compressed(
byte* b, /*!< in: pointer to memory where to store */
ulint n) /*!< in: ulint integer (< 2^32) to be stored */
{
- ut_ad(b);
-
if (n < 0x80) {
/* 0nnnnnnn (7 bits) */
mach_write_to_1(b, n);
@@ -271,8 +261,6 @@ mach_read_compressed(
{
ulint val;
- ut_ad(b);
-
val = mach_read_from_1(b);
if (val < 0x80) {
@@ -349,8 +337,6 @@ mach_write_to_8(
void* b, /*!< in: pointer to 8 bytes where to store */
ib_uint64_t n) /*!< in: 64-bit integer to be stored */
{
- ut_ad(b);
-
mach_write_to_4(static_cast<byte*>(b), (ulint) (n >> 32));
mach_write_to_4(static_cast<byte*>(b) + 4, (ulint) n);
}
@@ -388,8 +374,6 @@ mach_write_to_7(
byte* b, /*!< in: pointer to 7 bytes where to store */
ib_uint64_t n) /*!< in: 56-bit integer */
{
- ut_ad(b);
-
mach_write_to_3(b, (ulint) (n >> 32));
mach_write_to_4(b + 3, (ulint) n);
}
@@ -404,8 +388,6 @@ mach_read_from_7(
/*=============*/
const byte* b) /*!< in: pointer to 7 bytes */
{
- ut_ad(b);
-
return(ut_ull_create(mach_read_from_3(b), mach_read_from_4(b + 3)));
}
@@ -419,8 +401,6 @@ mach_write_to_6(
byte* b, /*!< in: pointer to 6 bytes where to store */
ib_uint64_t n) /*!< in: 48-bit integer */
{
- ut_ad(b);
-
mach_write_to_2(b, (ulint) (n >> 32));
mach_write_to_4(b + 2, (ulint) n);
}
@@ -435,8 +415,6 @@ mach_read_from_6(
/*=============*/
const byte* b) /*!< in: pointer to 6 bytes */
{
- ut_ad(b);
-
return(ut_ull_create(mach_read_from_2(b), mach_read_from_4(b + 2)));
}
@@ -450,11 +428,7 @@ mach_u64_write_compressed(
byte* b, /*!< in: pointer to memory where to store */
ib_uint64_t n) /*!< in: 64-bit integer to be stored */
{
- ulint size;
-
- ut_ad(b);
-
- size = mach_write_compressed(b, (ulint) (n >> 32));
+ ulint size = mach_write_compressed(b, (ulint) (n >> 32));
mach_write_to_4(b + size, (ulint) n);
return(size + 4);
@@ -490,8 +464,6 @@ mach_u64_write_much_compressed(
{
ulint size;
- ut_ad(b);
-
if (!(n >> 32)) {
return(mach_write_compressed(b, (ulint) n));
}
diff --git a/storage/innobase/include/os0file.h b/storage/innobase/include/os0file.h
index f37e735de4d..6a82c06e3ed 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, 2017, MariaDB Corporation. All Rights Reserved.
+Copyright (c) 2013, 2017, MariaDB Corporation.
Portions of this file contain modifications contributed and copyrighted
by Percona Inc.. Those modifications are
diff --git a/storage/innobase/include/page0page.ic b/storage/innobase/include/page0page.ic
index 3940931125e..7250a96bb5d 100644
--- a/storage/innobase/include/page0page.ic
+++ b/storage/innobase/include/page0page.ic
@@ -218,7 +218,6 @@ page_header_get_offs(
{
ulint offs;
- ut_ad(page);
ut_ad((field == PAGE_FREE)
|| (field == PAGE_LAST_INSERT)
|| (field == PAGE_HEAP_TOP));
diff --git a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0srv.h
index dd77738584b..e469cd90737 100644
--- a/storage/innobase/include/srv0srv.h
+++ b/storage/innobase/include/srv0srv.h
@@ -3,7 +3,7 @@
Copyright (c) 1995, 2016, Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2008, 2009, Google Inc.
Copyright (c) 2009, Percona Inc.
-Copyright (c) 2013, 2017, MariaDB Corporation. All Rights Reserved.
+Copyright (c) 2013, 2017, MariaDB Corporation.
Portions of this file contain modifications contributed and copyrighted by
Google, Inc. Those modifications are gratefully acknowledged and are described
@@ -181,6 +181,9 @@ struct srv_stats_t {
/** Number of log scrub operations */
ulint_ctr_64_t n_log_scrubs;
+
+ /** Number of spaces in keyrotation list */
+ ulint_ctr_64_t key_rotation_list_length;
};
extern const char* srv_main_thread_op_info;
@@ -1050,6 +1053,7 @@ struct export_var_t{
ulint innodb_encryption_rotation_pages_flushed;
ulint innodb_encryption_rotation_estimated_iops;
int64_t innodb_encryption_key_requests;
+ int64_t innodb_key_rotation_list_length;
ulint innodb_scrub_page_reorganizations;
ulint innodb_scrub_page_splits;
diff --git a/storage/innobase/include/trx0trx.h b/storage/innobase/include/trx0trx.h
index 7d9db25ddce..2b42d15731d 100644
--- a/storage/innobase/include/trx0trx.h
+++ b/storage/innobase/include/trx0trx.h
@@ -1104,8 +1104,8 @@ struct trx_t {
time_t start_time; /*!< time the state last time became
TRX_STATE_ACTIVE */
- clock_t start_time_micro; /*!< start time of the transaction
- in microseconds. */
+ ib_uint64_t start_time_micro; /*!< start time of transaction in
+ microseconds */
lsn_t commit_lsn; /*!< lsn at the time of the commit */
table_id_t table_id; /*!< Table to drop iff dict_operation
== TRX_DICT_OP_TABLE, or 0. */
diff --git a/storage/innobase/include/ut0ut.h b/storage/innobase/include/ut0ut.h
index bf127517051..3027004dbaf 100644
--- a/storage/innobase/include/ut0ut.h
+++ b/storage/innobase/include/ut0ut.h
@@ -72,9 +72,7 @@ typedef time_t ib_time_t;
# define UT_RELAX_CPU() YieldProcessor()
#elif defined(__powerpc__) && defined __GLIBC__
# include <sys/platform/ppc.h>
-# define UT_RELAX_CPU() do { \
- volatile lint volatile_var = __ppc_get_timebase(); \
- } while (0)
+# define UT_RELAX_CPU() __ppc_get_timebase()
#else
# define UT_RELAX_CPU() do { \
volatile int32 volatile_var; \
diff --git a/storage/innobase/lock/lock0lock.cc b/storage/innobase/lock/lock0lock.cc
index a37ad19e81d..134853dd0d7 100644
--- a/storage/innobase/lock/lock0lock.cc
+++ b/storage/innobase/lock/lock0lock.cc
@@ -800,7 +800,7 @@ lock_reset_lock_and_trx_wait(
stmt2 = innobase_get_stmt_unsafe(lock->trx->lock.wait_lock->trx->mysql_thd, &stmt_len);
}
- ib::info() <<
+ ib::error() <<
"Trx id " << lock->trx->id
<< " is waiting a lock in statement "
<< (stmt ? stmt : "NULL")
@@ -808,7 +808,7 @@ lock_reset_lock_and_trx_wait(
<< " and statement "
<< (stmt2 ? stmt2 : "NULL")
<< "wait_lock " << lock->trx->lock.wait_lock;
- ut_ad(lock->trx->lock.wait_lock != lock);
+ ut_ad(0);
}
lock->trx->lock.wait_lock = NULL;
diff --git a/storage/innobase/log/log0recv.cc b/storage/innobase/log/log0recv.cc
index e6d6f4b0af2..adf2d3aca0a 100644
--- a/storage/innobase/log/log0recv.cc
+++ b/storage/innobase/log/log0recv.cc
@@ -1495,7 +1495,7 @@ parse_log:
}
break;
case MLOG_FILE_WRITE_CRYPT_DATA:
- ptr = fil_parse_write_crypt_data(ptr, end_ptr, block);
+ ptr = const_cast<byte*>(fil_parse_write_crypt_data(ptr, end_ptr, block));
break;
default:
ptr = NULL;
@@ -1911,7 +1911,7 @@ recv_recover_page(bool just_read_in, buf_block_t* block)
ib_time_t time = ut_time();
- mutex_enter(&(recv_sys->mutex));
+ mutex_enter(&recv_sys->mutex);
if (recv_max_page_lsn < page_lsn) {
recv_max_page_lsn = page_lsn;
@@ -2013,9 +2013,8 @@ recv_apply_hashed_log_recs(bool last_batch)
recv_sys->apply_batch_on = TRUE;
for (ulint i = 0; i < hash_get_n_cells(recv_sys->addr_hash); i++) {
-
for (recv_addr_t* recv_addr = static_cast<recv_addr_t*>(
- HASH_GET_FIRST(recv_sys->addr_hash, i));
+ HASH_GET_FIRST(recv_sys->addr_hash, i));
recv_addr;
recv_addr = static_cast<recv_addr_t*>(
HASH_GET_NEXT(addr_hash, recv_addr))) {
@@ -2064,7 +2063,7 @@ recv_apply_hashed_log_recs(bool last_batch)
recv_read_in_area(page_id);
}
- mutex_enter(&(recv_sys->mutex));
+ mutex_enter(&recv_sys->mutex);
}
}
}
diff --git a/storage/innobase/os/os0file.cc b/storage/innobase/os/os0file.cc
index 7c118bde46d..43f04186f0e 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, 2017, MariaDB Corporation. All Rights Reserved.
+Copyright (c) 2012, 2017, MariaDB Corporation.
Portions of this file contain modifications contributed and copyrighted
by Percona Inc.. Those modifications are
@@ -678,22 +678,22 @@ static ulint os_aio_n_segments = ULINT_UNDEFINED;
/** If the following is true, read i/o handler threads try to
wait until a batch of new read requests have been posted */
-static bool os_aio_recommend_sleep_for_read_threads = false;
-
-ulint os_n_file_reads = 0;
-static ulint os_bytes_read_since_printout = 0;
-ulint os_n_file_writes = 0;
-ulint os_n_fsyncs = 0;
-static ulint os_n_file_reads_old = 0;
-static ulint os_n_file_writes_old = 0;
-static ulint os_n_fsyncs_old = 0;
+static bool os_aio_recommend_sleep_for_read_threads;
+
+ulint os_n_file_reads;
+static ulint os_bytes_read_since_printout;
+ulint os_n_file_writes;
+ulint os_n_fsyncs;
+static ulint os_n_file_reads_old;
+static ulint os_n_file_writes_old;
+static ulint os_n_fsyncs_old;
/** Number of pending write operations */
-ulint os_n_pending_writes = 0;
+ulint os_n_pending_writes;
/** Number of pending read operations */
-ulint os_n_pending_reads = 0;
+ulint os_n_pending_reads;
static time_t os_last_printout;
-bool os_has_said_disk_full = false;
+bool os_has_said_disk_full;
/** Default Zip compression level */
extern uint page_zip_level;
@@ -6085,9 +6085,7 @@ void
os_aio_wake_all_threads_at_shutdown()
{
#ifdef WIN_ASYNC_IO
-
AIO::wake_at_shutdown();
-
#elif defined(LINUX_NATIVE_AIO)
/* When using native AIO interface the io helper threads
wait on io_getevents with a timeout value of 500ms. At
diff --git a/storage/innobase/page/page0page.cc b/storage/innobase/page/page0page.cc
index 437b6c01a41..3765f8112a1 100644
--- a/storage/innobase/page/page0page.cc
+++ b/storage/innobase/page/page0page.cc
@@ -1493,7 +1493,6 @@ page_dir_split_slot(
ulint i;
ulint n_owned;
- ut_ad(page);
ut_ad(!page_zip || page_is_comp(page));
ut_ad(slot_no > 0);
@@ -1554,7 +1553,6 @@ page_dir_balance_slot(
rec_t* old_rec;
rec_t* new_rec;
- ut_ad(page);
ut_ad(!page_zip || page_is_comp(page));
ut_ad(slot_no > 0);
diff --git a/storage/innobase/pars/pars0pars.cc b/storage/innobase/pars/pars0pars.cc
index 39fd84a2b96..21325cac12a 100644
--- a/storage/innobase/pars/pars0pars.cc
+++ b/storage/innobase/pars/pars0pars.cc
@@ -1931,7 +1931,7 @@ pars_create_table(
}
node = tab_create_graph_create(table, pars_sym_tab_global->heap,
- FIL_SPACE_ENCRYPTION_DEFAULT, FIL_DEFAULT_ENCRYPTION_KEY);
+ FIL_ENCRYPTION_DEFAULT, FIL_DEFAULT_ENCRYPTION_KEY);
table_sym->resolved = TRUE;
table_sym->token_type = SYM_TABLE;
diff --git a/storage/innobase/row/row0ftsort.cc b/storage/innobase/row/row0ftsort.cc
index 0bf38503a2c..19e1ba926d0 100644
--- a/storage/innobase/row/row0ftsort.cc
+++ b/storage/innobase/row/row0ftsort.cc
@@ -225,7 +225,14 @@ row_fts_psort_info_init(
common_info->sort_event = os_event_create(0);
common_info->merge_event = os_event_create(0);
common_info->opt_doc_id_size = opt_doc_id_size;
- crypt_data = fil_space_get_crypt_data(new_table->space);
+
+ /* Theoretically the tablespace can be dropped straight away.
+ In practice, the DDL completion will wait for this thread to
+ finish. */
+ if (fil_space_t* space = fil_space_acquire(new_table->space)) {
+ crypt_data = space->crypt_data;
+ fil_space_release(space);
+ }
if (crypt_data && crypt_data->should_encrypt()) {
common_info->crypt_data = crypt_data;
diff --git a/storage/innobase/row/row0import.cc b/storage/innobase/row/row0import.cc
index 9bd5cedc8bb..b70a1952f97 100644
--- a/storage/innobase/row/row0import.cc
+++ b/storage/innobase/row/row0import.cc
@@ -1958,14 +1958,16 @@ PageConverter::validate(
buf_block_t* block) UNIV_NOTHROW
{
buf_frame_t* page = get_frame(block);
+ ulint space_id = mach_read_from_4(
+ page + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID);
+ fil_space_t* space = fil_space_found_by_id(space_id);
/* Check that the page number corresponds to the offset in
the file. Flag as corrupt if it doesn't. Disable the check
for LSN in buf_page_is_corrupted() */
if (buf_page_is_corrupted(
- false, page, get_page_size(),
- fsp_is_checksum_disabled(block->page.id.space()))
+ false, page, get_page_size(), space)
|| (page_get_page_no(page) != offset / m_page_size.physical()
&& page_get_page_no(page) != 0)) {
@@ -2028,9 +2030,7 @@ PageConverter::operator() (
!is_compressed_table()
? block->frame : block->page.zip.data,
!is_compressed_table() ? 0 : m_page_zip_ptr,
- m_current_lsn,
- fsp_is_checksum_disabled(
- block->page.id.space()));
+ m_current_lsn);
} else {
/* Calculate and update the checksum of non-btree
pages for compressed tables explicitly here. */
diff --git a/storage/innobase/row/row0merge.cc b/storage/innobase/row/row0merge.cc
index ef832c38b95..85f0ce2c9e6 100644
--- a/storage/innobase/row/row0merge.cc
+++ b/storage/innobase/row/row0merge.cc
@@ -298,13 +298,13 @@ row_merge_encrypt_buf(
space, ofs, 0);
if (! ((rc == MY_AES_OK) && ((ulint)dstlen == srv_sort_buf_size-ROW_MERGE_RESERVE_SIZE))) {
- ib::error()
+ ib::fatal()
<< "Unable to encrypt data-block "
- " src: %p srclen: %lu buf: %p buflen: %u."
- << srv_sort_buf_size << " buf: " << crypted_buf
+ " src: " << static_cast<const void*>(input_buf)
+ << " srclen: " << srv_sort_buf_size
+ << " buf: " << static_cast<const void*>(crypted_buf)
<< " buflen: " << dstlen
- << " return-code: " << rc << " Can't continue!";
- ut_error;
+ << ". return-code: " << rc << ". Can't continue!";
}
}
@@ -340,13 +340,13 @@ row_merge_decrypt_buf(
space, ofs, 0);
if (! ((rc == MY_AES_OK) && ((ulint)dstlen == srv_sort_buf_size-ROW_MERGE_RESERVE_SIZE))) {
- ib::error()
+ ib::fatal()
<< "Unable to decrypt data-block "
- << " src: " << input_buf << " srclen: "
- << srv_sort_buf_size << " buf: " << crypted_buf
+ << " src: " << static_cast<const void*>(input_buf)
+ << " srclen: " << srv_sort_buf_size
+ << " buf: " << static_cast<const void*>(crypted_buf)
<< " buflen: " << dstlen
- << " return-code: " << rc << " Can't continue!";
- ut_error;
+ << ". return-code: " << rc << ". Can't continue!";
}
return true;
@@ -1268,14 +1268,8 @@ row_merge_read_rec(
ulint data_size;
ulint avail_size;
- ut_ad(block);
- ut_ad(buf);
ut_ad(b >= &block[0]);
ut_ad(b < &block[srv_sort_buf_size]);
- ut_ad(index);
- ut_ad(foffs);
- ut_ad(mrec);
- ut_ad(offsets);
ut_ad(*offsets == 1 + REC_OFFS_HEADER_SIZE
+ dict_index_get_n_fields(index));
@@ -4627,7 +4621,7 @@ row_merge_build_indexes(
row_merge_block_t* block;
ut_new_pfx_t block_pfx;
ut_new_pfx_t crypt_pfx;
- row_merge_block_t* crypt_block;
+ row_merge_block_t* crypt_block = NULL;
ulint i;
ulint j;
dberr_t error;
@@ -4668,9 +4662,15 @@ row_merge_build_indexes(
DBUG_RETURN(DB_OUT_OF_MEMORY);
}
- /* Get crypt data from tablespace if present. */
- crypt_data = fil_space_get_crypt_data(new_table->space);
- crypt_block = NULL;
+ /* Get crypt data from tablespace if present. We should be protected
+ from concurrent DDL (e.g. drop table) by MDL-locks. */
+ FilSpace space(new_table->space);
+
+ if (const fil_space_t* fs = space()) {
+ crypt_data = fs->crypt_data;
+ } else {
+ DBUG_RETURN(DB_TABLESPACE_NOT_FOUND);
+ }
/* If tablespace is encrypted, allocate additional buffer for
encryption/decryption. */
diff --git a/storage/innobase/row/row0mysql.cc b/storage/innobase/row/row0mysql.cc
index d3fb6db880c..8b7c64868b8 100644
--- a/storage/innobase/row/row0mysql.cc
+++ b/storage/innobase/row/row0mysql.cc
@@ -3434,9 +3434,6 @@ fil_wait_crypt_bg_threads(
{
time_t start = time(0);
time_t last = start;
- if (table->space != 0) {
- fil_space_crypt_mark_space_closing(table->space, table->crypt_data);
- }
while (table->get_ref_count()> 0) {
dict_mutex_exit_for_mysql();
@@ -3448,14 +3445,14 @@ fil_wait_crypt_bg_threads(
ib::warn()
<< "Waited " << now - start
<< " seconds for ref-count on table: "
- << table->name.m_name << " space: " << table->space;
+ << table->name << " space: " << table->space;
last = now;
}
if (now >= start + 300) {
ib::warn()
<< "After " << now - start
<< " seconds, gave up waiting "
- << "for ref-count on table: " << table->name.m_name
+ << "for ref-count on table: " << table->name
<< " space: " << table->space;
break;
}
@@ -3905,7 +3902,14 @@ row_drop_table_for_mysql(
/* If table has not yet have crypt_data, try to read it to
make freeing the table easier. */
if (!table->crypt_data) {
- table->crypt_data = fil_space_get_crypt_data(table->space);
+ if (fil_space_t* space = fil_space_acquire_silent(
+ table->space)) {
+ /* We use crypt data in dict_table_t
+ in ha_innodb.cc to push warnings to
+ user thread. */
+ table->crypt_data = space->crypt_data;
+ fil_space_release(space);
+ }
}
/* We use the private SQL parser of Innobase to generate the
diff --git a/storage/innobase/row/row0trunc.cc b/storage/innobase/row/row0trunc.cc
index 152970d9413..46cff288059 100644
--- a/storage/innobase/row/row0trunc.cc
+++ b/storage/innobase/row/row0trunc.cc
@@ -2274,7 +2274,7 @@ truncate_t::truncate_t(
m_log_lsn(),
m_log_file_name(),
/* JAN: TODO: Encryption */
- m_encryption(FIL_SPACE_ENCRYPTION_DEFAULT),
+ m_encryption(FIL_ENCRYPTION_DEFAULT),
m_key_id(FIL_DEFAULT_ENCRYPTION_KEY)
{
if (dir_path != NULL) {
@@ -2301,7 +2301,7 @@ truncate_t::truncate_t(
m_log_lsn(),
m_log_file_name(),
/* JAN: TODO: Encryption */
- m_encryption(FIL_SPACE_ENCRYPTION_DEFAULT),
+ m_encryption(FIL_ENCRYPTION_DEFAULT),
m_key_id(FIL_DEFAULT_ENCRYPTION_KEY)
{
diff --git a/storage/innobase/row/row0upd.cc b/storage/innobase/row/row0upd.cc
index 9c159c6bd15..18ea3cf3cf8 100644
--- a/storage/innobase/row/row0upd.cc
+++ b/storage/innobase/row/row0upd.cc
@@ -1285,8 +1285,6 @@ row_upd_index_replace_new_col_vals_index_pos(
ulint n_fields;
const page_size_t& page_size = dict_table_page_size(index->table);
- ut_ad(index);
-
dtuple_set_info_bits(entry, update->info_bits);
if (order_only) {
@@ -1637,8 +1635,6 @@ row_upd_changes_ord_field_binary_func(
ulint i;
const dict_index_t* clust_index;
- ut_ad(index);
- ut_ad(update);
ut_ad(thr);
ut_ad(thr->graph);
ut_ad(thr->graph->trx);
diff --git a/storage/innobase/srv/srv0srv.cc b/storage/innobase/srv/srv0srv.cc
index 728a5415be9..b689cd012c6 100644
--- a/storage/innobase/srv/srv0srv.cc
+++ b/storage/innobase/srv/srv0srv.cc
@@ -954,14 +954,12 @@ srv_release_threads(enum srv_thread_type type, ulint n)
ut_ad(n > 0);
do {
- srv_sys_mutex_enter();
-
running = 0;
- for (ulint i = 0; i < srv_sys->n_sys_threads; i++) {
- srv_slot_t* slot;
+ srv_sys_mutex_enter();
- slot = &srv_sys->sys_threads[i];
+ for (ulint i = 0; i < srv_sys->n_sys_threads; i++) {
+ srv_slot_t* slot = &srv_sys->sys_threads[i];
if (!slot->in_use || srv_slot_get_type(slot) != type) {
continue;
@@ -1692,6 +1690,8 @@ srv_export_innodb_status(void)
crypt_stat.estimated_iops;
export_vars.innodb_encryption_key_requests =
srv_stats.n_key_requests;
+ export_vars.innodb_key_rotation_list_length =
+ srv_stats.key_rotation_list_length;
export_vars.innodb_scrub_page_reorganizations =
scrub_stat.page_reorganizations;
diff --git a/storage/innobase/srv/srv0start.cc b/storage/innobase/srv/srv0start.cc
index 077b93e9327..7c16ce1e58f 100644
--- a/storage/innobase/srv/srv0start.cc
+++ b/storage/innobase/srv/srv0start.cc
@@ -3,7 +3,7 @@
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2008, Google Inc.
Copyright (c) 2009, Percona Inc.
-Copyright (c) 2013, 2017, MariaDB Corporation
+Copyright (c) 2013, 2017, MariaDB Corporation.
Portions of this file contain modifications contributed and copyrighted by
Google, Inc. Those modifications are gratefully acknowledged and are described
@@ -450,6 +450,7 @@ create_log_files(
"innodb_redo_log", SRV_LOG_SPACE_FIRST_ID, 0, FIL_TYPE_LOG,
NULL, /* innodb_encrypt_log works at a different level */
true /* this is create */);
+
ut_a(fil_validate());
ut_a(log_space != NULL);
@@ -541,9 +542,10 @@ create_log_files_rename(
DBUG_EXECUTE_IF("innodb_log_abort_10", err = DB_ERROR;);
- fil_open_log_and_system_tablespace_files();
-
- ib::info() << "New log files created, LSN=" << lsn;
+ if (err == DB_SUCCESS) {
+ fil_open_log_and_system_tablespace_files();
+ ib::info() << "New log files created, LSN=" << lsn;
+ }
return(err);
}
diff --git a/storage/innobase/trx/trx0trx.cc b/storage/innobase/trx/trx0trx.cc
index f7a488d7507..4374041982c 100644
--- a/storage/innobase/trx/trx0trx.cc
+++ b/storage/innobase/trx/trx0trx.cc
@@ -1464,7 +1464,8 @@ trx_start_low(
ut_a(trx->error_state == DB_SUCCESS);
- trx->start_time_micro = clock();
+ trx->start_time_micro =
+ trx->mysql_thd ? thd_query_start_micro(trx->mysql_thd) : 0;
MONITOR_INC(MONITOR_TRX_ACTIVE);
}
diff --git a/storage/innobase/trx/trx0undo.cc b/storage/innobase/trx/trx0undo.cc
index d92f6641910..92e18c1c372 100644
--- a/storage/innobase/trx/trx0undo.cc
+++ b/storage/innobase/trx/trx0undo.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2017, 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
diff --git a/storage/maria/ft_maria.c b/storage/maria/ft_maria.c
index b1b24592593..4a5c660af6d 100644
--- a/storage/maria/ft_maria.c
+++ b/storage/maria/ft_maria.c
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
/* Written by Sergei A. Golubchik, who has a shared copyright to this code */
diff --git a/storage/maria/ha_maria.cc b/storage/maria/ha_maria.cc
index 41d9ac840f9..b3fbc15c1a3 100644
--- a/storage/maria/ha_maria.cc
+++ b/storage/maria/ha_maria.cc
@@ -1,6 +1,6 @@
/* Copyright (C) 2004-2008 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
Copyright (C) 2008-2009 Sun Microsystems, Inc.
- Copyright (c) 2009, 2014, SkySQL Ab.
+ Copyright (c) 2009, 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
@@ -13,7 +13,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#ifdef USE_PRAGMA_IMPLEMENTATION
@@ -1290,75 +1290,75 @@ int ha_maria::write_row(uchar * buf)
int ha_maria::check(THD * thd, HA_CHECK_OPT * check_opt)
{
int error;
- HA_CHECK &param= *(HA_CHECK*) thd->alloc(sizeof(param));
+ HA_CHECK *param= (HA_CHECK*) thd->alloc(sizeof *param);
MARIA_SHARE *share= file->s;
const char *old_proc_info;
TRN *old_trn= file->trn;
- if (!file || !&param) return HA_ADMIN_INTERNAL_ERROR;
+ if (!file || !param) return HA_ADMIN_INTERNAL_ERROR;
- maria_chk_init(&param);
- param.thd= thd;
- param.op_name= "check";
- param.db_name= table->s->db.str;
- param.table_name= table->alias.c_ptr();
- param.testflag= check_opt->flags | T_CHECK | T_SILENT;
- param.stats_method= (enum_handler_stats_method)THDVAR(thd,stats_method);
+ maria_chk_init(param);
+ param->thd= thd;
+ param->op_name= "check";
+ param->db_name= table->s->db.str;
+ param->table_name= table->alias.c_ptr();
+ param->testflag= check_opt->flags | T_CHECK | T_SILENT;
+ param->stats_method= (enum_handler_stats_method)THDVAR(thd,stats_method);
if (!(table->db_stat & HA_READ_ONLY))
- param.testflag |= T_STATISTICS;
- param.using_global_keycache= 1;
+ param->testflag |= T_STATISTICS;
+ param->using_global_keycache= 1;
if (!maria_is_crashed(file) &&
- (((param.testflag & T_CHECK_ONLY_CHANGED) &&
+ (((param->testflag & T_CHECK_ONLY_CHANGED) &&
!(share->state.changed & (STATE_CHANGED | STATE_CRASHED_FLAGS |
STATE_IN_REPAIR)) &&
share->state.open_count == 0) ||
- ((param.testflag & T_FAST) && (share->state.open_count ==
+ ((param->testflag & T_FAST) && (share->state.open_count ==
(uint) (share->global_changed ? 1 :
0)))))
return HA_ADMIN_ALREADY_DONE;
- maria_chk_init_for_check(&param, file);
+ maria_chk_init_for_check(param, file);
if ((file->s->state.changed & (STATE_CRASHED_FLAGS | STATE_MOVED)) ==
STATE_MOVED)
{
- _ma_check_print_error(&param, "%s", zerofill_error_msg);
+ _ma_check_print_error(param, "%s", zerofill_error_msg);
return HA_ADMIN_CORRUPT;
}
old_proc_info= thd_proc_info(thd, "Checking status");
thd_progress_init(thd, 3);
- error= maria_chk_status(&param, file); // Not fatal
- if (maria_chk_size(&param, file))
+ error= maria_chk_status(param, file); // Not fatal
+ if (maria_chk_size(param, file))
error= 1;
if (!error)
- error|= maria_chk_del(&param, file, param.testflag);
+ error|= maria_chk_del(param, file, param->testflag);
thd_proc_info(thd, "Checking keys");
thd_progress_next_stage(thd);
if (!error)
- error= maria_chk_key(&param, file);
+ error= maria_chk_key(param, file);
thd_proc_info(thd, "Checking data");
thd_progress_next_stage(thd);
if (!error)
{
- if ((!(param.testflag & T_QUICK) &&
+ if ((!(param->testflag & T_QUICK) &&
((share->options &
(HA_OPTION_PACK_RECORD | HA_OPTION_COMPRESS_RECORD)) ||
- (param.testflag & (T_EXTEND | T_MEDIUM)))) || maria_is_crashed(file))
+ (param->testflag & (T_EXTEND | T_MEDIUM)))) || maria_is_crashed(file))
{
- ulonglong old_testflag= param.testflag;
- param.testflag |= T_MEDIUM;
- if (!(error= init_io_cache(&param.read_cache, file->dfile.file,
+ ulonglong old_testflag= param->testflag;
+ param->testflag |= T_MEDIUM;
+ if (!(error= init_io_cache(&param->read_cache, file->dfile.file,
my_default_record_cache_size, READ_CACHE,
share->pack.header_length, 1, MYF(MY_WME))))
{
- error= maria_chk_data_link(&param, file,
- MY_TEST(param.testflag & T_EXTEND));
- end_io_cache(&(param.read_cache));
+ error= maria_chk_data_link(param, file,
+ MY_TEST(param->testflag & T_EXTEND));
+ end_io_cache(&param->read_cache);
}
- param.testflag= old_testflag;
+ param->testflag= old_testflag;
}
}
if (!error)
@@ -1366,7 +1366,7 @@ int ha_maria::check(THD * thd, HA_CHECK_OPT * check_opt)
if ((share->state.changed & (STATE_CHANGED |
STATE_CRASHED_FLAGS |
STATE_IN_REPAIR | STATE_NOT_ANALYZED)) ||
- (param.testflag & T_STATISTICS) || maria_is_crashed(file))
+ (param->testflag & T_STATISTICS) || maria_is_crashed(file))
{
file->update |= HA_STATE_CHANGED | HA_STATE_ROW_CHANGED;
mysql_mutex_lock(&share->intern_lock);
@@ -1374,7 +1374,7 @@ int ha_maria::check(THD * thd, HA_CHECK_OPT * check_opt)
share->state.changed&= ~(STATE_CHANGED | STATE_CRASHED_FLAGS |
STATE_IN_REPAIR);
if (!(table->db_stat & HA_READ_ONLY))
- error= maria_update_state_info(&param, file,
+ error= maria_update_state_info(param, file,
UPDATE_TIME | UPDATE_OPEN_COUNT |
UPDATE_STAT);
mysql_mutex_unlock(&share->intern_lock);
@@ -1405,33 +1405,33 @@ int ha_maria::check(THD * thd, HA_CHECK_OPT * check_opt)
int ha_maria::analyze(THD *thd, HA_CHECK_OPT * check_opt)
{
int error= 0;
- HA_CHECK &param= *(HA_CHECK*) thd->alloc(sizeof(param));
+ HA_CHECK *param= (HA_CHECK*) thd->alloc(sizeof *param);
MARIA_SHARE *share= file->s;
const char *old_proc_info;
- if (!&param)
+ if (!param)
return HA_ADMIN_INTERNAL_ERROR;
- maria_chk_init(&param);
- param.thd= thd;
- param.op_name= "analyze";
- param.db_name= table->s->db.str;
- param.table_name= table->alias.c_ptr();
- param.testflag= (T_FAST | T_CHECK | T_SILENT | T_STATISTICS |
+ maria_chk_init(param);
+ param->thd= thd;
+ param->op_name= "analyze";
+ param->db_name= table->s->db.str;
+ param->table_name= table->alias.c_ptr();
+ param->testflag= (T_FAST | T_CHECK | T_SILENT | T_STATISTICS |
T_DONT_CHECK_CHECKSUM);
- param.using_global_keycache= 1;
- param.stats_method= (enum_handler_stats_method)THDVAR(thd,stats_method);
+ param->using_global_keycache= 1;
+ param->stats_method= (enum_handler_stats_method)THDVAR(thd,stats_method);
if (!(share->state.changed & STATE_NOT_ANALYZED))
return HA_ADMIN_ALREADY_DONE;
old_proc_info= thd_proc_info(thd, "Scanning");
thd_progress_init(thd, 1);
- error= maria_chk_key(&param, file);
+ error= maria_chk_key(param, file);
if (!error)
{
mysql_mutex_lock(&share->intern_lock);
- error= maria_update_state_info(&param, file, UPDATE_STAT);
+ error= maria_update_state_info(param, file, UPDATE_STAT);
mysql_mutex_unlock(&share->intern_lock);
}
else if (!maria_is_crashed(file) && !thd->killed)
@@ -1444,46 +1444,46 @@ int ha_maria::analyze(THD *thd, HA_CHECK_OPT * check_opt)
int ha_maria::repair(THD * thd, HA_CHECK_OPT *check_opt)
{
int error;
- HA_CHECK &param= *(HA_CHECK*) thd->alloc(sizeof(param));
+ HA_CHECK *param= (HA_CHECK*) thd->alloc(sizeof *param);
ha_rows start_records;
const char *old_proc_info;
- if (!file || !&param)
+ if (!file || !param)
return HA_ADMIN_INTERNAL_ERROR;
- maria_chk_init(&param);
- param.thd= thd;
- param.op_name= "repair";
- param.testflag= ((check_opt->flags & ~(T_EXTEND)) |
+ maria_chk_init(param);
+ param->thd= thd;
+ param->op_name= "repair";
+ param->testflag= ((check_opt->flags & ~(T_EXTEND)) |
T_SILENT | T_FORCE_CREATE | T_CALC_CHECKSUM |
(check_opt->flags & T_EXTEND ? T_REP : T_REP_BY_SORT));
- param.sort_buffer_length= THDVAR(thd, sort_buffer_size);
- param.backup_time= check_opt->start_time;
+ param->sort_buffer_length= THDVAR(thd, sort_buffer_size);
+ param->backup_time= check_opt->start_time;
start_records= file->state->records;
old_proc_info= thd_proc_info(thd, "Checking table");
thd_progress_init(thd, 1);
- while ((error= repair(thd, &param, 0)) && param.retry_repair)
+ while ((error= repair(thd, param, 0)) && param->retry_repair)
{
- param.retry_repair= 0;
- if (test_all_bits(param.testflag,
+ param->retry_repair= 0;
+ if (test_all_bits(param->testflag,
(uint) (T_RETRY_WITHOUT_QUICK | T_QUICK)))
{
- param.testflag&= ~(T_RETRY_WITHOUT_QUICK | T_QUICK);
+ param->testflag&= ~(T_RETRY_WITHOUT_QUICK | T_QUICK);
/* Ensure we don't loose any rows when retrying without quick */
- param.testflag|= T_SAFE_REPAIR;
+ param->testflag|= T_SAFE_REPAIR;
if (thd->vio_ok())
- _ma_check_print_info(&param, "Retrying repair without quick");
+ _ma_check_print_info(param, "Retrying repair without quick");
else
sql_print_information("Retrying repair of: '%s' without quick",
table->s->path.str);
continue;
}
- param.testflag &= ~T_QUICK;
- if ((param.testflag & T_REP_BY_SORT))
+ param->testflag &= ~T_QUICK;
+ if (param->testflag & T_REP_BY_SORT)
{
- param.testflag= (param.testflag & ~T_REP_BY_SORT) | T_REP;
+ param->testflag= (param->testflag & ~T_REP_BY_SORT) | T_REP;
if (thd->vio_ok())
- _ma_check_print_info(&param, "Retrying repair with keycache");
+ _ma_check_print_info(param, "Retrying repair with keycache");
sql_print_information("Retrying repair of: '%s' with keycache",
table->s->path.str);
continue;
@@ -1507,20 +1507,20 @@ int ha_maria::repair(THD * thd, HA_CHECK_OPT *check_opt)
int ha_maria::zerofill(THD * thd, HA_CHECK_OPT *check_opt)
{
int error;
- HA_CHECK &param= *(HA_CHECK*) thd->alloc(sizeof(param));
+ HA_CHECK *param= (HA_CHECK*) thd->alloc(sizeof *param);
TRN *old_trn;
MARIA_SHARE *share= file->s;
- if (!file || !&param)
+ if (!file || !param)
return HA_ADMIN_INTERNAL_ERROR;
old_trn= file->trn;
- maria_chk_init(&param);
- param.thd= thd;
- param.op_name= "zerofill";
- param.testflag= check_opt->flags | T_SILENT | T_ZEROFILL;
- param.sort_buffer_length= THDVAR(thd, sort_buffer_size);
- error=maria_zerofill(&param, file, share->open_file_name.str);
+ maria_chk_init(param);
+ param->thd= thd;
+ param->op_name= "zerofill";
+ param->testflag= check_opt->flags | T_SILENT | T_ZEROFILL;
+ param->sort_buffer_length= THDVAR(thd, sort_buffer_size);
+ error=maria_zerofill(param, file, share->open_file_name.str);
/* Reset trn, that may have been set by repair */
_ma_set_trn_for_table(file, old_trn);
@@ -1530,7 +1530,7 @@ int ha_maria::zerofill(THD * thd, HA_CHECK_OPT *check_opt)
TrID create_trid= trnman_get_min_safe_trid();
mysql_mutex_lock(&share->intern_lock);
share->state.changed|= STATE_NOT_MOVABLE;
- maria_update_state_info(&param, file, UPDATE_TIME | UPDATE_OPEN_COUNT);
+ maria_update_state_info(param, file, UPDATE_TIME | UPDATE_OPEN_COUNT);
_ma_update_state_lsns_sub(share, LSN_IMPOSSIBLE, create_trid,
TRUE, TRUE);
mysql_mutex_unlock(&share->intern_lock);
@@ -1541,24 +1541,24 @@ int ha_maria::zerofill(THD * thd, HA_CHECK_OPT *check_opt)
int ha_maria::optimize(THD * thd, HA_CHECK_OPT *check_opt)
{
int error;
- HA_CHECK &param= *(HA_CHECK*) thd->alloc(sizeof(param));
+ HA_CHECK *param= (HA_CHECK*) thd->alloc(sizeof *param);
- if (!file || !&param)
+ if (!file || !param)
return HA_ADMIN_INTERNAL_ERROR;
- maria_chk_init(&param);
- param.thd= thd;
- param.op_name= "optimize";
- param.testflag= (check_opt->flags | T_SILENT | T_FORCE_CREATE |
+ maria_chk_init(param);
+ param->thd= thd;
+ param->op_name= "optimize";
+ param->testflag= (check_opt->flags | T_SILENT | T_FORCE_CREATE |
T_REP_BY_SORT | T_STATISTICS | T_SORT_INDEX);
- param.sort_buffer_length= THDVAR(thd, sort_buffer_size);
+ param->sort_buffer_length= THDVAR(thd, sort_buffer_size);
thd_progress_init(thd, 1);
- if ((error= repair(thd, &param, 1)) && param.retry_repair)
+ if ((error= repair(thd, param, 1)) && param->retry_repair)
{
sql_print_warning("Warning: Optimize table got errno %d on %s.%s, retrying",
- my_errno, param.db_name, param.table_name);
- param.testflag &= ~T_REP_BY_SORT;
- error= repair(thd, &param, 0);
+ my_errno, param->db_name, param->table_name);
+ param->testflag &= ~T_REP_BY_SORT;
+ error= repair(thd, param, 0);
}
thd_progress_end(thd);
return error;
@@ -1808,17 +1808,17 @@ int ha_maria::assign_to_keycache(THD * thd, HA_CHECK_OPT *check_opt)
if (error != HA_ADMIN_OK)
{
/* Send error to user */
- HA_CHECK &param= *(HA_CHECK*) thd->alloc(sizeof(param));
- if (!&param)
+ HA_CHECK *param= (HA_CHECK*) thd->alloc(sizeof *param);
+ if (!param)
return HA_ADMIN_INTERNAL_ERROR;
- maria_chk_init(&param);
- param.thd= thd;
- param.op_name= "assign_to_keycache";
- param.db_name= table->s->db.str;
- param.table_name= table->s->table_name.str;
- param.testflag= 0;
- _ma_check_print_error(&param, errmsg);
+ maria_chk_init(param);
+ param->thd= thd;
+ param->op_name= "assign_to_keycache";
+ param->db_name= table->s->db.str;
+ param->table_name= table->s->table_name.str;
+ param->testflag= 0;
+ _ma_check_print_error(param, errmsg);
}
DBUG_RETURN(error);
#else
@@ -1872,17 +1872,17 @@ int ha_maria::preload_keys(THD * thd, HA_CHECK_OPT *check_opt)
errmsg= buf;
}
- HA_CHECK &param= *(HA_CHECK*) thd->alloc(sizeof(param));
- if (!&param)
+ HA_CHECK *param= (HA_CHECK*) thd->alloc(sizeof *param);
+ if (!param)
return HA_ADMIN_INTERNAL_ERROR;
- maria_chk_init(&param);
- param.thd= thd;
- param.op_name= "preload_keys";
- param.db_name= table->s->db.str;
- param.table_name= table->s->table_name.str;
- param.testflag= 0;
- _ma_check_print_error(&param, "%s", errmsg);
+ maria_chk_init(param);
+ param->thd= thd;
+ param->op_name= "preload_keys";
+ param->db_name= table->s->db.str;
+ param->table_name= table->s->table_name.str;
+ param->testflag= 0;
+ _ma_check_print_error(param, "%s", errmsg);
DBUG_RETURN(HA_ADMIN_FAILED);
}
DBUG_RETURN(HA_ADMIN_OK);
@@ -1983,25 +1983,25 @@ int ha_maria::enable_indexes(uint mode)
else if (mode == HA_KEY_SWITCH_NONUNIQ_SAVE)
{
THD *thd= table->in_use;
- HA_CHECK &param= *(HA_CHECK*) thd->alloc(sizeof(param));
- if (!&param)
+ HA_CHECK *param= (HA_CHECK*) thd->alloc(sizeof *param);
+ if (!param)
return HA_ADMIN_INTERNAL_ERROR;
const char *save_proc_info= thd_proc_info(thd, "Creating index");
- maria_chk_init(&param);
- param.op_name= "recreating_index";
- param.testflag= (T_SILENT | T_REP_BY_SORT | T_QUICK |
+ maria_chk_init(param);
+ param->op_name= "recreating_index";
+ param->testflag= (T_SILENT | T_REP_BY_SORT | T_QUICK |
T_CREATE_MISSING_KEYS | T_SAFE_REPAIR);
/*
Don't lock and unlock table if it's locked.
Normally table should be locked. This test is mostly for safety.
*/
if (likely(file->lock_type != F_UNLCK))
- param.testflag|= T_NO_LOCKS;
+ param->testflag|= T_NO_LOCKS;
if (file->create_unique_index_by_sort)
- param.testflag|= T_CREATE_UNIQUE_BY_SORT;
+ param->testflag|= T_CREATE_UNIQUE_BY_SORT;
if (bulk_insert_single_undo == BULK_INSERT_SINGLE_UNDO_AND_NO_REPAIR)
{
@@ -2010,23 +2010,23 @@ int ha_maria::enable_indexes(uint mode)
Don't bump create_rename_lsn, because UNDO_BULK_INSERT
should not be skipped in case of crash during repair.
*/
- param.testflag|= T_NO_CREATE_RENAME_LSN;
+ param->testflag|= T_NO_CREATE_RENAME_LSN;
}
- param.myf_rw &= ~MY_WAIT_IF_FULL;
- param.sort_buffer_length= THDVAR(thd,sort_buffer_size);
- param.stats_method= (enum_handler_stats_method)THDVAR(thd,stats_method);
- param.tmpdir= &mysql_tmpdir_list;
- if ((error= (repair(thd, &param, 0) != HA_ADMIN_OK)) && param.retry_repair)
+ param->myf_rw &= ~MY_WAIT_IF_FULL;
+ param->sort_buffer_length= THDVAR(thd,sort_buffer_size);
+ param->stats_method= (enum_handler_stats_method)THDVAR(thd,stats_method);
+ param->tmpdir= &mysql_tmpdir_list;
+ if ((error= (repair(thd, param, 0) != HA_ADMIN_OK)) && param->retry_repair)
{
sql_print_warning("Warning: Enabling keys got errno %d on %s.%s, "
"retrying",
- my_errno, param.db_name, param.table_name);
+ my_errno, param->db_name, param->table_name);
/* This should never fail normally */
DBUG_ASSERT(thd->killed != 0);
/* Repairing by sort failed. Now try standard repair method. */
- param.testflag &= ~T_REP_BY_SORT;
- error= (repair(thd, &param, 0) != HA_ADMIN_OK);
+ param->testflag &= ~T_REP_BY_SORT;
+ error= (repair(thd, param, 0) != HA_ADMIN_OK);
/*
If the standard repair succeeded, clear all error messages which
might have been set by the first repair. They can still be seen
@@ -3605,10 +3605,6 @@ static int ha_maria_init(void *p)
maria_pagecache->extra_debug= 1;
maria_assert_if_crashed_table= debug_assert_if_crashed_table;
-#if defined(HAVE_REALPATH) && !defined(HAVE_valgrind) && !defined(HAVE_BROKEN_REALPATH)
- /* We can only test for sub paths if my_symlink.c is using realpath */
- maria_test_invalid_symlink= test_if_data_home_dir;
-#endif
if (res)
maria_hton= 0;
diff --git a/storage/maria/ha_maria.h b/storage/maria/ha_maria.h
index 2b99c31ec5d..65fe5f545d1 100644
--- a/storage/maria/ha_maria.h
+++ b/storage/maria/ha_maria.h
@@ -13,7 +13,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#ifdef USE_PRAGMA_INTERFACE
#pragma interface /* gcc class implementation */
diff --git a/storage/maria/lockman.c b/storage/maria/lockman.c
index f319fea1e0e..efdf7e1c4b8 100644
--- a/storage/maria/lockman.c
+++ b/storage/maria/lockman.c
@@ -15,7 +15,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
/*
Generic Lock Manager
diff --git a/storage/maria/lockman.h b/storage/maria/lockman.h
index 82ab483896f..2a5fc038b70 100644
--- a/storage/maria/lockman.h
+++ b/storage/maria/lockman.h
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#ifndef _lockman_h
#define _lockman_h
diff --git a/storage/maria/ma_bitmap.c b/storage/maria/ma_bitmap.c
index 8edaa418baa..0abfa34a85f 100644
--- a/storage/maria/ma_bitmap.c
+++ b/storage/maria/ma_bitmap.c
@@ -12,7 +12,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
/*
Bitmap handling (for records in block)
diff --git a/storage/maria/ma_blockrec.c b/storage/maria/ma_blockrec.c
index 2f2558d22c0..57596558208 100644
--- a/storage/maria/ma_blockrec.c
+++ b/storage/maria/ma_blockrec.c
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
/*
Storage of records in block
diff --git a/storage/maria/ma_blockrec.h b/storage/maria/ma_blockrec.h
index c33dfa0d5ea..8e5b4bc42de 100644
--- a/storage/maria/ma_blockrec.h
+++ b/storage/maria/ma_blockrec.h
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
/*
Storage of records in block
diff --git a/storage/maria/ma_cache.c b/storage/maria/ma_cache.c
index 24739671be6..0a45b43710a 100644
--- a/storage/maria/ma_cache.c
+++ b/storage/maria/ma_cache.c
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
/*
Functions for read record cacheing with maria
diff --git a/storage/maria/ma_changed.c b/storage/maria/ma_changed.c
index eb20db5669e..de591a590f3 100644
--- a/storage/maria/ma_changed.c
+++ b/storage/maria/ma_changed.c
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
/* Check if somebody has changed table since last check. */
diff --git a/storage/maria/ma_check.c b/storage/maria/ma_check.c
index 1a271c217a8..f92774a0321 100644
--- a/storage/maria/ma_check.c
+++ b/storage/maria/ma_check.c
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
/* Describe, check and repair of MARIA tables */
@@ -2837,7 +2837,7 @@ int maria_repair(HA_CHECK *param, register MARIA_HA *info,
(param->testflag & T_BACKUP_DATA ?
MYF(MY_REDEL_MAKE_BACKUP): MYF(0)) |
sync_dir) ||
- _ma_open_datafile(info, share, NullS, -1))
+ _ma_open_datafile(info, share))
{
goto err;
}
@@ -3998,7 +3998,7 @@ int maria_repair_by_sort(HA_CHECK *param, register MARIA_HA *info,
(param->testflag & T_BACKUP_DATA ?
MYF(MY_REDEL_MAKE_BACKUP): MYF(0)) |
sync_dir) ||
- _ma_open_datafile(info, share, NullS, -1))
+ _ma_open_datafile(info, share))
{
_ma_check_print_error(param, "Couldn't change to new data file");
goto err;
@@ -4638,7 +4638,7 @@ err:
MYF((param->testflag & T_BACKUP_DATA ?
MY_REDEL_MAKE_BACKUP : 0) |
sync_dir)) ||
- _ma_open_datafile(info,share, NullS, -1))
+ _ma_open_datafile(info,share))
got_error=1;
}
}
diff --git a/storage/maria/ma_check_standalone.h b/storage/maria/ma_check_standalone.h
index 890d6ba3d31..64f66fb19bc 100644
--- a/storage/maria/ma_check_standalone.h
+++ b/storage/maria/ma_check_standalone.h
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#include <my_check_opt.h>
diff --git a/storage/maria/ma_checkpoint.c b/storage/maria/ma_checkpoint.c
index 21b4758a720..c00278781ea 100644
--- a/storage/maria/ma_checkpoint.c
+++ b/storage/maria/ma_checkpoint.c
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
/*
WL#3071 Maria checkpoint
diff --git a/storage/maria/ma_checkpoint.h b/storage/maria/ma_checkpoint.h
index 126f8111a23..df877ad2bbc 100644
--- a/storage/maria/ma_checkpoint.h
+++ b/storage/maria/ma_checkpoint.h
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
/*
WL#3071 Maria checkpoint
diff --git a/storage/maria/ma_checksum.c b/storage/maria/ma_checksum.c
index 48b29946cea..d9d3877854a 100644
--- a/storage/maria/ma_checksum.c
+++ b/storage/maria/ma_checksum.c
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
/* Calculate a checksum for a row */
diff --git a/storage/maria/ma_close.c b/storage/maria/ma_close.c
index 022da39002b..d89a69f02ab 100644
--- a/storage/maria/ma_close.c
+++ b/storage/maria/ma_close.c
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
/* close a isam-database */
/*
diff --git a/storage/maria/ma_commit.c b/storage/maria/ma_commit.c
index 46db3ca4ae5..358f564d3f1 100644
--- a/storage/maria/ma_commit.c
+++ b/storage/maria/ma_commit.c
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#include "maria_def.h"
#include "trnman.h"
diff --git a/storage/maria/ma_commit.h b/storage/maria/ma_commit.h
index 2c57c73fd7a..5cb86d8b3c7 100644
--- a/storage/maria/ma_commit.h
+++ b/storage/maria/ma_commit.h
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
C_MODE_START
int ma_commit(TRN *trn);
diff --git a/storage/maria/ma_control_file.c b/storage/maria/ma_control_file.c
index 2fa3e6ed18e..b46cf7e1765 100644
--- a/storage/maria/ma_control_file.c
+++ b/storage/maria/ma_control_file.c
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
/*
WL#3234 Maria control file
diff --git a/storage/maria/ma_control_file.h b/storage/maria/ma_control_file.h
index f828ae69c6d..155c778c105 100644
--- a/storage/maria/ma_control_file.h
+++ b/storage/maria/ma_control_file.h
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
/*
WL#3234 Maria control file
diff --git a/storage/maria/ma_create.c b/storage/maria/ma_create.c
index 0680b5d568e..0ddd8b226e2 100644
--- a/storage/maria/ma_create.c
+++ b/storage/maria/ma_create.c
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
/* Create a MARIA table */
@@ -54,7 +54,8 @@ int maria_create(const char *name, enum data_file_type datafile_type,
uint max_field_lengths, extra_header_size, column_nr;
uint internal_table= flags & HA_CREATE_INTERNAL_TABLE;
ulong reclength, real_reclength,min_pack_length;
- char filename[FN_REFLEN], linkname[FN_REFLEN], *linkname_ptr;
+ char kfilename[FN_REFLEN], klinkname[FN_REFLEN], *klinkname_ptr;
+ char dfilename[FN_REFLEN], dlinkname[FN_REFLEN], *dlinkname_ptr;
ulong pack_reclength;
ulonglong tot_length,max_rows, tmp;
enum en_fieldtype type;
@@ -846,19 +847,19 @@ int maria_create(const char *name, enum data_file_type datafile_type,
/* chop off the table name, tempory tables use generated name */
if ((path= strrchr(ci->index_file_name, FN_LIBCHAR)))
*path= '\0';
- fn_format(filename, name, ci->index_file_name, MARIA_NAME_IEXT,
+ fn_format(kfilename, name, ci->index_file_name, MARIA_NAME_IEXT,
MY_REPLACE_DIR | MY_UNPACK_FILENAME |
MY_RETURN_REAL_PATH | MY_APPEND_EXT);
}
else
{
- fn_format(filename, ci->index_file_name, "", MARIA_NAME_IEXT,
+ fn_format(kfilename, ci->index_file_name, "", MARIA_NAME_IEXT,
MY_UNPACK_FILENAME | MY_RETURN_REAL_PATH |
(have_iext ? MY_REPLACE_EXT : MY_APPEND_EXT));
}
- fn_format(linkname, name, "", MARIA_NAME_IEXT,
+ fn_format(klinkname, name, "", MARIA_NAME_IEXT,
MY_UNPACK_FILENAME|MY_APPEND_EXT);
- linkname_ptr= linkname;
+ klinkname_ptr= klinkname;
/*
Don't create the table if the link or file exists to ensure that one
doesn't accidently destroy another table.
@@ -872,10 +873,10 @@ int maria_create(const char *name, enum data_file_type datafile_type,
{
char *iext= strrchr(name, '.');
int have_iext= iext && !strcmp(iext, MARIA_NAME_IEXT);
- fn_format(filename, name, "", MARIA_NAME_IEXT,
+ fn_format(kfilename, name, "", MARIA_NAME_IEXT,
MY_UNPACK_FILENAME | MY_RETURN_REAL_PATH |
(have_iext ? MY_REPLACE_EXT : MY_APPEND_EXT));
- linkname_ptr= NullS;
+ klinkname_ptr= NullS;
/*
Replace the current file.
Don't sync dir now if the data file has the same path.
@@ -895,7 +896,7 @@ int maria_create(const char *name, enum data_file_type datafile_type,
NOTE: The filename is compared against unique_file_name of every
open table. Hence we need a real path here.
*/
- if (!internal_table && _ma_test_if_reopen(filename))
+ if (!internal_table && _ma_test_if_reopen(kfilename))
{
my_printf_error(HA_ERR_TABLE_EXIST, "Aria table '%s' is in use "
"(most likely by a MERGE table). Try FLUSH TABLES.",
@@ -904,8 +905,8 @@ int maria_create(const char *name, enum data_file_type datafile_type,
goto err;
}
- if ((file= mysql_file_create_with_symlink(key_file_kfile, linkname_ptr,
- filename, 0, create_mode,
+ if ((file= mysql_file_create_with_symlink(key_file_kfile, klinkname_ptr,
+ kfilename, 0, create_mode,
MYF(MY_WME|create_flag))) < 0)
goto err;
errpos=1;
@@ -1165,30 +1166,30 @@ int maria_create(const char *name, enum data_file_type datafile_type,
/* chop off the table name, tempory tables use generated name */
if ((path= strrchr(ci->data_file_name, FN_LIBCHAR)))
*path= '\0';
- fn_format(filename, name, ci->data_file_name, MARIA_NAME_DEXT,
+ fn_format(dfilename, name, ci->data_file_name, MARIA_NAME_DEXT,
MY_REPLACE_DIR | MY_UNPACK_FILENAME | MY_APPEND_EXT);
}
else
{
- fn_format(filename, ci->data_file_name, "", MARIA_NAME_DEXT,
+ fn_format(dfilename, ci->data_file_name, "", MARIA_NAME_DEXT,
MY_UNPACK_FILENAME |
(have_dext ? MY_REPLACE_EXT : MY_APPEND_EXT));
}
- fn_format(linkname, name, "",MARIA_NAME_DEXT,
+ fn_format(dlinkname, name, "",MARIA_NAME_DEXT,
MY_UNPACK_FILENAME | MY_APPEND_EXT);
- linkname_ptr= linkname;
+ dlinkname_ptr= dlinkname;
create_flag=0;
}
else
{
- fn_format(filename,name,"", MARIA_NAME_DEXT,
+ fn_format(dfilename,name,"", MARIA_NAME_DEXT,
MY_UNPACK_FILENAME | MY_APPEND_EXT);
- linkname_ptr= NullS;
+ dlinkname_ptr= NullS;
create_flag= (flags & HA_CREATE_KEEP_FILES) ? 0 : MY_DELETE_OLD;
}
if ((dfile=
- mysql_file_create_with_symlink(key_file_dfile, linkname_ptr,
- filename, 0, create_mode,
+ mysql_file_create_with_symlink(key_file_dfile, dlinkname_ptr,
+ dfilename, 0, create_mode,
MYF(MY_WME | create_flag | sync_dir))) < 0)
goto err;
errpos=3;
@@ -1239,19 +1240,21 @@ err_no_lock:
mysql_file_close(dfile, MYF(0));
/* fall through */
case 2:
- if (! (flags & HA_DONT_TOUCH_DATA))
- mysql_file_delete_with_symlink(key_file_dfile,
- fn_format(filename,name,"",MARIA_NAME_DEXT,
- MY_UNPACK_FILENAME | MY_APPEND_EXT),
- sync_dir);
+ if (! (flags & HA_DONT_TOUCH_DATA))
+ {
+ mysql_file_delete(key_file_dfile, dfilename, MYF(sync_dir));
+ if (dlinkname_ptr)
+ mysql_file_delete(key_file_dfile, dlinkname_ptr, MYF(sync_dir));
+ }
/* fall through */
case 1:
mysql_file_close(file, MYF(0));
if (! (flags & HA_DONT_TOUCH_DATA))
- mysql_file_delete_with_symlink(key_file_kfile,
- fn_format(filename,name,"",MARIA_NAME_IEXT,
- MY_UNPACK_FILENAME | MY_APPEND_EXT),
- sync_dir);
+ {
+ mysql_file_delete(key_file_kfile, kfilename, MYF(sync_dir));
+ if (klinkname_ptr)
+ mysql_file_delete(key_file_kfile, klinkname_ptr, MYF(sync_dir));
+ }
}
ma_crypt_free(&share);
my_free(log_data);
diff --git a/storage/maria/ma_dbug.c b/storage/maria/ma_dbug.c
index ed6f79ddf92..677a5270c2e 100644
--- a/storage/maria/ma_dbug.c
+++ b/storage/maria/ma_dbug.c
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
/* Support rutiner with are using with dbug */
diff --git a/storage/maria/ma_delete.c b/storage/maria/ma_delete.c
index bcea1d4054d..7921ab59a8f 100644
--- a/storage/maria/ma_delete.c
+++ b/storage/maria/ma_delete.c
@@ -12,7 +12,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#include "ma_fulltext.h"
#include "ma_rt_index.h"
diff --git a/storage/maria/ma_delete_all.c b/storage/maria/ma_delete_all.c
index b5bb9d3ddf5..a14603b24a5 100644
--- a/storage/maria/ma_delete_all.c
+++ b/storage/maria/ma_delete_all.c
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
/* Remove all rows from a MARIA table */
/* This clears the status information and truncates files */
diff --git a/storage/maria/ma_delete_table.c b/storage/maria/ma_delete_table.c
index ec68902485b..067ab280fdc 100644
--- a/storage/maria/ma_delete_table.c
+++ b/storage/maria/ma_delete_table.c
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#include "ma_fulltext.h"
#include "trnman_public.h"
@@ -84,25 +84,16 @@ int maria_delete_table(const char *name)
int maria_delete_table_files(const char *name, my_bool temporary, myf sync_dir)
{
- char from[FN_REFLEN];
DBUG_ENTER("maria_delete_table_files");
- fn_format(from,name,"",MARIA_NAME_IEXT,MY_UNPACK_FILENAME|MY_APPEND_EXT);
- if (mysql_file_delete_with_symlink(key_file_kfile, from,
- MYF(MY_WME | sync_dir)))
- DBUG_RETURN(my_errno);
- fn_format(from,name,"",MARIA_NAME_DEXT,MY_UNPACK_FILENAME|MY_APPEND_EXT);
- if (mysql_file_delete_with_symlink(key_file_dfile, from,
- MYF(MY_WME | sync_dir)))
+ if (mysql_file_delete_with_symlink(key_file_kfile, name, MARIA_NAME_IEXT, MYF(MY_WME | sync_dir)) ||
+ mysql_file_delete_with_symlink(key_file_dfile, name, MARIA_NAME_DEXT, MYF(MY_WME | sync_dir)))
DBUG_RETURN(my_errno);
- // optional files from maria_pack:
if (!temporary)
{
- fn_format(from,name,"",".TMD",MY_UNPACK_FILENAME|MY_APPEND_EXT);
- mysql_file_delete_with_symlink(key_file_dfile, from, MYF(0));
- fn_format(from,name,"",".OLD",MY_UNPACK_FILENAME|MY_APPEND_EXT);
- mysql_file_delete_with_symlink(key_file_dfile, from, MYF(0));
+ mysql_file_delete_with_symlink(key_file_dfile, name, ".TMD", MYF(0));
+ mysql_file_delete_with_symlink(key_file_dfile, name, ".OLD", MYF(0));
}
DBUG_RETURN(0);
}
diff --git a/storage/maria/ma_dynrec.c b/storage/maria/ma_dynrec.c
index 2e17a95f390..7f34b73089f 100644
--- a/storage/maria/ma_dynrec.c
+++ b/storage/maria/ma_dynrec.c
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
/*
Functions to handle space-packed-records and blobs
diff --git a/storage/maria/ma_extra.c b/storage/maria/ma_extra.c
index 117a302b418..0cf5b2822b1 100644
--- a/storage/maria/ma_extra.c
+++ b/storage/maria/ma_extra.c
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#include "maria_def.h"
#ifdef HAVE_SYS_MMAN_H
diff --git a/storage/maria/ma_ft_boolean_search.c b/storage/maria/ma_ft_boolean_search.c
index 2d7989821fb..a37a1322ad0 100644
--- a/storage/maria/ma_ft_boolean_search.c
+++ b/storage/maria/ma_ft_boolean_search.c
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
/* Written by Sergei A. Golubchik, who has a shared copyright to this code */
diff --git a/storage/maria/ma_ft_eval.c b/storage/maria/ma_ft_eval.c
index 5fc67c6c664..1811a98abf9 100644
--- a/storage/maria/ma_ft_eval.c
+++ b/storage/maria/ma_ft_eval.c
@@ -8,7 +8,7 @@
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
/* Written by Sergei A. Golubchik, who has a shared copyright to this code
added support for long options (my_getopt) 22.5.2002 by Jani Tolonen */
diff --git a/storage/maria/ma_ft_eval.h b/storage/maria/ma_ft_eval.h
index 481943dfb0b..cd232d2bf93 100644
--- a/storage/maria/ma_ft_eval.h
+++ b/storage/maria/ma_ft_eval.h
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
/* Written by Sergei A. Golubchik, who has a shared copyright to this code */
diff --git a/storage/maria/ma_ft_nlq_search.c b/storage/maria/ma_ft_nlq_search.c
index 6a148643428..8d0ac74c131 100644
--- a/storage/maria/ma_ft_nlq_search.c
+++ b/storage/maria/ma_ft_nlq_search.c
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
/* Written by Sergei A. Golubchik, who has a shared copyright to this code */
diff --git a/storage/maria/ma_ft_parser.c b/storage/maria/ma_ft_parser.c
index 84a92a011c0..f0a2e1e1425 100644
--- a/storage/maria/ma_ft_parser.c
+++ b/storage/maria/ma_ft_parser.c
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
/* Written by Sergei A. Golubchik, who has a shared copyright to this code */
diff --git a/storage/maria/ma_ft_stem.c b/storage/maria/ma_ft_stem.c
index 06fc0b2df6c..fdce4956963 100644
--- a/storage/maria/ma_ft_stem.c
+++ b/storage/maria/ma_ft_stem.c
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
/* Written by Sergei A. Golubchik, who has a shared copyright to this code */
diff --git a/storage/maria/ma_ft_test1.c b/storage/maria/ma_ft_test1.c
index 4c98e766234..6839fcb9da8 100644
--- a/storage/maria/ma_ft_test1.c
+++ b/storage/maria/ma_ft_test1.c
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
/* Written by Sergei A. Golubchik, who has a shared copyright to this code
added support for long options (my_getopt) 22.5.2002 by Jani Tolonen */
diff --git a/storage/maria/ma_ft_test1.h b/storage/maria/ma_ft_test1.h
index 5883c42f5c5..c724a368f98 100644
--- a/storage/maria/ma_ft_test1.h
+++ b/storage/maria/ma_ft_test1.h
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
/* Written by Sergei A. Golubchik, who has a shared copyright to this code */
diff --git a/storage/maria/ma_ft_update.c b/storage/maria/ma_ft_update.c
index 59c134cd4d3..51f27520dc1 100644
--- a/storage/maria/ma_ft_update.c
+++ b/storage/maria/ma_ft_update.c
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
/* Written by Sergei A. Golubchik, who has a shared copyright to this code */
diff --git a/storage/maria/ma_ftdefs.h b/storage/maria/ma_ftdefs.h
index 9ec3d344e8c..2a03e2d325c 100644
--- a/storage/maria/ma_ftdefs.h
+++ b/storage/maria/ma_ftdefs.h
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
/* Written by Sergei A. Golubchik, who has a shared copyright to this code */
diff --git a/storage/maria/ma_fulltext.h b/storage/maria/ma_fulltext.h
index 6e087990bd2..89f7268974c 100644
--- a/storage/maria/ma_fulltext.h
+++ b/storage/maria/ma_fulltext.h
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
/* Written by Sergei A. Golubchik, who has a shared copyright to this code */
diff --git a/storage/maria/ma_info.c b/storage/maria/ma_info.c
index 912ed0984a3..1189594fd2b 100644
--- a/storage/maria/ma_info.c
+++ b/storage/maria/ma_info.c
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
/* Return useful base information for an open table */
diff --git a/storage/maria/ma_init.c b/storage/maria/ma_init.c
index 962405552f0..3b8f3ce9072 100644
--- a/storage/maria/ma_init.c
+++ b/storage/maria/ma_init.c
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
/* Initialize an maria-database */
diff --git a/storage/maria/ma_key.c b/storage/maria/ma_key.c
index 53a7479cd4e..89693f45dca 100644
--- a/storage/maria/ma_key.c
+++ b/storage/maria/ma_key.c
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
/* Functions to handle keys */
diff --git a/storage/maria/ma_key_recover.c b/storage/maria/ma_key_recover.c
index e0a7bd35322..8b6342b76b5 100644
--- a/storage/maria/ma_key_recover.c
+++ b/storage/maria/ma_key_recover.c
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
/* Redo of index */
diff --git a/storage/maria/ma_key_recover.h b/storage/maria/ma_key_recover.h
index d6b69010d5d..4eaf1fd4ec8 100644
--- a/storage/maria/ma_key_recover.h
+++ b/storage/maria/ma_key_recover.h
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
/*
When we have finished the write/update/delete of a row, we have cleanups to
diff --git a/storage/maria/ma_keycache.c b/storage/maria/ma_keycache.c
index e3c57801410..c3083445aee 100644
--- a/storage/maria/ma_keycache.c
+++ b/storage/maria/ma_keycache.c
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
/*
Key cache assignments
diff --git a/storage/maria/ma_locking.c b/storage/maria/ma_locking.c
index dd679f53533..4723c04e3cf 100644
--- a/storage/maria/ma_locking.c
+++ b/storage/maria/ma_locking.c
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
/*
Locking of Maria-tables.
diff --git a/storage/maria/ma_loghandler.c b/storage/maria/ma_loghandler.c
index 8bcb84c2a20..86e51cc3526 100644
--- a/storage/maria/ma_loghandler.c
+++ b/storage/maria/ma_loghandler.c
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#include "maria_def.h"
#include "trnman.h"
diff --git a/storage/maria/ma_loghandler.h b/storage/maria/ma_loghandler.h
index 3719ec5e666..3fb9e7d37bf 100644
--- a/storage/maria/ma_loghandler.h
+++ b/storage/maria/ma_loghandler.h
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#ifndef _ma_loghandler_h
#define _ma_loghandler_h
diff --git a/storage/maria/ma_loghandler_lsn.h b/storage/maria/ma_loghandler_lsn.h
index f618429f6f3..69481761e80 100644
--- a/storage/maria/ma_loghandler_lsn.h
+++ b/storage/maria/ma_loghandler_lsn.h
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#ifndef _ma_loghandler_lsn_h
#define _ma_loghandler_lsn_h
diff --git a/storage/maria/ma_norec.c b/storage/maria/ma_norec.c
index 6d4f37e34fd..8ed0ef68eb4 100644
--- a/storage/maria/ma_norec.c
+++ b/storage/maria/ma_norec.c
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
/*
Functions to handle tables with no row data (only index)
diff --git a/storage/maria/ma_open.c b/storage/maria/ma_open.c
index 4e97c6b43b9..c4a7df4443c 100644
--- a/storage/maria/ma_open.c
+++ b/storage/maria/ma_open.c
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
/* open an Aria table */
@@ -87,7 +87,7 @@ MARIA_HA *_ma_test_if_reopen(const char *filename)
*/
-static MARIA_HA *maria_clone_internal(MARIA_SHARE *share, const char *name,
+static MARIA_HA *maria_clone_internal(MARIA_SHARE *share,
int mode, File data_file,
uint internal_table)
{
@@ -107,7 +107,7 @@ static MARIA_HA *maria_clone_internal(MARIA_SHARE *share, const char *name,
}
if (data_file >= 0)
info.dfile.file= data_file;
- else if (_ma_open_datafile(&info, share, name, -1))
+ else if (_ma_open_datafile(&info, share))
goto err;
errpos= 5;
@@ -253,7 +253,7 @@ MARIA_HA *maria_clone(MARIA_SHARE *share, int mode)
{
MARIA_HA *new_info;
mysql_mutex_lock(&THR_LOCK_maria);
- new_info= maria_clone_internal(share, NullS, mode,
+ new_info= maria_clone_internal(share, mode,
share->data_file_type == BLOCK_RECORD ?
share->bitmap.file.file : -1, 0);
mysql_mutex_unlock(&THR_LOCK_maria);
@@ -299,8 +299,13 @@ MARIA_HA *maria_open(const char *name, int mode, uint open_flags)
realpath_err= my_realpath(name_buff, fn_format(org_name, name, "",
MARIA_NAME_IEXT,
MY_UNPACK_FILENAME),MYF(0));
+ if (realpath_err > 0) /* File not found, no point in looking further. */
+ {
+ DBUG_RETURN(NULL);
+ }
+
if (my_is_symlink(org_name) &&
- (realpath_err || (*maria_test_invalid_symlink)(name_buff)))
+ (realpath_err || mysys_test_invalid_symlink(name_buff)))
{
my_errno= HA_WRONG_CREATE_OPTION;
DBUG_RETURN(0);
@@ -325,13 +330,16 @@ MARIA_HA *maria_open(const char *name, int mode, uint open_flags)
my_errno= HA_ERR_CRASHED;
goto err;
});
+ DEBUG_SYNC_C("mi_open_kfile");
if ((kfile=mysql_file_open(key_file_kfile, name_buff,
- (open_mode=O_RDWR) | O_SHARE,MYF(0))) < 0)
+ (open_mode=O_RDWR) | O_SHARE | O_NOFOLLOW,
+ MYF(MY_NOSYMLINKS))) < 0)
{
if ((errno != EROFS && errno != EACCES) ||
mode != O_RDONLY ||
(kfile=mysql_file_open(key_file_kfile, name_buff,
- (open_mode=O_RDONLY) | O_SHARE,MYF(0))) < 0)
+ (open_mode=O_RDONLY) | O_SHARE | O_NOFOLLOW,
+ MYF(MY_NOSYMLINKS))) < 0)
goto err;
}
share->mode=open_mode;
@@ -376,7 +384,18 @@ MARIA_HA *maria_open(const char *name, int mode, uint open_flags)
(void) strmov(index_name, org_name);
*strrchr(org_name, FN_EXTCHAR)= '\0';
(void) fn_format(data_name,org_name,"",MARIA_NAME_DEXT,
- MY_APPEND_EXT|MY_UNPACK_FILENAME|MY_RESOLVE_SYMLINKS);
+ MY_APPEND_EXT|MY_UNPACK_FILENAME);
+ if (my_is_symlink(data_name))
+ {
+ if (my_realpath(data_name, data_name, MYF(0)))
+ goto err;
+ if (mysys_test_invalid_symlink(data_name))
+ {
+ my_errno= HA_WRONG_CREATE_OPTION;
+ goto err;
+ }
+ share->mode|= O_NOFOLLOW; /* all symlinks are resolved by realpath() */
+ }
info_length=mi_uint2korr(share->state.header.header_length);
base_pos= mi_uint2korr(share->state.header.base_pos);
@@ -853,7 +872,7 @@ MARIA_HA *maria_open(const char *name, int mode, uint open_flags)
if ((share->data_file_type == BLOCK_RECORD ||
share->data_file_type == COMPRESSED_RECORD))
{
- if (_ma_open_datafile(&info, share, name, -1))
+ if (_ma_open_datafile(&info, share))
goto err;
data_file= info.dfile.file;
}
@@ -1025,7 +1044,7 @@ MARIA_HA *maria_open(const char *name, int mode, uint open_flags)
data_file= share->bitmap.file.file; /* Only opened once */
}
- if (!(m_info= maria_clone_internal(share, name, mode, data_file,
+ if (!(m_info= maria_clone_internal(share, mode, data_file,
internal_table)))
goto err;
@@ -1913,35 +1932,15 @@ void _ma_set_index_pagecache_callbacks(PAGECACHE_FILE *file,
Open data file
We can't use dup() here as the data file descriptors need to have different
active seek-positions.
-
- The argument file_to_dup is here for the future if there would on some OS
- exist a dup()-like call that would give us two different file descriptors.
*************************************************************************/
-int _ma_open_datafile(MARIA_HA *info, MARIA_SHARE *share, const char *org_name,
- File file_to_dup __attribute__((unused)))
+int _ma_open_datafile(MARIA_HA *info, MARIA_SHARE *share)
{
- char *data_name= share->data_file_name.str;
- char real_data_name[FN_REFLEN];
-
- if (org_name)
- {
- fn_format(real_data_name, org_name, "", MARIA_NAME_DEXT, 4);
- if (my_is_symlink(real_data_name))
- {
- if (my_realpath(real_data_name, real_data_name, MYF(0)) ||
- (*maria_test_invalid_symlink)(real_data_name))
- {
- my_errno= HA_WRONG_CREATE_OPTION;
- return 1;
- }
- data_name= real_data_name;
- }
- }
-
+ myf flags= MY_WME | (share->mode & O_NOFOLLOW ? MY_NOSYMLINKS : 0);
+ DEBUG_SYNC_C("mi_open_datafile");
info->dfile.file= share->bitmap.file.file=
- mysql_file_open(key_file_dfile, data_name,
- share->mode | O_SHARE, MYF(MY_WME));
+ mysql_file_open(key_file_dfile, share->data_file_name.str,
+ share->mode | O_SHARE, MYF(flags));
return info->dfile.file >= 0 ? 0 : 1;
}
@@ -1955,8 +1954,8 @@ int _ma_open_keyfile(MARIA_SHARE *share)
mysql_mutex_lock(&share->intern_lock);
share->kfile.file= mysql_file_open(key_file_kfile,
share->unique_file_name.str,
- share->mode | O_SHARE,
- MYF(MY_WME));
+ share->mode | O_SHARE | O_NOFOLLOW,
+ MYF(MY_WME | MY_NOSYMLINKS));
mysql_mutex_unlock(&share->intern_lock);
return (share->kfile.file < 0);
}
diff --git a/storage/maria/ma_packrec.c b/storage/maria/ma_packrec.c
index 6a4e7ea99cf..5243d55428c 100644
--- a/storage/maria/ma_packrec.c
+++ b/storage/maria/ma_packrec.c
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
/* Functions to compressed records */
diff --git a/storage/maria/ma_page.c b/storage/maria/ma_page.c
index 3bf56b86064..4021fb8e161 100644
--- a/storage/maria/ma_page.c
+++ b/storage/maria/ma_page.c
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
/*
Read and write key blocks
diff --git a/storage/maria/ma_pagecache.c b/storage/maria/ma_pagecache.c
index d2c69cfc230..afb5fb8bdff 100644
--- a/storage/maria/ma_pagecache.c
+++ b/storage/maria/ma_pagecache.c
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
/*
These functions handle page caching for Maria tables.
@@ -887,11 +887,11 @@ size_t init_pagecache(PAGECACHE *pagecache, size_t use_mem,
pagecache->waiting_for_hash_link.last_thread= NULL;
pagecache->waiting_for_block.last_thread= NULL;
DBUG_PRINT("exit",
- ("disk_blocks: %ld block_root: %p hash_entries: %ld\
- hash_root: %p hash_links: %ld hash_link_root: %p",
- (long) pagecache->disk_blocks, pagecache->block_root,
- (long) pagecache->hash_entries, pagecache->hash_root,
- (long) pagecache->hash_links, pagecache->hash_link_root));
+ ("disk_blocks: %zu block_root: %p hash_entries: %zu\
+ hash_root: %p hash_links: %zu hash_link_root: %p",
+ pagecache->disk_blocks, pagecache->block_root,
+ pagecache->hash_entries, pagecache->hash_root,
+ pagecache->hash_links, pagecache->hash_link_root));
pagecache->blocks= pagecache->disk_blocks > 0 ? pagecache->disk_blocks : 0;
DBUG_RETURN((size_t)pagecache->disk_blocks);
@@ -1186,7 +1186,7 @@ void end_pagecache(PAGECACHE *pagecache, my_bool cleanup)
pagecache->blocks_changed= 0;
}
- DBUG_PRINT("status", ("used: %lu changed: %lu w_requests: %lu "
+ DBUG_PRINT("status", ("used: %zu changed: %zu w_requests: %lu "
"writes: %lu r_requests: %lu reads: %lu",
(ulong) pagecache->blocks_used,
(ulong) pagecache->global_blocks_changed,
@@ -1522,8 +1522,8 @@ static void unreg_request(PAGECACHE *pagecache,
if (block->temperature == PCBLOCK_WARM)
pagecache->warm_blocks--;
block->temperature= PCBLOCK_HOT;
- KEYCACHE_DBUG_PRINT("unreg_request", ("#warm_blocks: %lu",
- (ulong) pagecache->warm_blocks));
+ KEYCACHE_DBUG_PRINT("unreg_request", ("#warm_blocks: %zu",
+ pagecache->warm_blocks));
}
link_block(pagecache, block, hot, (my_bool)at_end);
block->last_hit_time= pagecache->time;
@@ -1541,8 +1541,8 @@ static void unreg_request(PAGECACHE *pagecache,
pagecache->warm_blocks++;
block->temperature= PCBLOCK_WARM;
}
- KEYCACHE_DBUG_PRINT("unreg_request", ("#warm_blocks: %lu",
- (ulong) pagecache->warm_blocks));
+ KEYCACHE_DBUG_PRINT("unreg_request", ("#warm_blocks: %zu",
+ pagecache->warm_blocks));
}
}
DBUG_VOID_RETURN;
@@ -4483,9 +4483,9 @@ static int flush_pagecache_blocks_int(PAGECACHE *pagecache,
int rc= PCFLUSH_OK;
DBUG_ENTER("flush_pagecache_blocks_int");
DBUG_PRINT("enter",
- ("fd: %d blocks_used: %lu blocks_changed: %lu type: %d",
- file->file, (ulong) pagecache->blocks_used,
- (ulong) pagecache->blocks_changed, type));
+ ("fd: %d blocks_used: %zu blocks_changed: %zu type: %d",
+ file->file, pagecache->blocks_used, pagecache->blocks_changed,
+ type));
#if !defined(DBUG_OFF) && defined(EXTRA_DEBUG)
DBUG_EXECUTE("check_pagecache",
@@ -4949,7 +4949,7 @@ my_bool pagecache_collect_changed_blocks_with_lsn(PAGECACHE *pagecache,
ptr= str->str;
int8store(ptr, (ulonglong)stored_list_size);
ptr+= 8;
- DBUG_PRINT("info", ("found %lu dirty pages", (ulong) stored_list_size));
+ DBUG_PRINT("info", ("found %zu dirty pages", stored_list_size));
if (stored_list_size == 0)
goto end;
for (file_hash= 0; file_hash < pagecache->changed_blocks_hash_size; file_hash++)
diff --git a/storage/maria/ma_pagecache.h b/storage/maria/ma_pagecache.h
index 207ad69711f..1183f9d57e0 100644
--- a/storage/maria/ma_pagecache.h
+++ b/storage/maria/ma_pagecache.h
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
/* Page cache variable structures */
diff --git a/storage/maria/ma_pagecaches.c b/storage/maria/ma_pagecaches.c
index 8a1423ee0d7..3c4ca6fd71f 100644
--- a/storage/maria/ma_pagecaches.c
+++ b/storage/maria/ma_pagecaches.c
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
/*
Handling of multiple key caches
diff --git a/storage/maria/ma_pagecrc.c b/storage/maria/ma_pagecrc.c
index 940feb8576b..838913cc3ed 100644
--- a/storage/maria/ma_pagecrc.c
+++ b/storage/maria/ma_pagecrc.c
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#include "maria_def.h"
diff --git a/storage/maria/ma_panic.c b/storage/maria/ma_panic.c
index 8ccb17af81d..bf31132ef55 100644
--- a/storage/maria/ma_panic.c
+++ b/storage/maria/ma_panic.c
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#include "ma_fulltext.h"
diff --git a/storage/maria/ma_preload.c b/storage/maria/ma_preload.c
index 10cabca9cfc..759f88a8453 100644
--- a/storage/maria/ma_preload.c
+++ b/storage/maria/ma_preload.c
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
/*
Preload indexes into key cache
diff --git a/storage/maria/ma_range.c b/storage/maria/ma_range.c
index 3d41cb9a37d..4519fbf5730 100644
--- a/storage/maria/ma_range.c
+++ b/storage/maria/ma_range.c
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
/*
Gives a approximated number of how many records there is between two keys.
diff --git a/storage/maria/ma_recovery.c b/storage/maria/ma_recovery.c
index 59e0630be8c..08d306a89be 100644
--- a/storage/maria/ma_recovery.c
+++ b/storage/maria/ma_recovery.c
@@ -12,7 +12,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
/*
WL#3072 Maria recovery
diff --git a/storage/maria/ma_recovery.h b/storage/maria/ma_recovery.h
index 45dba0e86b3..07a43942859 100644
--- a/storage/maria/ma_recovery.h
+++ b/storage/maria/ma_recovery.h
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
/*
WL#3072 Maria recovery
diff --git a/storage/maria/ma_recovery_util.c b/storage/maria/ma_recovery_util.c
index 57cb5724561..ac51df44843 100644
--- a/storage/maria/ma_recovery_util.c
+++ b/storage/maria/ma_recovery_util.c
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
/*
Q: Why isn't ma_recovery_util.c simply moved to ma_recovery.c ?
diff --git a/storage/maria/ma_recovery_util.h b/storage/maria/ma_recovery_util.h
index a35fea84fe9..9caf52c6983 100644
--- a/storage/maria/ma_recovery_util.h
+++ b/storage/maria/ma_recovery_util.h
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
struct st_dirty_page /* used only in the REDO phase */
{
diff --git a/storage/maria/ma_rename.c b/storage/maria/ma_rename.c
index 2f798a95dc5..71e2dea9d7e 100644
--- a/storage/maria/ma_rename.c
+++ b/storage/maria/ma_rename.c
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
/*
Rename a table
diff --git a/storage/maria/ma_rfirst.c b/storage/maria/ma_rfirst.c
index 226aaa551f0..8a2f0dfb1c1 100644
--- a/storage/maria/ma_rfirst.c
+++ b/storage/maria/ma_rfirst.c
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#include "maria_def.h"
diff --git a/storage/maria/ma_rkey.c b/storage/maria/ma_rkey.c
index 06db57dfab7..58e47089ce9 100644
--- a/storage/maria/ma_rkey.c
+++ b/storage/maria/ma_rkey.c
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
/* Read record based on a key */
diff --git a/storage/maria/ma_rlast.c b/storage/maria/ma_rlast.c
index a9a470d37d9..5b7732415b2 100644
--- a/storage/maria/ma_rlast.c
+++ b/storage/maria/ma_rlast.c
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#include "maria_def.h"
diff --git a/storage/maria/ma_rnext.c b/storage/maria/ma_rnext.c
index b4c1692d77d..82db1468f29 100644
--- a/storage/maria/ma_rnext.c
+++ b/storage/maria/ma_rnext.c
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#include "maria_def.h"
diff --git a/storage/maria/ma_rnext_same.c b/storage/maria/ma_rnext_same.c
index 353d06adaf4..b293943a13e 100644
--- a/storage/maria/ma_rnext_same.c
+++ b/storage/maria/ma_rnext_same.c
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#include "maria_def.h"
#include "ma_rt_index.h"
diff --git a/storage/maria/ma_rprev.c b/storage/maria/ma_rprev.c
index f4d25c0f676..f533f40d433 100644
--- a/storage/maria/ma_rprev.c
+++ b/storage/maria/ma_rprev.c
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#include "maria_def.h"
diff --git a/storage/maria/ma_rrnd.c b/storage/maria/ma_rrnd.c
index 8c35c71c95e..1f825294770 100644
--- a/storage/maria/ma_rrnd.c
+++ b/storage/maria/ma_rrnd.c
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
/* Read a record with random-access. The position to the record must
get by MARIA_HA. The next record can be read with pos= MARIA_POS_ERROR */
diff --git a/storage/maria/ma_rsame.c b/storage/maria/ma_rsame.c
index 0f29cb71370..aa45dbc2b52 100644
--- a/storage/maria/ma_rsame.c
+++ b/storage/maria/ma_rsame.c
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#include "maria_def.h"
diff --git a/storage/maria/ma_rsamepos.c b/storage/maria/ma_rsamepos.c
index d2099e7b116..f894003f032 100644
--- a/storage/maria/ma_rsamepos.c
+++ b/storage/maria/ma_rsamepos.c
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
/* read record through position and fix key-position */
/* As maria_rsame but supply a position */
diff --git a/storage/maria/ma_rt_index.c b/storage/maria/ma_rt_index.c
index 320418c15ed..c92045eb245 100644
--- a/storage/maria/ma_rt_index.c
+++ b/storage/maria/ma_rt_index.c
@@ -12,7 +12,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#include "maria_def.h"
#include "trnman.h"
diff --git a/storage/maria/ma_rt_index.h b/storage/maria/ma_rt_index.h
index dacaa4389b7..d8bd2dc9c73 100644
--- a/storage/maria/ma_rt_index.h
+++ b/storage/maria/ma_rt_index.h
@@ -12,7 +12,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#ifndef _rt_index_h
#define _rt_index_h
diff --git a/storage/maria/ma_rt_key.c b/storage/maria/ma_rt_key.c
index fa173605cd3..488137ff159 100644
--- a/storage/maria/ma_rt_key.c
+++ b/storage/maria/ma_rt_key.c
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#include "maria_def.h"
#include "trnman.h"
diff --git a/storage/maria/ma_rt_key.h b/storage/maria/ma_rt_key.h
index 948809f3d38..3d0616cea8a 100644
--- a/storage/maria/ma_rt_key.h
+++ b/storage/maria/ma_rt_key.h
@@ -12,7 +12,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
/* Written by Ramil Kalimullin, who has a shared copyright to this code */
diff --git a/storage/maria/ma_rt_mbr.c b/storage/maria/ma_rt_mbr.c
index 496ace2a84f..4c00f7cdadf 100644
--- a/storage/maria/ma_rt_mbr.c
+++ b/storage/maria/ma_rt_mbr.c
@@ -12,7 +12,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#include "maria_def.h"
diff --git a/storage/maria/ma_rt_mbr.h b/storage/maria/ma_rt_mbr.h
index 8fcd3d37b99..535ef68ca5d 100644
--- a/storage/maria/ma_rt_mbr.h
+++ b/storage/maria/ma_rt_mbr.h
@@ -12,7 +12,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#ifndef _rt_mbr_h
#define _rt_mbr_h
diff --git a/storage/maria/ma_rt_split.c b/storage/maria/ma_rt_split.c
index d14422a21d2..c26c0277e4f 100644
--- a/storage/maria/ma_rt_split.c
+++ b/storage/maria/ma_rt_split.c
@@ -12,7 +12,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#include "maria_def.h"
#include "trnman.h"
diff --git a/storage/maria/ma_rt_test.c b/storage/maria/ma_rt_test.c
index 9d8574212ca..88e4d7089e0 100644
--- a/storage/maria/ma_rt_test.c
+++ b/storage/maria/ma_rt_test.c
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
/* Testing of the basic functions of a MARIA rtree table */
/* Written by Alex Barkov who has a shared copyright to this code */
diff --git a/storage/maria/ma_scan.c b/storage/maria/ma_scan.c
index ad526211615..9a2cd8cd5d3 100644
--- a/storage/maria/ma_scan.c
+++ b/storage/maria/ma_scan.c
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
/* Read through all rows sequntially */
diff --git a/storage/maria/ma_search.c b/storage/maria/ma_search.c
index 14ff084332e..951850b16a4 100644
--- a/storage/maria/ma_search.c
+++ b/storage/maria/ma_search.c
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
/* key handling functions */
diff --git a/storage/maria/ma_servicethread.c b/storage/maria/ma_servicethread.c
index d92c5315933..e495b15eef2 100644
--- a/storage/maria/ma_servicethread.c
+++ b/storage/maria/ma_servicethread.c
@@ -12,7 +12,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#include "maria_def.h"
#include "ma_servicethread.h"
diff --git a/storage/maria/ma_servicethread.h b/storage/maria/ma_servicethread.h
index 254225bd608..f33908a97a2 100644
--- a/storage/maria/ma_servicethread.h
+++ b/storage/maria/ma_servicethread.h
@@ -12,7 +12,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#include <my_pthread.h>
diff --git a/storage/maria/ma_sort.c b/storage/maria/ma_sort.c
index 287ea36da60..edd5650e07b 100644
--- a/storage/maria/ma_sort.c
+++ b/storage/maria/ma_sort.c
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
/*
Creates a index for a database by reading keys, sorting them and outputing
diff --git a/storage/maria/ma_sp_defs.h b/storage/maria/ma_sp_defs.h
index 398bf99c52e..a8cea1fc0f3 100644
--- a/storage/maria/ma_sp_defs.h
+++ b/storage/maria/ma_sp_defs.h
@@ -12,7 +12,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#ifndef _SP_DEFS_H
#define _SP_DEFS_H
diff --git a/storage/maria/ma_sp_key.c b/storage/maria/ma_sp_key.c
index e64dd2c6f59..2a663c22ee2 100644
--- a/storage/maria/ma_sp_key.c
+++ b/storage/maria/ma_sp_key.c
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#include "maria_def.h"
#include "ma_blockrec.h" /* For ROW_FLAG_TRANSID */
diff --git a/storage/maria/ma_sp_test.c b/storage/maria/ma_sp_test.c
index 1aa16e0d5e1..64c56a194b5 100644
--- a/storage/maria/ma_sp_test.c
+++ b/storage/maria/ma_sp_test.c
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
/* Testing of the basic functions of a MARIA spatial table */
/* Written by Alex Barkov, who has a shared copyright to this code */
diff --git a/storage/maria/ma_state.c b/storage/maria/ma_state.c
index 0c673ded04e..88ce88b8f98 100644
--- a/storage/maria/ma_state.c
+++ b/storage/maria/ma_state.c
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
/*
Functions to maintain live statistics for Maria transactional tables
diff --git a/storage/maria/ma_state.h b/storage/maria/ma_state.h
index 2903986e32a..5ff6dc26337 100644
--- a/storage/maria/ma_state.h
+++ b/storage/maria/ma_state.h
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
/* Struct to store tables in use by one transaction */
diff --git a/storage/maria/ma_static.c b/storage/maria/ma_static.c
index 2877f05c8dc..12fb26aa466 100644
--- a/storage/maria/ma_static.c
+++ b/storage/maria/ma_static.c
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
/*
@@ -107,12 +107,6 @@ uint32 maria_readnext_vec[]=
SEARCH_BIGGER, SEARCH_SMALLER, SEARCH_SMALLER
};
-static int always_valid(const char *filename __attribute__((unused)))
-{
- return 0;
-}
-
-int (*maria_test_invalid_symlink)(const char *filename)= always_valid;
my_bool (*ma_killed)(MARIA_HA *)= ma_killed_standalone;
#ifdef HAVE_PSI_INTERFACE
diff --git a/storage/maria/ma_statrec.c b/storage/maria/ma_statrec.c
index 89a5a30f490..61a1731b71c 100644
--- a/storage/maria/ma_statrec.c
+++ b/storage/maria/ma_statrec.c
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
/* Functions to handle fixed-length-records */
diff --git a/storage/maria/ma_test1.c b/storage/maria/ma_test1.c
index a32ed77e437..07da313db8a 100644
--- a/storage/maria/ma_test1.c
+++ b/storage/maria/ma_test1.c
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
/* Testing of the basic functions of a MARIA table */
diff --git a/storage/maria/ma_test2.c b/storage/maria/ma_test2.c
index 8f8849785b8..6dfa04a5217 100644
--- a/storage/maria/ma_test2.c
+++ b/storage/maria/ma_test2.c
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
/* Test av isam-databas: stor test */
diff --git a/storage/maria/ma_test3.c b/storage/maria/ma_test3.c
index 5d57bef8f9e..f81d5363c6b 100644
--- a/storage/maria/ma_test3.c
+++ b/storage/maria/ma_test3.c
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
/* Test av locking */
diff --git a/storage/maria/ma_unique.c b/storage/maria/ma_unique.c
index ec22a7a0112..72104e25e3f 100644
--- a/storage/maria/ma_unique.c
+++ b/storage/maria/ma_unique.c
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
/* Functions to check if a row is unique */
diff --git a/storage/maria/ma_update.c b/storage/maria/ma_update.c
index 4385f2d306c..0e006d2473d 100644
--- a/storage/maria/ma_update.c
+++ b/storage/maria/ma_update.c
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#include "ma_fulltext.h"
#include "ma_rt_index.h"
diff --git a/storage/maria/ma_write.c b/storage/maria/ma_write.c
index 63bbdf83854..fdcb5abd090 100644
--- a/storage/maria/ma_write.c
+++ b/storage/maria/ma_write.c
@@ -12,7 +12,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
/* Write a row to a MARIA table */
diff --git a/storage/maria/maria_chk.c b/storage/maria/maria_chk.c
index 0e347cbbd47..2b6f8164135 100644
--- a/storage/maria/maria_chk.c
+++ b/storage/maria/maria_chk.c
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
/* Describe, check and repair of MARIA tables */
@@ -1275,7 +1275,7 @@ static int maria_chk(HA_CHECK *param, char *filename)
mysql_file_close(info->dfile.file, MYF(MY_WME)); /* Close new file */
error|=maria_change_to_newfile(filename,MARIA_NAME_DEXT,DATA_TMP_EXT,
0, MYF(0));
- if (_ma_open_datafile(info,info->s, NullS, -1))
+ if (_ma_open_datafile(info, info->s))
error=1;
param->out_flag&= ~O_NEW_DATA; /* We are using new datafile */
param->read_cache.file= info->dfile.file;
diff --git a/storage/maria/maria_def.h b/storage/maria/maria_def.h
index f3c66e87c46..8664157a65a 100644
--- a/storage/maria/maria_def.h
+++ b/storage/maria/maria_def.h
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
/* This file is included by all internal maria files */
@@ -889,7 +889,7 @@ struct st_maria_handler
#define PACK_TYPE_SELECTED 1U /* Bits in field->pack_type */
#define PACK_TYPE_SPACE_FIELDS 2U
#define PACK_TYPE_ZERO_FILL 4U
-#define MARIA_FOUND_WRONG_KEY 32738 /* Impossible value from ha_key_cmp */
+#define MARIA_FOUND_WRONG_KEY 32768U /* Impossible value from ha_key_cmp */
#define MARIA_BLOCK_SIZE(key_length,data_pointer,key_pointer,block_size) (((((key_length)+(data_pointer)+(key_pointer))*4+(key_pointer)+2)/(block_size)+1)*(block_size))
#define MARIA_MAX_KEYPTR_SIZE 5 /* For calculating block lengths */
@@ -1346,8 +1346,7 @@ int _ma_def_scan_restore_pos(MARIA_HA *info, MARIA_RECORD_POS lastpos);
extern MARIA_HA *_ma_test_if_reopen(const char *filename);
my_bool _ma_check_table_is_closed(const char *name, const char *where);
-int _ma_open_datafile(MARIA_HA *info, MARIA_SHARE *share, const char *org_name,
- File file_to_dup);
+int _ma_open_datafile(MARIA_HA *info, MARIA_SHARE *share);
int _ma_open_keyfile(MARIA_SHARE *share);
void _ma_setup_functions(register MARIA_SHARE *share);
my_bool _ma_dynmap_file(MARIA_HA *info, my_off_t size);
diff --git a/storage/maria/maria_dump_log.c b/storage/maria/maria_dump_log.c
index d5ce3913474..42c694bf1bf 100644
--- a/storage/maria/maria_dump_log.c
+++ b/storage/maria/maria_dump_log.c
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#include "maria_def.h"
#include <my_getopt.h>
diff --git a/storage/maria/maria_ftdump.c b/storage/maria/maria_ftdump.c
index 4e34678c8f8..4a1b610ff48 100644
--- a/storage/maria/maria_ftdump.c
+++ b/storage/maria/maria_ftdump.c
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
/* Written by Sergei A. Golubchik, who has a shared copyright to this code
added support for long options (my_getopt) 22.5.2002 by Jani Tolonen */
diff --git a/storage/maria/maria_pack.c b/storage/maria/maria_pack.c
index 280c5ff8f0a..814c50e1db8 100644
--- a/storage/maria/maria_pack.c
+++ b/storage/maria/maria_pack.c
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
/* Pack MARIA file */
diff --git a/storage/maria/maria_read_log.c b/storage/maria/maria_read_log.c
index 1087889b5b7..a0724b2199b 100644
--- a/storage/maria/maria_read_log.c
+++ b/storage/maria/maria_read_log.c
@@ -12,7 +12,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#include "maria_def.h"
#include "ma_recovery.h"
diff --git a/storage/maria/tablockman.c b/storage/maria/tablockman.c
index 6b538381329..994e323a17e 100644
--- a/storage/maria/tablockman.c
+++ b/storage/maria/tablockman.c
@@ -13,7 +13,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#include <my_base.h>
#include <hash.h>
diff --git a/storage/maria/tablockman.h b/storage/maria/tablockman.h
index 0ccf92aa0a3..0a76c9a0754 100644
--- a/storage/maria/tablockman.h
+++ b/storage/maria/tablockman.h
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#ifndef _tablockman_h
#define _tablockman_h
diff --git a/storage/maria/trnman.c b/storage/maria/trnman.c
index 3ada502988a..bc48d39baaa 100644
--- a/storage/maria/trnman.c
+++ b/storage/maria/trnman.c
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#include <my_global.h>
diff --git a/storage/maria/trnman.h b/storage/maria/trnman.h
index 77e2916390a..66139a31230 100644
--- a/storage/maria/trnman.h
+++ b/storage/maria/trnman.h
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#ifndef _trnman_h
#define _trnman_h
diff --git a/storage/maria/trnman_public.h b/storage/maria/trnman_public.h
index 9523eb5de8f..5254bd79817 100644
--- a/storage/maria/trnman_public.h
+++ b/storage/maria/trnman_public.h
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
/*
diff --git a/storage/maria/unittest/lockman-t.c b/storage/maria/unittest/lockman-t.c
index 9b54a3d8ff9..6230f6a09d8 100644
--- a/storage/maria/unittest/lockman-t.c
+++ b/storage/maria/unittest/lockman-t.c
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
/*
lockman for row and table locks
diff --git a/storage/maria/unittest/lockman1-t.c b/storage/maria/unittest/lockman1-t.c
index ca959c6e6e3..8033c5e90cd 100644
--- a/storage/maria/unittest/lockman1-t.c
+++ b/storage/maria/unittest/lockman1-t.c
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
/*
lockman for row locks, tablockman for table locks
diff --git a/storage/maria/unittest/lockman2-t.c b/storage/maria/unittest/lockman2-t.c
index c1d40159500..2ce24f5c90e 100644
--- a/storage/maria/unittest/lockman2-t.c
+++ b/storage/maria/unittest/lockman2-t.c
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
/*
tablockman for row and table locks
diff --git a/storage/maria/unittest/ma_control_file-t.c b/storage/maria/unittest/ma_control_file-t.c
index 5fdaa1c6321..25ec982133a 100644
--- a/storage/maria/unittest/ma_control_file-t.c
+++ b/storage/maria/unittest/ma_control_file-t.c
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
/* Unit test of the control file module of the Aria engine WL#3234 */
diff --git a/storage/maria/unittest/ma_loghandler_examples.c b/storage/maria/unittest/ma_loghandler_examples.c
index cd5d927587a..fa0b546cdd2 100644
--- a/storage/maria/unittest/ma_loghandler_examples.c
+++ b/storage/maria/unittest/ma_loghandler_examples.c
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#include "../maria_def.h"
diff --git a/storage/maria/unittest/ma_maria_log_cleanup.c b/storage/maria/unittest/ma_maria_log_cleanup.c
index 6ecec9bbc19..23e5be739d1 100644
--- a/storage/maria/unittest/ma_maria_log_cleanup.c
+++ b/storage/maria/unittest/ma_maria_log_cleanup.c
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#include "../maria_def.h"
#ifdef _WIN32
diff --git a/storage/maria/unittest/ma_pagecache_consist.c b/storage/maria/unittest/ma_pagecache_consist.c
index 2c505428dab..a9223ca9f6f 100644
--- a/storage/maria/unittest/ma_pagecache_consist.c
+++ b/storage/maria/unittest/ma_pagecache_consist.c
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
/*
TODO: use pthread_join instead of wait_for_thread_count_to_be_zero, like in
diff --git a/storage/maria/unittest/ma_pagecache_rwconsist.c b/storage/maria/unittest/ma_pagecache_rwconsist.c
index dbeb3a98052..0b05d976516 100644
--- a/storage/maria/unittest/ma_pagecache_rwconsist.c
+++ b/storage/maria/unittest/ma_pagecache_rwconsist.c
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
/*
TODO: use pthread_join instead of wait_for_thread_count_to_be_zero, like in
diff --git a/storage/maria/unittest/ma_pagecache_rwconsist2.c b/storage/maria/unittest/ma_pagecache_rwconsist2.c
index c06395d0fb3..cfc877d5556 100644
--- a/storage/maria/unittest/ma_pagecache_rwconsist2.c
+++ b/storage/maria/unittest/ma_pagecache_rwconsist2.c
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
/**
diff --git a/storage/maria/unittest/ma_pagecache_single.c b/storage/maria/unittest/ma_pagecache_single.c
index 6ae6f5b87a4..e149af7cf5e 100644
--- a/storage/maria/unittest/ma_pagecache_single.c
+++ b/storage/maria/unittest/ma_pagecache_single.c
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
/*
TODO: use pthread_join instead of wait_for_thread_count_to_be_zero, like in
diff --git a/storage/maria/unittest/ma_test_loghandler-t.c b/storage/maria/unittest/ma_test_loghandler-t.c
index 27e0b7ce8e5..aa8615e9b77 100644
--- a/storage/maria/unittest/ma_test_loghandler-t.c
+++ b/storage/maria/unittest/ma_test_loghandler-t.c
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#include "../maria_def.h"
#include <stdio.h>
diff --git a/storage/maria/unittest/ma_test_loghandler_first_lsn-t.c b/storage/maria/unittest/ma_test_loghandler_first_lsn-t.c
index f26a98f7e6b..9306be3958e 100644
--- a/storage/maria/unittest/ma_test_loghandler_first_lsn-t.c
+++ b/storage/maria/unittest/ma_test_loghandler_first_lsn-t.c
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#include "../maria_def.h"
#include <stdio.h>
diff --git a/storage/maria/unittest/ma_test_loghandler_max_lsn-t.c b/storage/maria/unittest/ma_test_loghandler_max_lsn-t.c
index 40acd96e154..9ff391b3814 100644
--- a/storage/maria/unittest/ma_test_loghandler_max_lsn-t.c
+++ b/storage/maria/unittest/ma_test_loghandler_max_lsn-t.c
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#include "../maria_def.h"
#include <stdio.h>
diff --git a/storage/maria/unittest/ma_test_loghandler_multigroup-t.c b/storage/maria/unittest/ma_test_loghandler_multigroup-t.c
index 308e4c5a3d1..39cff18a3ab 100644
--- a/storage/maria/unittest/ma_test_loghandler_multigroup-t.c
+++ b/storage/maria/unittest/ma_test_loghandler_multigroup-t.c
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#include "../maria_def.h"
#include <stdio.h>
diff --git a/storage/maria/unittest/ma_test_loghandler_multithread-t.c b/storage/maria/unittest/ma_test_loghandler_multithread-t.c
index 84679854f36..ff843937fcd 100644
--- a/storage/maria/unittest/ma_test_loghandler_multithread-t.c
+++ b/storage/maria/unittest/ma_test_loghandler_multithread-t.c
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#include "../maria_def.h"
#include <stdio.h>
diff --git a/storage/maria/unittest/ma_test_loghandler_noflush-t.c b/storage/maria/unittest/ma_test_loghandler_noflush-t.c
index b8ef5617743..9555cc0842f 100644
--- a/storage/maria/unittest/ma_test_loghandler_noflush-t.c
+++ b/storage/maria/unittest/ma_test_loghandler_noflush-t.c
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#include "../maria_def.h"
#include <stdio.h>
diff --git a/storage/maria/unittest/ma_test_loghandler_nologs-t.c b/storage/maria/unittest/ma_test_loghandler_nologs-t.c
index 990cbd050e1..a6ccfd754de 100644
--- a/storage/maria/unittest/ma_test_loghandler_nologs-t.c
+++ b/storage/maria/unittest/ma_test_loghandler_nologs-t.c
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#include "../maria_def.h"
#include <stdio.h>
diff --git a/storage/maria/unittest/ma_test_loghandler_pagecache-t.c b/storage/maria/unittest/ma_test_loghandler_pagecache-t.c
index 365d15c69b8..0d9382d34f1 100644
--- a/storage/maria/unittest/ma_test_loghandler_pagecache-t.c
+++ b/storage/maria/unittest/ma_test_loghandler_pagecache-t.c
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#include "../maria_def.h"
#include <stdio.h>
diff --git a/storage/maria/unittest/ma_test_loghandler_purge-t.c b/storage/maria/unittest/ma_test_loghandler_purge-t.c
index ac66070f37c..ef31b47c9c5 100644
--- a/storage/maria/unittest/ma_test_loghandler_purge-t.c
+++ b/storage/maria/unittest/ma_test_loghandler_purge-t.c
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#include "../maria_def.h"
#include <stdio.h>
diff --git a/storage/maria/unittest/sequence_storage.c b/storage/maria/unittest/sequence_storage.c
index 0bd120c43d3..9165ac1b248 100644
--- a/storage/maria/unittest/sequence_storage.c
+++ b/storage/maria/unittest/sequence_storage.c
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#include "../maria_def.h"
#include "sequence_storage.h"
diff --git a/storage/maria/unittest/sequence_storage.h b/storage/maria/unittest/sequence_storage.h
index 78ce15a6253..9bee33c5bbf 100644
--- a/storage/maria/unittest/sequence_storage.h
+++ b/storage/maria/unittest/sequence_storage.h
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
typedef struct st_seq_storage
diff --git a/storage/maria/unittest/test_file.c b/storage/maria/unittest/test_file.c
index 1a14f2e8ec5..7ee38c57068 100644
--- a/storage/maria/unittest/test_file.c
+++ b/storage/maria/unittest/test_file.c
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#include <tap.h> /* Includes my_global.h */
#include <my_sys.h>
diff --git a/storage/maria/unittest/test_file.h b/storage/maria/unittest/test_file.h
index 5b33f0e4f6c..10d77c9c6bd 100644
--- a/storage/maria/unittest/test_file.h
+++ b/storage/maria/unittest/test_file.h
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#include <m_string.h>
#include "../ma_pagecache.h"
diff --git a/storage/maria/unittest/trnman-t.c b/storage/maria/unittest/trnman-t.c
index 78740eac9c1..ede899bc303 100644
--- a/storage/maria/unittest/trnman-t.c
+++ b/storage/maria/unittest/trnman-t.c
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#include <tap.h>
diff --git a/storage/mroonga/CMakeLists.txt b/storage/mroonga/CMakeLists.txt
index 5c70e14d416..be14e73bd65 100644
--- a/storage/mroonga/CMakeLists.txt
+++ b/storage/mroonga/CMakeLists.txt
@@ -15,7 +15,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
cmake_minimum_required(VERSION 2.6)
project(mroonga)
diff --git a/storage/mroonga/config.sh.in b/storage/mroonga/config.sh.in
index 2b584c6916d..e86973bdf88 100644
--- a/storage/mroonga/config.sh.in
+++ b/storage/mroonga/config.sh.in
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
MYSQL_SOURCE_DIR="@MYSQL_SOURCE_DIR@"
MYSQL_BUILD_DIR="@MYSQL_BUILD_DIR@"
diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/check_freebsd.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/check_freebsd.inc
index 89700a87cff..39503a9c68d 100644
--- a/storage/mroonga/mysql-test/mroonga/include/mroonga/check_freebsd.inc
+++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/check_freebsd.inc
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--disable_query_log
let $VERSION_COMPILE_OS_FREEBSD=`SELECT IF(@@version_compile_os like 'FREEBSD%', 1, 0);`;
diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/check_ha_mroonga_so.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/check_ha_mroonga_so.inc
index 94cf42dd5ab..b2212fd94a8 100644
--- a/storage/mroonga/mysql-test/mroonga/include/mroonga/check_ha_mroonga_so.inc
+++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/check_ha_mroonga_so.inc
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/check_windows.inc
diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/check_libgroonga_embedded.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/check_libgroonga_embedded.inc
index 02c21ff32c6..6f89f05b869 100644
--- a/storage/mroonga/mysql-test/mroonga/include/mroonga/check_libgroonga_embedded.inc
+++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/check_libgroonga_embedded.inc
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--disable_query_log
let $libgroonga_embedded = `SELECT @@mroonga_libgroonga_embedded;`;
diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/check_libgroonga_support_lz4.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/check_libgroonga_support_lz4.inc
index 1c74cbffc46..076be2582ba 100644
--- a/storage/mroonga/mysql-test/mroonga/include/mroonga/check_libgroonga_support_lz4.inc
+++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/check_libgroonga_support_lz4.inc
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--disable_query_log
let $libgroonga_support_lz4 =
diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/check_libgroonga_support_zlib.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/check_libgroonga_support_zlib.inc
index 5ab5fcd2fb8..5d4862957ae 100644
--- a/storage/mroonga/mysql-test/mroonga/include/mroonga/check_libgroonga_support_zlib.inc
+++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/check_libgroonga_support_zlib.inc
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--disable_query_log
let $libgroonga_support_zlib =
diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/check_mariadb.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/check_mariadb.inc
index 13b2f3439e1..0ef2199b704 100644
--- a/storage/mroonga/mysql-test/mroonga/include/mroonga/check_mariadb.inc
+++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/check_mariadb.inc
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--disable_query_log
let $mariadb = `SELECT LOCATE('MariaDB', @@global.version) > 0`;
diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/check_osx.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/check_osx.inc
index 8b8387a74fb..a664a9c51f4 100644
--- a/storage/mroonga/mysql-test/mroonga/include/mroonga/check_osx.inc
+++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/check_osx.inc
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--disable_query_log
let $VERSION_COMPILE_OS_OSX=`SELECT IF(@@version_compile_os like 'osx%', 1, 0);`;
diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/check_version.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/check_version.inc
index b78e79558d7..cfa7c008e51 100644
--- a/storage/mroonga/mysql-test/mroonga/include/mroonga/check_version.inc
+++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/check_version.inc
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--disable_query_log
let $version_major_minor =
diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/check_windows.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/check_windows.inc
index 21e61000a06..b258225fa9f 100644
--- a/storage/mroonga/mysql-test/mroonga/include/mroonga/check_windows.inc
+++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/check_windows.inc
@@ -13,7 +13,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--disable_query_log
let $VERSION_COMPILE_OS_WIN=`SELECT IF(@@version_compile_os like 'Win%', 1, 0)`;
diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/have_32bit.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/have_32bit.inc
index 41ab6bf4899..ae44649df9e 100644
--- a/storage/mroonga/mysql-test/mroonga/include/mroonga/have_32bit.inc
+++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/have_32bit.inc
@@ -13,7 +13,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/skip_osx.inc
diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/have_64bit.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/have_64bit.inc
index 3774de2f479..1b3cf9c0942 100644
--- a/storage/mroonga/mysql-test/mroonga/include/mroonga/have_64bit.inc
+++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/have_64bit.inc
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
disable_query_log;
disable_warnings;
diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/have_fractional_seconds.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/have_fractional_seconds.inc
index c4764b83c8a..90a203c91ef 100644
--- a/storage/mroonga/mysql-test/mroonga/include/mroonga/have_fractional_seconds.inc
+++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/have_fractional_seconds.inc
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/check_mariadb.inc
--source ../../include/mroonga/check_version.inc
diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/have_freebsd.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/have_freebsd.inc
index dfe198ca9ba..fc6cddc5b14 100644
--- a/storage/mroonga/mysql-test/mroonga/include/mroonga/have_freebsd.inc
+++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/have_freebsd.inc
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/check_freebsd.inc
diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/have_groonga_plugin_register.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/have_groonga_plugin_register.inc
index 414eb1702de..dfd3ae12c93 100644
--- a/storage/mroonga/mysql-test/mroonga/include/mroonga/have_groonga_plugin_register.inc
+++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/have_groonga_plugin_register.inc
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/check_libgroonga_embedded.inc
diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/have_mariadb.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/have_mariadb.inc
index 24c65a61dd9..7f76ef05021 100644
--- a/storage/mroonga/mysql-test/mroonga/include/mroonga/have_mariadb.inc
+++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/have_mariadb.inc
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/check_mariadb.inc
diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/have_mroonga.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/have_mroonga.inc
index cd17adebfe9..7bb3ca8b371 100644
--- a/storage/mroonga/mysql-test/mroonga/include/mroonga/have_mroonga.inc
+++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/have_mroonga.inc
@@ -13,7 +13,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/check_ha_mroonga_so.inc
diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/have_mroonga_deinit.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/have_mroonga_deinit.inc
index 0b6b7081d00..bd5e4cf7f9f 100644
--- a/storage/mroonga/mysql-test/mroonga/include/mroonga/have_mroonga_deinit.inc
+++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/have_mroonga_deinit.inc
@@ -13,7 +13,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
disable_query_log;
diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/have_mroonga_helper.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/have_mroonga_helper.inc
index 1a7ec750288..f0bad1a490d 100644
--- a/storage/mroonga/mysql-test/mroonga/include/mroonga/have_mroonga_helper.inc
+++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/have_mroonga_helper.inc
@@ -12,6 +12,6 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
let $MYSQLD_DATADIR= `select @@datadir`;
diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/have_mysql.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/have_mysql.inc
index d054f0a9afd..e2a791aff5e 100644
--- a/storage/mroonga/mysql-test/mroonga/include/mroonga/have_mysql.inc
+++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/have_mysql.inc
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/check_mariadb.inc
diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/have_version_100.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/have_version_100.inc
index 5643d8c8c2d..b48d4e9d1bb 100644
--- a/storage/mroonga/mysql-test/mroonga/include/mroonga/have_version_100.inc
+++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/have_version_100.inc
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/check_version.inc
diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/have_version_100_or_later.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/have_version_100_or_later.inc
index 9c9faa00ea2..09e5acc0187 100644
--- a/storage/mroonga/mysql-test/mroonga/include/mroonga/have_version_100_or_later.inc
+++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/have_version_100_or_later.inc
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/check_version.inc
diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/have_version_55.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/have_version_55.inc
index b34f7876ed8..a08d789d6f2 100644
--- a/storage/mroonga/mysql-test/mroonga/include/mroonga/have_version_55.inc
+++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/have_version_55.inc
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/check_version.inc
diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/have_version_56.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/have_version_56.inc
index 4ecff3e4466..fbb4152fc4a 100644
--- a/storage/mroonga/mysql-test/mroonga/include/mroonga/have_version_56.inc
+++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/have_version_56.inc
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/check_version.inc
diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/have_version_56_or_later.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/have_version_56_or_later.inc
index ef166fcf590..350f51616ba 100644
--- a/storage/mroonga/mysql-test/mroonga/include/mroonga/have_version_56_or_later.inc
+++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/have_version_56_or_later.inc
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/check_version.inc
diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/have_version_57.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/have_version_57.inc
index 1ab664ed6a8..ca2d06ae617 100644
--- a/storage/mroonga/mysql-test/mroonga/include/mroonga/have_version_57.inc
+++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/have_version_57.inc
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/check_version.inc
diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/load_mroonga_functions.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/load_mroonga_functions.inc
index 6df4e88ffc8..6e563721fc7 100644
--- a/storage/mroonga/mysql-test/mroonga/include/mroonga/load_mroonga_functions.inc
+++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/load_mroonga_functions.inc
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/check_ha_mroonga_so.inc
diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/skip_freebsd.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/skip_freebsd.inc
index 0c48adfee92..ed13b737fb5 100644
--- a/storage/mroonga/mysql-test/mroonga/include/mroonga/skip_freebsd.inc
+++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/skip_freebsd.inc
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/check_freebsd.inc
diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/skip_mariadb_100_or_later.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/skip_mariadb_100_or_later.inc
index 8c9f76cd45f..9fbfd222df4 100644
--- a/storage/mroonga/mysql-test/mroonga/include/mroonga/skip_mariadb_100_or_later.inc
+++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/skip_mariadb_100_or_later.inc
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/check_version.inc
--source ../../include/mroonga/check_mariadb.inc
diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/skip_mariadb_55.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/skip_mariadb_55.inc
index 8b46d606eec..93eead8791e 100644
--- a/storage/mroonga/mysql-test/mroonga/include/mroonga/skip_mariadb_55.inc
+++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/skip_mariadb_55.inc
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/check_version.inc
--source ../../include/mroonga/check_mariadb.inc
diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/skip_mysql_55.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/skip_mysql_55.inc
index 86bb34ff86d..e29fae84d46 100644
--- a/storage/mroonga/mysql-test/mroonga/include/mroonga/skip_mysql_55.inc
+++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/skip_mysql_55.inc
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/check_version.inc
--source ../../include/mroonga/check_mariadb.inc
diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/skip_mysql_57.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/skip_mysql_57.inc
index f1b1651a0b1..39ee22834e7 100644
--- a/storage/mroonga/mysql-test/mroonga/include/mroonga/skip_mysql_57.inc
+++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/skip_mysql_57.inc
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/check_version.inc
--source ../../include/mroonga/check_mariadb.inc
diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/skip_osx.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/skip_osx.inc
index a8f4409f7e7..45a70d34ad7 100644
--- a/storage/mroonga/mysql-test/mroonga/include/mroonga/skip_osx.inc
+++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/skip_osx.inc
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/check_osx.inc
diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/support_libgroonga_lz4.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/support_libgroonga_lz4.inc
index e67f826b0ce..5e21a446f1b 100644
--- a/storage/mroonga/mysql-test/mroonga/include/mroonga/support_libgroonga_lz4.inc
+++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/support_libgroonga_lz4.inc
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/check_libgroonga_support_lz4.inc
diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/support_libgroonga_zlib.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/support_libgroonga_zlib.inc
index 9f5196f742b..d04826aa7dd 100644
--- a/storage/mroonga/mysql-test/mroonga/include/mroonga/support_libgroonga_zlib.inc
+++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/support_libgroonga_zlib.inc
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/check_libgroonga_support_zlib.inc
diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/unload_mroonga_functions.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/unload_mroonga_functions.inc
index 881aa47c629..8d0d13f9125 100644
--- a/storage/mroonga/mysql-test/mroonga/include/mroonga/unload_mroonga_functions.inc
+++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/unload_mroonga_functions.inc
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--disable_query_log
DROP FUNCTION last_insert_grn_id;
diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/unsupport_libgroonga_lz4.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/unsupport_libgroonga_lz4.inc
index 80874a7a50b..dcc049078f8 100644
--- a/storage/mroonga/mysql-test/mroonga/include/mroonga/unsupport_libgroonga_lz4.inc
+++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/unsupport_libgroonga_lz4.inc
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/check_libgroonga_support_lz4.inc
diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/unsupport_libgroonga_zlib.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/unsupport_libgroonga_zlib.inc
index d6c3f6dbeda..7533f786f22 100644
--- a/storage/mroonga/mysql-test/mroonga/include/mroonga/unsupport_libgroonga_zlib.inc
+++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/unsupport_libgroonga_zlib.inc
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/check_libgroonga_support_zlib.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_after.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_after.test
index e70dcb92e12..38d4f034daa 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_after.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_after.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/not_embedded.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_first.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_first.test
index dac06ff6719..0e82b3dd4b0 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_first.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_first.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/not_embedded.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_flags_comment.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_flags_comment.test
index 96c99612190..1071faf0b81 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_flags_comment.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_flags_comment.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/not_embedded.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_flags_parameter.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_flags_parameter.test
index 0c389ba3197..70fb61cc044 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_flags_parameter.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_flags_parameter.test
@@ -13,7 +13,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mariadb.inc
--source include/not_embedded.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_groonga_type_comment.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_groonga_type_comment.test
index d77809c1a6c..8a64fe00af0 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_groonga_type_comment.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_groonga_type_comment.test
@@ -13,7 +13,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/not_embedded.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_groonga_type_parameter.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_groonga_type_parameter.test
index a65eff4529f..f34cbcdcbf7 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_groonga_type_parameter.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_groonga_type_parameter.test
@@ -13,7 +13,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mariadb.inc
--source ../../include/mroonga/have_version_56_or_later.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_multiple.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_multiple.test
index ebf8ac5d581..568deea9e29 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_multiple.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_multiple.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/not_embedded.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_plain.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_plain.test
index 01f13799c02..8c4d76a5868 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_plain.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_plain.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/not_embedded.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_type_comment.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_type_comment.test
index dd05765585d..037e81c7906 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_type_comment.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_type_comment.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/not_embedded.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_index_token_filters_one_token_filter.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_index_token_filters_one_token_filter.test
index b2312997709..83b8aef1c5a 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_index_token_filters_one_token_filter.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_index_token_filters_one_token_filter.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
--source ../../include/mroonga/have_groonga_plugin_register.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_index_unique_duplicated.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_index_unique_duplicated.test
index 1dd6b31fb64..4476decec78 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_index_unique_duplicated.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_index_unique_duplicated.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/not_embedded.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_index_unique_multiple_column_duplicated.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_index_unique_multiple_column_duplicated.test
index 72e0ebc14a4..424ae89b4a6 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_index_unique_multiple_column_duplicated.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_index_unique_multiple_column_duplicated.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/not_embedded.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_key_multiple_column_with_data.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_key_multiple_column_with_data.test
index ba06e55e1ba..94db5d40b60 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_key_multiple_column_with_data.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_key_multiple_column_with_data.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/not_embedded.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_primary_key.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_primary_key.test
index 3dbfe5e24f0..5bc12edadc4 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_primary_key.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_primary_key.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_column_comment_not_for_mroonga.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_column_comment_not_for_mroonga.test
index 7b9fc783244..98d26966bd0 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_column_comment_not_for_mroonga.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_column_comment_not_for_mroonga.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
--source ../../include/mroonga/load_mroonga_functions.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_column_have_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_column_have_index.test
index 3a86d23facf..575d65e44a2 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_column_have_index.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_column_have_index.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_column_rename_after.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_column_rename_after.test
index 16e98a9769e..295bb91e0a9 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_column_rename_after.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_column_rename_after.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/not_embedded.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_column_rename_first.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_column_rename_first.test
index 86c94afd281..01682688a74 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_column_rename_first.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_column_rename_first.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/not_embedded.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_column_rename_multiple.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_column_rename_multiple.test
index ee25b482daa..b30486d080a 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_column_rename_multiple.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_column_rename_multiple.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/not_embedded.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_column_rename_no_order.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_column_rename_no_order.test
index 12ba5606b25..88a69111f65 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_column_rename_no_order.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_column_rename_no_order.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/not_embedded.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_engine.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_engine.test
index 867c6722d36..a477d091946 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_engine.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_engine.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/not_embedded.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_token_filter.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_token_filter.test
index ada266fff0c..92380fdb8ec 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_token_filter.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_token_filter.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
--source ../../include/mroonga/have_groonga_plugin_register.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_create_fulltext.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_create_fulltext.test
index 06cdb13ba16..1f6980cc04b 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_create_fulltext.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_create_fulltext.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_fulltext_table.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_fulltext_table.test
index 97d2d2ed5ec..5cba17d2072 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_fulltext_table.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_fulltext_table.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
--source ../../include/mroonga/load_mroonga_functions.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_fulltext_ujis.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_fulltext_ujis.test
index d6e32e0f004..d7f7f446459 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_fulltext_ujis.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_fulltext_ujis.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_fulltext_utf8.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_fulltext_utf8.test
index fb89d678b75..626a1bc80a8 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_fulltext_utf8.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_fulltext_utf8.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_multiple_column.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_multiple_column.test
index 2112828684a..ea424df2e57 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_multiple_column.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_multiple_column.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_normal.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_normal.test
index f599767ab8f..186e1f5095c 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_normal.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_normal.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_primary.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_primary.test
index 4bc5fb1f643..4348efeb066 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_primary.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_primary.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_truncate.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_truncate.test
index ab990a549b1..49d9f0b8da2 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_truncate.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_truncate.test
@@ -13,7 +13,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_updating.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_updating.test
index b172ff303c1..58e53cb06f2 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_updating.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_updating.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_drop_column_multiple.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_drop_column_multiple.test
index 549a5540450..fc3acad9000 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_drop_column_multiple.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_drop_column_multiple.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/not_embedded.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_drop_column_one.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_drop_column_one.test
index 1e7248125cf..6b790e5d621 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_drop_column_one.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_drop_column_one.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/not_embedded.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_drop_key_multiple_column_with_data.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_drop_key_multiple_column_with_data.test
index 992606b4f62..956f397b965 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_drop_key_multiple_column_with_data.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_drop_key_multiple_column_with_data.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/not_embedded.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_drop_primary_key.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_drop_primary_key.test
index 87de166cbfd..95f683f1df5 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_drop_primary_key.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_drop_primary_key.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_enable_keys_fulltext.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_enable_keys_fulltext.test
index 136acfcebf2..62bbe4a4dc2 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_enable_keys_fulltext.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_enable_keys_fulltext.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_enable_keys_fulltext_table.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_enable_keys_fulltext_table.test
index 4ff4af63534..d87078e7e9c 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_enable_keys_fulltext_table.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_enable_keys_fulltext_table.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
--source ../../include/mroonga/load_mroonga_functions.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_enable_keys_fulltext_ujis.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_enable_keys_fulltext_ujis.test
index e14400808e5..cb6ade7a418 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_enable_keys_fulltext_ujis.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_enable_keys_fulltext_ujis.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_enable_keys_fulltext_utf8.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_enable_keys_fulltext_utf8.test
index 136acfcebf2..62bbe4a4dc2 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_enable_keys_fulltext_utf8.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_enable_keys_fulltext_utf8.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_enable_keys_multiple_column.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_enable_keys_multiple_column.test
index 35e6366ed62..13afdcfe0e6 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_enable_keys_multiple_column.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_enable_keys_multiple_column.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_enable_keys_normal.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_enable_keys_normal.test
index ec45b48f61e..bf2cc8bd6e2 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_enable_keys_normal.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_enable_keys_normal.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_enable_keys_primary.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_enable_keys_primary.test
index b1ebb668391..3d9523ab537 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_enable_keys_primary.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_enable_keys_primary.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_engine_decimal.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_engine_decimal.test
index fc07085df5b..71e0fda3825 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_engine_decimal.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_engine_decimal.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/have_innodb.inc
--source include/not_embedded.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_fulltext_add_no_primary_key.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_fulltext_add_no_primary_key.test
index fb52105411d..193680296dc 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_fulltext_add_no_primary_key.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_fulltext_add_no_primary_key.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/not_embedded.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_fulltext_add_normal.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_fulltext_add_normal.test
index 3bcd1259236..bf7e7501741 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_fulltext_add_normal.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_fulltext_add_normal.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/not_embedded.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_fulltext_add_table.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_fulltext_add_table.test
index efd0d9928d2..c719318d847 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_fulltext_add_table.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_fulltext_add_table.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/not_embedded.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_fulltext_drop_table.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_fulltext_drop_table.test
index ebc30945062..11799a51a65 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_fulltext_drop_table.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_fulltext_drop_table.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/not_embedded.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_modify_column_after.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_modify_column_after.test
index 710161397d5..8bdfd10024e 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_modify_column_after.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_modify_column_after.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/not_embedded.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_modify_column_first.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_modify_column_first.test
index a810b7457a5..a4dd52d9fac 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_modify_column_first.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_modify_column_first.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/not_embedded.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_modify_column_no_order.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_modify_column_no_order.test
index 7dc75e180c1..45f4748e98d 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_modify_column_no_order.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_modify_column_no_order.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/not_embedded.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_recreate_anonymous_index_at_once.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_recreate_anonymous_index_at_once.test
index 0c391219426..c44937b3f84 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_recreate_anonymous_index_at_once.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_recreate_anonymous_index_at_once.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/not_embedded.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_rename_table.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_rename_table.test
index 20fa7f35463..91898b5bb44 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_rename_table.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_rename_table.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/not_embedded.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_spatial.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_spatial.test
index 9072d837a83..e696d12f128 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_spatial.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_spatial.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/not_embedded.inc
--source include/have_geometry.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/auto_increment_TODO_SPLIT_ME.test b/storage/mroonga/mysql-test/mroonga/storage/t/auto_increment_TODO_SPLIT_ME.test
index 8ce709b1187..db018023af0 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/auto_increment_TODO_SPLIT_ME.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/auto_increment_TODO_SPLIT_ME.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/auto_increment_table_param.test b/storage/mroonga/mysql-test/mroonga/storage/t/auto_increment_table_param.test
index 59727f4abaa..169260cc808 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/auto_increment_table_param.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/auto_increment_table_param.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/auto_increment_text.test b/storage/mroonga/mysql-test/mroonga/storage/t/auto_increment_text.test
index 83f9f745019..ee4db71722c 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/auto_increment_text.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/auto_increment_text.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/binlog_TODO_SPLIT_ME.test b/storage/mroonga/mysql-test/mroonga/storage/t/binlog_TODO_SPLIT_ME.test
index 57d57347205..c67aff06674 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/binlog_TODO_SPLIT_ME.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/binlog_TODO_SPLIT_ME.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/have_log_bin.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/collation_utf8_general_ci_french.test b/storage/mroonga/mysql-test/mroonga/storage/t/collation_utf8_general_ci_french.test
index 8b4c7d6eaf7..d0df707162b 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/collation_utf8_general_ci_french.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/collation_utf8_general_ci_french.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/collation_utf8_unicode_520_ci_french.test b/storage/mroonga/mysql-test/mroonga/storage/t/collation_utf8_unicode_520_ci_french.test
index 204b1f416ad..f9e9a817a08 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/collation_utf8_unicode_520_ci_french.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/collation_utf8_unicode_520_ci_french.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_version_56_or_later.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/collation_utf8_unicode_520_ci_japanese.test b/storage/mroonga/mysql-test/mroonga/storage/t/collation_utf8_unicode_520_ci_japanese.test
index a6a18dc4846..4beec67b468 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/collation_utf8_unicode_520_ci_japanese.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/collation_utf8_unicode_520_ci_japanese.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_version_56_or_later.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/collation_utf8_unicode_ci_french.test b/storage/mroonga/mysql-test/mroonga/storage/t/collation_utf8_unicode_ci_french.test
index 6cebc9ebce9..045c9ef2a4e 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/collation_utf8_unicode_ci_french.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/collation_utf8_unicode_ci_french.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/collation_utf8_unicode_ci_japanese.test b/storage/mroonga/mysql-test/mroonga/storage/t/collation_utf8_unicode_ci_japanese.test
index dacb1cba74f..199e2904d94 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/collation_utf8_unicode_ci_japanese.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/collation_utf8_unicode_ci_japanese.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_comment_index_not_for_mroonga.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_comment_index_not_for_mroonga.test
index 620d2a9fd56..4c63dedfc60 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/column_comment_index_not_for_mroonga.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_comment_index_not_for_mroonga.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
--source ../../include/mroonga/load_mroonga_functions.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_comment_normal_not_for_mroonga.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_comment_normal_not_for_mroonga.test
index 695ac9cba61..0fcc806883d 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/column_comment_normal_not_for_mroonga.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_comment_normal_not_for_mroonga.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
--source ../../include/mroonga/load_mroonga_functions.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_date_with_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_date_with_index.test
index fc2e58fdcd9..cc713a80e5a 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/column_date_with_index.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_date_with_index.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_date_without_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_date_without_index.test
index 8dae21494db..d5587876c3c 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/column_date_without_index.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_date_without_index.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_date_zero_date.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_date_zero_date.test
index 3442abca805..762b78ec0fc 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/column_date_zero_date.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_date_zero_date.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_32bit_2038.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_32bit_2038.test
index 023f4e8b0b7..8cbf9309538 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_32bit_2038.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_32bit_2038.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_32bit.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_32bit_before_unix_epoch.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_32bit_before_unix_epoch.test
index 7e357067b54..df656eca797 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_32bit_before_unix_epoch.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_32bit_before_unix_epoch.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_32bit.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_32bit_max.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_32bit_max.test
index 863bae8ecf1..12c2a312afe 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_32bit_max.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_32bit_max.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_32bit.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_32bit_out_of_range.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_32bit_out_of_range.test
index 68ff4b664fa..337e5baa955 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_32bit_out_of_range.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_32bit_out_of_range.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_32bit.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_64bit_2038.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_64bit_2038.test
index 75c757f147a..3abf611a839 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_64bit_2038.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_64bit_2038.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_64bit.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_64bit_before_unix_epoch.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_64bit_before_unix_epoch.test
index 433e239c301..586367147cc 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_64bit_before_unix_epoch.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_64bit_before_unix_epoch.test
@@ -13,7 +13,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/skip_freebsd.inc
--source ../../include/mroonga/skip_osx.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_64bit_max.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_64bit_max.test
index 661d145087c..6599a554efd 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_64bit_max.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_64bit_max.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_64bit.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_64bit_version_55_out_of_range.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_64bit_version_55_out_of_range.test
index 14a4483a96e..bdc21cccf52 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_64bit_version_55_out_of_range.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_64bit_version_55_out_of_range.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_64bit.inc
--source ../../include/mroonga/have_version_55.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_64bit_version_56_or_later_out_of_range.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_64bit_version_56_or_later_out_of_range.test
index a4ab4da20a6..94c9cab1373 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_64bit_version_56_or_later_out_of_range.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_64bit_version_56_or_later_out_of_range.test
@@ -13,7 +13,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/skip_freebsd.inc
--source ../../include/mroonga/skip_osx.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_fractional_seconds_with_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_fractional_seconds_with_index.test
index ac10203a576..efa54b1e094 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_fractional_seconds_with_index.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_fractional_seconds_with_index.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_fractional_seconds.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_fractional_seconds_without_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_fractional_seconds_without_index.test
index 11a2b783038..f0f51fba53e 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_fractional_seconds_without_index.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_fractional_seconds_without_index.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_fractional_seconds.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_freebsd_before_unix_epoch.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_freebsd_before_unix_epoch.test
index 07b54bebc9d..e75539d4ae2 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_freebsd_before_unix_epoch.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_freebsd_before_unix_epoch.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_freebsd.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_null.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_null.test
index e1db5043319..8c30509037f 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_null.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_null.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_with_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_with_index.test
index 992249b0fae..b49897800a0 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_with_index.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_with_index.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_without_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_without_index.test
index bc0b7b2e982..b1168f63330 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_without_index.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_without_index.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_zero_date.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_zero_date.test
index c41344cf655..66ba81d79e5 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_zero_date.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_zero_date.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_zero_date_strict.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_zero_date_strict.test
index 7736fc45b7b..808313da930 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_zero_date_strict.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_zero_date_strict.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_decimal_fractional_seconds_with_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_decimal_fractional_seconds_with_index.test
index 92636b4d773..9213379336f 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/column_decimal_fractional_seconds_with_index.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_decimal_fractional_seconds_with_index.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_decimal_fractional_seconds_without_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_decimal_fractional_seconds_without_index.test
index b314342fdea..91e4b789aea 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/column_decimal_fractional_seconds_without_index.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_decimal_fractional_seconds_without_index.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_decimal_with_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_decimal_with_index.test
index ffcf737fde9..46d9ea37470 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/column_decimal_with_index.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_decimal_with_index.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_decimal_without_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_decimal_without_index.test
index d7df5c3c323..acda07ab954 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/column_decimal_without_index.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_decimal_without_index.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_enum_less_with_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_enum_less_with_index.test
index 0d96498ee04..2b7fd7de818 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/column_enum_less_with_index.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_enum_less_with_index.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_enum_many_with_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_enum_many_with_index.test
index 3f8b728105c..f4b3175764c 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/column_enum_many_with_index.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_enum_many_with_index.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga__id__id.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga__id__id.test
index 6efb3920695..ca4f154d402 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga__id__id.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga__id__id.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga__id_invalid_id.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga__id_invalid_id.test
index 9b2e59615f3..c1c16d3affc 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga__id_invalid_id.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga__id_invalid_id.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_index_fulltext_other_table.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_index_fulltext_other_table.test
index dbaf2fb429f..9c83c94b417 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_index_fulltext_other_table.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_index_fulltext_other_table.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/not_embedded.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_index_fulltext_vector_other_table.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_index_fulltext_vector_other_table.test
index e9c9bb9b5ee..5143f06a21a 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_index_fulltext_vector_other_table.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_index_fulltext_vector_other_table.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/not_embedded.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_index_int_other_table.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_index_int_other_table.test
index 27cf85033cb..9be02c2a1a2 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_index_int_other_table.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_index_int_other_table.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/not_embedded.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_scalar_reference.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_scalar_reference.test
index 6e89c70c051..b7e85909399 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_scalar_reference.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_scalar_reference.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
--source ../../include/mroonga/load_mroonga_functions.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_scalar_support_lz4.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_scalar_support_lz4.test
index 5de8f951d8f..432aab88629 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_scalar_support_lz4.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_scalar_support_lz4.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
--source ../../include/mroonga/support_libgroonga_lz4.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_scalar_support_zlib.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_scalar_support_zlib.test
index 3ec14ebef76..0f21e37c201 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_scalar_support_zlib.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_scalar_support_zlib.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
--source ../../include/mroonga/support_libgroonga_zlib.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_scalar_unsupport_lz4.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_scalar_unsupport_lz4.test
index 324b7ac89f5..d057e0bcfbd 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_scalar_unsupport_lz4.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_scalar_unsupport_lz4.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
--source ../../include/mroonga/unsupport_libgroonga_lz4.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_scalar_unsupport_zlib.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_scalar_unsupport_zlib.test
index 10e77e40e3d..1066270e48d 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_scalar_unsupport_zlib.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_scalar_unsupport_zlib.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
--source ../../include/mroonga/unsupport_libgroonga_zlib.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_scalar_with_not_for_mroonga_comment.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_scalar_with_not_for_mroonga_comment.test
index 059b8bc4bfa..b168716ed94 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_scalar_with_not_for_mroonga_comment.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_scalar_with_not_for_mroonga_comment.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/not_embedded.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_vector_order_by_with_function.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_vector_order_by_with_function.test
index 0d3be3d663d..2098e878ecb 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_vector_order_by_with_function.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_vector_order_by_with_function.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
--source ../../include/mroonga/load_mroonga_functions.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_vector_reference.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_vector_reference.test
index bb66e35f2d1..995fafefeeb 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_vector_reference.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_vector_reference.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
--source ../../include/mroonga/load_mroonga_functions.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_int_with_index_zero_value.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_int_with_index_zero_value.test
index aa33af05df3..d8d181228bb 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/column_int_with_index_zero_value.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_int_with_index_zero_value.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_set_16_with_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_set_16_with_index.test
index 9d7d40433d0..ede3a07f542 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/column_set_16_with_index.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_set_16_with_index.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_set_24_with_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_set_24_with_index.test
index c555c4ced6a..c43f5c70e13 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/column_set_24_with_index.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_set_24_with_index.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_set_32_with_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_set_32_with_index.test
index 0f772522eb6..ccddec38fa0 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/column_set_32_with_index.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_set_32_with_index.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_set_64_with_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_set_64_with_index.test
index 6552c5da805..c041a3f9ea9 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/column_set_64_with_index.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_set_64_with_index.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_set_8_with_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_set_8_with_index.test
index bd92f23deb0..d8a6a0ac36c 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/column_set_8_with_index.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_set_8_with_index.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_signed_bigint_with_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_signed_bigint_with_index.test
index c8bd7df0a15..0a2f9d30749 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/column_signed_bigint_with_index.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_signed_bigint_with_index.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_signed_int_with_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_signed_int_with_index.test
index 572f46ebbb5..b64d97fd24e 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/column_signed_int_with_index.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_signed_int_with_index.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_signed_mediumint_with_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_signed_mediumint_with_index.test
index f43395cb0aa..f2252055c10 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/column_signed_mediumint_with_index.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_signed_mediumint_with_index.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_signed_smallint_with_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_signed_smallint_with_index.test
index 4ddd446dc46..ff2eeef6a7b 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/column_signed_smallint_with_index.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_signed_smallint_with_index.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_signed_tinyint_with_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_signed_tinyint_with_index.test
index e2bca9328a9..50824bb2cba 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/column_signed_tinyint_with_index.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_signed_tinyint_with_index.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_time_fractional_seconds_with_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_time_fractional_seconds_with_index.test
index 2a920d7e387..54d127c734d 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/column_time_fractional_seconds_with_index.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_time_fractional_seconds_with_index.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
--source ../../include/mroonga/have_fractional_seconds.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_time_with_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_time_with_index.test
index f5961825259..cfa760bcae5 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/column_time_with_index.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_time_with_index.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_timestamp_fractional_seconds_with_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_timestamp_fractional_seconds_with_index.test
index 6f5e0116eb7..c2407cb1b0b 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/column_timestamp_fractional_seconds_with_index.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_timestamp_fractional_seconds_with_index.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/skip_mariadb_55.inc
--source ../../include/mroonga/have_fractional_seconds.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_timestamp_with_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_timestamp_with_index.test
index ae78befc466..f398fb9b9e2 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/column_timestamp_with_index.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_timestamp_with_index.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_tinyint_without_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_tinyint_without_index.test
index c658c873e02..9cf9cb631ec 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/column_tinyint_without_index.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_tinyint_without_index.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_unsigned_bigint_with_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_unsigned_bigint_with_index.test
index 1936842707c..2da118e27a5 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/column_unsigned_bigint_with_index.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_unsigned_bigint_with_index.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_unsigned_bigint_without_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_unsigned_bigint_without_index.test
index 8ac9715ad76..dea56970414 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/column_unsigned_bigint_without_index.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_unsigned_bigint_without_index.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_unsigned_int_with_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_unsigned_int_with_index.test
index a97024b48d8..a2eb99b1dce 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/column_unsigned_int_with_index.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_unsigned_int_with_index.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_unsigned_mediumint_with_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_unsigned_mediumint_with_index.test
index bec5917b410..e219fc0757b 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/column_unsigned_mediumint_with_index.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_unsigned_mediumint_with_index.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_unsigned_smallint_with_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_unsigned_smallint_with_index.test
index 8e389b98881..e9dcd7e1e06 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/column_unsigned_smallint_with_index.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_unsigned_smallint_with_index.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_unsigned_tinyint_with_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_unsigned_tinyint_with_index.test
index 880bc2d7cd8..d90c71df988 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/column_unsigned_tinyint_with_index.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_unsigned_tinyint_with_index.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_year_with_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_year_with_index.test
index a61dccc6439..e7cb3f69610 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/column_year_with_index.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_year_with_index.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_year_without_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_year_without_index.test
index ce1e1c21921..8b798a71837 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/column_year_without_index.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_year_without_index.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_database_name_slash.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_database_name_slash.test
index b731acda9c9..28262bb4b7d 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/create_database_name_slash.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_database_name_slash.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/not_embedded.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_TODO_SPLIT_ME.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_TODO_SPLIT_ME.test
index e448a66956f..f02e4ddcb25 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_TODO_SPLIT_ME.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_TODO_SPLIT_ME.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_comment_normal.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_comment_normal.test
index 272485d3453..18a68fb1f94 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_comment_normal.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_comment_normal.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
--source ../../include/mroonga/load_mroonga_functions.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_default_tokenizer.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_default_tokenizer.test
index 30b53f8eee0..054d311bd44 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_default_tokenizer.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_default_tokenizer.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/not_embedded.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_field_flags_comment.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_field_flags_comment.test
index 2d5498c99c8..c01d80a209b 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_field_flags_comment.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_field_flags_comment.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/not_embedded.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_field_flags_parameter.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_field_flags_parameter.test
index dbecd47dac6..cb86cddcbe7 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_field_flags_parameter.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_field_flags_parameter.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mariadb.inc
--source include/not_embedded.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_field_groonga_type_comment.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_field_groonga_type_comment.test
index aa4723b087c..d7514512b5c 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_field_groonga_type_comment.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_field_groonga_type_comment.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/not_embedded.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_field_groonga_type_nonexistent.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_field_groonga_type_nonexistent.test
index 56d81fad16c..10d00bfcbb0 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_field_groonga_type_nonexistent.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_field_groonga_type_nonexistent.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_field_groonga_type_parameter.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_field_groonga_type_parameter.test
index 325536af3d2..4b820f7b88e 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_field_groonga_type_parameter.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_field_groonga_type_parameter.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mariadb.inc
--source ../../include/mroonga/have_version_56_or_later.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_field_type_comment.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_field_type_comment.test
index 0a1340d24d1..18cfbb33da5 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_field_type_comment.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_field_type_comment.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/not_embedded.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_field_type_nonexistent.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_field_type_nonexistent.test
index 2b9a58c887c..1c3b89be67f 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_field_type_nonexistent.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_field_type_nonexistent.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_flags_comment.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_flags_comment.test
index 668a148edf9..9a22c1b09ea 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_flags_comment.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_flags_comment.test
@@ -13,7 +13,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
--source ../../include/mroonga/load_mroonga_functions.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_flags_none.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_flags_none.test
index 107b045c8fc..470283e94d8 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_flags_none.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_flags_none.test
@@ -13,7 +13,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
--source ../../include/mroonga/load_mroonga_functions.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_flags_parameter.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_flags_parameter.test
index 14c65ad54c1..77a7683bc35 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_flags_parameter.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_flags_parameter.test
@@ -13,7 +13,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mariadb.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_index_flags_none.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_index_flags_none.test
index 039c518e673..e3680ad3471 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_index_flags_none.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_index_flags_none.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
--source ../../include/mroonga/load_mroonga_functions.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_index_flags_with_position_and_with_weight.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_index_flags_with_position_and_with_weight.test
index 9a67644d2c5..7add6db7831 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_index_flags_with_position_and_with_weight.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_index_flags_with_position_and_with_weight.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
--source ../../include/mroonga/load_mroonga_functions.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_normalizer_comment.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_normalizer_comment.test
index 02e2cb9e81a..42a91ecfc15 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_normalizer_comment.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_normalizer_comment.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
--source ../../include/mroonga/load_mroonga_functions.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_normalizer_no_utf8_charset_with_utf8_normalizer.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_normalizer_no_utf8_charset_with_utf8_normalizer.test
index f28fb5b8695..c35c7dc15ce 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_normalizer_no_utf8_charset_with_utf8_normalizer.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_normalizer_no_utf8_charset_with_utf8_normalizer.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
--source ../../include/mroonga/load_mroonga_functions.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_normalizer_none.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_normalizer_none.test
index ae4d4cb9f1b..fe9037843bf 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_normalizer_none.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_normalizer_none.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
--source ../../include/mroonga/load_mroonga_functions.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_normalizer_parameter.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_normalizer_parameter.test
index a42b30b72a1..5739e118ae3 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_normalizer_parameter.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_normalizer_parameter.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mariadb.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_parser_comment.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_parser_comment.test
index 1b728afa1c1..7048ab6e764 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_parser_comment.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_parser_comment.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_parser_default.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_parser_default.test
index a1756ad268e..e163201e859 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_parser_default.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_parser_default.test
@@ -13,7 +13,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_parser_off.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_parser_off.test
index 0869e2334b7..69a48eb7851 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_parser_off.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_parser_off.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_token_filters_multiple_token_filters.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_token_filters_multiple_token_filters.test
index 534ff998ff0..a58a408cf59 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_token_filters_multiple_token_filters.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_token_filters_multiple_token_filters.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
--source ../../include/mroonga/have_groonga_plugin_register.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_token_filters_one_token_filter.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_token_filters_one_token_filter.test
index 77d886579ba..0d560582184 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_token_filters_one_token_filter.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_token_filters_one_token_filter.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
--source ../../include/mroonga/have_groonga_plugin_register.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_token_filters_parameter.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_token_filters_parameter.test
index d9458f4402d..956044c7618 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_token_filters_parameter.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_token_filters_parameter.test
@@ -13,7 +13,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mariadb.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_tokenizer_comment.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_tokenizer_comment.test
index 4bf386a4c11..688783b9743 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_tokenizer_comment.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_tokenizer_comment.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_tokenizer_default.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_tokenizer_default.test
index 069e06b4a84..c7acf23cb31 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_tokenizer_default.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_tokenizer_default.test
@@ -13,7 +13,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_tokenizer_off.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_tokenizer_off.test
index 5aff5e3575b..e9c1fdf473c 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_tokenizer_off.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_tokenizer_off.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_tokenizer_parameter.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_tokenizer_parameter.test
index d79eaefe3f6..222cc59e402 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_tokenizer_parameter.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_tokenizer_parameter.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mariadb.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_table_normalizer_default.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_table_normalizer_default.test
index 1da8026f56d..c161c50626d 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_table_normalizer_default.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_table_normalizer_default.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
--source ../../include/mroonga/load_mroonga_functions.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_table_normalizer_hash.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_table_normalizer_hash.test
index 14b9ea9ab87..22b3061ced2 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_table_normalizer_hash.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_table_normalizer_hash.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
--source ../../include/mroonga/load_mroonga_functions.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_table_token_filters_multiple_token_filters.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_table_token_filters_multiple_token_filters.test
index 944838e2fe0..0c0fb1394cc 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_table_token_filters_multiple_token_filters.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_table_token_filters_multiple_token_filters.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
--source ../../include/mroonga/have_groonga_plugin_register.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_table_token_filters_one_token_filter.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_table_token_filters_one_token_filter.test
index 701a4ae425b..74d40a1adc3 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_table_token_filters_one_token_filter.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_table_token_filters_one_token_filter.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
--source ../../include/mroonga/have_groonga_plugin_register.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_table_token_filters_stop_word.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_table_token_filters_stop_word.test
index b2e6be600f1..62cc9ed172f 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_table_token_filters_stop_word.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_table_token_filters_stop_word.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
--source ../../include/mroonga/have_groonga_plugin_register.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/delete_fulltext_column.test b/storage/mroonga/mysql-test/mroonga/storage/t/delete_fulltext_column.test
index a43f5c6511b..89e6c347c8c 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/delete_fulltext_column.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/delete_fulltext_column.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/delete_index_btree_many_records.test b/storage/mroonga/mysql-test/mroonga/storage/t/delete_index_btree_many_records.test
index 224929fe308..aa38839f9ca 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/delete_index_btree_many_records.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/delete_index_btree_many_records.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/delete_index_hash_id_no_unique.test b/storage/mroonga/mysql-test/mroonga/storage/t/delete_index_hash_id_no_unique.test
index a23ca3bae5c..44f6bba6adc 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/delete_index_hash_id_no_unique.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/delete_index_hash_id_no_unique.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/delete_index_hash_id_unique.test b/storage/mroonga/mysql-test/mroonga/storage/t/delete_index_hash_id_unique.test
index 559b3a15be6..7c562842a95 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/delete_index_hash_id_unique.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/delete_index_hash_id_unique.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/delete_normal_column.test b/storage/mroonga/mysql-test/mroonga/storage/t/delete_normal_column.test
index 2f94a8242d3..513c56f074d 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/delete_normal_column.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/delete_normal_column.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/delete_unsigned_bigint.test b/storage/mroonga/mysql-test/mroonga/storage/t/delete_unsigned_bigint.test
index e174710934b..0199dd14a5d 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/delete_unsigned_bigint.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/delete_unsigned_bigint.test
@@ -13,7 +13,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/drop_database_TODO_SPLIT_ME.test b/storage/mroonga/mysql-test/mroonga/storage/t/drop_database_TODO_SPLIT_ME.test
index 74f840944f9..3d8430703a2 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/drop_database_TODO_SPLIT_ME.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/drop_database_TODO_SPLIT_ME.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/not_embedded.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/drop_table_TODO_SPLIT_ME.test b/storage/mroonga/mysql-test/mroonga/storage/t/drop_table_TODO_SPLIT_ME.test
index a057f328453..39aff4e4b23 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/drop_table_TODO_SPLIT_ME.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/drop_table_TODO_SPLIT_ME.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/flush_logs.test b/storage/mroonga/mysql-test/mroonga/storage/t/flush_logs.test
index 964217ae713..887b204c7ae 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/flush_logs.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/flush_logs.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/foreign_key_create.test b/storage/mroonga/mysql-test/mroonga/storage/t/foreign_key_create.test
index fe457562967..7f02c81dbcd 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/foreign_key_create.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/foreign_key_create.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/skip_mysql_55.inc
--source ../../include/mroonga/skip_mariadb_55.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_empty_query.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_empty_query.test
index 75f1c3c38ed..6a97baa362e 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_empty_query.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_empty_query.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_escape.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_escape.test
index 1a27422aa81..6fedec6810c 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_escape.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_escape.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_leading_not.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_leading_not.test
index 952749338ac..3e3c517bee6 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_leading_not.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_leading_not.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_all.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_all.test
index b94172c1c72..f927b45fbc6 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_all.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_all.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_minus_no_operator.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_minus_no_operator.test
index 89adbd4b5f7..1ead74d0354 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_minus_no_operator.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_minus_no_operator.test
@@ -13,7 +13,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_minus_with_or.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_minus_with_or.test
index 76a72a5b865..ba8f1c1eda1 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_minus_with_or.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_minus_with_or.test
@@ -13,7 +13,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_minus_with_plus.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_minus_with_plus.test
index e2edfe780b3..655bf1e8fa0 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_minus_with_plus.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_minus_with_plus.test
@@ -13,7 +13,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_or_no_operator.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_or_no_operator.test
index 66ff69d77e2..9c4e92ce55d 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_or_no_operator.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_or_no_operator.test
@@ -13,7 +13,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_or_with_minus.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_or_with_minus.test
index 1d91bdc7a56..5f1efdb796d 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_or_with_minus.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_or_with_minus.test
@@ -13,7 +13,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_or_with_plus.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_or_with_plus.test
index 63e5baeeb68..b720dcf6f71 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_or_with_plus.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_or_with_plus.test
@@ -13,7 +13,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_plus_no_operator.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_plus_no_operator.test
index fb2ec74a5e0..82d0718d1e8 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_plus_no_operator.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_plus_no_operator.test
@@ -13,7 +13,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_plus_with_astarisk.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_plus_with_astarisk.test
index ded739d8e8b..c2efa7a8575 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_plus_with_astarisk.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_plus_with_astarisk.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_plus_with_minus.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_plus_with_minus.test
index 30cf3e87491..29107188c35 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_plus_with_minus.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_plus_with_minus.test
@@ -13,7 +13,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_plus_with_or.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_plus_with_or.test
index 7268cc1921c..c5b5f2f795b 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_plus_with_or.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_plus_with_or.test
@@ -13,7 +13,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_weight_full_spec.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_weight_full_spec.test
index bec7944a82b..e8ad55ab4c6 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_weight_full_spec.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_weight_full_spec.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_weight_no_weight.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_weight_no_weight.test
index fa10ae7b73b..5cc8f4154c4 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_weight_no_weight.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_weight_no_weight.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_weight_omit_section.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_weight_omit_section.test
index d7f1bde6ca4..b85580dba01 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_weight_omit_section.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_weight_omit_section.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_weight_ten_or_more_sections.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_weight_ten_or_more_sections.test
index 6df0c13f111..642b438ebf6 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_weight_ten_or_more_sections.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_weight_ten_or_more_sections.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_weight_three_or_more_sections.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_weight_three_or_more_sections.test
index 9161ff6ff0d..5ea8c21797f 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_weight_three_or_more_sections.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_weight_three_or_more_sections.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_syntax_error_error.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_syntax_error_error.test
index f8d5e3fe6be..b9beffa2ef7 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_syntax_error_error.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_syntax_error_error.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_syntax_error_error_and_log.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_syntax_error_error_and_log.test
index 1c0795bca58..c4195f2a541 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_syntax_error_error_and_log.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_syntax_error_error_and_log.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_syntax_error_ignore.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_syntax_error_ignore.test
index fef386cc42d..9a45d479d30 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_syntax_error_ignore.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_syntax_error_ignore.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_syntax_error_ignore_and_log.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_syntax_error_ignore_and_log.test
index ac51f81a43a..cf2cd503b28 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_syntax_error_ignore_and_log.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_syntax_error_ignore_and_log.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_charset_ascii.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_charset_ascii.test
index 42ef563105d..4032ca9e669 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_charset_ascii.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_charset_ascii.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_charset_cp932.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_charset_cp932.test
index 7396a66ecc0..b6ac95da232 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_charset_cp932.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_charset_cp932.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/have_cp932.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_charset_eucjpms.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_charset_eucjpms.test
index 2d8b094c43d..c990b288552 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_charset_eucjpms.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_charset_eucjpms.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/have_eucjpms.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_charset_japanese.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_charset_japanese.test
index 4b6ca756a29..2e457aa768c 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_charset_japanese.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_charset_japanese.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_charset_utf8mb4.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_charset_utf8mb4.test
index d870affba4f..8fc97821563 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_charset_utf8mb4.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_charset_utf8mb4.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_empty_query.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_empty_query.test
index 59a274f942c..619363f0fed 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_empty_query.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_empty_query.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_found_rows.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_found_rows.test
index 4d899201fb3..41d1ab91660 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_found_rows.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_found_rows.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_groonga_varchar_vector.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_groonga_varchar_vector.test
index 19f82f644a6..e346fb1d3bc 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_groonga_varchar_vector.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_groonga_varchar_vector.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
--source ../../include/mroonga/load_mroonga_functions.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_index_recreate.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_index_recreate.test
index a8d4780fee3..0ac152703c9 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_index_recreate.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_index_recreate.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_insert_select.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_insert_select.test
index 3dffb2fb458..4f932d5ac2a 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_insert_select.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_insert_select.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_insert_values.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_insert_values.test
index 0b52448bc45..ef610b983df 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_insert_values.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_insert_values.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_multiple_column_index_delete.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_multiple_column_index_delete.test
index 9c083f57a80..ab9522f6fa2 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_multiple_column_index_delete.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_multiple_column_index_delete.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_multiple_column_index_insert.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_multiple_column_index_insert.test
index ce2c2714e31..2881d3cf160 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_multiple_column_index_insert.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_multiple_column_index_insert.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_multiple_column_index_recreate.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_multiple_column_index_recreate.test
index ffee108932a..353e19804e5 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_multiple_column_index_recreate.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_multiple_column_index_recreate.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_multiple_column_index_update.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_multiple_column_index_update.test
index e9e6aa2bb6e..949cc61a442 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_multiple_column_index_update.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_multiple_column_index_update.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_multiple_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_multiple_index.test
index 19fd4f8d3ba..97319b71176 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_multiple_index.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_multiple_index.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_no_primary_key.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_no_primary_key.test
index 7ef05efa3a5..419224d4fc0 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_no_primary_key.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_no_primary_key.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_not_match_against.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_not_match_against.test
index ffb49f2f396..3f7377d9c6e 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_not_match_against.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_not_match_against.test
@@ -13,7 +13,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_or.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_or.test
index 2b0f3bbb15c..5c94603c07f 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_or.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_or.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_boolean_mode_different_against.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_boolean_mode_different_against.test
index f2859f99dba..06afa3ce9cd 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_boolean_mode_different_against.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_boolean_mode_different_against.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_boolean_mode_different_match.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_boolean_mode_different_match.test
index dc97db87487..c90fdf6f88a 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_boolean_mode_different_match.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_boolean_mode_different_match.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_boolean_mode_no_where.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_boolean_mode_no_where.test
index 50dd652e2d0..a230111ba16 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_boolean_mode_no_where.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_boolean_mode_no_where.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_boolean_mode_same_match_against.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_boolean_mode_same_match_against.test
index 0873849a1e7..601ffcb73bb 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_boolean_mode_same_match_against.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_boolean_mode_same_match_against.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_natural_language_mode_asc.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_natural_language_mode_asc.test
index 1b29b5b9284..7c0156ffd33 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_natural_language_mode_asc.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_natural_language_mode_asc.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_natural_language_mode_desc.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_natural_language_mode_desc.test
index 761c7259057..c422a6a6750 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_natural_language_mode_desc.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_natural_language_mode_desc.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_natural_language_mode_different_against.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_natural_language_mode_different_against.test
index eef4e08c5d1..cdb4b9f27ae 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_natural_language_mode_different_against.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_natural_language_mode_different_against.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_natural_language_mode_different_match.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_natural_language_mode_different_match.test
index 42b621f4401..54206e43843 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_natural_language_mode_different_match.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_natural_language_mode_different_match.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_natural_language_mode_no_where.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_natural_language_mode_no_where.test
index 2078e59f042..1e84064b122 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_natural_language_mode_no_where.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_natural_language_mode_no_where.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_natural_language_mode_same_match_against.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_natural_language_mode_same_match_against.test
index 9a8c93c3470..a5040dd80a6 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_natural_language_mode_same_match_against.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_natural_language_mode_same_match_against.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_two_inner_join.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_two_inner_join.test
index 745720d1fe6..17957ab8284 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_two_inner_join.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_two_inner_join.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/have_innodb.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_version_100_no_such_key.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_version_100_no_such_key.test
index aab09c18b79..cf4c9b60230 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_version_100_no_such_key.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_version_100_no_such_key.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_version_100.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_version_55_no_such_key.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_version_55_no_such_key.test
index d447b1f85dc..da9de22217c 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_version_55_no_such_key.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_version_55_no_such_key.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_version_55.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_version_56_no_such_key.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_version_56_no_such_key.test
index 1187b189244..7dbc8fca2b7 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_version_56_no_such_key.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_version_56_no_such_key.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_version_56.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/function_command_select.test b/storage/mroonga/mysql-test/mroonga/storage/t/function_command_select.test
index f1a1777d92b..892b24c5a7a 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/function_command_select.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/function_command_select.test
@@ -13,7 +13,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/not_embedded.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/function_escape_error_query_is_missing.test b/storage/mroonga/mysql-test/mroonga/storage/t/function_escape_error_query_is_missing.test
index a37e601e92d..2712aab2218 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/function_escape_error_query_is_missing.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/function_escape_error_query_is_missing.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/not_embedded.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/function_escape_error_query_is_not_string.test b/storage/mroonga/mysql-test/mroonga/storage/t/function_escape_error_query_is_not_string.test
index 683efb7e25c..862e98c5a8c 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/function_escape_error_query_is_not_string.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/function_escape_error_query_is_not_string.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/not_embedded.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/function_escape_error_target_characters_is_not_string.test b/storage/mroonga/mysql-test/mroonga/storage/t/function_escape_error_target_characters_is_not_string.test
index 5e04ae2a615..39f99a7c2d4 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/function_escape_error_target_characters_is_not_string.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/function_escape_error_target_characters_is_not_string.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/not_embedded.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/function_escape_success_all.test b/storage/mroonga/mysql-test/mroonga/storage/t/function_escape_success_all.test
index 6d328fa8434..1dca7076512 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/function_escape_success_all.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/function_escape_success_all.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/not_embedded.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/function_escape_success_custom.test b/storage/mroonga/mysql-test/mroonga/storage/t/function_escape_success_custom.test
index 2ad633b43f0..e70bb3f367d 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/function_escape_success_custom.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/function_escape_success_custom.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/not_embedded.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/function_escape_success_nested.test b/storage/mroonga/mysql-test/mroonga/storage/t/function_escape_success_nested.test
index 82f7410d909..503e2000b10 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/function_escape_success_nested.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/function_escape_success_nested.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/not_embedded.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/function_last_insert_grn_id.test b/storage/mroonga/mysql-test/mroonga/storage/t/function_last_insert_grn_id.test
index ef6b0077976..5d80d5230ef 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/function_last_insert_grn_id.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/function_last_insert_grn_id.test
@@ -14,7 +14,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/not_embedded.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/function_last_insert_id_reference.test b/storage/mroonga/mysql-test/mroonga/storage/t/function_last_insert_id_reference.test
index a515757ab55..98e8d9dab2f 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/function_last_insert_id_reference.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/function_last_insert_id_reference.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/function_last_insert_id_set.test b/storage/mroonga/mysql-test/mroonga/storage/t/function_last_insert_id_set.test
index 2eb75ac3b60..41f9d3684bf 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/function_last_insert_id_set.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/function_last_insert_id_set.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_ascii.test b/storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_ascii.test
index f273a38c13a..0cb551dbc69 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_ascii.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_ascii.test
@@ -13,7 +13,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/not_embedded.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_cp932.test b/storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_cp932.test
index eb67245e7c0..338417021c8 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_cp932.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_cp932.test
@@ -13,7 +13,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/not_embedded.inc
--source include/have_cp932.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_eucjpms.test b/storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_eucjpms.test
index 8864d6adffc..fa8dbb20e93 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_eucjpms.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_eucjpms.test
@@ -13,7 +13,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/not_embedded.inc
--source include/have_eucjpms.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_invalid_nonexistent_charset.test b/storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_invalid_nonexistent_charset.test
index bf6b4df5871..a4e24ce030e 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_invalid_nonexistent_charset.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_invalid_nonexistent_charset.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/not_embedded.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_invalid_unsupported_charset.test b/storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_invalid_unsupported_charset.test
index 451737c900c..4df02c14e7b 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_invalid_unsupported_charset.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_invalid_unsupported_charset.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/not_embedded.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_japanese.test b/storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_japanese.test
index 354d5f5a2d6..3d41de6a93e 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_japanese.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_japanese.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/not_embedded.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/geometry_bulk_insert_null.test b/storage/mroonga/mysql-test/mroonga/storage/t/geometry_bulk_insert_null.test
index dc9ac4319ce..f0ce4e81ddb 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/geometry_bulk_insert_null.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/geometry_bulk_insert_null.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/have_geometry.inc
--source ../../include/mroonga/have_version_56_or_later.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/geometry_bulk_insert_null_57.test b/storage/mroonga/mysql-test/mroonga/storage/t/geometry_bulk_insert_null_57.test
index 84ce595621e..00efe1e4ac7 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/geometry_bulk_insert_null_57.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/geometry_bulk_insert_null_57.test
@@ -13,7 +13,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/have_geometry.inc
--source ../../include/mroonga/have_version_57.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/geometry_contains.test b/storage/mroonga/mysql-test/mroonga/storage/t/geometry_contains.test
index 2fcf7ec5e4b..4aed7b24729 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/geometry_contains.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/geometry_contains.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/have_geometry.inc
--source ../../include/mroonga/have_version_56_or_later.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_btree_equal_datetime.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_btree_equal_datetime.test
index 6b6971fa038..0354e9b7e4b 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/index_btree_equal_datetime.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_btree_equal_datetime.test
@@ -14,7 +14,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_64bit.inc
--source ../../include/mroonga/skip_freebsd.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_btree_equal_time.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_btree_equal_time.test
index 51737fcf375..a1429859a33 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/index_btree_equal_time.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_btree_equal_time.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_btree_equal_timestamp.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_btree_equal_timestamp.test
index f8848ce196d..0f63eed4b52 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/index_btree_equal_timestamp.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_btree_equal_timestamp.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_btree_normal_column_insert.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_btree_normal_column_insert.test
index 0215807b9db..dcf029593fd 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/index_btree_normal_column_insert.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_btree_normal_column_insert.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_hash_id_normal.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_hash_id_normal.test
index 29a937054a2..a28a912e23d 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/index_hash_id_normal.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_hash_id_normal.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_hash_id_primary.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_hash_id_primary.test
index 6aa4e04f7c8..d622aade72d 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/index_hash_id_primary.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_hash_id_primary.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_hash_id_unique.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_hash_id_unique.test
index 28922bc3644..8f1e6b889bb 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/index_hash_id_unique.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_hash_id_unique.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_hash_normal_column_insert.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_hash_normal_column_insert.test
index 5138c6c9698..acb298ef812 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/index_hash_normal_column_insert.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_hash_normal_column_insert.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_delete.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_delete.test
index f39ead56541..ebf331d2f15 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_delete.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_delete.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_nullable_smallint.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_nullable_smallint.test
index 055f2b20f22..5afdd36b5b8 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_nullable_smallint.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_nullable_smallint.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_nullable_unsigned_bigint.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_nullable_unsigned_bigint.test
index 9c9f3dfc283..314dbd85d95 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_nullable_unsigned_bigint.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_nullable_unsigned_bigint.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_nullable_unsigned_int.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_nullable_unsigned_int.test
index c78aec6d6e0..82372d63527 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_nullable_unsigned_int.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_nullable_unsigned_int.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_nullable_unsigned_smallint.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_nullable_unsigned_smallint.test
index 0b9b7dd3a3c..a221c40dcc1 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_nullable_unsigned_smallint.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_nullable_unsigned_smallint.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_nullable_varchar.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_nullable_varchar.test
index 2307c490fda..b765bab6769 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_nullable_varchar.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_nullable_varchar.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_primary_delete.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_primary_delete.test
index 75e77b597e0..40b39fe8538 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_primary_delete.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_primary_delete.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_primary_select_int.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_primary_select_int.test
index 0b3a7362c0e..52cee4c7b33 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_primary_select_int.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_primary_select_int.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_primary_update.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_primary_update.test
index c0f1e78552a..d71d1917df5 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_primary_update.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_primary_update.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_range_not_used_in_order_by_greater_than.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_range_not_used_in_order_by_greater_than.test
index aff138eb45e..431f123497b 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_range_not_used_in_order_by_greater_than.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_range_not_used_in_order_by_greater_than.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_range_not_used_in_order_by_greater_than_or_equal.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_range_not_used_in_order_by_greater_than_or_equal.test
index 0177c1a1479..bc739fdfb52 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_range_not_used_in_order_by_greater_than_or_equal.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_range_not_used_in_order_by_greater_than_or_equal.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_range_not_used_in_order_by_less_than.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_range_not_used_in_order_by_less_than.test
index 987db143da5..a3c3b766340 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_range_not_used_in_order_by_less_than.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_range_not_used_in_order_by_less_than.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_range_not_used_in_order_by_less_than_or_equal.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_range_not_used_in_order_by_less_than_or_equal.test
index 0a4eded6710..3cbac1c1ff9 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_range_not_used_in_order_by_less_than_or_equal.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_range_not_used_in_order_by_less_than_or_equal.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_recreate.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_recreate.test
index 90a1fdf6c49..430b3bb94a2 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_recreate.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_recreate.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_replace.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_replace.test
index b5e592938a7..18db29cc85f 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_replace.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_replace.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_select_double.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_select_double.test
index 4f9c60d14b2..07ab3d38028 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_select_double.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_select_double.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_select_float.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_select_float.test
index 941fddbc5a0..567d32e0ffd 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_select_float.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_select_float.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_select_int.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_select_int.test
index 478be9a90db..0658bbcedf3 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_select_int.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_select_int.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_select_string.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_select_string.test
index 6e0278f3910..a79567bde7f 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_select_string.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_select_string.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_select_varchar.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_select_varchar.test
index 9822ec18f4a..7c9af9aa998 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_select_varchar.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_select_varchar.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_date_32bit_equal.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_date_32bit_equal.test
index 66a0c463a34..0c949ab25b1 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_date_32bit_equal.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_date_32bit_equal.test
@@ -13,7 +13,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_32bit.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_date_64bit_equal.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_date_64bit_equal.test
index 010611ee3ec..c842ff428c3 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_date_64bit_equal.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_date_64bit_equal.test
@@ -14,7 +14,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/skip_freebsd.inc
--source ../../include/mroonga/skip_osx.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_date_index_read.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_date_index_read.test
index 628f81ba0ad..708ba0b44dc 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_date_index_read.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_date_index_read.test
@@ -14,7 +14,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_64bit.inc
--source ../../include/mroonga/skip_freebsd.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_date_order_32bit_asc.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_date_order_32bit_asc.test
index 09306536da9..ce28c45aac6 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_date_order_32bit_asc.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_date_order_32bit_asc.test
@@ -13,7 +13,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_32bit.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_date_order_32bit_desc.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_date_order_32bit_desc.test
index a3306fc776f..9e68d627890 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_date_order_32bit_desc.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_date_order_32bit_desc.test
@@ -13,7 +13,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_32bit.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_date_order_64bit_asc.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_date_order_64bit_asc.test
index ef7066164fd..92bd9915a22 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_date_order_64bit_asc.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_date_order_64bit_asc.test
@@ -14,7 +14,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/skip_freebsd.inc
--source ../../include/mroonga/skip_osx.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_date_order_64bit_desc.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_date_order_64bit_desc.test
index d34d29a224b..a25cd4d87c3 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_date_order_64bit_desc.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_date_order_64bit_desc.test
@@ -14,7 +14,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/skip_freebsd.inc
--source ../../include/mroonga/skip_osx.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_date_reinsert.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_date_reinsert.test
index 58ec29f07e9..6a04c4a9df5 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_date_reinsert.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_date_reinsert.test
@@ -13,7 +13,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_datetime_index_read.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_datetime_index_read.test
index 66e0a4d6a9f..0807e78c0aa 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_datetime_index_read.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_datetime_index_read.test
@@ -14,7 +14,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_64bit.inc
--source ../../include/mroonga/skip_freebsd.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_datetime_insert_delete_insert_invalid_value.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_datetime_insert_delete_insert_invalid_value.test
index 65e639181fe..776e05a2ffe 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_datetime_insert_delete_insert_invalid_value.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_datetime_insert_delete_insert_invalid_value.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_datetime_order_asc.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_datetime_order_asc.test
index c28fcd86a2a..3fcc92f7acf 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_datetime_order_asc.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_datetime_order_asc.test
@@ -14,7 +14,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/skip_freebsd.inc
--source ../../include/mroonga/skip_osx.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_datetime_order_desc.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_datetime_order_desc.test
index b5b3545cc9d..4d25f29cfdc 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_datetime_order_desc.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_datetime_order_desc.test
@@ -14,7 +14,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/skip_freebsd.inc
--source ../../include/mroonga/skip_osx.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_datetime_reinsert.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_datetime_reinsert.test
index ab9ed122862..eb6df3af8ad 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_datetime_reinsert.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_datetime_reinsert.test
@@ -13,7 +13,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_decimal.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_decimal.test
index 85645967fbd..faf590d84b6 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_decimal.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_decimal.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_time_index_read.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_time_index_read.test
index f9b2d2b6f5c..52e4113dc09 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_time_index_read.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_time_index_read.test
@@ -13,7 +13,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_time_order_asc.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_time_order_asc.test
index 94e2fa39946..a8e36f2ff26 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_time_order_asc.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_time_order_asc.test
@@ -13,7 +13,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_64bit.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_time_order_desc.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_time_order_desc.test
index d9d31cf3386..c13ed51cf7f 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_time_order_desc.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_time_order_desc.test
@@ -13,7 +13,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_64bit.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_time_reinsert.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_time_reinsert.test
index e0a18ae792b..497010df032 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_time_reinsert.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_time_reinsert.test
@@ -13,7 +13,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_timestamp_index_read.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_timestamp_index_read.test
index c660f6aef6e..2ee8ae466ac 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_timestamp_index_read.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_timestamp_index_read.test
@@ -13,7 +13,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_timestamp_order_asc.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_timestamp_order_asc.test
index 5ec630b56df..efb7ab70ae2 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_timestamp_order_asc.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_timestamp_order_asc.test
@@ -13,7 +13,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_64bit.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_timestamp_order_desc.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_timestamp_order_desc.test
index 9ca7440da88..1b1e62951e4 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_timestamp_order_desc.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_timestamp_order_desc.test
@@ -13,7 +13,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_64bit.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_timestamp_reinsert.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_timestamp_reinsert.test
index 559cf958804..74bd0eb133a 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_timestamp_reinsert.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_timestamp_reinsert.test
@@ -13,7 +13,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_varchar.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_varchar.test
index 900de61feac..e116e7a251e 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_varchar.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_varchar.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_year_32bit_equal.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_year_32bit_equal.test
index b09214d0037..7a17092d599 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_year_32bit_equal.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_year_32bit_equal.test
@@ -13,7 +13,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_32bit.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_year_64bit_equal.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_year_64bit_equal.test
index 50cefd25c60..2505b47b1bc 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_year_64bit_equal.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_year_64bit_equal.test
@@ -13,7 +13,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_64bit.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_year_index_read.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_year_index_read.test
index 120c5533f65..b475b857fd4 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_year_index_read.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_year_index_read.test
@@ -13,7 +13,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_64bit.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_year_order_32bit_asc.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_year_order_32bit_asc.test
index ffc00ddf1c1..4317cc1e974 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_year_order_32bit_asc.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_year_order_32bit_asc.test
@@ -13,7 +13,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_32bit.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_year_order_32bit_desc.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_year_order_32bit_desc.test
index c714f4424d6..b7e910f0829 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_year_order_32bit_desc.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_year_order_32bit_desc.test
@@ -13,7 +13,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_32bit.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_year_order_64bit_asc.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_year_order_64bit_asc.test
index 858da8a3cd8..5a4525fe7a5 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_year_order_64bit_asc.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_year_order_64bit_asc.test
@@ -13,7 +13,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_64bit.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_year_order_64bit_desc.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_year_order_64bit_desc.test
index a5d7f75eb0f..8865c3610ff 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_year_order_64bit_desc.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_year_order_64bit_desc.test
@@ -13,7 +13,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_64bit.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_year_reinsert.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_year_reinsert.test
index 250ef00b5b6..e7ac3a8a941 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_year_reinsert.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_year_reinsert.test
@@ -13,7 +13,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_update_int.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_update_int.test
index e1efd0c992c..d1c23dfbc73 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_update_int.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_update_int.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_update_string.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_update_string.test
index bcbbe82914b..19fc2c36dfb 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_update_string.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_update_string.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_char_exact_length.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_char_exact_length.test
index ba52b4b4138..37cd919eb77 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_char_exact_length.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_char_exact_length.test
@@ -13,7 +13,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_char_null_character.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_char_null_character.test
index bded856812c..9cdee6b1efb 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_char_null_character.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_char_null_character.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_char_short.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_char_short.test
index ae8c40b82c5..1e1029d0d86 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_char_short.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_char_short.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_date.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_date.test
index e57a8491d99..9b94d315836 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_date.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_date.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_datetime_with_fractional_seconds.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_datetime_with_fractional_seconds.test
index 7f140bf24c6..44a9fcaca69 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_datetime_with_fractional_seconds.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_datetime_with_fractional_seconds.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_fractional_seconds.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_datetime_without_fractional_seconds.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_datetime_without_fractional_seconds.test
index 1986e4db3db..82b6632672c 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_datetime_without_fractional_seconds.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_datetime_without_fractional_seconds.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_decimal_with_fractional_seconds.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_decimal_with_fractional_seconds.test
index d296285b391..c9134275c45 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_decimal_with_fractional_seconds.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_decimal_with_fractional_seconds.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_decimal_without_fractional_seconds.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_decimal_without_fractional_seconds.test
index 956b9800650..f9cdd093ff4 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_decimal_without_fractional_seconds.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_decimal_without_fractional_seconds.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_time_with_fractional_seconds.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_time_with_fractional_seconds.test
index 90e668e1e38..7b8f48e185a 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_time_with_fractional_seconds.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_time_with_fractional_seconds.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
--source ../../include/mroonga/have_fractional_seconds.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_time_without_fractional_seconds.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_time_without_fractional_seconds.test
index f000f7390f6..d71dd6485d2 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_time_without_fractional_seconds.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_time_without_fractional_seconds.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_timestamp_with_fractional_seconds.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_timestamp_with_fractional_seconds.test
index aba635ad637..f59ee627301 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_timestamp_with_fractional_seconds.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_timestamp_with_fractional_seconds.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/skip_mariadb_55.inc
--source ../../include/mroonga/have_fractional_seconds.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_timestamp_without_fractional_seconds.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_timestamp_without_fractional_seconds.test
index ae61434c795..7d8c1778331 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_timestamp_without_fractional_seconds.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_timestamp_without_fractional_seconds.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_varchar_null_character.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_varchar_null_character.test
index 20ae939be8b..9c8e4e46c28 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_varchar_null_character.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_varchar_null_character.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_year.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_year.test
index 25f02d38e94..6236b2d961d 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_year.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_year.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_range_normal_greater_than_asc.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_range_normal_greater_than_asc.test
index 6bab6708ba7..9358c7c0e47 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/index_range_normal_greater_than_asc.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_range_normal_greater_than_asc.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_range_normal_greater_than_desc.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_range_normal_greater_than_desc.test
index e1bbd5b338c..9fe76989745 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/index_range_normal_greater_than_desc.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_range_normal_greater_than_desc.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_range_normal_greater_than_or_equal_asc.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_range_normal_greater_than_or_equal_asc.test
index 680a4d624a7..24967c9d14b 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/index_range_normal_greater_than_or_equal_asc.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_range_normal_greater_than_or_equal_asc.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_range_normal_greater_than_or_equal_desc.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_range_normal_greater_than_or_equal_desc.test
index 25260c48c4b..7f4bc666fe1 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/index_range_normal_greater_than_or_equal_desc.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_range_normal_greater_than_or_equal_desc.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_range_normal_less_than_asc.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_range_normal_less_than_asc.test
index 6c183ddec21..58604aa347d 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/index_range_normal_less_than_asc.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_range_normal_less_than_asc.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_range_normal_less_than_desc.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_range_normal_less_than_desc.test
index aa1ba7602ee..df89318fbe4 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/index_range_normal_less_than_desc.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_range_normal_less_than_desc.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_range_normal_less_than_or_equal_asc.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_range_normal_less_than_or_equal_asc.test
index e083afdf4f5..97dc161f191 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/index_range_normal_less_than_or_equal_asc.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_range_normal_less_than_or_equal_asc.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_range_normal_less_than_or_equal_desc.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_range_normal_less_than_or_equal_desc.test
index 155a51506a9..2e4451b9fb7 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/index_range_normal_less_than_or_equal_desc.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_range_normal_less_than_or_equal_desc.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_range_primary_greater_than_asc.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_range_primary_greater_than_asc.test
index a622dfbf70d..76729da279e 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/index_range_primary_greater_than_asc.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_range_primary_greater_than_asc.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_range_primary_greater_than_desc.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_range_primary_greater_than_desc.test
index 63dc820ccfd..692953f9332 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/index_range_primary_greater_than_desc.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_range_primary_greater_than_desc.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_range_primary_greater_than_or_equal_asc.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_range_primary_greater_than_or_equal_asc.test
index a51e6c5da47..d5c73ac3d81 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/index_range_primary_greater_than_or_equal_asc.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_range_primary_greater_than_or_equal_asc.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_range_primary_greater_than_or_equal_desc.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_range_primary_greater_than_or_equal_desc.test
index ea5c150bf0f..b8d2dac9cac 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/index_range_primary_greater_than_or_equal_desc.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_range_primary_greater_than_or_equal_desc.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_range_primary_less_than_asc.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_range_primary_less_than_asc.test
index 12761c0f4d8..8f262237cde 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/index_range_primary_less_than_asc.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_range_primary_less_than_asc.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_range_primary_less_than_desc.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_range_primary_less_than_desc.test
index a4f4a781ead..994eff8b69a 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/index_range_primary_less_than_desc.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_range_primary_less_than_desc.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_range_primary_less_than_or_equal_asc.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_range_primary_less_than_or_equal_asc.test
index 2fba0d13f5f..9e58d3cd8e4 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/index_range_primary_less_than_or_equal_asc.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_range_primary_less_than_or_equal_asc.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_range_primary_less_than_or_equal_desc.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_range_primary_less_than_or_equal_desc.test
index e4661fc7047..14c97749c37 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/index_range_primary_less_than_or_equal_desc.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_range_primary_less_than_or_equal_desc.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_bigint.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_bigint.test
index 53111b576d7..318ccbfb820 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_bigint.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_bigint.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_bigint_unsigned.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_bigint_unsigned.test
index 5e93137afeb..ef89fbdd128 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_bigint_unsigned.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_bigint_unsigned.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_double.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_double.test
index 0ca7d948318..e35baa13037 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_double.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_double.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_float.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_float.test
index ade89f6bc56..aca93729e3b 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_float.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_float.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_int.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_int.test
index 9ed4979fd8f..f9563018bea 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_int.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_int.test
@@ -13,7 +13,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_int_unsigned.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_int_unsigned.test
index f68c2f6906c..b95dca5fe07 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_int_unsigned.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_int_unsigned.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_mediumint.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_mediumint.test
index 254345b6ec6..a817dfc285c 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_mediumint.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_mediumint.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_mediumint_unsigned.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_mediumint_unsigned.test
index 8975c5120cb..f9f42e48ac5 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_mediumint_unsigned.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_mediumint_unsigned.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_smallint.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_smallint.test
index 4ed8c4b366e..97762972912 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_smallint.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_smallint.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_smallint_unsigned.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_smallint_unsigned.test
index ef5da3e79c9..bba35ebbdeb 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_smallint_unsigned.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_smallint_unsigned.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_tinyint.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_tinyint.test
index 5c738fa567b..04344db0034 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_tinyint.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_tinyint.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_tinyint_unsigned.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_tinyint_unsigned.test
index 7f17f0031db..27ef9af3a80 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_tinyint_unsigned.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_tinyint_unsigned.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_varchar.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_varchar.test
index ccd53a95237..518eabe1cb0 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_varchar.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_varchar.test
@@ -13,7 +13,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_varchar_collation.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_varchar_collation.test
index 1d799e76696..08b9c5b5648 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_varchar_collation.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_varchar_collation.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_read_normal_int.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_read_normal_int.test
index a7ff9f3a600..84f2adce7c8 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/index_read_normal_int.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_read_normal_int.test
@@ -13,7 +13,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_read_normal_varchar.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_read_normal_varchar.test
index 4d094df41cd..995dd9d77a6 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/index_read_normal_varchar.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_read_normal_varchar.test
@@ -13,7 +13,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_read_primary_int.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_read_primary_int.test
index 68f132367f2..106a5bdd9f2 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/index_read_primary_int.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_read_primary_int.test
@@ -13,7 +13,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_read_primary_varchar.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_read_primary_varchar.test
index aa9ba644062..4a0b2ff3492 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/index_read_primary_varchar.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_read_primary_varchar.test
@@ -13,7 +13,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_unique_delete_by_primary_key.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_unique_delete_by_primary_key.test
index 2c1ec45c045..27c094acec9 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/index_unique_delete_by_primary_key.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_unique_delete_by_primary_key.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_unique_insert_after_error.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_unique_insert_after_error.test
index 6c47c877771..4acdfc0f1bf 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/index_unique_insert_after_error.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_unique_insert_after_error.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_unique_search_after_duplicated.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_unique_search_after_duplicated.test
index 533422ec087..7642ee733f3 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/index_unique_search_after_duplicated.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_unique_search_after_duplicated.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_unique_varchar.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_unique_varchar.test
index 21446b302f2..8bcdb56ccfd 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/index_unique_varchar.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_unique_varchar.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_update_multiple_column.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_update_multiple_column.test
index bbf368551af..fbf776d9e39 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/index_update_multiple_column.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_update_multiple_column.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_update_single_column.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_update_single_column.test
index a0dc2f8a952..557ce195ae3 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/index_update_single_column.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_update_single_column.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/information_schema_plugins.test b/storage/mroonga/mysql-test/mroonga/storage/t/information_schema_plugins.test
index d22c6560c2c..43988b71a9a 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/information_schema_plugins.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/information_schema_plugins.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/information_schema_tables_auto_increment_none.test b/storage/mroonga/mysql-test/mroonga/storage/t/information_schema_tables_auto_increment_none.test
index 2956e072302..f6d2d8fb5db 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/information_schema_tables_auto_increment_none.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/information_schema_tables_auto_increment_none.test
@@ -13,7 +13,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/information_schema_tables_auto_increment_use.test b/storage/mroonga/mysql-test/mroonga/storage/t/information_schema_tables_auto_increment_use.test
index 79e12fe67a9..3135ad9fa34 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/information_schema_tables_auto_increment_use.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/information_schema_tables_auto_increment_use.test
@@ -13,7 +13,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/information_schema_tables_data_length.test b/storage/mroonga/mysql-test/mroonga/storage/t/information_schema_tables_data_length.test
index 82dd4fdf1c6..7b54e8d3ac5 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/information_schema_tables_data_length.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/information_schema_tables_data_length.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/insert_TODO_SPLIT_ME.test b/storage/mroonga/mysql-test/mroonga/storage/t/insert_TODO_SPLIT_ME.test
index 3fa85344dfa..6e3ce140eba 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/insert_TODO_SPLIT_ME.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/insert_TODO_SPLIT_ME.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/not_embedded.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/insert_delayed.test b/storage/mroonga/mysql-test/mroonga/storage/t/insert_delayed.test
index 48a85f5d72b..d58d4326742 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/insert_delayed.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/insert_delayed.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/not_embedded.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/insert_on_duplicate_key_update_no_primary_key_and_unique_key_twice.test b/storage/mroonga/mysql-test/mroonga/storage/t/insert_on_duplicate_key_update_no_primary_key_and_unique_key_twice.test
index c3530dc34c0..a53e672cbe4 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/insert_on_duplicate_key_update_no_primary_key_and_unique_key_twice.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/insert_on_duplicate_key_update_no_primary_key_and_unique_key_twice.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/insert_on_duplicate_key_update_primary_key.test b/storage/mroonga/mysql-test/mroonga/storage/t/insert_on_duplicate_key_update_primary_key.test
index 794605d742b..c25e4606359 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/insert_on_duplicate_key_update_primary_key.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/insert_on_duplicate_key_update_primary_key.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/insert_on_duplicate_key_update_unique_key.test b/storage/mroonga/mysql-test/mroonga/storage/t/insert_on_duplicate_key_update_unique_key.test
index 350440515c1..5542b0ece3b 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/insert_on_duplicate_key_update_unique_key.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/insert_on_duplicate_key_update_unique_key.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/like_unicode_ci.test b/storage/mroonga/mysql-test/mroonga/storage/t/like_unicode_ci.test
index 18801541b72..48d50135b08 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/like_unicode_ci.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/like_unicode_ci.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/lock_tables_read.test b/storage/mroonga/mysql-test/mroonga/storage/t/lock_tables_read.test
index b7093f82aa5..eeda3dac4a9 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/lock_tables_read.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/lock_tables_read.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_TODO_SPLIT_ME.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_TODO_SPLIT_ME.test
index 669868c6c7f..2355e5d4af4 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_TODO_SPLIT_ME.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_TODO_SPLIT_ME.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_after_insert_multithread.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_after_insert_multithread.test
index bca2311ffbc..6d07ab7b606 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_after_insert_multithread.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_after_insert_multithread.test
@@ -13,7 +13,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_after_insert_single_thread.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_after_insert_single_thread.test
index fa960be850f..26930d47502 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_after_insert_single_thread.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_after_insert_single_thread.test
@@ -13,7 +13,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_disabled.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_disabled.test
index e94702e8159..fedf31810c7 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_disabled.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_disabled.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_index_view.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_index_view.test
index 11457b1e05a..378f4424da1 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_index_view.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_index_view.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/have_innodb.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_not_optimized_disabled.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_not_optimized_disabled.test
index 8c818041a6c..20b89f72463 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_not_optimized_disabled.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_not_optimized_disabled.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_not_optimized_no_limit.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_not_optimized_no_limit.test
index d75a6460218..b1246ddfbdc 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_not_optimized_no_limit.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_not_optimized_no_limit.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_datetime_between.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_datetime_between.test
index 61e16a9444d..41d5facf644 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_datetime_between.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_datetime_between.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_datetime_between_over.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_datetime_between_over.test
index 4b75648009b..f6440777ab5 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_datetime_between_over.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_datetime_between_over.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_datetime_equal.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_datetime_equal.test
index f3b4be95b3a..5b57d2980c6 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_datetime_equal.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_datetime_equal.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_datetime_greater_than.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_datetime_greater_than.test
index ce5724b8b0b..4f878af84cc 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_datetime_greater_than.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_datetime_greater_than.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_datetime_greater_than_or_equal.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_datetime_greater_than_or_equal.test
index 4c55ba2a895..e8735fda41c 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_datetime_greater_than_or_equal.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_datetime_greater_than_or_equal.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_datetime_less_than.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_datetime_less_than.test
index 36f0e0ab6f2..4a748bc130b 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_datetime_less_than.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_datetime_less_than.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_datetime_less_than_or_equal.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_datetime_less_than_or_equal.test
index 3fc1505fcc2..80fe51e1e80 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_datetime_less_than_or_equal.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_datetime_less_than_or_equal.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_duplicated_order_by_columns.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_duplicated_order_by_columns.test
index 832c1c5cb27..b36a13f3727 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_duplicated_order_by_columns.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_duplicated_order_by_columns.test
@@ -13,7 +13,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_have_primary_key.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_have_primary_key.test
index 0733a48ba97..bcc678360e2 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_have_primary_key.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_have_primary_key.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_int_between.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_int_between.test
index f96043b4e37..e0a2df2e587 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_int_between.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_int_between.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_int_between_over.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_int_between_over.test
index 39caa96424c..c8f698cdbcc 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_int_between_over.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_int_between_over.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_int_equal.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_int_equal.test
index 579b7b33899..ee510ab7527 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_int_equal.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_int_equal.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_int_greater_than.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_int_greater_than.test
index c7354438224..76f2de8146b 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_int_greater_than.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_int_greater_than.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_int_greater_than_or_equal.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_int_greater_than_or_equal.test
index 259e2e5178d..caca6b56b89 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_int_greater_than_or_equal.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_int_greater_than_or_equal.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_int_less_than.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_int_less_than.test
index 02c2123afef..1c26bef936f 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_int_less_than.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_int_less_than.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_int_less_than_or_equal.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_int_less_than_or_equal.test
index 0511de74442..4df32d8a590 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_int_less_than_or_equal.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_int_less_than_or_equal.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_no_primary_key.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_no_primary_key.test
index b757b39e9ce..07907f1dfb7 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_no_primary_key.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_no_primary_key.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_no_where_clause.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_no_where_clause.test
index b4d7aa348f0..0e0b3f8e1ea 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_no_where_clause.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_no_where_clause.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_order_by_asc.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_order_by_asc.test
index 74da8581596..213605adca1 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_order_by_asc.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_order_by_asc.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_order_by_desc.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_order_by_desc.test
index 2e5d0741c51..58505edf7a7 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_order_by_desc.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_order_by_desc.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_order_by_id.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_order_by_id.test
index d7becd3820a..92178a45158 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_order_by_id.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_order_by_id.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_order_by_match_against.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_order_by_match_against.test
index 827faa70fa9..4ec5a8b1596 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_order_by_match_against.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_order_by_match_against.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_select_match_against.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_select_match_against.test
index 04a2309e98e..eaedbbdc7dc 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_select_match_against.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_select_match_against.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_time_between.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_time_between.test
index 8c8fafc076c..72d2890a123 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_time_between.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_time_between.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_time_between_over.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_time_between_over.test
index 9f9848b7e7e..eeb2e36ae29 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_time_between_over.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_time_between_over.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_time_equal.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_time_equal.test
index 04efd54eb48..666887d3347 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_time_equal.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_time_equal.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_time_greater_than.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_time_greater_than.test
index b2ec8b78198..feeae64b8d1 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_time_greater_than.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_time_greater_than.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_time_greater_than_or_equal.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_time_greater_than_or_equal.test
index 0b9964eb542..4744add7881 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_time_greater_than_or_equal.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_time_greater_than_or_equal.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_time_less_than.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_time_less_than.test
index ce772a2ee6d..cb407d35450 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_time_less_than.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_time_less_than.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_time_less_than_or_equal.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_time_less_than_or_equal.test
index 797bd935eaa..b9327e4251d 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_time_less_than_or_equal.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_time_less_than_or_equal.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_varchar_equal_with_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_varchar_equal_with_index.test
index e34209b841e..7c460d1086a 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_varchar_equal_with_index.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_varchar_equal_with_index.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_varchar_equal_without_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_varchar_equal_without_index.test
index 380f323d64a..ffebd0a4bad 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_varchar_equal_without_index.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_varchar_equal_without_index.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_year_between.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_year_between.test
index 988a116731c..c4e86ac1039 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_year_between.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_year_between.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_year_between_over.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_year_between_over.test
index d4c1d020fcc..57b512ed88d 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_year_between_over.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_year_between_over.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_year_equal.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_year_equal.test
index b1daa3a0000..729d8b03770 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_year_equal.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_year_equal.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_year_greater_than.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_year_greater_than.test
index bf4a18793b5..6bd955cc956 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_year_greater_than.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_year_greater_than.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_year_greater_than_or_equal.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_year_greater_than_or_equal.test
index 8863d613f06..3e40e885859 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_year_greater_than_or_equal.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_year_greater_than_or_equal.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_year_less_than.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_year_less_than.test
index 2fe423ac053..44fb928774f 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_year_less_than.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_year_less_than.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_year_less_than_or_equal.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_year_less_than_or_equal.test
index 52f26e37123..f7d0865f303 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_year_less_than_or_equal.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_year_less_than_or_equal.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/partition_insert.test b/storage/mroonga/mysql-test/mroonga/storage/t/partition_insert.test
index fdd45ecc3a3..25270f14def 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/partition_insert.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/partition_insert.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/skip_mariadb_100_or_later.inc
--source include/have_partition.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/partition_update.test b/storage/mroonga/mysql-test/mroonga/storage/t/partition_update.test
index 8ec55268b38..d601b4d4fe9 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/partition_update.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/partition_update.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/skip_mariadb_100_or_later.inc
--source include/have_partition.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/repair_table_no_index_file.test b/storage/mroonga/mysql-test/mroonga/storage/t/repair_table_no_index_file.test
index bdbcfefcd85..65989b60e8a 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/repair_table_no_index_file.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/repair_table_no_index_file.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/not_embedded.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/replace_geometry.test b/storage/mroonga/mysql-test/mroonga/storage/t/replace_geometry.test
index 65144ecc9e3..81dcbe318b3 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/replace_geometry.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/replace_geometry.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/have_geometry.inc
--source ../../include/mroonga/have_version_56_or_later.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/replace_select_varchar.test b/storage/mroonga/mysql-test/mroonga/storage/t/replace_select_varchar.test
index d7cd89cf78c..0f8e90c0c03 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/replace_select_varchar.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/replace_select_varchar.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
# Based on #910.
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/replace_text.test b/storage/mroonga/mysql-test/mroonga/storage/t/replace_text.test
index 6411896312c..bb134cd04e4 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/replace_text.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/replace_text.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/replace_varchar.test b/storage/mroonga/mysql-test/mroonga/storage/t/replace_varchar.test
index 0d9b82fb7d4..231e8b09762 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/replace_varchar.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/replace_varchar.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/replace_vector.test b/storage/mroonga/mysql-test/mroonga/storage/t/replace_vector.test
index a2efa7912b5..2e06bf7e5f8 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/replace_vector.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/replace_vector.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/replace_without_key.test b/storage/mroonga/mysql-test/mroonga/storage/t/replace_without_key.test
index 5cbeab60fb0..fb8a6750fb9 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/replace_without_key.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/replace_without_key.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/select_all.test b/storage/mroonga/mysql-test/mroonga/storage/t/select_all.test
index 8de78ca99af..c3973cb9164 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/select_all.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/select_all.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/select_empty_key_where_equal.test b/storage/mroonga/mysql-test/mroonga/storage/t/select_empty_key_where_equal.test
index c4ce4c0193d..c624f8e0c36 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/select_empty_key_where_equal.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/select_empty_key_where_equal.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/select_empty_key_where_not_equal.test b/storage/mroonga/mysql-test/mroonga/storage/t/select_empty_key_where_not_equal.test
index 8537616e89e..59c358cc1b8 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/select_empty_key_where_not_equal.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/select_empty_key_where_not_equal.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/select_group_by_with_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/select_group_by_with_index.test
index 569fbcfd600..4424cf283da 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/select_group_by_with_index.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/select_group_by_with_index.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/select_group_by_without_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/select_group_by_without_index.test
index ae852bfcfed..46c0e5aa70e 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/select_group_by_without_index.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/select_group_by_without_index.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/select_pkey.test b/storage/mroonga/mysql-test/mroonga/storage/t/select_pkey.test
index 9ebd707392d..a0afe1198ef 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/select_pkey.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/select_pkey.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/select_secondary_key.test b/storage/mroonga/mysql-test/mroonga/storage/t/select_secondary_key.test
index a6159bea02b..231e7c27037 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/select_secondary_key.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/select_secondary_key.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/show_create_table_TODO_SPLIT_ME.test b/storage/mroonga/mysql-test/mroonga/storage/t/show_create_table_TODO_SPLIT_ME.test
index 240e8c11dcf..3f00049092c 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/show_create_table_TODO_SPLIT_ME.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/show_create_table_TODO_SPLIT_ME.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/sub_query_fulltext.test b/storage/mroonga/mysql-test/mroonga/storage/t/sub_query_fulltext.test
index 34839669f25..c2df2522b9c 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/sub_query_fulltext.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/sub_query_fulltext.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/temporary_table.test b/storage/mroonga/mysql-test/mroonga/storage/t/temporary_table.test
index 56ebb430afc..e71a2322bb2 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/temporary_table.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/temporary_table.test
@@ -13,7 +13,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/skip_osx.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/truncate.test b/storage/mroonga/mysql-test/mroonga/storage/t/truncate.test
index dac32178011..7e5bc2d010c 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/truncate.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/truncate.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/update_fulltext.test b/storage/mroonga/mysql-test/mroonga/storage/t/update_fulltext.test
index a6cc1ba7fb2..33ccec42989 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/update_fulltext.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/update_fulltext.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/update_id_hash_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/update_id_hash_index.test
index e362984f896..5b5a47ad447 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/update_id_hash_index.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/update_id_hash_index.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/update_id_unique_hash_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/update_id_unique_hash_index.test
index d8257e41fb5..f1c91bfd8d3 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/update_id_unique_hash_index.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/update_id_unique_hash_index.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/update_int.test b/storage/mroonga/mysql-test/mroonga/storage/t/update_int.test
index 043ae25aee5..7f40ba09b2e 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/update_int.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/update_int.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/update_last_insert_grn_id.test b/storage/mroonga/mysql-test/mroonga/storage/t/update_last_insert_grn_id.test
index 3ad713cbbde..65f0ce3b253 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/update_last_insert_grn_id.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/update_last_insert_grn_id.test
@@ -13,7 +13,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/not_embedded.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/update_virtual_column.test b/storage/mroonga/mysql-test/mroonga/storage/t/update_virtual_column.test
index f5d85de4043..a50bfd6929e 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/update_virtual_column.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/update_virtual_column.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/not_embedded.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/variable_boolean_mode_syntax_flags_allow_column.test b/storage/mroonga/mysql-test/mroonga/storage/t/variable_boolean_mode_syntax_flags_allow_column.test
index b2cdf053bdb..2cba585bc2a 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/variable_boolean_mode_syntax_flags_allow_column.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/variable_boolean_mode_syntax_flags_allow_column.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
# TODO: Remove the check after MariaDB 5.5.42 and MariaDB 10.0.17 are released.
--source ../../include/mroonga/have_mysql.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/variable_boolean_mode_syntax_flags_allow_leading_not.test b/storage/mroonga/mysql-test/mroonga/storage/t/variable_boolean_mode_syntax_flags_allow_leading_not.test
index 08afc2cb39e..bdd4f915bbf 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/variable_boolean_mode_syntax_flags_allow_leading_not.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/variable_boolean_mode_syntax_flags_allow_leading_not.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
# TODO: Remove the check after MariaDB 5.5.42 and MariaDB 10.0.17 are released.
--source ../../include/mroonga/have_mysql.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/variable_boolean_mode_syntax_flags_allow_update.test b/storage/mroonga/mysql-test/mroonga/storage/t/variable_boolean_mode_syntax_flags_allow_update.test
index 4987dbe2b7a..c7f54925382 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/variable_boolean_mode_syntax_flags_allow_update.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/variable_boolean_mode_syntax_flags_allow_update.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
# TODO: Remove the check after MariaDB 5.5.42 and MariaDB 10.0.17 are released.
--source ../../include/mroonga/have_mysql.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/variable_boolean_mode_syntax_flags_syntax_query.test b/storage/mroonga/mysql-test/mroonga/storage/t/variable_boolean_mode_syntax_flags_syntax_query.test
index 84cac40b16a..b3265d9645b 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/variable_boolean_mode_syntax_flags_syntax_query.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/variable_boolean_mode_syntax_flags_syntax_query.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
# TODO: Remove the check after MariaDB 5.5.42 and MariaDB 10.0.17 are released.
--source ../../include/mroonga/have_mysql.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/variable_boolean_mode_syntax_flags_syntax_script.test b/storage/mroonga/mysql-test/mroonga/storage/t/variable_boolean_mode_syntax_flags_syntax_script.test
index dea8212bda1..61613ef2906 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/variable_boolean_mode_syntax_flags_syntax_script.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/variable_boolean_mode_syntax_flags_syntax_script.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
# TODO: Remove the check after MariaDB 5.5.42 and MariaDB 10.0.17 are released.
--source ../../include/mroonga/have_mysql.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/variable_database_path_prefix.test b/storage/mroonga/mysql-test/mroonga/storage/t/variable_database_path_prefix.test
index 7a0c70a53b7..ad934696171 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/variable_database_path_prefix.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/variable_database_path_prefix.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/not_embedded.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/variable_default_parser_new_value.test b/storage/mroonga/mysql-test/mroonga/storage/t/variable_default_parser_new_value.test
index a61af87fb2b..e71dcfe0dda 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/variable_default_parser_new_value.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/variable_default_parser_new_value.test
@@ -13,7 +13,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/variable_default_parser_same_value.test b/storage/mroonga/mysql-test/mroonga/storage/t/variable_default_parser_same_value.test
index 0e8562de92c..4cfbe489b90 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/variable_default_parser_same_value.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/variable_default_parser_same_value.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/variable_dry_write_delete.test b/storage/mroonga/mysql-test/mroonga/storage/t/variable_dry_write_delete.test
index b80ac2e8400..de97096e5a4 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/variable_dry_write_delete.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/variable_dry_write_delete.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/variable_dry_write_insert.test b/storage/mroonga/mysql-test/mroonga/storage/t/variable_dry_write_insert.test
index 72346c80a6d..b52385793d2 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/variable_dry_write_insert.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/variable_dry_write_insert.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/variable_dry_write_update.test b/storage/mroonga/mysql-test/mroonga/storage/t/variable_dry_write_update.test
index 2100f61700c..47c24421586 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/variable_dry_write_update.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/variable_dry_write_update.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/variable_lock_timeout_disable.test b/storage/mroonga/mysql-test/mroonga/storage/t/variable_lock_timeout_disable.test
index 2c2776e5fd8..3e2c5bfe7bf 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/variable_lock_timeout_disable.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/variable_lock_timeout_disable.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_version_100_or_later.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/variable_lock_timeout_invalid.test b/storage/mroonga/mysql-test/mroonga/storage/t/variable_lock_timeout_invalid.test
index e2090cf9659..7358389bb5d 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/variable_lock_timeout_invalid.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/variable_lock_timeout_invalid.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_version_100_or_later.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/variable_lock_timeout_no_retry.test b/storage/mroonga/mysql-test/mroonga/storage/t/variable_lock_timeout_no_retry.test
index 9df4970cacd..c25d1747b1d 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/variable_lock_timeout_no_retry.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/variable_lock_timeout_no_retry.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/variable_lock_timeout_valid.test b/storage/mroonga/mysql-test/mroonga/storage/t/variable_lock_timeout_valid.test
index 49394d0a40a..523baa1b3e9 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/variable_lock_timeout_valid.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/variable_lock_timeout_valid.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/variable_log_file_new_value.test b/storage/mroonga/mysql-test/mroonga/storage/t/variable_log_file_new_value.test
index 77f6adb1713..c96b021be76 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/variable_log_file_new_value.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/variable_log_file_new_value.test
@@ -13,7 +13,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/variable_log_file_nonexistent_path.test b/storage/mroonga/mysql-test/mroonga/storage/t/variable_log_file_nonexistent_path.test
index 254beae17a0..d05cbd2349a 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/variable_log_file_nonexistent_path.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/variable_log_file_nonexistent_path.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/variable_log_file_same_value.test b/storage/mroonga/mysql-test/mroonga/storage/t/variable_log_file_same_value.test
index 54116467502..ead099e0cc1 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/variable_log_file_same_value.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/variable_log_file_same_value.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/variable_log_level_TODO_SPLIT_ME.test b/storage/mroonga/mysql-test/mroonga/storage/t/variable_log_level_TODO_SPLIT_ME.test
index f736be43e6b..1f73f4f447f 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/variable_log_level_TODO_SPLIT_ME.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/variable_log_level_TODO_SPLIT_ME.test
@@ -13,7 +13,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/variable_match_escalation_threshold_global.test b/storage/mroonga/mysql-test/mroonga/storage/t/variable_match_escalation_threshold_global.test
index 9018bd75626..8585c1c2f11 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/variable_match_escalation_threshold_global.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/variable_match_escalation_threshold_global.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/variable_match_escalation_threshold_session.test b/storage/mroonga/mysql-test/mroonga/storage/t/variable_match_escalation_threshold_session.test
index 49557069965..8743c3faadb 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/variable_match_escalation_threshold_session.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/variable_match_escalation_threshold_session.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/variable_max_n_records_for_estimate_global.test b/storage/mroonga/mysql-test/mroonga/storage/t/variable_max_n_records_for_estimate_global.test
index 264bf95fd22..043d8d3340b 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/variable_max_n_records_for_estimate_global.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/variable_max_n_records_for_estimate_global.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/variable_max_n_records_for_estimate_session.test b/storage/mroonga/mysql-test/mroonga/storage/t/variable_max_n_records_for_estimate_session.test
index 3abc3c532d3..894e14f4802 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/variable_max_n_records_for_estimate_session.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/variable_max_n_records_for_estimate_session.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/variable_vector_column_delimiter.test b/storage/mroonga/mysql-test/mroonga/storage/t/variable_vector_column_delimiter.test
index 8412e6a65fa..d2ae3fd8718 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/variable_vector_column_delimiter.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/variable_vector_column_delimiter.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/not_embedded.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/variable_version.test b/storage/mroonga/mysql-test/mroonga/storage/t/variable_version.test
index ff47f2c921d..6c21f8d50d7 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/variable_version.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/variable_version.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_add_column.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_add_column.test
index f25fdf95dab..bb4d5389909 100644
--- a/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_add_column.test
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_add_column.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/have_innodb.inc
--source include/not_embedded.inc
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_change_column_comment.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_change_column_comment.test
index bbc5ca49818..a1d5c28baf1 100644
--- a/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_change_column_comment.test
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_change_column_comment.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/have_innodb.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_change_engine.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_change_engine.test
index 38a13bf8a5e..e1b657b7ee8 100644
--- a/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_change_engine.test
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_change_engine.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/have_innodb.inc
--source include/not_embedded.inc
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_comment_change_engine.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_comment_change_engine.test
index 2c85cc68266..645d3dad7b3 100644
--- a/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_comment_change_engine.test
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_comment_change_engine.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/have_innodb.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_disable_keys_create_fulltext.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_disable_keys_create_fulltext.test
index 00b6ecf565e..68bf5c9bbe9 100644
--- a/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_disable_keys_create_fulltext.test
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_disable_keys_create_fulltext.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/have_innodb.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_disable_keys_fulltext.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_disable_keys_fulltext.test
index f81b4e82b06..0cd02e1812a 100644
--- a/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_disable_keys_fulltext.test
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_disable_keys_fulltext.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/have_innodb.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_disable_keys_multiple_column.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_disable_keys_multiple_column.test
index 760a4bc99bd..217df7a1edb 100644
--- a/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_disable_keys_multiple_column.test
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_disable_keys_multiple_column.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/have_innodb.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_disable_keys_normal.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_disable_keys_normal.test
index 89a62e78baa..ea3ef4f1484 100644
--- a/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_disable_keys_normal.test
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_disable_keys_normal.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/have_innodb.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_disable_keys_primary.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_disable_keys_primary.test
index 63f0b8ad404..107f4a9a755 100644
--- a/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_disable_keys_primary.test
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_disable_keys_primary.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/have_innodb.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_disable_keys_updating.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_disable_keys_updating.test
index 9d0f1f3dc1a..3c63d4a1496 100644
--- a/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_disable_keys_updating.test
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_disable_keys_updating.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_drop_column.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_drop_column.test
index 41a09b8721b..cc4b79ebf39 100644
--- a/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_drop_column.test
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_drop_column.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/have_innodb.inc
--source include/not_embedded.inc
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_enable_keys_fulltext.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_enable_keys_fulltext.test
index 293bc8b7963..e92a2e5c7f7 100644
--- a/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_enable_keys_fulltext.test
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_enable_keys_fulltext.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/have_innodb.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_enable_keys_lock_tables.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_enable_keys_lock_tables.test
index 0756c27f9f8..f5f7e307d5d 100644
--- a/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_enable_keys_lock_tables.test
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_enable_keys_lock_tables.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/have_innodb.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_enable_keys_multiple_column.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_enable_keys_multiple_column.test
index f8b93e19000..587102c3db4 100644
--- a/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_enable_keys_multiple_column.test
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_enable_keys_multiple_column.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/have_innodb.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_enable_keys_normal.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_enable_keys_normal.test
index 3dd0f332fe6..2f28eef1574 100644
--- a/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_enable_keys_normal.test
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_enable_keys_normal.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/have_innodb.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_enable_keys_primary.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_enable_keys_primary.test
index bfa11c9eb8c..aaff5f90b74 100644
--- a/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_enable_keys_primary.test
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_enable_keys_primary.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/have_innodb.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_fulltext.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_fulltext.test
index f4bd0b391b6..62e56899aad 100644
--- a/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_fulltext.test
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_fulltext.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/have_innodb.inc
--source include/not_embedded.inc
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_rename_table.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_rename_table.test
index 595a850ae03..c84e86594ca 100644
--- a/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_rename_table.test
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_rename_table.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/have_innodb.inc
--source include/not_embedded.inc
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_spatial.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_spatial.test
index 6a62ae312b2..34c8bc02a1d 100644
--- a/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_spatial.test
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_spatial.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/have_innodb.inc
--source include/not_embedded.inc
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/auto_increment_text.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/auto_increment_text.test
index e702cb5d591..b4ebd69a5e9 100644
--- a/storage/mroonga/mysql-test/mroonga/wrapper/t/auto_increment_text.test
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/auto_increment_text.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/have_innodb.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/binlog_TODO_SPLIT_ME.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/binlog_TODO_SPLIT_ME.test
index 230ab87b391..224bdfa07c6 100644
--- a/storage/mroonga/mysql-test/mroonga/wrapper/t/binlog_TODO_SPLIT_ME.test
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/binlog_TODO_SPLIT_ME.test
@@ -13,7 +13,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/have_innodb.inc
--source include/have_log_bin.inc
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/column_comment_index_not_for_mroonga.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/column_comment_index_not_for_mroonga.test
index 3bc3c069705..2adbae8afd8 100644
--- a/storage/mroonga/mysql-test/mroonga/wrapper/t/column_comment_index_not_for_mroonga.test
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/column_comment_index_not_for_mroonga.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/have_innodb.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/column_normal_comment.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/column_normal_comment.test
index 73065ffd7bb..2e9674c860e 100644
--- a/storage/mroonga/mysql-test/mroonga/wrapper/t/column_normal_comment.test
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/column_normal_comment.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/have_innodb.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/count_star_with_index.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/count_star_with_index.test
index 899f00320c9..6fd0ff1971c 100644
--- a/storage/mroonga/mysql-test/mroonga/wrapper/t/count_star_with_index.test
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/count_star_with_index.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/have_innodb.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_TODO_SPLIT_ME.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_TODO_SPLIT_ME.test
index 6df44e79665..4eab593cfe7 100644
--- a/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_TODO_SPLIT_ME.test
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_TODO_SPLIT_ME.test
@@ -13,7 +13,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/have_innodb.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_comment_combined.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_comment_combined.test
index f9a7dc3168b..f2d4cf80e3a 100644
--- a/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_comment_combined.test
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_comment_combined.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/have_innodb.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_flags_comment.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_flags_comment.test
index 0b2565f2fb5..aa6b1f01f10 100644
--- a/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_flags_comment.test
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_flags_comment.test
@@ -13,7 +13,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/have_innodb.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_flags_none.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_flags_none.test
index 656a349c1be..d116aa6cd34 100644
--- a/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_flags_none.test
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_flags_none.test
@@ -13,7 +13,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/have_innodb.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_flags_parameter.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_flags_parameter.test
index 6b1a4c8dec2..3c6bb52d143 100644
--- a/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_flags_parameter.test
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_flags_parameter.test
@@ -13,7 +13,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mariadb.inc
--source include/have_innodb.inc
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_index_flags_none.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_index_flags_none.test
index da1e5e736ea..b433e54e885 100644
--- a/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_index_flags_none.test
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_index_flags_none.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/have_innodb.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_index_flags_with_position_and_with_weight.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_index_flags_with_position_and_with_weight.test
index 8d0d585d56d..47cededee55 100644
--- a/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_index_flags_with_position_and_with_weight.test
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_index_flags_with_position_and_with_weight.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/have_innodb.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_normalizer_comment.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_normalizer_comment.test
index 3b84e5d1bce..0d26c751c22 100644
--- a/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_normalizer_comment.test
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_normalizer_comment.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/have_innodb.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_normalizer_parameter.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_normalizer_parameter.test
index b8fe3eb6c7d..141d15c3c45 100644
--- a/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_normalizer_parameter.test
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_normalizer_parameter.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mariadb.inc
--source include/have_innodb.inc
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_parser_comment.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_parser_comment.test
index 05fc2fdcb9d..151d15a9870 100644
--- a/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_parser_comment.test
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_parser_comment.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/have_innodb.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_token_filters_index_multiple_token_filters.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_token_filters_index_multiple_token_filters.test
index 472f26cda6e..d5487a3b828 100644
--- a/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_token_filters_index_multiple_token_filters.test
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_token_filters_index_multiple_token_filters.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/have_innodb.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_token_filters_index_one_token_filter.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_token_filters_index_one_token_filter.test
index 0d3c00e2c98..0d863c9f99f 100644
--- a/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_token_filters_index_one_token_filter.test
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_token_filters_index_one_token_filter.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/have_innodb.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_token_filters_index_parameter.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_token_filters_index_parameter.test
index 9decafaf1e7..0532c19dbde 100644
--- a/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_token_filters_index_parameter.test
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_token_filters_index_parameter.test
@@ -13,7 +13,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mariadb.inc
--source include/have_innodb.inc
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_tokenizer_comment.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_tokenizer_comment.test
index 5053de07781..0a55dd6ae69 100644
--- a/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_tokenizer_comment.test
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_tokenizer_comment.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/have_innodb.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_tokenizer_parameter.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_tokenizer_parameter.test
index 7c688199314..a2087ca8a9f 100644
--- a/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_tokenizer_parameter.test
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_tokenizer_parameter.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mariadb.inc
--source include/have_innodb.inc
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/delete_TODO_SPLIT_ME.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/delete_TODO_SPLIT_ME.test
index 1e82a2dff60..dae9bf033ca 100644
--- a/storage/mroonga/mysql-test/mroonga/wrapper/t/delete_TODO_SPLIT_ME.test
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/delete_TODO_SPLIT_ME.test
@@ -13,7 +13,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/have_innodb.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/delete_all.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/delete_all.test
index c77a9cdeac3..b25fc596813 100644
--- a/storage/mroonga/mysql-test/mroonga/wrapper/t/delete_all.test
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/delete_all.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/have_innodb.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_leading_not.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_leading_not.test
index fb55d609855..d835a20746c 100644
--- a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_leading_not.test
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_leading_not.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/have_innodb.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_multiple_match_against.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_multiple_match_against.test
index 483cca04c8a..9882883e597 100644
--- a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_multiple_match_against.test
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_multiple_match_against.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/have_innodb.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_minus_no_operator.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_minus_no_operator.test
index 2e96b8ed4f8..1e57b56d6b0 100644
--- a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_minus_no_operator.test
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_minus_no_operator.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/have_innodb.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_minus_with_or.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_minus_with_or.test
index 6eb46419c4d..3fdad5365fe 100644
--- a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_minus_with_or.test
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_minus_with_or.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/have_innodb.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_minus_with_plus.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_minus_with_plus.test
index 301365610c5..53251eb2af7 100644
--- a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_minus_with_plus.test
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_minus_with_plus.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/have_innodb.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_or_no_operator.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_or_no_operator.test
index c561ac84c98..f46f732203b 100644
--- a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_or_no_operator.test
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_or_no_operator.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/have_innodb.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_or_with_minus.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_or_with_minus.test
index cc3c6cef5b8..8f8130b7b45 100644
--- a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_or_with_minus.test
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_or_with_minus.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/have_innodb.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_or_with_plus.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_or_with_plus.test
index 7002db06461..6fa65d395ee 100644
--- a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_or_with_plus.test
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_or_with_plus.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/have_innodb.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_plus_no_operator.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_plus_no_operator.test
index d013578a8f8..9d7f887c98d 100644
--- a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_plus_no_operator.test
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_plus_no_operator.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/have_innodb.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_plus_with_minus.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_plus_with_minus.test
index 91b0a7f7891..7feca394fa5 100644
--- a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_plus_with_minus.test
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_plus_with_minus.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/have_innodb.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_plus_with_or.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_plus_with_or.test
index 29c1c0d9d98..ade88c9c60d 100644
--- a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_plus_with_or.test
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_plus_with_or.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/have_innodb.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_weight_full_spec.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_weight_full_spec.test
index 027b05d5320..ecc1e0d0bad 100644
--- a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_weight_full_spec.test
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_weight_full_spec.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/have_innodb.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_weight_no_weight.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_weight_no_weight.test
index 41b814de80f..384b951f562 100644
--- a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_weight_no_weight.test
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_weight_no_weight.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/have_innodb.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_weight_omit_section.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_weight_omit_section.test
index 1db4134d0a0..f259fc85388 100644
--- a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_weight_omit_section.test
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_weight_omit_section.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/have_innodb.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_charset_ascii.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_charset_ascii.test
index 33e23e801ff..4cec44d01a2 100644
--- a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_charset_ascii.test
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_charset_ascii.test
@@ -13,7 +13,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/have_innodb.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_charset_cp932.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_charset_cp932.test
index 75853611f69..169069fb67d 100644
--- a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_charset_cp932.test
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_charset_cp932.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/have_innodb.inc
--source include/have_cp932.inc
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_charset_eucjpms.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_charset_eucjpms.test
index 3f1cba869f8..cda39ce2ad6 100644
--- a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_charset_eucjpms.test
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_charset_eucjpms.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/have_innodb.inc
--source include/have_eucjpms.inc
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_charset_japanese.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_charset_japanese.test
index 27524ac2ed0..93e78d6b46d 100644
--- a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_charset_japanese.test
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_charset_japanese.test
@@ -13,7 +13,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/have_innodb.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_index_recreate.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_index_recreate.test
index 0115ed0699c..27af190ed7a 100644
--- a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_index_recreate.test
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_index_recreate.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/have_innodb.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_insert_select.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_insert_select.test
index 26c784391ab..083384b04d1 100644
--- a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_insert_select.test
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_insert_select.test
@@ -13,7 +13,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/have_innodb.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_insert_values.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_insert_values.test
index 43237cdc96a..f4b76888b76 100644
--- a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_insert_values.test
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_insert_values.test
@@ -13,7 +13,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/have_innodb.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_many_records.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_many_records.test
index 442b4f248d9..07750416342 100644
--- a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_many_records.test
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_many_records.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/have_innodb.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_matched_and_not_matched_have_where_matched_order.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_matched_and_not_matched_have_where_matched_order.test
index 2ed609d9fe2..52700ad01fe 100644
--- a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_matched_and_not_matched_have_where_matched_order.test
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_matched_and_not_matched_have_where_matched_order.test
@@ -13,7 +13,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/have_innodb.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_matched_and_not_matched_have_where_no_order.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_matched_and_not_matched_have_where_no_order.test
index 968a763917d..b362acd4565 100644
--- a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_matched_and_not_matched_have_where_no_order.test
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_matched_and_not_matched_have_where_no_order.test
@@ -13,7 +13,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/have_innodb.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_matched_and_not_matched_no_where_both_order.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_matched_and_not_matched_no_where_both_order.test
index a0ae0ef8a2e..fa8fb79634d 100644
--- a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_matched_and_not_matched_no_where_both_order.test
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_matched_and_not_matched_no_where_both_order.test
@@ -13,7 +13,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/have_innodb.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_multiple_column_index_delete.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_multiple_column_index_delete.test
index 61aa07d8da2..d6defc1fca2 100644
--- a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_multiple_column_index_delete.test
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_multiple_column_index_delete.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/have_innodb.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_multiple_column_index_insert.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_multiple_column_index_insert.test
index 8ddfa82e84a..ebf5c37ad94 100644
--- a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_multiple_column_index_insert.test
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_multiple_column_index_insert.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/have_innodb.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_multiple_column_index_recreate.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_multiple_column_index_recreate.test
index 1e2413689d6..8ae0dd8892b 100644
--- a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_multiple_column_index_recreate.test
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_multiple_column_index_recreate.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/have_innodb.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_multiple_column_index_update.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_multiple_column_index_update.test
index 44690e699a0..a6c12aa1714 100644
--- a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_multiple_column_index_update.test
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_multiple_column_index_update.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/have_innodb.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_multiple_index.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_multiple_index.test
index 97a8a1f07a5..58c0ea3faf7 100644
--- a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_multiple_index.test
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_multiple_index.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/have_innodb.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_myisam.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_myisam.test
index 4b872eb054c..305f51d4a02 100644
--- a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_myisam.test
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_myisam.test
@@ -13,7 +13,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_not_match_against.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_not_match_against.test
index 43fc4b2771a..7fcffefd234 100644
--- a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_not_match_against.test
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_not_match_against.test
@@ -13,7 +13,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/have_innodb.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_order_TODO_SPLIT_ME.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_order_TODO_SPLIT_ME.test
index 4835f3dcd99..cba565b0253 100644
--- a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_order_TODO_SPLIT_ME.test
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_order_TODO_SPLIT_ME.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/have_innodb.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_order_transaction.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_order_transaction.test
index 91e2f73da1d..825cf361546 100644
--- a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_order_transaction.test
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_order_transaction.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/have_innodb.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/function_last_insert_id_reference.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/function_last_insert_id_reference.test
index 1b7c3a7f265..2cfd00b2172 100644
--- a/storage/mroonga/mysql-test/mroonga/wrapper/t/function_last_insert_id_reference.test
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/function_last_insert_id_reference.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/have_innodb.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/function_last_insert_id_set.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/function_last_insert_id_set.test
index 6dc87f740f9..b5f7dd80c31 100644
--- a/storage/mroonga/mysql-test/mroonga/wrapper/t/function_last_insert_id_set.test
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/function_last_insert_id_set.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/have_innodb.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/geometry_contains.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/geometry_contains.test
index af6242a9ad1..88fa88427cf 100644
--- a/storage/mroonga/mysql-test/mroonga/wrapper/t/geometry_contains.test
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/geometry_contains.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/have_innodb.inc
--source include/have_geometry.inc
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/geometry_delete.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/geometry_delete.test
index 9f3589a66d1..655a8416725 100644
--- a/storage/mroonga/mysql-test/mroonga/wrapper/t/geometry_delete.test
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/geometry_delete.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/have_innodb.inc
--source include/have_geometry.inc
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/geometry_update.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/geometry_update.test
index aff5c52c786..6a734958158 100644
--- a/storage/mroonga/mysql-test/mroonga/wrapper/t/geometry_update.test
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/geometry_update.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/have_innodb.inc
--source include/have_geometry.inc
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/index_force_index_not_used.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/index_force_index_not_used.test
index 037f8b02fbf..b7a4dd4c36b 100644
--- a/storage/mroonga/mysql-test/mroonga/wrapper/t/index_force_index_not_used.test
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/index_force_index_not_used.test
@@ -13,7 +13,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/have_innodb.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/insert_TODO_SPLIT_ME.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/insert_TODO_SPLIT_ME.test
index e619b0af930..87947f1ea6c 100644
--- a/storage/mroonga/mysql-test/mroonga/wrapper/t/insert_TODO_SPLIT_ME.test
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/insert_TODO_SPLIT_ME.test
@@ -13,7 +13,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/have_innodb.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/insert_bulk.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/insert_bulk.test
index 4087abf9bc3..a5edb8bae4a 100644
--- a/storage/mroonga/mysql-test/mroonga/wrapper/t/insert_bulk.test
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/insert_bulk.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/have_innodb.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/insert_on_duplicate_key_update_multiple_column_primary_key_myisam.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/insert_on_duplicate_key_update_multiple_column_primary_key_myisam.test
index cc3bc477409..d16527644e3 100644
--- a/storage/mroonga/mysql-test/mroonga/wrapper/t/insert_on_duplicate_key_update_multiple_column_primary_key_myisam.test
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/insert_on_duplicate_key_update_multiple_column_primary_key_myisam.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/insert_on_duplicate_key_update_multiple_column_unique_index_myisam.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/insert_on_duplicate_key_update_multiple_column_unique_index_myisam.test
index cdcdcc796f3..d97823f77a2 100644
--- a/storage/mroonga/mysql-test/mroonga/wrapper/t/insert_on_duplicate_key_update_multiple_column_unique_index_myisam.test
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/insert_on_duplicate_key_update_multiple_column_unique_index_myisam.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/multi_range_read_disk_sweep.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/multi_range_read_disk_sweep.test
index f5b429e523b..dbe11f03bec 100644
--- a/storage/mroonga/mysql-test/mroonga/wrapper/t/multi_range_read_disk_sweep.test
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/multi_range_read_disk_sweep.test
@@ -13,7 +13,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source ../../include/mroonga/have_mysql.inc
--source ../../include/mroonga/have_version_56_or_later.inc
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/optimization_order_limit_TODO_SPLIT_ME.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/optimization_order_limit_TODO_SPLIT_ME.test
index 776fd27a2f2..078e0b6e28e 100644
--- a/storage/mroonga/mysql-test/mroonga/wrapper/t/optimization_order_limit_TODO_SPLIT_ME.test
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/optimization_order_limit_TODO_SPLIT_ME.test
@@ -13,7 +13,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/have_innodb.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/optimization_order_limit_no_direction.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/optimization_order_limit_no_direction.test
index 69be84e2619..07a497d7871 100644
--- a/storage/mroonga/mysql-test/mroonga/wrapper/t/optimization_order_limit_no_direction.test
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/optimization_order_limit_no_direction.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/have_innodb.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/optimization_order_limit_no_where_clause.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/optimization_order_limit_no_where_clause.test
index da37f5d6372..a74db4417b2 100644
--- a/storage/mroonga/mysql-test/mroonga/wrapper/t/optimization_order_limit_no_where_clause.test
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/optimization_order_limit_no_where_clause.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/have_innodb.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/optimization_order_limit_order_by_primary_key.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/optimization_order_limit_order_by_primary_key.test
index f7b858e75f0..25a02398a66 100644
--- a/storage/mroonga/mysql-test/mroonga/wrapper/t/optimization_order_limit_order_by_primary_key.test
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/optimization_order_limit_order_by_primary_key.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/have_innodb.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/performance_schema.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/performance_schema.test
index 31c3e0a26ff..7d663bef626 100644
--- a/storage/mroonga/mysql-test/mroonga/wrapper/t/performance_schema.test
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/performance_schema.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/have_innodb.inc
--source include/not_embedded.inc
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/repair_table_no_files.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/repair_table_no_files.test
index 8f0d01d52fb..d11a3efe900 100644
--- a/storage/mroonga/mysql-test/mroonga/wrapper/t/repair_table_no_files.test
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/repair_table_no_files.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/have_innodb.inc
--source include/not_embedded.inc
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/repair_table_no_index_file.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/repair_table_no_index_file.test
index b5a7f2c860a..6d09479e554 100644
--- a/storage/mroonga/mysql-test/mroonga/wrapper/t/repair_table_no_index_file.test
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/repair_table_no_index_file.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/have_innodb.inc
--source include/not_embedded.inc
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/temporary_table.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/temporary_table.test
index 0eb5ef514a2..7d98ca0bfa7 100644
--- a/storage/mroonga/mysql-test/mroonga/wrapper/t/temporary_table.test
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/temporary_table.test
@@ -13,7 +13,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/have_innodb.inc
--source ../../include/mroonga/skip_osx.inc
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/transaction_query_cache.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/transaction_query_cache.test
index b2522db7919..9055715486b 100644
--- a/storage/mroonga/mysql-test/mroonga/wrapper/t/transaction_query_cache.test
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/transaction_query_cache.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/have_innodb.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/transaction_rollback_delete_delete.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/transaction_rollback_delete_delete.test
index f0da6934f8e..dd08d93cd47 100644
--- a/storage/mroonga/mysql-test/mroonga/wrapper/t/transaction_rollback_delete_delete.test
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/transaction_rollback_delete_delete.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/have_innodb.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/transaction_rollback_delete_update.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/transaction_rollback_delete_update.test
index 425a16c204e..ae9099a7ab9 100644
--- a/storage/mroonga/mysql-test/mroonga/wrapper/t/transaction_rollback_delete_update.test
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/transaction_rollback_delete_update.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/have_innodb.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/truncate.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/truncate.test
index 8723a882ae9..1920237fdad 100644
--- a/storage/mroonga/mysql-test/mroonga/wrapper/t/truncate.test
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/truncate.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/have_innodb.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/update_fulltext.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/update_fulltext.test
index 50c14184c98..7afeee05ffd 100644
--- a/storage/mroonga/mysql-test/mroonga/wrapper/t/update_fulltext.test
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/update_fulltext.test
@@ -13,7 +13,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/have_innodb.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/update_int.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/update_int.test
index 5c794aacf65..db1e2da9a18 100644
--- a/storage/mroonga/mysql-test/mroonga/wrapper/t/update_int.test
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/update_int.test
@@ -13,7 +13,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/have_innodb.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/variable_dry_write_delete.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/variable_dry_write_delete.test
index 165c8df858a..2757c94b4c5 100644
--- a/storage/mroonga/mysql-test/mroonga/wrapper/t/variable_dry_write_delete.test
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/variable_dry_write_delete.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/have_innodb.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/variable_dry_write_insert.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/variable_dry_write_insert.test
index b1222118833..5e958528275 100644
--- a/storage/mroonga/mysql-test/mroonga/wrapper/t/variable_dry_write_insert.test
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/variable_dry_write_insert.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/have_innodb.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/variable_dry_write_update.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/variable_dry_write_update.test
index 6b47d18b872..8e9a9e3308a 100644
--- a/storage/mroonga/mysql-test/mroonga/wrapper/t/variable_dry_write_update.test
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/variable_dry_write_update.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/have_innodb.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/variable_match_escalation_threshold_global.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/variable_match_escalation_threshold_global.test
index 9704d2d3e53..ead26bca2c1 100644
--- a/storage/mroonga/mysql-test/mroonga/wrapper/t/variable_match_escalation_threshold_global.test
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/variable_match_escalation_threshold_global.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/have_innodb.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/variable_match_escalation_threshold_session.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/variable_match_escalation_threshold_session.test
index c6967790b01..5f5ae169890 100644
--- a/storage/mroonga/mysql-test/mroonga/wrapper/t/variable_match_escalation_threshold_session.test
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/variable_match_escalation_threshold_session.test
@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
--source include/have_innodb.inc
--source ../../include/mroonga/have_mroonga.inc
diff --git a/storage/mroonga/test/run-sql-test.sh b/storage/mroonga/test/run-sql-test.sh
index 690f75c413b..f1679dc70fa 100755
--- a/storage/mroonga/test/run-sql-test.sh
+++ b/storage/mroonga/test/run-sql-test.sh
@@ -16,7 +16,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
export BASE_DIR="$(cd $(dirname $0); pwd)"
top_dir="$BASE_DIR/.."
diff --git a/storage/mroonga/test/unit/test_mrn_path_mapper.cpp b/storage/mroonga/test/unit/test_mrn_path_mapper.cpp
index 316c4770115..a5d0d81c340 100644
--- a/storage/mroonga/test/unit/test_mrn_path_mapper.cpp
+++ b/storage/mroonga/test/unit/test_mrn_path_mapper.cpp
@@ -14,7 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
*/
#include <string.h>
diff --git a/storage/mroonga/tools/travis/before_script.sh b/storage/mroonga/tools/travis/before_script.sh
index 1b3ba158675..2b4591a60a4 100755
--- a/storage/mroonga/tools/travis/before_script.sh
+++ b/storage/mroonga/tools/travis/before_script.sh
@@ -14,7 +14,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
# set -x
set -e
diff --git a/storage/mroonga/tools/travis/install.sh b/storage/mroonga/tools/travis/install.sh
index d9b090cd154..c723eb69f35 100755
--- a/storage/mroonga/tools/travis/install.sh
+++ b/storage/mroonga/tools/travis/install.sh
@@ -14,7 +14,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
# set -x
set -e
diff --git a/storage/mroonga/tools/travis/script.sh b/storage/mroonga/tools/travis/script.sh
index d8dd188f1f2..91fa06b8b4d 100755
--- a/storage/mroonga/tools/travis/script.sh
+++ b/storage/mroonga/tools/travis/script.sh
@@ -14,7 +14,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
# set -x
set -e
diff --git a/storage/mroonga/vendor/groonga/lib/CMakeLists.txt b/storage/mroonga/vendor/groonga/lib/CMakeLists.txt
index 45b2c923635..78258789083 100644
--- a/storage/mroonga/vendor/groonga/lib/CMakeLists.txt
+++ b/storage/mroonga/vendor/groonga/lib/CMakeLists.txt
@@ -22,8 +22,14 @@ include_directories(
${ONIGMO_INCLUDE_DIRS}
${MRUBY_INCLUDE_DIRS}
${LIBLZ4_INCLUDE_DIRS})
-link_directories(
- ${LIBLZ4_LIBRARY_DIRS})
+if (LIBLZ4_LIBRARY_DIRS)
+ find_library(LZ4_LIBS
+ NAMES ${LIBLZ4_LIBRARIES}
+ PATHS ${LIBLZ4_LIBRARY_DIRS}
+ NO_DEFAULT_PATH)
+else()
+ set(LZ4_LIBS ${LIBLZ4_LIBRARIES})
+endif()
read_file_list(${CMAKE_CURRENT_SOURCE_DIR}/sources.am LIBGROONGA_SOURCES)
read_file_list(${CMAKE_CURRENT_SOURCE_DIR}/dat/sources.am LIBGRNDAT_SOURCES)
@@ -60,7 +66,7 @@ set(GRN_ALL_LIBRARIES
${RT_LIBS}
${PTHREAD_LIBS}
${Z_LIBS}
- ${LIBLZ4_LIBRARIES}
+ ${LZ4_LIBS}
${DL_LIBS}
${M_LIBS}
${WS2_32_LIBS}
diff --git a/storage/myisam/ft_myisam.c b/storage/myisam/ft_myisam.c
index 7bcc62d5bf5..4e1879fa8ce 100644
--- a/storage/myisam/ft_myisam.c
+++ b/storage/myisam/ft_myisam.c
@@ -12,7 +12,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
/* Written by Sergei A. Golubchik, who has a shared copyright to this code */
diff --git a/storage/myisam/ha_myisam.cc b/storage/myisam/ha_myisam.cc
index 9fb7e5b2c35..2b5536a9ce5 100644
--- a/storage/myisam/ha_myisam.cc
+++ b/storage/myisam/ha_myisam.cc
@@ -1,6 +1,6 @@
/*
Copyright (c) 2000, 2012, Oracle and/or its affiliates.
- Copyright (c) 2009, 2014, SkySQL Ab.
+ Copyright (c) 2009, 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
@@ -928,61 +928,61 @@ int ha_myisam::check(THD* thd, HA_CHECK_OPT* check_opt)
{
if (!file) return HA_ADMIN_INTERNAL_ERROR;
int error;
- HA_CHECK &param= *(HA_CHECK*) thd->alloc(sizeof(param));
+ HA_CHECK *param= (HA_CHECK*) thd->alloc(sizeof *param);
MYISAM_SHARE* share = file->s;
const char *old_proc_info=thd->proc_info;
- if (!&param)
+ if (!param)
return HA_ADMIN_INTERNAL_ERROR;
thd_proc_info(thd, "Checking table");
- myisamchk_init(&param);
- param.thd = thd;
- param.op_name = "check";
- param.db_name= table->s->db.str;
- param.table_name= table->alias.c_ptr();
- param.testflag = check_opt->flags | T_CHECK | T_SILENT;
- param.stats_method= (enum_handler_stats_method)THDVAR(thd, stats_method);
+ myisamchk_init(param);
+ param->thd = thd;
+ param->op_name = "check";
+ param->db_name= table->s->db.str;
+ param->table_name= table->alias.c_ptr();
+ param->testflag = check_opt->flags | T_CHECK | T_SILENT;
+ param->stats_method= (enum_handler_stats_method)THDVAR(thd, stats_method);
if (!(table->db_stat & HA_READ_ONLY))
- param.testflag|= T_STATISTICS;
- param.using_global_keycache = 1;
+ param->testflag|= T_STATISTICS;
+ param->using_global_keycache = 1;
if (!mi_is_crashed(file) &&
- (((param.testflag & T_CHECK_ONLY_CHANGED) &&
+ (((param->testflag & T_CHECK_ONLY_CHANGED) &&
!(share->state.changed & (STATE_CHANGED | STATE_CRASHED |
STATE_CRASHED_ON_REPAIR)) &&
share->state.open_count == 0) ||
- ((param.testflag & T_FAST) && (share->state.open_count ==
+ ((param->testflag & T_FAST) && (share->state.open_count ==
(uint) (share->global_changed ? 1 : 0)))))
return HA_ADMIN_ALREADY_DONE;
- setup_vcols_for_repair(&param);
+ setup_vcols_for_repair(param);
- error = chk_status(&param, file); // Not fatal
- error = chk_size(&param, file);
+ error = chk_status(param, file); // Not fatal
+ error = chk_size(param, file);
if (!error)
- error |= chk_del(&param, file, param.testflag);
+ error |= chk_del(param, file, param->testflag);
if (!error)
- error = chk_key(&param, file);
+ error = chk_key(param, file);
if (!error)
{
- if ((!(param.testflag & T_QUICK) &&
+ if ((!(param->testflag & T_QUICK) &&
((share->options &
(HA_OPTION_PACK_RECORD | HA_OPTION_COMPRESS_RECORD)) ||
- (param.testflag & (T_EXTEND | T_MEDIUM)))) ||
+ (param->testflag & (T_EXTEND | T_MEDIUM)))) ||
mi_is_crashed(file))
{
- ulonglong old_testflag= param.testflag;
- param.testflag|=T_MEDIUM;
- if (!(error= init_io_cache(&param.read_cache, file->dfile,
+ ulonglong old_testflag= param->testflag;
+ param->testflag|=T_MEDIUM;
+ if (!(error= init_io_cache(&param->read_cache, file->dfile,
my_default_record_cache_size, READ_CACHE,
share->pack.header_length, 1, MYF(MY_WME))))
{
- error= chk_data_link(&param, file, MY_TEST(param.testflag & T_EXTEND));
- end_io_cache(&(param.read_cache));
+ error= chk_data_link(param, file, MY_TEST(param->testflag & T_EXTEND));
+ end_io_cache(&param->read_cache);
}
- param.testflag= old_testflag;
+ param->testflag= old_testflag;
}
}
if (!error)
@@ -990,7 +990,7 @@ int ha_myisam::check(THD* thd, HA_CHECK_OPT* check_opt)
if ((share->state.changed & (STATE_CHANGED |
STATE_CRASHED_ON_REPAIR |
STATE_CRASHED | STATE_NOT_ANALYZED)) ||
- (param.testflag & T_STATISTICS) ||
+ (param->testflag & T_STATISTICS) ||
mi_is_crashed(file))
{
file->update|=HA_STATE_CHANGED | HA_STATE_ROW_CHANGED;
@@ -998,7 +998,7 @@ int ha_myisam::check(THD* thd, HA_CHECK_OPT* check_opt)
share->state.changed&= ~(STATE_CHANGED | STATE_CRASHED |
STATE_CRASHED_ON_REPAIR);
if (!(table->db_stat & HA_READ_ONLY))
- error=update_state_info(&param,file,UPDATE_TIME | UPDATE_OPEN_COUNT |
+ error=update_state_info(param,file,UPDATE_TIME | UPDATE_OPEN_COUNT |
UPDATE_STAT);
mysql_mutex_unlock(&share->intern_lock);
info(HA_STATUS_NO_LOCK | HA_STATUS_TIME | HA_STATUS_VARIABLE |
@@ -1027,32 +1027,32 @@ int ha_myisam::check(THD* thd, HA_CHECK_OPT* check_opt)
int ha_myisam::analyze(THD *thd, HA_CHECK_OPT* check_opt)
{
int error=0;
- HA_CHECK &param= *(HA_CHECK*) thd->alloc(sizeof(param));
+ HA_CHECK *param= (HA_CHECK*) thd->alloc(sizeof *param);
MYISAM_SHARE* share = file->s;
- if (!&param)
+ if (!param)
return HA_ADMIN_INTERNAL_ERROR;
- myisamchk_init(&param);
- param.thd = thd;
- param.op_name= "analyze";
- param.db_name= table->s->db.str;
- param.table_name= table->alias.c_ptr();
- param.testflag= (T_FAST | T_CHECK | T_SILENT | T_STATISTICS |
+ myisamchk_init(param);
+ param->thd = thd;
+ param->op_name= "analyze";
+ param->db_name= table->s->db.str;
+ param->table_name= table->alias.c_ptr();
+ param->testflag= (T_FAST | T_CHECK | T_SILENT | T_STATISTICS |
T_DONT_CHECK_CHECKSUM);
- param.using_global_keycache = 1;
- param.stats_method= (enum_handler_stats_method)THDVAR(thd, stats_method);
+ param->using_global_keycache = 1;
+ param->stats_method= (enum_handler_stats_method)THDVAR(thd, stats_method);
if (!(share->state.changed & STATE_NOT_ANALYZED))
return HA_ADMIN_ALREADY_DONE;
- setup_vcols_for_repair(&param);
+ setup_vcols_for_repair(param);
- error = chk_key(&param, file);
+ error = chk_key(param, file);
if (!error)
{
mysql_mutex_lock(&share->intern_lock);
- error=update_state_info(&param,file,UPDATE_STAT);
+ error=update_state_info(param,file,UPDATE_STAT);
mysql_mutex_unlock(&share->intern_lock);
}
else if (!mi_is_crashed(file) && !thd->killed)
@@ -1067,41 +1067,41 @@ int ha_myisam::analyze(THD *thd, HA_CHECK_OPT* check_opt)
int ha_myisam::repair(THD* thd, HA_CHECK_OPT *check_opt)
{
int error;
- HA_CHECK &param= *(HA_CHECK*) thd->alloc(sizeof(param));
+ HA_CHECK *param= (HA_CHECK*) thd->alloc(sizeof *param);
ha_rows start_records;
- if (!file || !&param) return HA_ADMIN_INTERNAL_ERROR;
+ if (!file || !param) return HA_ADMIN_INTERNAL_ERROR;
- myisamchk_init(&param);
- param.thd = thd;
- param.op_name= "repair";
- param.testflag= ((check_opt->flags & ~(T_EXTEND)) |
+ myisamchk_init(param);
+ param->thd = thd;
+ param->op_name= "repair";
+ param->testflag= ((check_opt->flags & ~(T_EXTEND)) |
T_SILENT | T_FORCE_CREATE | T_CALC_CHECKSUM |
(check_opt->flags & T_EXTEND ? T_REP : T_REP_BY_SORT));
- param.tmpfile_createflag= O_RDWR | O_TRUNC;
- param.sort_buffer_length= THDVAR(thd, sort_buffer_size);
- param.backup_time= check_opt->start_time;
+ param->tmpfile_createflag= O_RDWR | O_TRUNC;
+ param->sort_buffer_length= THDVAR(thd, sort_buffer_size);
+ param->backup_time= check_opt->start_time;
start_records=file->state->records;
- setup_vcols_for_repair(&param);
+ setup_vcols_for_repair(param);
- while ((error=repair(thd,param,0)) && param.retry_repair)
+ while ((error=repair(thd,*param,0)) && param->retry_repair)
{
- param.retry_repair=0;
- if (test_all_bits(param.testflag,
+ param->retry_repair=0;
+ if (test_all_bits(param->testflag,
(uint) (T_RETRY_WITHOUT_QUICK | T_QUICK)))
{
- param.testflag&= ~(T_RETRY_WITHOUT_QUICK | T_QUICK);
+ param->testflag&= ~(T_RETRY_WITHOUT_QUICK | T_QUICK);
/* Ensure we don't loose any rows when retrying without quick */
- param.testflag|= T_SAFE_REPAIR;
+ param->testflag|= T_SAFE_REPAIR;
sql_print_information("Retrying repair of: '%s' including modifying data file",
table->s->path.str);
continue;
}
- param.testflag&= ~T_QUICK;
- if ((param.testflag & (T_REP_BY_SORT | T_REP_PARALLEL)))
+ param->testflag&= ~T_QUICK;
+ if ((param->testflag & (T_REP_BY_SORT | T_REP_PARALLEL)))
{
- param.testflag= (param.testflag & ~T_REP_ANY) | T_REP;
+ param->testflag= (param->testflag & ~T_REP_ANY) | T_REP;
sql_print_information("Retrying repair of: '%s' with keycache",
table->s->path.str);
continue;
@@ -1126,26 +1126,26 @@ int ha_myisam::repair(THD* thd, HA_CHECK_OPT *check_opt)
int ha_myisam::optimize(THD* thd, HA_CHECK_OPT *check_opt)
{
int error;
- HA_CHECK &param= *(HA_CHECK*) thd->alloc(sizeof(param));
+ HA_CHECK *param= (HA_CHECK*) thd->alloc(sizeof *param);
- if (!file || !&param) return HA_ADMIN_INTERNAL_ERROR;
+ if (!file || !param) return HA_ADMIN_INTERNAL_ERROR;
- myisamchk_init(&param);
- param.thd = thd;
- param.op_name= "optimize";
- param.testflag= (check_opt->flags | T_SILENT | T_FORCE_CREATE |
+ myisamchk_init(param);
+ param->thd = thd;
+ param->op_name= "optimize";
+ param->testflag= (check_opt->flags | T_SILENT | T_FORCE_CREATE |
T_REP_BY_SORT | T_STATISTICS | T_SORT_INDEX);
- param.tmpfile_createflag= O_RDWR | O_TRUNC;
- param.sort_buffer_length= THDVAR(thd, sort_buffer_size);
+ param->tmpfile_createflag= O_RDWR | O_TRUNC;
+ param->sort_buffer_length= THDVAR(thd, sort_buffer_size);
- setup_vcols_for_repair(&param);
+ setup_vcols_for_repair(param);
- if ((error= repair(thd,param,1)) && param.retry_repair)
+ if ((error= repair(thd,*param,1)) && param->retry_repair)
{
sql_print_warning("Warning: Optimize table got errno %d on %s.%s, retrying",
- my_errno, param.db_name, param.table_name);
- param.testflag&= ~T_REP_BY_SORT;
- error= repair(thd,param,1);
+ my_errno, param->db_name, param->table_name);
+ param->testflag&= ~T_REP_BY_SORT;
+ error= repair(thd,*param,1);
}
restore_vcos_after_repair();
@@ -1353,17 +1353,17 @@ int ha_myisam::assign_to_keycache(THD* thd, HA_CHECK_OPT *check_opt)
if (error != HA_ADMIN_OK)
{
/* Send error to user */
- HA_CHECK &param= *(HA_CHECK*) thd->alloc(sizeof(param));
- if (!&param)
+ HA_CHECK *param= (HA_CHECK*) thd->alloc(sizeof *param);
+ if (!param)
return HA_ADMIN_INTERNAL_ERROR;
- myisamchk_init(&param);
- param.thd= thd;
- param.op_name= "assign_to_keycache";
- param.db_name= table->s->db.str;
- param.table_name= table->s->table_name.str;
- param.testflag= 0;
- mi_check_print_error(&param, errmsg);
+ myisamchk_init(param);
+ param->thd= thd;
+ param->op_name= "assign_to_keycache";
+ param->db_name= table->s->db.str;
+ param->table_name= table->s->table_name.str;
+ param->testflag= 0;
+ mi_check_print_error(param, errmsg);
}
DBUG_RETURN(error);
}
@@ -1420,16 +1420,16 @@ int ha_myisam::preload_keys(THD* thd, HA_CHECK_OPT *check_opt)
err:
{
- HA_CHECK &param= *(HA_CHECK*) thd->alloc(sizeof(param));
- if (!&param)
+ HA_CHECK *param= (HA_CHECK*) thd->alloc(sizeof *param);
+ if (!param)
return HA_ADMIN_INTERNAL_ERROR;
- myisamchk_init(&param);
- param.thd= thd;
- param.op_name= "preload_keys";
- param.db_name= table->s->db.str;
- param.table_name= table->s->table_name.str;
- param.testflag= 0;
- mi_check_print_error(&param, errmsg);
+ myisamchk_init(param);
+ param->thd= thd;
+ param->op_name= "preload_keys";
+ param->db_name= table->s->db.str;
+ param->table_name= table->s->table_name.str;
+ param->testflag= 0;
+ mi_check_print_error(param, errmsg);
DBUG_RETURN(error);
}
}
@@ -1534,48 +1534,48 @@ int ha_myisam::enable_indexes(uint mode)
{
THD *thd= table->in_use;
int was_error= thd->is_error();
- HA_CHECK &param= *(HA_CHECK*) thd->alloc(sizeof(param));
+ HA_CHECK *param= (HA_CHECK*) thd->alloc(sizeof *param);
const char *save_proc_info=thd->proc_info;
- if (!&param)
+ if (!param)
DBUG_RETURN(HA_ADMIN_INTERNAL_ERROR);
thd_proc_info(thd, "Creating index");
- myisamchk_init(&param);
- param.op_name= "recreating_index";
- param.testflag= (T_SILENT | T_REP_BY_SORT | T_QUICK |
+ myisamchk_init(param);
+ param->op_name= "recreating_index";
+ param->testflag= (T_SILENT | T_REP_BY_SORT | T_QUICK |
T_CREATE_MISSING_KEYS);
/*
Don't lock and unlock table if it's locked.
Normally table should be locked. This test is mostly for safety.
*/
if (likely(file->lock_type != F_UNLCK))
- param.testflag|= T_NO_LOCKS;
-
+ param->testflag|= T_NO_LOCKS;
+
if (file->create_unique_index_by_sort)
- param.testflag|= T_CREATE_UNIQUE_BY_SORT;
+ param->testflag|= T_CREATE_UNIQUE_BY_SORT;
- param.myf_rw&= ~MY_WAIT_IF_FULL;
- param.sort_buffer_length= THDVAR(thd, sort_buffer_size);
- param.stats_method= (enum_handler_stats_method)THDVAR(thd, stats_method);
- param.tmpdir=&mysql_tmpdir_list;
+ param->myf_rw&= ~MY_WAIT_IF_FULL;
+ param->sort_buffer_length= THDVAR(thd, sort_buffer_size);
+ param->stats_method= (enum_handler_stats_method)THDVAR(thd, stats_method);
+ param->tmpdir=&mysql_tmpdir_list;
- setup_vcols_for_repair(&param);
+ setup_vcols_for_repair(param);
- if ((error= (repair(thd,param,0) != HA_ADMIN_OK)) && param.retry_repair)
+ if ((error= (repair(thd,*param,0) != HA_ADMIN_OK)) && param->retry_repair)
{
sql_print_warning("Warning: Enabling keys got errno %d on %s.%s, retrying",
- my_errno, param.db_name, param.table_name);
+ my_errno, param->db_name, param->table_name);
/*
Repairing by sort failed. Now try standard repair method.
Still we want to fix only index file. If data file corruption
was detected (T_RETRY_WITHOUT_QUICK), we shouldn't do much here.
Let implicit repair do this job.
*/
- if (!(param.testflag & T_RETRY_WITHOUT_QUICK))
+ if (!(param->testflag & T_RETRY_WITHOUT_QUICK))
{
- param.testflag&= ~T_REP_BY_SORT;
- error= (repair(thd,param,0) != HA_ADMIN_OK);
+ param->testflag&= ~T_REP_BY_SORT;
+ error= (repair(thd,*param,0) != HA_ADMIN_OK);
}
/*
If the standard repair succeeded, clear all error messages which
@@ -1980,15 +1980,22 @@ int ha_myisam::info(uint flag)
Set data_file_name and index_file_name to point at the symlink value
if table is symlinked (Ie; Real name is not same as generated name)
*/
+ char buf[FN_REFLEN];
data_file_name= index_file_name= 0;
fn_format(name_buff, file->filename, "", MI_NAME_DEXT,
MY_APPEND_EXT | MY_UNPACK_FILENAME);
- if (strcmp(name_buff, misam_info.data_file_name))
- data_file_name=misam_info.data_file_name;
+ if (my_is_symlink(name_buff))
+ {
+ my_readlink(buf, name_buff, MYF(0));
+ data_file_name= ha_thd()->strdup(buf);
+ }
fn_format(name_buff, file->filename, "", MI_NAME_IEXT,
MY_APPEND_EXT | MY_UNPACK_FILENAME);
- if (strcmp(name_buff, misam_info.index_file_name))
- index_file_name=misam_info.index_file_name;
+ if (my_is_symlink(name_buff))
+ {
+ my_readlink(buf, name_buff, MYF(0));
+ index_file_name= ha_thd()->strdup(buf);
+ }
}
if (flag & HA_STATUS_ERRKEY)
{
@@ -2266,6 +2273,77 @@ uint ha_myisam::checksum() const
}
+enum_alter_inplace_result
+ha_myisam::check_if_supported_inplace_alter(TABLE *new_table,
+ Alter_inplace_info *alter_info)
+{
+ DBUG_ENTER("ha_myisam::check_if_supported_inplace_alter");
+
+ const uint readd_index= Alter_inplace_info::ADD_INDEX |
+ Alter_inplace_info::DROP_INDEX;
+ const uint readd_unique= Alter_inplace_info::ADD_UNIQUE_INDEX |
+ Alter_inplace_info::DROP_UNIQUE_INDEX;
+ const uint readd_pk= Alter_inplace_info::ADD_PK_INDEX |
+ Alter_inplace_info::DROP_PK_INDEX;
+
+ const uint op= alter_info->handler_flags;
+
+ if (alter_info->handler_flags & Alter_inplace_info::ALTER_COLUMN_VCOL)
+ DBUG_RETURN(HA_ALTER_INPLACE_NOT_SUPPORTED);
+
+ /*
+ ha_myisam::open() updates table->key_info->block_size to be the actual
+ MYI index block size, overwriting user-specified value (if any).
+ So, the server can not reliably detect whether ALTER TABLE changes
+ key_block_size or not, it might think the block size was changed,
+ when it wasn't, and in this case the server will recreate (drop+add)
+ the index unnecessary. Fix it.
+ */
+
+ if (table->s->keys == new_table->s->keys &&
+ ((op & readd_pk) == readd_pk ||
+ (op & readd_unique) == readd_unique ||
+ (op & readd_index) == readd_index))
+ {
+ for (uint i=0; i < table->s->keys; i++)
+ {
+ KEY *old_key= table->key_info + i;
+ KEY *new_key= new_table->key_info + i;
+
+ if (old_key->block_size == new_key->block_size)
+ DBUG_RETURN(HA_ALTER_INPLACE_NOT_SUPPORTED); // must differ somewhere else
+
+ if (new_key->block_size && new_key->block_size != old_key->block_size)
+ DBUG_RETURN(HA_ALTER_INPLACE_NOT_SUPPORTED); // really changed
+
+ /* any difference besides the block_size, and we give up */
+ if (old_key->key_length != new_key->key_length ||
+ old_key->flags != new_key->flags ||
+ old_key->user_defined_key_parts != new_key->user_defined_key_parts ||
+ old_key->algorithm != new_key->algorithm ||
+ strcmp(old_key->name, new_key->name))
+ DBUG_RETURN(HA_ALTER_INPLACE_NOT_SUPPORTED);
+
+ for (uint j= 0; j < old_key->user_defined_key_parts; j++)
+ {
+ KEY_PART_INFO *old_kp= old_key->key_part + j;
+ KEY_PART_INFO *new_kp= new_key->key_part + j;
+ if (old_kp->offset != new_kp->offset ||
+ old_kp->null_offset != new_kp->null_offset ||
+ old_kp->length != new_kp->length ||
+ old_kp->fieldnr != new_kp->fieldnr ||
+ old_kp->key_part_flag != new_kp->key_part_flag ||
+ old_kp->type != new_kp->type ||
+ old_kp->null_bit != new_kp->null_bit)
+ DBUG_RETURN(HA_ALTER_INPLACE_NOT_SUPPORTED);
+ }
+ }
+ alter_info->handler_flags &= ~(readd_pk | readd_unique | readd_index);
+ }
+ DBUG_RETURN(handler::check_if_supported_inplace_alter(new_table, alter_info));
+}
+
+
bool ha_myisam::check_if_incompatible_data(HA_CREATE_INFO *create_info,
uint table_changes)
{
diff --git a/storage/myisam/ha_myisam.h b/storage/myisam/ha_myisam.h
index bb1a36e089b..4068720e39e 100644
--- a/storage/myisam/ha_myisam.h
+++ b/storage/myisam/ha_myisam.h
@@ -140,6 +140,8 @@ class ha_myisam: public handler
int optimize(THD* thd, HA_CHECK_OPT* check_opt);
int assign_to_keycache(THD* thd, HA_CHECK_OPT* check_opt);
int preload_keys(THD* thd, HA_CHECK_OPT* check_opt);
+ enum_alter_inplace_result check_if_supported_inplace_alter(TABLE *new_table,
+ Alter_inplace_info *alter_info);
bool check_if_incompatible_data(HA_CREATE_INFO *info, uint table_changes);
#ifdef HAVE_QUERY_CACHE
my_bool register_query_cache_table(THD *thd, char *table_key,
diff --git a/storage/myisam/mi_check.c b/storage/myisam/mi_check.c
index 8711b9ff9aa..e0016eca43f 100644
--- a/storage/myisam/mi_check.c
+++ b/storage/myisam/mi_check.c
@@ -75,7 +75,7 @@ static int sort_delete_record(MI_SORT_PARAM *sort_param);
static SORT_KEY_BLOCKS *alloc_key_blocks(HA_CHECK *, uint, uint);
static ha_checksum mi_byte_checksum(const uchar *buf, uint length);
static void set_data_file_type(MI_SORT_INFO *sort_info, MYISAM_SHARE *share);
-static int replace_data_file(HA_CHECK *, MI_INFO *, const char *, File);
+static int replace_data_file(HA_CHECK *param, MI_INFO *info, File new_file);
void myisamchk_init(HA_CHECK *param)
{
@@ -1710,7 +1710,7 @@ err:
/* Replace the actual file with the temporary file */
if (new_file >= 0)
{
- got_error= replace_data_file(param, info, name, new_file);
+ got_error= replace_data_file(param, info, new_file);
new_file= -1;
param->retry_repair= 0;
}
@@ -2524,7 +2524,7 @@ err:
/* Replace the actual file with the temporary file */
if (new_file >= 0)
{
- got_error= replace_data_file(param, info, name, new_file);
+ got_error= replace_data_file(param, info, new_file);
new_file= -1;
}
}
@@ -2538,7 +2538,7 @@ err:
(void) mysql_file_delete(mi_key_file_datatmp,
param->temp_filename, MYF(MY_WME));
if (info->dfile == new_file) /* Retry with key cache */
- if (unlikely(mi_open_datafile(info, share, name, -1)))
+ if (unlikely(mi_open_datafile(info, share)))
param->retry_repair= 0; /* Safety */
}
mi_mark_crashed_on_repair(info);
@@ -3063,7 +3063,7 @@ err:
/* Replace the actual file with the temporary file */
if (new_file >= 0)
{
- got_error= replace_data_file(param, info, name, new_file);
+ got_error= replace_data_file(param, info, new_file);
new_file= -1;
}
}
@@ -3077,7 +3077,7 @@ err:
(void) mysql_file_delete(mi_key_file_datatmp,
param->temp_filename, MYF(MY_WME));
if (info->dfile == new_file) /* Retry with key cache */
- if (unlikely(mi_open_datafile(info, share, name, -1)))
+ if (unlikely(mi_open_datafile(info, share)))
param->retry_repair= 0; /* Safety */
}
mi_mark_crashed_on_repair(info);
@@ -4759,8 +4759,7 @@ int mi_make_backup_of_index(MI_INFO *info, time_t backup_time, myf flags)
}
-static int replace_data_file(HA_CHECK *param, MI_INFO *info,
- const char *name, File new_file)
+static int replace_data_file(HA_CHECK *param, MI_INFO *info, File new_file)
{
MYISAM_SHARE *share=info->s;
@@ -4796,7 +4795,7 @@ static int replace_data_file(HA_CHECK *param, MI_INFO *info,
DATA_TMP_EXT, param->backup_time,
(param->testflag & T_BACKUP_DATA ?
MYF(MY_REDEL_MAKE_BACKUP): MYF(0))) ||
- mi_open_datafile(info, share, name, -1))
+ mi_open_datafile(info, share))
return 1;
return 0;
}
diff --git a/storage/myisam/mi_create.c b/storage/myisam/mi_create.c
index 5cffd1a759f..c0967a60d13 100644
--- a/storage/myisam/mi_create.c
+++ b/storage/myisam/mi_create.c
@@ -46,7 +46,8 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs,
uint aligned_key_start, block_length, res;
uint internal_table= flags & HA_CREATE_INTERNAL_TABLE;
ulong reclength, real_reclength,min_pack_length;
- char filename[FN_REFLEN],linkname[FN_REFLEN], *linkname_ptr;
+ char kfilename[FN_REFLEN],klinkname[FN_REFLEN], *klinkname_ptr;
+ char dfilename[FN_REFLEN],dlinkname[FN_REFLEN], *dlinkname_ptr;
ulong pack_reclength;
ulonglong tot_length,max_rows, tmp;
enum en_fieldtype type;
@@ -595,19 +596,19 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs,
/* chop off the table name, tempory tables use generated name */
if ((path= strrchr(ci->index_file_name, FN_LIBCHAR)))
*path= '\0';
- fn_format(filename, name, ci->index_file_name, MI_NAME_IEXT,
+ fn_format(kfilename, name, ci->index_file_name, MI_NAME_IEXT,
MY_REPLACE_DIR | MY_UNPACK_FILENAME |
MY_RETURN_REAL_PATH | MY_APPEND_EXT);
}
else
{
- fn_format(filename, ci->index_file_name, "", MI_NAME_IEXT,
+ fn_format(kfilename, ci->index_file_name, "", MI_NAME_IEXT,
MY_UNPACK_FILENAME | MY_RETURN_REAL_PATH |
(have_iext ? MY_REPLACE_EXT : MY_APPEND_EXT));
}
- fn_format(linkname, name, "", MI_NAME_IEXT,
+ fn_format(klinkname, name, "", MI_NAME_IEXT,
MY_UNPACK_FILENAME|MY_APPEND_EXT);
- linkname_ptr=linkname;
+ klinkname_ptr= klinkname;
/*
Don't create the table if the link or file exists to ensure that one
doesn't accidently destroy another table.
@@ -618,10 +619,10 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs,
{
char *iext= strrchr(name, '.');
int have_iext= iext && !strcmp(iext, MI_NAME_IEXT);
- fn_format(filename, name, "", MI_NAME_IEXT,
+ fn_format(kfilename, name, "", MI_NAME_IEXT,
MY_UNPACK_FILENAME | MY_RETURN_REAL_PATH |
(have_iext ? MY_REPLACE_EXT : MY_APPEND_EXT));
- linkname_ptr=0;
+ klinkname_ptr= 0;
/* Replace the current file */
create_flag=(flags & HA_CREATE_KEEP_FILES) ? 0 : MY_DELETE_OLD;
}
@@ -636,7 +637,7 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs,
NOTE: The filename is compared against unique_file_name of every
open table. Hence we need a real path here.
*/
- if (!internal_table && test_if_reopen(filename))
+ if (!internal_table && test_if_reopen(kfilename))
{
my_printf_error(HA_ERR_TABLE_EXIST, "MyISAM table '%s' is in use "
"(most likely by a MERGE table). Try FLUSH TABLES.",
@@ -646,7 +647,7 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs,
}
if ((file= mysql_file_create_with_symlink(mi_key_file_kfile,
- linkname_ptr, filename, 0,
+ klinkname_ptr, kfilename, 0,
create_mode,
MYF(MY_WME | create_flag))) < 0)
goto err;
@@ -666,31 +667,31 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs,
/* chop off the table name, tempory tables use generated name */
if ((path= strrchr(ci->data_file_name, FN_LIBCHAR)))
*path= '\0';
- fn_format(filename, name, ci->data_file_name, MI_NAME_DEXT,
+ fn_format(dfilename, name, ci->data_file_name, MI_NAME_DEXT,
MY_REPLACE_DIR | MY_UNPACK_FILENAME | MY_APPEND_EXT);
}
else
{
- fn_format(filename, ci->data_file_name, "", MI_NAME_DEXT,
+ fn_format(dfilename, ci->data_file_name, "", MI_NAME_DEXT,
MY_UNPACK_FILENAME |
(have_dext ? MY_REPLACE_EXT : MY_APPEND_EXT));
}
- fn_format(linkname, name, "",MI_NAME_DEXT,
+ fn_format(dlinkname, name, "",MI_NAME_DEXT,
MY_UNPACK_FILENAME | MY_APPEND_EXT);
- linkname_ptr=linkname;
+ dlinkname_ptr= dlinkname;
create_flag=0;
}
else
{
- fn_format(filename,name,"", MI_NAME_DEXT,
+ fn_format(dfilename,name,"", MI_NAME_DEXT,
MY_UNPACK_FILENAME | MY_APPEND_EXT);
- linkname_ptr=0;
+ dlinkname_ptr= 0;
create_flag=(flags & HA_CREATE_KEEP_FILES) ? 0 : MY_DELETE_OLD;
}
if ((dfile=
mysql_file_create_with_symlink(mi_key_file_dfile,
- linkname_ptr, filename, 0,
+ dlinkname_ptr, dfilename, 0,
create_mode,
MYF(MY_WME | create_flag))) < 0)
goto err;
@@ -843,19 +844,21 @@ err_no_lock:
(void) mysql_file_close(dfile, MYF(0));
/* fall through */
case 2:
- if (! (flags & HA_DONT_TOUCH_DATA))
- mysql_file_delete_with_symlink(mi_key_file_dfile,
- fn_format(filename, name, "", MI_NAME_DEXT,
- MY_UNPACK_FILENAME | MY_APPEND_EXT),
- MYF(0));
+ if (! (flags & HA_DONT_TOUCH_DATA))
+ {
+ mysql_file_delete(mi_key_file_dfile, dfilename, MYF(0));
+ if (dlinkname_ptr)
+ mysql_file_delete(mi_key_file_dfile, dlinkname_ptr, MYF(0));
+ }
/* fall through */
case 1:
(void) mysql_file_close(file, MYF(0));
if (! (flags & HA_DONT_TOUCH_DATA))
- mysql_file_delete_with_symlink(mi_key_file_kfile,
- fn_format(filename, name, "", MI_NAME_IEXT,
- MY_UNPACK_FILENAME | MY_APPEND_EXT),
- MYF(0));
+ {
+ mysql_file_delete(mi_key_file_kfile, kfilename, MYF(0));
+ if (klinkname_ptr)
+ mysql_file_delete(mi_key_file_kfile, klinkname_ptr, MYF(0));
+ }
}
my_free(rec_per_key_part);
DBUG_RETURN(my_errno=save_errno); /* return the fatal errno */
diff --git a/storage/myisam/mi_delete_table.c b/storage/myisam/mi_delete_table.c
index 7da960011ca..d766fb2547f 100644
--- a/storage/myisam/mi_delete_table.c
+++ b/storage/myisam/mi_delete_table.c
@@ -26,47 +26,22 @@
#define mi_key_file_dfile 0
#endif
-static int delete_one_file(const char *name, const char *ext,
- PSI_file_key pskey __attribute__((unused)),
- myf flags)
-{
- char from[FN_REFLEN];
- DBUG_ENTER("delete_one_file");
- fn_format(from,name, "", ext, MY_UNPACK_FILENAME | MY_APPEND_EXT);
- if (my_is_symlink(from) && (*myisam_test_invalid_symlink)(from))
- {
- /*
- Symlink is pointing to file in data directory.
- Remove symlink, keep file.
- */
- if (mysql_file_delete(pskey, from, flags))
- DBUG_RETURN(my_errno);
- }
- else
- {
- if (mysql_file_delete_with_symlink(pskey, from, flags))
- DBUG_RETURN(my_errno);
- }
- DBUG_RETURN(0);
-}
-
int mi_delete_table(const char *name)
{
- int res;
DBUG_ENTER("mi_delete_table");
#ifdef EXTRA_DEBUG
check_table_is_closed(name,"delete");
#endif
- if ((res= delete_one_file(name, MI_NAME_IEXT, mi_key_file_kfile, MYF(MY_WME))))
- DBUG_RETURN(res);
- if ((res= delete_one_file(name, MI_NAME_DEXT, mi_key_file_dfile, MYF(MY_WME))))
- DBUG_RETURN(res);
+ if (mysql_file_delete_with_symlink(mi_key_file_kfile, name, MI_NAME_IEXT, MYF(MY_WME)) ||
+ mysql_file_delete_with_symlink(mi_key_file_dfile, name, MI_NAME_DEXT, MYF(MY_WME)))
+ DBUG_RETURN(my_errno);
+
// optionally present:
- delete_one_file(name, ".OLD", mi_key_file_dfile, MYF(0));
- delete_one_file(name, ".TMD", mi_key_file_dfile, MYF(0));
+ mysql_file_delete_with_symlink(mi_key_file_dfile, name, ".OLD", MYF(0));
+ mysql_file_delete_with_symlink(mi_key_file_dfile, name, ".TMD", MYF(0));
DBUG_RETURN(0);
}
diff --git a/storage/myisam/mi_open.c b/storage/myisam/mi_open.c
index 6fd684a050f..ef47265a18b 100644
--- a/storage/myisam/mi_open.c
+++ b/storage/myisam/mi_open.c
@@ -104,8 +104,13 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags)
realpath_err= my_realpath(name_buff,
fn_format(org_name,name,"",MI_NAME_IEXT,4),MYF(0));
+ if (realpath_err > 0) /* File not found, no point in looking further. */
+ {
+ DBUG_RETURN(NULL);
+ }
+
if (my_is_symlink(org_name) &&
- (realpath_err || (*myisam_test_invalid_symlink)(name_buff)))
+ (realpath_err || mysys_test_invalid_symlink(name_buff)))
{
my_errno= HA_WRONG_CREATE_OPTION;
DBUG_RETURN (NULL);
@@ -131,15 +136,17 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags)
my_errno= HA_ERR_CRASHED;
goto err;
});
- if ((kfile= mysql_file_open(mi_key_file_kfile,
- name_buff,
- (open_mode= O_RDWR) | O_SHARE, MYF(0))) < 0)
+
+ DEBUG_SYNC_C("mi_open_kfile");
+ if ((kfile= mysql_file_open(mi_key_file_kfile, name_buff,
+ (open_mode= O_RDWR) | O_SHARE | O_NOFOLLOW,
+ MYF(MY_NOSYMLINKS))) < 0)
{
if ((errno != EROFS && errno != EACCES) ||
mode != O_RDONLY ||
- (kfile= mysql_file_open(mi_key_file_kfile,
- name_buff,
- (open_mode= O_RDONLY) | O_SHARE, MYF(0))) < 0)
+ (kfile= mysql_file_open(mi_key_file_kfile, name_buff,
+ (open_mode= O_RDONLY) | O_SHARE| O_NOFOLLOW,
+ MYF(MY_NOSYMLINKS))) < 0)
goto err;
}
share->mode=open_mode;
@@ -183,7 +190,18 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags)
(void) strmov(index_name, org_name);
*strrchr(org_name, '.')= '\0';
(void) fn_format(data_name,org_name,"",MI_NAME_DEXT,
- MY_APPEND_EXT|MY_UNPACK_FILENAME|MY_RESOLVE_SYMLINKS);
+ MY_APPEND_EXT|MY_UNPACK_FILENAME);
+ if (my_is_symlink(data_name))
+ {
+ if (my_realpath(data_name, data_name, MYF(0)))
+ goto err;
+ if (mysys_test_invalid_symlink(data_name))
+ {
+ my_errno= HA_WRONG_CREATE_OPTION;
+ goto err;
+ }
+ share->mode|= O_NOFOLLOW; /* all symlinks are resolved by realpath() */
+ }
info_length=mi_uint2korr(share->state.header.header_length);
base_pos=mi_uint2korr(share->state.header.base_pos);
@@ -493,7 +511,7 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags)
lock_error=1; /* Database unlocked */
}
- if (mi_open_datafile(&info, share, name, -1))
+ if (mi_open_datafile(&info, share))
goto err;
errpos=5;
@@ -574,7 +592,7 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags)
my_errno=EACCES; /* Can't open in write mode */
goto err;
}
- if (mi_open_datafile(&info, share, name, old_info->dfile))
+ if (mi_open_datafile(&info, share))
goto err;
errpos=5;
have_rtree= old_info->rtree_recursion_state != NULL;
@@ -1245,33 +1263,14 @@ uchar *mi_recinfo_read(uchar *ptr, MI_COLUMNDEF *recinfo)
Open data file.
We can't use dup() here as the data file descriptors need to have different
active seek-positions.
-
-The argument file_to_dup is here for the future if there would on some OS
-exist a dup()-like call that would give us two different file descriptors.
*************************************************************************/
-int mi_open_datafile(MI_INFO *info, MYISAM_SHARE *share, const char *org_name,
- File file_to_dup __attribute__((unused)))
+int mi_open_datafile(MI_INFO *info, MYISAM_SHARE *share)
{
- char *data_name= share->data_file_name;
- char real_data_name[FN_REFLEN];
-
- if (org_name)
- {
- fn_format(real_data_name,org_name,"",MI_NAME_DEXT,4);
- if (my_is_symlink(real_data_name))
- {
- if (my_realpath(real_data_name, real_data_name, MYF(0)) ||
- (*myisam_test_invalid_symlink)(real_data_name))
- {
- my_errno= HA_WRONG_CREATE_OPTION;
- return 1;
- }
- data_name= real_data_name;
- }
- }
- info->dfile= mysql_file_open(mi_key_file_dfile,
- data_name, share->mode | O_SHARE, MYF(MY_WME));
+ myf flags= MY_WME | (share->mode & O_NOFOLLOW ? MY_NOSYMLINKS: 0);
+ DEBUG_SYNC_C("mi_open_datafile");
+ info->dfile= mysql_file_open(mi_key_file_dfile, share->data_file_name,
+ share->mode | O_SHARE, MYF(flags));
return info->dfile >= 0 ? 0 : 1;
}
@@ -1280,8 +1279,8 @@ int mi_open_keyfile(MYISAM_SHARE *share)
{
if ((share->kfile= mysql_file_open(mi_key_file_kfile,
share->unique_file_name,
- share->mode | O_SHARE,
- MYF(MY_WME))) < 0)
+ share->mode | O_SHARE | O_NOFOLLOW,
+ MYF(MY_NOSYMLINKS | MY_WME))) < 0)
return 1;
return 0;
}
diff --git a/storage/myisam/mi_static.c b/storage/myisam/mi_static.c
index d77f4f6b8e2..49019fb861c 100644
--- a/storage/myisam/mi_static.c
+++ b/storage/myisam/mi_static.c
@@ -42,14 +42,6 @@ ulong myisam_data_pointer_size=4;
ulonglong myisam_mmap_size= SIZE_T_MAX, myisam_mmap_used= 0;
my_bool (*mi_killed)(MI_INFO *)= mi_killed_standalone;
-static int always_valid(const char *filename __attribute__((unused)))
-{
- return 0;
-}
-
-int (*myisam_test_invalid_symlink)(const char *filename)= always_valid;
-
-
/*
read_vec[] is used for converting between P_READ_KEY.. and SEARCH_
Position is , == , >= , <= , > , <
diff --git a/storage/myisam/myisamchk.c b/storage/myisam/myisamchk.c
index 68c91154505..c31ac8cd0d4 100644
--- a/storage/myisam/myisamchk.c
+++ b/storage/myisam/myisamchk.c
@@ -1048,7 +1048,7 @@ static int myisamchk(HA_CHECK *param, char * filename)
MYF(MY_WME)); /* Close new file */
error|=change_to_newfile(filename, MI_NAME_DEXT, DATA_TMP_EXT,
0, MYF(0));
- if (mi_open_datafile(info,info->s, NULL, -1))
+ if (mi_open_datafile(info, info->s))
error=1;
param->out_flag&= ~O_NEW_DATA; /* We are using new datafile */
param->read_cache.file=info->dfile;
diff --git a/storage/myisam/myisamdef.h b/storage/myisam/myisamdef.h
index 8467daaafc3..ff12cb53dd9 100644
--- a/storage/myisam/myisamdef.h
+++ b/storage/myisam/myisamdef.h
@@ -715,8 +715,7 @@ void mi_disable_indexes_for_rebuild(MI_INFO *info, ha_rows rows,
my_bool all_keys);
extern MI_INFO *test_if_reopen(char *filename);
my_bool check_table_is_closed(const char *name, const char *where);
-int mi_open_datafile(MI_INFO *info, MYISAM_SHARE *share, const char *orn_name,
- File file_to_dup);
+int mi_open_datafile(MI_INFO *info, MYISAM_SHARE *share);
int mi_open_keyfile(MYISAM_SHARE *share);
void mi_setup_functions(register MYISAM_SHARE *share);
diff --git a/storage/oqgraph/graphcore-config.h b/storage/oqgraph/graphcore-config.h
index d5656bddf78..2afb7dfbcd6 100644
--- a/storage/oqgraph/graphcore-config.h
+++ b/storage/oqgraph/graphcore-config.h
@@ -12,7 +12,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
/* ======================================================================
Open Query Graph Computation Engine, based on a concept by Arjen Lentz
diff --git a/storage/oqgraph/graphcore-graph.cc b/storage/oqgraph/graphcore-graph.cc
index 31d62c5f4c2..6decce601fe 100644
--- a/storage/oqgraph/graphcore-graph.cc
+++ b/storage/oqgraph/graphcore-graph.cc
@@ -12,7 +12,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
/* ======================================================================
Open Query Graph Computation Engine, based on a concept by Arjen Lentz
diff --git a/storage/oqgraph/graphcore-graph.h b/storage/oqgraph/graphcore-graph.h
index ffc0772f0aa..4b55068a777 100644
--- a/storage/oqgraph/graphcore-graph.h
+++ b/storage/oqgraph/graphcore-graph.h
@@ -12,7 +12,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
/* ======================================================================
Open Query Graph Computation Engine, based on a concept by Arjen Lentz
diff --git a/storage/oqgraph/graphcore-types.h b/storage/oqgraph/graphcore-types.h
index 2f182341b39..5f333c271bd 100644
--- a/storage/oqgraph/graphcore-types.h
+++ b/storage/oqgraph/graphcore-types.h
@@ -12,7 +12,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
/* ======================================================================
Open Query Graph Computation Engine, based on a concept by Arjen Lentz
diff --git a/storage/oqgraph/graphcore.cc b/storage/oqgraph/graphcore.cc
index 7c8ca53c096..fb2b105f2fd 100644
--- a/storage/oqgraph/graphcore.cc
+++ b/storage/oqgraph/graphcore.cc
@@ -12,7 +12,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
/* ======================================================================
Open Query Graph Computation Engine, based on a concept by Arjen Lentz
diff --git a/storage/oqgraph/graphcore.h b/storage/oqgraph/graphcore.h
index b1560552fcf..7fa3d4554bf 100644
--- a/storage/oqgraph/graphcore.h
+++ b/storage/oqgraph/graphcore.h
@@ -12,7 +12,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
/* ======================================================================
Open Query Graph Computation Engine, based on a concept by Arjen Lentz
diff --git a/storage/oqgraph/ha_oqgraph.cc b/storage/oqgraph/ha_oqgraph.cc
index b55619a6fa5..66a20e9a6a1 100644
--- a/storage/oqgraph/ha_oqgraph.cc
+++ b/storage/oqgraph/ha_oqgraph.cc
@@ -14,7 +14,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
/* ======================================================================
Open Query Graph Computation Engine, based on a concept by Arjen Lentz
diff --git a/storage/oqgraph/ha_oqgraph.h b/storage/oqgraph/ha_oqgraph.h
index 6013df43e6b..07f47bd1239 100644
--- a/storage/oqgraph/ha_oqgraph.h
+++ b/storage/oqgraph/ha_oqgraph.h
@@ -12,7 +12,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
/* ======================================================================
Open Query Graph Computation Engine, based on a concept by Arjen Lentz
diff --git a/storage/oqgraph/mysql-test/oqgraph/generate_backing_table_tests_suite.sh b/storage/oqgraph/mysql-test/oqgraph/generate_backing_table_tests_suite.sh
index 087b2b7089c..22feaab5c3a 100755
--- a/storage/oqgraph/mysql-test/oqgraph/generate_backing_table_tests_suite.sh
+++ b/storage/oqgraph/mysql-test/oqgraph/generate_backing_table_tests_suite.sh
@@ -45,7 +45,8 @@ done
# Intended to be run from build as ../storage/oqgraph/mysql-test/oqgraph/maintainer-general-record.sh
MGFILE=maintainer-general-record.sh
-echo '# This is a maintainer generated file. Generated at '`date`'.' > $MGFILE
+echo '#!/bin/sh' > $MGFILE
+echo '# This is a maintainer generated file. Generated at '`date`'.' >> $MGFILE
for ENGINE in $ENGINES $ENGINES2 ; do
echo mysql-test/mysql-test-run --record oqgraph.general-$ENGINE >> $MGFILE
done
diff --git a/storage/oqgraph/mysql-test/oqgraph/maintainer-general-record.sh b/storage/oqgraph/mysql-test/oqgraph/maintainer-general-record.sh
index bc684015055..7af12013e53 100755
--- a/storage/oqgraph/mysql-test/oqgraph/maintainer-general-record.sh
+++ b/storage/oqgraph/mysql-test/oqgraph/maintainer-general-record.sh
@@ -1,3 +1,4 @@
+#!/bin/sh
# This is a maintainer generated file. Generated at Wednesday 5 February 22:26:12 CST 2014.
mysql-test/mysql-test-run --record oqgraph.general-MyISAM
mysql-test/mysql-test-run --record oqgraph.general-MEMORY
diff --git a/storage/oqgraph/mysql-test/oqgraph/regression_mdev6282.result b/storage/oqgraph/mysql-test/oqgraph/regression_mdev6282.result
index 96b9380fcc5..3ef61cc3e37 100644
--- a/storage/oqgraph/mysql-test/oqgraph/regression_mdev6282.result
+++ b/storage/oqgraph/mysql-test/oqgraph/regression_mdev6282.result
@@ -38,6 +38,6 @@ version nodeID
0.0.3 3
disconnect con2;
connect con3,localhost,root,,test;
-DROP TABLE db_history;
DROP TABLE version_history;
+DROP TABLE db_history;
disconnect con3;
diff --git a/storage/oqgraph/mysql-test/oqgraph/regression_mdev6282.test b/storage/oqgraph/mysql-test/oqgraph/regression_mdev6282.test
index 3a7a0e5af08..b8f0ae556c8 100644
--- a/storage/oqgraph/mysql-test/oqgraph/regression_mdev6282.test
+++ b/storage/oqgraph/mysql-test/oqgraph/regression_mdev6282.test
@@ -40,8 +40,8 @@
--disconnect con2
--connect (con3,localhost,root,,test)
-DROP TABLE db_history;
DROP TABLE version_history;
+DROP TABLE db_history;
--disconnect con3
diff --git a/storage/oqgraph/mysql-test/oqgraph/regression_mdev6345.result b/storage/oqgraph/mysql-test/oqgraph/regression_mdev6345.result
index 8e680e15206..68002ce98a2 100644
--- a/storage/oqgraph/mysql-test/oqgraph/regression_mdev6345.result
+++ b/storage/oqgraph/mysql-test/oqgraph/regression_mdev6345.result
@@ -8,5 +8,5 @@ latch origid destid weight seq linkid
breadth_first 1 6 NULL 0 1
breadth_first 1 6 1 1 2
breadth_first 1 6 1 2 6
-DROP TABLE IF EXISTS oq_backing;
DROP TABLE IF EXISTS oq_graph;
+DROP TABLE IF EXISTS oq_backing;
diff --git a/storage/oqgraph/mysql-test/oqgraph/regression_mdev6345.test b/storage/oqgraph/mysql-test/oqgraph/regression_mdev6345.test
index 72de926da2e..fefd03a7ed9 100644
--- a/storage/oqgraph/mysql-test/oqgraph/regression_mdev6345.test
+++ b/storage/oqgraph/mysql-test/oqgraph/regression_mdev6345.test
@@ -14,6 +14,6 @@ CREATE TABLE oq_graph (latch VARCHAR(32) NULL, origid BIGINT UNSIGNED NULL, dest
SELECT * FROM oq_graph WHERE latch='breadth_first' AND origid=1 AND destid=6;
-DROP TABLE IF EXISTS oq_backing;
DROP TABLE IF EXISTS oq_graph;
+DROP TABLE IF EXISTS oq_backing;
diff --git a/storage/oqgraph/oqgraph_judy.cc b/storage/oqgraph/oqgraph_judy.cc
index 44c7e28e268..60b7a4a1fbc 100644
--- a/storage/oqgraph/oqgraph_judy.cc
+++ b/storage/oqgraph/oqgraph_judy.cc
@@ -12,7 +12,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
/* ======================================================================
Open Query Graph Computation Engine, based on a concept by Arjen Lentz
diff --git a/storage/oqgraph/oqgraph_judy.h b/storage/oqgraph/oqgraph_judy.h
index 1d9d3953dcb..091b299afd9 100644
--- a/storage/oqgraph/oqgraph_judy.h
+++ b/storage/oqgraph/oqgraph_judy.h
@@ -12,7 +12,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
/* ======================================================================
Open Query Graph Computation Engine, based on a concept by Arjen Lentz
diff --git a/storage/oqgraph/oqgraph_probes.d b/storage/oqgraph/oqgraph_probes.d
index bfdee29ba6e..e1a29171b11 100644
--- a/storage/oqgraph/oqgraph_probes.d
+++ b/storage/oqgraph/oqgraph_probes.d
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
provider oqgraph {
probe open();
diff --git a/storage/oqgraph/oqgraph_shim.cc b/storage/oqgraph/oqgraph_shim.cc
index 31590100c33..d2492255291 100644
--- a/storage/oqgraph/oqgraph_shim.cc
+++ b/storage/oqgraph/oqgraph_shim.cc
@@ -12,7 +12,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
/* ======================================================================
Open Query Graph Computation Engine, based on a concept by Arjen Lentz
diff --git a/storage/oqgraph/oqgraph_shim.h b/storage/oqgraph/oqgraph_shim.h
index 004d7f0f7c5..c0a9dbb2b40 100644
--- a/storage/oqgraph/oqgraph_shim.h
+++ b/storage/oqgraph/oqgraph_shim.h
@@ -12,7 +12,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
/* ======================================================================
Open Query Graph Computation Engine, based on a concept by Arjen Lentz
diff --git a/storage/oqgraph/oqgraph_thunk.cc b/storage/oqgraph/oqgraph_thunk.cc
index 19a709a1c59..2ebd0171f9c 100644
--- a/storage/oqgraph/oqgraph_thunk.cc
+++ b/storage/oqgraph/oqgraph_thunk.cc
@@ -12,7 +12,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
/* ======================================================================
Open Query Graph Computation Engine, based on a concept by Arjen Lentz
diff --git a/storage/oqgraph/oqgraph_thunk.h b/storage/oqgraph/oqgraph_thunk.h
index 7930e2d6c69..fe47c3bc7eb 100644
--- a/storage/oqgraph/oqgraph_thunk.h
+++ b/storage/oqgraph/oqgraph_thunk.h
@@ -12,7 +12,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
/* ======================================================================
Open Query Graph Computation Engine, based on a concept by Arjen Lentz
diff --git a/storage/spider/ha_spider.cc b/storage/spider/ha_spider.cc
index adb4c5c9bcb..6ded5992c79 100644
--- a/storage/spider/ha_spider.cc
+++ b/storage/spider/ha_spider.cc
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation
diff --git a/storage/spider/ha_spider.h b/storage/spider/ha_spider.h
index e528b0e8a91..50d890dc854 100644
--- a/storage/spider/ha_spider.h
+++ b/storage/spider/ha_spider.h
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#ifdef USE_PRAGMA_INTERFACE
#pragma interface
diff --git a/storage/spider/hs_client/hs_compat.h b/storage/spider/hs_client/hs_compat.h
index 920b4efa508..a26dd18e481 100644
--- a/storage/spider/hs_client/hs_compat.h
+++ b/storage/spider/hs_client/hs_compat.h
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#ifndef HS_COMPAT_H
#define HS_COMPAT_H
diff --git a/storage/spider/spd_conn.cc b/storage/spider/spd_conn.cc
index 5e00ae19ae8..5c96fe321bd 100644
--- a/storage/spider/spd_conn.cc
+++ b/storage/spider/spd_conn.cc
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#define MYSQL_SERVER 1
#include "mysql_version.h"
diff --git a/storage/spider/spd_conn.h b/storage/spider/spd_conn.h
index 610a0359378..cdcb6543a35 100644
--- a/storage/spider/spd_conn.h
+++ b/storage/spider/spd_conn.h
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#define SPIDER_LOCK_MODE_NO_LOCK 0
#define SPIDER_LOCK_MODE_SHARED 1
diff --git a/storage/spider/spd_copy_tables.cc b/storage/spider/spd_copy_tables.cc
index 7e7845635af..d29ea635d97 100644
--- a/storage/spider/spd_copy_tables.cc
+++ b/storage/spider/spd_copy_tables.cc
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#define MYSQL_SERVER 1
#include "mysql_version.h"
diff --git a/storage/spider/spd_copy_tables.h b/storage/spider/spd_copy_tables.h
index bda7a051bc6..bac9b5d202c 100644
--- a/storage/spider/spd_copy_tables.h
+++ b/storage/spider/spd_copy_tables.h
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
int spider_udf_set_copy_tables_param_default(
SPIDER_COPY_TABLES *copy_tables
diff --git a/storage/spider/spd_db_conn.cc b/storage/spider/spd_db_conn.cc
index 1da25e17b50..5b2071b5f1e 100644
--- a/storage/spider/spd_db_conn.cc
+++ b/storage/spider/spd_db_conn.cc
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#define MYSQL_SERVER 1
#include "mysql_version.h"
diff --git a/storage/spider/spd_db_conn.h b/storage/spider/spd_db_conn.h
index 8626d6a47ec..6d149f6d4a0 100644
--- a/storage/spider/spd_db_conn.h
+++ b/storage/spider/spd_db_conn.h
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#define SPIDER_DB_WRAPPER_STR "mysql"
#define SPIDER_DB_WRAPPER_LEN (sizeof(SPIDER_DB_WRAPPER_STR) - 1)
diff --git a/storage/spider/spd_db_handlersocket.cc b/storage/spider/spd_db_handlersocket.cc
index 2ae84499aff..47f22b04116 100644
--- a/storage/spider/spd_db_handlersocket.cc
+++ b/storage/spider/spd_db_handlersocket.cc
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#define MYSQL_SERVER 1
#include "mysql_version.h"
diff --git a/storage/spider/spd_db_handlersocket.h b/storage/spider/spd_db_handlersocket.h
index 1cc1476c83a..d3fdf5564b7 100644
--- a/storage/spider/spd_db_handlersocket.h
+++ b/storage/spider/spd_db_handlersocket.h
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#define SPIDER_HS_CONN dena::hstcpcli_ptr
#define SPIDER_HS_CONN_CREATE dena::hstcpcli_i::create
diff --git a/storage/spider/spd_db_include.h b/storage/spider/spd_db_include.h
index 929b9778556..936951d3860 100644
--- a/storage/spider/spd_db_include.h
+++ b/storage/spider/spd_db_include.h
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#include "hs_compat.h"
#if defined(HS_HAS_SQLCOM) && defined(HAVE_HANDLERSOCKET)
diff --git a/storage/spider/spd_db_mysql.cc b/storage/spider/spd_db_mysql.cc
index a41a943cd04..1c1c440c2ed 100644
--- a/storage/spider/spd_db_mysql.cc
+++ b/storage/spider/spd_db_mysql.cc
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#define MYSQL_SERVER 1
#include "mysql_version.h"
diff --git a/storage/spider/spd_db_mysql.h b/storage/spider/spd_db_mysql.h
index 48942d701dc..9a4f08ade98 100644
--- a/storage/spider/spd_db_mysql.h
+++ b/storage/spider/spd_db_mysql.h
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
class spider_db_mysql_util: public spider_db_util
{
diff --git a/storage/spider/spd_db_oracle.cc b/storage/spider/spd_db_oracle.cc
index c8237f24f0f..c3dfe8b8cf2 100644
--- a/storage/spider/spd_db_oracle.cc
+++ b/storage/spider/spd_db_oracle.cc
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#define MYSQL_SERVER 1
#include "mysql_version.h"
diff --git a/storage/spider/spd_db_oracle.h b/storage/spider/spd_db_oracle.h
index 05bea4d33ab..0e84435d9be 100644
--- a/storage/spider/spd_db_oracle.h
+++ b/storage/spider/spd_db_oracle.h
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
class spider_db_oracle;
class spider_db_oracle_result;
diff --git a/storage/spider/spd_direct_sql.cc b/storage/spider/spd_direct_sql.cc
index ad7bd54c69f..dc1786796e6 100644
--- a/storage/spider/spd_direct_sql.cc
+++ b/storage/spider/spd_direct_sql.cc
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#define MYSQL_SERVER 1
#include "mysql_version.h"
diff --git a/storage/spider/spd_direct_sql.h b/storage/spider/spd_direct_sql.h
index 26e3043dd94..12d81346f0d 100644
--- a/storage/spider/spd_direct_sql.h
+++ b/storage/spider/spd_direct_sql.h
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
uint spider_udf_calc_hash(
char *key,
diff --git a/storage/spider/spd_err.h b/storage/spider/spd_err.h
index 35f90ad8a94..ed26359f98b 100644
--- a/storage/spider/spd_err.h
+++ b/storage/spider/spd_err.h
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#define ER_SPIDER_INVALID_CONNECT_INFO_NUM 12501
#define ER_SPIDER_INVALID_CONNECT_INFO_STR "The connect info '%-.64s' is invalid"
diff --git a/storage/spider/spd_i_s.cc b/storage/spider/spd_i_s.cc
index 49824693984..a525928344f 100644
--- a/storage/spider/spd_i_s.cc
+++ b/storage/spider/spd_i_s.cc
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#define MYSQL_SERVER 1
#include "mysql_version.h"
diff --git a/storage/spider/spd_include.h b/storage/spider/spd_include.h
index 5c922d3a7ad..37d9db3ba57 100644
--- a/storage/spider/spd_include.h
+++ b/storage/spider/spd_include.h
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#define SPIDER_DETAIL_VERSION "3.2.37"
#define SPIDER_HEX_VERSION 0x0302
diff --git a/storage/spider/spd_malloc.cc b/storage/spider/spd_malloc.cc
index ec71f9631bc..8d348682edf 100644
--- a/storage/spider/spd_malloc.cc
+++ b/storage/spider/spd_malloc.cc
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#define MYSQL_SERVER 1
#include "mysql_version.h"
diff --git a/storage/spider/spd_malloc.h b/storage/spider/spd_malloc.h
index 42e6abd407c..3c5c6e67c2a 100644
--- a/storage/spider/spd_malloc.h
+++ b/storage/spider/spd_malloc.h
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#define spider_free(A,B,C) spider_free_mem(A,B,C)
#define spider_malloc(A,B,C,D) \
diff --git a/storage/spider/spd_param.cc b/storage/spider/spd_param.cc
index 84d39b17897..39d5ba87c0b 100644
--- a/storage/spider/spd_param.cc
+++ b/storage/spider/spd_param.cc
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#define MYSQL_SERVER 1
#include "mysql_version.h"
diff --git a/storage/spider/spd_param.h b/storage/spider/spd_param.h
index c8eb5d0d417..d62917adb37 100644
--- a/storage/spider/spd_param.h
+++ b/storage/spider/spd_param.h
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program); if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
my_bool spider_param_support_xa();
my_bool spider_param_connect_mutex();
diff --git a/storage/spider/spd_ping_table.cc b/storage/spider/spd_ping_table.cc
index f59f7760359..77a2969d061 100644
--- a/storage/spider/spd_ping_table.cc
+++ b/storage/spider/spd_ping_table.cc
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#define MYSQL_SERVER 1
#include "mysql_version.h"
diff --git a/storage/spider/spd_ping_table.h b/storage/spider/spd_ping_table.h
index 836a050c185..8d12010e524 100644
--- a/storage/spider/spd_ping_table.h
+++ b/storage/spider/spd_ping_table.h
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
SPIDER_TABLE_MON_LIST *spider_get_ping_table_mon_list(
SPIDER_TRX *trx,
diff --git a/storage/spider/spd_sys_table.cc b/storage/spider/spd_sys_table.cc
index 86ab5fdccf4..e1e81394ce8 100644
--- a/storage/spider/spd_sys_table.cc
+++ b/storage/spider/spd_sys_table.cc
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#define MYSQL_SERVER 1
#include "mysql_version.h"
diff --git a/storage/spider/spd_sys_table.h b/storage/spider/spd_sys_table.h
index 8024c23c168..fc9d3fc38bd 100644
--- a/storage/spider/spd_sys_table.h
+++ b/storage/spider/spd_sys_table.h
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#define SPIDER_SYS_XA_TABLE_NAME_STR "spider_xa"
#define SPIDER_SYS_XA_TABLE_NAME_LEN (sizeof(SPIDER_SYS_XA_TABLE_NAME_STR) - 1)
diff --git a/storage/spider/spd_table.cc b/storage/spider/spd_table.cc
index fe682ce0be4..7724eb067e9 100644
--- a/storage/spider/spd_table.cc
+++ b/storage/spider/spd_table.cc
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#define MYSQL_SERVER 1
#include "mysql_version.h"
diff --git a/storage/spider/spd_table.h b/storage/spider/spd_table.h
index c2f17417dc6..6140f5bbdc7 100644
--- a/storage/spider/spd_table.h
+++ b/storage/spider/spd_table.h
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
uchar *spider_tbl_get_key(
SPIDER_SHARE *share,
diff --git a/storage/spider/spd_trx.cc b/storage/spider/spd_trx.cc
index 007e1fcba5d..8ba46774cfb 100644
--- a/storage/spider/spd_trx.cc
+++ b/storage/spider/spd_trx.cc
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#define MYSQL_SERVER 1
#include "mysql_version.h"
diff --git a/storage/spider/spd_trx.h b/storage/spider/spd_trx.h
index 3f3ca7fabed..b4abecf457f 100644
--- a/storage/spider/spd_trx.h
+++ b/storage/spider/spd_trx.h
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
int spider_free_trx_conn(
SPIDER_TRX *trx,
diff --git a/storage/spider/spd_udf.cc b/storage/spider/spd_udf.cc
index 1c457e69421..8381121aaab 100644
--- a/storage/spider/spd_udf.cc
+++ b/storage/spider/spd_udf.cc
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#define MYSQL_SERVER 1
#include <my_global.h>
diff --git a/storage/spider/spd_udf.h b/storage/spider/spd_udf.h
index 0b20a10393e..30a2d6699d1 100644
--- a/storage/spider/spd_udf.h
+++ b/storage/spider/spd_udf.h
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
long long spider_direct_sql_body(
UDF_INIT *initid,
diff --git a/storage/tokudb/CMakeLists.txt b/storage/tokudb/CMakeLists.txt
index fd9a4790a7e..ac8e5a11e2a 100644
--- a/storage/tokudb/CMakeLists.txt
+++ b/storage/tokudb/CMakeLists.txt
@@ -1,4 +1,4 @@
-SET(TOKUDB_VERSION 5.6.34-79.1)
+SET(TOKUDB_VERSION 5.6.35-80.0)
# PerconaFT only supports x86-64 and cmake-2.8.9+
IF(CMAKE_VERSION VERSION_LESS "2.8.9")
MESSAGE(STATUS "CMake 2.8.9 or higher is required by TokuDB")
diff --git a/storage/tokudb/PerconaFT/cmake_modules/TokuSetupCompiler.cmake b/storage/tokudb/PerconaFT/cmake_modules/TokuSetupCompiler.cmake
index f7e7f76e96e..0cd9a9c5941 100644
--- a/storage/tokudb/PerconaFT/cmake_modules/TokuSetupCompiler.cmake
+++ b/storage/tokudb/PerconaFT/cmake_modules/TokuSetupCompiler.cmake
@@ -161,9 +161,9 @@ if (NOT CMAKE_CXX_COMPILER_ID STREQUAL Clang)
set_cflags_if_supported(-Wcast-align)
endif ()
-## always want these
-set(CMAKE_C_FLAGS "-Wall -Werror ${CMAKE_C_FLAGS}")
-set(CMAKE_CXX_FLAGS "-Wall -Werror ${CMAKE_CXX_FLAGS}")
+## always want these in debug builds
+set(CMAKE_C_FLAGS_DEBUG "-Wall -Werror ${CMAKE_C_FLAGS_DEBUG}")
+set(CMAKE_CXX_FLAGS_DEBUG "-Wall -Werror ${CMAKE_CXX_FLAGS_DEBUG}")
# pick language dialect
set(CMAKE_C_FLAGS "-std=c99 ${CMAKE_C_FLAGS}")
diff --git a/storage/tokudb/PerconaFT/ft/ft-ops.cc b/storage/tokudb/PerconaFT/ft/ft-ops.cc
index 238290df949..eba9aa33e9f 100644
--- a/storage/tokudb/PerconaFT/ft/ft-ops.cc
+++ b/storage/tokudb/PerconaFT/ft/ft-ops.cc
@@ -652,10 +652,8 @@ void toku_ftnode_clone_callback(void *value_data,
// set new pair attr if necessary
if (node->height == 0) {
*new_attr = make_ftnode_pair_attr(node);
- for (int i = 0; i < node->n_children; i++) {
- BLB(node, i)->logical_rows_delta = 0;
- BLB(cloned_node, i)->logical_rows_delta = 0;
- }
+ node->logical_rows_delta = 0;
+ cloned_node->logical_rows_delta = 0;
} else {
new_attr->is_valid = false;
}
@@ -703,6 +701,10 @@ void toku_ftnode_flush_callback(CACHEFILE UU(cachefile),
if (ftnode->height == 0) {
FT_STATUS_INC(FT_FULL_EVICTIONS_LEAF, 1);
FT_STATUS_INC(FT_FULL_EVICTIONS_LEAF_BYTES, node_size);
+ if (!ftnode->dirty) {
+ toku_ft_adjust_logical_row_count(
+ ft, -ftnode->logical_rows_delta);
+ }
} else {
FT_STATUS_INC(FT_FULL_EVICTIONS_NONLEAF, 1);
FT_STATUS_INC(FT_FULL_EVICTIONS_NONLEAF_BYTES, node_size);
@@ -715,11 +717,12 @@ void toku_ftnode_flush_callback(CACHEFILE UU(cachefile),
BASEMENTNODE bn = BLB(ftnode, i);
toku_ft_decrease_stats(&ft->in_memory_stats,
bn->stat64_delta);
- if (!ftnode->dirty)
- toku_ft_adjust_logical_row_count(
- ft, -bn->logical_rows_delta);
}
}
+ if (!ftnode->dirty) {
+ toku_ft_adjust_logical_row_count(
+ ft, -ftnode->logical_rows_delta);
+ }
}
}
toku_ftnode_free(&ftnode);
@@ -945,8 +948,6 @@ int toku_ftnode_pe_callback(void *ftnode_pv,
basements_to_destroy[num_basements_to_destroy++] = bn;
toku_ft_decrease_stats(&ft->in_memory_stats,
bn->stat64_delta);
- toku_ft_adjust_logical_row_count(ft,
- -bn->logical_rows_delta);
set_BNULL(node, i);
BP_STATE(node, i) = PT_ON_DISK;
num_partial_evictions++;
@@ -2653,7 +2654,7 @@ static std::unique_ptr<char[], decltype(&toku_free)> toku_file_get_parent_dir(
return result;
}
-static bool toku_create_subdirs_if_needed(const char *path) {
+bool toku_create_subdirs_if_needed(const char *path) {
static const mode_t dir_mode = S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP |
S_IWGRP | S_IXGRP | S_IROTH | S_IXOTH;
@@ -4564,6 +4565,8 @@ int toku_ft_rename_iname(DB_TXN *txn,
bs_new_name);
}
+ if (!toku_create_subdirs_if_needed(new_iname_full.get()))
+ return get_error_errno();
r = toku_os_rename(old_iname_full.get(), new_iname_full.get());
if (r != 0)
return r;
diff --git a/storage/tokudb/PerconaFT/ft/ft-ops.h b/storage/tokudb/PerconaFT/ft/ft-ops.h
index 70cf045d43c..df8ffe287df 100644
--- a/storage/tokudb/PerconaFT/ft/ft-ops.h
+++ b/storage/tokudb/PerconaFT/ft/ft-ops.h
@@ -288,3 +288,8 @@ void toku_ft_set_direct_io(bool direct_io_on);
void toku_ft_set_compress_buffers_before_eviction(bool compress_buffers);
void toku_note_deserialized_basement_node(bool fixed_key_size);
+
+// Creates all directories for the path if necessary,
+// returns true if all dirs are created successfully or
+// all dirs exist, false otherwise.
+bool toku_create_subdirs_if_needed(const char* path);
diff --git a/storage/tokudb/PerconaFT/ft/logger/recover.cc b/storage/tokudb/PerconaFT/ft/logger/recover.cc
index a9c30c0e37a..9eaa56bdc53 100644
--- a/storage/tokudb/PerconaFT/ft/logger/recover.cc
+++ b/storage/tokudb/PerconaFT/ft/logger/recover.cc
@@ -987,7 +987,8 @@ static int toku_recover_frename(struct logtype_frename *l, RECOVER_ENV renv) {
return 1;
if (old_exist && !new_exist &&
- (toku_os_rename(old_iname_full.get(), new_iname_full.get()) == -1 ||
+ (!toku_create_subdirs_if_needed(new_iname_full.get()) ||
+ toku_os_rename(old_iname_full.get(), new_iname_full.get()) == -1 ||
toku_fsync_directory(old_iname_full.get()) == -1 ||
toku_fsync_directory(new_iname_full.get()) == -1))
return 1;
diff --git a/storage/tokudb/PerconaFT/ft/node.cc b/storage/tokudb/PerconaFT/ft/node.cc
index 7ddf0f3a1b0..aad0c1ca078 100644
--- a/storage/tokudb/PerconaFT/ft/node.cc
+++ b/storage/tokudb/PerconaFT/ft/node.cc
@@ -387,7 +387,8 @@ static void bnc_apply_messages_to_basement_node(
const pivot_bounds &
bounds, // contains pivot key bounds of this basement node
txn_gc_info *gc_info,
- bool *msgs_applied) {
+ bool *msgs_applied,
+ int64_t* logical_rows_delta) {
int r;
NONLEAF_CHILDINFO bnc = BNC(ancestor, childnum);
@@ -395,7 +396,6 @@ static void bnc_apply_messages_to_basement_node(
// apply messages from this buffer
STAT64INFO_S stats_delta = {0, 0};
uint64_t workdone_this_ancestor = 0;
- int64_t logical_rows_delta = 0;
uint32_t stale_lbi, stale_ube;
if (!bn->stale_ancestor_messages_applied) {
@@ -471,7 +471,7 @@ static void bnc_apply_messages_to_basement_node(
gc_info,
&workdone_this_ancestor,
&stats_delta,
- &logical_rows_delta);
+ logical_rows_delta);
}
} else if (stale_lbi == stale_ube) {
// No stale messages to apply, we just apply fresh messages, and mark
@@ -483,7 +483,7 @@ static void bnc_apply_messages_to_basement_node(
.gc_info = gc_info,
.workdone = &workdone_this_ancestor,
.stats_to_update = &stats_delta,
- .logical_rows_delta = &logical_rows_delta};
+ .logical_rows_delta = logical_rows_delta};
if (fresh_ube - fresh_lbi > 0)
*msgs_applied = true;
r = bnc->fresh_message_tree
@@ -504,7 +504,7 @@ static void bnc_apply_messages_to_basement_node(
.gc_info = gc_info,
.workdone = &workdone_this_ancestor,
.stats_to_update = &stats_delta,
- .logical_rows_delta = &logical_rows_delta};
+ .logical_rows_delta = logical_rows_delta};
r = bnc->stale_message_tree
.iterate_on_range<struct iterate_do_bn_apply_msg_extra,
@@ -522,8 +522,6 @@ static void bnc_apply_messages_to_basement_node(
if (stats_delta.numbytes || stats_delta.numrows) {
toku_ft_update_stats(&t->ft->in_memory_stats, stats_delta);
}
- toku_ft_adjust_logical_row_count(t->ft, logical_rows_delta);
- bn->logical_rows_delta += logical_rows_delta;
}
static void
@@ -537,6 +535,7 @@ apply_ancestors_messages_to_bn(
bool* msgs_applied
)
{
+ int64_t logical_rows_delta = 0;
BASEMENTNODE curr_bn = BLB(node, childnum);
const pivot_bounds curr_bounds = bounds.next_bounds(node, childnum);
for (ANCESTORS curr_ancestors = ancestors; curr_ancestors; curr_ancestors = curr_ancestors->next) {
@@ -549,13 +548,16 @@ apply_ancestors_messages_to_bn(
curr_ancestors->childnum,
curr_bounds,
gc_info,
- msgs_applied
+ msgs_applied,
+ &logical_rows_delta
);
// We don't want to check this ancestor node again if the
// next time we query it, the msn hasn't changed.
curr_bn->max_msn_applied = curr_ancestors->node->max_msn_applied_to_node_on_disk;
}
}
+ toku_ft_adjust_logical_row_count(t->ft, logical_rows_delta);
+ node->logical_rows_delta += logical_rows_delta;
// At this point, we know all the stale messages above this
// basement node have been applied, and any new messages will be
// fresh, so we don't need to look at stale messages for this
diff --git a/storage/tokudb/PerconaFT/ft/node.h b/storage/tokudb/PerconaFT/ft/node.h
index 52eefec0936..db189e36d59 100644
--- a/storage/tokudb/PerconaFT/ft/node.h
+++ b/storage/tokudb/PerconaFT/ft/node.h
@@ -157,36 +157,49 @@ private:
// TODO: class me up
struct ftnode {
- MSN max_msn_applied_to_node_on_disk; // max_msn_applied that will be written to disk
+ // max_msn_applied that will be written to disk
+ MSN max_msn_applied_to_node_on_disk;
unsigned int flags;
- BLOCKNUM blocknum; // Which block number is this node?
- int layout_version; // What version of the data structure?
- int layout_version_original; // different (<) from layout_version if upgraded from a previous version (useful for debugging)
- int layout_version_read_from_disk; // transient, not serialized to disk, (useful for debugging)
- uint32_t build_id; // build_id (svn rev number) of software that wrote this node to disk
- int height; /* height is always >= 0. 0 for leaf, >0 for nonleaf. */
- int dirty;
+ // Which block number is this node?
+ BLOCKNUM blocknum;
+ // What version of the data structure?
+ int layout_version;
+ // different (<) from layout_version if upgraded from a previous version
+ // (useful for debugging)
+ int layout_version_original;
+ // transient, not serialized to disk, (useful for debugging)
+ int layout_version_read_from_disk;
+ // build_id (svn rev number) of software that wrote this node to disk
+ uint32_t build_id;
+ // height is always >= 0. 0 for leaf, >0 for nonleaf.
+ int height;
+ int dirty;
uint32_t fullhash;
+ // current count of rows add or removed as a result of message application
+ // to this node as a basement, irrelevant for internal nodes, gets reset
+ // when node is undirtied. Used to back out tree scoped LRC id node is
+ // evicted but not persisted
+ int64_t logical_rows_delta;
- // for internal nodes, if n_children==fanout+1 then the tree needs to be rebalanced.
- // for leaf nodes, represents number of basement nodes
+ // for internal nodes, if n_children==fanout+1 then the tree needs to be
+ // rebalanced. for leaf nodes, represents number of basement nodes
int n_children;
ftnode_pivot_keys pivotkeys;
- // What's the oldest referenced xid that this node knows about? The real oldest
- // referenced xid might be younger, but this is our best estimate. We use it
- // as a heuristic to transition provisional mvcc entries from provisional to
- // committed (from implicity committed to really committed).
+ // What's the oldest referenced xid that this node knows about? The real
+ // oldest referenced xid might be younger, but this is our best estimate.
+ // We use it as a heuristic to transition provisional mvcc entries from
+ // provisional to committed (from implicity committed to really committed).
//
- // A better heuristic would be the oldest live txnid, but we use this since it
- // still works well most of the time, and its readily available on the inject
- // code path.
+ // A better heuristic would be the oldest live txnid, but we use this since
+ // it still works well most of the time, and its readily available on the
+ // inject code path.
TXNID oldest_referenced_xid_known;
// array of size n_children, consisting of ftnode partitions
- // each one is associated with a child
- // for internal nodes, the ith partition corresponds to the ith message buffer
- // for leaf nodes, the ith partition corresponds to the ith basement node
+ // each one is associated with a child for internal nodes, the ith
+ // partition corresponds to the ith message buffer for leaf nodes, the ith
+ // partition corresponds to the ith basement node
struct ftnode_partition *bp;
struct ctpair *ct_pair;
};
@@ -199,7 +212,6 @@ struct ftnode_leaf_basement_node {
MSN max_msn_applied; // max message sequence number applied
bool stale_ancestor_messages_applied;
STAT64INFO_S stat64_delta; // change in stat64 counters since basement was last written to disk
- int64_t logical_rows_delta;
};
typedef struct ftnode_leaf_basement_node *BASEMENTNODE;
diff --git a/storage/tokudb/PerconaFT/ft/serialize/ft_node-serialize.cc b/storage/tokudb/PerconaFT/ft/serialize/ft_node-serialize.cc
index 5914f8a1050..56876b474d4 100644
--- a/storage/tokudb/PerconaFT/ft/serialize/ft_node-serialize.cc
+++ b/storage/tokudb/PerconaFT/ft/serialize/ft_node-serialize.cc
@@ -996,7 +996,6 @@ BASEMENTNODE toku_clone_bn(BASEMENTNODE orig_bn) {
bn->seqinsert = orig_bn->seqinsert;
bn->stale_ancestor_messages_applied = orig_bn->stale_ancestor_messages_applied;
bn->stat64_delta = orig_bn->stat64_delta;
- bn->logical_rows_delta = orig_bn->logical_rows_delta;
bn->data_buffer.clone(&orig_bn->data_buffer);
return bn;
}
@@ -1007,7 +1006,6 @@ BASEMENTNODE toku_create_empty_bn_no_buffer(void) {
bn->seqinsert = 0;
bn->stale_ancestor_messages_applied = false;
bn->stat64_delta = ZEROSTATS;
- bn->logical_rows_delta = 0;
bn->data_buffer.init_zero();
return bn;
}
@@ -1432,6 +1430,7 @@ static FTNODE alloc_ftnode_for_deserialize(uint32_t fullhash, BLOCKNUM blocknum)
node->fullhash = fullhash;
node->blocknum = blocknum;
node->dirty = 0;
+ node->logical_rows_delta = 0;
node->bp = nullptr;
node->oldest_referenced_xid_known = TXNID_NONE;
return node;
diff --git a/storage/tokudb/PerconaFT/ft/txn/roll.cc b/storage/tokudb/PerconaFT/ft/txn/roll.cc
index 9f3977743a0..4f374d62173 100644
--- a/storage/tokudb/PerconaFT/ft/txn/roll.cc
+++ b/storage/tokudb/PerconaFT/ft/txn/roll.cc
@@ -227,7 +227,8 @@ int toku_rollback_frename(BYTESTRING old_iname,
return 1;
if (!old_exist && new_exist &&
- (toku_os_rename(new_iname_full.get(), old_iname_full.get()) == -1 ||
+ (!toku_create_subdirs_if_needed(old_iname_full.get()) ||
+ toku_os_rename(new_iname_full.get(), old_iname_full.get()) == -1 ||
toku_fsync_directory(new_iname_full.get()) == -1 ||
toku_fsync_directory(old_iname_full.get()) == -1))
return 1;
diff --git a/storage/tokudb/PerconaFT/third_party/snappy-1.1.2/aclocal.m4 b/storage/tokudb/PerconaFT/third_party/snappy-1.1.2/aclocal.m4
index b4c1d52e8d1..470ed7edd42 100644
--- a/storage/tokudb/PerconaFT/third_party/snappy-1.1.2/aclocal.m4
+++ b/storage/tokudb/PerconaFT/third_party/snappy-1.1.2/aclocal.m4
@@ -8643,7 +8643,7 @@ m4_ifndef([_LT_PROG_CXX], [AC_DEFUN([_LT_PROG_CXX])])
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301, USA.
#
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
diff --git a/storage/tokudb/PerconaFT/util/dmt.h b/storage/tokudb/PerconaFT/util/dmt.h
index 71cde8814ab..99be296d0e9 100644
--- a/storage/tokudb/PerconaFT/util/dmt.h
+++ b/storage/tokudb/PerconaFT/util/dmt.h
@@ -589,7 +589,6 @@ private:
void convert_from_tree_to_array(void);
- __attribute__((nonnull(2,5)))
void delete_internal(subtree *const subtreep, const uint32_t idx, subtree *const subtree_replace, subtree **const rebalance_subtree);
template<typename iterate_extra_t,
@@ -627,16 +626,12 @@ private:
__attribute__((nonnull))
void rebalance(subtree *const subtree);
- __attribute__((nonnull(3)))
static void copyout(uint32_t *const outlen, dmtdata_t *const out, const dmt_node *const n);
- __attribute__((nonnull(3)))
static void copyout(uint32_t *const outlen, dmtdata_t **const out, dmt_node *const n);
- __attribute__((nonnull(4)))
static void copyout(uint32_t *const outlen, dmtdata_t *const out, const uint32_t len, const dmtdata_t *const stored_value_ptr);
- __attribute__((nonnull(4)))
static void copyout(uint32_t *const outlen, dmtdata_t **const out, const uint32_t len, dmtdata_t *const stored_value_ptr);
template<typename dmtcmp_t,
diff --git a/storage/tokudb/PerconaFT/util/omt.h b/storage/tokudb/PerconaFT/util/omt.h
index 799ed0eae7c..c7ed2ca546f 100644
--- a/storage/tokudb/PerconaFT/util/omt.h
+++ b/storage/tokudb/PerconaFT/util/omt.h
@@ -284,7 +284,6 @@ public:
* By taking ownership of the array, we save a malloc and memcpy,
* and possibly a free (if the caller is done with the array).
*/
- __attribute__((nonnull))
void create_steal_sorted_array(omtdata_t **const values, const uint32_t numvalues, const uint32_t new_capacity);
/**
@@ -667,7 +666,6 @@ private:
void set_at_internal(const subtree &subtree, const omtdata_t &value, const uint32_t idx);
- __attribute__((nonnull(2,5)))
void delete_internal(subtree *const subtreep, const uint32_t idx, omt_node *const copyn, subtree **const rebalance_subtree);
template<typename iterate_extra_t,
diff --git a/storage/tokudb/ha_tokudb.cc b/storage/tokudb/ha_tokudb.cc
index 827c22ccd7d..227c8ae6b15 100644
--- a/storage/tokudb/ha_tokudb.cc
+++ b/storage/tokudb/ha_tokudb.cc
@@ -29,6 +29,7 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved.
#include "tokudb_status.h"
#include "tokudb_card.h"
#include "ha_tokudb.h"
+#include "sql_db.h"
#if TOKU_INCLUDE_EXTENDED_KEYS
@@ -6108,8 +6109,6 @@ int ha_tokudb::info(uint flag) {
stats.deleted = 0;
if (!(flag & HA_STATUS_NO_LOCK)) {
uint64_t num_rows = 0;
- TOKU_DB_FRAGMENTATION_S frag_info;
- memset(&frag_info, 0, sizeof frag_info);
error = txn_begin(db_env, NULL, &txn, DB_READ_UNCOMMITTED, ha_thd());
if (error) {
@@ -6126,11 +6125,6 @@ int ha_tokudb::info(uint flag) {
} else {
goto cleanup;
}
- error = share->file->get_fragmentation(share->file, &frag_info);
- if (error) {
- goto cleanup;
- }
- stats.delete_length = frag_info.unused_bytes;
DB_BTREE_STAT64 dict_stats;
error = share->file->stat64(share->file, txn, &dict_stats);
@@ -6142,6 +6136,7 @@ int ha_tokudb::info(uint flag) {
stats.update_time = dict_stats.bt_modify_time_sec;
stats.check_time = dict_stats.bt_verify_time_sec;
stats.data_file_length = dict_stats.bt_dsize;
+ stats.delete_length = dict_stats.bt_fsize - dict_stats.bt_dsize;
if (hidden_primary_key) {
//
// in this case, we have a hidden primary key, do not
@@ -6177,30 +6172,21 @@ int ha_tokudb::info(uint flag) {
//
// this solution is much simpler than trying to maintain an
// accurate number of valid keys at the handlerton layer.
- uint curr_num_DBs = table->s->keys + tokudb_test(hidden_primary_key);
+ uint curr_num_DBs =
+ table->s->keys + tokudb_test(hidden_primary_key);
for (uint i = 0; i < curr_num_DBs; i++) {
// skip the primary key, skip dropped indexes
if (i == primary_key || share->key_file[i] == NULL) {
continue;
}
- error =
- share->key_file[i]->stat64(
- share->key_file[i],
- txn,
- &dict_stats);
+ error = share->key_file[i]->stat64(
+ share->key_file[i], txn, &dict_stats);
if (error) {
goto cleanup;
}
stats.index_file_length += dict_stats.bt_dsize;
-
- error =
- share->file->get_fragmentation(
- share->file,
- &frag_info);
- if (error) {
- goto cleanup;
- }
- stats.delete_length += frag_info.unused_bytes;
+ stats.delete_length +=
+ dict_stats.bt_fsize - dict_stats.bt_dsize;
}
}
@@ -7637,6 +7623,27 @@ int ha_tokudb::delete_table(const char *name) {
TOKUDB_HANDLER_DBUG_RETURN(error);
}
+static bool tokudb_check_db_dir_exist_from_table_name(const char *table_name) {
+ DBUG_ASSERT(table_name);
+ bool mysql_dir_exists;
+ char db_name[FN_REFLEN];
+ const char *db_name_begin = strchr(table_name, FN_LIBCHAR);
+ const char *db_name_end = strrchr(table_name, FN_LIBCHAR);
+ DBUG_ASSERT(db_name_begin);
+ DBUG_ASSERT(db_name_end);
+ DBUG_ASSERT(db_name_begin != db_name_end);
+
+ ++db_name_begin;
+ size_t db_name_size = db_name_end - db_name_begin;
+
+ DBUG_ASSERT(db_name_size < FN_REFLEN);
+
+ memcpy(db_name, db_name_begin, db_name_size);
+ db_name[db_name_size] = '\0';
+ mysql_dir_exists = (check_db_dir_existence(db_name) == 0);
+
+ return mysql_dir_exists;
+}
//
// renames table from "from" to "to"
@@ -7659,15 +7666,33 @@ int ha_tokudb::rename_table(const char *from, const char *to) {
TOKUDB_SHARE::drop_share(share);
}
int error;
- error = delete_or_rename_table(from, to, false);
- if (TOKUDB_LIKELY(TOKUDB_DEBUG_FLAGS(TOKUDB_DEBUG_HIDE_DDL_LOCK_ERRORS) == 0) &&
- error == DB_LOCK_NOTGRANTED) {
+ bool to_db_dir_exist = tokudb_check_db_dir_exist_from_table_name(to);
+ if (!to_db_dir_exist) {
sql_print_error(
- "Could not rename table from %s to %s because another transaction "
- "has accessed the table. To rename the table, make sure no "
- "transactions touch the table.",
+ "Could not rename table from %s to %s because "
+ "destination db does not exist",
from,
to);
+#ifndef __WIN__
+ /* Small hack. tokudb_check_db_dir_exist_from_table_name calls
+ * my_access, which sets my_errno on Windows, but doesn't on
+ * unix. Set it for unix too.
+ */
+ my_errno= errno;
+#endif
+ error= my_errno;
+ }
+ else {
+ error = delete_or_rename_table(from, to, false);
+ if (TOKUDB_LIKELY(TOKUDB_DEBUG_FLAGS(TOKUDB_DEBUG_HIDE_DDL_LOCK_ERRORS) == 0) &&
+ error == DB_LOCK_NOTGRANTED) {
+ sql_print_error(
+ "Could not rename table from %s to %s because another transaction "
+ "has accessed the table. To rename the table, make sure no "
+ "transactions touch the table.",
+ from,
+ to);
+ }
}
TOKUDB_HANDLER_DBUG_RETURN(error);
}
diff --git a/storage/tokudb/ha_tokudb.h b/storage/tokudb/ha_tokudb.h
index 3d7a3a7fa05..4a7e395d0d1 100644
--- a/storage/tokudb/ha_tokudb.h
+++ b/storage/tokudb/ha_tokudb.h
@@ -816,6 +816,8 @@ public:
int index_first(uchar * buf);
int index_last(uchar * buf);
+ bool has_gap_locks() const { return true; }
+
int rnd_init(bool scan);
int rnd_end();
int rnd_next(uchar * buf);
diff --git a/storage/tokudb/mysql-test/tokudb/r/dir_per_db_rename_to_nonexisting_schema.result b/storage/tokudb/mysql-test/tokudb/r/dir_per_db_rename_to_nonexisting_schema.result
new file mode 100644
index 00000000000..74148bd4e74
--- /dev/null
+++ b/storage/tokudb/mysql-test/tokudb/r/dir_per_db_rename_to_nonexisting_schema.result
@@ -0,0 +1,46 @@
+SET GLOBAL tokudb_dir_per_db=true;
+######
+# Tokudb and mysql data dirs are the same, rename to existent db
+###
+CREATE DATABASE new_db;
+CREATE TABLE t1 (id INT AUTO_INCREMENT PRIMARY KEY NOT NULL) ENGINE=tokudb;
+ALTER TABLE test.t1 RENAME new_db.t1;
+The content of "test" directory:
+The content of "new_db" directory:
+db.opt
+t1.frm
+t1_main_id.tokudb
+t1_status_id.tokudb
+DROP DATABASE new_db;
+######
+# Tokudb and mysql data dirs are the same, rename to nonexistent db
+###
+CREATE TABLE t1 (id INT AUTO_INCREMENT PRIMARY KEY NOT NULL) ENGINE=tokudb;
+CALL mtr.add_suppression("because destination db does not exist");
+ALTER TABLE test.t1 RENAME foo.t1;
+ERROR HY000: Error on rename of './test/t1' to './foo/t1' (errno: 2 "No such file or directory")
+DROP TABLE t1;
+SELECT @@tokudb_data_dir;
+@@tokudb_data_dir
+NULL
+SELECT @@tokudb_dir_per_db;
+@@tokudb_dir_per_db
+0
+######
+# Tokudb and mysql data dirs are different, rename to existent db
+###
+CREATE DATABASE new_db;
+CREATE TABLE t1 (id INT AUTO_INCREMENT PRIMARY KEY NOT NULL) ENGINE=tokudb;
+ALTER TABLE test.t1 RENAME new_db.t1;
+The content of "test" direcotry:
+The content of "new_db" directory:
+DROP DATABASE new_db;
+######
+# Tokudb and mysql data dirs are different, rename to nonexistent db
+###
+CREATE TABLE t1 (id INT AUTO_INCREMENT PRIMARY KEY NOT NULL) ENGINE=tokudb;
+CALL mtr.add_suppression("because destination db does not exist");
+ALTER TABLE test.t1 RENAME foo.t1;
+ERROR HY000: Error on rename of './test/t1' to './foo/t1' (errno: 2 "No such file or directory")
+DROP TABLE t1;
+SET GLOBAL tokudb_dir_per_db=default;
diff --git a/storage/tokudb/mysql-test/tokudb/r/gap_lock_error.result b/storage/tokudb/mysql-test/tokudb/r/gap_lock_error.result
new file mode 100644
index 00000000000..41e294f7d8d
--- /dev/null
+++ b/storage/tokudb/mysql-test/tokudb/r/gap_lock_error.result
@@ -0,0 +1,469 @@
+CREATE TABLE gap1 (id1 INT, id2 INT, id3 INT, c1 INT, value INT,
+PRIMARY KEY (id1, id2, id3),
+INDEX i (c1)) ENGINE=tokudb;
+CREATE TABLE gap2 like gap1;
+CREATE TABLE gap3 (id INT, value INT,
+PRIMARY KEY (id),
+UNIQUE KEY ui(value)) ENGINE=tokudb;
+CREATE TABLE gap4 (id INT, value INT,
+PRIMARY KEY (id)) ENGINE=tokudb
+PARTITION BY HASH(id) PARTITIONS 2;
+insert into gap3 values (1,1), (2,2),(3,3),(4,4),(5,5);
+insert into gap4 values (1,1), (2,2),(3,3),(4,4),(5,5);
+set session autocommit=0;
+select * from gap1 limit 1 for update;
+id1 id2 id3 c1 value
+0 0 1 1 1
+select * from gap1 where value != 100 limit 1 for update;
+id1 id2 id3 c1 value
+0 0 1 1 1
+select * from gap1 where id1=1 for update;
+id1 id2 id3 c1 value
+1 0 2 2 2
+1 0 3 3 3
+select * from gap1 where id1=1 and id2= 1 for update;
+id1 id2 id3 c1 value
+select * from gap1 where id1=1 and id2= 1 and id3 != 1 for update;
+id1 id2 id3 c1 value
+select * from gap1 where id1=1 and id2= 1 and id3
+between 1 and 3 for update;
+id1 id2 id3 c1 value
+select * from gap1 where id1=1 and id2= 1 order by id3 asc
+limit 1 for update;
+id1 id2 id3 c1 value
+select * from gap1 where id1=1 and id2= 1 order by id3 desc
+limit 1 for update;
+id1 id2 id3 c1 value
+select * from gap1 order by id1 asc limit 1 for update;
+id1 id2 id3 c1 value
+0 0 1 1 1
+select * from gap1 order by id1 asc, id2 asc, id3 asc limit 1 for update;
+id1 id2 id3 c1 value
+0 0 1 1 1
+select * from gap1 order by id1 desc limit 1 for update;
+id1 id2 id3 c1 value
+500 100 1000 1000 1000
+select * from gap1 order by id1 desc, id2 desc, id3 desc
+limit 1 for update;
+id1 id2 id3 c1 value
+500 100 1000 1000 1000
+select * from gap1 force index(i) where c1=1 for update;
+id1 id2 id3 c1 value
+0 0 1 1 1
+select * from gap3 force index(ui) where value=1 for update;
+id value
+1 1
+select * from gap1 where id1=1 and id2=1 and id3=1 for update;
+id1 id2 id3 c1 value
+select * from gap1 where id1=1 and id2=1 and id3 in (1, 2, 3) for update;
+id1 id2 id3 c1 value
+select * from gap1 where id1=1 and id2=1 and id3=1 and value=1
+order by c1 for update;
+id1 id2 id3 c1 value
+select * from gap3 where id=1 for update;
+id value
+1 1
+select * from gap4 where id=1 for update;
+id value
+1 1
+select * from gap4 where id in (1, 2, 3) for update;
+id value
+1 1
+2 2
+3 3
+select * from gap4 for update;
+id value
+2 2
+4 4
+1 1
+3 3
+5 5
+select * from gap4 where id between 3 and 7 for update;
+id value
+3 3
+4 4
+5 5
+set session autocommit=1;
+select * from gap1 limit 1 for update;
+id1 id2 id3 c1 value
+0 0 1 1 1
+select * from gap1 where value != 100 limit 1 for update;
+id1 id2 id3 c1 value
+0 0 1 1 1
+select * from gap1 where id1=1 for update;
+id1 id2 id3 c1 value
+1 0 2 2 2
+1 0 3 3 3
+select * from gap1 where id1=1 and id2= 1 for update;
+id1 id2 id3 c1 value
+select * from gap1 where id1=1 and id2= 1 and id3 != 1 for update;
+id1 id2 id3 c1 value
+select * from gap1 where id1=1 and id2= 1 and id3
+between 1 and 3 for update;
+id1 id2 id3 c1 value
+select * from gap1 where id1=1 and id2= 1 order by id3 asc
+limit 1 for update;
+id1 id2 id3 c1 value
+select * from gap1 where id1=1 and id2= 1 order by id3 desc
+limit 1 for update;
+id1 id2 id3 c1 value
+select * from gap1 order by id1 asc limit 1 for update;
+id1 id2 id3 c1 value
+0 0 1 1 1
+select * from gap1 order by id1 asc, id2 asc, id3 asc limit 1 for update;
+id1 id2 id3 c1 value
+0 0 1 1 1
+select * from gap1 order by id1 desc limit 1 for update;
+id1 id2 id3 c1 value
+500 100 1000 1000 1000
+select * from gap1 order by id1 desc, id2 desc, id3 desc
+limit 1 for update;
+id1 id2 id3 c1 value
+500 100 1000 1000 1000
+select * from gap1 force index(i) where c1=1 for update;
+id1 id2 id3 c1 value
+0 0 1 1 1
+select * from gap3 force index(ui) where value=1 for update;
+id value
+1 1
+select * from gap1 where id1=1 and id2=1 and id3=1 for update;
+id1 id2 id3 c1 value
+select * from gap1 where id1=1 and id2=1 and id3 in (1, 2, 3) for update;
+id1 id2 id3 c1 value
+select * from gap1 where id1=1 and id2=1 and id3=1 and value=1
+order by c1 for update;
+id1 id2 id3 c1 value
+select * from gap3 where id=1 for update;
+id value
+1 1
+select * from gap4 where id=1 for update;
+id value
+1 1
+select * from gap4 where id in (1, 2, 3) for update;
+id value
+1 1
+2 2
+3 3
+select * from gap4 for update;
+id value
+2 2
+4 4
+1 1
+3 3
+5 5
+select * from gap4 where id between 3 and 7 for update;
+id value
+3 3
+4 4
+5 5
+set session autocommit=0;
+select * from gap1 limit 1 lock in share mode;
+id1 id2 id3 c1 value
+0 0 1 1 1
+select * from gap1 where value != 100 limit 1 lock in share mode;
+id1 id2 id3 c1 value
+0 0 1 1 1
+select * from gap1 where id1=1 lock in share mode;
+id1 id2 id3 c1 value
+1 0 2 2 2
+1 0 3 3 3
+select * from gap1 where id1=1 and id2= 1 lock in share mode;
+id1 id2 id3 c1 value
+select * from gap1 where id1=1 and id2= 1 and id3 != 1 lock in share mode;
+id1 id2 id3 c1 value
+select * from gap1 where id1=1 and id2= 1 and id3
+between 1 and 3 lock in share mode;
+id1 id2 id3 c1 value
+select * from gap1 where id1=1 and id2= 1 order by id3 asc
+limit 1 lock in share mode;
+id1 id2 id3 c1 value
+select * from gap1 where id1=1 and id2= 1 order by id3 desc
+limit 1 lock in share mode;
+id1 id2 id3 c1 value
+select * from gap1 order by id1 asc limit 1 lock in share mode;
+id1 id2 id3 c1 value
+0 0 1 1 1
+select * from gap1 order by id1 asc, id2 asc, id3 asc limit 1 lock in share mode;
+id1 id2 id3 c1 value
+0 0 1 1 1
+select * from gap1 order by id1 desc limit 1 lock in share mode;
+id1 id2 id3 c1 value
+500 100 1000 1000 1000
+select * from gap1 order by id1 desc, id2 desc, id3 desc
+limit 1 lock in share mode;
+id1 id2 id3 c1 value
+500 100 1000 1000 1000
+select * from gap1 force index(i) where c1=1 lock in share mode;
+id1 id2 id3 c1 value
+0 0 1 1 1
+select * from gap3 force index(ui) where value=1 lock in share mode;
+id value
+1 1
+select * from gap1 where id1=1 and id2=1 and id3=1 lock in share mode;
+id1 id2 id3 c1 value
+select * from gap1 where id1=1 and id2=1 and id3 in (1, 2, 3) lock in share mode;
+id1 id2 id3 c1 value
+select * from gap1 where id1=1 and id2=1 and id3=1 and value=1
+order by c1 lock in share mode;
+id1 id2 id3 c1 value
+select * from gap3 where id=1 lock in share mode;
+id value
+1 1
+select * from gap4 where id=1 lock in share mode;
+id value
+1 1
+select * from gap4 where id in (1, 2, 3) lock in share mode;
+id value
+1 1
+2 2
+3 3
+select * from gap4 lock in share mode;
+id value
+2 2
+4 4
+1 1
+3 3
+5 5
+select * from gap4 where id between 3 and 7 lock in share mode;
+id value
+3 3
+4 4
+5 5
+set session autocommit=1;
+select * from gap1 limit 1 lock in share mode;
+id1 id2 id3 c1 value
+0 0 1 1 1
+select * from gap1 where value != 100 limit 1 lock in share mode;
+id1 id2 id3 c1 value
+0 0 1 1 1
+select * from gap1 where id1=1 lock in share mode;
+id1 id2 id3 c1 value
+1 0 2 2 2
+1 0 3 3 3
+select * from gap1 where id1=1 and id2= 1 lock in share mode;
+id1 id2 id3 c1 value
+select * from gap1 where id1=1 and id2= 1 and id3 != 1 lock in share mode;
+id1 id2 id3 c1 value
+select * from gap1 where id1=1 and id2= 1 and id3
+between 1 and 3 lock in share mode;
+id1 id2 id3 c1 value
+select * from gap1 where id1=1 and id2= 1 order by id3 asc
+limit 1 lock in share mode;
+id1 id2 id3 c1 value
+select * from gap1 where id1=1 and id2= 1 order by id3 desc
+limit 1 lock in share mode;
+id1 id2 id3 c1 value
+select * from gap1 order by id1 asc limit 1 lock in share mode;
+id1 id2 id3 c1 value
+0 0 1 1 1
+select * from gap1 order by id1 asc, id2 asc, id3 asc limit 1 lock in share mode;
+id1 id2 id3 c1 value
+0 0 1 1 1
+select * from gap1 order by id1 desc limit 1 lock in share mode;
+id1 id2 id3 c1 value
+500 100 1000 1000 1000
+select * from gap1 order by id1 desc, id2 desc, id3 desc
+limit 1 lock in share mode;
+id1 id2 id3 c1 value
+500 100 1000 1000 1000
+select * from gap1 force index(i) where c1=1 lock in share mode;
+id1 id2 id3 c1 value
+0 0 1 1 1
+select * from gap3 force index(ui) where value=1 lock in share mode;
+id value
+1 1
+select * from gap1 where id1=1 and id2=1 and id3=1 lock in share mode;
+id1 id2 id3 c1 value
+select * from gap1 where id1=1 and id2=1 and id3 in (1, 2, 3) lock in share mode;
+id1 id2 id3 c1 value
+select * from gap1 where id1=1 and id2=1 and id3=1 and value=1
+order by c1 lock in share mode;
+id1 id2 id3 c1 value
+select * from gap3 where id=1 lock in share mode;
+id value
+1 1
+select * from gap4 where id=1 lock in share mode;
+id value
+1 1
+select * from gap4 where id in (1, 2, 3) lock in share mode;
+id value
+1 1
+2 2
+3 3
+select * from gap4 lock in share mode;
+id value
+2 2
+4 4
+1 1
+3 3
+5 5
+select * from gap4 where id between 3 and 7 lock in share mode;
+id value
+3 3
+4 4
+5 5
+set session autocommit=0;
+select * from gap1 limit 1 ;
+id1 id2 id3 c1 value
+0 0 1 1 1
+select * from gap1 where value != 100 limit 1 ;
+id1 id2 id3 c1 value
+0 0 1 1 1
+select * from gap1 where id1=1 ;
+id1 id2 id3 c1 value
+1 0 2 2 2
+1 0 3 3 3
+select * from gap1 where id1=1 and id2= 1 ;
+id1 id2 id3 c1 value
+select * from gap1 where id1=1 and id2= 1 and id3 != 1 ;
+id1 id2 id3 c1 value
+select * from gap1 where id1=1 and id2= 1 and id3
+between 1 and 3 ;
+id1 id2 id3 c1 value
+select * from gap1 where id1=1 and id2= 1 order by id3 asc
+limit 1 ;
+id1 id2 id3 c1 value
+select * from gap1 where id1=1 and id2= 1 order by id3 desc
+limit 1 ;
+id1 id2 id3 c1 value
+select * from gap1 order by id1 asc limit 1 ;
+id1 id2 id3 c1 value
+0 0 1 1 1
+select * from gap1 order by id1 asc, id2 asc, id3 asc limit 1 ;
+id1 id2 id3 c1 value
+0 0 1 1 1
+select * from gap1 order by id1 desc limit 1 ;
+id1 id2 id3 c1 value
+500 100 1000 1000 1000
+select * from gap1 order by id1 desc, id2 desc, id3 desc
+limit 1 ;
+id1 id2 id3 c1 value
+500 100 1000 1000 1000
+select * from gap1 force index(i) where c1=1 ;
+id1 id2 id3 c1 value
+0 0 1 1 1
+select * from gap3 force index(ui) where value=1 ;
+id value
+1 1
+select * from gap1 where id1=1 and id2=1 and id3=1 ;
+id1 id2 id3 c1 value
+select * from gap1 where id1=1 and id2=1 and id3 in (1, 2, 3) ;
+id1 id2 id3 c1 value
+select * from gap1 where id1=1 and id2=1 and id3=1 and value=1
+order by c1 ;
+id1 id2 id3 c1 value
+select * from gap3 where id=1 ;
+id value
+1 1
+select * from gap4 where id=1 ;
+id value
+1 1
+select * from gap4 where id in (1, 2, 3) ;
+id value
+1 1
+2 2
+3 3
+select * from gap4 ;
+id value
+2 2
+4 4
+1 1
+3 3
+5 5
+select * from gap4 where id between 3 and 7 ;
+id value
+3 3
+4 4
+5 5
+set session autocommit=1;
+select * from gap1 limit 1 ;
+id1 id2 id3 c1 value
+0 0 1 1 1
+select * from gap1 where value != 100 limit 1 ;
+id1 id2 id3 c1 value
+0 0 1 1 1
+select * from gap1 where id1=1 ;
+id1 id2 id3 c1 value
+1 0 2 2 2
+1 0 3 3 3
+select * from gap1 where id1=1 and id2= 1 ;
+id1 id2 id3 c1 value
+select * from gap1 where id1=1 and id2= 1 and id3 != 1 ;
+id1 id2 id3 c1 value
+select * from gap1 where id1=1 and id2= 1 and id3
+between 1 and 3 ;
+id1 id2 id3 c1 value
+select * from gap1 where id1=1 and id2= 1 order by id3 asc
+limit 1 ;
+id1 id2 id3 c1 value
+select * from gap1 where id1=1 and id2= 1 order by id3 desc
+limit 1 ;
+id1 id2 id3 c1 value
+select * from gap1 order by id1 asc limit 1 ;
+id1 id2 id3 c1 value
+0 0 1 1 1
+select * from gap1 order by id1 asc, id2 asc, id3 asc limit 1 ;
+id1 id2 id3 c1 value
+0 0 1 1 1
+select * from gap1 order by id1 desc limit 1 ;
+id1 id2 id3 c1 value
+500 100 1000 1000 1000
+select * from gap1 order by id1 desc, id2 desc, id3 desc
+limit 1 ;
+id1 id2 id3 c1 value
+500 100 1000 1000 1000
+select * from gap1 force index(i) where c1=1 ;
+id1 id2 id3 c1 value
+0 0 1 1 1
+select * from gap3 force index(ui) where value=1 ;
+id value
+1 1
+select * from gap1 where id1=1 and id2=1 and id3=1 ;
+id1 id2 id3 c1 value
+select * from gap1 where id1=1 and id2=1 and id3 in (1, 2, 3) ;
+id1 id2 id3 c1 value
+select * from gap1 where id1=1 and id2=1 and id3=1 and value=1
+order by c1 ;
+id1 id2 id3 c1 value
+select * from gap3 where id=1 ;
+id value
+1 1
+select * from gap4 where id=1 ;
+id value
+1 1
+select * from gap4 where id in (1, 2, 3) ;
+id value
+1 1
+2 2
+3 3
+select * from gap4 ;
+id value
+2 2
+4 4
+1 1
+3 3
+5 5
+select * from gap4 where id between 3 and 7 ;
+id value
+3 3
+4 4
+5 5
+set session autocommit=0;
+insert into gap1 (id1, id2, id3) values (-1,-1,-1);
+insert into gap1 (id1, id2, id3) values (-1,-1,-1)
+on duplicate key update value=100;
+update gap1 set value=100 where id1=1;
+update gap1 set value=100 where id1=1 and id2=1 and id3=1;
+delete from gap1 where id1=2;
+delete from gap1 where id1=-1 and id2=-1 and id3=-1;
+commit;
+set session autocommit=1;
+insert into gap1 (id1, id2, id3) values (-1,-1,-1);
+insert into gap1 (id1, id2, id3) values (-1,-1,-1)
+on duplicate key update value=100;
+update gap1 set value=100 where id1=1;
+update gap1 set value=100 where id1=1 and id2=1 and id3=1;
+delete from gap1 where id1=2;
+delete from gap1 where id1=-1 and id2=-1 and id3=-1;
+commit;
+drop table gap1, gap2, gap3, gap4;
diff --git a/storage/tokudb/mysql-test/tokudb/r/locks-select-update-3.result b/storage/tokudb/mysql-test/tokudb/r/locks-select-update-3.result
index 62b65a8535b..e8c82b65967 100644
--- a/storage/tokudb/mysql-test/tokudb/r/locks-select-update-3.result
+++ b/storage/tokudb/mysql-test/tokudb/r/locks-select-update-3.result
@@ -9,6 +9,7 @@ a b
1 0
update t set b=b+1 where a=1;
connect conn1,localhost,root;
+set session tokudb_lock_timeout= 60000;
set session transaction isolation level read committed;
begin;
select * from t where a=1 for update;
diff --git a/storage/tokudb/mysql-test/tokudb/r/percona_kill_idle_trx_tokudb.result b/storage/tokudb/mysql-test/tokudb/r/percona_kill_idle_trx_tokudb.result
new file mode 100644
index 00000000000..089d1d2b136
--- /dev/null
+++ b/storage/tokudb/mysql-test/tokudb/r/percona_kill_idle_trx_tokudb.result
@@ -0,0 +1,43 @@
+SET default_storage_engine=TokuDB;
+#
+# Test kill_idle_transaction_timeout feature with TokuDB
+#
+CREATE TABLE t1 (a INT);
+SET GLOBAL kill_idle_transaction= 1;
+BEGIN;
+INSERT INTO t1 VALUES (1),(2);
+COMMIT;
+SELECT * FROM t1;
+a
+1
+2
+BEGIN;
+INSERT INTO t1 VALUES (3);
+# Current connection idle transaction killed, reconnecting
+SELECT * FROM t1;
+a
+1
+2
+#
+# Test that row locks are released on idle transaction kill
+#
+SET GLOBAL kill_idle_transaction= 2;
+# Take row locks in connection conn1
+BEGIN;
+SELECT * FROM t1 FOR UPDATE;
+a
+1
+2
+# Take row locks in connection default
+UPDATE t1 SET a=4;
+SELECT * FROM t1;
+a
+4
+4
+# Show that connection conn1 has been killed
+SELECT * FROM t1;
+ERROR HY000: MySQL server has gone away
+# connection default
+# Cleanup
+DROP TABLE t1;
+SET GLOBAL kill_idle_transaction= saved_kill_idle_transaction;
diff --git a/storage/tokudb/mysql-test/tokudb/t/dir_per_db_rename_to_nonexisting_schema.test b/storage/tokudb/mysql-test/tokudb/t/dir_per_db_rename_to_nonexisting_schema.test
new file mode 100644
index 00000000000..17fe0188a6e
--- /dev/null
+++ b/storage/tokudb/mysql-test/tokudb/t/dir_per_db_rename_to_nonexisting_schema.test
@@ -0,0 +1,64 @@
+--source include/have_tokudb.inc
+
+SET GLOBAL tokudb_dir_per_db=true;
+--let DATADIR=`SELECT @@datadir`
+
+--echo ######
+--echo # Tokudb and mysql data dirs are the same, rename to existent db
+--echo ###
+CREATE DATABASE new_db;
+CREATE TABLE t1 (id INT AUTO_INCREMENT PRIMARY KEY NOT NULL) ENGINE=tokudb;
+ALTER TABLE test.t1 RENAME new_db.t1;
+--echo The content of "test" directory:
+--source include/table_files_replace_pattern.inc
+--sorted_result
+--list_files $DATADIR/test
+--echo The content of "new_db" directory:
+--source include/table_files_replace_pattern.inc
+--sorted_result
+--list_files $DATADIR/new_db
+DROP DATABASE new_db;
+
+--echo ######
+--echo # Tokudb and mysql data dirs are the same, rename to nonexistent db
+--echo ###
+CREATE TABLE t1 (id INT AUTO_INCREMENT PRIMARY KEY NOT NULL) ENGINE=tokudb;
+CALL mtr.add_suppression("because destination db does not exist");
+--error ER_ERROR_ON_RENAME
+ALTER TABLE test.t1 RENAME foo.t1;
+DROP TABLE t1;
+
+--let $custom_tokudb_data_dir=$MYSQL_TMP_DIR/custom_tokudb_data_dir
+--mkdir $custom_tokudb_data_dir
+--replace_result $custom_tokudb_data_dir CUSTOM_TOKUDB_DATA_DIR
+--source include/restart_mysqld.inc
+
+--replace_result $custom_tokudb_data_dir CUSTOM_TOKUDB_DATA_DIR
+SELECT @@tokudb_data_dir;
+SELECT @@tokudb_dir_per_db;
+
+--echo ######
+--echo # Tokudb and mysql data dirs are different, rename to existent db
+--echo ###
+CREATE DATABASE new_db;
+CREATE TABLE t1 (id INT AUTO_INCREMENT PRIMARY KEY NOT NULL) ENGINE=tokudb;
+ALTER TABLE test.t1 RENAME new_db.t1;
+--echo The content of "test" direcotry:
+--source include/table_files_replace_pattern.inc
+--sorted_result
+--echo The content of "new_db" directory:
+--source include/table_files_replace_pattern.inc
+--sorted_result
+DROP DATABASE new_db;
+
+--echo ######
+--echo # Tokudb and mysql data dirs are different, rename to nonexistent db
+--echo ###
+CREATE TABLE t1 (id INT AUTO_INCREMENT PRIMARY KEY NOT NULL) ENGINE=tokudb;
+CALL mtr.add_suppression("because destination db does not exist");
+--error ER_ERROR_ON_RENAME
+ALTER TABLE test.t1 RENAME foo.t1;
+DROP TABLE t1;
+
+SET GLOBAL tokudb_dir_per_db=default;
+
diff --git a/storage/tokudb/mysql-test/tokudb/t/gap_lock_error.test b/storage/tokudb/mysql-test/tokudb/t/gap_lock_error.test
new file mode 100644
index 00000000000..8c52cef9e27
--- /dev/null
+++ b/storage/tokudb/mysql-test/tokudb/t/gap_lock_error.test
@@ -0,0 +1,5 @@
+--source include/have_tokudb.inc
+
+let $engine=tokudb;
+let $expect_gap_lock_errors=0;
+--source include/gap_lock_error_all.inc
diff --git a/storage/tokudb/mysql-test/tokudb/t/locks-select-update-3.test b/storage/tokudb/mysql-test/tokudb/t/locks-select-update-3.test
index a563f061add..5b54fa7313e 100644
--- a/storage/tokudb/mysql-test/tokudb/t/locks-select-update-3.test
+++ b/storage/tokudb/mysql-test/tokudb/t/locks-select-update-3.test
@@ -15,6 +15,7 @@ select * from t where a=1 for update;
# t2 update
update t set b=b+1 where a=1;
connect(conn1,localhost,root);
+set session tokudb_lock_timeout= 60000;
set session transaction isolation level read committed;
begin;
# t2 select for update, should hang until t1 commits
diff --git a/storage/tokudb/mysql-test/tokudb/t/percona_kill_idle_trx_tokudb.test b/storage/tokudb/mysql-test/tokudb/t/percona_kill_idle_trx_tokudb.test
new file mode 100644
index 00000000000..743fb9a55a7
--- /dev/null
+++ b/storage/tokudb/mysql-test/tokudb/t/percona_kill_idle_trx_tokudb.test
@@ -0,0 +1,5 @@
+--source include/have_tokudb.inc
+--skip MariaDB doesn't support kill_idle_trx variable for all SE
+
+SET default_storage_engine=TokuDB;
+--source include/percona_kill_idle_trx.inc
diff --git a/storage/tokudb/mysql-test/tokudb_backup/t/suite.opt b/storage/tokudb/mysql-test/tokudb_backup/t/suite.opt
index 0d80cf85a91..5d4cb245e27 100644
--- a/storage/tokudb/mysql-test/tokudb_backup/t/suite.opt
+++ b/storage/tokudb/mysql-test/tokudb_backup/t/suite.opt
@@ -1 +1 @@
-$TOKUDB_OPT $TOKUDB_LOAD_ADD $TOKUDB_BACKUP_OPT $TOKUDB_BACKUP_LOAD_ADD --loose-tokudb-check-jemalloc=0 --loose-tokudb-cache-size=512M --loose-tokudb-block-size=1M
+$TOKUDB_OPT $TOKUDB_LOAD_ADD_PATH $TOKUDB_BACKUP_OPT $TOKUDB_BACKUP_LOAD_ADD_PATH --loose-tokudb-check-jemalloc=0 --loose-tokudb-cache-size=512M --loose-tokudb-block-size=1M
diff --git a/storage/xtradb/btr/btr0btr.cc b/storage/xtradb/btr/btr0btr.cc
index bce81f95ead..417eeb2c367 100644
--- a/storage/xtradb/btr/btr0btr.cc
+++ b/storage/xtradb/btr/btr0btr.cc
@@ -3571,8 +3571,6 @@ btr_level_list_remove_func(
ulint prev_page_no;
ulint next_page_no;
- ut_ad(page != NULL);
- ut_ad(mtr != NULL);
ut_ad(mtr_memo_contains_page(mtr, page, MTR_MEMO_PAGE_X_FIX));
ut_ad(space == page_get_space_id(page));
/* Get the previous and next page numbers of page */
diff --git a/storage/xtradb/btr/btr0cur.cc b/storage/xtradb/btr/btr0cur.cc
index 2acf5dfa6f7..454b085862c 100644
--- a/storage/xtradb/btr/btr0cur.cc
+++ b/storage/xtradb/btr/btr0cur.cc
@@ -1843,7 +1843,7 @@ btr_cur_pessimistic_insert(
/*************************************************************//**
For an update, checks the locks and does the undo logging.
@return DB_SUCCESS, DB_WAIT_LOCK, or error number */
-UNIV_INLINE MY_ATTRIBUTE((warn_unused_result, nonnull(2,3,6,7)))
+UNIV_INLINE MY_ATTRIBUTE((warn_unused_result))
dberr_t
btr_cur_upd_lock_and_undo(
/*======================*/
@@ -2073,7 +2073,6 @@ btr_cur_update_alloc_zip_func(
const page_t* page = page_cur_get_page(cursor);
ut_ad(page_zip == page_cur_get_page_zip(cursor));
- ut_ad(page_zip);
ut_ad(!dict_index_is_ibuf(index));
ut_ad(rec_offs_validate(page_cur_get_rec(cursor), index, offsets));
@@ -3940,19 +3939,42 @@ inexact:
return(n_rows);
}
-/*******************************************************************//**
-Estimates the number of rows in a given index range.
-@return estimated number of rows */
-UNIV_INTERN
-ib_int64_t
-btr_estimate_n_rows_in_range(
-/*=========================*/
- dict_index_t* index, /*!< in: index */
- const dtuple_t* tuple1, /*!< in: range start, may also be empty tuple */
- ulint mode1, /*!< in: search mode for range start */
- const dtuple_t* tuple2, /*!< in: range end, may also be empty tuple */
- ulint mode2, /*!< in: search mode for range end */
- trx_t* trx) /*!< in: trx */
+/** If the tree gets changed too much between the two dives for the left
+and right boundary then btr_estimate_n_rows_in_range_low() will retry
+that many times before giving up and returning the value stored in
+rows_in_range_arbitrary_ret_val. */
+static const unsigned rows_in_range_max_retries = 4;
+
+/** We pretend that a range has that many records if the tree keeps changing
+for rows_in_range_max_retries retries while we try to estimate the records
+in a given range. */
+static const int64_t rows_in_range_arbitrary_ret_val = 10;
+
+/** Estimates the number of rows in a given index range.
+@param[in] index index
+@param[in] tuple1 range start, may also be empty tuple
+@param[in] mode1 search mode for range start
+@param[in] tuple2 range end, may also be empty tuple
+@param[in] mode2 search mode for range end
+@param[in] trx trx
+@param[in] nth_attempt if the tree gets modified too much while
+we are trying to analyze it, then we will retry (this function will call
+itself, incrementing this parameter)
+@return estimated number of rows; if after rows_in_range_max_retries
+retries the tree keeps changing, then we will just return
+rows_in_range_arbitrary_ret_val as a result (if
+nth_attempt >= rows_in_range_max_retries and the tree is modified between
+the two dives). */
+static
+int64_t
+btr_estimate_n_rows_in_range_low(
+ dict_index_t* index,
+ const dtuple_t* tuple1,
+ ulint mode1,
+ const dtuple_t* tuple2,
+ ulint mode2,
+ trx_t* trx,
+ unsigned nth_attempt)
{
btr_path_t path1[BTR_PATH_ARRAY_N_SLOTS];
btr_path_t path2[BTR_PATH_ARRAY_N_SLOTS];
@@ -3990,6 +4012,12 @@ btr_estimate_n_rows_in_range(
mtr_start_trx(&mtr, trx);
+#ifdef UNIV_DEBUG
+ if (!strcmp(index->name, "iC")) {
+ DEBUG_SYNC_C("btr_estimate_n_rows_in_range_between_dives");
+ }
+#endif
+
cursor.path_arr = path2;
if (dtuple_get_n_fields(tuple2) > 0) {
@@ -4056,6 +4084,33 @@ btr_estimate_n_rows_in_range(
if (!diverged && slot1->nth_rec != slot2->nth_rec) {
+ /* If both slots do not point to the same page or if
+ the paths have crossed and the same page on both
+ apparently contains a different number of records,
+ this means that the tree must have changed between
+ the dive for slot1 and the dive for slot2 at the
+ beginning of this function. */
+ if (slot1->page_no != slot2->page_no
+ || slot1->page_level != slot2->page_level
+ || (slot1->nth_rec >= slot2->nth_rec
+ && slot1->n_recs != slot2->n_recs)) {
+
+ /* If the tree keeps changing even after a
+ few attempts, then just return some arbitrary
+ number. */
+ if (nth_attempt >= rows_in_range_max_retries) {
+ return(rows_in_range_arbitrary_ret_val);
+ }
+
+ const int64_t ret =
+ btr_estimate_n_rows_in_range_low(
+ index, tuple1, mode1,
+ tuple2, mode2, trx,
+ nth_attempt + 1);
+
+ return(ret);
+ }
+
diverged = TRUE;
if (slot1->nth_rec < slot2->nth_rec) {
@@ -4074,7 +4129,7 @@ btr_estimate_n_rows_in_range(
in this case slot1->nth_rec will point
to the supr record and slot2->nth_rec
will point to 6 */
- n_rows = 0;
+ return(0);
}
} else if (diverged && !diverged_lot) {
@@ -4105,6 +4160,30 @@ btr_estimate_n_rows_in_range(
}
}
+/** Estimates the number of rows in a given index range.
+@param[in] index index
+@param[in] tuple1 range start, may also be empty tuple
+@param[in] mode1 search mode for range start
+@param[in] tuple2 range end, may also be empty tuple
+@param[in] mode2 search mode for range end
+@param[in] trx trx
+@return estimated number of rows */
+int64_t
+btr_estimate_n_rows_in_range(
+ dict_index_t* index,
+ const dtuple_t* tuple1,
+ ulint mode1,
+ const dtuple_t* tuple2,
+ ulint mode2,
+ trx_t* trx)
+{
+ const int64_t ret = btr_estimate_n_rows_in_range_low(
+ index, tuple1, mode1, tuple2, mode2, trx,
+ 1 /* first attempt */);
+
+ return(ret);
+}
+
/*******************************************************************//**
Record the number of non_null key values in a given index for
each n-column prefix of the index where 1 <= n <= dict_index_get_n_unique(index).
@@ -4567,7 +4646,6 @@ btr_cur_disown_inherited_fields(
ut_ad(rec_offs_validate(rec, index, offsets));
ut_ad(!rec_offs_comp(offsets) || !rec_get_node_ptr_flag(rec));
ut_ad(rec_offs_any_extern(offsets));
- ut_ad(mtr);
for (i = 0; i < rec_offs_n_fields(offsets); i++) {
if (rec_offs_nth_extern(offsets, i)
@@ -4630,9 +4708,6 @@ btr_push_update_extern_fields(
ulint n;
const upd_field_t* uf;
- ut_ad(tuple);
- ut_ad(update);
-
uf = update->fields;
n = upd_get_n_fields(update);
@@ -4816,7 +4891,6 @@ btr_store_big_rec_extern_fields(
ut_ad(rec_offs_validate(rec, index, offsets));
ut_ad(rec_offs_any_extern(offsets));
- ut_ad(btr_mtr);
ut_ad(mtr_memo_contains(btr_mtr, dict_index_get_lock(index),
MTR_MEMO_X_LOCK));
ut_ad(mtr_memo_contains(btr_mtr, rec_block, MTR_MEMO_PAGE_X_FIX));
diff --git a/storage/xtradb/btr/btr0scrub.cc b/storage/xtradb/btr/btr0scrub.cc
index 62a41d19768..560d2ece6c0 100644
--- a/storage/xtradb/btr/btr0scrub.cc
+++ b/storage/xtradb/btr/btr0scrub.cc
@@ -111,11 +111,18 @@ log_scrub_failure(
Lock dict mutexes */
static
bool
-btr_scrub_lock_dict_func(ulint space, bool lock_to_close_table,
+btr_scrub_lock_dict_func(ulint space_id, 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;
+
+ /* FIXME: this is not the proper way of doing things. The
+ dict_sys->mutex should not be held by any thread for longer
+ than a few microseconds. It must not be held during I/O,
+ for example. So, what is the purpose for this busy-waiting?
+ This function should be rewritten as part of MDEV-8139:
+ Fix scrubbing tests. */
while (mutex_enter_nowait_func(&(dict_sys->mutex), file, line)) {
/* if we lock to close a table, we wait forever
@@ -123,19 +130,24 @@ btr_scrub_lock_dict_func(ulint space, bool lock_to_close_table,
* is closing, and then instead give up
*/
if (lock_to_close_table == false) {
- if (fil_crypt_is_closing(space)) {
+ fil_space_t* space = fil_space_acquire(space_id);
+ if (!space || space->stop_new_ops) {
+ if (space) {
+ fil_space_release(space);
+ }
return false;
}
+ fil_space_release(space);
}
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 %ld seconds for"
" dict_sys lock, space: %lu"
- " lock_to_close_table: %u\n",
- file, line, now - start, space,
+ " lock_to_close_table: %d\n",
+ file, line, now - start, space_id,
lock_to_close_table);
last = now;
@@ -181,16 +193,24 @@ void
btr_scrub_table_close_for_thread(
btr_scrub_t *scrub_data)
{
- if (scrub_data->current_table == NULL)
+ if (scrub_data->current_table == NULL) {
return;
+ }
- bool lock_for_close = true;
- btr_scrub_lock_dict(scrub_data->space, lock_for_close);
+ fil_space_t* space = fil_space_acquire(scrub_data->space);
- /* perform the actual closing */
- btr_scrub_table_close(scrub_data->current_table);
+ /* If tablespace is not marked as stopping perform
+ the actual close. */
+ if (space && !space->is_stopping()) {
+ mutex_enter(&dict_sys->mutex);
+ /* perform the actual closing */
+ btr_scrub_table_close(scrub_data->current_table);
+ mutex_exit(&dict_sys->mutex);
+ }
- btr_scrub_unlock_dict();
+ if (space) {
+ fil_space_release(space);
+ }
scrub_data->current_table = NULL;
scrub_data->current_index = NULL;
diff --git a/storage/xtradb/buf/buf0buddy.cc b/storage/xtradb/buf/buf0buddy.cc
index 8cb880c1169..2ee39c6c992 100644
--- a/storage/xtradb/buf/buf0buddy.cc
+++ b/storage/xtradb/buf/buf0buddy.cc
@@ -485,7 +485,6 @@ buf_buddy_alloc_low(
{
buf_block_t* block;
- ut_ad(lru);
ut_ad(mutex_own(&buf_pool->LRU_list_mutex));
ut_ad(!mutex_own(&buf_pool->zip_mutex));
ut_ad(i >= buf_buddy_get_slot(UNIV_ZIP_SIZE_MIN));
diff --git a/storage/xtradb/buf/buf0buf.cc b/storage/xtradb/buf/buf0buf.cc
index 6d5776dc726..c9a3f6aa6ec 100644
--- a/storage/xtradb/buf/buf0buf.cc
+++ b/storage/xtradb/buf/buf0buf.cc
@@ -65,26 +65,9 @@ Created 11/5/1995 Heikki Tuuri
#include "fil0pagecompress.h"
#include "ha_prototypes.h"
-/* Enable this for checksum error messages. */
-//#ifdef UNIV_DEBUG
-//#define UNIV_DEBUG_LEVEL2 1
-//#endif
-
/* prototypes for new functions added to ha_innodb.cc */
trx_t* innobase_get_trx();
-/********************************************************************//**
-Check if page is maybe compressed, encrypted or both when we encounter
-corrupted page. Note that we can't be 100% sure if page is corrupted
-or decrypt/decompress just failed.
-*/
-static
-ibool
-buf_page_check_corrupt(
-/*===================*/
- buf_page_t* bpage); /*!< in/out: buffer page read from
- disk */
-
static inline
void
_increment_page_get_statistics(buf_block_t* block, trx_t* trx)
@@ -568,6 +551,7 @@ buf_block_alloc(
/********************************************************************//**
Checks if a page is all zeroes.
@return TRUE if the page is all zeroes */
+UNIV_INTERN
bool
buf_page_is_zeroes(
/*===============*/
@@ -590,7 +574,7 @@ buf_page_is_zeroes(
@param[in] checksum_field1 new checksum field
@param[in] checksum_field2 old checksum field
@return true if the page is in crc32 checksum format */
-UNIV_INLINE
+UNIV_INTERN
bool
buf_page_is_checksum_valid_crc32(
const byte* read_buf,
@@ -599,15 +583,15 @@ buf_page_is_checksum_valid_crc32(
{
ib_uint32_t crc32 = buf_calc_page_crc32(read_buf);
-#ifdef UNIV_DEBUG_LEVEL2
if (!(checksum_field1 == crc32 && checksum_field2 == crc32)) {
- ib_logf(IB_LOG_LEVEL_INFO,
- "Page checksum crc32 not valid field1 %lu field2 %lu crc32 %lu.",
- checksum_field1, checksum_field2, (ulint)crc32);
+ DBUG_PRINT("buf_checksum",
+ ("Page checksum crc32 not valid field1 " ULINTPF
+ " field2 " ULINTPF " crc32 %u.",
+ checksum_field1, checksum_field2, crc32));
+ return (false);
}
-#endif
- return(checksum_field1 == crc32 && checksum_field2 == crc32);
+ return (true);
}
/** Checks if the page is in innodb checksum format.
@@ -615,7 +599,7 @@ buf_page_is_checksum_valid_crc32(
@param[in] checksum_field1 new checksum field
@param[in] checksum_field2 old checksum field
@return true if the page is in innodb checksum format */
-UNIV_INLINE
+UNIV_INTERN
bool
buf_page_is_checksum_valid_innodb(
const byte* read_buf,
@@ -634,13 +618,13 @@ buf_page_is_checksum_valid_innodb(
if (checksum_field2 != mach_read_from_4(read_buf + FIL_PAGE_LSN)
&& checksum_field2 != buf_calc_page_old_checksum(read_buf)) {
-#ifdef UNIV_DEBUG_LEVEL2
- ib_logf(IB_LOG_LEVEL_INFO,
- "Page checksum innodb not valid field1 %lu field2 %lu crc32 %lu lsn %lu.",
+
+ DBUG_PRINT("buf_checksum",
+ ("Page checksum innodb not valid field1 " ULINTPF
+ " field2 " ULINTPF "crc32 " ULINTPF " lsn " ULINTPF ".",
checksum_field1, checksum_field2, buf_calc_page_old_checksum(read_buf),
- mach_read_from_4(read_buf + FIL_PAGE_LSN)
- );
-#endif
+ mach_read_from_4(read_buf + FIL_PAGE_LSN)));
+
return(false);
}
@@ -651,13 +635,13 @@ buf_page_is_checksum_valid_innodb(
if (checksum_field1 != 0
&& checksum_field1 != buf_calc_page_new_checksum(read_buf)) {
-#ifdef UNIV_DEBUG_LEVEL2
- ib_logf(IB_LOG_LEVEL_INFO,
- "Page checksum innodb not valid field1 %lu field2 %lu crc32 %lu lsn %lu.",
+
+ DBUG_PRINT("buf_checksum",
+ ("Page checksum innodb not valid field1 " ULINTPF
+ " field2 " ULINTPF "crc32 " ULINTPF " lsn " ULINTPF ".",
checksum_field1, checksum_field2, buf_calc_page_new_checksum(read_buf),
- mach_read_from_4(read_buf + FIL_PAGE_LSN)
- );
-#endif
+ mach_read_from_4(read_buf + FIL_PAGE_LSN)));
+
return(false);
}
@@ -669,22 +653,21 @@ buf_page_is_checksum_valid_innodb(
@param[in] checksum_field1 new checksum field
@param[in] checksum_field2 old checksum field
@return true if the page is in none checksum format */
-UNIV_INLINE
+UNIV_INTERN
bool
buf_page_is_checksum_valid_none(
const byte* read_buf,
ulint checksum_field1,
ulint checksum_field2)
{
-#ifdef UNIV_DEBUG_LEVEL2
- if (!(checksum_field1 == checksum_field2 || checksum_field1 == BUF_NO_CHECKSUM_MAGIC)) {
- ib_logf(IB_LOG_LEVEL_INFO,
- "Page checksum none not valid field1 %lu field2 %lu crc32 %lu lsn %lu.",
+
+ if (!(checksum_field1 == checksum_field2 && checksum_field1 == BUF_NO_CHECKSUM_MAGIC)) {
+ DBUG_PRINT("buf_checksum",
+ ("Page checksum none not valid field1 " ULINTPF
+ " field2 " ULINTPF "crc32 " ULINTPF " lsn " ULINTPF ".",
checksum_field1, checksum_field2, BUF_NO_CHECKSUM_MAGIC,
- mach_read_from_4(read_buf + FIL_PAGE_LSN)
- );
+ mach_read_from_4(read_buf + FIL_PAGE_LSN)));
}
-#endif
return(checksum_field1 == checksum_field2
&& checksum_field1 == BUF_NO_CHECKSUM_MAGIC);
@@ -692,43 +675,42 @@ buf_page_is_checksum_valid_none(
/********************************************************************//**
Checks if a page is corrupt.
-@return TRUE if corrupted */
+@param[in] check_lsn true if LSN should be checked
+@param[in] read_buf Page to be checked
+@param[in] zip_size compressed size or 0
+@param[in] space Pointer to tablespace
+@return true if corrupted, false if not */
UNIV_INTERN
-ibool
+bool
buf_page_is_corrupted(
-/*==================*/
- bool check_lsn, /*!< in: true if we need to check
- and complain about the LSN */
- const byte* read_buf, /*!< in: a database page */
- ulint zip_size) /*!< in: size of compressed page;
- 0 for uncompressed pages */
+ bool check_lsn,
+ const byte* read_buf,
+ ulint zip_size,
+ const fil_space_t* space)
{
ulint checksum_field1;
ulint checksum_field2;
ulint space_id = mach_read_from_4(
read_buf + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID);
- ulint page_type = mach_read_from_4(
+ ulint page_type = mach_read_from_2(
read_buf + FIL_PAGE_TYPE);
- bool no_checksum = (page_type == FIL_PAGE_PAGE_COMPRESSED ||
- page_type == FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED);
- fil_space_crypt_t* crypt_data = fil_space_get_crypt_data(space_id);
-
-
- /* Page is encrypted if encryption information is found from
- tablespace and page contains used key_version. This is true
- also for pages first compressed and then encrypted. */
- if (crypt_data &&
- crypt_data->type != CRYPT_SCHEME_UNENCRYPTED &&
- fil_page_is_encrypted(read_buf)) {
- no_checksum = true;
- }
- /* Return early if there is no checksum or END_LSN */
- if (no_checksum) {
- return (FALSE);
- }
-
- if (!no_checksum && !zip_size
+ /* We can trust page type if page compression is set on tablespace
+ flags because page compression flag means file must have been
+ created with 10.1 (later than 5.5 code base). In 10.1 page
+ compressed tables do not contain post compression checksum and
+ FIL_PAGE_END_LSN_OLD_CHKSUM field stored. Note that space can
+ be null if we are in fil_check_first_page() and first page
+ is not compressed or encrypted. Page checksum is verified
+ after decompression (i.e. normally pages are already
+ decompressed at this stage). */
+ if ((page_type == FIL_PAGE_PAGE_COMPRESSED ||
+ page_type == FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED)
+ && space && FSP_FLAGS_HAS_PAGE_COMPRESSION(space->flags)) {
+ return (false);
+ }
+
+ if (!zip_size
&& memcmp(read_buf + FIL_PAGE_LSN + 4,
read_buf + UNIV_PAGE_SIZE
- FIL_PAGE_END_LSN_OLD_CHKSUM + 4, 4)) {
@@ -780,7 +762,7 @@ buf_page_is_corrupted(
/* Check whether the checksum fields have correct values */
if (srv_checksum_algorithm == SRV_CHECKSUM_ALGORITHM_NONE) {
- return(FALSE);
+ return(false);
}
if (zip_size) {
@@ -807,14 +789,14 @@ buf_page_is_corrupted(
ib_logf(IB_LOG_LEVEL_INFO,
"Checksum fields zero but page is not empty.");
- return(TRUE);
+ return(true);
}
}
- return(FALSE);
+ return(false);
}
- DBUG_EXECUTE_IF("buf_page_is_corrupt_failure", return(TRUE); );
+ DBUG_EXECUTE_IF("buf_page_is_corrupt_failure", return(true); );
ulint page_no = mach_read_from_4(read_buf + FIL_PAGE_OFFSET);
@@ -827,7 +809,7 @@ buf_page_is_corrupted(
if (buf_page_is_checksum_valid_crc32(read_buf,
checksum_field1, checksum_field2)) {
- return(FALSE);
+ return(false);
}
if (buf_page_is_checksum_valid_none(read_buf,
@@ -840,7 +822,7 @@ buf_page_is_corrupted(
space_id, page_no);
}
- return(FALSE);
+ return(false);
}
if (buf_page_is_checksum_valid_innodb(read_buf,
@@ -853,17 +835,17 @@ buf_page_is_corrupted(
space_id, page_no);
}
- return(FALSE);
+ return(false);
}
- return(TRUE);
+ return(true);
case SRV_CHECKSUM_ALGORITHM_INNODB:
case SRV_CHECKSUM_ALGORITHM_STRICT_INNODB:
if (buf_page_is_checksum_valid_innodb(read_buf,
checksum_field1, checksum_field2)) {
- return(FALSE);
+ return(false);
}
if (buf_page_is_checksum_valid_none(read_buf,
@@ -876,7 +858,7 @@ buf_page_is_corrupted(
space_id, page_no);
}
- return(FALSE);
+ return(false);
}
if (buf_page_is_checksum_valid_crc32(read_buf,
@@ -889,16 +871,16 @@ buf_page_is_corrupted(
space_id, page_no);
}
- return(FALSE);
+ return(false);
}
- return(TRUE);
+ return(true);
case SRV_CHECKSUM_ALGORITHM_STRICT_NONE:
if (buf_page_is_checksum_valid_none(read_buf,
checksum_field1, checksum_field2)) {
- return(FALSE);
+ return(false);
}
if (buf_page_is_checksum_valid_crc32(read_buf,
@@ -907,7 +889,7 @@ buf_page_is_corrupted(
curr_algo,
SRV_CHECKSUM_ALGORITHM_CRC32,
space_id, page_no);
- return(FALSE);
+ return(false);
}
if (buf_page_is_checksum_valid_innodb(read_buf,
@@ -916,10 +898,10 @@ buf_page_is_corrupted(
curr_algo,
SRV_CHECKSUM_ALGORITHM_INNODB,
space_id, page_no);
- return(FALSE);
+ return(false);
}
- return(TRUE);
+ return(true);
case SRV_CHECKSUM_ALGORITHM_NONE:
/* should have returned FALSE earlier */
@@ -929,7 +911,7 @@ buf_page_is_corrupted(
}
ut_error;
- return(FALSE);
+ return(false);
}
/********************************************************************//**
@@ -1198,12 +1180,8 @@ buf_block_init(
block->page.state = BUF_BLOCK_NOT_USED;
block->page.buf_fix_count = 0;
block->page.io_fix = BUF_IO_NONE;
- block->page.key_version = 0;
- block->page.page_encrypted = false;
- block->page.page_compressed = false;
block->page.encrypted = false;
- block->page.stored_checksum = BUF_NO_CHECKSUM_MAGIC;
- block->page.calculated_checksum = BUF_NO_CHECKSUM_MAGIC;
+ block->page.key_version = 0;
block->page.real_size = 0;
block->page.write_size = 0;
block->modify_clock = 0;
@@ -3026,14 +3004,14 @@ loop:
} else if (retries < BUF_PAGE_READ_MAX_RETRIES) {
++retries;
- bool corrupted = true;
+ bool corrupted = false;
if (bpage) {
corrupted = buf_page_check_corrupt(bpage);
}
/* Do not try again for encrypted pages */
- if (!corrupted) {
+ if (corrupted && bpage->encrypted) {
ib_mutex_t* pmutex = buf_page_get_mutex(bpage);
mutex_enter(&buf_pool->LRU_list_mutex);
mutex_enter(pmutex);
@@ -3062,14 +3040,14 @@ loop:
retries = BUF_PAGE_READ_MAX_RETRIES;
);
} else {
- bool corrupted = true;
+ bool corrupted = false;
if (bpage) {
corrupted = buf_page_check_corrupt(bpage);
}
- if (corrupted) {
- fprintf(stderr, "InnoDB: Error: Unable"
+ if (corrupted && !bpage->encrypted) {
+ ib_logf(IB_LOG_LEVEL_ERROR, "Unable"
" to read tablespace %lu page no"
" %lu into the buffer pool after"
" %lu attempts\n"
@@ -3880,12 +3858,8 @@ buf_page_init_low(
bpage->newest_modification = 0;
bpage->oldest_modification = 0;
bpage->write_size = 0;
- bpage->key_version = 0;
- bpage->stored_checksum = BUF_NO_CHECKSUM_MAGIC;
- bpage->calculated_checksum = BUF_NO_CHECKSUM_MAGIC;
- bpage->page_encrypted = false;
- bpage->page_compressed = false;
bpage->encrypted = false;
+ bpage->key_version = 0;
bpage->real_size = 0;
HASH_INVALIDATE(bpage, hash);
@@ -3924,15 +3898,6 @@ buf_page_init(
/* Set the state of the block */
buf_block_set_file_page(block, space, offset);
-#ifdef UNIV_DEBUG_VALGRIND
- if (!space) {
- /* Silence valid Valgrind warnings about uninitialized
- data being written to data files. There are some unused
- bytes on some pages that InnoDB does not initialize. */
- UNIV_MEM_VALID(block->frame, UNIV_PAGE_SIZE);
- }
-#endif /* UNIV_DEBUG_VALGRIND */
-
buf_block_init_low(block);
block->lock_hash_val = lock_rec_hash(space, offset);
@@ -4598,78 +4563,80 @@ buf_mark_space_corrupt(
Check if page is maybe compressed, encrypted or both when we encounter
corrupted page. Note that we can't be 100% sure if page is corrupted
or decrypt/decompress just failed.
-*/
-static
-ibool
+@param[in,out] bpage Page
+@return true if page corrupted, false if not */
+UNIV_INTERN
+bool
buf_page_check_corrupt(
-/*===================*/
- buf_page_t* bpage) /*!< in/out: buffer page read from disk */
+ buf_page_t* bpage)
{
ulint zip_size = buf_page_get_zip_size(bpage);
byte* dst_frame = (zip_size) ? bpage->zip.data :
((buf_block_t*) bpage)->frame;
- bool page_compressed = bpage->page_encrypted;
- ulint stored_checksum = bpage->stored_checksum;
- ulint calculated_checksum = bpage->calculated_checksum;
- bool page_compressed_encrypted = bpage->page_compressed;
- ulint space_id = mach_read_from_4(
- dst_frame + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID);
- fil_space_crypt_t* crypt_data = fil_space_get_crypt_data(space_id);
- fil_space_t* space = fil_space_found_by_id(space_id);
- bool corrupted = true;
- ulint key_version = bpage->key_version;
-
- if (key_version != 0 || page_compressed_encrypted) {
- bpage->encrypted = true;
+ ulint space_id = bpage->space;
+ fil_space_t* space = fil_space_acquire_silent(space_id);
+ bool still_encrypted = false;
+ bool corrupted = false;
+ ulint page_type = mach_read_from_2(dst_frame + FIL_PAGE_TYPE);
+ fil_space_crypt_t* crypt_data = NULL;
+
+ ut_ad(space);
+ crypt_data = space->crypt_data;
+
+ /* In buf_decrypt_after_read we have either decrypted the page if
+ page post encryption checksum matches and used key_id is found
+ from the encryption plugin. If checksum did not match page was
+ not decrypted and it could be either encrypted and corrupted
+ or corrupted or good page. If we decrypted, there page could
+ still be corrupted if used key does not match. */
+ still_encrypted = (crypt_data &&
+ crypt_data->type != CRYPT_SCHEME_UNENCRYPTED &&
+ !bpage->encrypted &&
+ fil_space_verify_crypt_checksum(dst_frame, zip_size,
+ space, bpage->offset));
+
+ if (!still_encrypted) {
+ /* If traditional checksums match, we assume that page is
+ not anymore encrypted. */
+ corrupted = buf_page_is_corrupted(true, dst_frame, zip_size, space);
+
+ if (!corrupted) {
+ bpage->encrypted = false;
+ }
}
- if (key_version != 0 ||
- (crypt_data && crypt_data->type != CRYPT_SCHEME_UNENCRYPTED) ||
- page_compressed || page_compressed_encrypted) {
-
- /* Page is really corrupted if post encryption stored
- checksum does not match calculated checksum after page was
- read. For pages compressed and then encrypted, there is no
- checksum. */
- corrupted = (!page_compressed_encrypted && stored_checksum != calculated_checksum);
+ /* Pages that we think are unencrypted but do not match the checksum
+ checks could be corrupted or encrypted or both. */
+ if (corrupted && !bpage->encrypted) {
+ ib_logf(IB_LOG_LEVEL_ERROR,
+ "%s: Block in space_id " ULINTPF " in file %s corrupted.",
+ page_type == FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED ? "Maybe corruption" : "Corruption",
+ space_id, (space && space->name) ? space->name : "NULL");
+ ib_logf(IB_LOG_LEVEL_ERROR,
+ "Based on page type %s (" ULINTPF ")",
+ fil_get_page_type_name(page_type), page_type);
+ } else if (still_encrypted || (bpage->encrypted && corrupted)) {
+ bpage->encrypted = true;
+ corrupted = true;
- if (corrupted) {
- ib_logf(IB_LOG_LEVEL_ERROR,
- "%s: Block in space_id %lu in file %s corrupted.",
- page_compressed_encrypted ? "Maybe corruption" : "Corruption",
- space_id, space ? space->name : "NULL");
- ib_logf(IB_LOG_LEVEL_ERROR,
- "Page based on contents %s encrypted.",
- (key_version == 0 && page_compressed_encrypted == false) ? "not" : "maybe");
- if (stored_checksum != BUF_NO_CHECKSUM_MAGIC || calculated_checksum != BUF_NO_CHECKSUM_MAGIC) {
- ib_logf(IB_LOG_LEVEL_ERROR,
- "Page stored checksum %lu but calculated checksum %lu.",
- stored_checksum, calculated_checksum);
- }
- ib_logf(IB_LOG_LEVEL_ERROR,
- "Reason could be that key_version %lu in page "
- "or in crypt_data %p could not be found.",
- key_version, crypt_data);
- ib_logf(IB_LOG_LEVEL_ERROR,
- "Reason could be also that key management plugin is not found or"
- " used encryption algorithm or method does not match.");
- ib_logf(IB_LOG_LEVEL_ERROR,
- "Based on page page compressed %d, compressed and encrypted %d.",
- page_compressed, page_compressed_encrypted);
- } else {
- ib_logf(IB_LOG_LEVEL_ERROR,
- "Block in space_id %lu in file %s encrypted.",
- space_id, space ? space->name : "NULL");
- ib_logf(IB_LOG_LEVEL_ERROR,
- "However key management plugin or used key_id %lu is not found or"
+ ib_logf(IB_LOG_LEVEL_ERROR,
+ "Block in space_id " ULINTPF " in file %s encrypted.",
+ space_id, (space && space->name) ? space->name : "NULL");
+ ib_logf(IB_LOG_LEVEL_ERROR,
+ "However key management plugin or used key_version %u is not found or"
" used encryption algorithm or method does not match.",
- key_version);
+ bpage->key_version);
+ if (space_id > TRX_SYS_SPACE) {
ib_logf(IB_LOG_LEVEL_ERROR,
"Marking tablespace as missing. You may drop this table or"
" install correct key management plugin and key file.");
}
}
+ if (space) {
+ fil_space_release(space);
+ }
+
return corrupted;
}
@@ -4689,6 +4656,8 @@ buf_page_io_complete(
== BUF_BLOCK_FILE_PAGE);
bool have_LRU_mutex = false;
fil_space_t* space = NULL;
+ byte* frame = NULL;
+ bool corrupted = false;
ut_a(buf_page_in_file(bpage));
@@ -4704,21 +4673,13 @@ buf_page_io_complete(
if (io_type == BUF_IO_READ) {
ulint read_page_no;
ulint read_space_id;
- byte* frame;
- if (!buf_page_decrypt_after_read(bpage)) {
- /* encryption error! */
- if (buf_page_get_zip_size(bpage)) {
- frame = bpage->zip.data;
- } else {
- frame = ((buf_block_t*) bpage)->frame;
- }
-
- ib_logf(IB_LOG_LEVEL_INFO,
- "Page %u in tablespace %u encryption error key_version %u.",
- bpage->offset, bpage->space, bpage->key_version);
+ buf_page_decrypt_after_read(bpage);
- goto database_corrupted;
+ if (buf_page_get_zip_size(bpage)) {
+ frame = bpage->zip.data;
+ } else {
+ frame = ((buf_block_t*) bpage)->frame;
}
if (buf_page_get_zip_size(bpage)) {
@@ -4735,6 +4696,8 @@ buf_page_io_complete(
"Page %u in tablespace %u zip_decompress failure.",
bpage->offset, bpage->space);
+ corrupted = true;
+
goto database_corrupted;
}
os_atomic_decrement_ulint(&buf_pool->n_pend_unzip, 1);
@@ -4773,7 +4736,7 @@ buf_page_io_complete(
fprintf(stderr,
" InnoDB: Error: space id and page n:o"
" stored in the page\n"
- "InnoDB: read in are %lu:%lu,"
+ "InnoDB: read in are " ULINTPF ":" ULINTPF ","
" should be %u:%u!\n",
read_space_id,
read_page_no,
@@ -4783,121 +4746,116 @@ buf_page_io_complete(
if (UNIV_LIKELY(!bpage->is_corrupt ||
!srv_pass_corrupt_table)) {
- /* From version 3.23.38 up we store the page checksum
- to the 4 first bytes of the page end lsn field */
-
- if (buf_page_is_corrupted(true, frame,
- buf_page_get_zip_size(bpage))) {
-
- /* 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
- && buf_mark_space_corrupt(bpage)) {
- ib_logf(IB_LOG_LEVEL_INFO,
- "Simulated page corruption");
- return(true);
- }
- goto page_not_corrupt;
- ;);
+ corrupted = buf_page_check_corrupt(bpage);
+
+ }
+
database_corrupted:
- bool corrupted = buf_page_check_corrupt(bpage);
+ if (corrupted) {
+ /* 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
+ && buf_mark_space_corrupt(bpage)) {
+ ib_logf(IB_LOG_LEVEL_INFO,
+ "Simulated page corruption");
+ return(true);
+ }
+ goto page_not_corrupt;
+ );
- if (corrupted) {
- fil_system_enter();
- space = fil_space_get_by_id(bpage->space);
- fil_system_exit();
- ib_logf(IB_LOG_LEVEL_ERROR,
- "Database page corruption on disk"
- " or a failed");
- ib_logf(IB_LOG_LEVEL_ERROR,
- "Space %u file %s read of page %u.",
- bpage->space,
- space ? space->name : "NULL",
- bpage->offset);
- ib_logf(IB_LOG_LEVEL_ERROR,
- "You may have to recover"
- " from a backup.");
+ if (!bpage->encrypted) {
+ fil_system_enter();
+ space = fil_space_get_by_id(bpage->space);
+ fil_system_exit();
+ ib_logf(IB_LOG_LEVEL_ERROR,
+ "Database page corruption on disk"
+ " or a failed");
+ ib_logf(IB_LOG_LEVEL_ERROR,
+ "Space %u file %s read of page %u.",
+ bpage->space,
+ space->name ? space->name : "NULL",
+ bpage->offset);
+ ib_logf(IB_LOG_LEVEL_ERROR,
+ "You may have to recover"
+ " from a backup.");
+ buf_page_print(frame, buf_page_get_zip_size(bpage),
+ BUF_PAGE_PRINT_NO_CRASH);
- buf_page_print(frame, buf_page_get_zip_size(bpage),
- BUF_PAGE_PRINT_NO_CRASH);
+ ib_logf(IB_LOG_LEVEL_ERROR,
+ "It is also possible that your operating"
+ "system has corrupted its own file cache.");
+ ib_logf(IB_LOG_LEVEL_ERROR,
+ "and rebooting your computer removes the error.");
+ ib_logf(IB_LOG_LEVEL_ERROR,
+ "If the corrupt page is an index page you can also try to");
+ ib_logf(IB_LOG_LEVEL_ERROR,
+ "fix the corruption by dumping, dropping, and reimporting");
+ ib_logf(IB_LOG_LEVEL_ERROR,
+ "the corrupt table. You can use CHECK");
+ ib_logf(IB_LOG_LEVEL_ERROR,
+ "TABLE to scan your table for corruption.");
+ ib_logf(IB_LOG_LEVEL_ERROR,
+ "See also "
+ REFMAN "forcing-innodb-recovery.html"
+ " about forcing recovery.");
+ }
- ib_logf(IB_LOG_LEVEL_ERROR,
- "It is also possible that your operating"
- "system has corrupted its own file cache.");
- ib_logf(IB_LOG_LEVEL_ERROR,
- "and rebooting your computer removes the error.");
- ib_logf(IB_LOG_LEVEL_ERROR,
- "If the corrupt page is an index page you can also try to");
- ib_logf(IB_LOG_LEVEL_ERROR,
- "fix the corruption by dumping, dropping, and reimporting");
- ib_logf(IB_LOG_LEVEL_ERROR,
- "the corrupt table. You can use CHECK");
- ib_logf(IB_LOG_LEVEL_ERROR,
- "TABLE to scan your table for corruption.");
- ib_logf(IB_LOG_LEVEL_ERROR,
- "See also "
- REFMAN "forcing-innodb-recovery.html"
- " about forcing recovery.");
+ if (srv_pass_corrupt_table && bpage->space != 0
+ && bpage->space < SRV_LOG_SPACE_FIRST_ID) {
+ trx_t* trx;
+
+ fprintf(stderr,
+ "InnoDB: space %u will be treated as corrupt.\n",
+ bpage->space);
+ fil_space_set_corrupt(bpage->space);
+
+ trx = innobase_get_trx();
+
+ if (trx && trx->dict_operation_lock_mode == RW_X_LATCH) {
+ dict_table_set_corrupt_by_space(bpage->space, FALSE);
+ } else {
+ dict_table_set_corrupt_by_space(bpage->space, TRUE);
}
- if (srv_pass_corrupt_table && bpage->space != 0
- && bpage->space < SRV_LOG_SPACE_FIRST_ID) {
- trx_t* trx;
+ bpage->is_corrupt = TRUE;
+ }
- fprintf(stderr,
- "InnoDB: space %u will be treated as corrupt.\n",
- bpage->space);
- fil_space_set_corrupt(bpage->space);
+ if (srv_force_recovery < SRV_FORCE_IGNORE_CORRUPT) {
+ /* If page space id is larger than TRX_SYS_SPACE
+ (0), we will attempt to mark the corresponding
+ table as corrupted instead of crashing server */
+ if (bpage->space > TRX_SYS_SPACE
+ && buf_mark_space_corrupt(bpage)) {
+ return(false);
+ } else {
+ if (!bpage->encrypted) {
+ ib_logf(IB_LOG_LEVEL_ERROR,
+ "Ending processing because of a corrupt database page.");
- trx = innobase_get_trx();
- if (trx && trx->dict_operation_lock_mode == RW_X_LATCH) {
- dict_table_set_corrupt_by_space(bpage->space, FALSE);
- } else {
- dict_table_set_corrupt_by_space(bpage->space, TRUE);
+ ut_error;
}
- bpage->is_corrupt = TRUE;
- }
- if (srv_force_recovery < SRV_FORCE_IGNORE_CORRUPT) {
- /* If page space id is larger than TRX_SYS_SPACE
- (0), we will attempt to mark the corresponding
- table as corrupted instead of crashing server */
- if (bpage->space > TRX_SYS_SPACE
- && buf_mark_space_corrupt(bpage)) {
- return(false);
+ ib_push_warning(innobase_get_trx(), DB_DECRYPTION_FAILED,
+ "Table in tablespace %lu encrypted."
+ "However key management plugin or used key_id %lu is not found or"
+ " used encryption algorithm or method does not match."
+ " Can't continue opening the table.",
+ bpage->space, bpage->key_version);
+
+ if (bpage->encrypted && bpage->space > TRX_SYS_SPACE) {
+ buf_mark_space_corrupt(bpage);
} else {
- corrupted = buf_page_check_corrupt(bpage);
- ulint key_version = bpage->key_version;
-
- if (corrupted) {
- ib_logf(IB_LOG_LEVEL_ERROR,
- "Ending processing because of a corrupt database page.");
-
- ut_error;
- }
-
- ib_push_warning(innobase_get_trx(), DB_DECRYPTION_FAILED,
- "Table in tablespace %lu encrypted."
- "However key management plugin or used key_id %lu is not found or"
- " used encryption algorithm or method does not match."
- " Can't continue opening the table.",
- (ulint)bpage->space, key_version);
-
- if (bpage->space > TRX_SYS_SPACE) {
- if (corrupted) {
- buf_mark_space_corrupt(bpage);
- }
- } else {
- ut_error;
- }
- return(false);
+ ut_error;
}
+
+ return(false);
}
}
- } /**/
+ }
DBUG_EXECUTE_IF("buf_page_is_corrupt_failure",
page_not_corrupt: bpage = bpage; );
@@ -4912,32 +4870,19 @@ database_corrupted:
&& fil_page_get_type(frame) == FIL_PAGE_INDEX
&& page_is_leaf(frame)) {
- buf_block_t* block;
- ibool update_ibuf_bitmap;
-
- if (UNIV_UNLIKELY(bpage->is_corrupt &&
- srv_pass_corrupt_table)) {
-
- block = NULL;
- update_ibuf_bitmap = FALSE;
- } else {
-
- block = (buf_block_t *) bpage;
- update_ibuf_bitmap = TRUE;
- }
-
if (bpage && bpage->encrypted) {
- fprintf(stderr,
- "InnoDB: Warning: Table in tablespace %lu encrypted."
- "However key management plugin or used key_id %u is not found or"
+ ib_logf(IB_LOG_LEVEL_WARN,
+ "Table in tablespace %lu encrypted."
+ "However key management plugin or used key_version %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);
} else {
+
ibuf_merge_or_delete_for_page(
- block, bpage->space,
+ (buf_block_t*)bpage, bpage->space,
bpage->offset, buf_page_get_zip_size(bpage),
- update_ibuf_bitmap);
+ TRUE);
}
}
@@ -5081,24 +5026,22 @@ buf_all_freed_instance(
mutex_exit(&buf_pool->LRU_list_mutex);
- if (UNIV_LIKELY_NULL(block)) {
- if (block->page.key_version == 0) {
- fil_space_t* space = fil_space_get(block->page.space);
- ib_logf(IB_LOG_LEVEL_ERROR,
- "Page %u %u still fixed or dirty.",
- block->page.space,
- block->page.offset);
- ib_logf(IB_LOG_LEVEL_ERROR,
- "Page oldest_modification %lu fix_count %d io_fix %d.",
- (ulong) block->page.oldest_modification,
- block->page.buf_fix_count,
- buf_page_get_io_fix(&block->page));
- ib_logf(IB_LOG_LEVEL_ERROR,
- "Page space_id %u name %s.",
- block->page.space,
- (space && space->name) ? space->name : "NULL");
- ut_error;
- }
+ if (UNIV_LIKELY_NULL(block) && block->page.key_version == 0) {
+ fil_space_t* space = fil_space_get(block->page.space);
+ ib_logf(IB_LOG_LEVEL_ERROR,
+ "Page %u %u still fixed or dirty.",
+ block->page.space,
+ block->page.offset);
+ ib_logf(IB_LOG_LEVEL_ERROR,
+ "Page oldest_modification " LSN_PF
+ " fix_count %d io_fix %d.",
+ block->page.oldest_modification,
+ block->page.buf_fix_count,
+ buf_page_get_io_fix(&block->page));
+ ib_logf(IB_LOG_LEVEL_FATAL,
+ "Page space_id %u name %s.",
+ block->page.space,
+ (space && space->name) ? space->name : "NULL");
}
}
@@ -6304,21 +6247,17 @@ buf_pool_reserve_tmp_slot(
/********************************************************************//**
Encrypts a buffer page right before it's flushed to disk
+@param[in,out] bpage Page control block
+@param[in,out] src_frame Source page
+@param[in] space_id Tablespace id
+@return either unencrypted source page or decrypted page.
*/
byte*
buf_page_encrypt_before_write(
-/*==========================*/
- buf_page_t* bpage, /*!< in/out: buffer page to be flushed */
- byte* src_frame, /*!< in: src frame */
- ulint space_id) /*!< in: space id */
+ buf_page_t* bpage,
+ byte* src_frame,
+ ulint space_id)
{
- fil_space_crypt_t* crypt_data = fil_space_get_crypt_data(space_id);
- ulint zip_size = buf_page_get_zip_size(bpage);
- ulint page_size = (zip_size) ? zip_size : UNIV_PAGE_SIZE;
- buf_pool_t* buf_pool = buf_pool_from_bpage(bpage);
- bool page_compressed = fil_space_is_page_compressed(bpage->space);
- bool encrypted = true;
-
bpage->real_size = UNIV_PAGE_SIZE;
fil_page_type_validate(src_frame);
@@ -6335,7 +6274,20 @@ buf_page_encrypt_before_write(
return src_frame;
}
- if (crypt_data != NULL && crypt_data->not_encrypted()) {
+ fil_space_t* space = fil_space_acquire_silent(space_id);
+
+ /* Tablespace must exist during write operation */
+ if (!space) {
+ /* This could be true on discard if we have injected a error
+ case e.g. in innodb.innodb-wl5522-debug-zip so that space
+ is already marked as stop_new_ops = true. */
+ return src_frame;
+ }
+
+ fil_space_crypt_t* crypt_data = space->crypt_data;
+ bool encrypted = true;
+
+ if (space->crypt_data != NULL && space->crypt_data->not_encrypted()) {
/* Encryption is disabled */
encrypted = false;
}
@@ -6352,11 +6304,17 @@ buf_page_encrypt_before_write(
encrypted = false;
}
+ bool page_compressed = fil_space_is_page_compressed(bpage->space);
+
if (!encrypted && !page_compressed) {
/* No need to encrypt or page compress the page */
+ fil_space_release(space);
return src_frame;
}
+ ulint zip_size = buf_page_get_zip_size(bpage);
+ ulint page_size = (zip_size) ? zip_size : UNIV_PAGE_SIZE;
+ buf_pool_t* buf_pool = buf_pool_from_bpage(bpage);
/* Find free slot from temporary memory array */
buf_tmp_buffer_t* slot = buf_pool_reserve_tmp_slot(buf_pool, page_compressed);
slot->out_buf = NULL;
@@ -6366,11 +6324,10 @@ buf_page_encrypt_before_write(
if (!page_compressed) {
/* Encrypt page content */
- byte* tmp = fil_space_encrypt(bpage->space,
+ byte* tmp = fil_space_encrypt(space,
bpage->offset,
bpage->newest_modification,
src_frame,
- zip_size,
dst_frame);
ulint key_version = mach_read_from_4(dst_frame + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION);
@@ -6408,11 +6365,10 @@ buf_page_encrypt_before_write(
if(encrypted) {
/* And then we encrypt the page content */
- tmp = fil_space_encrypt(bpage->space,
+ tmp = fil_space_encrypt(space,
bpage->offset,
bpage->newest_modification,
tmp,
- zip_size,
dst_frame);
}
@@ -6423,17 +6379,20 @@ buf_page_encrypt_before_write(
fil_page_type_validate(dst_frame);
#endif
+ fil_space_release(space);
// return dst_frame which will be written
return dst_frame;
}
/********************************************************************//**
Decrypt page after it has been read from disk
+@param[in,out] bpage Page control block
+@return true if successfull, false if something went wrong
*/
-ibool
+UNIV_INTERN
+bool
buf_page_decrypt_after_read(
-/*========================*/
- buf_page_t* bpage) /*!< in/out: buffer page read from disk */
+ buf_page_t* bpage)
{
ulint zip_size = buf_page_get_zip_size(bpage);
ulint size = (zip_size) ? zip_size : UNIV_PAGE_SIZE;
@@ -6446,53 +6405,25 @@ buf_page_decrypt_after_read(
bool page_compressed_encrypted = fil_page_is_compressed_encrypted(dst_frame);
buf_pool_t* buf_pool = buf_pool_from_bpage(bpage);
bool success = true;
- ulint space_id = mach_read_from_4(
- dst_frame + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID);
- fil_space_crypt_t* crypt_data = fil_space_get_crypt_data(space_id);
- /* Page is encrypted if encryption information is found from
- tablespace and page contains used key_version. This is true
- also for pages first compressed and then encrypted. */
- if (!crypt_data ||
- (crypt_data &&
- crypt_data->type == CRYPT_SCHEME_UNENCRYPTED &&
- key_version != 0)) {
- byte* frame = NULL;
-
- if (buf_page_get_zip_size(bpage)) {
- frame = bpage->zip.data;
- } else {
- frame = ((buf_block_t*) bpage)->frame;
- }
+ bpage->key_version = key_version;
- /* If page is not corrupted at this point, page can't be
- encrypted, thus set key_version to 0. If page is corrupted,
- we assume at this point that it is encrypted as page
- contained key_version != 0. Note that page could still be
- really corrupted. This we will find out after decrypt by
- checking page checksums. */
- if (!buf_page_is_corrupted(false, frame, buf_page_get_zip_size(bpage))) {
- key_version = 0;
- }
+ if (bpage->offset == 0) {
+ /* File header pages are not encrypted/compressed */
+ return (true);
}
- /* If page is encrypted read post-encryption checksum */
- if (!page_compressed_encrypted && key_version != 0) {
- bpage->stored_checksum = mach_read_from_4(dst_frame + + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION + 4);
- }
+ fil_space_t* space = fil_space_acquire(bpage->space);
- ut_ad(bpage->key_version == 0);
+ fil_space_crypt_t* crypt_data = space->crypt_data;
- if (bpage->offset == 0) {
- /* File header pages are not encrypted/compressed */
- return (TRUE);
+ /* Page is encrypted if encryption information is found from
+ tablespace and page contains used key_version. This is true
+ also for pages first compressed and then encrypted. */
+ if (!crypt_data) {
+ key_version = 0;
}
- /* Store these for corruption check */
- bpage->key_version = key_version;
- bpage->page_encrypted = page_compressed_encrypted;
- bpage->page_compressed = page_compressed;
-
if (page_compressed) {
/* the page we read is unencrypted */
/* Find free slot from temporary memory array */
@@ -6519,6 +6450,13 @@ buf_page_decrypt_after_read(
buf_tmp_buffer_t* slot = NULL;
if (key_version) {
+ /* Verify encryption checksum before we even try to
+ decrypt. */
+ if (!fil_space_verify_crypt_checksum(dst_frame,
+ zip_size, NULL, bpage->offset)) {
+ return (false);
+ }
+
/* Find free slot from temporary memory array */
slot = buf_pool_reserve_tmp_slot(buf_pool, page_compressed);
@@ -6526,22 +6464,16 @@ buf_page_decrypt_after_read(
fil_page_type_validate(dst_frame);
#endif
- /* Calculate checksum before decrypt, this will be
- used later to find out if incorrect key was used. */
- if (!page_compressed_encrypted) {
- bpage->calculated_checksum = fil_crypt_calculate_checksum(zip_size, dst_frame);
- }
-
/* decrypt using crypt_buf to dst_frame */
- byte* res = fil_space_decrypt(bpage->space,
+ byte* res = fil_space_decrypt(space,
slot->crypt_buf,
- size,
- dst_frame);
+ dst_frame,
+ &bpage->encrypted);
if (!res) {
- bpage->encrypted = true;
success = false;
}
+
#ifdef UNIV_DEBUG
fil_page_type_validate(dst_frame);
#endif
@@ -6572,7 +6504,6 @@ buf_page_decrypt_after_read(
}
}
- bpage->key_version = key_version;
-
+ fil_space_release(space);
return (success);
}
diff --git a/storage/xtradb/buf/buf0dblwr.cc b/storage/xtradb/buf/buf0dblwr.cc
index 68bb83e4903..b11c32064bf 100644
--- a/storage/xtradb/buf/buf0dblwr.cc
+++ b/storage/xtradb/buf/buf0dblwr.cc
@@ -382,13 +382,7 @@ buf_dblwr_init_or_load_pages(
doublewrite = read_buf + TRX_SYS_DOUBLEWRITE;
- if (mach_read_from_4(read_buf + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION) != 0) {
- byte* tmp = fil_space_decrypt((ulint)TRX_SYS_SPACE,
- read_buf + UNIV_PAGE_SIZE,
- UNIV_PAGE_SIZE, /* page size */
- read_buf);
- doublewrite = tmp + TRX_SYS_DOUBLEWRITE;
- }
+ /* TRX_SYS_PAGE_NO is not encrypted see fil_crypt_rotate_page() */
if (mach_read_from_4(doublewrite + TRX_SYS_DOUBLEWRITE_MAGIC)
== TRX_SYS_DOUBLEWRITE_MAGIC_N) {
@@ -514,6 +508,7 @@ buf_dblwr_process()
continue;
}
+ fil_space_t* space = fil_space_found_by_id(space_id);
ulint zip_size = fil_space_get_zip_size(space_id);
ut_ad(!buf_page_is_zeroes(page, zip_size));
@@ -548,9 +543,9 @@ buf_dblwr_process()
}
if (fil_space_verify_crypt_checksum(
- read_buf, zip_size)
+ read_buf, zip_size, NULL, page_no)
|| !buf_page_is_corrupted(
- true, read_buf, zip_size)) {
+ true, read_buf, zip_size, space)) {
/* The page is good; there is no need
to consult the doublewrite buffer. */
continue;
@@ -573,8 +568,8 @@ buf_dblwr_process()
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 (!fil_space_verify_crypt_checksum(page, zip_size, NULL, page_no)
+ && buf_page_is_corrupted(true, page, zip_size, space)) {
if (!is_all_zero) {
ib_logf(IB_LOG_LEVEL_WARN,
"A doublewrite copy of page "
diff --git a/storage/xtradb/buf/buf0dump.cc b/storage/xtradb/buf/buf0dump.cc
index 6abf7375775..e728636042b 100644
--- a/storage/xtradb/buf/buf0dump.cc
+++ b/storage/xtradb/buf/buf0dump.cc
@@ -53,8 +53,8 @@ enum status_severity {
/* Flags that tell the buffer pool dump/load thread which action should it
take after being waked up. */
-static ibool buf_dump_should_start = FALSE;
-static ibool buf_load_should_start = FALSE;
+static volatile bool buf_dump_should_start;
+static volatile bool buf_load_should_start;
static ibool buf_load_abort_flag = FALSE;
@@ -79,7 +79,7 @@ void
buf_dump_start()
/*============*/
{
- buf_dump_should_start = TRUE;
+ buf_dump_should_start = true;
os_event_set(srv_buf_dump_event);
}
@@ -93,7 +93,7 @@ void
buf_load_start()
/*============*/
{
- buf_load_should_start = TRUE;
+ buf_load_should_start = true;
os_event_set(srv_buf_dump_event);
}
@@ -699,15 +699,18 @@ DECLARE_THREAD(buf_dump_thread)(void*)
os_event_wait(srv_buf_dump_event);
if (buf_dump_should_start) {
- buf_dump_should_start = FALSE;
+ buf_dump_should_start = false;
buf_dump(TRUE /* quit on shutdown */);
}
if (buf_load_should_start) {
- buf_load_should_start = FALSE;
+ buf_load_should_start = false;
buf_load();
}
+ if (buf_dump_should_start || buf_load_should_start) {
+ continue;
+ }
os_event_reset(srv_buf_dump_event);
}
diff --git a/storage/xtradb/buf/buf0flu.cc b/storage/xtradb/buf/buf0flu.cc
index 09f07bbd696..e7ed7204920 100644
--- a/storage/xtradb/buf/buf0flu.cc
+++ b/storage/xtradb/buf/buf0flu.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
-Copyright (c) 1995, 2016, Oracle and/or its affiliates
-Copyright (c) 2013, 2016, MariaDB
+Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2013, 2017, MariaDB Corporation. All Rights Reserved.
Copyright (c) 2013, 2014, Fusion-io
This program is free software; you can redistribute it and/or modify it under
diff --git a/storage/xtradb/buf/buf0lru.cc b/storage/xtradb/buf/buf0lru.cc
index 579166753c4..dff67c0fad6 100644
--- a/storage/xtradb/buf/buf0lru.cc
+++ b/storage/xtradb/buf/buf0lru.cc
@@ -1301,6 +1301,71 @@ buf_LRU_check_size_of_non_data_objects(
}
}
+/** Diagnose failure to get a free page and request InnoDB monitor output in
+the error log if more than two seconds have been spent already.
+@param[in] n_iterations how many buf_LRU_get_free_page iterations
+ already completed
+@param[in] started_ms timestamp in ms of when the attempt to get the
+ free page started
+@param[in] flush_failures how many times single-page flush, if allowed,
+ has failed
+@param[out] mon_value_was previous srv_print_innodb_monitor value
+@param[out] started_monitor whether InnoDB monitor print has been requested
+*/
+static
+void
+buf_LRU_handle_lack_of_free_blocks(ulint n_iterations, ulint started_ms,
+ ulint flush_failures,
+ ibool *mon_value_was,
+ ibool *started_monitor)
+{
+ static ulint last_printout_ms = 0;
+
+ /* Legacy algorithm started warning after at least 2 seconds, we
+ emulate this. */
+ const ulint current_ms = ut_time_ms();
+
+ if ((current_ms > started_ms + 2000)
+ && (current_ms > last_printout_ms + 2000)) {
+
+ ut_print_timestamp(stderr);
+ fprintf(stderr,
+ " InnoDB: Warning: difficult to find free blocks in\n"
+ "InnoDB: the buffer pool (%lu search iterations)!\n"
+ "InnoDB: %lu failed attempts to flush a page!"
+ " Consider\n"
+ "InnoDB: increasing the buffer pool size.\n"
+ "InnoDB: It is also possible that"
+ " in your Unix version\n"
+ "InnoDB: fsync is very slow, or"
+ " completely frozen inside\n"
+ "InnoDB: the OS kernel. Then upgrading to"
+ " a newer version\n"
+ "InnoDB: of your operating system may help."
+ " Look at the\n"
+ "InnoDB: number of fsyncs in diagnostic info below.\n"
+ "InnoDB: Pending flushes (fsync) log: %lu;"
+ " buffer pool: %lu\n"
+ "InnoDB: %lu OS file reads, %lu OS file writes,"
+ " %lu OS fsyncs\n"
+ "InnoDB: Starting InnoDB Monitor to print further\n"
+ "InnoDB: diagnostics to the standard output.\n",
+ (ulong) n_iterations,
+ (ulong) flush_failures,
+ (ulong) fil_n_pending_log_flushes,
+ (ulong) fil_n_pending_tablespace_flushes,
+ (ulong) os_n_file_reads, (ulong) os_n_file_writes,
+ (ulong) os_n_fsyncs);
+
+ last_printout_ms = current_ms;
+ *mon_value_was = srv_print_innodb_monitor;
+ *started_monitor = TRUE;
+ srv_print_innodb_monitor = TRUE;
+ os_event_set(lock_sys->timeout_event);
+ }
+
+}
+
/** The maximum allowed backoff sleep time duration, microseconds */
#define MAX_FREE_LIST_BACKOFF_SLEEP 10000
@@ -1348,6 +1413,7 @@ buf_LRU_get_free_block(
ulint flush_failures = 0;
ibool mon_value_was = FALSE;
ibool started_monitor = FALSE;
+ ulint started_ms = 0;
ut_ad(!mutex_own(&buf_pool->LRU_list_mutex));
@@ -1356,7 +1422,24 @@ loop:
buf_LRU_check_size_of_non_data_objects(buf_pool);
/* If there is a block in the free list, take it */
- block = buf_LRU_get_free_only(buf_pool);
+ if (DBUG_EVALUATE_IF("simulate_lack_of_pages", true, false)) {
+
+ block = NULL;
+
+ if (srv_debug_monitor_printed)
+ DBUG_SET("-d,simulate_lack_of_pages");
+
+ } else if (DBUG_EVALUATE_IF("simulate_recovery_lack_of_pages",
+ recv_recovery_on, false)) {
+
+ block = NULL;
+
+ if (srv_debug_monitor_printed)
+ DBUG_SUICIDE();
+ } else {
+
+ block = buf_LRU_get_free_only(buf_pool);
+ }
if (block) {
@@ -1371,6 +1454,9 @@ loop:
return(block);
}
+ if (!started_ms)
+ started_ms = ut_time_ms();
+
if (srv_empty_free_list_algorithm == SRV_EMPTY_FREE_LIST_BACKOFF
&& buf_lru_manager_is_active
&& (srv_shutdown_state == SRV_SHUTDOWN_NONE
@@ -1408,11 +1494,17 @@ loop:
: FREE_LIST_BACKOFF_LOW_PRIO_DIVIDER));
}
- /* In case of backoff, do not ever attempt single page flushes
- and wait for the cleaner to free some pages instead. */
+ buf_LRU_handle_lack_of_free_blocks(n_iterations, started_ms,
+ flush_failures,
+ &mon_value_was,
+ &started_monitor);
n_iterations++;
+ srv_stats.buf_pool_wait_free.add(n_iterations, 1);
+
+ /* In case of backoff, do not ever attempt single page flushes
+ and wait for the cleaner to free some pages instead. */
goto loop;
} else {
@@ -1444,6 +1536,12 @@ loop:
mutex_exit(&buf_pool->flush_state_mutex);
+ if (DBUG_EVALUATE_IF("simulate_recovery_lack_of_pages", true, false)
+ || DBUG_EVALUATE_IF("simulate_lack_of_pages", true, false)) {
+
+ buf_pool->try_LRU_scan = false;
+ }
+
freed = FALSE;
if (buf_pool->try_LRU_scan || n_iterations > 0) {
@@ -1469,41 +1567,9 @@ loop:
}
- if (n_iterations > 20) {
- ut_print_timestamp(stderr);
- fprintf(stderr,
- " InnoDB: Warning: difficult to find free blocks in\n"
- "InnoDB: the buffer pool (%lu search iterations)!\n"
- "InnoDB: %lu failed attempts to flush a page!"
- " Consider\n"
- "InnoDB: increasing the buffer pool size.\n"
- "InnoDB: It is also possible that"
- " in your Unix version\n"
- "InnoDB: fsync is very slow, or"
- " completely frozen inside\n"
- "InnoDB: the OS kernel. Then upgrading to"
- " a newer version\n"
- "InnoDB: of your operating system may help."
- " Look at the\n"
- "InnoDB: number of fsyncs in diagnostic info below.\n"
- "InnoDB: Pending flushes (fsync) log: %lu;"
- " buffer pool: %lu\n"
- "InnoDB: %lu OS file reads, %lu OS file writes,"
- " %lu OS fsyncs\n"
- "InnoDB: Starting InnoDB Monitor to print further\n"
- "InnoDB: diagnostics to the standard output.\n",
- (ulong) n_iterations,
- (ulong) flush_failures,
- (ulong) fil_n_pending_log_flushes,
- (ulong) fil_n_pending_tablespace_flushes,
- (ulong) os_n_file_reads, (ulong) os_n_file_writes,
- (ulong) os_n_fsyncs);
-
- mon_value_was = srv_print_innodb_monitor;
- started_monitor = TRUE;
- srv_print_innodb_monitor = TRUE;
- os_event_set(srv_monitor_event);
- }
+ buf_LRU_handle_lack_of_free_blocks(n_iterations, started_ms,
+ flush_failures, &mon_value_was,
+ &started_monitor);
/* If we have scanned the whole LRU and still are unable to
find a free block then we should sleep here to let the
diff --git a/storage/xtradb/buf/buf0mtflu.cc b/storage/xtradb/buf/buf0mtflu.cc
index f0480cfc169..f90b1e46c1e 100644
--- a/storage/xtradb/buf/buf0mtflu.cc
+++ b/storage/xtradb/buf/buf0mtflu.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (C) 2013, 2014, Fusion-io. All Rights Reserved.
-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
@@ -486,14 +486,13 @@ buf_mtflu_handler_init(
mtflush_heap2 = mem_heap_create(0);
ut_a(mtflush_heap2 != NULL);
- mtflush_ctx = (thread_sync_t *)mem_heap_alloc(mtflush_heap,
+ mtflush_ctx = (thread_sync_t *)mem_heap_zalloc(mtflush_heap,
sizeof(thread_sync_t));
- memset(mtflush_ctx, 0, sizeof(thread_sync_t));
+
ut_a(mtflush_ctx != NULL);
- mtflush_ctx->thread_data = (thread_data_t*)mem_heap_alloc(
+ mtflush_ctx->thread_data = (thread_data_t*)mem_heap_zalloc(
mtflush_heap, sizeof(thread_data_t) * n_threads);
ut_a(mtflush_ctx->thread_data);
- memset(mtflush_ctx->thread_data, 0, sizeof(thread_data_t) * n_threads);
mtflush_ctx->n_threads = n_threads;
mtflush_ctx->wq = ib_wqueue_create();
diff --git a/storage/xtradb/dict/dict0dict.cc b/storage/xtradb/dict/dict0dict.cc
index 90936f6667b..49de1cf7ef8 100644
--- a/storage/xtradb/dict/dict0dict.cc
+++ b/storage/xtradb/dict/dict0dict.cc
@@ -6214,7 +6214,6 @@ dict_set_corrupted(
row_mysql_lock_data_dictionary(trx);
}
- ut_ad(index);
ut_ad(mutex_own(&dict_sys->mutex));
ut_ad(!dict_table_is_comp(dict_sys->sys_tables));
ut_ad(!dict_table_is_comp(dict_sys->sys_indexes));
diff --git a/storage/xtradb/dict/dict0stats.cc b/storage/xtradb/dict/dict0stats.cc
index c13d4583fef..6a28f3cdf8f 100644
--- a/storage/xtradb/dict/dict0stats.cc
+++ b/storage/xtradb/dict/dict0stats.cc
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 2009, 2015, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2009, 2016, Oracle and/or its affiliates. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -1161,7 +1161,8 @@ dict_stats_analyze_index_level(
them away) which brings non-determinism. We skip only
leaf-level delete marks because delete marks on
non-leaf level do not make sense. */
- if (level == 0 &&
+
+ if (level == 0 && srv_stats_include_delete_marked? 0:
rec_get_deleted_flag(
rec,
page_is_comp(btr_pcur_get_page(&pcur)))) {
@@ -1347,8 +1348,12 @@ enum page_scan_method_t {
the given page and count the number of
distinct ones, also ignore delete marked
records */
- QUIT_ON_FIRST_NON_BORING/* quit when the first record that differs
+ QUIT_ON_FIRST_NON_BORING,/* quit when the first record that differs
from its right neighbor is found */
+ COUNT_ALL_NON_BORING_INCLUDE_DEL_MARKED/* scan all records on
+ the given page and count the number of
+ distinct ones, include delete marked
+ records */
};
/* @} */
@@ -1624,6 +1629,8 @@ dict_stats_analyze_index_below_cur(
offsets_rec = dict_stats_scan_page(
&rec, offsets1, offsets2, index, page, n_prefix,
+ srv_stats_include_delete_marked ?
+ COUNT_ALL_NON_BORING_INCLUDE_DEL_MARKED:
COUNT_ALL_NON_BORING_AND_SKIP_DEL_MARKED, n_diff,
n_external_pages);
diff --git a/storage/xtradb/dict/dict0stats_bg.cc b/storage/xtradb/dict/dict0stats_bg.cc
index c2265d6abd6..55d34ff6ae1 100644
--- a/storage/xtradb/dict/dict0stats_bg.cc
+++ b/storage/xtradb/dict/dict0stats_bg.cc
@@ -41,8 +41,9 @@ Created Apr 25, 2012 Vasil Dimov
#define SHUTTING_DOWN() (srv_shutdown_state != SRV_SHUTDOWN_NONE)
-/** Event to wake up the stats thread */
-UNIV_INTERN os_event_t dict_stats_event = NULL;
+/** Event to wake up dict_stats_thread on dict_stats_recalc_pool_add()
+or shutdown. Not protected by any mutex. */
+UNIV_INTERN os_event_t dict_stats_event;
/** This mutex protects the "recalc_pool" variable. */
static ib_mutex_t recalc_pool_mutex;
diff --git a/storage/xtradb/dyn/dyn0dyn.cc b/storage/xtradb/dyn/dyn0dyn.cc
index 3ef5297a7c9..dd1f6863c14 100644
--- a/storage/xtradb/dyn/dyn0dyn.cc
+++ b/storage/xtradb/dyn/dyn0dyn.cc
@@ -40,7 +40,6 @@ dyn_array_add_block(
mem_heap_t* heap;
dyn_block_t* block;
- ut_ad(arr);
ut_ad(arr->magic_n == DYN_BLOCK_MAGIC_N);
if (arr->heap == NULL) {
diff --git a/storage/xtradb/fil/fil0crypt.cc b/storage/xtradb/fil/fil0crypt.cc
index 131d03ea17a..60ab067d105 100644
--- a/storage/xtradb/fil/fil0crypt.cc
+++ b/storage/xtradb/fil/fil0crypt.cc
@@ -37,7 +37,6 @@ Modified Jan Lindström jan.lindstrom@mariadb.com
#include "fsp0fsp.h"
#include "fil0pagecompress.h"
#include "ha_prototypes.h" // IB_LOG_
-
#include <my_crypt.h>
/** Mutex for keys */
@@ -59,7 +58,7 @@ UNIV_INTERN uint srv_n_fil_crypt_threads = 0;
UNIV_INTERN uint srv_n_fil_crypt_threads_started = 0;
/** At this age or older a space/page will be rotated */
-UNIV_INTERN uint srv_fil_crypt_rotate_key_age = 1;
+UNIV_INTERN uint srv_fil_crypt_rotate_key_age;
/** Event to signal FROM the key rotation threads. */
static os_event_t fil_crypt_event;
@@ -67,11 +66,11 @@ static os_event_t fil_crypt_event;
/** Event to signal TO the key rotation threads. */
UNIV_INTERN os_event_t fil_crypt_threads_event;
-/** Event for waking up threads throttle */
+/** Event for waking up threads throttle. */
static os_event_t fil_crypt_throttle_sleep_event;
-/** Mutex for key rotation threads */
-static ib_mutex_t fil_crypt_threads_mutex;
+/** Mutex for key rotation threads. */
+UNIV_INTERN ib_mutex_t fil_crypt_threads_mutex;
#ifdef UNIV_PFS_MUTEX
static mysql_pfs_key_t fil_crypt_threads_mutex_key;
@@ -104,9 +103,12 @@ static mysql_pfs_key_t fil_crypt_stat_mutex_key;
UNIV_INTERN mysql_pfs_key_t fil_crypt_data_mutex_key;
#endif
+/** Is background scrubbing enabled, defined on btr0scrub.cc */
+extern my_bool srv_background_scrub_data_uncompressed;
+extern my_bool srv_background_scrub_data_compressed;
+
static bool
fil_crypt_needs_rotation(
-/*=====================*/
fil_encryption_t encrypt_mode, /*!< in: Encryption
mode */
uint key_version, /*!< in: Key version */
@@ -118,7 +120,6 @@ Init space crypt */
UNIV_INTERN
void
fil_space_crypt_init()
-/*==================*/
{
mutex_create(fil_crypt_key_mutex_key,
&fil_crypt_key_mutex, SYNC_NO_ORDER_CHECK);
@@ -127,6 +128,7 @@ fil_space_crypt_init()
mutex_create(fil_crypt_stat_mutex_key,
&crypt_stat_mutex, SYNC_NO_ORDER_CHECK);
+
memset(&crypt_stat, 0, sizeof(crypt_stat));
}
@@ -135,9 +137,9 @@ Cleanup space crypt */
UNIV_INTERN
void
fil_space_crypt_cleanup()
-/*=====================*/
{
os_event_free(fil_crypt_throttle_sleep_event);
+ fil_crypt_throttle_sleep_event = NULL;
mutex_free(&fil_crypt_key_mutex);
mutex_free(&crypt_stat_mutex);
}
@@ -146,7 +148,7 @@ fil_space_crypt_cleanup()
Get latest key version from encryption plugin.
@return key version or ENCRYPTION_KEY_VERSION_INVALID */
uint
-fil_space_crypt_struct::key_get_latest_version(void)
+fil_space_crypt_t::key_get_latest_version(void)
{
uint key_version = key_found;
@@ -160,12 +162,12 @@ fil_space_crypt_struct::key_get_latest_version(void)
}
/******************************************************************
-Get the latest(key-version), waking the encrypt thread, if needed */
+Get the latest(key-version), waking the encrypt thread, if needed
+@param[in,out] crypt_data Crypt data */
static inline
uint
fil_crypt_get_latest_key_version(
-/*=============================*/
- fil_space_crypt_t* crypt_data) /*!< in: crypt data */
+ fil_space_crypt_t* crypt_data)
{
ut_ad(crypt_data != NULL);
@@ -204,28 +206,31 @@ crypt_data_scheme_locker(
/******************************************************************
Create a fil_space_crypt_t object
+@param[in] type CRYPT_SCHEME_UNENCRYPTE or
+ CRYPT_SCHEME_1
+@param[in] encrypt_mode FIL_ENCRYPTION_DEFAULT or
+ FIL_ENCRYPTION_ON or
+ FIL_ENCRYPTION_OFF
+@param[in] min_key_version key_version or 0
+@param[in] key_id Used key id
@return crypt object */
static
fil_space_crypt_t*
fil_space_create_crypt_data(
-/*========================*/
uint type,
fil_encryption_t encrypt_mode,
uint min_key_version,
- uint key_id,
- ulint offset)
+ uint key_id)
{
- const uint sz = sizeof(fil_space_crypt_t);
- void* buf = mem_zalloc(sz);
+ void* buf = mem_zalloc(sizeof(fil_space_crypt_t));
fil_space_crypt_t* crypt_data = NULL;
if (buf) {
crypt_data = new(buf)
- fil_space_crypt_struct(
+ fil_space_crypt_t(
type,
min_key_version,
key_id,
- offset,
encrypt_mode);
}
@@ -234,25 +239,30 @@ fil_space_create_crypt_data(
/******************************************************************
Create a fil_space_crypt_t object
+@param[in] encrypt_mode FIL_ENCRYPTION_DEFAULT or
+ FIL_ENCRYPTION_ON or
+ FIL_ENCRYPTION_OFF
+
+@param[in] key_id Encryption key id
@return crypt object */
UNIV_INTERN
fil_space_crypt_t*
fil_space_create_crypt_data(
-/*========================*/
- fil_encryption_t encrypt_mode, /*!< in: encryption mode */
- uint key_id) /*!< in: encryption key id */
+ fil_encryption_t encrypt_mode,
+ uint key_id)
{
- return (fil_space_create_crypt_data(0, encrypt_mode, 0, key_id, 0));
+ return (fil_space_create_crypt_data(0, encrypt_mode, 0, key_id));
}
/******************************************************************
-Merge fil_space_crypt_t object */
+Merge fil_space_crypt_t object
+@param[in,out] dst Destination cryp data
+@param[in] src Source crypt data */
UNIV_INTERN
void
fil_space_merge_crypt_data(
-/*=======================*/
- fil_space_crypt_t* dst,/*!< out: Crypt data */
- const fil_space_crypt_t* src)/*!< in: Crypt data */
+ fil_space_crypt_t* dst,
+ const fil_space_crypt_t* src)
{
mutex_enter(&dst->mutex);
@@ -267,21 +277,22 @@ fil_space_merge_crypt_data(
dst->type = src->type;
dst->min_key_version = src->min_key_version;
dst->keyserver_requests += src->keyserver_requests;
- dst->closing = src->closing;
mutex_exit(&dst->mutex);
}
/******************************************************************
Read crypt data from a page (0)
-@return crypt data from page 0. */
+@param[in] space space_id
+@param[in] page Page 0
+@param[in] offset Offset to crypt data
+@return crypt data from page 0 or NULL. */
UNIV_INTERN
fil_space_crypt_t*
fil_space_read_crypt_data(
-/*======================*/
- ulint space, /*!< in: file space id*/
- const byte* page, /*!< in: page 0 */
- ulint offset) /*!< in: offset */
+ ulint space,
+ const byte* page,
+ ulint offset)
{
if (memcmp(page + offset, CRYPT_MAGIC, MAGIC_SZ) != 0) {
/* Crypt data is not stored. */
@@ -294,8 +305,8 @@ fil_space_read_crypt_data(
type == CRYPT_SCHEME_1)) {
ib_logf(IB_LOG_LEVEL_ERROR,
- "Found non sensible crypt scheme: %lu for space %lu "
- " offset: %lu bytes: "
+ "Found non sensible crypt scheme: " ULINTPF " for space " ULINTPF
+ " offset: " ULINTPF " bytes: "
"[ %.2x %.2x %.2x %.2x %.2x %.2x ].",
type, space, offset,
page[offset + 0 + MAGIC_SZ],
@@ -346,43 +357,37 @@ fil_space_read_crypt_data(
}
/******************************************************************
-Free a crypt data object */
+Free a crypt data object
+@param[in,out] crypt_data crypt data to be freed */
UNIV_INTERN
void
fil_space_destroy_crypt_data(
-/*=========================*/
- fil_space_crypt_t **crypt_data) /*!< out: crypt data */
+ fil_space_crypt_t **crypt_data)
{
if (crypt_data != NULL && (*crypt_data) != NULL) {
fil_space_crypt_t* c = *crypt_data;
- c->~fil_space_crypt_struct();
+ c->~fil_space_crypt_t();
mem_free(c);
*crypt_data = NULL;
}
}
/******************************************************************
-Write crypt data to a page (0) */
-static
+Write crypt data to a page (0)
+@param[in,out] page0 Page 0 where to write
+@param[in,out] mtr Minitransaction */
+UNIV_INTERN
void
-fil_space_write_crypt_data_low(
-/*===========================*/
- fil_space_crypt_t* crypt_data, /*<! out: crypt data */
- ulint type, /*<! in: crypt scheme */
- byte* page, /*<! in: page 0 */
- ulint offset, /*<! in: offset */
- ulint maxsize, /*<! in: size of crypt data */
- mtr_t* mtr) /*<! in: minitransaction */
+fil_space_crypt_t::write_page0(
+ byte* page,
+ mtr_t* mtr)
{
- ut_a(offset > 0 && offset < UNIV_PAGE_SIZE);
ulint space_id = mach_read_from_4(
page + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID);
- const uint len = sizeof(crypt_data->iv);
- const uint min_key_version = crypt_data->min_key_version;
- const uint key_id = crypt_data->key_id;
- const fil_encryption_t encryption = crypt_data->encryption;
- crypt_data->page0_offset = offset;
- ut_a(2 + len + 4 + 1 + 4 + MAGIC_SZ < maxsize);
+ const uint len = sizeof(iv);
+ ulint zip_size = fsp_header_get_zip_size(page);
+ const ulint offset = fsp_header_get_crypt_offset(zip_size);
+ page0_offset = offset;
/*
redo log this as bytewise updates to page 0
@@ -392,7 +397,7 @@ fil_space_write_crypt_data_low(
mlog_write_string(page + offset, CRYPT_MAGIC, MAGIC_SZ, mtr);
mlog_write_ulint(page + offset + MAGIC_SZ + 0, type, MLOG_1BYTE, mtr);
mlog_write_ulint(page + offset + MAGIC_SZ + 1, len, MLOG_1BYTE, mtr);
- mlog_write_string(page + offset + MAGIC_SZ + 2, crypt_data->iv, len,
+ mlog_write_string(page + offset + MAGIC_SZ + 2, iv, len,
mtr);
mlog_write_ulint(page + offset + MAGIC_SZ + 2 + len, min_key_version,
MLOG_4BYTES, mtr);
@@ -424,44 +429,61 @@ fil_space_write_crypt_data_low(
log_ptr += 1;
mlog_close(mtr, log_ptr);
- mlog_catenate_string(mtr, crypt_data->iv, len);
+ mlog_catenate_string(mtr, iv, len);
}
}
/******************************************************************
-Write crypt data to a page (0) */
-UNIV_INTERN
-void
-fil_space_write_crypt_data(
-/*=======================*/
- ulint space, /*<! in: file space */
- byte* page, /*<! in: page 0 */
- ulint offset, /*<! in: offset */
- ulint maxsize, /*<! in: size of crypt data */
- mtr_t* mtr) /*<! in: minitransaction */
+Set crypt data for a tablespace
+@param[in,out] space Tablespace
+@param[in,out] crypt_data Crypt data to be set
+@return crypt_data in tablespace */
+static
+fil_space_crypt_t*
+fil_space_set_crypt_data(
+ fil_space_t* space,
+ fil_space_crypt_t* crypt_data)
{
- fil_space_crypt_t* crypt_data = fil_space_get_crypt_data(space);
+ fil_space_crypt_t* free_crypt_data = NULL;
+ fil_space_crypt_t* ret_crypt_data = NULL;
+
+ /* Provided space is protected using fil_space_acquire()
+ from concurrent operations. */
+ if (space->crypt_data != NULL) {
+ /* There is already crypt data present,
+ merge new crypt_data */
+ fil_space_merge_crypt_data(space->crypt_data,
+ crypt_data);
+ ret_crypt_data = space->crypt_data;
+ free_crypt_data = crypt_data;
+ } else {
+ space->crypt_data = crypt_data;
+ ret_crypt_data = space->crypt_data;
+ }
- /* If no crypt data is stored on memory cache for this space,
- then do not continue writing crypt data to page 0. */
- if (crypt_data == NULL) {
- return;
+ if (free_crypt_data != NULL) {
+ /* there was already crypt data present and the new crypt
+ * data provided as argument to this function has been merged
+ * into that => free new crypt data
+ */
+ fil_space_destroy_crypt_data(&free_crypt_data);
}
- fil_space_write_crypt_data_low(crypt_data, crypt_data->type,
- page, offset, maxsize, mtr);
+ return ret_crypt_data;
}
/******************************************************************
Parse a MLOG_FILE_WRITE_CRYPT_DATA log entry
+@param[in] ptr Log entry start
+@param[in] end_ptr Log entry end
+@param[in] block buffer block
@return position on log buffer */
UNIV_INTERN
-byte*
+const byte*
fil_parse_write_crypt_data(
-/*=======================*/
- byte* ptr, /*!< in: Log entry start */
- byte* end_ptr,/*!< in: Log entry end */
- buf_block_t* block) /*!< in: buffer block */
+ const byte* ptr,
+ const byte* end_ptr,
+ const buf_block_t* block)
{
/* check that redo log entry is complete */
size_t entry_size =
@@ -473,7 +495,7 @@ fil_parse_write_crypt_data(
4 + // size of key_id
1; // fil_encryption_t
- if ((size_t) (end_ptr - ptr) < entry_size){
+ if (ptr + entry_size > end_ptr) {
return NULL;
}
@@ -499,7 +521,7 @@ fil_parse_write_crypt_data(
fil_encryption_t encryption = (fil_encryption_t)mach_read_from_1(ptr);
ptr +=1;
- if ((size_t) (end_ptr - ptr) < len) {
+ if (ptr + len > end_ptr) {
return NULL;
}
@@ -512,47 +534,36 @@ fil_parse_write_crypt_data(
ptr += len;
/* update fil_space memory cache with crypt_data */
- fil_space_set_crypt_data(space_id, crypt_data);
+ fil_space_t* space = fil_space_acquire_silent(space_id);
- return ptr;
-}
+ if (space) {
+ crypt_data = fil_space_set_crypt_data(space, crypt_data);
+ fil_space_release(space);
+ }
-/******************************************************************
-Clear crypt data from a page (0) */
-UNIV_INTERN
-void
-fil_space_clear_crypt_data(
-/*=======================*/
- byte* page, /*!< in/out: Page 0 */
- ulint offset) /*!< in: Offset */
-{
- //TODO(jonaso): pass crypt-data and read len from there
- ulint len = CRYPT_SCHEME_1_IV_LEN;
- ulint size =
- sizeof(CRYPT_MAGIC) +
- 1 + // type
- 1 + // len
- len + // iv
- 4 + // min key version
- 4 + // key id
- 1; // fil_encryption_t
- memset(page + offset, 0, size);
+ return ptr;
}
/******************************************************************
-Encrypt a buffer */
+Encrypt a buffer
+@param[in,out] crypt_data Crypt data
+@param[in] space space_id
+@param[in] offset Page offset
+@param[in] lsn Log sequence number
+@param[in] src_frame Page to encrypt
+@param[in] zip_size Compressed size or 0
+@param[in,out] dst_frame Output buffer
+@return encrypted buffer or NULL */
UNIV_INTERN
byte*
fil_encrypt_buf(
-/*============*/
- fil_space_crypt_t* crypt_data, /*!< in: crypt data */
- ulint space, /*!< in: Space id */
- ulint offset, /*!< in: Page offset */
- lsn_t lsn, /*!< in: lsn */
- byte* src_frame, /*!< in: Source page to be encrypted */
- ulint zip_size, /*!< in: compressed size if
- row format compressed */
- byte* dst_frame) /*!< in: outbut buffer */
+ fil_space_crypt_t* crypt_data,
+ ulint space,
+ ulint offset,
+ lsn_t lsn,
+ const byte* src_frame,
+ ulint zip_size,
+ byte* dst_frame)
{
ulint page_size = (zip_size) ? zip_size : UNIV_PAGE_SIZE;
uint key_version = fil_crypt_get_latest_key_version(crypt_data);
@@ -625,46 +636,48 @@ fil_encrypt_buf(
// store the post-encryption checksum after the key-version
mach_write_to_4(dst_frame + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION + 4, checksum);
+ ut_ad(fil_space_verify_crypt_checksum(dst_frame, zip_size, NULL, offset));
+
srv_stats.pages_encrypted.inc();
return dst_frame;
}
/******************************************************************
-Encrypt a page */
+Encrypt a page
+
+@param[in] space Tablespace
+@param[in] offset Page offset
+@param[in] lsn Log sequence number
+@param[in] src_frame Page to encrypt
+@param[in,out] dst_frame Output buffer
+@return encrypted buffer or NULL */
UNIV_INTERN
byte*
fil_space_encrypt(
-/*==============*/
- ulint space, /*!< in: Space id */
- ulint offset, /*!< in: Page offset */
- lsn_t lsn, /*!< in: lsn */
- byte* src_frame, /*!< in: Source page to be encrypted */
- ulint zip_size, /*!< in: compressed size if
- row_format compressed */
- byte* dst_frame) /*!< in: outbut buffer */
+ const fil_space_t* space,
+ ulint offset,
+ lsn_t lsn,
+ byte* src_frame,
+ byte* dst_frame)
{
- fil_space_crypt_t* crypt_data = NULL;
-
ulint orig_page_type = mach_read_from_2(src_frame+FIL_PAGE_TYPE);
if (orig_page_type==FIL_PAGE_TYPE_FSP_HDR
|| orig_page_type==FIL_PAGE_TYPE_XDES) {
/* File space header or extent descriptor do not need to be
encrypted. */
- return src_frame;
+ return (src_frame);
}
- /* Get crypt data from file space */
- crypt_data = fil_space_get_crypt_data(space);
-
- if (crypt_data == NULL) {
- return src_frame;
+ if (!space->crypt_data || !space->crypt_data->is_encrypted()) {
+ return (src_frame);
}
- ut_a(crypt_data != NULL && crypt_data->is_encrypted());
-
- byte* tmp = fil_encrypt_buf(crypt_data, space, offset, lsn, src_frame, zip_size, dst_frame);
+ fil_space_crypt_t* crypt_data = space->crypt_data;
+ ut_ad(space->n_pending_ops);
+ ulint zip_size = fsp_flags_get_zip_size(space->flags);
+ byte* tmp = fil_encrypt_buf(crypt_data, space->id, offset, lsn, src_frame, zip_size, dst_frame);
#ifdef UNIV_DEBUG
if (tmp) {
@@ -685,7 +698,7 @@ fil_space_encrypt(
src = uncomp_mem;
}
- bool corrupted1 = buf_page_is_corrupted(true, src, zip_size);
+ bool corrupted1 = buf_page_is_corrupted(true, src, zip_size, space);
bool ok = fil_space_decrypt(crypt_data, tmp_mem, size, tmp, &err);
/* Need to decompress the page if it was also compressed */
@@ -694,18 +707,17 @@ fil_space_encrypt(
fil_decompress_page(tmp_mem, comp_mem, UNIV_PAGE_SIZE, NULL);
}
- bool corrupted = buf_page_is_corrupted(true, tmp_mem, zip_size);
+ bool corrupted = buf_page_is_corrupted(true, tmp_mem, zip_size, space);
bool different = memcmp(src, tmp_mem, size);
if (!ok || corrupted || corrupted1 || err != DB_SUCCESS || different) {
- fprintf(stderr, "JAN: ok %d corrupted %d corrupted1 %d err %d different %d\n", ok , corrupted, corrupted1, err, different);
- fprintf(stderr, "JAN1: src_frame\n");
+ fprintf(stderr, "ok %d corrupted %d corrupted1 %d err %d different %d\n", ok , corrupted, corrupted1, err, different);
+ fprintf(stderr, "src_frame\n");
buf_page_print(src_frame, zip_size, BUF_PAGE_PRINT_NO_CRASH);
- fprintf(stderr, "JAN2: encrypted_frame\n");
+ fprintf(stderr, "encrypted_frame\n");
buf_page_print(tmp, zip_size, BUF_PAGE_PRINT_NO_CRASH);
- fprintf(stderr, "JAN1: decrypted_frame\n");
- buf_page_print(tmp_mem, zip_size, BUF_PAGE_PRINT_NO_CRASH);
- ut_error;
+ fprintf(stderr, "decrypted_frame\n");
+ buf_page_print(tmp_mem, zip_size, 0);
}
free(tmp_mem);
@@ -724,45 +736,22 @@ fil_space_encrypt(
return tmp;
}
-/*********************************************************************
-Check if extra buffer shall be allocated for decrypting after read
-@return true if fil space has encryption data. */
-UNIV_INTERN
-bool
-fil_space_check_encryption_read(
-/*=============================*/
- ulint space) /*!< in: tablespace id */
-{
- fil_space_crypt_t* crypt_data = fil_space_get_crypt_data(space);
-
- if (crypt_data == NULL) {
- return false;
- }
-
- if (crypt_data->type == CRYPT_SCHEME_UNENCRYPTED) {
- return false;
- }
-
- if (crypt_data->not_encrypted()) {
- return false;
- }
-
- return true;
-}
-
/******************************************************************
Decrypt a page
+@param[in] crypt_data crypt_data
+@param[in] tmp_frame Temporary buffer
+@param[in] page_size Page size
+@param[in,out] src_frame Page to decrypt
+@param[out] err DB_SUCCESS or DB_DECRYPTION_FAILED
@return true if page decrypted, false if not.*/
UNIV_INTERN
bool
fil_space_decrypt(
-/*==============*/
- fil_space_crypt_t* crypt_data, /*!< in: crypt data */
- byte* tmp_frame, /*!< in: temporary buffer */
- ulint page_size, /*!< in: page size */
- byte* src_frame, /*!< in: out: page buffer */
- dberr_t* err) /*!< in: out: DB_SUCCESS or
- error code */
+ fil_space_crypt_t* crypt_data,
+ byte* tmp_frame,
+ ulint page_size,
+ byte* src_frame,
+ dberr_t* err)
{
ulint page_type = mach_read_from_2(src_frame+FIL_PAGE_TYPE);
uint key_version = mach_read_from_4(src_frame + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION);
@@ -770,6 +759,7 @@ fil_space_decrypt(
ulint offset = mach_read_from_4(src_frame + FIL_PAGE_OFFSET);
ulint space = mach_read_from_4(src_frame + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID);
ib_uint64_t lsn = mach_read_from_8(src_frame + FIL_PAGE_LSN);
+
*err = DB_SUCCESS;
if (key_version == ENCRYPTION_KEY_NOT_ENCRYPTED) {
@@ -784,12 +774,12 @@ fil_space_decrypt(
first page in a system tablespace
data file (ibdata*, not *.ibd), if not
clear it. */
-#ifdef UNIV_DEBUG
- ib_logf(IB_LOG_LEVEL_WARN,
- "Page on space %lu offset %lu has key_version %u"
+
+ DBUG_PRINT("ib_crypt",
+ ("Page on space %lu offset %lu has key_version %u"
" when it shoud be undefined.",
- space, offset, key_version);
-#endif
+ space, offset, key_version));
+
mach_write_to_4(src_frame + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION, 0);
}
return false;
@@ -858,32 +848,43 @@ fil_space_decrypt(
/******************************************************************
Decrypt a page
-@return encrypted page, or original not encrypted page if encryption is
-not needed. */
+@param[in] space Tablespace
+@param[in] tmp_frame Temporary buffer used for decrypting
+@param[in] page_size Page size
+@param[in,out] src_frame Page to decrypt
+@param[out] decrypted true if page was decrypted
+@return decrypted page, or original not encrypted page if decryption is
+not needed.*/
UNIV_INTERN
byte*
fil_space_decrypt(
-/*==============*/
- ulint space, /*!< in: Fil space id */
- byte* tmp_frame, /*!< in: temporary buffer */
- ulint page_size, /*!< in: page size */
- byte* src_frame) /*!< in/out: page buffer */
+ const fil_space_t* space,
+ byte* tmp_frame,
+ byte* src_frame,
+ bool* decrypted)
{
dberr_t err = DB_SUCCESS;
byte* res = NULL;
+ ulint zip_size = fsp_flags_get_zip_size(space->flags);
+ ulint size = zip_size ? zip_size : UNIV_PAGE_SIZE;
+ *decrypted = false;
+
+ ut_ad(space->crypt_data != NULL && space->crypt_data->is_encrypted());
+ ut_ad(space->n_pending_ops > 0);
bool encrypted = fil_space_decrypt(
- fil_space_get_crypt_data(space),
+ space->crypt_data,
tmp_frame,
- page_size,
+ size,
src_frame,
&err);
if (err == DB_SUCCESS) {
if (encrypted) {
+ *decrypted = true;
/* Copy the decrypted page back to page buffer, not
really any other options. */
- memcpy(src_frame, tmp_frame, page_size);
+ memcpy(src_frame, tmp_frame, size);
}
res = src_frame;
@@ -894,14 +895,15 @@ fil_space_decrypt(
/******************************************************************
Calculate post encryption checksum
+@param[in] zip_size zip_size or 0
+@param[in] dst_frame Block where checksum is calculated
@return page checksum or BUF_NO_CHECKSUM_MAGIC
not needed. */
UNIV_INTERN
ulint
fil_crypt_calculate_checksum(
-/*=========================*/
- ulint zip_size, /*!< in: zip_size or 0 */
- byte* dst_frame) /*!< in: page where to calculate */
+ ulint zip_size,
+ const byte* dst_frame)
{
ib_uint32_t checksum = 0;
srv_checksum_algorithm_t algorithm =
@@ -934,83 +936,133 @@ fil_crypt_calculate_checksum(
}
/*********************************************************************
-Verify checksum for a page (iff it's encrypted)
-NOTE: currently this function can only be run in single threaded mode
-as it modifies srv_checksum_algorithm (temporarily)
+Verify that post encryption checksum match calculated checksum.
+This function should be called only if tablespace contains crypt_data
+metadata (this is strong indication that tablespace is encrypted).
+Function also verifies that traditional checksum does not match
+calculated checksum as if it does page could be valid unencrypted,
+encrypted, or corrupted.
+
+@param[in] page Page to verify
+@param[in] zip_size zip size
+@param[in] space Tablespace
+@param[in] pageno Page no
@return true if page is encrypted AND OK, false otherwise */
UNIV_INTERN
bool
fil_space_verify_crypt_checksum(
-/*============================*/
- const byte* src_frame, /*!< in: page the verify */
- ulint zip_size) /*!< in: compressed size if
- row_format compressed */
+ byte* page,
+ ulint zip_size,
+ const fil_space_t* space,
+ ulint pageno)
{
- // key version
- uint key_version = mach_read_from_4(
- src_frame + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION);
+ uint key_version = mach_read_from_4(page+ FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION);
+ /* If page is not encrypted, return false */
if (key_version == 0) {
- return false; // unencrypted page
+ return false;
+ }
+
+ srv_checksum_algorithm_t algorithm =
+ static_cast<srv_checksum_algorithm_t>(srv_checksum_algorithm);
+ /* If no checksum is used, can't continue checking. */
+ if (algorithm == SRV_CHECKSUM_ALGORITHM_NONE) {
+ return(true);
}
- /* "trick" the normal checksum routines by storing the post-encryption
- * checksum into the normal checksum field allowing for reuse of
- * the normal routines */
+ /* Read stored post encryption checksum. */
+ ib_uint32_t checksum = mach_read_from_4(
+ page + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION + 4);
- // post encryption checksum
- ib_uint32_t stored_post_encryption = mach_read_from_4(
- src_frame + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION + 4);
+ /* Declare empty pages non-corrupted */
+ if (checksum == 0
+ && *reinterpret_cast<const ib_uint64_t*>(page + FIL_PAGE_LSN) == 0
+ && buf_page_is_zeroes(page, zip_size)) {
+ return(true);
+ }
- // save pre encryption checksum for restore in end of this function
- ib_uint32_t stored_pre_encryption = mach_read_from_4(
- src_frame + FIL_PAGE_SPACE_OR_CHKSUM);
+ /* Compressed and encrypted pages do not have checksum. Assume not
+ corrupted. Page verification happens after decompression in
+ buf_page_io_complete() using buf_page_is_corrupted(). */
+ if (mach_read_from_2(page+FIL_PAGE_TYPE) == FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED) {
+ return (true);
+ }
- ib_uint32_t checksum_field2 = mach_read_from_4(
- src_frame + UNIV_PAGE_SIZE - FIL_PAGE_END_LSN_OLD_CHKSUM);
+ /* Compressed pages use different checksum method. We first store
+ the post encryption checksum on checksum location and after function
+ restore the original. */
+ if (zip_size) {
+ ib_uint32_t old = static_cast<ib_uint32_t>(mach_read_from_4(
+ page + FIL_PAGE_SPACE_OR_CHKSUM));
- /** prepare frame for usage of normal checksum routines */
- mach_write_to_4(const_cast<byte*>(src_frame) + FIL_PAGE_SPACE_OR_CHKSUM,
- stored_post_encryption);
+ mach_write_to_4(page + FIL_PAGE_SPACE_OR_CHKSUM, checksum);
- /* NOTE: this function is (currently) only run when restoring
- * dblwr-buffer, server is single threaded so it's safe to modify
- * srv_checksum_algorithm */
- srv_checksum_algorithm_t save_checksum_algorithm =
- (srv_checksum_algorithm_t)srv_checksum_algorithm;
+ bool valid = page_zip_verify_checksum(page, zip_size);
- if (zip_size == 0 &&
- (save_checksum_algorithm == SRV_CHECKSUM_ALGORITHM_STRICT_INNODB ||
- save_checksum_algorithm == SRV_CHECKSUM_ALGORITHM_INNODB)) {
- /* handle ALGORITHM_INNODB specially,
- * "downgrade" to ALGORITHM_INNODB and store BUF_NO_CHECKSUM_MAGIC
- * checksum_field2 is sort of pointless anyway...
- */
- srv_checksum_algorithm = SRV_CHECKSUM_ALGORITHM_INNODB;
- mach_write_to_4(const_cast<byte*>(src_frame) +
- UNIV_PAGE_SIZE - FIL_PAGE_END_LSN_OLD_CHKSUM,
- BUF_NO_CHECKSUM_MAGIC);
+ mach_write_to_4(page + FIL_PAGE_SPACE_OR_CHKSUM, old);
+
+ return (valid);
}
- /* verify checksums */
- ibool corrupted = buf_page_is_corrupted(false, src_frame, zip_size);
+ /* If stored checksum matches one of the calculated checksums
+ page is not corrupted. */
- /** restore frame & algorithm */
- srv_checksum_algorithm = save_checksum_algorithm;
+ ib_uint32_t cchecksum1 = buf_calc_page_crc32(page);
+ ib_uint32_t cchecksum2 = (ib_uint32_t) buf_calc_page_new_checksum(
+ page);
+ bool encrypted = (checksum == cchecksum1 || checksum == cchecksum2
+ || checksum == BUF_NO_CHECKSUM_MAGIC);
- mach_write_to_4(const_cast<byte*>(src_frame) +
- FIL_PAGE_SPACE_OR_CHKSUM,
- stored_pre_encryption);
+ /* MySQL 5.6 and MariaDB 10.0 and 10.1 will write an LSN to the
+ first page of each system tablespace file at
+ FIL_PAGE_FILE_FLUSH_LSN offset. On other pages and in other files,
+ the field might have been uninitialized until MySQL 5.5. In MySQL 5.7
+ (and MariaDB Server 10.2.2) WL#7990 stopped writing the field for other
+ than page 0 of the system tablespace.
- mach_write_to_4(const_cast<byte*>(src_frame) +
- UNIV_PAGE_SIZE - FIL_PAGE_END_LSN_OLD_CHKSUM,
- checksum_field2);
+ Starting from MariaDB 10.1 the field has been repurposed for
+ encryption key_version.
- if (!corrupted) {
- return true; // page was encrypted and checksum matched
- } else {
- return false; // page was encrypted but checksum didn't match
+ Starting with MySQL 5.7 (and MariaDB Server 10.2), the
+ field has been repurposed for SPATIAL INDEX pages for
+ FIL_RTREE_SPLIT_SEQ_NUM.
+
+ Note that FIL_PAGE_FILE_FLUSH_LSN is not included in the InnoDB page
+ checksum.
+
+ Thus, FIL_PAGE_FILE_FLUSH_LSN could contain any value. While the
+ field would usually be 0 for pages that are not encrypted, we cannot
+ assume that a nonzero value means that the page is encrypted.
+ Therefore we must validate the page both as encrypted and unencrypted
+ when FIL_PAGE_FILE_FLUSH_LSN does not contain 0.
+ */
+
+ ulint checksum1 = mach_read_from_4(
+ page + FIL_PAGE_SPACE_OR_CHKSUM);
+
+ ulint checksum2 = mach_read_from_4(
+ page + UNIV_PAGE_SIZE - FIL_PAGE_END_LSN_OLD_CHKSUM);
+
+
+ bool valid = (buf_page_is_checksum_valid_crc32(page,checksum1,checksum2)
+ || buf_page_is_checksum_valid_none(page,checksum1,checksum2)
+ || buf_page_is_checksum_valid_innodb(page,checksum1, checksum2));
+
+ if (encrypted && valid) {
+ /* If page is encrypted and traditional checksums match,
+ page could be still encrypted, or not encrypted and valid or
+ corrupted. */
+ ib_logf(IB_LOG_LEVEL_ERROR,
+ " Page %lu in space %s (%lu) maybe corrupted."
+ " Post encryption checksum %u stored [%lu:%lu] key_version %u",
+ pageno,
+ space ? space->name : "N/A",
+ mach_read_from_4(page + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID),
+ checksum, checksum1, checksum2, key_version);
+ encrypted = false;
}
+
+ return(encrypted);
}
/***********************************************************************/
@@ -1029,12 +1081,13 @@ struct key_state_t {
};
/***********************************************************************
-Copy global key state */
+Copy global key state
+@param[in,out] new_state key state
+@param[in] crypt_data crypt data */
static void
fil_crypt_get_key_state(
-/*====================*/
- key_state_t* new_state, /*!< out: key state */
- fil_space_crypt_t* crypt_data) /*!< in, out: crypt_data */
+ key_state_t* new_state,
+ fil_space_crypt_t* crypt_data)
{
if (srv_encrypt_tables) {
new_state->key_version = crypt_data->key_get_latest_version();
@@ -1049,15 +1102,17 @@ fil_crypt_get_key_state(
/***********************************************************************
Check if a key needs rotation given a key_state
+@param[in] encrypt_mode Encryption mode
+@param[in] key_version Current key version
+@param[in] latest_key_version Latest key version
+@param[in] rotate_key_age when to rotate
@return true if key needs rotation, false if not */
static bool
fil_crypt_needs_rotation(
-/*=====================*/
- fil_encryption_t encrypt_mode, /*!< in: Encryption
- mode */
- uint key_version, /*!< in: Key version */
- uint latest_key_version, /*!< in: Latest key version */
- uint rotate_key_age) /*!< in: When to rotate */
+ fil_encryption_t encrypt_mode,
+ uint key_version,
+ uint latest_key_version,
+ uint rotate_key_age)
{
if (key_version == ENCRYPTION_KEY_VERSION_INVALID) {
return false;
@@ -1070,7 +1125,7 @@ fil_crypt_needs_rotation(
}
if (latest_key_version == 0 && key_version != 0) {
- if (encrypt_mode == FIL_SPACE_ENCRYPTION_DEFAULT) {
+ if (encrypt_mode == FIL_ENCRYPTION_DEFAULT) {
/* this is rotation encrypted => unencrypted */
return true;
}
@@ -1087,59 +1142,34 @@ fil_crypt_needs_rotation(
}
/***********************************************************************
-Check if a space is closing (i.e just before drop)
-@return true if space is closing, false if not. */
-UNIV_INTERN
-bool
-fil_crypt_is_closing(
-/*=================*/
- ulint space) /*!< in: FIL space id */
-{
- bool closing=true;
- fil_space_crypt_t *crypt_data = fil_space_get_crypt_data(space);
-
- if (crypt_data) {
- closing = crypt_data->is_closing(false);
- }
-
- return closing;
-}
-
-/***********************************************************************
Start encrypting a space
-@return true if a pending op (fil_inc_pending_ops/fil_decr_pending_ops) is held
-*/
+@param[in,out] space Tablespace
+@return true if a recheck is needed */
static
bool
fil_crypt_start_encrypting_space(
-/*=============================*/
- ulint space, /*!< in: FIL space id */
- bool* recheck)/*!< out: true if recheck needed */
+ fil_space_t* space)
{
-
- /* we have a pending op when entering function */
- bool pending_op = true;
-
+ bool recheck = false;
mutex_enter(&fil_crypt_threads_mutex);
- fil_space_crypt_t *crypt_data = fil_space_get_crypt_data(space);
- ibool page_encrypted = (crypt_data != NULL);
+ fil_space_crypt_t *crypt_data = space->crypt_data;
- /*If spage is not encrypted and encryption is not enabled, then
+ /* If space is not encrypted and encryption is not enabled, then
do not continue encrypting the space. */
- if (!page_encrypted && !srv_encrypt_tables) {
+ if (!crypt_data && !srv_encrypt_tables) {
mutex_exit(&fil_crypt_threads_mutex);
- return pending_op;
+ return false;
}
if (crypt_data != NULL || fil_crypt_start_converting) {
/* someone beat us to it */
if (fil_crypt_start_converting) {
- *recheck = true;
+ recheck = true;
}
mutex_exit(&fil_crypt_threads_mutex);
- return pending_op;
+ return recheck;
}
/* NOTE: we need to write and flush page 0 before publishing
@@ -1148,10 +1178,11 @@ fil_crypt_start_encrypting_space(
* crypt data in page 0 */
/* 1 - create crypt data */
- crypt_data = fil_space_create_crypt_data(FIL_SPACE_ENCRYPTION_DEFAULT, FIL_DEFAULT_ENCRYPTION_KEY);
+ crypt_data = fil_space_create_crypt_data(FIL_ENCRYPTION_DEFAULT, FIL_DEFAULT_ENCRYPTION_KEY);
+
if (crypt_data == NULL) {
mutex_exit(&fil_crypt_threads_mutex);
- return pending_op;
+ return false;
}
crypt_data->type = CRYPT_SCHEME_UNENCRYPTED;
@@ -1169,87 +1200,44 @@ fil_crypt_start_encrypting_space(
do
{
- if (fil_crypt_is_closing(space) ||
- fil_space_found_by_id(space) == NULL) {
- break;
- }
-
mtr_t mtr;
mtr_start(&mtr);
/* 2 - get page 0 */
- ulint offset = 0;
- ulint zip_size = fil_space_get_zip_size(space);
- buf_block_t* block = buf_page_get_gen(space, zip_size, offset,
+ ulint zip_size = fsp_flags_get_zip_size(space->flags);
+ buf_block_t* block = buf_page_get_gen(space->id, zip_size, 0,
RW_X_LATCH,
NULL,
BUF_GET,
__FILE__, __LINE__,
&mtr);
- if (fil_crypt_is_closing(space) ||
- fil_space_found_by_id(space) == NULL) {
- mtr_commit(&mtr);
- break;
- }
- /* 3 - compute location to store crypt data */
+ /* 3 - write crypt data to page 0 */
byte* frame = buf_block_get_frame(block);
- ulint maxsize;
- ut_ad(crypt_data);
- crypt_data->page0_offset =
- fsp_header_get_crypt_offset(zip_size, &maxsize);
-
- /* 4 - write crypt data to page 0 */
- fil_space_write_crypt_data_low(crypt_data,
- CRYPT_SCHEME_1,
- frame,
- crypt_data->page0_offset,
- maxsize, &mtr);
+ crypt_data->type = CRYPT_SCHEME_1;
+ crypt_data->write_page0(frame, &mtr);
- mtr_commit(&mtr);
- if (fil_crypt_is_closing(space) ||
- fil_space_found_by_id(space) == NULL) {
- break;
- }
+ mtr_commit(&mtr);
/* record lsn of update */
lsn_t end_lsn = mtr.end_lsn;
/* 4 - sync tablespace before publishing crypt data */
- /* release "lock" while syncing */
- fil_decr_pending_ops(space);
- pending_op = false;
-
bool success = false;
- ulint n_pages = 0;
ulint sum_pages = 0;
+
do {
+ ulint n_pages = 0;
success = buf_flush_list(ULINT_MAX, end_lsn, &n_pages);
buf_flush_wait_batch_end(NULL, BUF_FLUSH_LIST);
sum_pages += n_pages;
- } while (!success &&
- !fil_crypt_is_closing(space) &&
- !fil_space_found_by_id(space));
-
- /* try to reacquire pending op */
- if (fil_inc_pending_ops(space, true)) {
- break;
- }
-
- /* pending op reacquired! */
- pending_op = true;
-
- if (fil_crypt_is_closing(space) ||
- fil_space_found_by_id(space) == NULL) {
- break;
- }
+ } while (!success);
/* 5 - publish crypt data */
mutex_enter(&fil_crypt_threads_mutex);
- ut_ad(crypt_data);
mutex_enter(&crypt_data->mutex);
crypt_data->type = CRYPT_SCHEME_1;
ut_a(crypt_data->rotate_state.active_threads == 1);
@@ -1260,10 +1248,9 @@ fil_crypt_start_encrypting_space(
mutex_exit(&crypt_data->mutex);
mutex_exit(&fil_crypt_threads_mutex);
- return pending_op;
+ return recheck;
} while (0);
- ut_ad(crypt_data);
mutex_enter(&crypt_data->mutex);
ut_a(crypt_data->rotate_state.active_threads == 1);
crypt_data->rotate_state.active_threads = 0;
@@ -1273,7 +1260,7 @@ fil_crypt_start_encrypting_space(
fil_crypt_start_converting = false;
mutex_exit(&fil_crypt_threads_mutex);
- return pending_op;
+ return recheck;
}
/** State of a rotation thread */
@@ -1287,7 +1274,7 @@ struct rotate_thread_t {
uint thread_no;
bool first; /*!< is position before first space */
- ulint space; /*!< current space */
+ fil_space_t* space; /*!< current space or NULL */
ulint offset; /*!< current offset */
ulint batch; /*!< #pages to rotate */
uint min_key_version_found;/*!< min key version found but not rotated */
@@ -1322,54 +1309,41 @@ struct rotate_thread_t {
/***********************************************************************
Check if space needs rotation given a key_state
+@param[in,out] state Key rotation state
+@param[in,out] key_state Key state
+@param[in,out] recheck needs recheck ?
@return true if space needs key rotation */
static
bool
fil_crypt_space_needs_rotation(
-/*===========================*/
- rotate_thread_t* state, /*!< in: Key rotation state */
- key_state_t* key_state, /*!< in: Key state */
- bool* recheck) /*!< out: needs recheck ? */
+ rotate_thread_t* state,
+ key_state_t* key_state,
+ bool* recheck)
{
- ulint space = state->space;
-
- /* Make sure that tablespace is found and it is normal tablespace */
- if (fil_space_found_by_id(space) == NULL ||
- fil_space_get_type(space) != FIL_TABLESPACE) {
- return false;
- }
+ fil_space_t* space = state->space;
- if (fil_inc_pending_ops(space, true)) {
- /* tablespace being dropped */
+ /* Make sure that tablespace is normal tablespace */
+ if (space->purpose != FIL_TABLESPACE) {
return false;
}
- /* keep track of if we have pending op */
- bool pending_op = true;
+ ut_ad(space->n_pending_ops > 0);
- fil_space_crypt_t *crypt_data = fil_space_get_crypt_data(space);
+ fil_space_crypt_t *crypt_data = space->crypt_data;
if (crypt_data == NULL) {
/**
* space has no crypt data
* start encrypting it...
*/
- pending_op = fil_crypt_start_encrypting_space(space, recheck);
-
- crypt_data = fil_space_get_crypt_data(space);
+ *recheck = fil_crypt_start_encrypting_space(space);
+ crypt_data = space->crypt_data;
if (crypt_data == NULL) {
- if (pending_op) {
- fil_decr_pending_ops(space);
- }
return false;
}
crypt_data->key_get_latest_version();
-
- if (!crypt_data->is_key_found()) {
- return false;
- }
}
/* If used key_id is not found from encryption plugin we can't
@@ -1389,7 +1363,7 @@ fil_crypt_space_needs_rotation(
}
/* prevent threads from starting to rotate space */
- if (crypt_data->is_closing(true)) {
+ if (space->is_stopping()) {
break;
}
@@ -1413,39 +1387,39 @@ fil_crypt_space_needs_rotation(
key_state->key_version, key_state->rotate_key_age);
crypt_data->rotate_state.scrubbing.is_active =
- btr_scrub_start_space(space, &state->scrub_data);
+ btr_scrub_start_space(space->id, &state->scrub_data);
time_t diff = time(0) - crypt_data->rotate_state.scrubbing.
last_scrub_completed;
bool need_scrubbing =
+ (srv_background_scrub_data_uncompressed ||
+ srv_background_scrub_data_compressed) &&
crypt_data->rotate_state.scrubbing.is_active
- && diff >= (time_t) srv_background_scrub_data_interval;
+ && diff >= 0
+ && ulint(diff) >= srv_background_scrub_data_interval;
if (need_key_rotation == false && need_scrubbing == false) {
break;
}
mutex_exit(&crypt_data->mutex);
- /* NOTE! fil_decr_pending_ops is performed outside */
+
return true;
} while (0);
mutex_exit(&crypt_data->mutex);
- if (pending_op) {
- fil_decr_pending_ops(space);
- }
return false;
}
/***********************************************************************
-Update global statistics with thread statistics */
+Update global statistics with thread statistics
+@param[in,out] state key rotation statistics */
static void
fil_crypt_update_total_stat(
-/*========================*/
- rotate_thread_t *state) /*!< in: Key rotation status */
+ rotate_thread_t *state)
{
mutex_enter(&crypt_stat_mutex);
crypt_stat.pages_read_from_cache +=
@@ -1469,15 +1443,19 @@ fil_crypt_update_total_stat(
/***********************************************************************
Allocate iops to thread from global setting,
used before starting to rotate a space.
+@param[in,out] state Rotation state
@return true if allocation succeeded, false if failed */
static
bool
fil_crypt_alloc_iops(
-/*=================*/
- rotate_thread_t *state) /*!< in: Key rotation status */
+ rotate_thread_t *state)
{
ut_ad(state->allocated_iops == 0);
+ /* We have not yet selected the space to rotate, thus
+ state might not contain space and we can't check
+ its status yet. */
+
uint max_iops = state->estimated_max_iops;
mutex_enter(&fil_crypt_threads_mutex);
@@ -1503,12 +1481,12 @@ fil_crypt_alloc_iops(
/***********************************************************************
Reallocate iops to thread,
-used when inside a space */
+used when inside a space
+@param[in,out] state Rotation state */
static
void
fil_crypt_realloc_iops(
-/*===================*/
- rotate_thread_t *state) /*!< in: Key rotation status */
+ rotate_thread_t *state)
{
ut_a(state->allocated_iops > 0);
@@ -1517,13 +1495,12 @@ fil_crypt_realloc_iops(
uint avg_wait_time_us =
state->sum_waited_us / state->cnt_waited;
-#if DEBUG_KEYROTATION_THROTTLING
- ib_logf(IB_LOG_LEVEL_INFO,
- "thr_no: %u - update estimated_max_iops from %u to %u.",
+ DBUG_PRINT("ib_crypt",
+ ("thr_no: %u - update estimated_max_iops from %u to %u.",
state->thread_no,
state->estimated_max_iops,
- 1000000 / avg_wait_time_us);
-#endif
+ 1000000 / avg_wait_time_us));
+
if (avg_wait_time_us == 0) {
avg_wait_time_us = 1; // prevent division by zero
}
@@ -1532,12 +1509,11 @@ fil_crypt_realloc_iops(
state->cnt_waited = 0;
state->sum_waited_us = 0;
} else {
-#if DEBUG_KEYROTATION_THROTTLING
- ib_logf(IB_LOG_LEVEL_INFO,
- "thr_no: %u only waited %lu%% skip re-estimate.",
+
+ DBUG_PRINT("ib_crypt",
+ ("thr_no: %u only waited %lu%% skip re-estimate.",
state->thread_no,
- (100 * state->cnt_waited) / state->batch);
-#endif
+ (100 * state->cnt_waited) / state->batch));
}
if (state->estimated_max_iops <= state->allocated_iops) {
@@ -1563,8 +1539,9 @@ fil_crypt_realloc_iops(
state->allocated_iops ++;
n_fil_crypt_iops_allocated ++;
}
- mutex_exit(&fil_crypt_threads_mutex);
+
os_event_set(fil_crypt_threads_event);
+ mutex_exit(&fil_crypt_threads_mutex);
}
} else {
/* see if there are more to get */
@@ -1581,13 +1558,13 @@ fil_crypt_realloc_iops(
}
n_fil_crypt_iops_allocated += extra;
state->allocated_iops += extra;
-#if DEBUG_KEYROTATION_THROTTLING
- ib_logf(IB_LOG_LEVEL_INFO,
- "thr_no: %u increased iops from %u to %u.",
+
+ DBUG_PRINT("ib_crypt",
+ ("thr_no: %u increased iops from %u to %u.",
state->thread_no,
state->allocated_iops - extra,
- state->allocated_iops);
-#endif
+ state->allocated_iops));
+
}
mutex_exit(&fil_crypt_threads_mutex);
}
@@ -1596,12 +1573,12 @@ fil_crypt_realloc_iops(
}
/***********************************************************************
-Return allocated iops to global */
+Return allocated iops to global
+@param[in,out] state Rotation state */
static
void
fil_crypt_return_iops(
-/*==================*/
- rotate_thread_t *state) /*!< in: Key rotation status */
+ rotate_thread_t *state)
{
if (state->allocated_iops > 0) {
uint iops = state->allocated_iops;
@@ -1614,25 +1591,27 @@ fil_crypt_return_iops(
ut_ad(0);
iops = 0;
}
+
n_fil_crypt_iops_allocated -= iops;
- mutex_exit(&fil_crypt_threads_mutex);
state->allocated_iops = 0;
os_event_set(fil_crypt_threads_event);
+ mutex_exit(&fil_crypt_threads_mutex);
}
fil_crypt_update_total_stat(state);
}
/***********************************************************************
-Search for a space needing rotation */
-UNIV_INTERN
+Search for a space needing rotation
+@param[in,out] key_state Key state
+@param[in,out] state Rotation state
+@param[in,out] recheck recheck ? */
+static
bool
fil_crypt_find_space_to_rotate(
-/*===========================*/
- key_state_t* key_state, /*!< in: Key state */
- rotate_thread_t* state, /*!< in: Key rotation state */
- bool* recheck) /*!< out: true if recheck
- needed */
+ key_state_t* key_state,
+ rotate_thread_t* state,
+ bool* recheck)
{
/* we need iops to start rotating */
while (!state->should_shutdown() && !fil_crypt_alloc_iops(state)) {
@@ -1641,30 +1620,44 @@ fil_crypt_find_space_to_rotate(
}
if (state->should_shutdown()) {
+ if (state->space) {
+ fil_space_release(state->space);
+ state->space = NULL;
+ }
return false;
}
if (state->first) {
state->first = false;
- state->space = fil_get_first_space_safe();
- } else {
- state->space = fil_get_next_space_safe(state->space);
+ if (state->space) {
+ fil_space_release(state->space);
+ }
+ state->space = NULL;
}
- while (!state->should_shutdown() && state->space != ULINT_UNDEFINED) {
- fil_space_t* space = fil_space_found_by_id(state->space);
+ /* If key rotation is enabled (default) we iterate all tablespaces.
+ If key rotation is not enabled we iterate only the tablespaces
+ added to keyrotation list. */
+ if (srv_fil_crypt_rotate_key_age) {
+ state->space = fil_space_next(state->space);
+ } else {
+ state->space = fil_space_keyrotate_next(state->space);
+ }
- if (space) {
- if (fil_crypt_space_needs_rotation(state, key_state, recheck)) {
- ut_ad(key_state->key_id);
- /* init state->min_key_version_found before
- * starting on a space */
- state->min_key_version_found = key_state->key_version;
- return true;
- }
+ while (!state->should_shutdown() && state->space) {
+ if (fil_crypt_space_needs_rotation(state, key_state, recheck)) {
+ ut_ad(key_state->key_id);
+ /* init state->min_key_version_found before
+ * starting on a space */
+ state->min_key_version_found = key_state->key_version;
+ return true;
}
- state->space = fil_get_next_space_safe(state->space);
+ if (srv_fil_crypt_rotate_key_age) {
+ state->space = fil_space_next(state->space);
+ } else {
+ state->space = fil_space_keyrotate_next(state->space);
+ }
}
/* if we didn't find any space return iops */
@@ -1675,16 +1668,16 @@ fil_crypt_find_space_to_rotate(
}
/***********************************************************************
-Start rotating a space */
+Start rotating a space
+@param[in] key_state Key state
+@param[in,out] state Rotation state */
static
void
fil_crypt_start_rotate_space(
-/*=========================*/
- const key_state_t* key_state, /*!< in: Key state */
- rotate_thread_t* state) /*!< in: Key rotation state */
+ const key_state_t* key_state,
+ rotate_thread_t* state)
{
- ulint space = state->space;
- fil_space_crypt_t *crypt_data = fil_space_get_crypt_data(space);
+ fil_space_crypt_t *crypt_data = state->space->crypt_data;
ut_ad(crypt_data);
mutex_enter(&crypt_data->mutex);
@@ -1695,8 +1688,9 @@ fil_crypt_start_rotate_space(
crypt_data->rotate_state.next_offset = 1; // skip page 0
/* no need to rotate beyond current max
* if space extends, it will be encrypted with newer version */
- crypt_data->rotate_state.max_offset = fil_space_get_size(space);
-
+ /* FIXME: max_offset could be removed and instead
+ space->size consulted.*/
+ crypt_data->rotate_state.max_offset = state->space->size;
crypt_data->rotate_state.end_lsn = 0;
crypt_data->rotate_state.min_key_version_found =
key_state->key_version;
@@ -1724,26 +1718,34 @@ fil_crypt_start_rotate_space(
/***********************************************************************
Search for batch of pages needing rotation
+@param[in] key_state Key state
+@param[in,out] state Rotation state
@return true if page needing key rotation found, false if not found */
static
bool
fil_crypt_find_page_to_rotate(
-/*==========================*/
- const key_state_t* key_state, /*!< in: Key state */
- rotate_thread_t* state) /*!< in: Key rotation state */
+ const key_state_t* key_state,
+ rotate_thread_t* state)
{
ulint batch = srv_alloc_time * state->allocated_iops;
- ulint space = state->space;
- fil_space_crypt_t *crypt_data = fil_space_get_crypt_data(space);
+ fil_space_t* space = state->space;
+
+ ut_ad(!space || space->n_pending_ops > 0);
+
+ /* If space is marked to be dropped stop rotation. */
+ if (!space || space->is_stopping()) {
+ return false;
+ }
+
+ fil_space_crypt_t *crypt_data = space->crypt_data;
/* Space might already be dropped */
if (crypt_data) {
mutex_enter(&crypt_data->mutex);
ut_ad(key_state->key_id == crypt_data->key_id);
- if (!crypt_data->is_closing(true) &&
- crypt_data->rotate_state.next_offset <
- crypt_data->rotate_state.max_offset) {
+ if (crypt_data->rotate_state.next_offset <
+ crypt_data->rotate_state.max_offset) {
state->offset = crypt_data->rotate_state.next_offset;
ulint remaining = crypt_data->rotate_state.max_offset -
@@ -1768,59 +1770,47 @@ fil_crypt_find_page_to_rotate(
/***********************************************************************
Check if a page is uninitialized (doesn't need to be rotated)
-@return true if page is uninitialized, false if not.*/
-static
+@param[in] frame Page to check
+@param[in] zip_size zip_size or 0
+@return true if page is uninitialized, false if not. */
+static inline
bool
fil_crypt_is_page_uninitialized(
-/*============================*/
- const byte *frame, /*!< in: Page */
- uint zip_size) /*!< in: compressed size if
- row_format compressed */
+ const byte *frame,
+ uint zip_size)
{
- if (zip_size) {
- ulint stored_checksum = mach_read_from_4(
- frame + FIL_PAGE_SPACE_OR_CHKSUM);
- /* empty pages aren't encrypted */
- if (stored_checksum == 0) {
- return true;
- }
- } else {
- ulint size = UNIV_PAGE_SIZE;
- ulint checksum_field1 = mach_read_from_4(
- frame + FIL_PAGE_SPACE_OR_CHKSUM);
- ulint checksum_field2 = mach_read_from_4(
- frame + size - FIL_PAGE_END_LSN_OLD_CHKSUM);
- /* empty pages are not encrypted */
- if (checksum_field1 == 0 && checksum_field2 == 0
- && mach_read_from_4(frame + FIL_PAGE_LSN) == 0) {
- return true;
- }
- }
- return false;
+ return (buf_page_is_zeroes(frame, zip_size));
}
-#define fil_crypt_get_page_throttle(state,space,zip_size,offset,mtr,sleeptime_ms) \
- fil_crypt_get_page_throttle_func(state, space, zip_size, offset, mtr, \
+#define fil_crypt_get_page_throttle(state,offset,mtr,sleeptime_ms) \
+ fil_crypt_get_page_throttle_func(state, offset, mtr, \
sleeptime_ms, __FILE__, __LINE__)
/***********************************************************************
Get a page and compute sleep time
-@return page */
+@param[in,out] state Rotation state
+@param[in] zip_size compressed size or 0
+@param[in] offset Page offset
+@param[in,out] mtr Minitransaction
+@param[out] sleeptime_ms Sleep time
+@param[in] file File where called
+@param[in] line Line where called
+@return page or NULL*/
static
buf_block_t*
fil_crypt_get_page_throttle_func(
-/*=============================*/
- rotate_thread_t* state, /*!< in/out: Key rotation state */
- ulint space, /*!< in: FIL space id */
- uint zip_size, /*!< in: compressed size if
- row_format compressed */
- ulint offset, /*!< in: page offsett */
- mtr_t* mtr, /*!< in/out: minitransaction */
- ulint* sleeptime_ms, /*!< out: sleep time */
- const char* file, /*!< in: file name */
- ulint line) /*!< in: file line */
+ rotate_thread_t* state,
+ ulint offset,
+ mtr_t* mtr,
+ ulint* sleeptime_ms,
+ const char* file,
+ ulint line)
{
- buf_block_t* block = buf_page_try_get_func(space, offset, RW_X_LATCH,
+ fil_space_t* space = state->space;
+ ulint zip_size = fsp_flags_get_zip_size(space->flags);
+ ut_ad(space->n_pending_ops > 0);
+
+ buf_block_t* block = buf_page_try_get_func(space->id, offset, RW_X_LATCH,
true,
file, line, mtr);
if (block != NULL) {
@@ -1831,16 +1821,14 @@ fil_crypt_get_page_throttle_func(
/* Before reading from tablespace we need to make sure that
tablespace exists and is not is just being dropped. */
-
- if (fil_crypt_is_closing(space) ||
- fil_space_found_by_id(space) == NULL) {
+ if (space->is_stopping()) {
return NULL;
}
state->crypt_stat.pages_read_from_disk++;
ullint start = ut_time_us(NULL);
- block = buf_page_get_gen(space, zip_size, offset,
+ block = buf_page_get_gen(space->id, zip_size, offset,
RW_X_LATCH,
NULL, BUF_GET_POSSIBLY_FREED,
file, line, mtr);
@@ -1866,6 +1854,7 @@ fil_crypt_get_page_throttle_func(
}
*sleeptime_ms += add_sleeptime_ms;
+
return block;
}
@@ -1875,27 +1864,35 @@ Get block and allocation status
note: innodb locks fil_space_latch and then block when allocating page
but locks block and then fil_space_latch when freeing page.
-@return block
+
+@param[in,out] state Rotation state
+@param[in] zip_size Compressed size or 0
+@param[in] offset Page offset
+@param[in,out] mtr Minitransaction
+@param[out] allocation_status Allocation status
+@param[out] sleeptime_ms Sleep time
+@return block or NULL
*/
static
buf_block_t*
btr_scrub_get_block_and_allocation_status(
-/*======================================*/
- rotate_thread_t* state, /*!< in/out: Key rotation state */
- ulint space, /*!< in: FIL space id */
- uint zip_size, /*!< in: compressed size if
- row_format compressed */
- ulint offset, /*!< in: page offsett */
- mtr_t* mtr, /*!< in/out: minitransaction
- */
+ rotate_thread_t* state,
+ uint zip_size,
+ ulint offset,
+ mtr_t* mtr,
btr_scrub_page_allocation_status_t *allocation_status,
- /*!< in/out: allocation status */
- ulint* sleeptime_ms) /*!< out: sleep time */
+ ulint* sleeptime_ms)
{
mtr_t local_mtr;
buf_block_t *block = NULL;
+ fil_space_t* space = state->space;
+
+ ut_ad(space->n_pending_ops > 0);
+ ut_ad(zip_size == fsp_flags_get_zip_size(space->flags));
+
mtr_start(&local_mtr);
- *allocation_status = fsp_page_is_free(space, offset, &local_mtr) ?
+
+ *allocation_status = fsp_page_is_free(space->id, offset, &local_mtr) ?
BTR_SCRUB_PAGE_FREE :
BTR_SCRUB_PAGE_ALLOCATED;
@@ -1903,7 +1900,6 @@ btr_scrub_get_block_and_allocation_status(
/* this is easy case, we lock fil_space_latch first and
then block */
block = fil_crypt_get_page_throttle(state,
- space, zip_size,
offset, mtr,
sleeptime_ms);
mtr_commit(&local_mtr);
@@ -1920,7 +1916,6 @@ btr_scrub_get_block_and_allocation_status(
*/
block = fil_crypt_get_page_throttle(state,
- space, zip_size,
offset, mtr,
sleeptime_ms);
}
@@ -1930,21 +1925,29 @@ btr_scrub_get_block_and_allocation_status(
/***********************************************************************
-Rotate one page */
+Rotate one page
+@param[in,out] key_state Key state
+@param[in,out] state Rotation state */
static
void
fil_crypt_rotate_page(
-/*==================*/
- const key_state_t* key_state, /*!< in: Key state */
- rotate_thread_t* state) /*!< in: Key rotation state */
+ const key_state_t* key_state,
+ rotate_thread_t* state)
{
- ulint space = state->space;
+ fil_space_t*space = state->space;
+ ulint space_id = space->id;
ulint offset = state->offset;
- const uint zip_size = fil_space_get_zip_size(space);
+ const uint zip_size = fsp_flags_get_zip_size(space->flags);
ulint sleeptime_ms = 0;
+ fil_space_crypt_t *crypt_data = space->crypt_data;
- /* check if tablespace is closing before reading page */
- if (fil_crypt_is_closing(space) || fil_space_found_by_id(space) == NULL) {
+ ut_ad(space->n_pending_ops > 0);
+
+ /* In fil_crypt_thread where key rotation is done we have
+ acquired space and checked that this space is not yet
+ marked to be dropped. Similarly, in fil_crypt_find_page_to_rotate().
+ Check here also to give DROP TABLE or similar a change. */
+ if (space->is_stopping()) {
return;
}
@@ -1956,7 +1959,6 @@ fil_crypt_rotate_page(
mtr_t mtr;
mtr_start(&mtr);
buf_block_t* block = fil_crypt_get_page_throttle(state,
- space, zip_size,
offset, &mtr,
&sleeptime_ms);
@@ -1968,9 +1970,8 @@ fil_crypt_rotate_page(
uint kv = block->page.key_version;
/* check if tablespace is closing after reading page */
- if (!fil_crypt_is_closing(space)) {
+ if (space->is_stopping()) {
byte* frame = buf_block_get_frame(block);
- fil_space_crypt_t *crypt_data = fil_space_get_crypt_data(space);
if (kv == 0 &&
fil_crypt_is_page_uninitialized(frame, zip_size)) {
@@ -1990,7 +1991,7 @@ fil_crypt_rotate_page(
/* force rotation by dummy updating page */
mlog_write_ulint(frame +
FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID,
- space, MLOG_4BYTES, &mtr);
+ space_id, MLOG_4BYTES, &mtr);
/* update block */
block->page.key_version = key_state->key_version;
@@ -2023,7 +2024,7 @@ fil_crypt_rotate_page(
*/
btr_scrub_page_allocation_status_t allocated;
block = btr_scrub_get_block_and_allocation_status(
- state, space, zip_size, offset, &mtr,
+ state, zip_size, offset, &mtr,
&allocated,
&sleeptime_ms);
@@ -2037,7 +2038,7 @@ fil_crypt_rotate_page(
/* we need to refetch it once more now that we have
* index locked */
block = btr_scrub_get_block_and_allocation_status(
- state, space, zip_size, offset, &mtr,
+ state, zip_size, offset, &mtr,
&allocated,
&sleeptime_ms);
@@ -2068,7 +2069,6 @@ fil_crypt_rotate_page(
if (needs_scrubbing == BTR_SCRUB_TURNED_OFF) {
/* if we just detected that scrubbing was turned off
* update global state to reflect this */
- fil_space_crypt_t *crypt_data = fil_space_get_crypt_data(space);
ut_ad(crypt_data);
mutex_enter(&crypt_data->mutex);
crypt_data->rotate_state.scrubbing.is_active = false;
@@ -2096,17 +2096,20 @@ fil_crypt_rotate_page(
}
/***********************************************************************
-Rotate a batch of pages */
+Rotate a batch of pages
+@param[in,out] key_state Key state
+@param[in,out] state Rotation state */
static
void
fil_crypt_rotate_pages(
-/*===================*/
- const key_state_t* key_state, /*!< in: Key state */
- rotate_thread_t* state) /*!< in: Key rotation state */
+ const key_state_t* key_state,
+ rotate_thread_t* state)
{
- ulint space = state->space;
+ ulint space = state->space->id;
ulint end = state->offset + state->batch;
+ ut_ad(state->space->n_pending_ops > 0);
+
for (; state->offset < end; state->offset++) {
/* we can't rotate pages in dblwr buffer as
@@ -2127,20 +2130,23 @@ fil_crypt_rotate_pages(
}
/***********************************************************************
-Flush rotated pages and then update page 0 */
+Flush rotated pages and then update page 0
+
+@param[in,out] state rotation state */
static
void
fil_crypt_flush_space(
-/*==================*/
- rotate_thread_t* state, /*!< in: Key rotation state */
- ulint space) /*!< in: FIL space id */
+ rotate_thread_t* state)
{
- fil_space_crypt_t *crypt_data = fil_space_get_crypt_data(space);
+ fil_space_t* space = state->space;
+ fil_space_crypt_t *crypt_data = space->crypt_data;
+
+ ut_ad(space->n_pending_ops > 0);
/* flush tablespace pages so that there are no pages left with old key */
lsn_t end_lsn = crypt_data->rotate_state.end_lsn;
- if (end_lsn > 0 && !fil_crypt_is_closing(space)) {
+ if (end_lsn > 0 && !space->is_stopping()) {
bool success = false;
ulint n_pages = 0;
ulint sum_pages = 0;
@@ -2150,7 +2156,7 @@ fil_crypt_flush_space(
success = buf_flush_list(ULINT_MAX, end_lsn, &n_pages);
buf_flush_wait_batch_end(NULL, BUF_FLUSH_LIST);
sum_pages += n_pages;
- } while (!success && !fil_crypt_is_closing(space));
+ } while (!success && !space->is_stopping());
ullint end = ut_time_us(NULL);
@@ -2168,40 +2174,38 @@ fil_crypt_flush_space(
}
/* update page 0 */
- if (!fil_crypt_is_closing(space)) {
- mtr_t mtr;
- mtr_start(&mtr);
- ulint offset = 0; // page 0
- const uint zip_size = fil_space_get_zip_size(space);
- buf_block_t* block = buf_page_get_gen(space, zip_size, offset,
- RW_X_LATCH, NULL, BUF_GET,
- __FILE__, __LINE__, &mtr);
- byte* frame = buf_block_get_frame(block);
- ulint maxsize;
- crypt_data->page0_offset =
- fsp_header_get_crypt_offset(zip_size, &maxsize);
+ mtr_t mtr;
+ mtr_start(&mtr);
- fil_space_write_crypt_data(space, frame,
- crypt_data->page0_offset,
- ULINT_MAX, &mtr);
- mtr_commit(&mtr);
- }
+ const uint zip_size = fsp_flags_get_zip_size(state->space->flags);
+
+ buf_block_t* block = buf_page_get_gen(space->id, zip_size, 0,
+ RW_X_LATCH, NULL, BUF_GET,
+ __FILE__, __LINE__, &mtr);
+ byte* frame = buf_block_get_frame(block);
+
+ crypt_data->write_page0(frame, &mtr);
+
+ mtr_commit(&mtr);
}
/***********************************************************************
-Complete rotating a space */
+Complete rotating a space
+@param[in,out] key_state Key state
+@param[in,out] state Rotation state */
static
void
fil_crypt_complete_rotate_space(
-/*============================*/
- const key_state_t* key_state, /*!< in: Key state */
- rotate_thread_t* state) /*!< in: Key rotation state */
+ const key_state_t* key_state,
+ rotate_thread_t* state)
{
- ulint space = state->space;
- fil_space_crypt_t *crypt_data = fil_space_get_crypt_data(space);
+ fil_space_crypt_t *crypt_data = state->space->crypt_data;
+
+ ut_ad(crypt_data);
+ ut_ad(state->space->n_pending_ops > 0);
/* Space might already be dropped */
- if (crypt_data != NULL && !crypt_data->is_closing(false)) {
+ if (!state->space->is_stopping()) {
mutex_enter(&crypt_data->mutex);
/**
@@ -2259,9 +2263,8 @@ fil_crypt_complete_rotate_space(
}
if (should_flush) {
- fil_crypt_flush_space(state, space);
+ fil_crypt_flush_space(state);
- ut_ad(crypt_data);
mutex_enter(&crypt_data->mutex);
crypt_data->rotate_state.flushing = false;
mutex_exit(&crypt_data->mutex);
@@ -2284,8 +2287,8 @@ DECLARE_THREAD(fil_crypt_thread)(
mutex_enter(&fil_crypt_threads_mutex);
uint thread_no = srv_n_fil_crypt_threads_started;
srv_n_fil_crypt_threads_started++;
- mutex_exit(&fil_crypt_threads_mutex);
os_event_set(fil_crypt_event); /* signal that we started */
+ mutex_exit(&fil_crypt_threads_mutex);
/* state of this thread */
rotate_thread_t thr(thread_no);
@@ -2305,6 +2308,7 @@ DECLARE_THREAD(fil_crypt_thread)(
* i.e either new key version of change or
* new rotate_key_age */
os_event_reset(fil_crypt_threads_event);
+
if (os_event_wait_time(fil_crypt_threads_event, 1000000) == 0) {
break;
}
@@ -2318,7 +2322,12 @@ DECLARE_THREAD(fil_crypt_thread)(
time_t waited = time(0) - wait_start;
- if (waited >= (time_t) srv_background_scrub_data_check_interval) {
+ /* Break if we have waited the background scrub
+ internal and background scrubbing is enabled */
+ if (waited >= 0
+ && ulint(waited) >= srv_background_scrub_data_check_interval
+ && (srv_background_scrub_data_uncompressed
+ || srv_background_scrub_data_compressed)) {
break;
}
}
@@ -2333,29 +2342,32 @@ DECLARE_THREAD(fil_crypt_thread)(
/* we found a space to rotate */
fil_crypt_start_rotate_space(&new_state, &thr);
- /* decrement pending ops that was incremented in
- * fil_crypt_space_needs_rotation
- * (called from fil_crypt_find_space_to_rotate),
- * this makes sure that tablespace won't be dropped
- * just after we decided to start processing it. */
- fil_decr_pending_ops(thr.space);
-
/* iterate all pages (cooperativly with other threads) */
- while (!thr.should_shutdown() &&
+ while (!thr.should_shutdown() && thr.space &&
fil_crypt_find_page_to_rotate(&new_state, &thr)) {
/* rotate a (set) of pages */
fil_crypt_rotate_pages(&new_state, &thr);
+ /* If space is marked as stopping, release
+ space and stop rotation. */
+ if (thr.space->is_stopping()) {
+ fil_space_release(thr.space);
+ thr.space = NULL;
+ break;
+ }
+
/* realloc iops */
fil_crypt_realloc_iops(&thr);
}
/* complete rotation */
- fil_crypt_complete_rotate_space(&new_state, &thr);
+ if (thr.space) {
+ fil_crypt_complete_rotate_space(&new_state, &thr);
+ }
/* force key state refresh */
- new_state.key_id= 0;
+ new_state.key_id = 0;
/* return iops */
fil_crypt_return_iops(&thr);
@@ -2365,10 +2377,16 @@ DECLARE_THREAD(fil_crypt_thread)(
/* return iops if shutting down */
fil_crypt_return_iops(&thr);
+ /* release current space if shutting down */
+ if (thr.space) {
+ fil_space_release(thr.space);
+ thr.space = NULL;
+ }
+
mutex_enter(&fil_crypt_threads_mutex);
srv_n_fil_crypt_threads_started--;
- mutex_exit(&fil_crypt_threads_mutex);
os_event_set(fil_crypt_event); /* signal that we stopped */
+ mutex_exit(&fil_crypt_threads_mutex);
/* We count the number of threads in os_thread_exit(). A created
thread should always use that to exit and not use return() to exit. */
@@ -2379,23 +2397,26 @@ DECLARE_THREAD(fil_crypt_thread)(
}
/*********************************************************************
-Adjust thread count for key rotation */
+Adjust thread count for key rotation
+@param[in] enw_cnt Number of threads to be used */
UNIV_INTERN
void
fil_crypt_set_thread_cnt(
-/*=====================*/
- uint new_cnt) /*!< in: New key rotation thread count */
+ const uint new_cnt)
{
if (!fil_crypt_threads_inited) {
fil_crypt_threads_init();
}
+ mutex_enter(&fil_crypt_threads_mutex);
+
if (new_cnt > srv_n_fil_crypt_threads) {
uint add = new_cnt - srv_n_fil_crypt_threads;
srv_n_fil_crypt_threads = new_cnt;
for (uint i = 0; i < add; i++) {
os_thread_id_t rotation_thread_id;
os_thread_create(fil_crypt_thread, NULL, &rotation_thread_id);
+
ib_logf(IB_LOG_LEVEL_INFO,
"Creating #%d thread id %lu total threads %u.",
i+1, os_thread_pf(rotation_thread_id), new_cnt);
@@ -2405,6 +2426,8 @@ fil_crypt_set_thread_cnt(
os_event_set(fil_crypt_threads_event);
}
+ mutex_exit(&fil_crypt_threads_mutex);
+
while(srv_n_fil_crypt_threads_started != srv_n_fil_crypt_threads) {
os_event_reset(fil_crypt_event);
os_event_wait_time(fil_crypt_event, 1000000);
@@ -2412,39 +2435,39 @@ fil_crypt_set_thread_cnt(
}
/*********************************************************************
-Adjust max key age */
+Adjust max key age
+@param[in] val New max key age */
UNIV_INTERN
void
fil_crypt_set_rotate_key_age(
-/*=========================*/
- uint val) /*!< in: New max key age */
+ uint val)
{
srv_fil_crypt_rotate_key_age = val;
os_event_set(fil_crypt_threads_event);
}
/*********************************************************************
-Adjust rotation iops */
+Adjust rotation iops
+@param[in] val New max roation iops */
UNIV_INTERN
void
fil_crypt_set_rotation_iops(
-/*========================*/
- uint val) /*!< in: New iops setting */
+ uint val)
{
srv_n_fil_crypt_iops = val;
os_event_set(fil_crypt_threads_event);
}
/*********************************************************************
-Adjust encrypt tables */
+Adjust encrypt tables
+@param[in] val New setting for innodb-encrypt-tables */
UNIV_INTERN
void
fil_crypt_set_encrypt_tables(
-/*=========================*/
- uint val) /*!< in: New srv_encrypt_tables setting */
+ uint val)
{
- srv_encrypt_tables = val;
- os_event_set(fil_crypt_threads_event);
+ srv_encrypt_tables = val;
+ os_event_set(fil_crypt_threads_event);
}
/*********************************************************************
@@ -2452,7 +2475,6 @@ Init threads for key rotation */
UNIV_INTERN
void
fil_crypt_threads_init()
-/*====================*/
{
ut_ad(mutex_own(&fil_system->mutex));
if (!fil_crypt_threads_inited) {
@@ -2473,75 +2495,40 @@ Clean up key rotation threads resources */
UNIV_INTERN
void
fil_crypt_threads_cleanup()
-/*=======================*/
{
if (!fil_crypt_threads_inited) {
return;
}
ut_a(!srv_n_fil_crypt_threads_started);
os_event_free(fil_crypt_event);
+ fil_crypt_event = NULL;
os_event_free(fil_crypt_threads_event);
+ fil_crypt_threads_event = NULL;
mutex_free(&fil_crypt_threads_mutex);
fil_crypt_threads_inited = false;
}
/*********************************************************************
-Mark a space as closing */
-UNIV_INTERN
-void
-fil_space_crypt_mark_space_closing(
-/*===============================*/
- ulint space, /*!< in: tablespace id */
- fil_space_crypt_t* crypt_data) /*!< in: crypt_data or NULL */
-{
- if (!fil_crypt_threads_inited) {
- return;
- }
-
- mutex_enter(&fil_crypt_threads_mutex);
-
- if (!crypt_data) {
- crypt_data = fil_space_get_crypt_data(space);
- }
-
- if (crypt_data == NULL) {
- mutex_exit(&fil_crypt_threads_mutex);
- return;
- }
-
- mutex_enter(&crypt_data->mutex);
- mutex_exit(&fil_crypt_threads_mutex);
- crypt_data->closing = true;
- mutex_exit(&crypt_data->mutex);
-}
-
-/*********************************************************************
-Wait for crypt threads to stop accessing space */
+Wait for crypt threads to stop accessing space
+@param[in] space Tablespace */
UNIV_INTERN
void
fil_space_crypt_close_tablespace(
-/*=============================*/
- ulint space) /*!< in: Space id */
+ const fil_space_t* space)
{
- if (!srv_encrypt_tables) {
+ if (!srv_encrypt_tables || !space->crypt_data) {
return;
}
mutex_enter(&fil_crypt_threads_mutex);
- fil_space_crypt_t* crypt_data = fil_space_get_crypt_data(space);
-
- if (crypt_data == NULL || crypt_data->is_closing(false)) {
- mutex_exit(&fil_crypt_threads_mutex);
- return;
- }
+ fil_space_crypt_t* crypt_data = space->crypt_data;
- 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);
- crypt_data->closing = true;
uint cnt = crypt_data->rotate_state.active_threads;
bool flushing = crypt_data->rotate_state.flushing;
@@ -2551,20 +2538,22 @@ fil_space_crypt_close_tablespace(
/* release dict mutex so that scrub threads can release their
* table references */
dict_mutex_exit_for_mysql();
+
/* wakeup throttle (all) sleepers */
os_event_set(fil_crypt_throttle_sleep_event);
+
os_thread_sleep(20000);
dict_mutex_enter_for_mysql();
mutex_enter(&crypt_data->mutex);
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_logf(IB_LOG_LEVEL_WARN,
- "Waited %u seconds to drop space: %lu.",
- now - start, space);
+ "Waited %ld seconds to drop space: %s(" ULINTPF ").",
+ now - start, space->name, space->id);
last = now;
}
}
@@ -2574,22 +2563,23 @@ fil_space_crypt_close_tablespace(
/*********************************************************************
Get crypt status for a space (used by information_schema)
-return 0 if crypt data present */
+@param[in] space Tablespace
+@param[out] status Crypt status */
UNIV_INTERN
-int
+void
fil_space_crypt_get_status(
-/*=======================*/
- ulint id, /*!< in: space id */
- struct fil_space_crypt_status_t* status) /*!< out: status */
+ const fil_space_t* space,
+ struct fil_space_crypt_status_t* status)
{
- fil_space_crypt_t* crypt_data = fil_space_get_crypt_data(id);
-
memset(status, 0, sizeof(*status));
+ ut_ad(space->n_pending_ops > 0);
+ fil_space_crypt_t* crypt_data = space->crypt_data;
+ status->space = space->id;
+
if (crypt_data != NULL) {
- status->space = id;
- status->scheme = crypt_data->type;
mutex_enter(&crypt_data->mutex);
+ status->scheme = crypt_data->type;
status->keyserver_requests = crypt_data->keyserver_requests;
status->min_key_version = crypt_data->min_key_version;
status->key_id = crypt_data->key_id;
@@ -2603,8 +2593,6 @@ fil_space_crypt_get_status(
crypt_data->rotate_state.next_offset;
status->rotate_max_page_number =
crypt_data->rotate_state.max_offset;
- } else {
- status->rotating = false;
}
mutex_exit(&crypt_data->mutex);
@@ -2612,25 +2600,17 @@ fil_space_crypt_get_status(
if (srv_encrypt_tables || crypt_data->min_key_version) {
status->current_key_version =
fil_crypt_get_latest_key_version(crypt_data);
- } else {
- status->current_key_version = 0;
- }
- } else {
- if (srv_encrypt_tables) {
- os_event_set(fil_crypt_threads_event);
}
}
-
- return crypt_data == NULL ? 1 : 0;
}
/*********************************************************************
-Return crypt statistics */
+Return crypt statistics
+@param[out] stat Crypt statistics */
UNIV_INTERN
void
fil_crypt_total_stat(
-/*=================*/
- fil_crypt_stat_t *stat) /*!< out: Crypt statistics */
+ fil_crypt_stat_t *stat)
{
mutex_enter(&crypt_stat_mutex);
*stat = crypt_stat;
@@ -2639,21 +2619,24 @@ fil_crypt_total_stat(
/*********************************************************************
Get scrub status for a space (used by information_schema)
-return 0 if data found */
+
+@param[in] space Tablespace
+@param[out] status Scrub status */
UNIV_INTERN
-int
+void
fil_space_get_scrub_status(
-/*=======================*/
- ulint id, /*!< in: space id */
- struct fil_space_scrub_status_t* status) /*!< out: status */
+ const fil_space_t* space,
+ struct fil_space_scrub_status_t* status)
{
- fil_space_crypt_t* crypt_data = fil_space_get_crypt_data(id);
-
memset(status, 0, sizeof(*status));
+ ut_ad(space->n_pending_ops > 0);
+ fil_space_crypt_t* crypt_data = space->crypt_data;
+
+ status->space = space->id;
+
if (crypt_data != NULL) {
- status->space = id;
- status->compressed = fil_space_get_zip_size(id) > 0;
+ status->compressed = fsp_flags_get_zip_size(space->flags) > 0;
mutex_enter(&crypt_data->mutex);
status->last_scrub_completed =
crypt_data->rotate_state.scrubbing.last_scrub_completed;
@@ -2668,12 +2651,8 @@ fil_space_get_scrub_status(
crypt_data->rotate_state.next_offset;
status->current_scrub_max_page_number =
crypt_data->rotate_state.max_offset;
- } else {
- status->scrubbing = false;
}
mutex_exit(&crypt_data->mutex);
}
-
- return crypt_data == NULL ? 1 : 0;
}
diff --git a/storage/xtradb/fil/fil0fil.cc b/storage/xtradb/fil/fil0fil.cc
index f4301d47028..a116bfad99d 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, 2017, MariaDB Corporation.
+Copyright (c) 2014, 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
@@ -157,7 +157,11 @@ UNIV_INTERN mysql_pfs_key_t fil_space_latch_key;
/** The tablespace memory cache. This variable is NULL before the module is
initialized. */
-fil_system_t* fil_system = NULL;
+UNIV_INTERN fil_system_t* fil_system = NULL;
+
+/** At this age or older a space/page will be rotated */
+UNIV_INTERN extern uint srv_fil_crypt_rotate_key_age;
+UNIV_INTERN extern ib_mutex_t fil_crypt_threads_mutex;
/** Determine if (i) is a user tablespace id or not. */
# define fil_is_user_tablespace_id(i) ((i) > srv_undo_tablespaces_open)
@@ -169,7 +173,7 @@ fil_system_t* fil_system = NULL;
&& srv_unix_file_flush_method == SRV_UNIX_O_DIRECT_NO_FSYNC)\
|| ((s)->purpose == FIL_LOG \
&& srv_unix_file_flush_method == SRV_UNIX_ALL_O_DIRECT))
-
+
#else /* __WIN__ */
# define fil_buffering_disabled(s) (0)
#endif /* __WIN__ */
@@ -601,7 +605,6 @@ fil_node_open_file(
ibool success;
byte* buf2;
byte* page;
- ulint page_size;
ut_ad(mutex_own(&(system->mutex)));
ut_a(node->n_pending == 0);
@@ -619,6 +622,7 @@ fil_node_open_file(
node->handle = os_file_create_simple_no_error_handling(
innodb_file_data_key, node->name, OS_FILE_OPEN,
OS_FILE_READ_ONLY, &success, 0);
+
if (!success) {
/* The following call prints an error message */
os_file_get_last_error(true);
@@ -670,6 +674,16 @@ fil_node_open_file(
const ulint space_id = fsp_header_get_space_id(page);
ulint flags = fsp_header_get_flags(page);
+ /* Try to read crypt_data from page 0 if it is not yet
+ read. */
+ if (!node->space->page_0_crypt_read) {
+ ulint offset = fsp_header_get_crypt_offset(
+ fsp_flags_get_zip_size(flags));
+ ut_ad(node->space->crypt_data == NULL);
+ node->space->crypt_data = fil_space_read_crypt_data(space_id, page, offset);
+ node->space->page_0_crypt_read = true;
+ }
+
ut_free(buf2);
os_file_close(node->handle);
@@ -687,8 +701,6 @@ fil_node_open_file(
flags = cflags;
}
- page_size = fsp_flags_get_page_size(flags);
-
if (UNIV_UNLIKELY(space_id != space->id)) {
ib_logf(IB_LOG_LEVEL_ERROR,
"tablespace id is " ULINTPF " in the data dictionary"
@@ -697,17 +709,10 @@ fil_node_open_file(
return(false);
}
- if (size_bytes >= (1024*1024)) {
- /* Truncate the size to whole extent size. */
- size_bytes = ut_2pow_round(size_bytes, (1024*1024));
- }
-
- if (!fsp_flags_is_compressed(flags)) {
- node->size = (ulint) (size_bytes / UNIV_PAGE_SIZE);
+ if (ulint zip_size = fsp_flags_get_zip_size(flags)) {
+ node->size = ulint(size_bytes / zip_size);
} else {
- node->size = (ulint)
- (size_bytes
- / fsp_flags_get_zip_size(flags));
+ node->size = ulint(size_bytes / UNIV_PAGE_SIZE);
}
#ifdef UNIV_HOTBACKUP
@@ -1041,8 +1046,8 @@ fil_space_extend_must_retry(
we have set the node->being_extended flag. */
mutex_exit(&fil_system->mutex);
- ulint start_page_no = space->size;
- ulint file_start_page_no = start_page_no - node->size;
+ ulint start_page_no = space->size;
+ const ulint file_start_page_no = start_page_no - node->size;
/* Determine correct file block size */
if (node->file_block_size == 0) {
@@ -1052,64 +1057,126 @@ fil_space_extend_must_retry(
}
ulint page_size = fsp_flags_get_zip_size(space->flags);
- ulint pages_added = 0;
-
if (!page_size) {
page_size = UNIV_PAGE_SIZE;
}
-#ifdef HAVE_POSIX_FALLOCATE
+#ifdef _WIN32
+ const ulint io_completion_type = OS_FILE_READ;
+ /* Logically or physically extend the file with zero bytes,
+ depending on whether it is sparse. */
+
+ /* FIXME: Call DeviceIoControl(node->handle, FSCTL_SET_SPARSE, ...)
+ when opening a file when FSP_FLAGS_HAS_PAGE_COMPRESSION(). */
+ {
+ FILE_END_OF_FILE_INFO feof;
+ /* fil_read_first_page() expects UNIV_PAGE_SIZE bytes.
+ fil_node_open_file() expects at least 4 * UNIV_PAGE_SIZE bytes.
+ Do not shrink short ROW_FORMAT=COMPRESSED files. */
+ feof.EndOfFile.QuadPart = std::max(
+ os_offset_t(size - file_start_page_no) * page_size,
+ os_offset_t(FIL_IBD_FILE_INITIAL_SIZE
+ * UNIV_PAGE_SIZE));
+ *success = SetFileInformationByHandle(node->handle,
+ FileEndOfFileInfo,
+ &feof, sizeof feof);
+ if (!*success) {
+ ib_logf(IB_LOG_LEVEL_ERROR, "extending file %s"
+ " from " INT64PF
+ " to " INT64PF " bytes failed with %u",
+ node->name,
+ os_offset_t(node->size) * page_size,
+ feof.EndOfFile.QuadPart, GetLastError());
+ } else {
+ start_page_no = size;
+ }
+ }
+#else
+ /* We will logically extend the file with ftruncate() if
+ page_compression is enabled, because the file is expected to
+ be sparse in that case. Make sure that ftruncate() can deal
+ with large files. */
+ const bool is_sparse = sizeof(off_t) >= 8
+ && FSP_FLAGS_HAS_PAGE_COMPRESSION(space->flags);
+
+# ifdef HAVE_POSIX_FALLOCATE
/* We must complete the I/O request after invoking
posix_fallocate() to avoid an assertion failure at shutdown.
Because no actual writes were dispatched, a read operation
will suffice. */
const ulint io_completion_type = srv_use_posix_fallocate
- ? OS_FILE_READ : OS_FILE_WRITE;
+ || is_sparse ? OS_FILE_READ : OS_FILE_WRITE;
+
+ if (srv_use_posix_fallocate && !is_sparse) {
+ const os_offset_t start_offset
+ = os_offset_t(start_page_no - file_start_page_no)
+ * page_size;
+ const ulint n_pages = size - start_page_no;
+ const os_offset_t len = os_offset_t(n_pages) * page_size;
- if (srv_use_posix_fallocate) {
- const os_offset_t start_offset = static_cast<os_offset_t>(
- start_page_no) * page_size;
- const os_offset_t len = static_cast<os_offset_t>(
- pages_added) * page_size;
+ int err;
+ do {
+ err = posix_fallocate(node->handle, start_offset, len);
+ } while (err == EINTR
+ && srv_shutdown_state == SRV_SHUTDOWN_NONE);
- *success = !posix_fallocate(node->handle, start_offset, len);
+ *success = !err;
if (!*success) {
- ib_logf(IB_LOG_LEVEL_ERROR, "preallocating file "
- "space for file \'%s\' failed. Current size "
- INT64PF ", desired size " INT64PF,
- node->name, start_offset, len+start_offset);
- os_file_handle_error_no_exit(
- node->name, "posix_fallocate",
- FALSE, __FILE__, __LINE__);
+ ib_logf(IB_LOG_LEVEL_ERROR, "extending file %s"
+ " from " INT64PF " to " INT64PF " bytes"
+ " failed with error %d",
+ node->name, start_offset, len + start_offset,
+ err);
}
DBUG_EXECUTE_IF("ib_os_aio_func_io_failure_28",
- *success = FALSE; errno = 28;
+ *success = FALSE;
os_has_said_disk_full = TRUE;);
if (*success) {
os_has_said_disk_full = FALSE;
- } else {
- pages_added = 0;
+ start_page_no = size;
}
} else
-#else
- const ulint io_completion_type = OS_FILE_WRITE;
-#endif
- {
- byte* buf2;
- byte* buf;
- ulint buf_size;
-
+# else
+ const ulint io_completion_type = is_sparse
+ ? OS_FILE_READ : OS_FILE_WRITE;
+# endif
+ if (is_sparse) {
+ /* fil_read_first_page() expects UNIV_PAGE_SIZE bytes.
+ fil_node_open_file() expects at least 4 * UNIV_PAGE_SIZE bytes.
+ Do not shrink short ROW_FORMAT=COMPRESSED files. */
+ off_t s = std::max(off_t(size - file_start_page_no)
+ * off_t(page_size),
+ off_t(FIL_IBD_FILE_INITIAL_SIZE
+ * UNIV_PAGE_SIZE));
+ *success = !ftruncate(node->handle, s);
+ if (!*success) {
+ ib_logf(IB_LOG_LEVEL_ERROR, "ftruncate of file %s"
+ " from " INT64PF " to " INT64PF " bytes"
+ " failed with error %d",
+ node->name,
+ os_offset_t(start_page_no - file_start_page_no)
+ * page_size, os_offset_t(s), errno);
+ } else {
+ start_page_no = size;
+ }
+ } else {
/* Extend at most 64 pages at a time */
- buf_size = ut_min(64, size - start_page_no)
+ ulint buf_size = ut_min(64, size - start_page_no)
* page_size;
- buf2 = static_cast<byte*>(mem_alloc(buf_size + page_size));
- buf = static_cast<byte*>(ut_align(buf2, page_size));
-
- memset(buf, 0, buf_size);
-
- while (start_page_no < size) {
+ byte* buf2 = static_cast<byte*>(
+ calloc(1, buf_size + page_size));
+ *success = buf2 != NULL;
+ if (!buf2) {
+ ib_logf(IB_LOG_LEVEL_ERROR, "Cannot allocate " ULINTPF
+ " bytes to extend file",
+ buf_size + page_size);
+ }
+ byte* const buf = static_cast<byte*>(
+ ut_align(buf2, page_size));
+
+ while (*success && start_page_no < size) {
ulint n_pages
= ut_min(buf_size / page_size,
size - start_page_no);
@@ -1118,50 +1185,40 @@ fil_space_extend_must_retry(
start_page_no - file_start_page_no)
* page_size;
- const char* name = node->name == NULL
- ? space->name : node->name;
-
*success = os_aio(OS_FILE_WRITE, 0, OS_AIO_SYNC,
- name, node->handle, buf,
+ node->name, node->handle, buf,
offset, page_size * n_pages,
page_size, node, NULL,
space->id, NULL, 0);
DBUG_EXECUTE_IF("ib_os_aio_func_io_failure_28",
- *success = FALSE; errno = 28;
+ *success = FALSE;
os_has_said_disk_full = TRUE;);
if (*success) {
os_has_said_disk_full = FALSE;
- } else {
- /* Let us measure the size of the file
- to determine how much we were able to
- extend it */
- os_offset_t size;
-
- size = os_file_get_size(node->handle);
- ut_a(size != (os_offset_t) -1);
-
- n_pages = ((ulint) (size / page_size))
- - node->size - pages_added;
-
- pages_added += n_pages;
- break;
}
+ /* Let us measure the size of the file
+ to determine how much we were able to
+ extend it */
+ os_offset_t fsize = os_file_get_size(node->handle);
+ ut_a(fsize != os_offset_t(-1));
- start_page_no += n_pages;
- pages_added += n_pages;
+ start_page_no = ulint(fsize / page_size)
+ + file_start_page_no;
}
- mem_free(buf2);
+ free(buf2);
}
-
+#endif
mutex_enter(&fil_system->mutex);
ut_a(node->being_extended);
+ ut_a(start_page_no - file_start_page_no >= node->size);
- space->size += pages_added;
- node->size += pages_added;
+ ulint file_size = start_page_no - file_start_page_no;
+ space->size += file_size - node->size;
+ node->size = file_size;
fil_node_complete_io(node, fil_system, io_completion_type);
@@ -1449,17 +1506,24 @@ fil_space_contains_node(
/*******************************************************************//**
Creates a space memory object and puts it to the 'fil system' hash table.
If there is an error, prints an error message to the .err log.
+@param[in] name Space name
+@param[in] id Space id
+@param[in] flags Tablespace flags
+@param[in] purpose FIL_TABLESPACE or FIL_LOG if log
+@param[in] crypt_data Encryption information
+@param[in] create_table True if this is create table
+@param[in] mode Encryption mode
@return TRUE if success */
UNIV_INTERN
-ibool
+bool
fil_space_create(
-/*=============*/
- const char* name, /*!< in: space name */
- ulint id, /*!< in: space id */
- ulint flags, /*!< in: tablespace flags */
- ulint purpose,/*!< in: FIL_TABLESPACE, or FIL_LOG if log */
- fil_space_crypt_t* crypt_data, /*!< in: crypt data */
- bool create_table) /*!< in: true if create table */
+ const char* name,
+ ulint id,
+ ulint flags,
+ ulint purpose,
+ fil_space_crypt_t* crypt_data,
+ bool create_table,
+ fil_encryption_t mode)
{
fil_space_t* space;
@@ -1483,7 +1547,7 @@ fil_space_create(
mutex_exit(&fil_system->mutex);
- return(FALSE);
+ return(false);
}
ib_logf(IB_LOG_LEVEL_WARN,
@@ -1510,7 +1574,7 @@ fil_space_create(
mutex_exit(&fil_system->mutex);
- return(FALSE);
+ return(false);
}
space = static_cast<fil_space_t*>(mem_zalloc(sizeof(*space)));
@@ -1541,17 +1605,6 @@ fil_space_create(
space->flags = flags;
space->magic_n = FIL_SPACE_MAGIC_N;
- space->printed_compression_failure = false;
-
- rw_lock_create(fil_space_latch_key, &space->latch, SYNC_FSP);
-
- HASH_INSERT(fil_space_t, hash, fil_system->spaces, id, space);
-
- HASH_INSERT(fil_space_t, name_hash, fil_system->name_hash,
- ut_fold_string(name), space);
- space->is_in_unflushed_spaces = false;
-
- space->is_corrupt = FALSE;
space->crypt_data = crypt_data;
/* In create table we write page 0 so we have already
@@ -1570,11 +1623,33 @@ fil_space_create(
space->crypt_data ? space->crypt_data->encryption : 0);
#endif
+ rw_lock_create(fil_space_latch_key, &space->latch, SYNC_FSP);
+
+ HASH_INSERT(fil_space_t, hash, fil_system->spaces, id, space);
+
+ HASH_INSERT(fil_space_t, name_hash, fil_system->name_hash,
+ ut_fold_string(name), space);
+
UT_LIST_ADD_LAST(space_list, fil_system->space_list, space);
- mutex_exit(&fil_system->mutex);
+ /* Inform key rotation that there could be something
+ to do */
+ if (purpose == FIL_TABLESPACE && !srv_fil_crypt_rotate_key_age && fil_crypt_threads_event &&
+ (mode == FIL_ENCRYPTION_ON || mode == FIL_ENCRYPTION_OFF ||
+ srv_encrypt_tables)) {
+ /* Key rotation is not enabled, need to inform background
+ encryption threads. */
+ UT_LIST_ADD_LAST(rotation_list, fil_system->rotation_list, space);
+ space->is_in_rotation_list = true;
+ mutex_exit(&fil_system->mutex);
+ mutex_enter(&fil_crypt_threads_mutex);
+ os_event_set(fil_crypt_threads_event);
+ mutex_exit(&fil_crypt_threads_mutex);
+ } else {
+ mutex_exit(&fil_system->mutex);
+ }
- return(TRUE);
+ return(true);
}
/*******************************************************************//**
@@ -1686,6 +1761,12 @@ fil_space_free(
space);
}
+ if (space->is_in_rotation_list) {
+ space->is_in_rotation_list = false;
+ ut_a(UT_LIST_GET_LEN(fil_system->rotation_list) > 0);
+ UT_LIST_REMOVE(rotation_list, fil_system->rotation_list, space);
+ }
+
UT_LIST_REMOVE(space_list, fil_system->space_list, space);
ut_a(space->magic_n == FIL_SPACE_MAGIC_N);
@@ -2309,7 +2390,7 @@ fil_check_first_page(const page_t* page, ulint space_id, ulint flags)
}
if (buf_page_is_corrupted(
- false, page, fsp_flags_get_zip_size(flags))) {
+ false, page, fsp_flags_get_zip_size(flags), NULL)) {
return("checksum mismatch");
}
@@ -2348,7 +2429,6 @@ fil_read_first_page(
const char* check_msg = NULL;
fil_space_crypt_t* cdata;
-
buf = static_cast<byte*>(ut_malloc(2 * UNIV_PAGE_SIZE));
/* Align the memory for a possible read from a raw device */
@@ -2388,7 +2468,7 @@ fil_read_first_page(
ulint space = fsp_header_get_space_id(page);
ulint offset = fsp_header_get_crypt_offset(
- fsp_flags_get_zip_size(*flags), NULL);
+ fsp_flags_get_zip_size(*flags));
cdata = fil_space_read_crypt_data(space, page, offset);
@@ -2767,7 +2847,7 @@ fil_op_log_parse_or_replay(
space_id, name, path, flags,
DICT_TF2_USE_TABLESPACE,
FIL_IBD_FILE_INITIAL_SIZE,
- FIL_SPACE_ENCRYPTION_DEFAULT,
+ FIL_ENCRYPTION_DEFAULT,
FIL_DEFAULT_ENCRYPTION_KEY) != DB_SUCCESS) {
ut_error;
}
@@ -2891,16 +2971,27 @@ fil_check_pending_operations(
*space = 0;
- /* Wait for crypt threads to stop accessing space */
- fil_space_crypt_close_tablespace(id);
-
mutex_enter(&fil_system->mutex);
fil_space_t* sp = fil_space_get_by_id(id);
+
if (sp) {
sp->stop_new_ops = TRUE;
+ /* space could be freed by other threads as soon
+ as n_pending_ops reaches 0, thus increment pending
+ ops here. */
+ sp->n_pending_ops++;
}
+
mutex_exit(&fil_system->mutex);
+ /* Wait for crypt threads to stop accessing space */
+ if (sp) {
+ fil_space_crypt_close_tablespace(sp);
+ /* We have "acquired" this space and must
+ free it now as below we compare n_pending_ops. */
+ fil_space_release(sp);
+ }
+
/* Check for pending change buffer merges. */
do {
@@ -3852,7 +3943,23 @@ fil_create_new_single_table_tablespace(
goto error_exit_3;
}
- ret = os_file_set_size(path, file, size * UNIV_PAGE_SIZE);
+ {
+ /* fil_read_first_page() expects UNIV_PAGE_SIZE bytes.
+ fil_node_open_file() expects at least 4 * UNIV_PAGE_SIZE bytes.
+ Do not create too short ROW_FORMAT=COMPRESSED files. */
+ const ulint zip_size = fsp_flags_get_zip_size(flags);
+ const ulint page_size = zip_size ? zip_size : UNIV_PAGE_SIZE;
+ const os_offset_t fsize = std::max(
+ os_offset_t(size) * page_size,
+ os_offset_t(FIL_IBD_FILE_INITIAL_SIZE
+ * UNIV_PAGE_SIZE));
+ /* ROW_FORMAT=COMPRESSED files never use page_compression
+ (are never sparse). */
+ ut_ad(!zip_size || !FSP_FLAGS_HAS_PAGE_COMPRESSION(flags));
+
+ ret = os_file_set_size(path, file, fsize,
+ FSP_FLAGS_HAS_PAGE_COMPRESSION(flags));
+ }
if (!ret) {
err = DB_OUT_OF_FILE_SPACE;
@@ -3880,14 +3987,8 @@ fil_create_new_single_table_tablespace(
fsp_header_init_fields(page, space_id, flags);
mach_write_to_4(page + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID, space_id);
- if (!(fsp_flags_is_compressed(flags))) {
- buf_flush_init_for_writing(page, NULL, 0);
- ret = os_file_write(path, file, page, 0, UNIV_PAGE_SIZE);
- } else {
+ if (const ulint zip_size = fsp_flags_get_zip_size(flags)) {
page_zip_des_t page_zip;
- ulint zip_size;
-
- zip_size = fsp_flags_get_zip_size(flags);
page_zip_set_size(&page_zip, zip_size);
page_zip.data = page + UNIV_PAGE_SIZE;
@@ -3898,6 +3999,9 @@ fil_create_new_single_table_tablespace(
page_zip.n_blobs = 0;
buf_flush_init_for_writing(page, &page_zip, 0);
ret = os_file_write(path, file, page_zip.data, 0, zip_size);
+ } else {
+ buf_flush_init_for_writing(page, NULL, 0);
+ ret = os_file_write(path, file, page, 0, UNIV_PAGE_SIZE);
}
ut_free(buf2);
@@ -3930,13 +4034,13 @@ fil_create_new_single_table_tablespace(
/* Create crypt data if the tablespace is either encrypted or user has
requested it to remain unencrypted. */
- if (mode == FIL_SPACE_ENCRYPTION_ON || mode == FIL_SPACE_ENCRYPTION_OFF ||
+ if (mode == FIL_ENCRYPTION_ON || mode == FIL_ENCRYPTION_OFF ||
srv_encrypt_tables) {
crypt_data = fil_space_create_crypt_data(mode, key_id);
}
success = fil_space_create(tablename, space_id, flags, FIL_TABLESPACE,
- crypt_data, true);
+ crypt_data, true, mode);
if (!success || !fil_node_create(path, size, space_id, FALSE)) {
err = DB_ERROR;
@@ -4547,13 +4651,13 @@ fil_user_tablespace_find_space_id(
to UNIV_PAGE_SIZE. */
if (page_size == UNIV_PAGE_SIZE) {
uncompressed_ok = !buf_page_is_corrupted(
- false, page, 0);
+ false, page, 0, NULL);
}
bool compressed_ok = false;
if (page_size <= UNIV_PAGE_SIZE_DEF) {
compressed_ok = !buf_page_is_corrupted(
- false, page, page_size);
+ false, page, page_size, NULL);
}
if (uncompressed_ok || compressed_ok) {
@@ -6644,7 +6748,8 @@ fil_iterate(
page_type == FIL_PAGE_PAGE_COMPRESSED);
/* If tablespace is encrypted, we need to decrypt
- the page. */
+ the page. Note that tablespaces are not in
+ fil_system during import. */
if (encrypted) {
decrypted = fil_space_decrypt(
iter.crypt_data,
@@ -6897,8 +7002,11 @@ fil_tablespace_iterate(
iter.n_io_buffers = n_io_buffers;
iter.page_size = callback.get_page_size();
+ /* In MariaDB/MySQL 5.6 tablespace does not exist
+ during import, therefore we can't use space directly
+ here. */
ulint crypt_data_offset = fsp_header_get_crypt_offset(
- callback.get_zip_size(), 0);
+ callback.get_zip_size());
/* read (optional) crypt data */
iter.crypt_data = fil_space_read_crypt_data(
@@ -6940,7 +7048,7 @@ fil_tablespace_iterate(
mem_free(io_buffer);
- if (iter.crypt_data != NULL) {
+ if (crypt_io_buffer != NULL) {
mem_free(crypt_io_buffer);
iter.crypt_io_buffer = NULL;
fil_space_destroy_crypt_data(&iter.crypt_data);
@@ -7199,33 +7307,12 @@ fil_space_set_corrupt(
space = fil_space_get_by_id(space_id);
if (space) {
- space->is_corrupt = TRUE;
+ space->is_corrupt = true;
}
mutex_exit(&fil_system->mutex);
}
-/****************************************************************//**
-Acquire fil_system mutex */
-void
-fil_system_enter(void)
-/*==================*/
-{
- ut_ad(!mutex_own(&fil_system->mutex));
- mutex_enter(&fil_system->mutex);
-}
-
-/****************************************************************//**
-Release fil_system mutex */
-void
-fil_system_exit(void)
-/*=================*/
-{
- ut_ad(mutex_own(&fil_system->mutex));
- mutex_exit(&fil_system->mutex);
-}
-
-
/******************************************************************
Get id of first tablespace or ULINT_UNDEFINED if none */
UNIV_INTERN
@@ -7256,36 +7343,6 @@ fil_get_first_space()
}
/******************************************************************
-Get id of first tablespace that has node or ULINT_UNDEFINED if none */
-UNIV_INTERN
-ulint
-fil_get_first_space_safe()
-/*======================*/
-{
- ulint out_id = ULINT_UNDEFINED;
- fil_space_t* space;
-
- mutex_enter(&fil_system->mutex);
-
- space = UT_LIST_GET_FIRST(fil_system->space_list);
- if (space != NULL) {
- do
- {
- if (!space->stop_new_ops && UT_LIST_GET_LEN(space->chain) > 0) {
- out_id = space->id;
- break;
- }
-
- space = UT_LIST_GET_NEXT(space_list, space);
- } while (space != NULL);
- }
-
- mutex_exit(&fil_system->mutex);
-
- return out_id;
-}
-
-/******************************************************************
Get id of next tablespace or ULINT_UNDEFINED if none */
UNIV_INTERN
ulint
@@ -7326,165 +7383,207 @@ fil_get_next_space(
return out_id;
}
-/******************************************************************
-Get id of next tablespace that has node or ULINT_UNDEFINED if none */
-UNIV_INTERN
-ulint
-fil_get_next_space_safe(
-/*====================*/
- ulint id) /*!< in: previous space id */
+/** Acquire a tablespace when it could be dropped concurrently.
+Used by background threads that do not necessarily hold proper locks
+for concurrency control.
+@param[in] id tablespace ID
+@param[in] silent whether to silently ignore missing tablespaces
+@return the tablespace, or NULL if missing or being deleted */
+inline
+fil_space_t*
+fil_space_acquire_low(
+ ulint id,
+ bool silent)
{
- bool found;
- fil_space_t* space;
- ulint out_id = ULINT_UNDEFINED;
+ fil_space_t* space;
mutex_enter(&fil_system->mutex);
space = fil_space_get_by_id(id);
- if (space == NULL) {
- /* we didn't find it...search for space with space->id > id */
- found = false;
- space = UT_LIST_GET_FIRST(fil_system->space_list);
- } else {
- /* we found it, take next available space */
- found = true;
- }
-
- while ((space = UT_LIST_GET_NEXT(space_list, space)) != NULL) {
-
- if (!found && space->id <= id)
- continue;
- if (!space->stop_new_ops) {
- /* inc reference to prevent drop */
- out_id = space->id;
- break;
+ if (space == NULL) {
+ if (!silent) {
+ ib_logf(IB_LOG_LEVEL_WARN, "Trying to access missing"
+ " tablespace " ULINTPF ".", id);
+ ut_error;
}
+ } else if (space->stop_new_ops) {
+ space = NULL;
+ } else {
+ space->n_pending_ops++;
}
mutex_exit(&fil_system->mutex);
- return out_id;
+ return(space);
}
-/******************************************************************
-Get crypt data for a tablespace */
-UNIV_INTERN
-fil_space_crypt_t*
-fil_space_get_crypt_data(
-/*=====================*/
- ulint id) /*!< in: space id */
+/** Acquire a tablespace when it could be dropped concurrently.
+Used by background threads that do not necessarily hold proper locks
+for concurrency control.
+@param[in] id tablespace ID
+@return the tablespace, or NULL if missing or being deleted */
+fil_space_t*
+fil_space_acquire(
+ ulint id)
{
- fil_space_t* space;
- fil_space_crypt_t* crypt_data = NULL;
+ return(fil_space_acquire_low(id, false));
+}
- ut_ad(fil_system);
+/** Acquire a tablespace that may not exist.
+Used by background threads that do not necessarily hold proper locks
+for concurrency control.
+@param[in] id tablespace ID
+@return the tablespace, or NULL if missing or being deleted */
+fil_space_t*
+fil_space_acquire_silent(
+ ulint id)
+{
+ return(fil_space_acquire_low(id, true));
+}
+/** Release a tablespace acquired with fil_space_acquire().
+@param[in,out] space tablespace to release */
+void
+fil_space_release(
+ fil_space_t* space)
+{
mutex_enter(&fil_system->mutex);
+ ut_ad(space->magic_n == FIL_SPACE_MAGIC_N);
+ ut_ad(space->n_pending_ops > 0);
+ space->n_pending_ops--;
+ mutex_exit(&fil_system->mutex);
+}
- space = fil_space_get_by_id(id);
+/** Return the next fil_space_t.
+Once started, the caller must keep calling this until it returns NULL.
+fil_space_acquire() and fil_space_release() are invoked here which
+blocks a concurrent operation from dropping the tablespace.
+@param[in] prev_space Pointer to the previous fil_space_t.
+If NULL, use the first fil_space_t on fil_system->space_list.
+@return pointer to the next fil_space_t.
+@retval NULL if this was the last*/
+fil_space_t*
+fil_space_next(
+ fil_space_t* prev_space)
+{
+ fil_space_t* space=prev_space;
- mutex_exit(&fil_system->mutex);
+ mutex_enter(&fil_system->mutex);
- if (space != NULL) {
- /* If we have not yet read the page0
- of this tablespace we will do it now. */
- if (!space->crypt_data && !space->page_0_crypt_read) {
- ulint space_id = space->id;
- fil_node_t* node;
-
- ut_a(space->crypt_data == NULL);
- node = UT_LIST_GET_FIRST(space->chain);
-
- byte *buf = static_cast<byte*>(ut_malloc(2 * UNIV_PAGE_SIZE));
- 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 offset = fsp_header_get_crypt_offset(
- fsp_header_get_zip_size(page), NULL);
- space->crypt_data = fil_space_read_crypt_data(space_id, page, offset);
- ut_free(buf);
+ if (prev_space == NULL) {
+ space = UT_LIST_GET_FIRST(fil_system->space_list);
-#ifdef UNIV_DEBUG
- ib_logf(IB_LOG_LEVEL_INFO,
- "Read page 0 from tablespace for space %lu name %s key_id %u encryption %d handle %d.",
- space_id,
- space->name,
- space->crypt_data ? space->crypt_data->key_id : 0,
- space->crypt_data ? space->crypt_data->encryption : 0,
- node->handle);
-#endif
+ /* We can trust that space is not NULL because at least the
+ system tablespace is always present and loaded first. */
+ space->n_pending_ops++;
+ } else {
+ ut_ad(space->n_pending_ops > 0);
- ut_a(space->id == space_id);
+ /* Move on to the next fil_space_t */
+ space->n_pending_ops--;
+ space = UT_LIST_GET_NEXT(space_list, space);
- space->page_0_crypt_read = true;
+ /* Skip spaces that are being created by
+ fil_ibd_create(), or dropped, or !tablespace. */
+ while (space != NULL
+ && (UT_LIST_GET_LEN(space->chain) == 0
+ || space->stop_new_ops
+ || space->purpose != FIL_TABLESPACE)) {
+ space = UT_LIST_GET_NEXT(space_list, space);
}
- crypt_data = space->crypt_data;
-
- if (!space->page_0_crypt_read) {
- ib_logf(IB_LOG_LEVEL_WARN,
- "Space %lu name %s contains encryption %d information for key_id %u but page0 is not read.",
- space->id,
- space->name,
- space->crypt_data ? space->crypt_data->encryption : 0,
- space->crypt_data ? space->crypt_data->key_id : 0);
+ if (space != NULL) {
+ space->n_pending_ops++;
}
}
- return(crypt_data);
+ mutex_exit(&fil_system->mutex);
+
+ return(space);
}
-/******************************************************************
-Get crypt data for a tablespace */
-UNIV_INTERN
-fil_space_crypt_t*
-fil_space_set_crypt_data(
-/*=====================*/
- ulint id, /*!< in: space id */
- fil_space_crypt_t* crypt_data) /*!< in: crypt data */
+/**
+Remove space from key rotation list if there are no more
+pending operations.
+@param[in] space Tablespace */
+static
+void
+fil_space_remove_from_keyrotation(
+ fil_space_t* space)
{
- fil_space_t* space;
- fil_space_crypt_t* free_crypt_data = NULL;
- fil_space_crypt_t* ret_crypt_data = NULL;
+ ut_ad(mutex_own(&fil_system->mutex));
+ ut_ad(space);
- ut_ad(fil_system);
+ if (space->n_pending_ops == 0 && space->is_in_rotation_list) {
+ space->is_in_rotation_list = false;
+ ut_a(UT_LIST_GET_LEN(fil_system->rotation_list) > 0);
+ UT_LIST_REMOVE(rotation_list, fil_system->rotation_list, space);
+ }
+}
- mutex_enter(&fil_system->mutex);
- space = fil_space_get_by_id(id);
+/** Return the next fil_space_t from key rotation list.
+Once started, the caller must keep calling this until it returns NULL.
+fil_space_acquire() and fil_space_release() are invoked here which
+blocks a concurrent operation from dropping the tablespace.
+@param[in] prev_space Pointer to the previous fil_space_t.
+If NULL, use the first fil_space_t on fil_system->space_list.
+@return pointer to the next fil_space_t.
+@retval NULL if this was the last*/
+fil_space_t*
+fil_space_keyrotate_next(
+ fil_space_t* prev_space)
+{
+ fil_space_t* space = prev_space;
+ fil_space_t* old = NULL;
- if (space != NULL) {
- if (space->crypt_data != NULL) {
- /* Here we need to release fil_system mutex to
- avoid mutex deadlock assertion. Here we would
- take mutexes in order fil_system, crypt_data and
- in fil_crypt_start_encrypting_space we would
- take them in order crypt_data, fil_system
- at fil_space_get_flags -> fil_space_get_space */
- mutex_exit(&fil_system->mutex);
- fil_space_merge_crypt_data(space->crypt_data,
- crypt_data);
- ret_crypt_data = space->crypt_data;
- free_crypt_data = crypt_data;
- } else {
- space->crypt_data = crypt_data;
- ret_crypt_data = space->crypt_data;
- mutex_exit(&fil_system->mutex);
+ mutex_enter(&fil_system->mutex);
+
+ if (UT_LIST_GET_LEN(fil_system->rotation_list) == 0) {
+ if (space) {
+ ut_ad(space->n_pending_ops > 0);
+ space->n_pending_ops--;
+ fil_space_remove_from_keyrotation(space);
}
- } else {
- /* there is a small risk that tablespace has been deleted */
- free_crypt_data = crypt_data;
mutex_exit(&fil_system->mutex);
+ return(NULL);
}
- if (free_crypt_data != NULL) {
- /* there was already crypt data present and the new crypt
- * data provided as argument to this function has been merged
- * into that => free new crypt data
- */
- fil_space_destroy_crypt_data(&free_crypt_data);
+ if (prev_space == NULL) {
+ space = UT_LIST_GET_FIRST(fil_system->rotation_list);
+
+ /* We can trust that space is not NULL because we
+ checked list length above */
+ } else {
+ ut_ad(space->n_pending_ops > 0);
+
+ /* Move on to the next fil_space_t */
+ space->n_pending_ops--;
+
+ old = space;
+ space = UT_LIST_GET_NEXT(rotation_list, space);
+
+ fil_space_remove_from_keyrotation(old);
}
- return ret_crypt_data;
+ /* Skip spaces that are being created by fil_ibd_create(),
+ or dropped. Note that rotation_list contains only
+ space->purpose == FIL_TABLESPACE. */
+ while (space != NULL
+ && (UT_LIST_GET_LEN(space->chain) == 0
+ || space->stop_new_ops)) {
+
+ old = space;
+ space = UT_LIST_GET_NEXT(rotation_list, space);
+ fil_space_remove_from_keyrotation(old);
+ }
+
+ if (space != NULL) {
+ space->n_pending_ops++;
+ }
+
+ mutex_exit(&fil_system->mutex);
+
+ return(space);
}
diff --git a/storage/xtradb/fil/fil0pagecompress.cc b/storage/xtradb/fil/fil0pagecompress.cc
index fe4f64d88ca..303ab5102fb 100644
--- a/storage/xtradb/fil/fil0pagecompress.cc
+++ b/storage/xtradb/fil/fil0pagecompress.cc
@@ -366,7 +366,7 @@ fil_compress_page(
fil_decompress_page(uncomp_page, comp_page, len, NULL);
- if(buf_page_is_corrupted(false, uncomp_page, 0)) {
+ if(buf_page_is_corrupted(false, uncomp_page, 0, space)) {
buf_page_print(uncomp_page, 0, BUF_PAGE_PRINT_NO_CRASH);
ut_error;
}
diff --git a/storage/xtradb/fsp/fsp0fsp.cc b/storage/xtradb/fsp/fsp0fsp.cc
index c32fddaabbe..934824c6462 100644
--- a/storage/xtradb/fsp/fsp0fsp.cc
+++ b/storage/xtradb/fsp/fsp0fsp.cc
@@ -133,7 +133,7 @@ fsp_fill_free_list(
ulint space, /*!< in: space */
fsp_header_t* header, /*!< in/out: space header */
mtr_t* mtr) /*!< in/out: mini-transaction */
- UNIV_COLD MY_ATTRIBUTE((nonnull));
+ UNIV_COLD;
/**********************************************************************//**
Allocates a single free page from a segment. This function implements
the intelligent allocation strategy which tries to minimize file space
@@ -162,7 +162,7 @@ fseg_alloc_free_page_low(
in which the page should be initialized.
If init_mtr!=mtr, but the page is already
latched in mtr, do not initialize the page. */
- MY_ATTRIBUTE((warn_unused_result, nonnull));
+ MY_ATTRIBUTE((warn_unused_result));
#endif /* !UNIV_HOTBACKUP */
/**********************************************************************//**
@@ -680,7 +680,7 @@ UNIV_INTERN
void
fsp_header_init(
/*============*/
- ulint space, /*!< in: space id */
+ ulint space_id, /*!< in: space id */
ulint size, /*!< in: current size in blocks */
mtr_t* mtr) /*!< in/out: mini-transaction */
{
@@ -692,11 +692,11 @@ fsp_header_init(
ut_ad(mtr);
- mtr_x_lock(fil_space_get_latch(space, &flags), mtr);
+ mtr_x_lock(fil_space_get_latch(space_id, &flags), mtr);
zip_size = fsp_flags_get_zip_size(flags);
- block = buf_page_create(space, 0, zip_size, mtr);
- buf_page_get(space, zip_size, 0, RW_X_LATCH, mtr);
+ block = buf_page_create(space_id, 0, zip_size, mtr);
+ buf_page_get(space_id, zip_size, 0, RW_X_LATCH, mtr);
buf_block_dbg_add_level(block, SYNC_FSP_PAGE);
/* The prior contents of the file page should be ignored */
@@ -709,7 +709,7 @@ fsp_header_init(
header = FSP_HEADER_OFFSET + page;
- mlog_write_ulint(header + FSP_SPACE_ID, space, MLOG_4BYTES, mtr);
+ mlog_write_ulint(header + FSP_SPACE_ID, space_id, MLOG_4BYTES, mtr);
mlog_write_ulint(header + FSP_NOT_USED, 0, MLOG_4BYTES, mtr);
mlog_write_ulint(header + FSP_SIZE, size, MLOG_4BYTES, mtr);
@@ -725,18 +725,23 @@ fsp_header_init(
flst_init(header + FSP_SEG_INODES_FREE, mtr);
mlog_write_ull(header + FSP_SEG_ID, 1, mtr);
- if (space == 0) {
- fsp_fill_free_list(FALSE, space, header, mtr);
+ if (space_id == 0) {
+ fsp_fill_free_list(FALSE, space_id, header, mtr);
btr_create(DICT_CLUSTERED | DICT_UNIVERSAL | DICT_IBUF,
- 0, 0, DICT_IBUF_ID_MIN + space,
+ 0, 0, DICT_IBUF_ID_MIN + space_id,
dict_ind_redundant, mtr);
} else {
- fsp_fill_free_list(TRUE, space, header, mtr);
+ fsp_fill_free_list(TRUE, space_id, header, mtr);
+ }
+
+ fil_space_t* space = fil_space_acquire(space_id);
+ ut_ad(space);
+
+ if (space->crypt_data) {
+ space->crypt_data->write_page0(page, mtr);
}
- ulint maxsize = 0;
- ulint offset = fsp_header_get_crypt_offset(zip_size, &maxsize);
- fil_space_write_crypt_data(space, page, offset, maxsize, mtr);
+ fil_space_release(space);
}
#endif /* !UNIV_HOTBACKUP */
@@ -1074,8 +1079,6 @@ fsp_fill_free_list(
ulint i;
mtr_t ibuf_mtr;
- ut_ad(header != NULL);
- ut_ad(mtr != NULL);
ut_ad(page_offset(header) == FSP_HEADER_OFFSET);
/* Check if we can fill free list from above the free list limit */
@@ -1338,7 +1341,7 @@ Allocates a single free page from a space. The page is marked as used.
@retval block, rw_lock_x_lock_count(&block->lock) == 1 if allocation succeeded
(init_mtr == mtr, or the page was not previously freed in mtr)
@retval block (not allocated or initialized) otherwise */
-static MY_ATTRIBUTE((nonnull, warn_unused_result))
+static MY_ATTRIBUTE((warn_unused_result))
buf_block_t*
fsp_alloc_free_page(
/*================*/
@@ -1358,9 +1361,6 @@ fsp_alloc_free_page(
ulint page_no;
ulint space_size;
- ut_ad(mtr);
- ut_ad(init_mtr);
-
header = fsp_get_space_header(space, zip_size, mtr);
/* Get the hinted descriptor */
@@ -2379,7 +2379,6 @@ fseg_alloc_free_page_low(
ibool success;
ulint n;
- ut_ad(mtr);
ut_ad((direction >= FSP_UP) && (direction <= FSP_NO_DIR));
ut_ad(mach_read_from_4(seg_inode + FSEG_MAGIC_N)
== FSEG_MAGIC_N_VALUE);
@@ -2817,6 +2816,7 @@ try_again:
}
} else {
ut_a(alloc_type == FSP_CLEANING);
+ reserve = 0;
}
success = fil_space_reserve_free_extents(space, n_free, n_ext);
@@ -4154,12 +4154,11 @@ fsp_print(
/**********************************************************************//**
Compute offset after xdes where crypt data can be stored
+@param[in] zip_size Compressed size or 0
@return offset */
ulint
fsp_header_get_crypt_offset(
-/*========================*/
- ulint zip_size, /*!< in: zip_size */
- ulint* max_size) /*!< out: free space available for crypt data */
+ const ulint zip_size)
{
ulint pageno = 0;
/* compute first page_no that will have xdes stored on page != 0*/
@@ -4174,12 +4173,6 @@ fsp_header_get_crypt_offset(
ulint iv_offset = XDES_ARR_OFFSET +
XDES_SIZE * (1 + xdes_calc_descriptor_index(zip_size, pageno));
- if (max_size != NULL) {
- /* return how much free space there is available on page */
- *max_size = (zip_size ? zip_size : UNIV_PAGE_SIZE) -
- (FSP_HEADER_OFFSET + iv_offset + FIL_PAGE_DATA_END);
- }
-
return FSP_HEADER_OFFSET + iv_offset;
}
diff --git a/storage/xtradb/fts/fts0fts.cc b/storage/xtradb/fts/fts0fts.cc
index a9c4d175715..e1a95bcd427 100644
--- a/storage/xtradb/fts/fts0fts.cc
+++ b/storage/xtradb/fts/fts0fts.cc
@@ -1989,7 +1989,7 @@ fts_create_one_index_table(
dict_mem_table_add_col(new_table, heap, "ilist", DATA_BLOB,
4130048, 0);
- error = row_create_table_for_mysql(new_table, trx, false, FIL_SPACE_ENCRYPTION_DEFAULT, FIL_DEFAULT_ENCRYPTION_KEY);
+ error = row_create_table_for_mysql(new_table, trx, false, FIL_ENCRYPTION_DEFAULT, FIL_DEFAULT_ENCRYPTION_KEY);
if (error != DB_SUCCESS) {
trx->error_state = error;
diff --git a/storage/xtradb/fts/fts0opt.cc b/storage/xtradb/fts/fts0opt.cc
index ed882d33548..cb30122adcb 100644
--- a/storage/xtradb/fts/fts0opt.cc
+++ b/storage/xtradb/fts/fts0opt.cc
@@ -579,9 +579,6 @@ fts_zip_read_word(
fts_zip_t* zip, /*!< in: Zip state + data */
fts_string_t* word) /*!< out: uncompressed word */
{
-#ifdef UNIV_DEBUG
- ulint i;
-#endif
short len = 0;
void* null = NULL;
byte* ptr = word->f_str;
@@ -656,10 +653,9 @@ fts_zip_read_word(
}
}
-#ifdef UNIV_DEBUG
/* All blocks must be freed at end of inflate. */
if (zip->status != Z_OK) {
- for (i = 0; i < ib_vector_size(zip->blocks); ++i) {
+ for (ulint i = 0; i < ib_vector_size(zip->blocks); ++i) {
if (ib_vector_getp(zip->blocks, i)) {
ut_free(ib_vector_getp(zip->blocks, i));
ib_vector_set(zip->blocks, i, &null);
@@ -670,7 +666,6 @@ fts_zip_read_word(
if (ptr != NULL) {
ut_ad(word->f_len == strlen((char*) ptr));
}
-#endif /* UNIV_DEBUG */
return(zip->status == Z_OK || zip->status == Z_STREAM_END ? ptr : NULL);
}
diff --git a/storage/xtradb/handler/ha_innodb.cc b/storage/xtradb/handler/ha_innodb.cc
index 00f13172db1..742c03b5404 100644
--- a/storage/xtradb/handler/ha_innodb.cc
+++ b/storage/xtradb/handler/ha_innodb.cc
@@ -1295,6 +1295,9 @@ static SHOW_VAR innodb_status_variables[]= {
{"encryption_rotation_estimated_iops",
(char*) &export_vars.innodb_encryption_rotation_estimated_iops,
SHOW_LONG},
+ {"encryption_key_rotation_list_length",
+ (char*)&export_vars.innodb_key_rotation_list_length,
+ SHOW_LONGLONG},
/* Scrubing feature */
{"scrub_background_page_reorganizations",
@@ -1748,6 +1751,7 @@ static bool innobase_purge_archive_logs(
}
#endif
+
/*************************************************************//**
Check for a valid value of innobase_commit_concurrency.
@return 0 for valid innodb_commit_concurrency */
@@ -1982,6 +1986,15 @@ thd_has_edited_nontrans_tables(
return((ibool) thd_non_transactional_update(thd));
}
+/* Return high resolution timestamp for the start of the current query */
+UNIV_INTERN
+unsigned long long
+thd_query_start_micro(
+ const THD* thd) /*!< in: thread handle */
+{
+ return thd_start_utime(thd);
+}
+
/******************************************************************//**
Returns true if the thread is executing a SELECT statement.
@return true if thd is executing SELECT */
@@ -4348,14 +4361,9 @@ innobase_change_buffering_inited_ok:
innobase_commit_concurrency_init_default();
-#ifndef EXTENDED_FOR_KILLIDLE
- srv_kill_idle_transaction = 0;
-#endif
-
#ifdef HAVE_POSIX_FALLOCATE
srv_use_posix_fallocate = (ibool) innobase_use_fallocate;
#endif
-
/* Do not enable backoff algorithm for small buffer pool. */
if (!innodb_empty_free_list_algorithm_backoff_allowed(
static_cast<srv_empty_free_list_t>(
@@ -12392,7 +12400,7 @@ ha_innobase::check_table_options(
atomic_writes_t awrites = (atomic_writes_t)options->atomic_writes;
fil_encryption_t encrypt = (fil_encryption_t)options->encryption;
- if (encrypt != FIL_SPACE_ENCRYPTION_DEFAULT && !use_tablespace) {
+ if (encrypt != FIL_ENCRYPTION_DEFAULT && !use_tablespace) {
push_warning(
thd, Sql_condition::WARN_LEVEL_WARN,
HA_WRONG_CREATE_OPTION,
@@ -12400,7 +12408,7 @@ ha_innobase::check_table_options(
return "ENCRYPTED";
}
- if (encrypt == FIL_SPACE_ENCRYPTION_OFF && srv_encrypt_tables == 2) {
+ if (encrypt == FIL_ENCRYPTION_OFF && srv_encrypt_tables == 2) {
push_warning(
thd, Sql_condition::WARN_LEVEL_WARN,
HA_WRONG_CREATE_OPTION,
@@ -12481,8 +12489,8 @@ ha_innobase::check_table_options(
}
/* If encryption is set up make sure that used key_id is found */
- if (encrypt == FIL_SPACE_ENCRYPTION_ON ||
- (encrypt == FIL_SPACE_ENCRYPTION_DEFAULT && srv_encrypt_tables)) {
+ if (encrypt == FIL_ENCRYPTION_ON ||
+ (encrypt == FIL_ENCRYPTION_DEFAULT && srv_encrypt_tables)) {
if (!encryption_key_id_exists((unsigned int)options->encryption_key_id)) {
push_warning_printf(
thd, Sql_condition::WARN_LEVEL_WARN,
@@ -12496,7 +12504,7 @@ ha_innobase::check_table_options(
}
/* Ignore nondefault key_id if encryption is set off */
- if (encrypt == FIL_SPACE_ENCRYPTION_OFF &&
+ if (encrypt == FIL_ENCRYPTION_OFF &&
options->encryption_key_id != THDVAR(thd, default_encryption_key_id)) {
push_warning_printf(
thd, Sql_condition::WARN_LEVEL_WARN,
@@ -12509,7 +12517,7 @@ ha_innobase::check_table_options(
/* If default encryption is used make sure that used kay is found
from key file. */
- if (encrypt == FIL_SPACE_ENCRYPTION_DEFAULT &&
+ if (encrypt == FIL_ENCRYPTION_DEFAULT &&
!srv_encrypt_tables &&
options->encryption_key_id != FIL_DEFAULT_ENCRYPTION_KEY) {
if (!encryption_key_id_exists((unsigned int)options->encryption_key_id)) {
@@ -14101,9 +14109,13 @@ ha_innobase::info_low(
/* If this table is already queued for
background analyze, remove it from the
queue as we are about to do the same */
- dict_mutex_enter_for_mysql();
- dict_stats_recalc_pool_del(ib_table);
- dict_mutex_exit_for_mysql();
+ if (!srv_read_only_mode) {
+
+ dict_mutex_enter_for_mysql();
+ dict_stats_recalc_pool_del(
+ ib_table);
+ dict_mutex_exit_for_mysql();
+ }
opt = DICT_STATS_RECALC_PERSISTENT;
} else {
@@ -16642,6 +16654,37 @@ ha_innobase::get_auto_increment(
ulonglong col_max_value = innobase_get_int_col_max_value(
table->next_number_field);
+ /** The following logic is needed to avoid duplicate key error
+ for autoincrement column.
+
+ (1) InnoDB gives the current autoincrement value with respect
+ to increment and offset value.
+
+ (2) Basically it does compute_next_insert_id() logic inside InnoDB
+ to avoid the current auto increment value changed by handler layer.
+
+ (3) It is restricted only for insert operations. */
+
+ if (increment > 1 && thd_sql_command(user_thd) != SQLCOM_ALTER_TABLE
+ && autoinc < col_max_value) {
+
+ ulonglong prev_auto_inc = autoinc;
+
+ autoinc = ((autoinc - 1) + increment - offset)/ increment;
+
+ autoinc = autoinc * increment + offset;
+
+ /* If autoinc exceeds the col_max_value then reset
+ to old autoinc value. Because in case of non-strict
+ sql mode, boundary value is not considered as error. */
+
+ if (autoinc >= col_max_value) {
+ autoinc = prev_auto_inc;
+ }
+
+ ut_ad(autoinc > 0);
+ }
+
/* Called for the first time ? */
if (trx->n_autoinc_rows == 0) {
@@ -19154,32 +19197,6 @@ innobase_fts_retrieve_ranking(
}
/***********************************************************************
-functions for kill session of idle transaction */
-ibool
-innobase_thd_is_idle(
-/*=================*/
- const void* thd) /*!< in: thread handle (THD*) */
-{
-#ifdef EXTENDED_FOR_KILLIDLE
- return(thd_command((const THD*) thd) == COM_SLEEP);
-#else
- return(FALSE);
-#endif
-}
-
-ib_int64_t
-innobase_thd_get_start_time(
-/*========================*/
- const void* thd) /*!< in: thread handle (THD*) */
-{
-#ifdef EXTENDED_FOR_KILLIDLE
- return((ib_int64_t)thd_start_time((const THD*) thd));
-#else
- return(0); /*dummy value*/
-#endif
-}
-
-/***********************************************************************
Free the memory for the FTS handler */
UNIV_INTERN
void
@@ -19198,19 +19215,6 @@ innobase_fts_close_ranking(
return;
}
-UNIV_INTERN
-void
-innobase_thd_kill(
-/*==============*/
- ulong thd_id)
-{
-#ifdef EXTENDED_FOR_KILLIDLE
- thd_kill(thd_id);
-#else
- return;
-#endif
-}
-
/***********************************************************************
Find and Retrieve the FTS Relevance Ranking result for doc with doc_id
of prebuilt->fts_doc_id
@@ -19408,16 +19412,6 @@ innobase_fts_retrieve_docid(
}
-ulong
-innobase_thd_get_thread_id(
-/*=======================*/
- const void* thd)
-{
- return(thd_get_thread_id((const THD*) thd));
-}
-
-
-
/***********************************************************************
Find and retrieve the size of the current result
@return number of matching rows */
@@ -19651,19 +19645,21 @@ wsrep_innobase_kill_one_trx(
if (!thd) {
DBUG_PRINT("wsrep", ("no thd for conflicting lock"));
- WSREP_WARN("no THD for trx: %lu", victim_trx->id);
+ WSREP_WARN("no THD for trx: " TRX_ID_FMT, victim_trx->id);
DBUG_RETURN(1);
}
if (!bf_thd) {
DBUG_PRINT("wsrep", ("no BF thd for conflicting lock"));
- WSREP_WARN("no BF THD for trx: %lu", (bf_trx) ? bf_trx->id : 0);
+ WSREP_WARN("no BF THD for trx: " TRX_ID_FMT,
+ bf_trx ? bf_trx->id : 0);
DBUG_RETURN(1);
}
WSREP_LOG_CONFLICT(bf_thd, thd, TRUE);
- WSREP_DEBUG("BF kill (%lu, seqno: %lld), victim: (%lu) trx: %lu",
+ WSREP_DEBUG("BF kill (%lu, seqno: %lld), victim: (%lu) trx: "
+ TRX_ID_FMT,
signal, (long long)bf_seqno,
thd_get_thread_id(thd),
victim_trx->id);
@@ -19683,13 +19679,14 @@ wsrep_innobase_kill_one_trx(
if (wsrep_thd_query_state(thd) == QUERY_EXITING) {
- WSREP_DEBUG("kill trx EXITING for %lu", victim_trx->id);
+ WSREP_DEBUG("kill trx EXITING for " TRX_ID_FMT,
+ victim_trx->id);
wsrep_thd_UNLOCK(thd);
DBUG_RETURN(0);
}
if(wsrep_thd_exec_mode(thd) != LOCAL_STATE) {
- WSREP_DEBUG("withdraw for BF trx: %lu, state: %d",
+ WSREP_DEBUG("withdraw for BF trx: " TRX_ID_FMT ", state: %d",
victim_trx->id,
wsrep_thd_get_conflict_state(thd));
}
@@ -19699,7 +19696,7 @@ wsrep_innobase_kill_one_trx(
wsrep_thd_set_conflict_state(thd, MUST_ABORT);
break;
case MUST_ABORT:
- WSREP_DEBUG("victim %lu in MUST ABORT state",
+ WSREP_DEBUG("victim " TRX_ID_FMT " in MUST ABORT state",
victim_trx->id);
wsrep_thd_UNLOCK(thd);
wsrep_thd_awake(thd, signal);
@@ -19708,7 +19705,7 @@ wsrep_innobase_kill_one_trx(
case ABORTED:
case ABORTING: // fall through
default:
- WSREP_DEBUG("victim %lu in state %d",
+ WSREP_DEBUG("victim " TRX_ID_FMT " in state %d",
victim_trx->id, wsrep_thd_get_conflict_state(thd));
wsrep_thd_UNLOCK(thd);
DBUG_RETURN(0);
@@ -19721,7 +19718,7 @@ wsrep_innobase_kill_one_trx(
WSREP_DEBUG("kill query for: %ld",
thd_get_thread_id(thd));
- WSREP_DEBUG("kill trx QUERY_COMMITTING for %lu",
+ WSREP_DEBUG("kill trx QUERY_COMMITTING for " TRX_ID_FMT,
victim_trx->id);
if (wsrep_thd_exec_mode(thd) == REPL_RECV) {
@@ -19736,7 +19733,8 @@ wsrep_innobase_kill_one_trx(
switch (rcode) {
case WSREP_WARNING:
- WSREP_DEBUG("cancel commit warning: %lu",
+ WSREP_DEBUG("cancel commit warning: "
+ TRX_ID_FMT,
victim_trx->id);
wsrep_thd_UNLOCK(thd);
wsrep_thd_awake(thd, signal);
@@ -19746,7 +19744,8 @@ wsrep_innobase_kill_one_trx(
break;
default:
WSREP_ERROR(
- "cancel commit bad exit: %d %lu",
+ "cancel commit bad exit: %d "
+ TRX_ID_FMT,
rcode,
victim_trx->id);
/* unable to interrupt, must abort */
@@ -19764,7 +19763,8 @@ wsrep_innobase_kill_one_trx(
/* it is possible that victim trx is itself waiting for some
* other lock. We need to cancel this waiting
*/
- WSREP_DEBUG("kill trx QUERY_EXEC for %lu", victim_trx->id);
+ WSREP_DEBUG("kill trx QUERY_EXEC for " TRX_ID_FMT,
+ victim_trx->id);
victim_trx->lock.was_chosen_as_deadlock_victim= TRUE;
if (victim_trx->lock.wait_lock) {
@@ -19799,7 +19799,7 @@ wsrep_innobase_kill_one_trx(
break;
case QUERY_IDLE:
{
- WSREP_DEBUG("kill IDLE for %lu", victim_trx->id);
+ WSREP_DEBUG("kill IDLE for " TRX_ID_FMT, victim_trx->id);
if (wsrep_thd_exec_mode(thd) == REPL_RECV) {
WSREP_DEBUG("kill BF IDLE, seqno: %lld",
@@ -20072,6 +20072,12 @@ static MYSQL_SYSVAR_BOOL(doublewrite, innobase_use_doublewrite,
"Disable with --skip-innodb-doublewrite.",
NULL, NULL, TRUE);
+static MYSQL_SYSVAR_BOOL(stats_include_delete_marked,
+ srv_stats_include_delete_marked,
+ PLUGIN_VAR_OPCMDARG,
+ "Scan delete marked records for persistent stat",
+ NULL, NULL, FALSE);
+
static MYSQL_SYSVAR_BOOL(use_atomic_writes, innobase_use_atomic_writes,
PLUGIN_VAR_NOCMDARG | PLUGIN_VAR_READONLY,
"Prevent partial page writes, via atomic writes (beta). "
@@ -20782,13 +20788,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, 10, 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.",
@@ -21308,10 +21307,11 @@ static MYSQL_SYSVAR_UINT(encryption_rotate_key_age,
PLUGIN_VAR_RQCMDARG,
"Key rotation - re-encrypt in background "
"all pages that were encrypted with a key that "
- "many (or more) versions behind",
+ "many (or more) versions behind. Value 0 indicates "
+ "that key rotation is disabled.",
NULL,
innodb_encryption_rotate_key_age_update,
- srv_fil_crypt_rotate_key_age, 0, UINT_MAX32, 0);
+ 1, 0, UINT_MAX32, 0);
static MYSQL_SYSVAR_UINT(encryption_rotation_iops, srv_n_fil_crypt_iops,
PLUGIN_VAR_RQCMDARG,
@@ -21430,6 +21430,7 @@ static struct st_mysql_sys_var* innobase_system_variables[]= {
MYSQL_SYSVAR(data_file_path),
MYSQL_SYSVAR(data_home_dir),
MYSQL_SYSVAR(doublewrite),
+ MYSQL_SYSVAR(stats_include_delete_marked),
MYSQL_SYSVAR(api_enable_binlog),
MYSQL_SYSVAR(api_enable_mdl),
MYSQL_SYSVAR(api_disable_rowlock),
@@ -21448,9 +21449,6 @@ static struct st_mysql_sys_var* innobase_system_variables[]= {
MYSQL_SYSVAR(use_global_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(ft_cache_size),
MYSQL_SYSVAR(ft_total_cache_size),
MYSQL_SYSVAR(ft_result_cache_limit),
@@ -22274,8 +22272,9 @@ innodb_encrypt_tables_validate(
for update function */
struct st_mysql_value* value) /*!< in: incoming string */
{
- if (check_sysvar_enum(thd, var, save, value))
+ if (check_sysvar_enum(thd, var, save, value)) {
return 1;
+ }
ulong encrypt_tables = *(ulong*)save;
@@ -22287,6 +22286,17 @@ innodb_encrypt_tables_validate(
"encryption plugin is not available");
return 1;
}
+
+ if (!srv_fil_crypt_rotate_key_age) {
+ const char *msg = (encrypt_tables ? "enable" : "disable");
+ push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
+ HA_ERR_UNSUPPORTED,
+ "InnoDB: cannot %s encryption, "
+ "innodb_encryption_rotate_key_age=0"
+ " i.e. key rotation disabled", msg);
+ return 1;
+ }
+
return 0;
}
diff --git a/storage/xtradb/handler/ha_innodb.h b/storage/xtradb/handler/ha_innodb.h
index 783077ceaf1..62b80c492a1 100644
--- a/storage/xtradb/handler/ha_innodb.h
+++ b/storage/xtradb/handler/ha_innodb.h
@@ -167,6 +167,8 @@ class ha_innobase: public handler
int index_first(uchar * buf);
int index_last(uchar * buf);
+ bool has_gap_locks() const { return true; }
+
int rnd_init(bool scan);
int rnd_end();
int rnd_next(uchar *buf);
@@ -426,6 +428,15 @@ int thd_slave_thread(const MYSQL_THD thd);
int thd_non_transactional_update(const MYSQL_THD thd);
/**
+ Get high resolution timestamp for the current query start time.
+ The timestamp is not anchored to any specific point in time,
+ but can be used for comparison.
+
+ @retval timestamp in microseconds precision
+*/
+unsigned long long thd_start_utime(const MYSQL_THD thd);
+
+/**
Get the user thread's binary logging format
@param thd user thread
@return Value to be used as index into the binlog_format_names array
diff --git a/storage/xtradb/handler/handler0alter.cc b/storage/xtradb/handler/handler0alter.cc
index c62dc5bc837..8aaf5cd83bc 100644
--- a/storage/xtradb/handler/handler0alter.cc
+++ b/storage/xtradb/handler/handler0alter.cc
@@ -1868,6 +1868,7 @@ innobase_fts_check_doc_id_index_in_def(
return(FTS_NOT_EXIST_DOC_ID_INDEX);
}
+
/*******************************************************************//**
Create an index table where indexes are ordered as follows:
@@ -1936,26 +1937,11 @@ innobase_create_key_defs(
(only prefix/part of the column is indexed), MySQL will treat the
index as a PRIMARY KEY unless the table already has one. */
- if (n_add > 0 && !new_primary && got_default_clust
- && (key_info[*add].flags & HA_NOSAME)
- && !(key_info[*add].flags & HA_KEY_HAS_PART_KEY_SEG)) {
- uint key_part = key_info[*add].user_defined_key_parts;
-
- new_primary = true;
+ ut_ad(altered_table->s->primary_key == 0
+ || altered_table->s->primary_key == MAX_KEY);
- while (key_part--) {
- const uint maybe_null
- = key_info[*add].key_part[key_part].key_type
- & FIELDFLAG_MAYBE_NULL;
- DBUG_ASSERT(!maybe_null
- == !key_info[*add].key_part[key_part].
- field->real_maybe_null());
-
- if (maybe_null) {
- new_primary = false;
- break;
- }
- }
+ if (got_default_clust && !new_primary) {
+ new_primary = (altered_table->s->primary_key != MAX_KEY);
}
const bool rebuild = new_primary || add_fts_doc_id
@@ -1974,8 +1960,14 @@ innobase_create_key_defs(
ulint primary_key_number;
if (new_primary) {
- DBUG_ASSERT(n_add > 0);
- primary_key_number = *add;
+ if (n_add == 0) {
+ DBUG_ASSERT(got_default_clust);
+ DBUG_ASSERT(altered_table->s->primary_key
+ == 0);
+ primary_key_number = 0;
+ } else {
+ primary_key_number = *add;
+ }
} else if (got_default_clust) {
/* Create the GEN_CLUST_INDEX */
index_def_t* index = indexdef++;
@@ -2899,9 +2891,11 @@ prepare_inplace_alter_table_dict(
ulint n_cols;
dtuple_t* add_cols;
ulint key_id = FIL_DEFAULT_ENCRYPTION_KEY;
- fil_encryption_t mode = FIL_SPACE_ENCRYPTION_DEFAULT;
+ fil_encryption_t mode = FIL_ENCRYPTION_DEFAULT;
- crypt_data = fil_space_get_crypt_data(ctx->prebuilt->table->space);
+ fil_space_t* space = fil_space_acquire(ctx->prebuilt->table->space);
+ crypt_data = space->crypt_data;
+ fil_space_release(space);
if (crypt_data) {
key_id = crypt_data->key_id;
@@ -3097,6 +3091,8 @@ prepare_inplace_alter_table_dict(
ctx->add_cols = add_cols;
} else {
DBUG_ASSERT(!innobase_need_rebuild(ha_alter_info, old_table));
+ DBUG_ASSERT(old_table->s->primary_key
+ == altered_table->s->primary_key);
if (!ctx->new_table->fts
&& innobase_fulltext_exist(altered_table)) {
@@ -4142,6 +4138,27 @@ found_col:
add_fts_doc_id_idx, prebuilt));
}
+/** Get the name of an erroneous key.
+@param[in] error_key_num InnoDB number of the erroneus key
+@param[in] ha_alter_info changes that were being performed
+@param[in] table InnoDB table
+@return the name of the erroneous key */
+static
+const char*
+get_error_key_name(
+ ulint error_key_num,
+ const Alter_inplace_info* ha_alter_info,
+ const dict_table_t* table)
+{
+ if (error_key_num == ULINT_UNDEFINED) {
+ return(FTS_DOC_ID_INDEX_NAME);
+ } else if (ha_alter_info->key_count == 0) {
+ return(dict_table_get_first_index(table)->name);
+ } else {
+ return(ha_alter_info->key_info_buffer[error_key_num].name);
+ }
+}
+
/** Alter the table structure in-place with operations
specified using Alter_inplace_info.
The level of concurrency allowed during this operation depends
@@ -4264,17 +4281,13 @@ oom:
case DB_ONLINE_LOG_TOO_BIG:
DBUG_ASSERT(ctx->online);
my_error(ER_INNODB_ONLINE_LOG_TOO_BIG, MYF(0),
- (prebuilt->trx->error_key_num == ULINT_UNDEFINED)
- ? FTS_DOC_ID_INDEX_NAME
- : ha_alter_info->key_info_buffer[
- prebuilt->trx->error_key_num].name);
+ get_error_key_name(prebuilt->trx->error_key_num,
+ ha_alter_info, prebuilt->table));
break;
case DB_INDEX_CORRUPT:
my_error(ER_INDEX_CORRUPT, MYF(0),
- (prebuilt->trx->error_key_num == ULINT_UNDEFINED)
- ? FTS_DOC_ID_INDEX_NAME
- : ha_alter_info->key_info_buffer[
- prebuilt->trx->error_key_num].name);
+ get_error_key_name(prebuilt->trx->error_key_num,
+ ha_alter_info, prebuilt->table));
break;
case DB_DECRYPTION_FAILED: {
String str;
@@ -5094,7 +5107,6 @@ innobase_update_foreign_cache(
"Foreign key constraints for table '%s'"
" are loaded with charset check off",
user_table->name);
-
}
}
@@ -5194,14 +5206,13 @@ commit_try_rebuild(
DBUG_RETURN(true);
case DB_ONLINE_LOG_TOO_BIG:
my_error(ER_INNODB_ONLINE_LOG_TOO_BIG, MYF(0),
- ha_alter_info->key_info_buffer[0].name);
+ get_error_key_name(err_key, ha_alter_info,
+ rebuilt_table));
DBUG_RETURN(true);
case DB_INDEX_CORRUPT:
my_error(ER_INDEX_CORRUPT, MYF(0),
- (err_key == ULINT_UNDEFINED)
- ? FTS_DOC_ID_INDEX_NAME
- : ha_alter_info->key_info_buffer[err_key]
- .name);
+ get_error_key_name(err_key, ha_alter_info,
+ rebuilt_table));
DBUG_RETURN(true);
default:
my_error_innodb(error, table_name, user_table->flags);
diff --git a/storage/xtradb/handler/i_s.cc b/storage/xtradb/handler/i_s.cc
index 420dff83a40..086d5642dbb 100644
--- a/storage/xtradb/handler/i_s.cc
+++ b/storage/xtradb/handler/i_s.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 2007, 2016, Oracle and/or its affiliates.
-Copyrigth (c) 2014, 2016, MariaDB Corporation
+Copyrigth (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
@@ -8324,29 +8324,7 @@ i_s_innodb_changed_pages_fill(
while(log_online_bitmap_iterator_next(&i) &&
(!srv_max_changed_pages ||
- output_rows_num < srv_max_changed_pages) &&
- /*
- There is no need to compare both start LSN and end LSN fields
- with maximum value. It's enough to compare only start LSN.
- Example:
-
- max_lsn = 100
- \\\\\\\\\\\\\\\\\\\\\\\\\|\\\\\\\\ - Query 1
- I------I I-------I I-------------I I----I
- ////////////////// | - Query 2
- 1 2 3 4
-
- Query 1:
- SELECT * FROM INNODB_CHANGED_PAGES WHERE start_lsn < 100
- will select 1,2,3 bitmaps
- Query 2:
- SELECT * FROM INNODB_CHANGED_PAGES WHERE end_lsn < 100
- will select 1,2 bitmaps
-
- The condition start_lsn <= 100 will be false after reading
- 1,2,3 bitmaps which suits for both cases.
- */
- LOG_BITMAP_ITERATOR_START_LSN(i) <= max_lsn)
+ output_rows_num < srv_max_changed_pages))
{
if (!LOG_BITMAP_ITERATOR_PAGE_CHANGED(i))
continue;
@@ -8514,22 +8492,31 @@ static ST_FIELD_INFO innodb_tablespaces_encryption_fields_info[] =
STRUCT_FLD(old_name, ""),
STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+#define TABLESPACES_ENCRYPTION_ROTATING_OR_FLUSHING 9
+ {STRUCT_FLD(field_name, "ROTATING_OR_FLUSHING"),
+ STRUCT_FLD(field_length, 1),
+ STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
+ STRUCT_FLD(value, 0),
+ STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
+ STRUCT_FLD(old_name, ""),
+ STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+
END_OF_ST_FIELD_INFO
};
/**********************************************************************//**
Function to fill INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION
-with information collected by scanning SYS_TABLESPACES table and then use
-fil_space()
+with information collected by scanning SYS_TABLESPACES table.
+@param[in] thd thread handle
+@param[in] space Tablespace
+@param[in] table_to_fill I_S table to fill
@return 0 on success */
static
int
i_s_dict_fill_tablespaces_encryption(
-/*==========================*/
- THD* thd, /*!< in: thread */
- ulint space, /*!< in: space ID */
- const char* name, /*!< in: tablespace name */
- TABLE* table_to_fill) /*!< in/out: fill this table */
+ THD* thd,
+ fil_space_t* space,
+ TABLE* table_to_fill)
{
Field** fields;
struct fil_space_crypt_status_t status;
@@ -8539,10 +8526,11 @@ i_s_dict_fill_tablespaces_encryption(
fields = table_to_fill->field;
fil_space_crypt_get_status(space, &status);
- OK(fields[TABLESPACES_ENCRYPTION_SPACE]->store(space));
+
+ OK(fields[TABLESPACES_ENCRYPTION_SPACE]->store(space->id));
OK(field_store_string(fields[TABLESPACES_ENCRYPTION_NAME],
- name));
+ space->name));
OK(fields[TABLESPACES_ENCRYPTION_ENCRYPTION_SCHEME]->store(
status.scheme));
@@ -8554,6 +8542,9 @@ i_s_dict_fill_tablespaces_encryption(
status.current_key_version));
OK(fields[TABLESPACES_ENCRYPTION_CURRENT_KEY_ID]->store(
status.key_id));
+ OK(fields[TABLESPACES_ENCRYPTION_ROTATING_OR_FLUSHING]->store(
+ (status.rotating || status.flushing) ? 1 : 0));
+
if (status.rotating) {
fields[TABLESPACES_ENCRYPTION_KEY_ROTATION_PAGE_NUMBER]->set_notnull();
OK(fields[TABLESPACES_ENCRYPTION_KEY_ROTATION_PAGE_NUMBER]->store(
@@ -8567,6 +8558,7 @@ i_s_dict_fill_tablespaces_encryption(
fields[TABLESPACES_ENCRYPTION_KEY_ROTATION_MAX_PAGE_NUMBER]
->set_null();
}
+
OK(schema_table_store_record(thd, table_to_fill));
DBUG_RETURN(0);
@@ -8606,30 +8598,36 @@ i_s_tablespaces_encryption_fill_table(
while (rec) {
const char* err_msg;
- ulint space;
+ ulint space_id;
const char* name;
ulint flags;
/* Extract necessary information from a SYS_TABLESPACES row */
err_msg = dict_process_sys_tablespaces(
- heap, rec, &space, &name, &flags);
+ heap, rec, &space_id, &name, &flags);
mtr_commit(&mtr);
mutex_exit(&dict_sys->mutex);
- if (space == 0) {
+ if (space_id == 0) {
found_space_0 = true;
}
- if (!err_msg) {
+ fil_space_t* space = fil_space_acquire_silent(space_id);
+
+ if (!err_msg && space) {
i_s_dict_fill_tablespaces_encryption(
- thd, space, name, tables->table);
+ thd, space, tables->table);
} else {
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
ER_CANT_FIND_SYSTEM_REC, "%s",
err_msg);
}
+ if (space) {
+ fil_space_release(space);
+ }
+
mem_heap_empty(heap);
/* Get the next record */
@@ -8645,10 +8643,13 @@ i_s_tablespaces_encryption_fill_table(
if (found_space_0 == false) {
/* space 0 does for what ever unknown reason not show up
* in iteration above, add it manually */
- ulint space = 0;
- const char* name = NULL;
+
+ fil_space_t* space = fil_space_acquire_silent(0);
+
i_s_dict_fill_tablespaces_encryption(
- thd, space, name, tables->table);
+ thd, space, tables->table);
+
+ fil_space_release(space);
}
DBUG_RETURN(0);
@@ -8802,17 +8803,18 @@ static ST_FIELD_INFO innodb_tablespaces_scrubbing_fields_info[] =
/**********************************************************************//**
Function to fill INFORMATION_SCHEMA.INNODB_TABLESPACES_SCRUBBING
-with information collected by scanning SYS_TABLESPACES table and then use
-fil_space()
+with information collected by scanning SYS_TABLESPACES table and
+fil_space.
+@param[in] thd Thread handle
+@param[in] space Tablespace
+@param[in] table_to_fill I_S table
@return 0 on success */
static
int
i_s_dict_fill_tablespaces_scrubbing(
-/*==========================*/
- THD* thd, /*!< in: thread */
- ulint space, /*!< in: space ID */
- const char* name, /*!< in: tablespace name */
- TABLE* table_to_fill) /*!< in/out: fill this table */
+ THD* thd,
+ fil_space_t* space,
+ TABLE* table_to_fill)
{
Field** fields;
struct fil_space_scrub_status_t status;
@@ -8822,10 +8824,11 @@ i_s_dict_fill_tablespaces_scrubbing(
fields = table_to_fill->field;
fil_space_get_scrub_status(space, &status);
- OK(fields[TABLESPACES_SCRUBBING_SPACE]->store(space));
+
+ OK(fields[TABLESPACES_SCRUBBING_SPACE]->store(space->id));
OK(field_store_string(fields[TABLESPACES_SCRUBBING_NAME],
- name));
+ space->name));
OK(fields[TABLESPACES_SCRUBBING_COMPRESSED]->store(
status.compressed ? 1 : 0));
@@ -8845,6 +8848,7 @@ i_s_dict_fill_tablespaces_scrubbing(
TABLESPACES_SCRUBBING_CURRENT_SCRUB_ACTIVE_THREADS,
TABLESPACES_SCRUBBING_CURRENT_SCRUB_PAGE_NUMBER,
TABLESPACES_SCRUBBING_CURRENT_SCRUB_MAX_PAGE_NUMBER };
+
if (status.scrubbing) {
for (uint i = 0; i < array_elements(field_numbers); i++) {
fields[field_numbers[i]]->set_notnull();
@@ -8864,6 +8868,7 @@ i_s_dict_fill_tablespaces_scrubbing(
fields[field_numbers[i]]->set_null();
}
}
+
OK(schema_table_store_record(thd, table_to_fill));
DBUG_RETURN(0);
@@ -8903,30 +8908,36 @@ i_s_tablespaces_scrubbing_fill_table(
while (rec) {
const char* err_msg;
- ulint space;
+ ulint space_id;
const char* name;
ulint flags;
/* Extract necessary information from a SYS_TABLESPACES row */
err_msg = dict_process_sys_tablespaces(
- heap, rec, &space, &name, &flags);
+ heap, rec, &space_id, &name, &flags);
mtr_commit(&mtr);
mutex_exit(&dict_sys->mutex);
- if (space == 0) {
+ if (space_id == 0) {
found_space_0 = true;
}
- if (!err_msg) {
+ fil_space_t* space = fil_space_acquire_silent(space_id);
+
+ if (!err_msg && space) {
i_s_dict_fill_tablespaces_scrubbing(
- thd, space, name, tables->table);
+ thd, space, tables->table);
} else {
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
ER_CANT_FIND_SYSTEM_REC, "%s",
err_msg);
}
+ if (space) {
+ fil_space_release(space);
+ }
+
mem_heap_empty(heap);
/* Get the next record */
@@ -8942,10 +8953,12 @@ i_s_tablespaces_scrubbing_fill_table(
if (found_space_0 == false) {
/* space 0 does for what ever unknown reason not show up
* in iteration above, add it manually */
- ulint space = 0;
- const char* name = NULL;
+ fil_space_t* space = fil_space_acquire_silent(0);
+
i_s_dict_fill_tablespaces_scrubbing(
- thd, space, name, tables->table);
+ thd, space, tables->table);
+
+ fil_space_release(space);
}
DBUG_RETURN(0);
diff --git a/storage/xtradb/ibuf/ibuf0ibuf.cc b/storage/xtradb/ibuf/ibuf0ibuf.cc
index c1d735eecdd..e66568565e1 100644
--- a/storage/xtradb/ibuf/ibuf0ibuf.cc
+++ b/storage/xtradb/ibuf/ibuf0ibuf.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1997, 2016, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2016, 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
@@ -4596,7 +4596,7 @@ ibuf_merge_or_delete_for_page(
buf_block_t* block, /*!< in: if page has been read from
disk, pointer to the page x-latched,
else NULL */
- ulint space, /*!< in: space id of the index page */
+ ulint space_id,/*!< in: space id of the index page */
ulint page_no,/*!< in: page number of the index page */
ulint zip_size,/*!< in: compressed page size in bytes,
or 0 */
@@ -4613,21 +4613,21 @@ ibuf_merge_or_delete_for_page(
ulint volume = 0;
#endif
page_zip_des_t* page_zip = NULL;
- ibool tablespace_being_deleted = FALSE;
ibool corruption_noticed = FALSE;
mtr_t mtr;
+ fil_space_t* space = NULL;
/* Counts for merged & discarded operations. */
ulint mops[IBUF_OP_COUNT];
ulint dops[IBUF_OP_COUNT];
- ut_ad(!block || buf_block_get_space(block) == space);
+ ut_ad(!block || buf_block_get_space(block) == space_id);
ut_ad(!block || buf_block_get_page_no(block) == page_no);
ut_ad(!block || buf_block_get_zip_size(block) == zip_size);
ut_ad(!block || buf_block_get_io_fix_unlocked(block) == BUF_IO_READ);
if (srv_force_recovery >= SRV_FORCE_NO_IBUF_MERGE
- || trx_sys_hdr_page(space, page_no)) {
+ || trx_sys_hdr_page(space_id, page_no)) {
return;
}
@@ -4641,7 +4641,7 @@ ibuf_merge_or_delete_for_page(
uncompressed page size always is a power-of-2 multiple of the
compressed page size. */
- if (ibuf_fixed_addr_page(space, 0, page_no)
+ if (ibuf_fixed_addr_page(space_id, 0, page_no)
|| fsp_descr_page(0, page_no)) {
return;
}
@@ -4649,19 +4649,19 @@ ibuf_merge_or_delete_for_page(
if (UNIV_LIKELY(update_ibuf_bitmap)) {
ut_a(ut_is_2pow(zip_size));
- if (ibuf_fixed_addr_page(space, zip_size, page_no)
+ if (ibuf_fixed_addr_page(space_id, zip_size, page_no)
|| fsp_descr_page(zip_size, page_no)) {
return;
}
- /* If the following returns FALSE, we get the counter
+ /* If the following returns space, we get the counter
incremented, and must decrement it when we leave this
function. When the counter is > 0, that prevents tablespace
from being dropped. */
- tablespace_being_deleted = fil_inc_pending_ops(space, true);
+ space = fil_space_acquire(space_id);
- if (UNIV_UNLIKELY(tablespace_being_deleted)) {
+ if (UNIV_UNLIKELY(!space)) {
/* Do not try to read the bitmap page from space;
just delete the ibuf records for the page */
@@ -4674,7 +4674,7 @@ ibuf_merge_or_delete_for_page(
ibuf_mtr_start(&mtr);
bitmap_page = ibuf_bitmap_get_map_page(
- space, page_no, zip_size, &mtr);
+ space_id, page_no, zip_size, &mtr);
if (bitmap_page &&
fil_page_get_type(bitmap_page) != FIL_PAGE_TYPE_ALLOCATED) {
@@ -4688,15 +4688,15 @@ ibuf_merge_or_delete_for_page(
if (!bitmap_bits) {
/* No inserts buffered for this page */
- if (!tablespace_being_deleted) {
- fil_decr_pending_ops(space);
+ if (space) {
+ fil_space_release(space);
}
return;
}
}
} else if (block
- && (ibuf_fixed_addr_page(space, zip_size, page_no)
+ && (ibuf_fixed_addr_page(space_id, zip_size, page_no)
|| fsp_descr_page(zip_size, page_no))) {
return;
@@ -4704,7 +4704,7 @@ ibuf_merge_or_delete_for_page(
heap = mem_heap_create(512);
- search_tuple = ibuf_search_tuple_build(space, page_no, heap);
+ search_tuple = ibuf_search_tuple_build(space_id, page_no, heap);
if (block) {
/* Move the ownership of the x-latch on the page to this OS
@@ -4730,7 +4730,7 @@ ibuf_merge_or_delete_for_page(
fputs(" InnoDB: Dump of the ibuf bitmap page:\n",
stderr);
- bitmap_page = ibuf_bitmap_get_map_page(space, page_no,
+ bitmap_page = ibuf_bitmap_get_map_page(space_id, page_no,
zip_size, &mtr);
if (bitmap_page == NULL)
{
@@ -4814,7 +4814,7 @@ loop:
/* Check if the entry is for this index page */
if (ibuf_rec_get_page_no(&mtr, rec) != page_no
- || ibuf_rec_get_space(&mtr, rec) != space) {
+ || ibuf_rec_get_space(&mtr, rec) != space_id) {
if (block) {
page_header_reset_last_insert(
@@ -4881,7 +4881,7 @@ loop:
ut_ad(page_rec_is_user_rec(rec));
ut_ad(ibuf_rec_get_page_no(&mtr, rec)
== page_no);
- ut_ad(ibuf_rec_get_space(&mtr, rec) == space);
+ ut_ad(ibuf_rec_get_space(&mtr, rec) == space_id);
/* Mark the change buffer record processed,
so that it will not be merged again in case
@@ -4911,7 +4911,7 @@ loop:
buf_block_dbg_add_level(
block, SYNC_IBUF_TREE_NODE);
- if (!ibuf_restore_pos(space, page_no,
+ if (!ibuf_restore_pos(space_id, page_no,
search_tuple,
BTR_MODIFY_LEAF,
&pcur, &mtr)) {
@@ -4935,7 +4935,7 @@ loop:
}
/* Delete the record from ibuf */
- if (ibuf_delete_rec(space, page_no, &pcur, search_tuple,
+ if (ibuf_delete_rec(space_id, page_no, &pcur, search_tuple,
&mtr)) {
/* Deletion was pessimistic and mtr was committed:
we start from the beginning again */
@@ -4955,7 +4955,7 @@ reset_bit:
page_t* bitmap_page;
bitmap_page = ibuf_bitmap_get_map_page(
- space, page_no, zip_size, &mtr);
+ space_id, page_no, zip_size, &mtr);
ibuf_bitmap_page_set_bits(
bitmap_page, page_no, zip_size,
@@ -4996,13 +4996,12 @@ reset_bit:
mutex_exit(&ibuf_mutex);
#endif /* HAVE_ATOMIC_BUILTINS */
- if (update_ibuf_bitmap && !tablespace_being_deleted) {
-
- fil_decr_pending_ops(space);
+ if (space) {
+ fil_space_release(space);
}
#ifdef UNIV_IBUF_COUNT_DEBUG
- ut_a(ibuf_count_get(space, page_no) == 0);
+ ut_a(ibuf_count_get(space_id, page_no) == 0);
#endif
}
diff --git a/storage/xtradb/include/btr0cur.h b/storage/xtradb/include/btr0cur.h
index f485d072c4c..960bd55d3d9 100644
--- a/storage/xtradb/include/btr0cur.h
+++ b/storage/xtradb/include/btr0cur.h
@@ -294,11 +294,7 @@ btr_cur_update_alloc_zip_func(
false=update-in-place */
mtr_t* mtr, /*!< in/out: mini-transaction */
trx_t* trx) /*!< in: NULL or transaction */
-#ifdef UNIV_DEBUG
- MY_ATTRIBUTE((nonnull (1, 2, 3, 4, 7), warn_unused_result));
-#else
- MY_ATTRIBUTE((nonnull (1, 2, 3, 6), warn_unused_result));
-#endif
+ MY_ATTRIBUTE((warn_unused_result));
#ifdef UNIV_DEBUG
# define btr_cur_update_alloc_zip(page_zip,cursor,index,offsets,len,cr,mtr,trx) \
@@ -428,7 +424,7 @@ btr_cur_del_mark_set_clust_rec(
const ulint* offsets,/*!< in: rec_get_offsets(rec) */
que_thr_t* thr, /*!< in: query thread */
mtr_t* mtr) /*!< in/out: mini-transaction */
- MY_ATTRIBUTE((nonnull, warn_unused_result));
+ MY_ATTRIBUTE((warn_unused_result));
/***********************************************************//**
Sets a secondary index record delete mark to TRUE or FALSE.
@return DB_SUCCESS, DB_LOCK_WAIT, or error number */
@@ -441,7 +437,7 @@ btr_cur_del_mark_set_sec_rec(
ibool val, /*!< in: value to set */
que_thr_t* thr, /*!< in: query thread */
mtr_t* mtr) /*!< in/out: mini-transaction */
- MY_ATTRIBUTE((nonnull, warn_unused_result));
+ MY_ATTRIBUTE((warn_unused_result));
/*************************************************************//**
Tries to compress a page of the tree if it seems useful. It is assumed
that mtr holds an x-latch on the tree and on the cursor page. To avoid
@@ -609,8 +605,7 @@ btr_cur_disown_inherited_fields(
dict_index_t* index, /*!< in: index of the page */
const ulint* offsets,/*!< in: array returned by rec_get_offsets() */
const upd_t* update, /*!< in: update vector */
- mtr_t* mtr) /*!< in/out: mini-transaction */
- MY_ATTRIBUTE((nonnull(2,3,4,5,6)));
+ mtr_t* mtr); /*!< in/out: mini-transaction */
/** Operation code for btr_store_big_rec_extern_fields(). */
enum blob_op {
@@ -655,7 +650,7 @@ btr_store_big_rec_extern_fields(
mtr_t* btr_mtr, /*!< in: mtr containing the
latches to the clustered index */
enum blob_op op) /*! in: operation code */
- MY_ATTRIBUTE((nonnull, warn_unused_result));
+ MY_ATTRIBUTE((warn_unused_result));
/*******************************************************************//**
Frees the space in an externally stored field to the file space
@@ -751,8 +746,7 @@ btr_push_update_extern_fields(
/*==========================*/
dtuple_t* tuple, /*!< in/out: data tuple */
const upd_t* update, /*!< in: update vector */
- mem_heap_t* heap) /*!< in: memory heap */
- MY_ATTRIBUTE((nonnull));
+ mem_heap_t* heap); /*!< in: memory heap */
/***********************************************************//**
Sets a secondary index record's delete mark to the given value. This
function is only used by the insert buffer merge mechanism. */
diff --git a/storage/xtradb/include/btr0sea.h b/storage/xtradb/include/btr0sea.h
index db7b477fae1..66c27607013 100644
--- a/storage/xtradb/include/btr0sea.h
+++ b/storage/xtradb/include/btr0sea.h
@@ -200,7 +200,7 @@ hash_table_t*
btr_search_get_hash_table(
/*======================*/
const dict_index_t* index) /*!< in: index */
- MY_ATTRIBUTE((pure,warn_unused_result));
+ MY_ATTRIBUTE((warn_unused_result));
/********************************************************************//**
Returns the adaptive hash index latch for a given index key.
@@ -210,7 +210,7 @@ prio_rw_lock_t*
btr_search_get_latch(
/*=================*/
const dict_index_t* index) /*!< in: index */
- MY_ATTRIBUTE((pure,warn_unused_result));
+ MY_ATTRIBUTE((warn_unused_result));
/*********************************************************************//**
Returns the AHI partition number corresponding to a given index ID. */
@@ -227,8 +227,7 @@ UNIV_INLINE
void
btr_search_index_init(
/*===============*/
- dict_index_t* index) /*!< in: index */
- MY_ATTRIBUTE((nonnull));
+ dict_index_t* index); /*!< in: index */
/********************************************************************//**
Latches all adaptive hash index latches in exclusive mode. */
diff --git a/storage/xtradb/include/btr0sea.ic b/storage/xtradb/include/btr0sea.ic
index 3cbcff75f31..e963d8a8449 100644
--- a/storage/xtradb/include/btr0sea.ic
+++ b/storage/xtradb/include/btr0sea.ic
@@ -90,7 +90,6 @@ btr_search_get_hash_table(
/*======================*/
const dict_index_t* index) /*!< in: index */
{
- ut_ad(index);
ut_ad(index->search_table);
return(index->search_table);
@@ -105,7 +104,6 @@ btr_search_get_latch(
/*=================*/
const dict_index_t* index) /*!< in: index */
{
- ut_ad(index);
ut_ad(index->search_latch >= btr_search_latch_arr &&
index->search_latch < btr_search_latch_arr +
btr_search_index_num);
@@ -132,8 +130,6 @@ btr_search_index_init(
/*===============*/
dict_index_t* index) /*!< in: index */
{
- ut_ad(index);
-
index->search_latch =
&btr_search_latch_arr[btr_search_get_key(index->id)];
index->search_table =
diff --git a/storage/xtradb/include/buf0buddy.ic b/storage/xtradb/include/buf0buddy.ic
index 9bc8e9e8762..a5fb510dd19 100644
--- a/storage/xtradb/include/buf0buddy.ic
+++ b/storage/xtradb/include/buf0buddy.ic
@@ -50,7 +50,7 @@ buf_buddy_alloc_low(
allocated from the LRU list and
buf_pool->LRU_list_mutex was
temporarily released */
- MY_ATTRIBUTE((malloc, nonnull));
+ MY_ATTRIBUTE((malloc));
/**********************************************************************//**
Deallocate a block. */
diff --git a/storage/xtradb/include/buf0buf.h b/storage/xtradb/include/buf0buf.h
index 6924481af49..1774d9445ff 100644
--- a/storage/xtradb/include/buf0buf.h
+++ b/storage/xtradb/include/buf0buf.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. 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
@@ -243,8 +243,7 @@ buf_relocate(
buf_page_t* bpage, /*!< in/out: control block being relocated;
buf_page_get_state(bpage) must be
BUF_BLOCK_ZIP_DIRTY or BUF_BLOCK_ZIP_PAGE */
- buf_page_t* dpage) /*!< in/out: destination control block */
- MY_ATTRIBUTE((nonnull));
+ buf_page_t* dpage); /*!< in/out: destination control block */
/*********************************************************************//**
Gets the current size of buffer buf_pool in bytes.
@return size in bytes */
@@ -639,19 +638,68 @@ buf_block_unfix(
#else /* !UNIV_HOTBACKUP */
# define buf_block_modify_clock_inc(block) ((void) 0)
#endif /* !UNIV_HOTBACKUP */
+
+/** Checks if the page is in crc32 checksum format.
+@param[in] read_buf database page
+@param[in] checksum_field1 new checksum field
+@param[in] checksum_field2 old checksum field
+@return true if the page is in crc32 checksum format */
+bool
+buf_page_is_checksum_valid_crc32(
+ const byte* read_buf,
+ ulint checksum_field1,
+ ulint checksum_field2)
+ MY_ATTRIBUTE((warn_unused_result));
+
+/** Checks if the page is in innodb checksum format.
+@param[in] read_buf database page
+@param[in] checksum_field1 new checksum field
+@param[in] checksum_field2 old checksum field
+@return true if the page is in innodb checksum format */
+bool
+buf_page_is_checksum_valid_innodb(
+ const byte* read_buf,
+ ulint checksum_field1,
+ ulint checksum_field2)
+ MY_ATTRIBUTE((warn_unused_result));
+
+/** Checks if the page is in none checksum format.
+@param[in] read_buf database page
+@param[in] checksum_field1 new checksum field
+@param[in] checksum_field2 old checksum field
+@return true if the page is in none checksum format */
+bool
+buf_page_is_checksum_valid_none(
+ const byte* read_buf,
+ ulint checksum_field1,
+ ulint checksum_field2)
+ MY_ATTRIBUTE((warn_unused_result));
+
/********************************************************************//**
Checks if a page is corrupt.
-@return TRUE if corrupted */
-UNIV_INTERN
-ibool
+@param[in] check_lsn true if LSN should be checked
+@param[in] read_buf Page to be checked
+@param[in] zip_size compressed size or 0
+@param[in] space Pointer to tablespace
+@return true if corrupted, false if not */
+bool
buf_page_is_corrupted(
-/*==================*/
- bool check_lsn, /*!< in: true if we need to check the
- and complain about the LSN */
- const byte* read_buf, /*!< in: a database page */
- ulint zip_size) /*!< in: size of compressed page;
- 0 for uncompressed pages */
- MY_ATTRIBUTE((nonnull, warn_unused_result));
+ bool check_lsn,
+ const byte* read_buf,
+ ulint zip_size,
+ const fil_space_t* space)
+ MY_ATTRIBUTE((warn_unused_result));
+/********************************************************************//**
+Check if page is maybe compressed, encrypted or both when we encounter
+corrupted page. Note that we can't be 100% sure if page is corrupted
+or decrypt/decompress just failed.
+@param[in] bpage Page
+@return true if page corrupted, false if not */
+bool
+buf_page_check_corrupt(
+ buf_page_t* bpage) /*!< in/out: buffer page read from disk */
+ MY_ATTRIBUTE(( warn_unused_result));
+
/********************************************************************//**
Checks if a page is all zeroes.
@return TRUE if the page is all zeroes */
@@ -742,7 +790,7 @@ buf_page_print(
ulint flags) /*!< in: 0 or
BUF_PAGE_PRINT_NO_CRASH or
BUF_PAGE_PRINT_NO_FULL */
- UNIV_COLD MY_ATTRIBUTE((nonnull));
+ UNIV_COLD;
/********************************************************************//**
Decompress a block.
@return TRUE if successful */
@@ -1524,7 +1572,7 @@ The hook that is called just after a page is read from disk.
The function decrypt disk content into buf_page_t and releases the
temporary buffer that was allocated in buf_page_decrypt_before_read */
UNIV_INTERN
-ibool
+bool
buf_page_decrypt_after_read(
/*========================*/
buf_page_t* page); /*!< in/out: buffer page read from disk */
@@ -1630,15 +1678,8 @@ struct buf_page_t{
if written again we check is TRIM
operation needed. */
- unsigned key_version; /*!< key version for this block */
- bool page_encrypted; /*!< page is page encrypted */
- bool page_compressed;/*!< page is page compressed */
- ulint stored_checksum;/*!< stored page checksum if page
- encrypted */
- bool encrypted; /*!< page is still encrypted */
- ulint calculated_checksum;
- /*!< calculated checksum if page
- encrypted */
+ unsigned key_version; /*!< key version for this block */
+ bool encrypted; /*!< page is still encrypted */
ulint real_size; /*!< Real size of the page
Normal pages == UNIV_PAGE_SIZE
@@ -2070,7 +2111,10 @@ struct buf_pool_t{
os_event_t no_flush[BUF_FLUSH_N_TYPES];
/*!< this is in the set state
when there is no flush batch
- of the given type running */
+ of the given type running;
+ os_event_set() and os_event_reset()
+ are protected by
+ buf_pool_t::flush_state_mutex */
ib_rbt_t* flush_rbt; /*!< a red-black tree is used
exclusively during recovery to
speed up insertions in the
@@ -2318,7 +2362,6 @@ buf_pool_mutex_exit(
/*================*/
buf_pool_t* buf_pool); /*!< in: buffer pool */
-
#ifndef UNIV_NONINL
#include "buf0buf.ic"
#endif
diff --git a/storage/xtradb/include/buf0dblwr.h b/storage/xtradb/include/buf0dblwr.h
index a62a6400d97..5582778825c 100644
--- a/storage/xtradb/include/buf0dblwr.h
+++ b/storage/xtradb/include/buf0dblwr.h
@@ -1,6 +1,7 @@
/*****************************************************************************
Copyright (c) 1995, 2014, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 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
@@ -134,11 +135,13 @@ struct buf_dblwr_t{
ulint b_reserved;/*!< number of slots currently reserved
for batch flush. */
os_event_t b_event;/*!< event where threads wait for a
- batch flush to end. */
+ batch flush to end;
+ os_event_set() and os_event_reset()
+ are protected by buf_dblwr_t::mutex */
ulint s_reserved;/*!< number of slots currently
reserved for single page flushes. */
os_event_t s_event;/*!< event where threads wait for a
- single page flush slot. */
+ single page flush slot. Protected by mutex. */
bool* in_use; /*!< flag used to indicate if a slot is
in use. Only used for single page
flushes. */
diff --git a/storage/xtradb/include/dict0dict.h b/storage/xtradb/include/dict0dict.h
index cfaf3e12e82..1622b927a76 100644
--- a/storage/xtradb/include/dict0dict.h
+++ b/storage/xtradb/include/dict0dict.h
@@ -762,7 +762,7 @@ ulint
dict_index_is_clust(
/*================*/
const dict_index_t* index) /*!< in: index */
- MY_ATTRIBUTE((nonnull, pure, warn_unused_result));
+ MY_ATTRIBUTE((warn_unused_result));
/********************************************************************//**
Check whether the index is unique.
@return nonzero for unique index, zero for other indexes */
@@ -771,7 +771,7 @@ ulint
dict_index_is_unique(
/*=================*/
const dict_index_t* index) /*!< in: index */
- MY_ATTRIBUTE((nonnull, pure, warn_unused_result));
+ MY_ATTRIBUTE((warn_unused_result));
/********************************************************************//**
Check whether the index is the insert buffer tree.
@return nonzero for insert buffer, zero for other indexes */
@@ -780,7 +780,7 @@ ulint
dict_index_is_ibuf(
/*===============*/
const dict_index_t* index) /*!< in: index */
- MY_ATTRIBUTE((nonnull, pure, warn_unused_result));
+ MY_ATTRIBUTE((warn_unused_result));
/********************************************************************//**
Check whether the index is a secondary index or the insert buffer tree.
@return nonzero for insert buffer, zero for other indexes */
@@ -789,7 +789,7 @@ ulint
dict_index_is_sec_or_ibuf(
/*======================*/
const dict_index_t* index) /*!< in: index */
- MY_ATTRIBUTE((nonnull, pure, warn_unused_result));
+ MY_ATTRIBUTE((warn_unused_result));
/************************************************************************
Gets the all the FTS indexes for the table. NOTE: must not be called for
@@ -811,7 +811,7 @@ ulint
dict_table_get_n_user_cols(
/*=======================*/
const dict_table_t* table) /*!< in: table */
- MY_ATTRIBUTE((nonnull, pure, warn_unused_result));
+ MY_ATTRIBUTE((warn_unused_result));
/********************************************************************//**
Gets the number of system columns in a table in the dictionary cache.
@return number of system (e.g., ROW_ID) columns of a table */
@@ -830,7 +830,7 @@ ulint
dict_table_get_n_cols(
/*==================*/
const dict_table_t* table) /*!< in: table */
- MY_ATTRIBUTE((nonnull, pure, warn_unused_result));
+ MY_ATTRIBUTE((warn_unused_result));
/********************************************************************//**
Gets the approximately estimated number of rows in the table.
@return estimated number of rows */
@@ -1784,7 +1784,7 @@ ulint
dict_index_is_corrupted(
/*====================*/
const dict_index_t* index) /*!< in: index */
- MY_ATTRIBUTE((nonnull, warn_unused_result));
+ MY_ATTRIBUTE((warn_unused_result));
#endif /* !UNIV_HOTBACKUP */
/**********************************************************************//**
@@ -1797,7 +1797,7 @@ dict_set_corrupted(
dict_index_t* index, /*!< in/out: index */
trx_t* trx, /*!< in/out: transaction */
const char* ctx) /*!< in: context */
- UNIV_COLD MY_ATTRIBUTE((nonnull));
+ UNIV_COLD;
/**********************************************************************//**
Flags an index corrupted in the data dictionary cache only. This
@@ -1808,8 +1808,7 @@ void
dict_set_corrupted_index_cache_only(
/*================================*/
dict_index_t* index, /*!< in/out: index */
- dict_table_t* table) /*!< in/out: table */
- MY_ATTRIBUTE((nonnull));
+ dict_table_t* table); /*!< in/out: table */
/**********************************************************************//**
Flags a table with specified space_id corrupted in the table dictionary
diff --git a/storage/xtradb/include/dict0dict.ic b/storage/xtradb/include/dict0dict.ic
index 2b63ddea51d..81da2fa5580 100644
--- a/storage/xtradb/include/dict0dict.ic
+++ b/storage/xtradb/include/dict0dict.ic
@@ -267,7 +267,6 @@ dict_index_is_clust(
/*================*/
const dict_index_t* index) /*!< in: index */
{
- ut_ad(index);
ut_ad(index->magic_n == DICT_INDEX_MAGIC_N);
return(index->type & DICT_CLUSTERED);
@@ -281,7 +280,6 @@ dict_index_is_unique(
/*=================*/
const dict_index_t* index) /*!< in: index */
{
- ut_ad(index);
ut_ad(index->magic_n == DICT_INDEX_MAGIC_N);
return(index->type & DICT_UNIQUE);
@@ -296,7 +294,6 @@ dict_index_is_ibuf(
/*===============*/
const dict_index_t* index) /*!< in: index */
{
- ut_ad(index);
ut_ad(index->magic_n == DICT_INDEX_MAGIC_N);
return(index->type & DICT_IBUF);
@@ -328,7 +325,6 @@ dict_index_is_sec_or_ibuf(
{
ulint type;
- ut_ad(index);
ut_ad(index->magic_n == DICT_INDEX_MAGIC_N);
type = index->type;
@@ -346,7 +342,6 @@ dict_table_get_n_user_cols(
/*=======================*/
const dict_table_t* table) /*!< in: table */
{
- ut_ad(table);
ut_ad(table->magic_n == DICT_TABLE_MAGIC_N);
return(table->n_cols - DATA_N_SYS_COLS);
@@ -378,7 +373,6 @@ dict_table_get_n_cols(
/*==================*/
const dict_table_t* table) /*!< in: table */
{
- ut_ad(table);
ut_ad(table->magic_n == DICT_TABLE_MAGIC_N);
return(table->n_cols);
@@ -1550,7 +1544,6 @@ dict_index_is_corrupted(
/*====================*/
const dict_index_t* index) /*!< in: index */
{
- ut_ad(index);
ut_ad(index->magic_n == DICT_INDEX_MAGIC_N);
return((index->type & DICT_CORRUPT)
diff --git a/storage/xtradb/include/dict0stats_bg.h b/storage/xtradb/include/dict0stats_bg.h
index 34dc4657829..d5f0870718d 100644
--- a/storage/xtradb/include/dict0stats_bg.h
+++ b/storage/xtradb/include/dict0stats_bg.h
@@ -1,6 +1,7 @@
/*****************************************************************************
Copyright (c) 2012, 2016, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 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
@@ -32,7 +33,8 @@ Created Apr 26, 2012 Vasil Dimov
#include "os0sync.h" /* os_event_t */
#include "os0thread.h" /* DECLARE_THREAD */
-/** Event to wake up the stats thread */
+/** Event to wake up dict_stats_thread on dict_stats_recalc_pool_add()
+or shutdown. Not protected by any mutex. */
extern os_event_t dict_stats_event;
/*****************************************************************//**
diff --git a/storage/xtradb/include/dyn0dyn.h b/storage/xtradb/include/dyn0dyn.h
index 1bd10b6bf58..20963a1472b 100644
--- a/storage/xtradb/include/dyn0dyn.h
+++ b/storage/xtradb/include/dyn0dyn.h
@@ -46,9 +46,8 @@ UNIV_INLINE
dyn_array_t*
dyn_array_create(
/*=============*/
- dyn_array_t* arr) /*!< in/out memory buffer of
+ dyn_array_t* arr); /*!< in/out memory buffer of
size sizeof(dyn_array_t) */
- MY_ATTRIBUTE((nonnull));
/************************************************************//**
Frees a dynamic array. */
UNIV_INLINE
@@ -69,7 +68,7 @@ dyn_array_open(
dyn_array_t* arr, /*!< in: dynamic array */
ulint size) /*!< in: size in bytes of the buffer; MUST be
smaller than DYN_ARRAY_DATA_SIZE! */
- MY_ATTRIBUTE((nonnull, warn_unused_result));
+ MY_ATTRIBUTE((warn_unused_result));
/*********************************************************************//**
Closes the buffer returned by dyn_array_open. */
UNIV_INLINE
@@ -77,8 +76,7 @@ void
dyn_array_close(
/*============*/
dyn_array_t* arr, /*!< in: dynamic array */
- const byte* ptr) /*!< in: end of used space */
- MY_ATTRIBUTE((nonnull));
+ const byte* ptr); /*!< in: end of used space */
/*********************************************************************//**
Makes room on top of a dyn array and returns a pointer to
the added element. The caller must copy the element to
@@ -90,7 +88,7 @@ dyn_array_push(
/*===========*/
dyn_array_t* arr, /*!< in/out: dynamic array */
ulint size) /*!< in: size in bytes of the element */
- MY_ATTRIBUTE((nonnull, warn_unused_result));
+ MY_ATTRIBUTE((warn_unused_result));
/************************************************************//**
Returns pointer to an element in dyn array.
@return pointer to element */
@@ -101,7 +99,7 @@ dyn_array_get_element(
const dyn_array_t* arr, /*!< in: dyn array */
ulint pos) /*!< in: position of element
in bytes from array start */
- MY_ATTRIBUTE((nonnull, warn_unused_result));
+ MY_ATTRIBUTE((warn_unused_result));
/************************************************************//**
Returns the size of stored data in a dyn array.
@return data size in bytes */
@@ -110,7 +108,7 @@ ulint
dyn_array_get_data_size(
/*====================*/
const dyn_array_t* arr) /*!< in: dyn array */
- MY_ATTRIBUTE((nonnull, warn_unused_result, pure));
+ MY_ATTRIBUTE((warn_unused_result));
/************************************************************//**
Gets the first block in a dyn array.
@param arr dyn array
@@ -144,7 +142,7 @@ ulint
dyn_block_get_used(
/*===============*/
const dyn_block_t* block) /*!< in: dyn array block */
- MY_ATTRIBUTE((nonnull, warn_unused_result, pure));
+ MY_ATTRIBUTE((warn_unused_result));
/********************************************************************//**
Gets pointer to the start of data in a dyn array block.
@return pointer to data */
@@ -153,7 +151,7 @@ byte*
dyn_block_get_data(
/*===============*/
const dyn_block_t* block) /*!< in: dyn array block */
- MY_ATTRIBUTE((nonnull, warn_unused_result, pure));
+ MY_ATTRIBUTE((warn_unused_result));
/********************************************************//**
Pushes n bytes to a dyn array. */
UNIV_INLINE
diff --git a/storage/xtradb/include/dyn0dyn.ic b/storage/xtradb/include/dyn0dyn.ic
index f18f2e6dff9..6e97649245e 100644
--- a/storage/xtradb/include/dyn0dyn.ic
+++ b/storage/xtradb/include/dyn0dyn.ic
@@ -36,7 +36,7 @@ dyn_block_t*
dyn_array_add_block(
/*================*/
dyn_array_t* arr) /*!< in/out: dyn array */
- MY_ATTRIBUTE((nonnull, warn_unused_result));
+ MY_ATTRIBUTE((warn_unused_result));
/********************************************************************//**
Gets the number of used bytes in a dyn array block.
@@ -47,8 +47,6 @@ dyn_block_get_used(
/*===============*/
const dyn_block_t* block) /*!< in: dyn array block */
{
- ut_ad(block);
-
return((block->used) & ~DYN_BLOCK_FULL_FLAG);
}
@@ -76,7 +74,6 @@ dyn_array_create(
dyn_array_t* arr) /*!< in/out: memory buffer of
size sizeof(dyn_array_t) */
{
- ut_ad(arr);
#if DYN_ARRAY_DATA_SIZE >= DYN_BLOCK_FULL_FLAG
# error "DYN_ARRAY_DATA_SIZE >= DYN_BLOCK_FULL_FLAG"
#endif
@@ -119,7 +116,6 @@ dyn_array_push(
dyn_block_t* block;
ulint used;
- ut_ad(arr);
ut_ad(arr->magic_n == DYN_BLOCK_MAGIC_N);
ut_ad(size <= DYN_ARRAY_DATA_SIZE);
ut_ad(size);
@@ -159,7 +155,6 @@ dyn_array_open(
{
dyn_block_t* block;
- ut_ad(arr);
ut_ad(arr->magic_n == DYN_BLOCK_MAGIC_N);
ut_ad(size <= DYN_ARRAY_DATA_SIZE);
ut_ad(size);
@@ -195,7 +190,6 @@ dyn_array_close(
{
dyn_block_t* block;
- ut_ad(arr);
ut_ad(arr->magic_n == DYN_BLOCK_MAGIC_N);
block = dyn_array_get_last_block(arr);
@@ -222,7 +216,6 @@ dyn_array_get_element(
{
const dyn_block_t* block;
- ut_ad(arr);
ut_ad(arr->magic_n == DYN_BLOCK_MAGIC_N);
/* Get the first array block */
@@ -260,7 +253,6 @@ dyn_array_get_data_size(
const dyn_block_t* block;
ulint sum = 0;
- ut_ad(arr);
ut_ad(arr->magic_n == DYN_BLOCK_MAGIC_N);
if (arr->heap == NULL) {
diff --git a/storage/xtradb/include/fil0crypt.h b/storage/xtradb/include/fil0crypt.h
index 42cdafde4d0..cfc2d850883 100644
--- a/storage/xtradb/include/fil0crypt.h
+++ b/storage/xtradb/include/fil0crypt.h
@@ -39,14 +39,6 @@ static const unsigned char CRYPT_MAGIC[MAGIC_SZ] = {
/* This key will be used if nothing else is given */
#define FIL_DEFAULT_ENCRYPTION_KEY ENCRYPTION_KEY_SYSTEM_DATA
-/** Enum values for encryption table option */
-typedef enum {
- FIL_SPACE_ENCRYPTION_DEFAULT = 0, /* Tablespace encrypted if
- srv_encrypt_tables = ON */
- FIL_SPACE_ENCRYPTION_ON = 1, /* Tablespace is encrypted always */
- FIL_SPACE_ENCRYPTION_OFF = 2 /* Tablespace is not encrypted */
-} fil_encryption_t;
-
extern os_event_t fil_crypt_threads_event;
/**
@@ -110,23 +102,21 @@ struct fil_space_rotate_state_t
} scrubbing;
};
-struct fil_space_crypt_struct : st_encryption_scheme
+struct fil_space_crypt_t : st_encryption_scheme
{
public:
/** Constructor. Does not initialize the members!
The object is expected to be placed in a buffer that
has been zero-initialized. */
- fil_space_crypt_struct(
+ fil_space_crypt_t(
ulint new_type,
uint new_min_key_version,
uint new_key_id,
- ulint offset,
fil_encryption_t new_encryption)
: st_encryption_scheme(),
min_key_version(new_min_key_version),
- page0_offset(offset),
+ page0_offset(0),
encryption(new_encryption),
- closing(false),
key_found(),
rotate_state()
{
@@ -138,9 +128,9 @@ struct fil_space_crypt_struct : st_encryption_scheme
locker = crypt_data_scheme_locker;
type = new_type;
- if (new_encryption == FIL_SPACE_ENCRYPTION_OFF ||
+ if (new_encryption == FIL_ENCRYPTION_OFF ||
(!srv_encrypt_tables &&
- new_encryption == FIL_SPACE_ENCRYPTION_DEFAULT)) {
+ new_encryption == FIL_ENCRYPTION_DEFAULT)) {
type = CRYPT_SCHEME_UNENCRYPTED;
} else {
type = CRYPT_SCHEME_1;
@@ -149,9 +139,8 @@ struct fil_space_crypt_struct : st_encryption_scheme
}
/** Destructor */
- ~fil_space_crypt_struct()
+ ~fil_space_crypt_t()
{
- closing = true;
mutex_free(&mutex);
}
@@ -169,45 +158,36 @@ struct fil_space_crypt_struct : st_encryption_scheme
/** Returns true if tablespace should be encrypted */
bool should_encrypt() const {
- return ((encryption == FIL_SPACE_ENCRYPTION_ON) ||
+ return ((encryption == FIL_ENCRYPTION_ON) ||
(srv_encrypt_tables &&
- encryption == FIL_SPACE_ENCRYPTION_DEFAULT));
+ encryption == FIL_ENCRYPTION_DEFAULT));
}
/** Return true if tablespace is encrypted. */
bool is_encrypted() const {
- return (encryption != FIL_SPACE_ENCRYPTION_OFF);
+ return (encryption != FIL_ENCRYPTION_OFF);
}
/** Return true if default tablespace encryption is used, */
bool is_default_encryption() const {
- return (encryption == FIL_SPACE_ENCRYPTION_DEFAULT);
+ return (encryption == FIL_ENCRYPTION_DEFAULT);
}
/** Return true if tablespace is not encrypted. */
bool not_encrypted() const {
- return (encryption == FIL_SPACE_ENCRYPTION_OFF);
+ return (encryption == FIL_ENCRYPTION_OFF);
}
- /** Is this tablespace closing. */
- bool is_closing(bool is_fixed) {
- bool closed;
- if (!is_fixed) {
- mutex_enter(&mutex);
- }
- closed = closing;
- if (!is_fixed) {
- mutex_exit(&mutex);
- }
- return closed;
- }
+ /** Write crypt data to a page (0)
+ @param[in,out] page0 Page 0 where to write
+ @param[in,out] mtr Minitransaction */
+ void write_page0(byte* page0, mtr_t* mtr);
uint min_key_version; // min key version for this space
ulint page0_offset; // byte offset on page 0 for crypt data
fil_encryption_t encryption; // Encryption setup
ib_mutex_t mutex; // mutex protecting following variables
- bool closing; // is tablespace being closed
/** Return code from encryption_key_get_latest_version.
If ENCRYPTION_KEY_VERSION_INVALID encryption plugin
@@ -219,317 +199,307 @@ struct fil_space_crypt_struct : st_encryption_scheme
fil_space_rotate_state_t rotate_state;
};
-/* structure containing encryption specification */
-typedef struct fil_space_crypt_struct fil_space_crypt_t;
+/** Status info about encryption */
+struct fil_space_crypt_status_t {
+ ulint space; /*!< tablespace id */
+ ulint scheme; /*!< encryption scheme */
+ uint min_key_version; /*!< min key version */
+ uint current_key_version;/*!< current key version */
+ uint keyserver_requests;/*!< no of key requests to key server */
+ ulint key_id; /*!< current key_id */
+ bool rotating; /*!< is key rotation ongoing */
+ bool flushing; /*!< is flush at end of rotation ongoing */
+ ulint rotate_next_page_number; /*!< next page if key rotating */
+ ulint rotate_max_page_number; /*!< max page if key rotating */
+};
+
+/** Statistics about encryption key rotation */
+struct fil_crypt_stat_t {
+ ulint pages_read_from_cache;
+ ulint pages_read_from_disk;
+ ulint pages_modified;
+ ulint pages_flushed;
+ ulint estimated_iops;
+};
+
+/** Status info about scrubbing */
+struct fil_space_scrub_status_t {
+ ulint space; /*!< tablespace id */
+ bool compressed; /*!< is space compressed */
+ time_t last_scrub_completed; /*!< when was last scrub completed */
+ bool scrubbing; /*!< is scrubbing ongoing */
+ time_t current_scrub_started; /*!< when started current scrubbing */
+ ulint current_scrub_active_threads; /*!< current scrub active threads */
+ ulint current_scrub_page_number; /*!< current scrub page no */
+ ulint current_scrub_max_page_number; /*!< current scrub max page no */
+};
/*********************************************************************
-Init global resources needed for tablespace encryption/decryption */
+Init space crypt */
UNIV_INTERN
void
fil_space_crypt_init();
/*********************************************************************
-Cleanup global resources needed for tablespace encryption/decryption */
+Cleanup space crypt */
UNIV_INTERN
void
fil_space_crypt_cleanup();
-/*********************************************************************
-Create crypt data, i.e data that is used for a single tablespace */
-UNIV_INTERN
-fil_space_crypt_t *
-fil_space_create_crypt_data(
-/*========================*/
- fil_encryption_t encrypt_mode, /*!< in: encryption mode */
- uint key_id); /*!< in: encryption key id */
-
-/*********************************************************************
-Destroy crypt data */
-UNIV_INTERN
-void
-fil_space_destroy_crypt_data(
-/*=========================*/
- fil_space_crypt_t **crypt_data); /*!< in/out: crypt data */
-
-/*********************************************************************
-Get crypt data for a space*/
-UNIV_INTERN
-fil_space_crypt_t *
-fil_space_get_crypt_data(
-/*=====================*/
- ulint space); /*!< in: tablespace id */
+/******************************************************************
+Create a fil_space_crypt_t object
+@param[in] encrypt_mode FIL_ENCRYPTION_DEFAULT or
+ FIL_ENCRYPTION_ON or
+ FIL_ENCRYPTION_OFF
-/*********************************************************************
-Set crypt data for a space*/
+@param[in] key_id Encryption key id
+@return crypt object */
UNIV_INTERN
fil_space_crypt_t*
-fil_space_set_crypt_data(
-/*=====================*/
- ulint space, /*!< in: tablespace id */
- fil_space_crypt_t* crypt_data); /*!< in: crypt data to set */
+fil_space_create_crypt_data(
+ fil_encryption_t encrypt_mode,
+ uint key_id)
+ MY_ATTRIBUTE((warn_unused_result));
-/*********************************************************************
-Merge crypt data */
+/******************************************************************
+Merge fil_space_crypt_t object
+@param[in,out] dst Destination cryp data
+@param[in] src Source crypt data */
UNIV_INTERN
void
fil_space_merge_crypt_data(
-/*=======================*/
- fil_space_crypt_t* dst_crypt_data, /*!< in: crypt_data */
- const fil_space_crypt_t* src_crypt_data); /*!< in: crypt data */
+ fil_space_crypt_t* dst,
+ const fil_space_crypt_t* src);
-/*********************************************************************
-Read crypt data from buffer page */
+/******************************************************************
+Read crypt data from a page (0)
+@param[in] space space_id
+@param[in] page Page 0
+@param[in] offset Offset to crypt data
+@return crypt data from page 0 or NULL. */
UNIV_INTERN
-fil_space_crypt_t *
+fil_space_crypt_t*
fil_space_read_crypt_data(
-/*======================*/
- ulint space, /*!< in: tablespace id */
- const byte* page, /*!< in: buffer page */
- ulint offset); /*!< in: offset where crypt data is stored */
+ ulint space,
+ const byte* page,
+ ulint offset)
+ MY_ATTRIBUTE((warn_unused_result));
-/*********************************************************************
-Write crypt data to buffer page */
+/******************************************************************
+Free a crypt data object
+@param[in,out] crypt_data crypt data to be freed */
UNIV_INTERN
void
-fil_space_write_crypt_data(
-/*=======================*/
- ulint space, /*!< in: tablespace id */
- byte* page, /*!< in: buffer page */
- ulint offset, /*!< in: offset where to store data */
- ulint maxsize, /*!< in: max space available to store crypt data in */
- mtr_t * mtr); /*!< in: mini-transaction */
+fil_space_destroy_crypt_data(
+ fil_space_crypt_t **crypt_data);
-/*********************************************************************
-Clear crypt data from page 0 (used for import tablespace) */
+/******************************************************************
+Parse a MLOG_FILE_WRITE_CRYPT_DATA log entry
+@param[in] ptr Log entry start
+@param[in] end_ptr Log entry end
+@param[in] block buffer block
+@return position on log buffer */
UNIV_INTERN
-void
-fil_space_clear_crypt_data(
-/*=======================*/
- byte* page, /*!< in: buffer page */
- ulint offset); /*!< in: offset where crypt data is stored */
+const byte*
+fil_parse_write_crypt_data(
+ const byte* ptr,
+ const byte* end_ptr,
+ const buf_block_t* block)
+ MY_ATTRIBUTE((warn_unused_result));
-/*********************************************************************
-Parse crypt data log record */
+/******************************************************************
+Encrypt a buffer
+@param[in,out] crypt_data Crypt data
+@param[in] space space_id
+@param[in] offset Page offset
+@param[in] lsn Log sequence number
+@param[in] src_frame Page to encrypt
+@param[in] zip_size Compressed size or 0
+@param[in,out] dst_frame Output buffer
+@return encrypted buffer or NULL */
UNIV_INTERN
byte*
-fil_parse_write_crypt_data(
-/*=======================*/
- byte* ptr, /*!< in: start of log record */
- byte* end_ptr, /*!< in: end of log record */
- buf_block_t*); /*!< in: buffer page to apply record to */
+fil_encrypt_buf(
+ fil_space_crypt_t* crypt_data,
+ ulint space,
+ ulint offset,
+ lsn_t lsn,
+ const byte* src_frame,
+ ulint zip_size,
+ byte* dst_frame)
+ MY_ATTRIBUTE((warn_unused_result));
-/*********************************************************************
-Check if extra buffer shall be allocated for decrypting after read */
+/******************************************************************
+Encrypt a page
+
+@param[in] space Tablespace
+@param[in] offset Page offset
+@param[in] lsn Log sequence number
+@param[in] src_frame Page to encrypt
+@param[in,out] dst_frame Output buffer
+@return encrypted buffer or NULL */
UNIV_INTERN
-bool
-fil_space_check_encryption_read(
-/*============================*/
- ulint space); /*!< in: tablespace id */
+byte*
+fil_space_encrypt(
+ const fil_space_t* space,
+ ulint offset,
+ lsn_t lsn,
+ byte* src_frame,
+ byte* dst_frame)
+ MY_ATTRIBUTE((warn_unused_result));
/******************************************************************
Decrypt a page
-@return true if page is decrypted, false if not. */
+@param[in,out] crypt_data crypt_data
+@param[in] tmp_frame Temporary buffer
+@param[in] page_size Page size
+@param[in,out] src_frame Page to decrypt
+@param[out] err DB_SUCCESS or error
+@return true if page decrypted, false if not.*/
UNIV_INTERN
bool
fil_space_decrypt(
-/*==============*/
- fil_space_crypt_t* crypt_data, /*!< in: crypt data */
- byte* tmp_frame, /*!< in: temporary buffer */
- ulint page_size, /*!< in: page size */
- byte* src_frame, /*!< in:out: page buffer */
- dberr_t* err); /*!< in: out: DB_SUCCESS or
- error code */
-
-/*********************************************************************
-Encrypt buffer page
-@return encrypted page, or original not encrypted page if encrypt
-is not needed. */
-UNIV_INTERN
-byte*
-fil_space_encrypt(
-/*==============*/
- ulint space, /*!< in: tablespace id */
- ulint offset, /*!< in: page no */
- lsn_t lsn, /*!< in: page lsn */
- byte* src_frame, /*!< in: page frame */
- ulint size, /*!< in: size of data to encrypt */
- byte* dst_frame); /*!< in: where to encrypt to */
+ fil_space_crypt_t* crypt_data,
+ byte* tmp_frame,
+ ulint page_size,
+ byte* src_frame,
+ dberr_t* err);
-/*********************************************************************
-Decrypt buffer page
-@return decrypted page, or original not encrypted page if decrypt is
+/******************************************************************
+Decrypt a page
+@param[in] space Tablespace
+@param[in] tmp_frame Temporary buffer used for decrypting
+@param[in] page_size Page size
+@param[in,out] src_frame Page to decrypt
+@param[out] decrypted true if page was decrypted
+@return decrypted page, or original not encrypted page if decryption is
not needed.*/
UNIV_INTERN
byte*
fil_space_decrypt(
-/*==============*/
- ulint space, /*!< in: tablespace id */
- byte* src_frame, /*!< in: page frame */
- ulint page_size, /*!< in: size of data to encrypt */
- byte* dst_frame) /*!< in: where to decrypt to */
- __attribute__((warn_unused_result));
+ const fil_space_t* space,
+ byte* tmp_frame,
+ byte* src_frame,
+ bool* decrypted)
+ MY_ATTRIBUTE((warn_unused_result));
+
+/******************************************************************
+Calculate post encryption checksum
+@param[in] zip_size zip_size or 0
+@param[in] dst_frame Block where checksum is calculated
+@return page checksum or BUF_NO_CHECKSUM_MAGIC
+not needed. */
+UNIV_INTERN
+ulint
+fil_crypt_calculate_checksum(
+ ulint zip_size,
+ const byte* dst_frame)
+ MY_ATTRIBUTE((warn_unused_result));
/*********************************************************************
-fil_space_verify_crypt_checksum
-NOTE: currently this function can only be run in single threaded mode
-as it modifies srv_checksum_algorithm (temporarily)
+Verify that post encryption checksum match calculated checksum.
+This function should be called only if tablespace contains crypt_data
+metadata (this is strong indication that tablespace is encrypted).
+Function also verifies that traditional checksum does not match
+calculated checksum as if it does page could be valid unencrypted,
+encrypted, or corrupted.
+
+@param[in] page Page to verify
+@param[in] zip_size zip size
+@param[in] space Tablespace
+@param[in] pageno Page no
@return true if page is encrypted AND OK, false otherwise */
UNIV_INTERN
bool
fil_space_verify_crypt_checksum(
-/*============================*/
- const byte* src_frame,/*!< in: page frame */
- ulint zip_size); /*!< in: size of data to encrypt */
+ byte* page,
+ ulint zip_size,
+ const fil_space_t* space,
+ ulint pageno)
+ MY_ATTRIBUTE((warn_unused_result));
/*********************************************************************
-Init threads for key rotation */
+Adjust thread count for key rotation
+@param[in] enw_cnt Number of threads to be used */
UNIV_INTERN
void
-fil_crypt_threads_init();
+fil_crypt_set_thread_cnt(
+ uint new_cnt);
/*********************************************************************
-Set thread count (e.g start or stops threads) used for key rotation */
+Adjust max key age
+@param[in] val New max key age */
UNIV_INTERN
void
-fil_crypt_set_thread_cnt(
-/*=====================*/
- uint new_cnt); /*!< in: requested #threads */
+fil_crypt_set_rotate_key_age(
+ uint val);
/*********************************************************************
-Cleanup resources for threads for key rotation */
+Adjust rotation iops
+@param[in] val New max roation iops */
UNIV_INTERN
void
-fil_crypt_threads_cleanup();
+fil_crypt_set_rotation_iops(
+ uint val);
/*********************************************************************
-Set rotate key age */
+Adjust encrypt tables
+@param[in] val New setting for innodb-encrypt-tables */
UNIV_INTERN
void
-fil_crypt_set_rotate_key_age(
-/*=========================*/
- uint rotate_age); /*!< in: requested rotate age */
+fil_crypt_set_encrypt_tables(
+ uint val);
/*********************************************************************
-Set rotation threads iops */
+Init threads for key rotation */
UNIV_INTERN
void
-fil_crypt_set_rotation_iops(
-/*========================*/
- uint iops); /*!< in: requested iops */
+fil_crypt_threads_init();
/*********************************************************************
-Mark a space as closing */
+Clean up key rotation threads resources */
UNIV_INTERN
void
-fil_space_crypt_mark_space_closing(
-/*===============================*/
- ulint space, /*!< in: tablespace id */
- fil_space_crypt_t* crypt_data); /*!< in: crypt_data or NULL */
+fil_crypt_threads_cleanup();
/*********************************************************************
-Wait for crypt threads to stop accessing space */
+Wait for crypt threads to stop accessing space
+@param[in] space Tablespace */
UNIV_INTERN
void
fil_space_crypt_close_tablespace(
-/*=============================*/
- ulint space); /*!< in: tablespace id */
-
-/** Struct for retreiving info about encryption */
-struct fil_space_crypt_status_t {
- ulint space; /*!< tablespace id */
- ulint scheme; /*!< encryption scheme */
- uint min_key_version; /*!< min key version */
- uint current_key_version;/*!< current key version */
- uint keyserver_requests;/*!< no of key requests to key server */
- ulint key_id; /*!< current key_id */
- bool rotating; /*!< is key rotation ongoing */
- bool flushing; /*!< is flush at end of rotation ongoing */
- ulint rotate_next_page_number; /*!< next page if key rotating */
- ulint rotate_max_page_number; /*!< max page if key rotating */
-};
+ const fil_space_t* space);
/*********************************************************************
-Get crypt status for a space
-@return 0 if crypt data found */
+Get crypt status for a space (used by information_schema)
+@param[in] space Tablespace
+@param[out] status Crypt status
+return 0 if crypt data present */
UNIV_INTERN
-int
+void
fil_space_crypt_get_status(
-/*=======================*/
- ulint id, /*!< in: space id */
- struct fil_space_crypt_status_t * status); /*!< out: status */
-
-/** Struct for retreiving statistics about encryption key rotation */
-struct fil_crypt_stat_t {
- ulint pages_read_from_cache;
- ulint pages_read_from_disk;
- ulint pages_modified;
- ulint pages_flushed;
- ulint estimated_iops;
-};
+ const fil_space_t* space,
+ struct fil_space_crypt_status_t* status);
/*********************************************************************
-Get crypt rotation statistics */
+Return crypt statistics
+@param[out] stat Crypt statistics */
UNIV_INTERN
void
fil_crypt_total_stat(
-/*==================*/
- fil_crypt_stat_t* stat); /*!< out: crypt stat */
-
-/** Struct for retreiving info about scrubbing */
-struct fil_space_scrub_status_t {
- ulint space; /*!< tablespace id */
- bool compressed; /*!< is space compressed */
- time_t last_scrub_completed; /*!< when was last scrub completed */
- bool scrubbing; /*!< is scrubbing ongoing */
- time_t current_scrub_started; /*!< when started current scrubbing */
- ulint current_scrub_active_threads; /*!< current scrub active threads */
- ulint current_scrub_page_number; /*!< current scrub page no */
- ulint current_scrub_max_page_number; /*!< current scrub max page no */
-};
+ fil_crypt_stat_t *stat);
/*********************************************************************
-Get scrub status for a space
-@return 0 if no scrub info found */
-UNIV_INTERN
-int
-fil_space_get_scrub_status(
-/*=======================*/
- ulint id, /*!< in: space id */
- struct fil_space_scrub_status_t * status); /*!< out: status */
+Get scrub status for a space (used by information_schema)
-/*********************************************************************
-Adjust encrypt tables */
+@param[in] space Tablespace
+@param[out] status Scrub status
+return 0 if data found */
UNIV_INTERN
void
-fil_crypt_set_encrypt_tables(
-/*=========================*/
- uint val); /*!< in: New srv_encrypt_tables setting */
-
-/******************************************************************
-Encrypt a buffer */
-UNIV_INTERN
-byte*
-fil_encrypt_buf(
-/*============*/
- fil_space_crypt_t* crypt_data, /*!< in: crypt data */
- ulint space, /*!< in: Space id */
- ulint offset, /*!< in: Page offset */
- lsn_t lsn, /*!< in: lsn */
- byte* src_frame, /*!< in: Source page to be encrypted */
- ulint zip_size, /*!< in: compressed size if
- row_format compressed */
- byte* dst_frame); /*!< in: outbut buffer */
-
-/******************************************************************
-Calculate post encryption checksum
-@return page checksum or BUF_NO_CHECKSUM_MAGIC
-not needed. */
-UNIV_INTERN
-ulint
-fil_crypt_calculate_checksum(
-/*=========================*/
- ulint zip_size, /*!< in: zip_size or 0 */
- byte* dst_frame); /*!< in: page where to calculate */
+fil_space_get_scrub_status(
+ const fil_space_t* space,
+ struct fil_space_scrub_status_t* status);
#ifndef UNIV_NONINL
#include "fil0crypt.ic"
diff --git a/storage/xtradb/include/fil0crypt.ic b/storage/xtradb/include/fil0crypt.ic
index 0a1a60dfab8..cb9ba083466 100644
--- a/storage/xtradb/include/fil0crypt.ic
+++ b/storage/xtradb/include/fil0crypt.ic
@@ -34,35 +34,3 @@ fil_page_is_encrypted(
{
return(mach_read_from_4(buf+FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION) != 0);
}
-
-/*******************************************************************//**
-Find out whether the page can be decrypted.
-The function for decrypting the page should already be executed before this.
-@return 1 if key provider not available or key is not available
- 0 if decryption should be possible
-*/
-UNIV_INLINE
-bool
-fil_page_encryption_status(
-/*===================*/
- const byte *buf, /*!< in: page */
- ulint space_id) /*!< in: space_id */
-{
- fil_space_crypt_t *crypt_data = fil_space_get_crypt_data(space_id);
- ulint page_type = mach_read_from_2(buf+FIL_PAGE_TYPE);
-
- if (page_type == FIL_PAGE_TYPE_FSP_HDR) {
- if (crypt_data != NULL) {
- if (!encryption_key_id_exists(crypt_data->key_id)) {
- /* accessing table would surely fail, because no key or no key provider available */
- return 1;
- }
- }
- } else {
- ulint key = mach_read_from_4(buf + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION);
- if (!encryption_key_version_exists(crypt_data->key_id, key)) {
- return 1;
- }
- }
- return 0;
-}
diff --git a/storage/xtradb/include/fil0fil.h b/storage/xtradb/include/fil0fil.h
index 41e38794ea9..b80df057351 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, 2017, MariaDB Corporation.
+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
@@ -181,8 +181,18 @@ extern fil_addr_t fil_addr_null;
#define FIL_LOG 502 /*!< redo log */
/* @} */
-/* structure containing encryption specification */
-typedef struct fil_space_crypt_struct fil_space_crypt_t;
+/** Structure containing encryption specification */
+struct fil_space_crypt_t;
+
+/** Enum values for encryption table option */
+enum fil_encryption_t {
+ /** Encrypted if innodb_encrypt_tables=ON (srv_encrypt_tables) */
+ FIL_ENCRYPTION_DEFAULT,
+ /** Encrypted */
+ FIL_ENCRYPTION_ON,
+ /** Not encrypted */
+ FIL_ENCRYPTION_OFF
+};
/** The number of fsyncs done to the log */
extern ulint fil_n_log_flushes;
@@ -219,7 +229,9 @@ struct fil_node_t {
ibool open; /*!< TRUE if file open */
os_file_t handle; /*!< OS handle to the file, if file open */
os_event_t sync_event;/*!< Condition event to group and
- serialize calls to fsync */
+ serialize calls to fsync;
+ os_event_set() and os_event_reset()
+ are protected by fil_system_t::mutex */
ibool is_raw_disk;/*!< TRUE if the 'file' is actually a raw
device or a raw disk partition */
ulint size; /*!< size of the file in database pages, 0 if
@@ -267,8 +279,8 @@ struct fil_space_t {
.ibd file of tablespace and want to
stop temporarily posting of new i/o
requests on the file */
- ibool stop_new_ops;
- /*!< we set this TRUE when we start
+ bool stop_new_ops;
+ /*!< we set this true when we start
deleting a single-table tablespace.
When this is set following new ops
are not allowed:
@@ -314,13 +326,16 @@ struct fil_space_t {
prio_rw_lock_t latch; /*!< latch protecting the file space storage
allocation */
#endif /* !UNIV_HOTBACKUP */
+
UT_LIST_NODE_T(fil_space_t) unflushed_spaces;
/*!< list of spaces with at least one unflushed
file we have written to */
bool is_in_unflushed_spaces;
/*!< true if this space is currently in
unflushed_spaces */
- ibool is_corrupt;
+ /** True if srv_pass_corrupt_table=true and tablespace contains
+ corrupted page. */
+ bool is_corrupt;
/*!< true if tablespace corrupted */
bool printed_compression_failure;
/*!< true if we have already printed
@@ -336,7 +351,22 @@ struct fil_space_t {
UT_LIST_NODE_T(fil_space_t) space_list;
/*!< list of all spaces */
+ /*!< Protected by fil_system */
+ UT_LIST_NODE_T(fil_space_t) rotation_list;
+ /*!< list of spaces needing
+ key rotation */
+
+ bool is_in_rotation_list;
+ /*!< true if this space is
+ currently in key rotation list */
+
ulint magic_n;/*!< FIL_SPACE_MAGIC_N */
+
+ /** @return whether the tablespace is about to be dropped or truncated */
+ bool is_stopping() const
+ {
+ return stop_new_ops;
+ }
};
/** Value of fil_space_t::magic_n */
@@ -392,6 +422,11 @@ struct fil_system_t {
request */
UT_LIST_BASE_NODE_T(fil_space_t) space_list;
/*!< list of all file spaces */
+
+ UT_LIST_BASE_NODE_T(fil_space_t) rotation_list;
+ /*!< list of all file spaces needing
+ key rotation.*/
+
ibool space_id_reuse_warned;
/* !< TRUE if fil_space_create()
has issued a warning about
@@ -470,18 +505,24 @@ fil_space_contains_node(
/*******************************************************************//**
Creates a space memory object and puts it to the 'fil system' hash table.
If there is an error, prints an error message to the .err log.
+@param[in] name Space name
+@param[in] id Space id
+@param[in] flags Tablespace flags
+@param[in] purpose FIL_TABLESPACE or FIL_LOG if log
+@param[in] crypt_data Encryption information
+@param[in] create_table True if this is create table
+@param[in] mode Encryption mode
@return TRUE if success */
UNIV_INTERN
-ibool
+bool
fil_space_create(
-/*=============*/
- const char* name, /*!< in: space name */
- ulint id, /*!< in: space id */
- ulint zip_size,/*!< in: compressed page size, or
- 0 for uncompressed tablespaces */
- ulint purpose, /*!< in: FIL_TABLESPACE, or FIL_LOG if log */
- fil_space_crypt_t* crypt_data, /*!< in: crypt data */
- bool create_table); /*!< in: true if create table */
+ const char* name,
+ ulint id,
+ ulint flags,
+ ulint purpose,
+ fil_space_crypt_t* crypt_data,
+ bool create_table,
+ fil_encryption_t mode = FIL_ENCRYPTION_DEFAULT);
/*******************************************************************//**
Assigns a new space id for a new single-table tablespace. This works simply by
@@ -604,6 +645,59 @@ fil_write_flushed_lsn_to_data_files(
/*================================*/
lsn_t lsn, /*!< in: lsn to write */
ulint arch_log_no); /*!< in: latest archived log file number */
+
+/** Acquire a tablespace when it could be dropped concurrently.
+Used by background threads that do not necessarily hold proper locks
+for concurrency control.
+@param[in] id tablespace ID
+@return the tablespace, or NULL if missing or being deleted */
+fil_space_t*
+fil_space_acquire(
+ ulint id)
+ MY_ATTRIBUTE((warn_unused_result));
+
+/** Acquire a tablespace that may not exist.
+Used by background threads that do not necessarily hold proper locks
+for concurrency control.
+@param[in] id tablespace ID
+@return the tablespace, or NULL if missing or being deleted */
+fil_space_t*
+fil_space_acquire_silent(
+ ulint id)
+ MY_ATTRIBUTE((warn_unused_result));
+
+/** Release a tablespace acquired with fil_space_acquire().
+@param[in,out] space tablespace to release */
+void
+fil_space_release(
+ fil_space_t* space);
+
+/** Return the next fil_space_t.
+Once started, the caller must keep calling this until it returns NULL.
+fil_space_acquire() and fil_space_release() are invoked here which
+blocks a concurrent operation from dropping the tablespace.
+@param[in,out] prev_space Pointer to the previous fil_space_t.
+If NULL, use the first fil_space_t on fil_system->space_list.
+@return pointer to the next fil_space_t.
+@retval NULL if this was the last */
+fil_space_t*
+fil_space_next(
+ fil_space_t* prev_space)
+ MY_ATTRIBUTE((warn_unused_result));
+
+/** Return the next fil_space_t from key rotation list.
+Once started, the caller must keep calling this until it returns NULL.
+fil_space_acquire() and fil_space_release() are invoked here which
+blocks a concurrent operation from dropping the tablespace.
+@param[in,out] prev_space Pointer to the previous fil_space_t.
+If NULL, use the first fil_space_t on fil_system->space_list.
+@return pointer to the next fil_space_t.
+@retval NULL if this was the last*/
+fil_space_t*
+fil_space_keyrotate_next(
+ fil_space_t* prev_space)
+ MY_ATTRIBUTE((warn_unused_result));
+
/*******************************************************************//**
Reads the flushed lsn, arch no, and tablespace flag fields from a data
file at database startup.
@@ -1312,16 +1406,10 @@ fil_space_set_corrupt(
/*==================*/
ulint space_id);
-/****************************************************************//**
-Acquire fil_system mutex */
-void
-fil_system_enter(void);
-/*==================*/
-/****************************************************************//**
-Release fil_system mutex */
-void
-fil_system_exit(void);
-/*==================*/
+/** Acquire the fil_system mutex. */
+#define fil_system_enter() mutex_enter(&fil_system->mutex)
+/** Release the fil_system mutex. */
+#define fil_system_exit() mutex_exit(&fil_system->mutex)
#ifndef UNIV_INNOCHECKSUM
/*******************************************************************//**
diff --git a/storage/xtradb/include/fil0fil.ic b/storage/xtradb/include/fil0fil.ic
index 23614a6567a..1179eea8b8e 100644
--- a/storage/xtradb/include/fil0fil.ic
+++ b/storage/xtradb/include/fil0fil.ic
@@ -58,38 +58,41 @@ fil_get_page_type_name(
{
switch(page_type) {
case FIL_PAGE_PAGE_COMPRESSED:
- return (const char*)"PAGE_COMPRESSED";
+ return "PAGE_COMPRESSED";
+ case FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED:
+ return "PAGE_COMPRESSED_ENCRYPTED";
case FIL_PAGE_INDEX:
- return (const char*)"INDEX";
+ return "INDEX";
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";
+ return "ZBLOB2";
case FIL_PAGE_TYPE_COMPRESSED:
- return (const char*)"ORACLE PAGE COMPRESSED";
- default:
- return (const char*)"PAGE TYPE CORRUPTED";
+ return "ORACLE PAGE COMPRESSED";
}
+
+ return "PAGE TYPE CORRUPTED";
+
}
/****************************************************************//**
diff --git a/storage/xtradb/include/fsp0fsp.h b/storage/xtradb/include/fsp0fsp.h
index 93f98eb0b0b..6ed78eba6f9 100644
--- a/storage/xtradb/include/fsp0fsp.h
+++ b/storage/xtradb/include/fsp0fsp.h
@@ -1037,14 +1037,15 @@ fsp_flags_get_page_size(
/*====================*/
ulint flags); /*!< in: tablespace flags */
-/*********************************************************************/
-/* @return offset into fsp header where crypt data is stored */
+/*********************************************************************
+Compute offset after xdes where crypt data can be stored
+@param[in] zip_size Compressed size or 0
+@return offset */
UNIV_INTERN
ulint
fsp_header_get_crypt_offset(
-/*========================*/
- ulint zip_size, /*!< in: zip_size */
- ulint* max_size); /*!< out: free space after offset */
+ const ulint zip_size)
+ MY_ATTRIBUTE((warn_unused_result));
#define fsp_page_is_free(space,page,mtr) \
fsp_page_is_free_func(space,page,mtr, __FILE__, __LINE__)
diff --git a/storage/xtradb/include/fsp0types.h b/storage/xtradb/include/fsp0types.h
index 509909d1cf5..7152d65054f 100644
--- a/storage/xtradb/include/fsp0types.h
+++ b/storage/xtradb/include/fsp0types.h
@@ -1,6 +1,7 @@
/*****************************************************************************
Copyright (c) 1995, 2009, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 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
diff --git a/storage/xtradb/include/fts0types.h b/storage/xtradb/include/fts0types.h
index e495fe72a60..0dad75d8f1b 100644
--- a/storage/xtradb/include/fts0types.h
+++ b/storage/xtradb/include/fts0types.h
@@ -126,7 +126,9 @@ struct fts_sync_t {
bool in_progress; /*!< flag whether sync is in progress.*/
bool unlock_cache; /*!< flag whether unlock cache when
write fts node */
- os_event_t event; /*!< sync finish event */
+ os_event_t event; /*!< sync finish event;
+ only os_event_set() and os_event_wait()
+ are used */
};
/** The cache for the FTS system. It is a memory-based inverted index
diff --git a/storage/xtradb/include/ha_prototypes.h b/storage/xtradb/include/ha_prototypes.h
index a35f975b13c..a161ec8c06c 100644
--- a/storage/xtradb/include/ha_prototypes.h
+++ b/storage/xtradb/include/ha_prototypes.h
@@ -158,6 +158,13 @@ thd_has_edited_nontrans_tables(
/*===========================*/
THD* thd); /*!< in: thread handle */
+/**
+Get high resolution timestamp for the current query start time.
+
+@retval timestamp in microseconds precision
+*/
+unsigned long long thd_query_start_micro(const MYSQL_THD thd);
+
/*************************************************************//**
Prints info of a THD object (== user session thread) to the given file. */
UNIV_INTERN
diff --git a/storage/xtradb/include/lock0lock.h b/storage/xtradb/include/lock0lock.h
index a12ca1d85e6..923c463aa22 100644
--- a/storage/xtradb/include/lock0lock.h
+++ b/storage/xtradb/include/lock0lock.h
@@ -962,7 +962,12 @@ struct lock_sys_t{
srv_slot_t* waiting_threads; /*!< Array of user threads
suspended while waiting for
locks within InnoDB, protected
- by the lock_sys->wait_mutex */
+ by the lock_sys->wait_mutex;
+ os_event_set() and
+ os_event_reset() on
+ waiting_threads[]->event
+ are protected by
+ trx_t::mutex */
srv_slot_t* last_slot; /*!< highest slot ever used
in the waiting_threads array,
protected by
@@ -975,10 +980,11 @@ struct lock_sys_t{
ulint n_lock_max_wait_time; /*!< Max wait time */
- os_event_t timeout_event; /*!< Set to the event that is
- created in the lock wait monitor
- thread. A value of 0 means the
- thread is not active */
+ os_event_t timeout_event; /*!< An event waited for by
+ lock_wait_timeout_thread.
+ Not protected by a mutex,
+ but the waits are timed.
+ Signaled on shutdown only. */
bool timeout_thread_active; /*!< True if the timeout thread
is running */
diff --git a/storage/xtradb/include/log0log.h b/storage/xtradb/include/log0log.h
index 8bcee8b1919..a55c1ea818c 100644
--- a/storage/xtradb/include/log0log.h
+++ b/storage/xtradb/include/log0log.h
@@ -2,7 +2,7 @@
Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2009, Google Inc.
-Copyright (c) 2017, MariaDB Corporation
+Copyright (c) 2017, MariaDB Corporation. All Rights Reserved.
Portions of this file contain modifications contributed and copyrighted by
Google, Inc. Those modifications are gratefully acknowledged and are described
@@ -934,10 +934,8 @@ struct log_t{
be 'flush_or_write'! */
os_event_t no_flush_event; /*!< this event is in the reset state
when a flush or a write is running;
- a thread should wait for this without
- owning the log mutex, but NOTE that
- to set or reset this event, the
- thread MUST own the log mutex! */
+ os_event_set() and os_event_reset()
+ are protected by log_sys_t::mutex */
ibool one_flushed; /*!< during a flush, this is
first FALSE and becomes TRUE
when one log group has been
@@ -946,11 +944,9 @@ struct log_t{
flush or write has not yet completed
for any log group; e.g., this means
that a transaction has been committed
- when this is set; a thread should wait
- for this without owning the log mutex,
- but NOTE that to set or reset this
- event, the thread MUST own the log
- mutex! */
+ when this is set;
+ os_event_set() and os_event_reset()
+ are protected by log_sys_t::mutex */
ulint n_log_ios; /*!< number of log i/os initiated thus
far */
ulint n_log_ios_old; /*!< number of log i/o's at the
@@ -1036,9 +1032,9 @@ struct log_t{
byte* archive_buf_ptr;/*!< unaligned archived_buf */
byte* archive_buf; /*!< log segment is written to the
archive from this buffer */
- os_event_t archiving_on; /*!< if archiving has been stopped,
- a thread can wait for this event to
- become signaled */
+ os_event_t archiving_on; /*!< if archiving has been stopped;
+ os_event_set() and os_event_reset()
+ are protected by log_sys_t::mutex */
/* @} */
#endif /* UNIV_LOG_ARCHIVE */
lsn_t tracked_lsn; /*!< log tracking has advanced to this
diff --git a/storage/xtradb/include/log0online.h b/storage/xtradb/include/log0online.h
index 5706f3af4b0..722336dd6b4 100644
--- a/storage/xtradb/include/log0online.h
+++ b/storage/xtradb/include/log0online.h
@@ -38,19 +38,25 @@ log_online_bitmap_file_range_t;
/** An iterator over changed page info */
typedef struct log_bitmap_iterator_struct log_bitmap_iterator_t;
-/*********************************************************************//**
-Initializes the online log following subsytem. */
+/** Initialize the constant part of the log tracking subsystem */
+UNIV_INTERN
+void
+log_online_init(void);
+
+/** Initialize the dynamic part of the log tracking subsystem */
UNIV_INTERN
void
log_online_read_init(void);
-/*=======================*/
-/*********************************************************************//**
-Shuts down the online log following subsystem. */
+/** Shut down the dynamic part of the log tracking subsystem */
UNIV_INTERN
void
log_online_read_shutdown(void);
-/*===========================*/
+
+/** Shut down the constant part of the log tracking subsystem */
+UNIV_INTERN
+void
+log_online_shutdown(void);
/*********************************************************************//**
Reads and parses the redo log up to last checkpoint LSN to build the changed
@@ -147,6 +153,8 @@ struct log_online_bitmap_file_range_struct {
/** Struct for an iterator through all bits of changed pages bitmap blocks */
struct log_bitmap_iterator_struct
{
+ lsn_t max_lsn; /*!< End LSN of the
+ range */
ibool failed; /*!< Has the iteration
stopped prematurely */
log_online_bitmap_file_range_t in_files; /*!< The bitmap files
diff --git a/storage/xtradb/include/log0recv.h b/storage/xtradb/include/log0recv.h
index e93ec2666af..e7b6a937f01 100644
--- a/storage/xtradb/include/log0recv.h
+++ b/storage/xtradb/include/log0recv.h
@@ -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
@@ -300,20 +301,12 @@ void
recv_sys_var_init(void);
/*===================*/
#endif /* !UNIV_HOTBACKUP */
-/*******************************************************************//**
-Empties the hash table of stored log records, applying them to appropriate
-pages. */
+/** Apply the hash table of stored log records to persistent data pages.
+@param[in] last_batch whether the change buffer merge will be
+ performed as part of the operation */
UNIV_INTERN
-dberr_t
-recv_apply_hashed_log_recs(
-/*=======================*/
- ibool allow_ibuf); /*!< in: if TRUE, also ibuf operations are
- allowed during the application; if FALSE,
- no ibuf operations are allowed, and after
- the application all file pages are flushed to
- disk and invalidated in buffer pool: this
- alternative means that no new log records
- can be generated during the application */
+void
+recv_apply_hashed_log_recs(bool last_batch);
#ifdef UNIV_HOTBACKUP
/*******************************************************************//**
Applies log records in the hash table to a backup. */
@@ -439,6 +432,8 @@ struct recv_sys_t{
scan find a corrupt log block, or a corrupt
log record, or there is a log parsing
buffer overflow */
+ /** the time when progress was last reported */
+ ib_time_t progress_time;
#ifdef UNIV_LOG_ARCHIVE
log_group_t* archive_group;
/*!< in archive recovery: the log group whose
@@ -451,6 +446,20 @@ struct recv_sys_t{
addresses in the hash table */
recv_dblwr_t dblwr;
+
+ /** Determine whether redo log recovery progress should be reported.
+ @param[in] time the current time
+ @return whether progress should be reported
+ (the last report was at least 15 seconds ago) */
+ bool report(ib_time_t time)
+ {
+ if (time - progress_time < 15) {
+ return false;
+ }
+
+ progress_time = time;
+ return true;
+ }
};
/** The recovery system */
diff --git a/storage/xtradb/include/mach0data.h b/storage/xtradb/include/mach0data.h
index 9859def0adc..2e16634a6c2 100644
--- a/storage/xtradb/include/mach0data.h
+++ b/storage/xtradb/include/mach0data.h
@@ -53,7 +53,7 @@ ulint
mach_read_from_1(
/*=============*/
const byte* b) /*!< in: pointer to byte */
- MY_ATTRIBUTE((nonnull, pure));
+ MY_ATTRIBUTE((warn_unused_result));
/*******************************************************//**
The following function is used to store data in two consecutive
bytes. We store the most significant byte to the lower address. */
@@ -114,7 +114,7 @@ ulint
mach_read_from_3(
/*=============*/
const byte* b) /*!< in: pointer to 3 bytes */
- MY_ATTRIBUTE((nonnull, pure));
+ MY_ATTRIBUTE((warn_unused_result));
/*******************************************************//**
The following function is used to store data in four consecutive
bytes. We store the most significant byte to the lowest address. */
@@ -133,7 +133,7 @@ ulint
mach_read_from_4(
/*=============*/
const byte* b) /*!< in: pointer to four bytes */
- MY_ATTRIBUTE((nonnull, pure));
+ MY_ATTRIBUTE((warn_unused_result));
/*********************************************************//**
Writes a ulint in a compressed form (1..5 bytes).
@return stored size in bytes */
@@ -160,7 +160,7 @@ ulint
mach_read_compressed(
/*=================*/
const byte* b) /*!< in: pointer to memory from where to read */
- MY_ATTRIBUTE((nonnull, pure));
+ MY_ATTRIBUTE((warn_unused_result));
/*******************************************************//**
The following function is used to store data in 6 consecutive
bytes. We store the most significant byte to the lowest address. */
@@ -179,7 +179,7 @@ ib_uint64_t
mach_read_from_6(
/*=============*/
const byte* b) /*!< in: pointer to 6 bytes */
- MY_ATTRIBUTE((nonnull, pure));
+ MY_ATTRIBUTE((warn_unused_result));
/*******************************************************//**
The following function is used to store data in 7 consecutive
bytes. We store the most significant byte to the lowest address. */
@@ -198,7 +198,7 @@ ib_uint64_t
mach_read_from_7(
/*=============*/
const byte* b) /*!< in: pointer to 7 bytes */
- MY_ATTRIBUTE((nonnull, pure));
+ MY_ATTRIBUTE((warn_unused_result));
/*******************************************************//**
The following function is used to store data in 8 consecutive
bytes. We store the most significant byte to the lowest address. */
@@ -243,7 +243,7 @@ ib_uint64_t
mach_ull_read_compressed(
/*=====================*/
const byte* b) /*!< in: pointer to memory from where to read */
- MY_ATTRIBUTE((nonnull, pure));
+ MY_ATTRIBUTE((warn_unused_result));
/*********************************************************//**
Writes a 64-bit integer in a compressed form (1..11 bytes).
@return size in bytes */
@@ -270,7 +270,7 @@ ib_uint64_t
mach_ull_read_much_compressed(
/*==========================*/
const byte* b) /*!< in: pointer to memory from where to read */
- MY_ATTRIBUTE((nonnull, pure));
+ MY_ATTRIBUTE((warn_unused_result));
/*********************************************************//**
Reads a ulint in a compressed form if the log record fully contains it.
@return pointer to end of the stored field, NULL if not complete */
diff --git a/storage/xtradb/include/mach0data.ic b/storage/xtradb/include/mach0data.ic
index bf2c735b0da..3904d96c09f 100644
--- a/storage/xtradb/include/mach0data.ic
+++ b/storage/xtradb/include/mach0data.ic
@@ -52,7 +52,6 @@ mach_read_from_1(
/*=============*/
const byte* b) /*!< in: pointer to byte */
{
- ut_ad(b);
return((ulint)(b[0]));
}
@@ -132,7 +131,6 @@ mach_read_from_3(
/*=============*/
const byte* b) /*!< in: pointer to 3 bytes */
{
- ut_ad(b);
return( ((ulint)(b[0]) << 16)
| ((ulint)(b[1]) << 8)
| (ulint)(b[2])
@@ -182,7 +180,6 @@ mach_read_from_4(
/*=============*/
const byte* b) /*!< in: pointer to four bytes */
{
- ut_ad(b);
return( ((ulint)(b[0]) << 24)
| ((ulint)(b[1]) << 16)
| ((ulint)(b[2]) << 8)
@@ -261,8 +258,6 @@ mach_read_compressed(
{
ulint flag;
- ut_ad(b);
-
flag = mach_read_from_1(b);
if (flag < 0x80UL) {
@@ -339,8 +334,6 @@ mach_read_from_7(
/*=============*/
const byte* b) /*!< in: pointer to 7 bytes */
{
- ut_ad(b);
-
return(ut_ull_create(mach_read_from_3(b), mach_read_from_4(b + 3)));
}
@@ -370,8 +363,6 @@ mach_read_from_6(
/*=============*/
const byte* b) /*!< in: pointer to 6 bytes */
{
- ut_ad(b);
-
return(ut_ull_create(mach_read_from_2(b), mach_read_from_4(b + 2)));
}
@@ -419,8 +410,6 @@ mach_ull_read_compressed(
ib_uint64_t n;
ulint size;
- ut_ad(b);
-
n = (ib_uint64_t) mach_read_compressed(b);
size = mach_get_compressed_size((ulint) n);
@@ -486,8 +475,6 @@ mach_ull_read_much_compressed(
ib_uint64_t n;
ulint size;
- ut_ad(b);
-
if (*b != (byte)0xFF) {
n = 0;
size = 0;
diff --git a/storage/xtradb/include/mtr0mtr.h b/storage/xtradb/include/mtr0mtr.h
index 23992598f2e..ef6cd61719d 100644
--- a/storage/xtradb/include/mtr0mtr.h
+++ b/storage/xtradb/include/mtr0mtr.h
@@ -235,8 +235,7 @@ UNIV_INTERN
void
mtr_commit(
/*=======*/
- mtr_t* mtr) /*!< in/out: mini-transaction */
- MY_ATTRIBUTE((nonnull));
+ mtr_t* mtr); /*!< in/out: mini-transaction */
/**********************************************************//**
Sets and returns a savepoint in mtr.
@return savepoint */
@@ -354,7 +353,7 @@ mtr_memo_contains(
mtr_t* mtr, /*!< in: mtr */
const void* object, /*!< in: object to search */
ulint type) /*!< in: type of object */
- MY_ATTRIBUTE((warn_unused_result, nonnull));
+ MY_ATTRIBUTE((warn_unused_result));
/**********************************************************//**
Checks if memo contains the given page.
diff --git a/storage/xtradb/include/os0file.h b/storage/xtradb/include/os0file.h
index 2a385c9bf58..d6f0ecfb69c 100644
--- a/storage/xtradb/include/os0file.h
+++ b/storage/xtradb/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, 2015, MariaDB Corporation.
+Copyright (c) 2013, 2017, MariaDB Corporation. All Rights Reserved.
Portions of this file contain modifications contributed and copyrighted
by Percona Inc.. Those modifications are
@@ -557,9 +557,10 @@ os_file_create_simple_no_error_handling_func(
value */
__attribute__((nonnull, warn_unused_result));
/****************************************************************//**
-Tries to disable OS caching on an opened file descriptor. */
+Tries to disable OS caching on an opened file descriptor.
+@return true if operation is success and false otherwise */
UNIV_INTERN
-void
+bool
os_file_set_nocache(
/*================*/
os_file_t fd, /*!< in: file descriptor to alter */
@@ -904,17 +905,19 @@ os_file_get_size(
/*=============*/
os_file_t file) /*!< in: handle to a file */
MY_ATTRIBUTE((warn_unused_result));
-/***********************************************************************//**
-Write the specified number of zeros to a newly created file.
-@return TRUE if success */
+/** Set the size of a newly created file.
+@param[in] name file name
+@param[in] file file handle
+@param[in] size desired file size
+@param[in] sparse whether to create a sparse file (no preallocating)
+@return whether the operation succeeded */
UNIV_INTERN
-ibool
+bool
os_file_set_size(
-/*=============*/
- const char* name, /*!< in: name of the file or path as a
- null-terminated string */
- os_file_t file, /*!< in: handle to a file */
- os_offset_t size) /*!< in: file size */
+ const char* name,
+ os_file_t file,
+ os_offset_t size,
+ bool is_sparse = false)
MY_ATTRIBUTE((nonnull, warn_unused_result));
/***********************************************************************//**
Truncates a file at its current position.
@@ -1203,6 +1206,7 @@ UNIV_INTERN
void
os_aio_simulated_wake_handler_threads(void);
/*=======================================*/
+#ifdef _WIN32
/**********************************************************************//**
This function can be called if one wants to post a batch of reads and
prefers an i/o-handler thread to handle them all at once later. You must
@@ -1210,8 +1214,10 @@ call os_aio_simulated_wake_handler_threads later to ensure the threads
are not left sleeping! */
UNIV_INTERN
void
-os_aio_simulated_put_read_threads_to_sleep(void);
-/*============================================*/
+os_aio_simulated_put_read_threads_to_sleep();
+#else /* _WIN32 */
+# define os_aio_simulated_put_read_threads_to_sleep()
+#endif /* _WIN32 */
#ifdef WIN_ASYNC_IO
/**********************************************************************//**
diff --git a/storage/xtradb/include/os0thread.h b/storage/xtradb/include/os0thread.h
index 671b9b7dc3f..7865358b0f7 100644
--- a/storage/xtradb/include/os0thread.h
+++ b/storage/xtradb/include/os0thread.h
@@ -131,11 +131,9 @@ os_thread_create_func(
os_thread_id_t* thread_id); /*!< out: id of the created
thread, or NULL */
-/**
-Waits until the specified thread completes and joins it. Its return value is
-ignored.
-
-@param thread thread to join */
+/** Waits until the specified thread completes and joins it.
+Its return value is ignored.
+@param[in,out] thread thread to join */
UNIV_INTERN
void
os_thread_join(
diff --git a/storage/xtradb/include/page0page.h b/storage/xtradb/include/page0page.h
index cb43c937757..eefa0fa4c5b 100644
--- a/storage/xtradb/include/page0page.h
+++ b/storage/xtradb/include/page0page.h
@@ -235,8 +235,7 @@ ulint
page_header_get_offs(
/*=================*/
const page_t* page, /*!< in: page */
- ulint field) /*!< in: PAGE_FREE, ... */
- MY_ATTRIBUTE((nonnull, pure));
+ ulint field); /*!< in: PAGE_FREE, ... */
/*************************************************************//**
Returns the pointer stored in the given header field, or NULL. */
@@ -528,7 +527,7 @@ bool
page_is_leaf(
/*=========*/
const page_t* page) /*!< in: page */
- MY_ATTRIBUTE((nonnull, pure));
+ MY_ATTRIBUTE((warn_unused_result));
/************************************************************//**
Determine whether the page is empty.
@return true if the page is empty (PAGE_N_RECS = 0) */
@@ -849,8 +848,7 @@ page_copy_rec_list_end(
buf_block_t* block, /*!< in: index page containing rec */
rec_t* rec, /*!< in: record on page */
dict_index_t* index, /*!< in: record descriptor */
- mtr_t* mtr) /*!< in: mtr */
- MY_ATTRIBUTE((nonnull));
+ mtr_t* mtr); /*!< in: mtr */
/*************************************************************//**
Copies records from page to new_page, up to the given record, NOT
including that record. Infimum and supremum records are not copied.
@@ -871,8 +869,7 @@ page_copy_rec_list_start(
buf_block_t* block, /*!< in: index page containing rec */
rec_t* rec, /*!< in: record on page */
dict_index_t* index, /*!< in: record descriptor */
- mtr_t* mtr) /*!< in: mtr */
- MY_ATTRIBUTE((nonnull));
+ mtr_t* mtr); /*!< in: mtr */
/*************************************************************//**
Deletes records from a page from a given record onward, including that record.
The infimum and supremum records are not deleted. */
@@ -921,8 +918,7 @@ page_move_rec_list_end(
buf_block_t* block, /*!< in: index page from where to move */
rec_t* split_rec, /*!< in: first record to move */
dict_index_t* index, /*!< in: record descriptor */
- mtr_t* mtr) /*!< in: mtr */
- MY_ATTRIBUTE((nonnull(1, 2, 4, 5)));
+ mtr_t* mtr); /*!< in: mtr */
/*************************************************************//**
Moves record list start to another page. Moved records do not include
split_rec.
@@ -952,8 +948,7 @@ page_dir_split_slot(
page_t* page, /*!< in: index page */
page_zip_des_t* page_zip,/*!< in/out: compressed page whose
uncompressed part will be written, or NULL */
- ulint slot_no)/*!< in: the directory slot */
- MY_ATTRIBUTE((nonnull(1)));
+ ulint slot_no);/*!< in: the directory slot */
/*************************************************************//**
Tries to balance the given directory slot with too few records
with the upper neighbor, so that there are at least the minimum number
@@ -965,8 +960,7 @@ page_dir_balance_slot(
/*==================*/
page_t* page, /*!< in/out: index page */
page_zip_des_t* page_zip,/*!< in/out: compressed page, or NULL */
- ulint slot_no)/*!< in: the directory slot */
- MY_ATTRIBUTE((nonnull(1)));
+ ulint slot_no);/*!< in: the directory slot */
/**********************************************************//**
Parses a log record of a record list end or start deletion.
@return end of log record or NULL */
diff --git a/storage/xtradb/include/page0page.ic b/storage/xtradb/include/page0page.ic
index 5cf92fd5d8d..364536b86f8 100644
--- a/storage/xtradb/include/page0page.ic
+++ b/storage/xtradb/include/page0page.ic
@@ -156,7 +156,6 @@ page_header_get_offs(
{
ulint offs;
- ut_ad(page);
ut_ad((field == PAGE_FREE)
|| (field == PAGE_LAST_INSERT)
|| (field == PAGE_HEAP_TOP));
diff --git a/storage/xtradb/include/page0zip.h b/storage/xtradb/include/page0zip.h
index 81068e7bd29..adafaa6d8b6 100644
--- a/storage/xtradb/include/page0zip.h
+++ b/storage/xtradb/include/page0zip.h
@@ -132,7 +132,7 @@ page_zip_compress(
dict_index_t* index, /*!< in: index of the B-tree node */
ulint level, /*!< in: compression level */
mtr_t* mtr) /*!< in: mini-transaction, or NULL */
- MY_ATTRIBUTE((nonnull(1,2,3)));
+ MY_ATTRIBUTE((warn_unused_result));
/**********************************************************************//**
Decompress a page. This function should tolerate errors on the compressed
@@ -424,8 +424,7 @@ page_zip_reorganize(
out: data, n_blobs,
m_start, m_end, m_nonempty */
dict_index_t* index, /*!< in: index of the B-tree node */
- mtr_t* mtr) /*!< in: mini-transaction */
- MY_ATTRIBUTE((nonnull));
+ mtr_t* mtr); /*!< in: mini-transaction */
#ifndef UNIV_HOTBACKUP
/**********************************************************************//**
Copy the records of a page byte for byte. Do not copy the page header
@@ -458,7 +457,7 @@ page_zip_parse_compress(
byte* end_ptr,/*!< in: buffer end */
page_t* page, /*!< out: uncompressed page */
page_zip_des_t* page_zip)/*!< out: compressed page */
- MY_ATTRIBUTE((nonnull(1,2)));
+ MY_ATTRIBUTE((warn_unused_result));
#endif /* !UNIV_INNOCHECKSUM */
diff --git a/storage/xtradb/include/rem0rec.h b/storage/xtradb/include/rem0rec.h
index d72f2760a8c..9baf0ab380a 100644
--- a/storage/xtradb/include/rem0rec.h
+++ b/storage/xtradb/include/rem0rec.h
@@ -747,8 +747,7 @@ rec_copy(
/*=====*/
void* buf, /*!< in: buffer */
const rec_t* rec, /*!< in: physical record */
- const ulint* offsets)/*!< in: array returned by rec_get_offsets() */
- MY_ATTRIBUTE((nonnull));
+ const ulint* offsets);/*!< in: array returned by rec_get_offsets() */
#ifndef UNIV_HOTBACKUP
/**********************************************************//**
Determines the size of a data tuple prefix in a temporary file.
diff --git a/storage/xtradb/include/row0upd.h b/storage/xtradb/include/row0upd.h
index e59ec58b63c..4312fcf7339 100644
--- a/storage/xtradb/include/row0upd.h
+++ b/storage/xtradb/include/row0upd.h
@@ -248,9 +248,8 @@ row_upd_index_replace_new_col_vals_index_pos(
/*!< in: if TRUE, limit the replacement to
ordering fields of index; note that this
does not work for non-clustered indexes. */
- mem_heap_t* heap) /*!< in: memory heap for allocating and
+ mem_heap_t* heap); /*!< in: memory heap for allocating and
copying the new values */
- MY_ATTRIBUTE((nonnull));
/***********************************************************//**
Replaces the new column values stored in the update vector to the index entry
given. */
@@ -311,7 +310,7 @@ row_upd_changes_ord_field_binary_func(
compile time */
const row_ext_t*ext) /*!< NULL, or prefixes of the externally
stored columns in the old row */
- MY_ATTRIBUTE((nonnull(1,2), warn_unused_result));
+ MY_ATTRIBUTE((warn_unused_result));
#ifdef UNIV_DEBUG
# define row_upd_changes_ord_field_binary(index,update,thr,row,ext) \
row_upd_changes_ord_field_binary_func(index,update,thr,row,ext)
diff --git a/storage/xtradb/include/srv0srv.h b/storage/xtradb/include/srv0srv.h
index 4eb67a84cc1..c18bc7c1fc3 100644
--- a/storage/xtradb/include/srv0srv.h
+++ b/storage/xtradb/include/srv0srv.h
@@ -3,7 +3,7 @@
Copyright (c) 1995, 2016, Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2008, 2009, Google Inc.
Copyright (c) 2009, Percona Inc.
-Copyright (c) 2013, 2017, MariaDB Corporation
+Copyright (c) 2013, 2017, MariaDB Corporation Ab. All Rights Reserved.
Portions of this file contain modifications contributed and copyrighted by
Google, Inc. Those modifications are gratefully acknowledged and are described
@@ -192,6 +192,9 @@ struct srv_stats_t {
/** Number of encryption_get_latest_key_version calls */
ulint_ctr_64_t n_key_requests;
+
+ /** Number of spaces in keyrotation list */
+ ulint_ctr_64_t key_rotation_list_length;
};
extern const char* srv_main_thread_op_info;
@@ -199,13 +202,16 @@ extern const char* srv_main_thread_op_info;
/** Prefix used by MySQL to indicate pre-5.1 table name encoding */
extern const char srv_mysql50_table_name_prefix[10];
-/* The monitor thread waits on this event. */
+/** Event to signal srv_monitor_thread. Not protected by a mutex.
+Set after setting srv_print_innodb_monitor. */
extern os_event_t srv_monitor_event;
-/* The error monitor thread waits on this event. */
+/** Event to signal the shutdown of srv_error_monitor_thread.
+Not protected by a mutex. */
extern os_event_t srv_error_event;
-/** The buffer pool dump/load thread waits on this event. */
+/** Event for waking up buf_dump_thread. Not protected by a mutex.
+Set on shutdown or by buf_dump_start() or buf_load_start(). */
extern os_event_t srv_buf_dump_event;
/** The buffer pool dump/load file name */
@@ -506,9 +512,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.
@@ -523,6 +526,7 @@ extern unsigned long long srv_stats_transient_sample_pages;
extern my_bool srv_stats_persistent;
extern unsigned long long srv_stats_persistent_sample_pages;
extern my_bool srv_stats_auto_recalc;
+extern my_bool srv_stats_include_delete_marked;
extern unsigned long long srv_stats_modified_counter;
extern my_bool srv_stats_sample_traditional;
@@ -1070,24 +1074,17 @@ ulint
srv_get_task_queue_length(void);
/*===========================*/
-/*********************************************************************//**
-Releases threads of the type given from suspension in the thread table.
-NOTE! The server mutex has to be reserved by the caller!
-@return number of threads released: this may be less than n if not
-enough threads were suspended at the moment */
-UNIV_INTERN
-ulint
-srv_release_threads(
-/*================*/
- enum srv_thread_type type, /*!< in: thread type */
- ulint n); /*!< in: number of threads to release */
+/** Ensure that a given number of threads of the type given are running
+(or are already terminated).
+@param[in] type thread type
+@param[in] n number of threads that have to run */
+void
+srv_release_threads(enum srv_thread_type type, ulint n);
-/**********************************************************************//**
-Wakeup the purge threads. */
+/** Wake up the purge threads. */
UNIV_INTERN
void
-srv_purge_wakeup(void);
-/*==================*/
+srv_purge_wakeup();
/** Status variables to be passed to MySQL */
struct export_var_t{
@@ -1268,6 +1265,7 @@ struct export_var_t{
ulint innodb_encryption_rotation_pages_flushed;
ulint innodb_encryption_rotation_estimated_iops;
ib_int64_t innodb_encryption_key_requests;
+ ib_int64_t innodb_key_rotation_list_length;
ulint innodb_scrub_page_reorganizations;
ulint innodb_scrub_page_splits;
@@ -1325,4 +1323,12 @@ wsrep_srv_conc_cancel_wait(
thread */
#endif /* WITH_WSREP */
+#ifndef DBUG_OFF
+/** false before InnoDB monitor has been printed at least once, true
+afterwards */
+extern bool srv_debug_monitor_printed;
+#else
+#define srv_debug_monitor_printed false
+#endif
+
#endif
diff --git a/storage/xtradb/include/trx0purge.h b/storage/xtradb/include/trx0purge.h
index a862523c092..7b9b5dc49cd 100644
--- a/storage/xtradb/include/trx0purge.h
+++ b/storage/xtradb/include/trx0purge.h
@@ -1,6 +1,7 @@
/*****************************************************************************
Copyright (c) 1996, 2011, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 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
@@ -145,7 +146,10 @@ struct trx_purge_t{
log operation can prevent this by
obtaining an s-latch here. It also
protects state and running */
- os_event_t event; /*!< State signal event */
+ os_event_t event; /*!< State signal event;
+ os_event_set() and os_event_reset()
+ are protected by trx_purge_t::latch
+ X-lock */
ulint n_stop; /*!< Counter to track number stops */
volatile bool running; /*!< true, if purge is active,
we check this without the latch too */
diff --git a/storage/xtradb/include/trx0trx.h b/storage/xtradb/include/trx0trx.h
index 239ed0b273b..e621d4226a7 100644
--- a/storage/xtradb/include/trx0trx.h
+++ b/storage/xtradb/include/trx0trx.h
@@ -107,7 +107,7 @@ void
trx_free_prepared(
/*==============*/
trx_t* trx) /*!< in, own: trx object */
- UNIV_COLD MY_ATTRIBUTE((nonnull));
+ UNIV_COLD;
/********************************************************************//**
Frees a transaction object for MySQL. */
UNIV_INTERN
@@ -881,7 +881,7 @@ struct trx_t{
time_t start_time; /*!< time the trx state last time became
TRX_STATE_ACTIVE */
- clock_t start_time_micro; /*!< start time of transaction in
+ ib_uint64_t start_time_micro; /*!< start time of transaction in
microseconds */
trx_id_t id; /*!< transaction id */
XID xid; /*!< X/Open XA transaction
diff --git a/storage/xtradb/include/univ.i b/storage/xtradb/include/univ.i
index ad0565a0290..1e375ba2c09 100644
--- a/storage/xtradb/include/univ.i
+++ b/storage/xtradb/include/univ.i
@@ -45,10 +45,10 @@ Created 1/20/1994 Heikki Tuuri
#define INNODB_VERSION_MAJOR 5
#define INNODB_VERSION_MINOR 6
-#define INNODB_VERSION_BUGFIX 34
+#define INNODB_VERSION_BUGFIX 35
#ifndef PERCONA_INNODB_VERSION
-#define PERCONA_INNODB_VERSION 79.1
+#define PERCONA_INNODB_VERSION 80.0
#endif
/* Enable UNIV_LOG_ARCHIVE in XtraDB */
diff --git a/storage/xtradb/include/ut0ut.h b/storage/xtradb/include/ut0ut.h
index c5944bb0547..ca4ce0d4ef9 100644
--- a/storage/xtradb/include/ut0ut.h
+++ b/storage/xtradb/include/ut0ut.h
@@ -87,9 +87,7 @@ private:
# define UT_RELAX_CPU() YieldProcessor()
# elif defined(__powerpc__) && defined __GLIBC__
#include <sys/platform/ppc.h>
-# define UT_RELAX_CPU() do { \
- volatile lint volatile_var = __ppc_get_timebase(); \
- } while (0)
+# define UT_RELAX_CPU() __ppc_get_timebase()
# else
# define UT_RELAX_CPU() ((void)0) /* avoid warning for an empty statement */
# endif
diff --git a/storage/xtradb/include/ut0wqueue.h b/storage/xtradb/include/ut0wqueue.h
index e6b9891aed1..d69363afe7b 100644
--- a/storage/xtradb/include/ut0wqueue.h
+++ b/storage/xtradb/include/ut0wqueue.h
@@ -1,6 +1,7 @@
/*****************************************************************************
Copyright (c) 2006, 2009, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 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
@@ -116,7 +117,9 @@ ib_wqueue_len(
struct ib_wqueue_t {
ib_mutex_t mutex; /*!< mutex protecting everything */
ib_list_t* items; /*!< work item list */
- os_event_t event; /*!< event we use to signal additions to list */
+ os_event_t event; /*!< event we use to signal additions to list;
+ os_event_set() and os_event_reset() are
+ protected by ib_wqueue_t::mutex */
};
#endif
diff --git a/storage/xtradb/lock/lock0lock.cc b/storage/xtradb/lock/lock0lock.cc
index af2c823af64..0d555ed2dd7 100644
--- a/storage/xtradb/lock/lock0lock.cc
+++ b/storage/xtradb/lock/lock0lock.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2014, 2015, 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
@@ -930,8 +930,10 @@ lock_reset_lock_and_trx_wait(
}
ib_logf(IB_LOG_LEVEL_INFO,
- "Trx id %lu is waiting a lock in statement %s"
- " for this trx id %lu and statement %s wait_lock %p",
+ "Trx id " TRX_ID_FMT
+ " is waiting a lock in statement %s"
+ " for this trx id " TRX_ID_FMT
+ " and statement %s wait_lock %p",
lock->trx->id,
stmt ? stmt : "NULL",
trx_id,
@@ -2654,7 +2656,8 @@ lock_rec_add_to_queue(
if (wsrep_thd_is_BF(trx->mysql_thd, FALSE)) {
if (wsrep_debug) {
fprintf(stderr,
- "BF skipping wait: %lu\n",
+ "BF skipping wait: "
+ TRX_ID_FMT "\n",
trx->id);
lock_rec_print(stderr, lock);
}
@@ -5316,7 +5319,9 @@ lock_table_other_has_incompatible(
#ifdef WITH_WSREP
if(wsrep_thd_is_wsrep(trx->mysql_thd)) {
if (wsrep_debug) {
- fprintf(stderr, "WSREP: trx %ld table lock abort\n",
+ fprintf(stderr, "WSREP: trx "
+ TRX_ID_FMT
+ " table lock abort\n",
trx->id);
}
trx_mutex_enter(lock->trx);
@@ -6445,12 +6450,13 @@ loop:
if (lock_get_type_low(lock) == LOCK_REC) {
if (load_page_first) {
- ulint space = lock->un_member.rec_lock.space;
- ulint zip_size= fil_space_get_zip_size(space);
+ ulint space_id = lock->un_member.rec_lock.space;
+ /* Check if the space is exists or not. only
+ when the space is valid, try to get the page. */
+ fil_space_t* space = fil_space_acquire(space_id);
ulint page_no = lock->un_member.rec_lock.page_no;
- ibool tablespace_being_deleted = FALSE;
- if (UNIV_UNLIKELY(zip_size == ULINT_UNDEFINED)) {
+ if (!space) {
/* It is a single table tablespace and
the .ibd file is missing (TRUNCATE
@@ -6459,11 +6465,13 @@ loop:
load the page in the buffer pool. */
fprintf(file, "RECORD LOCKS on"
- " non-existing space %lu\n",
- (ulong) space);
+ " non-existing space: " ULINTPF "\n",
+ space_id);
goto print_rec;
}
+ const ulint zip_size = fsp_flags_get_zip_size(space->flags);
+
lock_mutex_exit();
mutex_exit(&trx_sys->mutex);
@@ -6471,15 +6479,10 @@ loop:
DEBUG_SYNC_C("innodb_monitor_before_lock_page_read");
- /* Check if the space is exists or not. only
- when the space is valid, try to get the page. */
- tablespace_being_deleted
- = fil_inc_pending_ops(space, false);
-
- if (!tablespace_being_deleted) {
+ if (space) {
mtr_start(&mtr);
- buf_page_get_gen(space, zip_size,
+ buf_page_get_gen(space_id, zip_size,
page_no, RW_NO_LATCH,
NULL,
BUF_GET_POSSIBLY_FREED,
@@ -6488,14 +6491,11 @@ loop:
mtr_commit(&mtr);
- fil_decr_pending_ops(space);
- } else {
- fprintf(file, "RECORD LOCKS on"
- " non-existing space %lu\n",
- (ulong) space);
}
}
+ fil_space_release(space);
+
load_page_first = FALSE;
lock_mutex_enter();
@@ -6924,7 +6924,7 @@ static
void
lock_rec_block_validate(
/*====================*/
- ulint space,
+ ulint space_id,
ulint page_no)
{
/* The lock and the block that it is referring to may be freed at
@@ -6937,10 +6937,11 @@ lock_rec_block_validate(
/* Make sure that the tablespace is not deleted while we are
trying to access the page. */
- if (!fil_inc_pending_ops(space, true)) {
+ if (fil_space_t* space = fil_space_acquire(space_id)) {
+
mtr_start(&mtr);
block = buf_page_get_gen(
- space, fil_space_get_zip_size(space),
+ space_id, fsp_flags_get_zip_size(space->flags),
page_no, RW_X_LATCH, NULL,
BUF_GET_POSSIBLY_FREED,
__FILE__, __LINE__, &mtr);
@@ -6950,7 +6951,7 @@ lock_rec_block_validate(
ut_ad(lock_rec_validate_page(block));
mtr_commit(&mtr);
- fil_decr_pending_ops(space);
+ fil_space_release(space);
}
}
diff --git a/storage/xtradb/log/log0crypt.cc b/storage/xtradb/log/log0crypt.cc
index f518845b1a8..e6b5c845757 100644
--- a/storage/xtradb/log/log0crypt.cc
+++ b/storage/xtradb/log/log0crypt.cc
@@ -144,11 +144,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);
+ fprintf(stderr,
+ "InnoDB: redo log checkpoint: " UINT64PF " [ chk key ]: ",
+ checkpoint_no);
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,
+ fprintf(stderr, "[ " UINT64PF " %u ] ",
+ it->checkpoint_no,
it->key_version);
}
fprintf(stderr, "\n");
diff --git a/storage/xtradb/log/log0log.cc b/storage/xtradb/log/log0log.cc
index 9245ae160e6..25c8ed06981 100644
--- a/storage/xtradb/log/log0log.cc
+++ b/storage/xtradb/log/log0log.cc
@@ -2,7 +2,7 @@
Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2009, Google Inc.
-Copyright (c) 2014, 2017, MariaDB Corporation. All Rights Reserved.
+Copyright (c) 2014, 2017, MariaDB Corporation.
Portions of this file contain modifications contributed and copyrighted by
Google, Inc. Those modifications are gratefully acknowledged and are described
@@ -48,6 +48,10 @@ Created 12/9/1995 Heikki Tuuri
#endif
#ifndef UNIV_HOTBACKUP
+#if MYSQL_VERSION_ID < 100200
+# include <my_systemd.h> /* sd_notifyf() */
+#endif
+
#include "mem0mem.h"
#include "buf0buf.h"
#include "buf0flu.h"
@@ -1588,17 +1592,7 @@ log_write_up_to(
}
loop:
-#ifdef UNIV_DEBUG
- loop_count++;
-
- ut_ad(loop_count < 5);
-
-# if 0
- if (loop_count > 2) {
- fprintf(stderr, "Log loop count %lu\n", loop_count);
- }
-# endif
-#endif
+ ut_ad(++loop_count < 100);
mutex_enter(&(log_sys->mutex));
ut_ad(!recv_no_log_write);
@@ -1886,7 +1880,7 @@ log_preflush_pool_modified_pages(
and we could not make a new checkpoint on the basis of the
info on the buffer pool only. */
- recv_apply_hashed_log_recs(TRUE);
+ recv_apply_hashed_log_recs(true);
}
if (!buf_page_cleaner_is_active
@@ -2261,7 +2255,7 @@ log_checkpoint(
ut_ad(!srv_read_only_mode);
if (recv_recovery_is_on()) {
- recv_apply_hashed_log_recs(TRUE);
+ recv_apply_hashed_log_recs(true);
}
if (srv_unix_file_flush_method != SRV_UNIX_NOSYNC &&
@@ -2635,6 +2629,13 @@ loop:
start_lsn += len;
buf += len;
+ if (recv_sys->report(ut_time())) {
+ ib_logf(IB_LOG_LEVEL_INFO, "Read redo log up to LSN=" LSN_PF,
+ start_lsn);
+ sd_notifyf(0, "STATUS=Read redo log up to LSN=" LSN_PF,
+ start_lsn);
+ }
+
if (start_lsn != end_lsn) {
if (release_mutex) {
@@ -3560,7 +3561,6 @@ logs_empty_and_mark_files_at_shutdown(void)
lsn_t lsn;
lsn_t tracked_lsn;
ulint count = 0;
- ulint total_trx;
ulint pending_io;
ibool server_busy;
@@ -3570,12 +3570,6 @@ logs_empty_and_mark_files_at_shutdown(void)
if (log_disable_checkpoint_active)
log_enable_checkpoint();
- while (srv_fast_shutdown == 0 && trx_rollback_or_clean_is_active) {
- /* we should wait until rollback after recovery end
- for slow shutdown */
- os_thread_sleep(100000);
- }
-
/* Wait until the master thread and all other operations are idle: our
algorithm only works if the server is idle at shutdown */
@@ -3597,10 +3591,9 @@ 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 && !srv_read_only_mode
+ && srv_force_recovery < SRV_FORCE_NO_TRX_UNDO
+ ? trx_sys_any_active_transactions() : 0) {
if (srv_print_verbose_log && count > 600) {
ib_logf(IB_LOG_LEVEL_INFO,
"Waiting for %lu active transactions to finish",
@@ -3625,6 +3618,8 @@ loop:
thread_name = "lock_wait_timeout_thread";
} else if (srv_buf_dump_thread_active) {
thread_name = "buf_dump_thread";
+ } else if (srv_fast_shutdown != 2 && trx_rollback_or_clean_is_active) {
+ thread_name = "rollback of recovered transactions";
} else {
thread_name = NULL;
}
@@ -4086,6 +4081,7 @@ log_shutdown(void)
if (!srv_read_only_mode && srv_scrub_log) {
os_event_free(log_scrub_event);
+ log_scrub_event = NULL;
}
#ifdef UNIV_LOG_ARCHIVE
diff --git a/storage/xtradb/log/log0online.cc b/storage/xtradb/log/log0online.cc
index 4e6ad65a906..74f2e2360a8 100644
--- a/storage/xtradb/log/log0online.cc
+++ b/storage/xtradb/log/log0online.cc
@@ -77,12 +77,14 @@ struct log_bitmap_struct {
both the correct type and the tree does
not mind its overwrite during
rbt_next() tree traversal. */
- ib_mutex_t mutex; /*!< mutex protecting all the fields.*/
};
/* The log parsing and bitmap output struct instance */
static struct log_bitmap_struct* log_bmp_sys;
+/* Mutex protecting log_bmp_sys */
+static ib_mutex_t log_bmp_sys_mutex;
+
/** File name stem for bitmap files. */
static const char* bmp_file_name_stem = "ib_modified_log_";
@@ -174,28 +176,24 @@ log_online_set_page_bit(
ulint space, /*!<in: log record space id */
ulint page_no)/*!<in: log record page id */
{
- ulint block_start_page;
- ulint block_pos;
- uint bit_pos;
- ib_rbt_bound_t tree_search_pos;
- byte search_page[MODIFIED_PAGE_BLOCK_SIZE];
- byte *page_ptr;
-
- ut_ad(mutex_own(&log_bmp_sys->mutex));
+ ut_ad(mutex_own(&log_bmp_sys_mutex));
ut_a(space != ULINT_UNDEFINED);
ut_a(page_no != ULINT_UNDEFINED);
- block_start_page = page_no / MODIFIED_PAGE_BLOCK_ID_COUNT
+ ulint block_start_page = page_no / MODIFIED_PAGE_BLOCK_ID_COUNT
* MODIFIED_PAGE_BLOCK_ID_COUNT;
- block_pos = block_start_page ? (page_no % block_start_page / 8)
+ ulint block_pos = block_start_page ? (page_no % block_start_page / 8)
: (page_no / 8);
- bit_pos = page_no % 8;
+ uint bit_pos = page_no % 8;
+ byte search_page[MODIFIED_PAGE_BLOCK_SIZE];
mach_write_to_4(search_page + MODIFIED_PAGE_SPACE_ID, space);
mach_write_to_4(search_page + MODIFIED_PAGE_1ST_PAGE_ID,
block_start_page);
+ byte *page_ptr;
+ ib_rbt_bound_t tree_search_pos;
if (!rbt_search(log_bmp_sys->modified_pages, &tree_search_pos,
search_page)) {
page_ptr = rbt_value(byte, tree_search_pos.last);
@@ -594,12 +592,19 @@ log_online_is_bitmap_file(
&& (!strcmp(stem, bmp_file_name_stem)));
}
-/*********************************************************************//**
-Initialize the online log following subsytem. */
+/** Initialize the constant part of the log tracking subsystem */
+UNIV_INTERN
+void
+log_online_init(void)
+{
+ mutex_create(log_bmp_sys_mutex_key, &log_bmp_sys_mutex,
+ SYNC_LOG_ONLINE);
+}
+
+/** Initialize the dynamic part of the log tracking subsystem */
UNIV_INTERN
void
log_online_read_init(void)
-/*======================*/
{
ibool success;
lsn_t tracking_start_lsn
@@ -623,9 +628,6 @@ log_online_read_init(void)
log_bmp_sys->read_buf = static_cast<byte *>
(ut_align(log_bmp_sys->read_buf_ptr, OS_FILE_LOG_BLOCK_SIZE));
- mutex_create(log_bmp_sys_mutex_key, &log_bmp_sys->mutex,
- SYNC_LOG_ONLINE);
-
/* Initialize bitmap file directory from srv_data_home and add a path
separator if needed. */
srv_data_home_len = strlen(srv_data_home);
@@ -760,13 +762,15 @@ log_online_read_init(void)
log_set_tracked_lsn(tracking_start_lsn);
}
-/*********************************************************************//**
-Shut down the online log following subsystem. */
+/** Shut down the dynamic part of the log tracking subsystem */
UNIV_INTERN
void
log_online_read_shutdown(void)
-/*==========================*/
{
+ mutex_enter(&log_bmp_sys_mutex);
+
+ srv_track_changed_pages = FALSE;
+
ib_rbt_node_t *free_list_node = log_bmp_sys->page_free_list;
if (log_bmp_sys->out.file != os_file_invalid) {
@@ -782,10 +786,21 @@ log_online_read_shutdown(void)
free_list_node = next;
}
- mutex_free(&log_bmp_sys->mutex);
-
ut_free(log_bmp_sys->read_buf_ptr);
ut_free(log_bmp_sys);
+ log_bmp_sys = NULL;
+
+ srv_redo_log_thread_started = false;
+
+ mutex_exit(&log_bmp_sys_mutex);
+}
+
+/** Shut down the constant part of the log tracking subsystem */
+UNIV_INTERN
+void
+log_online_shutdown(void)
+{
+ mutex_free(&log_bmp_sys_mutex);
}
/*********************************************************************//**
@@ -831,13 +846,12 @@ void
log_online_parse_redo_log(void)
/*===========================*/
{
+ ut_ad(mutex_own(&log_bmp_sys_mutex));
+
byte *ptr = log_bmp_sys->parse_buf;
byte *end = log_bmp_sys->parse_buf_end;
-
ulint len = 0;
- ut_ad(mutex_own(&log_bmp_sys->mutex));
-
while (ptr != end
&& log_bmp_sys->next_parse_lsn < log_bmp_sys->end_lsn) {
@@ -919,6 +933,8 @@ log_online_add_to_parse_buf(
ulint skip_len) /*!< in: how much of log data to
skip */
{
+ ut_ad(mutex_own(&log_bmp_sys_mutex));
+
ulint start_offset = skip_len ? skip_len : LOG_BLOCK_HDR_SIZE;
ulint end_offset
= (data_len == OS_FILE_LOG_BLOCK_SIZE)
@@ -927,8 +943,6 @@ log_online_add_to_parse_buf(
ulint actual_data_len = (end_offset >= start_offset)
? end_offset - start_offset : 0;
- ut_ad(mutex_own(&log_bmp_sys->mutex));
-
ut_memcpy(log_bmp_sys->parse_buf_end, log_block + start_offset,
actual_data_len);
@@ -951,11 +965,9 @@ log_online_parse_redo_log_block(
log data should be skipped as
they were parsed before */
{
- ulint block_data_len;
-
- ut_ad(mutex_own(&log_bmp_sys->mutex));
+ ut_ad(mutex_own(&log_bmp_sys_mutex));
- block_data_len = log_block_get_data_len(log_block);
+ ulint block_data_len = log_block_get_data_len(log_block);
ut_ad(block_data_len % OS_FILE_LOG_BLOCK_SIZE == 0
|| block_data_len < OS_FILE_LOG_BLOCK_SIZE);
@@ -975,14 +987,14 @@ log_online_follow_log_seg(
lsn_t block_start_lsn, /*!< in: the LSN to read from */
lsn_t block_end_lsn) /*!< in: the LSN to read to */
{
+ ut_ad(mutex_own(&log_bmp_sys_mutex));
+
/* Pointer to the current OS_FILE_LOG_BLOCK-sized chunk of the read log
data to parse */
byte* log_block = log_bmp_sys->read_buf;
byte* log_block_end = log_bmp_sys->read_buf
+ (block_end_lsn - block_start_lsn);
- ut_ad(mutex_own(&log_bmp_sys->mutex));
-
mutex_enter(&log_sys->mutex);
log_group_read_log_seg(LOG_RECOVER, log_bmp_sys->read_buf,
group, block_start_lsn, block_end_lsn, TRUE);
@@ -1042,11 +1054,11 @@ log_online_follow_log_group(
lsn_t contiguous_lsn) /*!< in: the LSN of log block start
containing the log_parse_start_lsn */
{
+ ut_ad(mutex_own(&log_bmp_sys_mutex));
+
lsn_t block_start_lsn = contiguous_lsn;
lsn_t block_end_lsn;
- ut_ad(mutex_own(&log_bmp_sys->mutex));
-
log_bmp_sys->next_parse_lsn = log_bmp_sys->start_lsn;
log_bmp_sys->parse_buf_end = log_bmp_sys->parse_buf;
@@ -1083,21 +1095,29 @@ log_online_write_bitmap_page(
/*=========================*/
const byte *block) /*!< in: block to write */
{
- ibool success;
-
- ut_ad(srv_track_changed_pages);
- ut_ad(mutex_own(&log_bmp_sys->mutex));
+ ut_ad(mutex_own(&log_bmp_sys_mutex));
/* Simulate a write error */
DBUG_EXECUTE_IF("bitmap_page_write_error",
- ib_logf(IB_LOG_LEVEL_ERROR,
- "simulating bitmap write error in "
- "log_online_write_bitmap_page");
- return FALSE;);
-
- success = os_file_write(log_bmp_sys->out.name, log_bmp_sys->out.file,
- block, log_bmp_sys->out.offset,
- MODIFIED_PAGE_BLOCK_SIZE);
+ {
+ ulint space_id
+ = mach_read_from_4(block
+ + MODIFIED_PAGE_SPACE_ID);
+ if (space_id > 0) {
+ ib_logf(IB_LOG_LEVEL_ERROR,
+ "simulating bitmap write "
+ "error in "
+ "log_online_write_bitmap_page "
+ "for space ID %lu",
+ space_id);
+ return FALSE;
+ }
+ });
+
+ ibool success = os_file_write(log_bmp_sys->out.name,
+ log_bmp_sys->out.file, block,
+ log_bmp_sys->out.offset,
+ MODIFIED_PAGE_BLOCK_SIZE);
if (UNIV_UNLIKELY(!success)) {
/* The following call prints an error message */
@@ -1136,11 +1156,7 @@ ibool
log_online_write_bitmap(void)
/*=========================*/
{
- ib_rbt_node_t *bmp_tree_node;
- const ib_rbt_node_t *last_bmp_tree_node;
- ibool success = TRUE;
-
- ut_ad(mutex_own(&log_bmp_sys->mutex));
+ ut_ad(mutex_own(&log_bmp_sys_mutex));
if (log_bmp_sys->out.offset >= srv_max_bitmap_file_size) {
if (!log_online_rotate_bitmap_file(log_bmp_sys->start_lsn)) {
@@ -1148,9 +1164,12 @@ log_online_write_bitmap(void)
}
}
- bmp_tree_node = (ib_rbt_node_t *)
- rbt_first(log_bmp_sys->modified_pages);
- last_bmp_tree_node = rbt_last(log_bmp_sys->modified_pages);
+ ib_rbt_node_t *bmp_tree_node
+ = (ib_rbt_node_t *)rbt_first(log_bmp_sys->modified_pages);
+ const ib_rbt_node_t * const last_bmp_tree_node
+ = rbt_last(log_bmp_sys->modified_pages);
+
+ ibool success = TRUE;
while (bmp_tree_node) {
@@ -1183,9 +1202,11 @@ log_online_write_bitmap(void)
rbt_next(log_bmp_sys->modified_pages, bmp_tree_node);
DBUG_EXECUTE_IF("bitmap_page_2_write_error",
- ut_ad(bmp_tree_node); /* 2nd page must exist */
- DBUG_SET("+d,bitmap_page_write_error");
- DBUG_SET("-d,bitmap_page_2_write_error"););
+ if (bmp_tree_node)
+ {
+ DBUG_SET("+d,bitmap_page_write_error");
+ DBUG_SET("-d,bitmap_page_2_write_error");
+ });
}
rbt_reset(log_bmp_sys->modified_pages);
@@ -1206,10 +1227,19 @@ log_online_follow_redo_log(void)
log_group_t* group;
ibool result;
- ut_ad(srv_track_changed_pages);
ut_ad(!srv_read_only_mode);
- mutex_enter(&log_bmp_sys->mutex);
+ if (!srv_track_changed_pages)
+ return TRUE;
+
+ DEBUG_SYNC_C("log_online_follow_redo_log");
+
+ mutex_enter(&log_bmp_sys_mutex);
+
+ if (!srv_track_changed_pages) {
+ mutex_exit(&log_bmp_sys_mutex);
+ return TRUE;
+ }
/* Grab the LSN of the last checkpoint, we will parse up to it */
mutex_enter(&(log_sys->mutex));
@@ -1217,7 +1247,7 @@ log_online_follow_redo_log(void)
mutex_exit(&(log_sys->mutex));
if (log_bmp_sys->end_lsn == log_bmp_sys->start_lsn) {
- mutex_exit(&log_bmp_sys->mutex);
+ mutex_exit(&log_bmp_sys_mutex);
return TRUE;
}
@@ -1240,7 +1270,7 @@ log_online_follow_redo_log(void)
log_bmp_sys->start_lsn = log_bmp_sys->end_lsn;
log_set_tracked_lsn(log_bmp_sys->start_lsn);
- mutex_exit(&log_bmp_sys->mutex);
+ mutex_exit(&log_bmp_sys_mutex);
return result;
}
@@ -1587,6 +1617,8 @@ log_online_bitmap_iterator_init(
{
ut_a(i);
+ i->max_lsn = max_lsn;
+
if (UNIV_UNLIKELY(min_lsn > max_lsn)) {
/* Empty range */
@@ -1695,6 +1727,9 @@ log_online_bitmap_iterator_next(
return TRUE;
}
+ if (i->end_lsn >= i->max_lsn && i->last_page_in_run)
+ return FALSE;
+
while (!checksum_ok)
{
while (i->in.size < MODIFIED_PAGE_BLOCK_SIZE
@@ -1790,15 +1825,21 @@ log_online_purge_changed_page_bitmaps(
lsn = LSN_MAX;
}
+ bool log_bmp_sys_inited = false;
if (srv_redo_log_thread_started) {
/* User requests might happen with both enabled and disabled
tracking */
- mutex_enter(&log_bmp_sys->mutex);
+ log_bmp_sys_inited = true;
+ mutex_enter(&log_bmp_sys_mutex);
+ if (!srv_redo_log_thread_started) {
+ log_bmp_sys_inited = false;
+ mutex_exit(&log_bmp_sys_mutex);
+ }
}
if (!log_online_setup_bitmap_file_range(&bitmap_files, 0, LSN_MAX)) {
- if (srv_redo_log_thread_started) {
- mutex_exit(&log_bmp_sys->mutex);
+ if (log_bmp_sys_inited) {
+ mutex_exit(&log_bmp_sys_mutex);
}
return TRUE;
}
@@ -1836,7 +1877,7 @@ log_online_purge_changed_page_bitmaps(
}
}
- if (srv_redo_log_thread_started) {
+ if (log_bmp_sys_inited) {
if (lsn > log_bmp_sys->end_lsn) {
lsn_t new_file_lsn;
if (lsn == LSN_MAX) {
@@ -1852,7 +1893,7 @@ log_online_purge_changed_page_bitmaps(
}
}
- mutex_exit(&log_bmp_sys->mutex);
+ mutex_exit(&log_bmp_sys_mutex);
}
free(bitmap_files.files);
diff --git a/storage/xtradb/log/log0recv.cc b/storage/xtradb/log/log0recv.cc
index 11c643afff1..6b7c8d77824 100644
--- a/storage/xtradb/log/log0recv.cc
+++ b/storage/xtradb/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, 2017, 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
@@ -85,7 +85,7 @@ this must be less than UNIV_PAGE_SIZE as it is stored in the buffer pool */
#define RECV_READ_AHEAD_AREA 32
/** The recovery system */
-UNIV_INTERN recv_sys_t* recv_sys = NULL;
+UNIV_INTERN recv_sys_t* recv_sys;
/** TRUE when applying redo log records during crash recovery; FALSE
otherwise. Note that this is FALSE while a background thread is
rolling back incomplete transactions. */
@@ -137,9 +137,6 @@ UNIV_INTERN ibool recv_is_making_a_backup = FALSE;
UNIV_INTERN ibool recv_is_from_backup = FALSE;
# define buf_pool_get_curr_size() (5 * 1024 * 1024)
#endif /* !UNIV_HOTBACKUP */
-/** The following counter is used to decide when to print info on
-log scan */
-static ulint recv_scan_print_counter;
/** The type of the previous parsed redo log record */
static ulint recv_previous_parsed_rec_type;
@@ -182,7 +179,7 @@ UNIV_INTERN mysql_pfs_key_t recv_writer_mutex_key;
# endif /* UNIV_PFS_MUTEX */
/** Flag indicating if recv_writer thread is active. */
-UNIV_INTERN bool recv_writer_thread_active = false;
+static volatile bool recv_writer_thread_active;
UNIV_INTERN os_thread_t recv_writer_thread_handle = 0;
#endif /* !UNIV_HOTBACKUP */
@@ -310,8 +307,6 @@ recv_sys_var_init(void)
recv_no_ibuf_operations = FALSE;
- recv_scan_print_counter = 0;
-
recv_previous_parsed_rec_type = 999999;
recv_previous_parsed_rec_offset = 0;
@@ -348,8 +343,6 @@ DECLARE_THREAD(recv_writer_thread)(
os_thread_pf(os_thread_get_curr_id()));
#endif /* UNIV_DEBUG_THREAD_CREATION */
- recv_writer_thread_active = true;
-
while (srv_shutdown_state == SRV_SHUTDOWN_NONE) {
os_thread_sleep(100000);
@@ -424,6 +417,7 @@ recv_sys_init(
recv_sys->last_block_buf_start, OS_FILE_LOG_BLOCK_SIZE));
recv_sys->found_corrupt_log = FALSE;
+ recv_sys->progress_time = ut_time();
recv_max_page_lsn = 0;
@@ -433,33 +427,18 @@ recv_sys_init(
mutex_exit(&(recv_sys->mutex));
}
-/********************************************************//**
-Empties the hash table when it has been fully processed.
-@return DB_SUCCESS when successfull or DB_ERROR when fails. */
+/** Empty a fully processed hash table. */
static
-dberr_t
-recv_sys_empty_hash(void)
-/*=====================*/
+void
+recv_sys_empty_hash()
{
ut_ad(mutex_own(&(recv_sys->mutex)));
-
- if (recv_sys->n_addrs != 0) {
- fprintf(stderr,
- "InnoDB: Error: %lu pages with log records"
- " were left unprocessed!\n"
- "InnoDB: Maximum page number with"
- " log records on it %lu\n",
- (ulong) recv_sys->n_addrs,
- (ulong) recv_max_parsed_page_no);
- return DB_ERROR;
- }
+ ut_a(recv_sys->n_addrs == 0);
hash_table_free(recv_sys->addr_hash);
mem_heap_empty(recv_sys->heap);
recv_sys->addr_hash = hash_create(buf_pool_get_curr_size() / 512);
-
- return DB_SUCCESS;
}
#ifndef UNIV_HOTBACKUP
@@ -1404,7 +1383,7 @@ recv_parse_or_apply_log_rec_body(
}
break;
case MLOG_FILE_WRITE_CRYPT_DATA:
- ptr = fil_parse_write_crypt_data(ptr, end_ptr, block);
+ ptr = const_cast<byte*>(fil_parse_write_crypt_data(ptr, end_ptr, block));
break;
default:
ptr = NULL;
@@ -1806,6 +1785,8 @@ recv_recover_page_func(
mtr_commit(&mtr);
+ ib_time_t time = ut_time();
+
mutex_enter(&(recv_sys->mutex));
if (recv_max_page_lsn < page_lsn) {
@@ -1814,11 +1795,17 @@ recv_recover_page_func(
recv_addr->state = RECV_PROCESSED;
- ut_a(recv_sys->n_addrs);
- recv_sys->n_addrs--;
-
- mutex_exit(&(recv_sys->mutex));
+ ut_a(recv_sys->n_addrs > 0);
+ if (ulint n = --recv_sys->n_addrs) {
+ if (recv_sys->report(time)) {
+ ib_logf(IB_LOG_LEVEL_INFO,
+ "To recover: " ULINTPF " pages from log", n);
+ sd_notifyf(0, "STATUS=To recover: " ULINTPF
+ " pages from log", n);
+ }
+ }
+ mutex_exit(&recv_sys->mutex);
}
#ifndef UNIV_HOTBACKUP
@@ -1864,62 +1851,50 @@ recv_read_in_area(
}
buf_read_recv_pages(FALSE, space, zip_size, page_nos, n);
- /*
- fprintf(stderr, "Recv pages at %lu n %lu\n", page_nos[0], n);
- */
return(n);
}
-/*******************************************************************//**
-Empties the hash table of stored log records, applying them to appropriate
-pages.
-@return DB_SUCCESS when successfull or DB_ERROR when fails. */
+/** Apply the hash table of stored log records to persistent data pages.
+@param[in] last_batch whether the change buffer merge will be
+ performed as part of the operation */
UNIV_INTERN
-dberr_t
-recv_apply_hashed_log_recs(
-/*=======================*/
- ibool allow_ibuf) /*!< in: if TRUE, also ibuf operations are
- allowed during the application; if FALSE,
- no ibuf operations are allowed, and after
- the application all file pages are flushed to
- disk and invalidated in buffer pool: this
- alternative means that no new log records
- can be generated during the application;
- the caller must in this case own the log
- mutex */
+void
+recv_apply_hashed_log_recs(bool last_batch)
{
- recv_addr_t* recv_addr;
- ulint i;
- ibool has_printed = FALSE;
- ulong progress;
- mtr_t mtr;
- dberr_t err = DB_SUCCESS;
-loop:
- mutex_enter(&(recv_sys->mutex));
-
- if (recv_sys->apply_batch_on) {
+ for (;;) {
+ mutex_enter(&recv_sys->mutex);
- mutex_exit(&(recv_sys->mutex));
+ if (!recv_sys->apply_batch_on) {
+ break;
+ }
+ mutex_exit(&recv_sys->mutex);
os_thread_sleep(500000);
-
- goto loop;
}
- ut_ad((allow_ibuf == 0) == (mutex_own(&log_sys->mutex) != 0));
+ ut_ad(!last_batch == mutex_own(&log_sys->mutex));
- if (!allow_ibuf) {
+ if (!last_batch) {
recv_no_ibuf_operations = TRUE;
}
+ if (ulint n = recv_sys->n_addrs) {
+ const char* msg = last_batch
+ ? "Starting final batch to recover "
+ : "Starting a batch to recover ";
+ ib_logf(IB_LOG_LEVEL_INFO,
+ "%s" ULINTPF " pages from redo log", msg, n);
+ sd_notifyf(0, "STATUS=%s" ULINTPF " pages from redo log",
+ msg, n);
+ }
+
recv_sys->apply_log_recs = TRUE;
recv_sys->apply_batch_on = TRUE;
- for (i = 0; i < hash_get_n_cells(recv_sys->addr_hash); i++) {
-
- for (recv_addr = static_cast<recv_addr_t*>(
- HASH_GET_FIRST(recv_sys->addr_hash, i));
- recv_addr != 0;
+ for (ulint i = 0; i < hash_get_n_cells(recv_sys->addr_hash); i++) {
+ for (recv_addr_t* recv_addr = static_cast<recv_addr_t*>(
+ HASH_GET_FIRST(recv_sys->addr_hash, i));
+ recv_addr;
recv_addr = static_cast<recv_addr_t*>(
HASH_GET_NEXT(addr_hash, recv_addr))) {
@@ -1928,24 +1903,12 @@ loop:
ulint page_no = recv_addr->page_no;
if (recv_addr->state == RECV_NOT_PROCESSED) {
- if (!has_printed) {
- ib_logf(IB_LOG_LEVEL_INFO,
- "Starting an apply batch"
- " of log records"
- " to the database...");
- fputs("InnoDB: Progress in percent: ",
- stderr);
- has_printed = TRUE;
- }
-
- mutex_exit(&(recv_sys->mutex));
+ mutex_exit(&recv_sys->mutex);
if (buf_page_peek(space, page_no)) {
- buf_block_t* block;
-
+ mtr_t mtr;
mtr_start(&mtr);
-
- block = buf_page_get(
+ buf_block_t* block = buf_page_get(
space, zip_size, page_no,
RW_X_LATCH, &mtr);
buf_block_dbg_add_level(
@@ -1958,21 +1921,9 @@ loop:
page_no);
}
- mutex_enter(&(recv_sys->mutex));
+ mutex_enter(&recv_sys->mutex);
}
}
-
- progress = (ulong) (i * 100)
- / hash_get_n_cells(recv_sys->addr_hash);
- if (has_printed
- && progress
- != ((i + 1) * 100)
- / hash_get_n_cells(recv_sys->addr_hash)) {
-
- fprintf(stderr, "%lu ", progress);
- sd_notifyf(0, "STATUS=Applying batch of log records for"
- " InnoDB: Progress %lu", progress);
- }
}
/* Wait until all the pages have been processed */
@@ -1986,12 +1937,7 @@ loop:
mutex_enter(&(recv_sys->mutex));
}
- if (has_printed) {
-
- fprintf(stderr, "\n");
- }
-
- if (!allow_ibuf) {
+ if (!last_batch) {
bool success;
/* Flush all the file pages to disk and invalidate them in
@@ -2029,16 +1975,9 @@ loop:
recv_sys->apply_log_recs = FALSE;
recv_sys->apply_batch_on = FALSE;
- err = recv_sys_empty_hash();
-
- if (has_printed) {
- fprintf(stderr, "InnoDB: Apply batch completed\n");
- sd_notify(0, "STATUS=InnoDB: Apply batch completed");
- }
-
- mutex_exit(&(recv_sys->mutex));
+ recv_sys_empty_hash();
- return err;
+ mutex_exit(&recv_sys->mutex);
}
#else /* !UNIV_HOTBACKUP */
/*******************************************************************//**
@@ -2061,11 +2000,6 @@ recv_apply_log_recs_for_backup(void)
block = back_block1;
- ib_logf(IB_LOG_LEVEL_INFO,
- "Starting an apply batch of log records to the database...");
-
- fputs("InnoDB: Progress in percent: ", stderr);
-
n_hash_cells = hash_get_n_cells(recv_sys->addr_hash);
for (i = 0; i < n_hash_cells; i++) {
@@ -2179,16 +2113,6 @@ recv_apply_log_recs_for_backup(void)
skip_this_recv_addr:
recv_addr = HASH_GET_NEXT(addr_hash, recv_addr);
}
-
- if ((100 * i) / n_hash_cells
- != (100 * (i + 1)) / n_hash_cells) {
- fprintf(stderr, "%lu ",
- (ulong) ((100 * i) / n_hash_cells));
- fflush(stderr);
- sd_notifyf(0, "STATUS=Applying batch of log records for"
- " backup InnoDB: Progress %lu",
- (ulong) (100 * i) / n_hash_cells);
- }
}
sd_notify(0, "STATUS=InnoDB: Apply batch for backup completed");
@@ -2891,11 +2815,10 @@ recv_scan_log_recs(
#ifndef UNIV_HOTBACKUP
if (recv_log_scan_is_startup_type
&& !recv_needed_recovery) {
-
if (!srv_read_only_mode) {
ib_logf(IB_LOG_LEVEL_INFO,
- "Log scan progressed past the "
- "checkpoint lsn " LSN_PF "",
+ "Starting crash recovery from "
+ "checkpoint LSN=" LSN_PF,
recv_sys->scanned_lsn);
recv_init_crash_recovery();
@@ -2955,19 +2878,6 @@ recv_scan_log_recs(
*group_scanned_lsn = scanned_lsn;
- if (recv_needed_recovery
- || (recv_is_from_backup && !recv_is_making_a_backup)) {
- recv_scan_print_counter++;
-
- if (finished || (recv_scan_print_counter % 80 == 0)) {
-
- fprintf(stderr,
- "InnoDB: Doing recovery: scanned up to"
- " log sequence number " LSN_PF "\n",
- *group_scanned_lsn);
- }
- }
-
if (more_data && !recv_sys->found_corrupt_log) {
/* Try to parse more log records */
@@ -2987,12 +2897,7 @@ recv_scan_log_recs(
log yet: they would be produced by ibuf
operations */
- *err = recv_apply_hashed_log_recs(FALSE);
-
- if (*err != DB_SUCCESS) {
- /* Finish processing because of error */
- return (TRUE);
- }
+ recv_apply_hashed_log_recs(false);
}
#endif /* !UNIV_HOTBACKUP */
@@ -3076,11 +2981,6 @@ recv_init_crash_recovery(void)
recv_needed_recovery = TRUE;
- ib_logf(IB_LOG_LEVEL_INFO, "Database was not shutdown normally!");
- ib_logf(IB_LOG_LEVEL_INFO, "Starting crash recovery.");
- ib_logf(IB_LOG_LEVEL_INFO,
- "Reading tablespace information from the .ibd files...");
-
fil_load_single_table_tablespaces();
/* If we are using the doublewrite method, we will
@@ -3091,15 +2991,14 @@ recv_init_crash_recovery(void)
if (srv_force_recovery < SRV_FORCE_NO_LOG_REDO) {
ib_logf(IB_LOG_LEVEL_INFO,
- "Restoring possible half-written data pages ");
-
- ib_logf(IB_LOG_LEVEL_INFO,
+ "Restoring possible half-written data pages "
"from the doublewrite buffer...");
buf_dblwr_process();
/* Spawn the background thread to flush dirty pages
from the buffer pools. */
+ recv_writer_thread_active = true;
recv_writer_thread_handle = os_thread_create(
recv_writer_thread, 0, 0);
}
diff --git a/storage/xtradb/mach/mach0data.cc b/storage/xtradb/mach/mach0data.cc
index 206434dc5ab..feeedb01609 100644
--- a/storage/xtradb/mach/mach0data.cc
+++ b/storage/xtradb/mach/mach0data.cc
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1995, 2009, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -55,7 +55,6 @@ mach_parse_compressed(
if (flag < 0x80UL) {
*val = flag;
return(ptr + 1);
-
}
/* Workaround GCC bug
@@ -64,7 +63,11 @@ mach_parse_compressed(
function, causing and out-of-bounds read if we are reading a short
integer close to the end of buffer. */
#if defined(__GNUC__) && (__GNUC__ >= 5) && !defined(__clang__)
- asm volatile("": : :"memory");
+#define DEPLOY_FENCE
+#endif
+
+#ifdef DEPLOY_FENCE
+ __atomic_thread_fence(__ATOMIC_ACQUIRE);
#endif
if (flag < 0xC0UL) {
@@ -75,8 +78,13 @@ mach_parse_compressed(
*val = mach_read_from_2(ptr) & 0x7FFFUL;
return(ptr + 2);
+ }
- } else if (flag < 0xE0UL) {
+#ifdef DEPLOY_FENCE
+ __atomic_thread_fence(__ATOMIC_ACQUIRE);
+#endif
+
+ if (flag < 0xE0UL) {
if (end_ptr < ptr + 3) {
return(NULL);
}
@@ -84,7 +92,13 @@ mach_parse_compressed(
*val = mach_read_from_3(ptr) & 0x3FFFFFUL;
return(ptr + 3);
- } else if (flag < 0xF0UL) {
+ }
+
+#ifdef DEPLOY_FENCE
+ __atomic_thread_fence(__ATOMIC_ACQUIRE);
+#endif
+
+ if (flag < 0xF0UL) {
if (end_ptr < ptr + 4) {
return(NULL);
}
@@ -92,14 +106,20 @@ mach_parse_compressed(
*val = mach_read_from_4(ptr) & 0x1FFFFFFFUL;
return(ptr + 4);
- } else {
- ut_ad(flag == 0xF0UL);
+ }
- if (end_ptr < ptr + 5) {
- return(NULL);
- }
+#ifdef DEPLOY_FENCE
+ __atomic_thread_fence(__ATOMIC_ACQUIRE);
+#endif
- *val = mach_read_from_4(ptr + 1);
- return(ptr + 5);
+#undef DEPLOY_FENCE
+
+ ut_ad(flag == 0xF0UL);
+
+ if (end_ptr < ptr + 5) {
+ return(NULL);
}
+
+ *val = mach_read_from_4(ptr + 1);
+ return(ptr + 5);
}
diff --git a/storage/xtradb/mtr/mtr0mtr.cc b/storage/xtradb/mtr/mtr0mtr.cc
index a1d7261e43c..e564b270d00 100644
--- a/storage/xtradb/mtr/mtr0mtr.cc
+++ b/storage/xtradb/mtr/mtr0mtr.cc
@@ -312,7 +312,6 @@ mtr_commit(
/*=======*/
mtr_t* mtr) /*!< in: mini-transaction */
{
- ut_ad(mtr);
ut_ad(mtr->magic_n == MTR_MAGIC_N);
ut_ad(mtr->state == MTR_ACTIVE);
ut_ad(!mtr->inside_ibuf);
diff --git a/storage/xtradb/os/os0file.cc b/storage/xtradb/os/os0file.cc
index caf2becae72..ed84834e6ea 100644
--- a/storage/xtradb/os/os0file.cc
+++ b/storage/xtradb/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. All Rights Reserved.
Portions of this file contain modifications contributed and copyrighted
by Percona Inc.. Those modifications are
@@ -258,11 +258,15 @@ struct os_aio_array_t{
os_event_t not_full;
/*!< The event which is set to the
signaled state when there is space in
- the aio outside the ibuf segment */
+ the aio outside the ibuf segment;
+ os_event_set() and os_event_reset()
+ are protected by os_aio_array_t::mutex */
os_event_t is_empty;
/*!< The event which is set to the
signaled state when there are no
- pending i/os in this array */
+ pending i/os in this array;
+ os_event_set() and os_event_reset()
+ are protected by os_aio_array_t::mutex */
ulint n_slots;/*!< Total number of slots in the aio
array. This must be divisible by
n_threads. */
@@ -304,8 +308,8 @@ struct os_aio_array_t{
#define OS_AIO_IO_SETUP_RETRY_ATTEMPTS 5
#endif
-/** Array of events used in simulated aio */
-static os_event_t* os_aio_segment_wait_events = NULL;
+/** Array of events used in simulated aio. */
+static os_event_t* os_aio_segment_wait_events;
/** The aio arrays for non-ibuf i/o and ibuf i/o, as well as sync aio. These
are NULL when the module has not yet been initialized. @{ */
@@ -342,16 +346,17 @@ static os_ib_mutex_t os_file_count_mutex;
#endif /* !UNIV_HOTBACKUP && (!HAVE_ATOMIC_BUILTINS || UNIV_WORD_SIZE < 8) */
/** Number of pending os_file_pread() operations */
-UNIV_INTERN ulint os_file_n_pending_preads = 0;
+UNIV_INTERN ulint os_file_n_pending_preads;
/** Number of pending os_file_pwrite() operations */
-UNIV_INTERN ulint os_file_n_pending_pwrites = 0;
+UNIV_INTERN ulint os_file_n_pending_pwrites;
/** Number of pending write operations */
-UNIV_INTERN ulint os_n_pending_writes = 0;
+UNIV_INTERN ulint os_n_pending_writes;
/** Number of pending read operations */
-UNIV_INTERN ulint os_n_pending_reads = 0;
+UNIV_INTERN ulint os_n_pending_reads;
+#if defined(WIN_ASYNC_IO) || defined(LINUX_NATIVE_AIO)
/** After first fallocate failure we will disable os_file_trim */
-UNIV_INTERN ibool os_fallocate_failed = FALSE;
+static bool os_fallocate_failed;
/**********************************************************************//**
Directly manipulate the allocated disk space by deallocating for the file referred to
@@ -360,11 +365,12 @@ Within the specified range, partial file system blocks are zeroed, and whole
file system blocks are removed from the file. After a successful call,
subsequent reads from this range will return zeroes.
@return true if success, false if error */
-UNIV_INTERN
+static
ibool
os_file_trim(
/*=========*/
os_aio_slot_t* slot); /*!< in: slot structure */
+#endif /* WIN_ASYNC_IO || LINUX_NATIVE_AIO */
/****************************************************************//**
Does error handling when a file operation fails.
@@ -1230,50 +1236,15 @@ next_file:
char* full_path;
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
next_file:
-#ifdef HAVE_READDIR_R
- ret = readdir_r(dir, (struct dirent*) dirent_buf, &ent);
-
- if (ret != 0
-#ifdef UNIV_AIX
- /* On AIX, only if we got non-NULL 'ent' (result) value and
- a non-zero 'ret' (return) value, it indicates a failed
- readdir_r() call. An NULL 'ent' with an non-zero 'ret'
- would indicate the "end of the directory" is reached. */
- && ent != NULL
-#endif
- ) {
- fprintf(stderr,
- "InnoDB: cannot read directory %s, error %lu\n",
- dirname, (ulong) 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
ut_a(strlen(ent->d_name) < OS_FILE_MAX_PATH);
if (strcmp(ent->d_name, ".") == 0 || strcmp(ent->d_name, "..") == 0) {
@@ -1601,9 +1572,13 @@ os_file_set_nocache_if_needed(os_file_t file, const char* name,
if (srv_unix_file_flush_method == SRV_UNIX_ALL_O_DIRECT
|| (type == OS_DATA_FILE
&& (srv_unix_file_flush_method == SRV_UNIX_O_DIRECT
- || (srv_unix_file_flush_method == SRV_UNIX_O_DIRECT_NO_FSYNC)))) {
- os_file_set_nocache(file, name, mode_str);
- }
+ || (srv_unix_file_flush_method
+ == SRV_UNIX_O_DIRECT_NO_FSYNC))))
+ /* Do fsync() on log files when setting O_DIRECT fails.
+ See log_io_complete() */
+ if (!os_file_set_nocache(file, name, mode_str)
+ && srv_unix_file_flush_method == SRV_UNIX_ALL_O_DIRECT)
+ srv_unix_file_flush_method = SRV_UNIX_O_DIRECT;
}
/****************************************************************//**
@@ -1811,9 +1786,10 @@ os_file_create_simple_no_error_handling_func(
}
/****************************************************************//**
-Tries to disable OS caching on an opened file descriptor. */
+Tries to disable OS caching on an opened file descriptor.
+@return TRUE if operation is success and FALSE otherwise */
UNIV_INTERN
-void
+bool
os_file_set_nocache(
/*================*/
os_file_t fd /*!< in: file descriptor to alter */
@@ -1834,6 +1810,7 @@ os_file_set_nocache(
"Failed to set DIRECTIO_ON on file %s: %s: %s, "
"continuing anyway.",
file_name, operation_name, strerror(errno_save));
+ return false;
}
#elif defined(O_DIRECT)
if (fcntl(fd, F_SETFL, O_DIRECT) == -1) {
@@ -1864,8 +1841,10 @@ short_warning:
"continuing anyway.",
file_name, operation_name, strerror(errno_save));
}
+ return false;
}
#endif /* defined(UNIV_SOLARIS) && defined(DIRECTIO_ON) */
+ return true;
}
@@ -2005,10 +1984,6 @@ os_file_create_func(
attributes |= FILE_FLAG_NO_BUFFERING;
#else
if (purpose == OS_FILE_AIO) {
-
- bool encrypt_later; /*!< should the page be encrypted
- before write */
-
#ifdef WIN_ASYNC_IO
/* If specified, use asynchronous (overlapped) io and no
buffering of writes in the OS */
@@ -2537,60 +2512,80 @@ os_file_get_size(
#endif /* __WIN__ */
}
-/***********************************************************************//**
-Write the specified number of zeros to a newly created file.
-@return TRUE if success */
+/** Set the size of a newly created file.
+@param[in] name file name
+@param[in] file file handle
+@param[in] size desired file size
+@param[in] sparse whether to create a sparse file (no preallocating)
+@return whether the operation succeeded */
UNIV_INTERN
-ibool
+bool
os_file_set_size(
-/*=============*/
- const char* name, /*!< in: name of the file or path as a
- null-terminated string */
- os_file_t file, /*!< in: handle to a file */
- os_offset_t size) /*!< in: file size */
+ const char* name,
+ os_file_t file,
+ os_offset_t size,
+ bool is_sparse)
{
- os_offset_t current_size;
- ibool ret;
- byte* buf;
- byte* buf2;
- ulint buf_size;
-
- current_size = 0;
+#ifdef _WIN32
+ FILE_END_OF_FILE_INFO feof;
+ feof.EndOfFile.QuadPart = size;
+ bool success = SetFileInformationByHandle(file,
+ FileEndOfFileInfo,
+ &feof, sizeof feof);
+ if (!success) {
+ ib_logf(IB_LOG_LEVEL_ERROR, "os_file_set_size() of file %s"
+ " to " INT64PF " bytes failed with %u",
+ name, size, GetLastError());
+ }
+ return(success);
+#else
+ if (is_sparse) {
+ bool success = !ftruncate(file, size);
+ if (!success) {
+ ib_logf(IB_LOG_LEVEL_ERROR, "ftruncate of file %s"
+ " to " INT64PF " bytes failed with error %d",
+ name, size, errno);
+ }
+ return(success);
+ }
-#ifdef HAVE_POSIX_FALLOCATE
+# ifdef HAVE_POSIX_FALLOCATE
if (srv_use_posix_fallocate) {
+ int err;
+ do {
+ err = posix_fallocate(file, 0, size);
+ } while (err == EINTR
+ && srv_shutdown_state == SRV_SHUTDOWN_NONE);
- if (posix_fallocate(file, current_size, size) == -1) {
-
- ib_logf(IB_LOG_LEVEL_ERROR, "preallocating file "
- "space for file \'%s\' failed. Current size "
- INT64PF ", desired size " INT64PF,
- name, current_size, size);
- os_file_handle_error_no_exit (name, "posix_fallocate",
- FALSE, __FILE__, __LINE__);
- return(FALSE);
+ if (err) {
+ ib_logf(IB_LOG_LEVEL_ERROR,
+ "preallocating " INT64PF " bytes for"
+ "file %s failed with error %d",
+ size, name, err);
}
- return(TRUE);
+ return(!err);
}
-#endif
+# endif
/* Write up to 1 megabyte at a time. */
- buf_size = ut_min(64, (ulint) (size / UNIV_PAGE_SIZE))
+ ulint buf_size = ut_min(64, (ulint) (size / UNIV_PAGE_SIZE))
* UNIV_PAGE_SIZE;
- buf2 = static_cast<byte*>(ut_malloc(buf_size + UNIV_PAGE_SIZE));
-
- /* Align the buffer for possible raw i/o */
- buf = static_cast<byte*>(ut_align(buf2, UNIV_PAGE_SIZE));
+ os_offset_t current_size = 0;
- /* Write buffer full of zeros */
- memset(buf, 0, buf_size);
+ byte* buf2 = static_cast<byte*>(calloc(1, buf_size + UNIV_PAGE_SIZE));
- if (size >= (os_offset_t) 100 << 20) {
-
- fprintf(stderr, "InnoDB: Progress in MB:");
+ if (!buf2) {
+ ib_logf(IB_LOG_LEVEL_ERROR,
+ "Cannot allocate " ULINTPF " bytes to extend file\n",
+ buf_size + UNIV_PAGE_SIZE);
+ return(false);
}
- while (current_size < size) {
+ /* Align the buffer for possible raw i/o */
+ byte* buf = static_cast<byte*>(ut_align(buf2, UNIV_PAGE_SIZE));
+ bool ret;
+
+ do {
ulint n_bytes;
if (size - current_size < (os_offset_t) buf_size) {
@@ -2602,37 +2597,16 @@ os_file_set_size(
ret = os_file_write(name, file, buf, current_size, n_bytes);
if (!ret) {
- ut_free(buf2);
- goto error_handling;
- }
-
- /* Print about progress for each 100 MB written */
- if ((current_size + n_bytes) / (100 << 20)
- != current_size / (100 << 20)) {
-
- fprintf(stderr, " %lu00",
- (ulong) ((current_size + n_bytes)
- / (100 << 20)));
+ break;
}
current_size += n_bytes;
- }
-
- if (size >= (os_offset_t) 100 << 20) {
-
- fprintf(stderr, "\n");
- }
-
- ut_free(buf2);
+ } while (current_size < size);
- ret = os_file_flush(file);
+ free(buf2);
- if (ret) {
- return(TRUE);
- }
-
-error_handling:
- return(FALSE);
+ return(ret && os_file_flush(file));
+#endif
}
/***********************************************************************//**
@@ -4435,13 +4409,6 @@ os_aio_init(
os_aio_validate();
- os_aio_segment_wait_events = static_cast<os_event_t*>(
- ut_malloc(n_segments * sizeof *os_aio_segment_wait_events));
-
- for (ulint i = 0; i < n_segments; ++i) {
- os_aio_segment_wait_events[i] = os_event_create();
- }
-
os_last_printout = ut_time();
#ifdef _WIN32
@@ -4451,8 +4418,18 @@ os_aio_init(
ut_a(completion_port && read_completion_port);
#endif
- return(TRUE);
+ if (srv_use_native_aio) {
+ return(TRUE);
+ }
+ os_aio_segment_wait_events = static_cast<os_event_t*>(
+ ut_malloc(n_segments * sizeof *os_aio_segment_wait_events));
+
+ for (ulint i = 0; i < n_segments; ++i) {
+ os_aio_segment_wait_events[i] = os_event_create();
+ }
+
+ return(TRUE);
}
/***********************************************************************
@@ -4480,8 +4457,10 @@ os_aio_free(void)
os_aio_array_free(os_aio_read_array);
- for (ulint i = 0; i < os_aio_n_segments; i++) {
- os_event_free(os_aio_segment_wait_events[i]);
+ if (!srv_use_native_aio) {
+ for (ulint i = 0; i < os_aio_n_segments; i++) {
+ os_event_free(os_aio_segment_wait_events[i]);
+ }
}
#if !defined(HAVE_ATOMIC_BUILTINS) || UNIV_WORD_SIZE < 8
@@ -4541,22 +4520,17 @@ os_aio_wake_all_threads_at_shutdown(void)
if (os_aio_log_array != 0) {
os_aio_array_wake_win_aio_at_shutdown(os_aio_log_array);
}
-
#elif defined(LINUX_NATIVE_AIO)
-
/* When using native AIO interface the io helper threads
wait on io_getevents with a timeout value of 500ms. At
each wake up these threads check the server status.
No need to do anything to wake them up. */
+#endif /* !WIN_ASYNC_AIO */
if (srv_use_native_aio) {
return;
}
- /* Fall through to simulated AIO handler wakeup if we are
- not using native AIO. */
-#endif /* !WIN_ASYNC_AIO */
-
/* This loop wakes up all simulated ai/o threads */
for (ulint i = 0; i < os_aio_n_segments; i++) {
@@ -4939,6 +4913,7 @@ os_aio_simulated_wake_handler_threads(void)
}
}
+#ifdef _WIN32
/**********************************************************************//**
This function can be called if one wants to post a batch of reads and
prefers an i/o-handler thread to handle them all at once later. You must
@@ -4946,15 +4921,14 @@ call os_aio_simulated_wake_handler_threads later to ensure the threads
are not left sleeping! */
UNIV_INTERN
void
-os_aio_simulated_put_read_threads_to_sleep(void)
-/*============================================*/
+os_aio_simulated_put_read_threads_to_sleep()
{
/* The idea of putting background IO threads to sleep is only for
Windows when using simulated AIO. Windows XP seems to schedule
background threads too eagerly to allow for coalescing during
readahead requests. */
-#ifdef __WIN__
+
os_aio_array_t* array;
if (srv_use_native_aio) {
@@ -4973,8 +4947,8 @@ readahead requests. */
os_event_reset(os_aio_segment_wait_events[i]);
}
}
-#endif /* __WIN__ */
}
+#endif /* _WIN32 */
#if defined(LINUX_NATIVE_AIO)
/*******************************************************************//**
@@ -5364,7 +5338,7 @@ os_aio_windows_handle(
}
if (slot->type == OS_FILE_WRITE) {
- if (!slot->is_log && srv_use_trim && os_fallocate_failed == FALSE) {
+ if (!slot->is_log && srv_use_trim && !os_fallocate_failed) {
// Deallocate unused blocks from file system
os_file_trim(slot);
}
@@ -5460,7 +5434,8 @@ retry:
ut_a(slot->pos < end_pos);
if (slot->type == OS_FILE_WRITE) {
- if (!slot->is_log && srv_use_trim && os_fallocate_failed == FALSE) {
+ if (!slot->is_log && srv_use_trim
+ && !os_fallocate_failed) {
// Deallocate unused blocks from file system
os_file_trim(slot);
}
@@ -6178,11 +6153,12 @@ os_aio_print(
srv_io_thread_op_info[i],
srv_io_thread_function[i]);
-#ifndef __WIN__
- if (os_aio_segment_wait_events[i]->is_set()) {
+#ifndef _WIN32
+ if (!srv_use_native_aio
+ && os_aio_segment_wait_events[i]->is_set()) {
fprintf(file, " ev set");
}
-#endif /* __WIN__ */
+#endif /* _WIN32 */
fprintf(file, "\n");
}
@@ -6361,6 +6337,7 @@ typedef struct _FILE_LEVEL_TRIM {
#endif
#endif
+#if defined(WIN_ASYNC_IO) || defined(LINUX_NATIVE_AIO)
/**********************************************************************//**
Directly manipulate the allocated disk space by deallocating for the file referred to
by fd for the byte range starting at offset and continuing for len bytes.
@@ -6368,7 +6345,7 @@ Within the specified range, partial file system blocks are zeroed, and whole
file system blocks are removed from the file. After a successful call,
subsequent reads from this range will return zeroes.
@return true if success, false if error */
-UNIV_INTERN
+static
ibool
os_file_trim(
/*=========*/
@@ -6413,13 +6390,13 @@ os_file_trim(
if (ret) {
/* After first failure do not try to trim again */
- os_fallocate_failed = TRUE;
+ os_fallocate_failed = true;
srv_use_trim = FALSE;
- ut_print_timestamp(stderr);
- fprintf(stderr,
- " InnoDB: Warning: fallocate call failed with error code %d.\n"
- " InnoDB: start: %lu len: %lu payload: %lu\n"
- " InnoDB: Disabling fallocate for now.\n", errno, (ulong) off, (ulong) trim_len, (ulong) len);
+ ib_logf(IB_LOG_LEVEL_WARN,
+ "fallocate() failed with error %d."
+ " start: " UINT64PF " len: " ULINTPF " payload: " ULINTPF "."
+ " Disabling fallocate for now.",
+ errno, off, ulint(trim_len), ulint(len));
os_file_handle_error_no_exit(slot->name,
" fallocate(FALLOC_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE) ",
@@ -6440,7 +6417,7 @@ os_file_trim(
fprintf(stderr,
" InnoDB: Warning: fallocate not supported on this installation."
" InnoDB: Disabling fallocate for now.");
- os_fallocate_failed = TRUE;
+ os_fallocate_failed = true;
srv_use_trim = FALSE;
if (slot->write_size) {
*slot->write_size = 0;
@@ -6460,7 +6437,7 @@ os_file_trim(
if (!ret) {
/* After first failure do not try to trim again */
- os_fallocate_failed = TRUE;
+ os_fallocate_failed = true;
srv_use_trim = FALSE;
ut_print_timestamp(stderr);
fprintf(stderr,
@@ -6514,6 +6491,7 @@ os_file_trim(
return (TRUE);
}
+#endif /* WIN_ASYNC_IO || LINUX_NATIVE_AIO */
/***********************************************************************//**
Try to get number of bytes per sector from file system.
diff --git a/storage/xtradb/os/os0thread.cc b/storage/xtradb/os/os0thread.cc
index 5ddc40b0eeb..8baf06b9bb7 100644
--- a/storage/xtradb/os/os0thread.cc
+++ b/storage/xtradb/os/os0thread.cc
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1995, 2013, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -206,29 +206,32 @@ os_thread_create_func(
#endif
}
-/**
-Waits until the specified thread completes and joins it. Its return value is
-ignored.
-
-@param thread thread to join */
+/** Waits until the specified thread completes and joins it.
+Its return value is ignored.
+@param[in,out] thread thread to join */
UNIV_INTERN
void
os_thread_join(
os_thread_t thread)
{
- /*This function is currently only used to workaround glibc bug
+ /* This function is currently only used to workaround glibc bug
described in http://bugs.mysql.com/bug.php?id=82886
On Windows, no workarounds are necessary, all threads
are "detached" upon thread exit (handle is closed), so we do
nothing.
*/
-#ifndef _WIN32
- int ret MY_ATTRIBUTE((unused)) = pthread_join(thread, NULL);
+#ifdef __WIN__
+ /* Do nothing. */
+#else
+#ifdef UNIV_DEBUG
+ const int ret MY_ATTRIBUTE((unused)) =
+#endif /* UNIV_DEBUG */
+ pthread_join(thread, NULL);
- /* Waiting on already-quit threads is allowed */
+ /* Waiting on already-quit threads is allowed. */
ut_ad(ret == 0 || ret == ESRCH);
-#endif
+#endif /* __WIN__ */
}
/*****************************************************************//**
@@ -257,8 +260,9 @@ os_thread_exit(
#ifdef __WIN__
ExitThread((DWORD) exit_value);
#else
- if (detach)
+ if (detach) {
pthread_detach(pthread_self());
+ }
pthread_exit(exit_value);
#endif
}
diff --git a/storage/xtradb/page/page0page.cc b/storage/xtradb/page/page0page.cc
index a6fba4074ef..3f8e47adafd 100644
--- a/storage/xtradb/page/page0page.cc
+++ b/storage/xtradb/page/page0page.cc
@@ -1455,7 +1455,6 @@ page_dir_split_slot(
ulint i;
ulint n_owned;
- ut_ad(page);
ut_ad(!page_zip || page_is_comp(page));
ut_ad(slot_no > 0);
@@ -1517,7 +1516,6 @@ page_dir_balance_slot(
rec_t* old_rec;
rec_t* new_rec;
- ut_ad(page);
ut_ad(!page_zip || page_is_comp(page));
ut_ad(slot_no > 0);
diff --git a/storage/xtradb/page/page0zip.cc b/storage/xtradb/page/page0zip.cc
index 04340c0f3d2..32e76fb44e6 100644
--- a/storage/xtradb/page/page0zip.cc
+++ b/storage/xtradb/page/page0zip.cc
@@ -4810,8 +4810,6 @@ page_zip_parse_compress(
ulint size;
ulint trailer_size;
- ut_ad(ptr != NULL);
- ut_ad(end_ptr != NULL);
ut_ad(!page == !page_zip);
if (UNIV_UNLIKELY(ptr + (2 + 2) > end_ptr)) {
diff --git a/storage/xtradb/pars/pars0pars.cc b/storage/xtradb/pars/pars0pars.cc
index e6af3d25e86..ce61d6e1e3b 100644
--- a/storage/xtradb/pars/pars0pars.cc
+++ b/storage/xtradb/pars/pars0pars.cc
@@ -2020,7 +2020,7 @@ pars_create_table(
}
node = tab_create_graph_create(table, pars_sym_tab_global->heap, true,
- FIL_SPACE_ENCRYPTION_DEFAULT, FIL_DEFAULT_ENCRYPTION_KEY);
+ FIL_ENCRYPTION_DEFAULT, FIL_DEFAULT_ENCRYPTION_KEY);
table_sym->resolved = TRUE;
table_sym->token_type = SYM_TABLE;
diff --git a/storage/xtradb/rem/rem0rec.cc b/storage/xtradb/rem/rem0rec.cc
index b9496b7f620..6770748c38b 100644
--- a/storage/xtradb/rem/rem0rec.cc
+++ b/storage/xtradb/rem/rem0rec.cc
@@ -789,7 +789,7 @@ rec_get_nth_field_offs_old(
/**********************************************************//**
Determines the size of a data tuple prefix in ROW_FORMAT=COMPACT.
@return total size */
-UNIV_INLINE MY_ATTRIBUTE((warn_unused_result, nonnull(1,2)))
+UNIV_INLINE MY_ATTRIBUTE((warn_unused_result))
ulint
rec_get_converted_size_comp_prefix_low(
/*===================================*/
diff --git a/storage/xtradb/row/row0ftsort.cc b/storage/xtradb/row/row0ftsort.cc
index fb78808ae80..29ddffd2587 100644
--- a/storage/xtradb/row/row0ftsort.cc
+++ b/storage/xtradb/row/row0ftsort.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 2010, 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
@@ -224,7 +224,14 @@ row_fts_psort_info_init(
common_info->sort_event = os_event_create();
common_info->merge_event = os_event_create();
common_info->opt_doc_id_size = opt_doc_id_size;
- crypt_data = fil_space_get_crypt_data(new_table->space);
+
+ /* Theoretically the tablespace can be dropped straight away.
+ In practice, the DDL completion will wait for this thread to
+ finish. */
+ if (fil_space_t* space = fil_space_acquire(new_table->space)) {
+ crypt_data = space->crypt_data;
+ fil_space_release(space);
+ }
if (crypt_data && crypt_data->should_encrypt()) {
common_info->crypt_data = crypt_data;
diff --git a/storage/xtradb/row/row0import.cc b/storage/xtradb/row/row0import.cc
index 6170eb66195..6dc01907710 100644
--- a/storage/xtradb/row/row0import.cc
+++ b/storage/xtradb/row/row0import.cc
@@ -40,6 +40,7 @@ Created 2012-02-08 by Sunny Bains.
#include "row0mysql.h"
#include "srv0start.h"
#include "row0quiesce.h"
+#include "buf0buf.h"
#include <vector>
@@ -1873,10 +1874,10 @@ PageConverter::update_index_page(
if (index == 0) {
ib_logf(IB_LOG_LEVEL_ERROR,
- "Page for tablespace %lu is "
- " index page with id %lu but that"
+ "Page for tablespace " ULINTPF " is "
+ " index page with id " IB_ID_FMT " but that"
" index is not found from configuration file."
- " Current index name %s and id %lu.",
+ " Current index name %s and id " IB_ID_FMT ".",
m_space,
id,
m_index->m_name,
@@ -2036,12 +2037,15 @@ PageConverter::validate(
buf_block_t* block) UNIV_NOTHROW
{
buf_frame_t* page = get_frame(block);
+ ulint space_id = mach_read_from_4(
+ page + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID);
+ fil_space_t* space = fil_space_found_by_id(space_id);
/* Check that the page number corresponds to the offset in
the file. Flag as corrupt if it doesn't. Disable the check
for LSN in buf_page_is_corrupted() */
- if (buf_page_is_corrupted(false, page, get_zip_size())
+ if (buf_page_is_corrupted(false, page, get_zip_size(), space)
|| (page_get_page_no(page) != offset / m_page_size
&& page_get_page_no(page) != 0)) {
diff --git a/storage/xtradb/row/row0merge.cc b/storage/xtradb/row/row0merge.cc
index ed8ab600611..72be305d481 100644
--- a/storage/xtradb/row/row0merge.cc
+++ b/storage/xtradb/row/row0merge.cc
@@ -112,9 +112,8 @@ row_merge_encrypt_buf(
"Unable to encrypt data-block "
" src: %p srclen: %lu buf: %p buflen: %u."
" return-code: %d. Can't continue!\n",
- input_buf, (ulong) srv_sort_buf_size,
+ input_buf, srv_sort_buf_size,
crypted_buf, dstlen, rc);
- ut_error;
}
}
@@ -154,9 +153,8 @@ row_merge_decrypt_buf(
"Unable to encrypt data-block "
" src: %p srclen: %lu buf: %p buflen: %d."
" return-code: %d. Can't continue!\n",
- input_buf, (ulong) srv_sort_buf_size,
+ input_buf, srv_sort_buf_size,
crypted_buf, dstlen, rc);
- ut_error;
}
return (true);
@@ -1073,14 +1071,8 @@ row_merge_read_rec(
ulint data_size;
ulint avail_size;
- ut_ad(block);
- ut_ad(buf);
ut_ad(b >= &block[0]);
ut_ad(b < &block[srv_sort_buf_size]);
- ut_ad(index);
- ut_ad(foffs);
- ut_ad(mrec);
- ut_ad(offsets);
ut_ad(*offsets == 1 + REC_OFFS_HEADER_SIZE
+ dict_index_get_n_fields(index));
@@ -3959,7 +3951,7 @@ row_merge_build_indexes(
{
merge_file_t* merge_files;
row_merge_block_t* block;
- row_merge_block_t* crypt_block;
+ row_merge_block_t* crypt_block = NULL;
ulint block_size;
ulint i;
ulint j;
@@ -3995,9 +3987,15 @@ row_merge_build_indexes(
DBUG_RETURN(DB_OUT_OF_MEMORY);
}
- /* Get crypt data from tablespace if present. */
- crypt_data = fil_space_get_crypt_data(new_table->space);
- crypt_block = NULL;
+ /* Get crypt data from tablespace if present. We should be protected
+ from concurrent DDL (e.g. drop table) by MDL-locks. */
+ fil_space_t* space = fil_space_acquire(new_table->space);
+
+ if (space) {
+ crypt_data = space->crypt_data;
+ } else {
+ DBUG_RETURN(DB_TABLESPACE_NOT_FOUND);
+ }
/* If tablespace is encrypted, allocate additional buffer for
encryption/decryption. */
@@ -4172,8 +4170,8 @@ wait_again:
for (j = 0; j < FTS_NUM_AUX_INDEX;
j++) {
- os_thread_join(merge_info[j]
- .thread_hdl);
+ os_thread_join(merge_info[j]
+ .thread_hdl);
}
}
} else {
@@ -4361,5 +4359,9 @@ func_exit:
}
}
+ if (space) {
+ fil_space_release(space);
+ }
+
DBUG_RETURN(error);
}
diff --git a/storage/xtradb/row/row0mysql.cc b/storage/xtradb/row/row0mysql.cc
index c81b10b93f1..7c8636d354f 100644
--- a/storage/xtradb/row/row0mysql.cc
+++ b/storage/xtradb/row/row0mysql.cc
@@ -1373,6 +1373,8 @@ run_again:
row_ins_step(thr);
+ DEBUG_SYNC_C("ib_after_row_insert_step");
+
err = trx->error_state;
if (err != DB_SUCCESS) {
@@ -3308,21 +3310,17 @@ void
fil_wait_crypt_bg_threads(
dict_table_t* table)
{
- uint start = time(0);
- uint last = start;
-
- if (table->space != 0) {
- fil_space_crypt_mark_space_closing(table->space, table->crypt_data);
- }
+ time_t start = time(0);
+ time_t last = start;
while (table->n_ref_count > 0) {
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) {
fprintf(stderr,
- "WARNING: waited %u seconds "
+ "WARNING: waited %ld seconds "
"for ref-count on table: %s space: %u\n",
now - start, table->name, table->space);
last = now;
@@ -3330,7 +3328,7 @@ fil_wait_crypt_bg_threads(
if (now >= start + 300) {
fprintf(stderr,
- "WARNING: after %u seconds, gave up waiting "
+ "WARNING: after %ld seconds, gave up waiting "
"for ref-count on table: %s space: %u\n",
now - start, table->name, table->space);
break;
@@ -3526,35 +3524,40 @@ row_truncate_table_for_mysql(
if (table->space && !DICT_TF2_FLAG_IS_SET(table, DICT_TF2_TEMPORARY)) {
/* Discard and create the single-table tablespace. */
- fil_space_crypt_t* crypt_data;
- ulint space = table->space;
- ulint flags = fil_space_get_flags(space);
+ ulint space_id = table->space;
+ ulint flags = ULINT_UNDEFINED;
ulint key_id = FIL_DEFAULT_ENCRYPTION_KEY;
- fil_encryption_t mode = FIL_SPACE_ENCRYPTION_DEFAULT;
+ fil_encryption_t mode = FIL_ENCRYPTION_DEFAULT;
dict_get_and_save_data_dir_path(table, true);
- crypt_data = fil_space_get_crypt_data(space);
- if (crypt_data) {
- key_id = crypt_data->key_id;
- mode = crypt_data->encryption;
+ if (fil_space_t* space = fil_space_acquire(space_id)) {
+ fil_space_crypt_t* crypt_data = space->crypt_data;
+
+ if (crypt_data) {
+ key_id = crypt_data->key_id;
+ mode = crypt_data->encryption;
+ }
+
+ flags = space->flags;
+ fil_space_release(space);
}
if (flags != ULINT_UNDEFINED
- && fil_discard_tablespace(space) == DB_SUCCESS) {
+ && fil_discard_tablespace(space_id) == DB_SUCCESS) {
dict_index_t* index;
- dict_hdr_get_new_id(NULL, NULL, &space);
+ dict_hdr_get_new_id(NULL, NULL, &space_id);
/* Lock all index trees for this table. We must
do so after dict_hdr_get_new_id() to preserve
the latch order */
dict_table_x_lock_indexes(table);
- if (space == ULINT_UNDEFINED
+ if (space_id == ULINT_UNDEFINED
|| fil_create_new_single_table_tablespace(
- space, table->name,
+ space_id, table->name,
table->data_dir_path,
flags, table->flags2,
FIL_IBD_FILE_INITIAL_SIZE,
@@ -3572,21 +3575,21 @@ row_truncate_table_for_mysql(
goto funct_exit;
}
- recreate_space = space;
+ recreate_space = space_id;
/* Replace the space_id in the data dictionary cache.
The persisent data dictionary (SYS_TABLES.SPACE
and SYS_INDEXES.SPACE) are updated later in this
function. */
- table->space = space;
+ table->space = space_id;
index = dict_table_get_first_index(table);
do {
- index->space = space;
+ index->space = space_id;
index = dict_table_get_next_index(index);
} while (index);
mtr_start_trx(&mtr, trx);
- fsp_header_init(space,
+ fsp_header_init(space_id,
FIL_IBD_FILE_INITIAL_SIZE, &mtr);
mtr_commit(&mtr);
}
@@ -4260,7 +4263,13 @@ row_drop_table_for_mysql(
/* If table has not yet have crypt_data, try to read it to
make freeing the table easier. */
if (!table->crypt_data) {
- table->crypt_data = fil_space_get_crypt_data(table->space);
+
+ if (fil_space_t* space = fil_space_acquire_silent(table->space)) {
+ /* We use crypt data in dict_table_t in ha_innodb.cc
+ to push warnings to user thread. */
+ table->crypt_data = space->crypt_data;
+ fil_space_release(space);
+ }
}
/* We use the private SQL parser of Innobase to generate the
diff --git a/storage/xtradb/row/row0purge.cc b/storage/xtradb/row/row0purge.cc
index bc2e0b0e1cb..35b3520749b 100644
--- a/storage/xtradb/row/row0purge.cc
+++ b/storage/xtradb/row/row0purge.cc
@@ -897,7 +897,7 @@ row_purge_record_func(
Fetches an undo log record and does the purge for the recorded operation.
If none left, or the current purge completed, returns the control to the
parent node, which is always a query thread node. */
-static MY_ATTRIBUTE((nonnull))
+static
void
row_purge(
/*======*/
diff --git a/storage/xtradb/row/row0upd.cc b/storage/xtradb/row/row0upd.cc
index 69206efd530..1156cbe4b4c 100644
--- a/storage/xtradb/row/row0upd.cc
+++ b/storage/xtradb/row/row0upd.cc
@@ -1285,8 +1285,6 @@ row_upd_index_replace_new_col_vals_index_pos(
ulint n_fields;
const ulint zip_size = dict_table_zip_size(index->table);
- ut_ad(index);
-
dtuple_set_info_bits(entry, update->info_bits);
if (order_only) {
@@ -1471,8 +1469,6 @@ row_upd_changes_ord_field_binary_func(
ulint i;
const dict_index_t* clust_index;
- ut_ad(index);
- ut_ad(update);
ut_ad(thr);
ut_ad(thr->graph);
ut_ad(thr->graph->trx);
diff --git a/storage/xtradb/srv/srv0conc.cc b/storage/xtradb/srv/srv0conc.cc
index a8e7e2ab1aa..e90f744cfa4 100644
--- a/storage/xtradb/srv/srv0conc.cc
+++ b/storage/xtradb/srv/srv0conc.cc
@@ -1,6 +1,7 @@
/*****************************************************************************
Copyright (c) 2011, 2012, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2017, MariaDB Corporation. All Rights Reserved.
Portions of this file contain modifications contributed and copyrighted by
Google, Inc. Those modifications are gratefully acknowledged and are described
@@ -79,7 +80,9 @@ typedef UT_LIST_NODE_T(struct srv_conc_slot_t) srv_conc_node_t;
/** Slot for a thread waiting in the concurrency control queue. */
struct srv_conc_slot_t{
- os_event_t event; /*!< event to wait */
+ os_event_t event; /*!< event to wait for;
+ os_event_set() and os_event_reset()
+ are protected by srv_conc_mutex */
ibool reserved; /*!< TRUE if slot
reserved */
ibool wait_ended; /*!< TRUE when another thread has
@@ -378,11 +381,11 @@ srv_conc_exit_innodb_without_atomics(
}
}
- os_fast_mutex_unlock(&srv_conc_mutex);
-
if (slot != NULL) {
os_event_set(slot->event);
}
+
+ os_fast_mutex_unlock(&srv_conc_mutex);
}
/*********************************************************************//**
diff --git a/storage/xtradb/srv/srv0srv.cc b/storage/xtradb/srv/srv0srv.cc
index 42d667b111c..f8c8c330f0c 100644
--- a/storage/xtradb/srv/srv0srv.cc
+++ b/storage/xtradb/srv/srv0srv.cc
@@ -79,12 +79,6 @@ Created 10/8/1995 Heikki Tuuri
#include <my_rdtsc.h>
#include "btr0scrub.h"
-/* prototypes of new functions added to ha_innodb.cc for kill_idle_transaction */
-ibool innobase_thd_is_idle(const void* thd);
-ib_int64_t innobase_thd_get_start_time(const void* thd);
-void innobase_thd_kill(ulong thd_id);
-ulong innobase_thd_get_thread_id(const void* thd);
-
/* prototypes for new functions added to ha_innodb.cc */
ibool innobase_get_slow_log();
@@ -474,11 +468,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. */
UNIV_INTERN ulong srv_force_recovery;
-#ifndef DBUG_OFF
-/** Inject a crash at different steps of the recovery process.
-This is for testing and debugging only. */
-UNIV_INTERN ulong srv_force_recovery_crash;
-#endif /* !DBUG_OFF */
/** Print all user-level transactions deadlocks to mysqld stderr */
@@ -511,6 +500,7 @@ this many index pages, there are 2 ways to calculate statistics:
table/index are not found in the innodb database */
UNIV_INTERN unsigned long long srv_stats_transient_sample_pages = 8;
UNIV_INTERN my_bool srv_stats_persistent = TRUE;
+UNIV_INTERN my_bool srv_stats_include_delete_marked = FALSE;
UNIV_INTERN unsigned long long srv_stats_persistent_sample_pages = 20;
UNIV_INTERN my_bool srv_stats_auto_recalc = TRUE;
@@ -609,7 +599,7 @@ UNIV_INTERN const char* srv_io_thread_function[SRV_MAX_N_IO_THREADS];
UNIV_INTERN time_t srv_last_monitor_time;
-UNIV_INTERN ib_mutex_t srv_innodb_monitor_mutex;
+static ib_mutex_t srv_innodb_monitor_mutex;
/* Mutex for locking srv_monitor_file. Not created if srv_read_only_mode */
UNIV_INTERN ib_mutex_t srv_monitor_file_mutex;
@@ -795,7 +785,11 @@ struct srv_sys_t{
ulint n_sys_threads; /*!< size of the sys_threads
array */
- srv_slot_t* sys_threads; /*!< server thread table */
+ srv_slot_t* sys_threads; /*!< server thread table;
+ os_event_set() and
+ os_event_reset() on
+ sys_threads[]->event are
+ covered by srv_sys_t::mutex */
ulint n_threads_active[SRV_MASTER + 1];
/*!< number of threads active
@@ -817,13 +811,16 @@ UNIV_INTERN ib_mutex_t server_mutex;
static srv_sys_t* srv_sys = NULL;
-/** Event to signal the monitor thread. */
+/** Event to signal srv_monitor_thread. Not protected by a mutex.
+Set after setting srv_print_innodb_monitor. */
UNIV_INTERN os_event_t srv_monitor_event;
-/** Event to signal the error thread */
+/** Event to signal the shutdown of srv_error_monitor_thread.
+Not protected by a mutex. */
UNIV_INTERN os_event_t srv_error_event;
-/** Event to signal the buffer pool dump/load thread */
+/** Event for waking up buf_dump_thread. Not protected by a mutex.
+Set on shutdown or by buf_dump_start() or buf_load_start(). */
UNIV_INTERN os_event_t srv_buf_dump_event;
/** The buffer pool dump/load file name */
@@ -993,7 +990,6 @@ srv_suspend_thread_low(
/*===================*/
srv_slot_t* slot) /*!< in/out: thread slot */
{
-
ut_ad(!srv_read_only_mode);
ut_ad(srv_sys_mutex_own());
@@ -1051,34 +1047,71 @@ srv_suspend_thread(
return(sig_count);
}
-/*********************************************************************//**
-Releases threads of the type given from suspension in the thread table.
-NOTE! The server mutex has to be reserved by the caller!
-@return number of threads released: this may be less than n if not
- enough threads were suspended at the moment. */
-UNIV_INTERN
-ulint
-srv_release_threads(
-/*================*/
- srv_thread_type type, /*!< in: thread type */
- ulint n) /*!< in: number of threads to release */
+/** Resume the calling thread.
+@param[in,out] slot thread slot
+@param[in] sig_count signal count (if wait)
+@param[in] wait whether to wait for the event
+@param[in] timeout_usec timeout in microseconds (0=infinite)
+@return whether the wait timed out */
+static
+bool
+srv_resume_thread(srv_slot_t* slot, ib_int64_t sig_count = 0, bool wait = true,
+ ulint timeout_usec = 0)
+{
+ bool timeout;
+
+ ut_ad(!srv_read_only_mode);
+ ut_ad(slot->in_use);
+ ut_ad(slot->suspended);
+
+ if (!wait) {
+ timeout = false;
+ } else if (timeout_usec) {
+ timeout = OS_SYNC_TIME_EXCEEDED == os_event_wait_time_low(
+ slot->event, timeout_usec, sig_count);
+ } else {
+ timeout = false;
+ os_event_wait_low(slot->event, sig_count);
+ }
+
+ srv_sys_mutex_enter();
+ ut_ad(slot->in_use);
+ ut_ad(slot->suspended);
+
+ slot->suspended = FALSE;
+ ++srv_sys->n_threads_active[slot->type];
+ srv_sys_mutex_exit();
+ return(timeout);
+}
+
+/** Ensure that a given number of threads of the type given are running
+(or are already terminated).
+@param[in] type thread type
+@param[in] n number of threads that have to run */
+void
+srv_release_threads(enum srv_thread_type type, ulint n)
{
- ulint i;
- ulint count = 0;
+ ulint running;
ut_ad(srv_thread_type_validate(type));
ut_ad(n > 0);
- srv_sys_mutex_enter();
+ do {
+ running = 0;
- for (i = 0; i < srv_sys->n_sys_threads; i++) {
- srv_slot_t* slot;
+ srv_sys_mutex_enter();
- slot = &srv_sys->sys_threads[i];
+ for (ulint i = 0; i < srv_sys->n_sys_threads; i++) {
+ srv_slot_t* slot = &srv_sys->sys_threads[i];
- if (slot->in_use
- && srv_slot_get_type(slot) == type
- && slot->suspended) {
+ if (!slot->in_use || srv_slot_get_type(slot) != type) {
+ continue;
+ } else if (!slot->suspended) {
+ if (++running >= n) {
+ break;
+ }
+ continue;
+ }
switch (type) {
case SRV_NONE:
@@ -1108,21 +1141,11 @@ srv_release_threads(
break;
}
- slot->suspended = FALSE;
-
- ++srv_sys->n_threads_active[type];
-
os_event_set(slot->event);
-
- if (++count == n) {
- break;
- }
}
- }
- srv_sys_mutex_exit();
-
- return(count);
+ srv_sys_mutex_exit();
+ } while (running && running < n);
}
/*********************************************************************//**
@@ -1135,11 +1158,8 @@ srv_free_slot(
{
srv_sys_mutex_enter();
- if (!slot->suspended) {
- /* Mark the thread as inactive. */
- srv_suspend_thread_low(slot);
- }
-
+ /* Mark the thread as inactive. */
+ srv_suspend_thread_low(slot);
/* Free the slot for reuse. */
ut_ad(slot->in_use);
slot->in_use = FALSE;
@@ -1259,16 +1279,22 @@ srv_free(void)
os_event_free(srv_sys->sys_threads[i].event);
os_event_free(srv_error_event);
+ srv_error_event = NULL;
os_event_free(srv_monitor_event);
+ srv_monitor_event = NULL;
os_event_free(srv_buf_dump_event);
+ srv_buf_dump_event = NULL;
os_event_free(srv_checkpoint_completed_event);
+ srv_checkpoint_completed_event = NULL;
os_event_free(srv_redo_log_tracked_event);
+ srv_redo_log_tracked_event = NULL;
mutex_free(&srv_sys->mutex);
mutex_free(&srv_sys->tasks_mutex);
}
#ifdef WITH_INNODB_DISALLOW_WRITES
os_event_free(srv_allow_writes_event);
+ srv_allow_writes_event = NULL;
#endif /* WITH_INNODB_DISALLOW_WRITES */
#ifndef HAVE_ATOMIC_BUILTINS
@@ -1450,22 +1476,26 @@ srv_printf_innodb_monitor(
low level 135. Therefore we can reserve the latter mutex here without
a danger of a deadlock of threads. */
- mutex_enter(&dict_foreign_err_mutex);
+ if (!recv_recovery_on) {
- if (!srv_read_only_mode && ftell(dict_foreign_err_file) != 0L) {
- fputs("------------------------\n"
- "LATEST FOREIGN KEY ERROR\n"
- "------------------------\n", file);
- ut_copy_file(file, dict_foreign_err_file);
- }
+ mutex_enter(&dict_foreign_err_mutex);
- mutex_exit(&dict_foreign_err_mutex);
+ if (!srv_read_only_mode
+ && ftell(dict_foreign_err_file) != 0L) {
+ fputs("------------------------\n"
+ "LATEST FOREIGN KEY ERROR\n"
+ "------------------------\n", file);
+ ut_copy_file(file, dict_foreign_err_file);
+ }
+
+ mutex_exit(&dict_foreign_err_mutex);
+ }
/* Only if lock_print_info_summary proceeds correctly,
before we call the lock_print_info_all_transactions
to print all the lock information. IMPORTANT NOTE: This
function acquires the lock mutex on success. */
- ret = lock_print_info_summary(file, nowait);
+ ret = recv_recovery_on ? FALSE : lock_print_info_summary(file, nowait);
if (ret) {
if (trx_start_pos) {
@@ -1498,10 +1528,13 @@ srv_printf_innodb_monitor(
"--------\n", file);
os_aio_print(file);
- fputs("-------------------------------------\n"
- "INSERT BUFFER AND ADAPTIVE HASH INDEX\n"
- "-------------------------------------\n", file);
- ibuf_print(file);
+ if (!recv_recovery_on) {
+
+ fputs("-------------------------------------\n"
+ "INSERT BUFFER AND ADAPTIVE HASH INDEX\n"
+ "-------------------------------------\n", file);
+ ibuf_print(file);
+ }
fprintf(file,
@@ -1513,10 +1546,13 @@ srv_printf_innodb_monitor(
btr_cur_n_sea_old = btr_cur_n_sea;
btr_cur_n_non_sea_old = btr_cur_n_non_sea;
- fputs("---\n"
- "LOG\n"
- "---\n", file);
- log_print(file);
+ if (!recv_recovery_on) {
+
+ fputs("---\n"
+ "LOG\n"
+ "---\n", file);
+ log_print(file);
+ }
fputs("----------------------\n"
"BUFFER POOL AND MEMORY\n"
@@ -1611,8 +1647,9 @@ srv_printf_innodb_monitor(
? (recv_sys->addr_hash->n_cells * sizeof(hash_cell_t)) : 0),
recv_sys_subtotal);
+
fprintf(file, "Dictionary memory allocated " ULINTPF "\n",
- dict_sys->size);
+ dict_sys ? dict_sys->size : 0);
buf_print_io(file);
@@ -1720,6 +1757,10 @@ srv_printf_innodb_monitor(
mutex_exit(&srv_innodb_monitor_mutex);
fflush(file);
+#ifndef DBUG_OFF
+ srv_debug_monitor_printed = true;
+#endif
+
return(ret);
}
@@ -2071,6 +2112,8 @@ srv_export_innodb_status(void)
crypt_stat.estimated_iops;
export_vars.innodb_encryption_key_requests =
srv_stats.n_key_requests;
+ export_vars.innodb_key_rotation_list_length =
+ srv_stats.key_rotation_list_length;
export_vars.innodb_scrub_page_reorganizations =
scrub_stat.page_reorganizations;
@@ -2088,6 +2131,12 @@ srv_export_innodb_status(void)
mutex_exit(&srv_innodb_monitor_mutex);
}
+#ifndef DBUG_OFF
+/** false before InnoDB monitor has been printed at least once, true
+afterwards */
+bool srv_debug_monitor_printed = false;
+#endif
+
/*********************************************************************//**
A thread which prints the info output by various InnoDB monitors.
@return a dummy parameter */
@@ -2361,36 +2410,6 @@ loop:
old_sema = sema;
}
- if (srv_kill_idle_transaction && trx_sys) {
- trx_t* trx;
- time_t now;
-rescan_idle:
- now = time(NULL);
- mutex_enter(&trx_sys->mutex);
- trx = UT_LIST_GET_FIRST(trx_sys->mysql_trx_list);
- while (trx) {
- if (trx->state == TRX_STATE_ACTIVE
- && trx->mysql_thd
- && innobase_thd_is_idle(trx->mysql_thd)) {
- ib_int64_t start_time = innobase_thd_get_start_time(trx->mysql_thd);
- ulong thd_id = innobase_thd_get_thread_id(trx->mysql_thd);
-
- if (trx->last_stmt_start != start_time) {
- trx->idle_start = now;
- trx->last_stmt_start = start_time;
- } else if (difftime(now, trx->idle_start)
- > srv_kill_idle_transaction) {
- /* kill the session */
- mutex_exit(&trx_sys->mutex);
- innobase_thd_kill(thd_id);
- goto rescan_idle;
- }
- }
- trx = UT_LIST_GET_NEXT(mysql_trx_list, trx);
- }
- mutex_exit(&trx_sys->mutex);
- }
-
/* Flush stderr so that a database user gets the output
to possible MySQL error file */
@@ -2512,10 +2531,8 @@ DECLARE_THREAD(srv_redo_log_follow_thread)(
} while (srv_shutdown_state < SRV_SHUTDOWN_LAST_PHASE);
- srv_track_changed_pages = FALSE;
log_online_read_shutdown();
os_event_set(srv_redo_log_tracked_event);
- srv_redo_log_thread_started = false; /* Defensive, not required */
my_thread_end();
os_thread_exit(NULL);
@@ -2681,15 +2698,7 @@ srv_active_wake_master_thread(void)
if (slot->in_use) {
ut_a(srv_slot_get_type(slot) == SRV_MASTER);
-
- if (slot->suspended) {
-
- slot->suspended = FALSE;
-
- ++srv_sys->n_threads_active[SRV_MASTER];
-
- os_event_set(slot->event);
- }
+ os_event_set(slot->event);
}
srv_sys_mutex_exit();
@@ -3216,7 +3225,7 @@ suspend_thread:
manual also mentions this string in several places. */
srv_main_thread_op_info = "waiting for server activity";
- os_event_wait(slot->event);
+ srv_resume_thread(slot);
if (srv_shutdown_state == SRV_SHUTDOWN_EXIT_THREADS) {
os_thread_exit(NULL);
@@ -3338,8 +3347,7 @@ DECLARE_THREAD(srv_worker_thread)(
do {
srv_suspend_thread(slot);
-
- os_event_wait(slot->event);
+ srv_resume_thread(slot);
srv_current_thread_priority = srv_purge_thread_priority;
@@ -3479,8 +3487,6 @@ srv_purge_coordinator_suspend(
ib_int64_t sig_count = srv_suspend_thread(slot);
do {
- ulint ret;
-
rw_lock_x_lock(&purge_sys->latch);
purge_sys->running = false;
@@ -3489,32 +3495,11 @@ srv_purge_coordinator_suspend(
/* We don't wait right away on the the non-timed wait because
we want to signal the thread that wants to suspend purge. */
-
- if (stop) {
- os_event_wait_low(slot->event, sig_count);
- ret = 0;
- } else if (rseg_history_len <= trx_sys->rseg_history_len) {
- ret = os_event_wait_time_low(
- slot->event, SRV_PURGE_MAX_TIMEOUT, sig_count);
- } else {
- /* We don't want to waste time waiting, if the
- history list increased by the time we got here,
- unless purge has been stopped. */
- ret = 0;
- }
-
- srv_sys_mutex_enter();
-
- /* The thread can be in state !suspended after the timeout
- but before this check if another thread sent a wakeup signal. */
-
- if (slot->suspended) {
- slot->suspended = FALSE;
- ++srv_sys->n_threads_active[slot->type];
- ut_a(srv_sys->n_threads_active[slot->type] == 1);
- }
-
- srv_sys_mutex_exit();
+ const bool wait = stop
+ || rseg_history_len <= trx_sys->rseg_history_len;
+ const bool timeout = srv_resume_thread(
+ slot, sig_count, wait,
+ stop ? 0 : SRV_PURGE_MAX_TIMEOUT);
sig_count = srv_suspend_thread(slot);
@@ -3526,6 +3511,19 @@ srv_purge_coordinator_suspend(
if (!stop) {
ut_a(purge_sys->n_stop == 0);
purge_sys->running = true;
+
+ if (timeout
+ && rseg_history_len == trx_sys->rseg_history_len
+ && trx_sys->rseg_history_len < 5000) {
+ /* No new records were added since the
+ wait started. Simply wait for new
+ records. The magic number 5000 is an
+ approximation for the case where we
+ have cached UNDO log records which
+ prevent truncate of the UNDO
+ segments. */
+ stop = true;
+ }
} else {
ut_a(purge_sys->n_stop > 0);
@@ -3534,33 +3532,9 @@ srv_purge_coordinator_suspend(
}
rw_lock_x_unlock(&purge_sys->latch);
-
- if (ret == OS_SYNC_TIME_EXCEEDED) {
-
- /* No new records added since wait started then simply
- wait for new records. The magic number 5000 is an
- approximation for the case where we have cached UNDO
- log records which prevent truncate of the UNDO
- segments. */
-
- if (rseg_history_len == trx_sys->rseg_history_len
- && trx_sys->rseg_history_len < 5000) {
-
- stop = true;
- }
- }
-
} while (stop);
- srv_sys_mutex_enter();
-
- if (slot->suspended) {
- slot->suspended = FALSE;
- ++srv_sys->n_threads_active[slot->type];
- ut_a(srv_sys->n_threads_active[slot->type] == 1);
- }
-
- srv_sys_mutex_exit();
+ srv_resume_thread(slot, 0, false);
}
/*********************************************************************//**
@@ -3616,8 +3590,9 @@ DECLARE_THREAD(srv_purge_coordinator_thread)(
srv_purge_coordinator_suspend(slot, rseg_history_len);
}
+ ut_ad(!slot->suspended);
+
if (srv_purge_should_exit(n_total_purged)) {
- ut_a(!slot->suspended);
break;
}
@@ -3732,12 +3707,10 @@ srv_get_task_queue_length(void)
return(n_tasks);
}
-/**********************************************************************//**
-Wakeup the purge threads. */
+/** Wake up the purge threads. */
UNIV_INTERN
void
-srv_purge_wakeup(void)
-/*==================*/
+srv_purge_wakeup()
{
ut_ad(!srv_read_only_mode);
@@ -3752,4 +3725,3 @@ srv_purge_wakeup(void)
}
}
}
-
diff --git a/storage/xtradb/srv/srv0start.cc b/storage/xtradb/srv/srv0start.cc
index 4dd31ad43f6..5255a7454ea 100644
--- a/storage/xtradb/srv/srv0start.cc
+++ b/storage/xtradb/srv/srv0start.cc
@@ -623,19 +623,6 @@ create_log_file(
/** Initial number of the first redo log file */
#define INIT_LOG_FILE0 (SRV_N_LOG_FILES_MAX + 1)
-#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); \
- exit(3); \
- } \
-} while (0)
-#endif
-
/*********************************************************************//**
Creates all log files.
@return DB_SUCCESS or error code */
@@ -676,13 +663,14 @@ 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,
@@ -695,7 +683,7 @@ 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
@@ -707,6 +695,7 @@ create_log_files(
FIL_LOG,
NULL /* no encryption yet */,
true /* this is create */);
+
ut_a(fil_validate());
logfile0 = fil_node_create(
@@ -751,10 +740,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 */
@@ -765,6 +760,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);
@@ -773,26 +771,28 @@ create_log_files_rename(
checkpoint has been created. */
sprintf(logfilename + dirnamelen, "ib_logfile%u", 0);
- RECOVERY_CRASH(9);
-
ib_logf(IB_LOG_LEVEL_INFO,
"Renaming log file %s to %s", logfile0, logfilename);
mutex_enter(&log_sys->mutex);
ut_ad(strlen(logfile0) == 2 + strlen(logfilename));
- ibool success = os_file_rename(
- innodb_file_log_key, logfile0, logfilename);
- ut_a(success);
-
- RECOVERY_CRASH(10);
+ dberr_t err = os_file_rename(
+ innodb_file_log_key, logfile0, logfilename)
+ ? DB_SUCCESS : DB_ERROR;
/* Replace the first file with ib_logfile0. */
strcpy(logfile0, logfilename);
mutex_exit(&log_sys->mutex);
- fil_open_log_and_system_tablespace_files();
+ DBUG_EXECUTE_IF("innodb_log_abort_10", err = DB_ERROR;);
- ib_logf(IB_LOG_LEVEL_WARN, "New log files created, LSN=" LSN_PF, lsn);
+ if (err == DB_SUCCESS) {
+ fil_open_log_and_system_tablespace_files();
+ ib_logf(IB_LOG_LEVEL_WARN,
+ "New log files created, LSN=" LSN_PF, lsn);
+ }
+
+ return(err);
}
/*********************************************************************//**
@@ -1163,14 +1163,13 @@ check_first_page:
(ulong) (srv_data_file_sizes[i]
>> (20 - UNIV_PAGE_SIZE_SHIFT)));
- ib_logf(IB_LOG_LEVEL_INFO,
- "Database physically writes the"
- " file full: wait...");
-
ret = os_file_set_size(
name, files[i],
(os_offset_t) srv_data_file_sizes[i]
- << UNIV_PAGE_SIZE_SHIFT);
+ << UNIV_PAGE_SIZE_SHIFT
+ /* TODO: enable page_compression on the
+ system tablespace and add
+ , FSP_FLAGS_HAS_PAGE_COMPRESSION(flags)*/);
if (!ret) {
ib_logf(IB_LOG_LEVEL_ERROR,
@@ -1189,13 +1188,14 @@ check_first_page:
if (i == 0) {
if (!crypt_data) {
- crypt_data = fil_space_create_crypt_data(FIL_SPACE_ENCRYPTION_DEFAULT, FIL_DEFAULT_ENCRYPTION_KEY);
+ crypt_data = fil_space_create_crypt_data(FIL_ENCRYPTION_DEFAULT,
+ FIL_DEFAULT_ENCRYPTION_KEY);
}
flags = FSP_FLAGS_PAGE_SSIZE();
fil_space_create(name, 0, flags, FIL_TABLESPACE,
- crypt_data, (*create_new_db) == true);
+ crypt_data, (*create_new_db) == true);
}
ut_a(fil_validate());
@@ -1267,10 +1267,11 @@ srv_undo_tablespace_create(
"Setting file %s size to %lu MB",
name, size >> (20 - UNIV_PAGE_SIZE_SHIFT));
- ib_logf(IB_LOG_LEVEL_INFO,
- "Database physically writes the file full: wait...");
-
- ret = os_file_set_size(name, fh, size << UNIV_PAGE_SIZE_SHIFT);
+ ret = os_file_set_size(name, fh, size << UNIV_PAGE_SIZE_SHIFT
+ /* TODO: enable page_compression on the
+ system tablespace and add
+ FSP_FLAGS_HAS_PAGE_COMPRESSION(flags)
+ */);
if (!ret) {
ib_logf(IB_LOG_LEVEL_INFO,
@@ -2090,6 +2091,7 @@ innobase_start_or_create_for_mysql(void)
fsp_init();
log_init();
+ log_online_init();
lock_sys_create(srv_lock_table_size);
@@ -2268,14 +2270,18 @@ innobase_start_or_create_for_mysql(void)
dirnamelen, max_flushed_lsn,
logfile0);
+ if (err == DB_SUCCESS) {
+ err = create_log_files_rename(
+ logfilename,
+ dirnamelen,
+ max_flushed_lsn,
+ logfile0);
+ }
+
if (err != DB_SUCCESS) {
return(err);
}
- create_log_files_rename(
- logfilename, dirnamelen,
- max_flushed_lsn, logfile0);
-
/* Suppress the message about
crash recovery. */
max_flushed_lsn = min_flushed_lsn
@@ -2445,8 +2451,12 @@ files_checked:
fil_flush_file_spaces(FIL_TABLESPACE);
- create_log_files_rename(logfilename, dirnamelen,
- max_flushed_lsn, logfile0);
+ err = create_log_files_rename(logfilename, dirnamelen,
+ max_flushed_lsn, logfile0);
+
+ if (err != DB_SUCCESS) {
+ return(err);
+ }
} else {
/* Check if we support the max format that is stamped
@@ -2475,6 +2485,23 @@ files_checked:
and there must be no page in the buf_flush list. */
buf_pool_invalidate();
+ /* Start monitor thread early enough so that e.g. crash
+ recovery failing to find free pages in the buffer pool is
+ diagnosed. */
+ if (!srv_read_only_mode)
+ {
+ /* Create the thread which prints InnoDB monitor
+ info */
+ srv_monitor_active = true;
+ thread_handles[4 + SRV_MAX_N_IO_THREADS] =
+ os_thread_create(
+ srv_monitor_thread,
+ NULL,
+ thread_ids + 4 + SRV_MAX_N_IO_THREADS);
+
+ thread_started[4 + SRV_MAX_N_IO_THREADS] = true;
+ }
+
/* We always try to do a recovery, even if the database had
been shut down normally: this is the normal startup path */
@@ -2495,7 +2522,7 @@ files_checked:
return(err);
}
- /* This must precede recv_apply_hashed_log_recs(TRUE). */
+ /* This must precede recv_apply_hashed_log_recs(true). */
ib_bh = trx_sys_init_at_db_start();
if (srv_force_recovery < SRV_FORCE_NO_LOG_REDO) {
@@ -2503,12 +2530,8 @@ files_checked:
respective file pages, for the last batch of
recv_group_scan_log_recs(). */
- err = recv_apply_hashed_log_recs(TRUE);
+ recv_apply_hashed_log_recs(true);
DBUG_PRINT("ib_log", ("apply completed"));
-
- if (err != DB_SUCCESS) {
- return(err);
- }
}
if (!srv_read_only_mode) {
@@ -2648,7 +2671,8 @@ files_checked:
ULINT_MAX, LSN_MAX, NULL);
ut_a(success);
- RECOVERY_CRASH(1);
+ DBUG_EXECUTE_IF("innodb_log_abort_1",
+ return(DB_ERROR););
min_flushed_lsn = max_flushed_lsn = log_get_lsn();
@@ -2663,8 +2687,6 @@ files_checked:
buf_flush_wait_batch_end(NULL, BUF_FLUSH_LIST);
- RECOVERY_CRASH(2);
-
/* Flush the old log files. */
log_buffer_flush_to_disk();
/* If innodb_flush_method=O_DSYNC,
@@ -2679,21 +2701,27 @@ files_checked:
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(DB_ERROR););
/* Stamp the LSN to the data files. */
fil_write_flushed_lsn_to_data_files(
max_flushed_lsn, 0);
- fil_flush_file_spaces(FIL_TABLESPACE);
+ DBUG_EXECUTE_IF("innodb_log_abort_4", err = DB_ERROR;);
- RECOVERY_CRASH(4);
+ if (err != DB_SUCCESS) {
+ return(err);
+ }
+
+ fil_flush_file_spaces(FIL_TABLESPACE);
/* 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(DB_ERROR););
/* Free the old log file space. */
log_group_close_all();
@@ -2717,8 +2745,11 @@ files_checked:
fil_write_flushed_lsn_to_data_files(min_flushed_lsn, 0);
fil_flush_file_spaces(FIL_TABLESPACE);
- create_log_files_rename(logfilename, dirnamelen,
- log_get_lsn(), logfile0);
+ err = create_log_files_rename(logfilename, dirnamelen,
+ log_get_lsn(), logfile0);
+ if (err != DB_SUCCESS) {
+ return(err);
+ }
}
srv_startup_is_before_trx_rollback_phase = FALSE;
@@ -2814,11 +2845,14 @@ files_checked:
thread_started[3 + SRV_MAX_N_IO_THREADS] = true;
/* Create the thread which prints InnoDB monitor info */
- srv_monitor_active = true;
- thread_handles[4 + SRV_MAX_N_IO_THREADS] = os_thread_create(
- srv_monitor_thread,
- NULL, thread_ids + 4 + SRV_MAX_N_IO_THREADS);
- thread_started[4 + SRV_MAX_N_IO_THREADS] = true;
+ if (!thread_started[4 + SRV_MAX_N_IO_THREADS]) {
+ /* srv_monitor_thread not yet started */
+ srv_monitor_active = true;
+ thread_handles[4 + SRV_MAX_N_IO_THREADS] = os_thread_create(
+ srv_monitor_thread,
+ NULL, thread_ids + 4 + SRV_MAX_N_IO_THREADS);
+ thread_started[4 + SRV_MAX_N_IO_THREADS] = true;
+ }
}
/* Create the SYS_FOREIGN and SYS_FOREIGN_COLS system tables */
@@ -3189,6 +3223,7 @@ innobase_shutdown_for_mysql(void)
btr_search_disable();
ibuf_close();
+ log_online_shutdown();
log_shutdown();
trx_sys_file_format_close();
trx_sys_close();
diff --git a/storage/xtradb/sync/sync0sync.cc b/storage/xtradb/sync/sync0sync.cc
index 5c4b45eb3c0..6692eef9fb0 100644
--- a/storage/xtradb/sync/sync0sync.cc
+++ b/storage/xtradb/sync/sync0sync.cc
@@ -2,6 +2,7 @@
Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2008, Google Inc.
+Copyright (c) 2017, MariaDB Corporation.
Portions of this file contain modifications contributed and copyrighted by
Google, Inc. Those modifications are gratefully acknowledged and are described
@@ -1363,7 +1364,7 @@ sync_thread_add_level(
case SYNC_TRX_UNDO_PAGE:
/* Purge is allowed to read in as many UNDO pages as it likes,
there was a bogus rule here earlier that forced the caller to
- acquire the purge_sys_t::mutex. The purge mutex did not really
+ acquire the trx_purge_t::mutex. The purge mutex did not really
protect anything because it was only ever acquired by the
single purge thread. The purge thread can read the UNDO pages
without any covering mutex. */
diff --git a/storage/xtradb/trx/trx0purge.cc b/storage/xtradb/trx/trx0purge.cc
index 57338a73450..7d35bb12093 100644
--- a/storage/xtradb/trx/trx0purge.cc
+++ b/storage/xtradb/trx/trx0purge.cc
@@ -1,6 +1,7 @@
/*****************************************************************************
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 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
@@ -172,13 +173,9 @@ trx_purge_sys_close(void)
sess_close(purge_sys->sess);
- purge_sys->sess = NULL;
-
read_view_free(purge_sys->prebuilt_view);
read_view_free(purge_sys->prebuilt_clone);
- purge_sys->view = NULL;
-
rw_lock_free(&purge_sys->latch);
mutex_free(&purge_sys->bh_mutex);
@@ -187,9 +184,6 @@ trx_purge_sys_close(void)
ib_bh_free(purge_sys->ib_bh);
os_event_free(purge_sys->event);
-
- purge_sys->event = NULL;
-
mem_free(purge_sys);
purge_sys = NULL;
@@ -1301,20 +1295,16 @@ void
trx_purge_stop(void)
/*================*/
{
- purge_state_t state;
- ib_int64_t sig_count = os_event_reset(purge_sys->event);
-
ut_a(srv_n_purge_threads > 0);
rw_lock_x_lock(&purge_sys->latch);
- ut_a(purge_sys->state != PURGE_STATE_INIT);
- ut_a(purge_sys->state != PURGE_STATE_EXIT);
- ut_a(purge_sys->state != PURGE_STATE_DISABLED);
+ const ib_int64_t sig_count = os_event_reset(purge_sys->event);
+ const purge_state_t state = purge_sys->state;
- ++purge_sys->n_stop;
+ ut_a(state == PURGE_STATE_RUN || state == PURGE_STATE_STOP);
- state = purge_sys->state;
+ ++purge_sys->n_stop;
if (state == PURGE_STATE_RUN) {
ib_logf(IB_LOG_LEVEL_INFO, "Stopping purge");
diff --git a/storage/xtradb/trx/trx0roll.cc b/storage/xtradb/trx/trx0roll.cc
index ee1497b209f..d228743d300 100644
--- a/storage/xtradb/trx/trx0roll.cc
+++ b/storage/xtradb/trx/trx0roll.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2016, MariaDB Corporation. All Rights Reserved.
+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
@@ -753,9 +753,9 @@ trx_rollback_or_clean_recovered(
}
if (all) {
- fprintf(stderr,
- "InnoDB: Starting in background the rollback"
- " of uncommitted transactions\n");
+ ib_logf(IB_LOG_LEVEL_INFO,
+ "Starting in background the rollback"
+ " of recovered transactions");
}
/* Note: For XA recovered transactions, we rely on MySQL to
@@ -775,6 +775,12 @@ trx_rollback_or_clean_recovered(
assert_trx_in_rw_list(trx);
+ if (srv_shutdown_state != SRV_SHUTDOWN_NONE
+ && srv_fast_shutdown != 0) {
+ all = FALSE;
+ break;
+ }
+
/* If this function does a cleanup or rollback
then it will release the trx_sys->mutex, therefore
we need to reacquire it before retrying the loop. */
@@ -792,10 +798,8 @@ trx_rollback_or_clean_recovered(
} while (trx != NULL);
if (all) {
- ut_print_timestamp(stderr);
- fprintf(stderr,
- " InnoDB: Rollback of non-prepared"
- " transactions completed\n");
+ ib_logf(IB_LOG_LEVEL_INFO,
+ "Rollback of non-prepared transactions completed");
}
}
diff --git a/storage/xtradb/trx/trx0sys.cc b/storage/xtradb/trx/trx0sys.cc
index 182bdc5d74c..1c4fb19430e 100644
--- a/storage/xtradb/trx/trx0sys.cc
+++ b/storage/xtradb/trx/trx0sys.cc
@@ -1344,7 +1344,9 @@ trx_sys_close(void)
ut_a(UT_LIST_GET_LEN(trx_sys->ro_trx_list) == 0);
/* 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);
+ ut_a(UT_LIST_GET_LEN(trx_sys->rw_trx_list) == trx_sys->n_prepared_trx
+ || srv_read_only_mode
+ || srv_force_recovery >= SRV_FORCE_NO_TRX_UNDO);
while ((trx = UT_LIST_GET_FIRST(trx_sys->rw_trx_list)) != NULL) {
trx_free_prepared(trx);
@@ -1390,6 +1392,33 @@ trx_sys_close(void)
trx_sys = NULL;
}
+/** @brief Convert an undo log to TRX_UNDO_PREPARED state on shutdown.
+
+If any prepared ACTIVE transactions exist, and their rollback was
+prevented by innodb_force_recovery, we convert these transactions to
+XA PREPARE state in the main-memory data structures, so that shutdown
+will proceed normally. These transactions will again recover as ACTIVE
+on the next restart, and they will be rolled back unless
+innodb_force_recovery prevents it again.
+
+@param[in] trx transaction
+@param[in,out] undo undo log to convert to TRX_UNDO_PREPARED */
+static
+void
+trx_undo_fake_prepared(
+ const trx_t* trx,
+ trx_undo_t* undo)
+{
+ ut_ad(srv_force_recovery >= SRV_FORCE_NO_TRX_UNDO);
+ ut_ad(trx_state_eq(trx, TRX_STATE_ACTIVE));
+ ut_ad(trx->is_recovered);
+
+ if (undo != NULL) {
+ ut_ad(undo->state == TRX_UNDO_ACTIVE);
+ undo->state = TRX_UNDO_PREPARED;
+ }
+}
+
/*********************************************************************
Check if there are any active (non-prepared) transactions.
@return total number of active transactions or 0 if none */
@@ -1398,15 +1427,42 @@ ulint
trx_sys_any_active_transactions(void)
/*=================================*/
{
- ulint total_trx = 0;
-
mutex_enter(&trx_sys->mutex);
- total_trx = UT_LIST_GET_LEN(trx_sys->rw_trx_list)
- + UT_LIST_GET_LEN(trx_sys->mysql_trx_list);
+ ulint total_trx = UT_LIST_GET_LEN(trx_sys->mysql_trx_list);
+
+ if (total_trx == 0) {
+ total_trx = UT_LIST_GET_LEN(trx_sys->rw_trx_list);
+ ut_a(total_trx >= trx_sys->n_prepared_trx);
+
+ if (total_trx > trx_sys->n_prepared_trx
+ && srv_force_recovery >= SRV_FORCE_NO_TRX_UNDO) {
+ for (trx_t* trx = UT_LIST_GET_FIRST(
+ trx_sys->rw_trx_list);
+ trx != NULL;
+ trx = UT_LIST_GET_NEXT(trx_list, trx)) {
+ if (!trx_state_eq(trx, TRX_STATE_ACTIVE)
+ || !trx->is_recovered) {
+ continue;
+ }
+ /* This was a recovered transaction
+ whose rollback was disabled by
+ the innodb_force_recovery setting.
+ Pretend that it is in XA PREPARE
+ state so that shutdown will work. */
+ trx_undo_fake_prepared(
+ trx, trx->insert_undo);
+ trx_undo_fake_prepared(
+ trx, trx->update_undo);
+ trx->state = TRX_STATE_PREPARED;
+ trx_sys->n_prepared_trx++;
+ trx_sys->n_prepared_recovered_trx++;
+ }
+ }
- ut_a(total_trx >= trx_sys->n_prepared_trx);
- total_trx -= trx_sys->n_prepared_trx;
+ ut_a(total_trx >= trx_sys->n_prepared_trx);
+ total_trx -= trx_sys->n_prepared_trx;
+ }
mutex_exit(&trx_sys->mutex);
diff --git a/storage/xtradb/trx/trx0trx.cc b/storage/xtradb/trx/trx0trx.cc
index bdf407ff7fb..439897a5b96 100644
--- a/storage/xtradb/trx/trx0trx.cc
+++ b/storage/xtradb/trx/trx0trx.cc
@@ -478,7 +478,11 @@ trx_free_prepared(
/*==============*/
trx_t* trx) /*!< in, own: trx object */
{
- ut_a(trx_state_eq(trx, TRX_STATE_PREPARED));
+ ut_a(trx_state_eq(trx, TRX_STATE_PREPARED)
+ || (trx_state_eq(trx, TRX_STATE_ACTIVE)
+ && trx->is_recovered
+ && (srv_read_only_mode
+ || srv_force_recovery >= SRV_FORCE_NO_TRX_UNDO)));
ut_a(trx->magic_n == TRX_MAGIC_N);
lock_trx_release_locks(trx);
@@ -1117,7 +1121,8 @@ trx_start_low(
trx->start_time = ut_time();
- trx->start_time_micro = clock();
+ trx->start_time_micro =
+ trx->mysql_thd ? thd_query_start_micro(trx->mysql_thd) : 0;
MONITOR_INC(MONITOR_TRX_ACTIVE);
}
diff --git a/storage/xtradb/trx/trx0undo.cc b/storage/xtradb/trx/trx0undo.cc
index cdd23726f2e..220589dd9ff 100644
--- a/storage/xtradb/trx/trx0undo.cc
+++ b/storage/xtradb/trx/trx0undo.cc
@@ -1,6 +1,7 @@
/*****************************************************************************
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2014, 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
@@ -2011,13 +2012,37 @@ trx_undo_free_prepared(
ut_ad(srv_shutdown_state == SRV_SHUTDOWN_EXIT_THREADS);
if (trx->update_undo) {
- ut_a(trx->update_undo->state == TRX_UNDO_PREPARED);
+ switch (trx->update_undo->state) {
+ case TRX_UNDO_PREPARED:
+ break;
+ case TRX_UNDO_ACTIVE:
+ /* lock_trx_release_locks() assigns
+ trx->is_recovered=false */
+ ut_a(srv_read_only_mode
+ || srv_force_recovery >= SRV_FORCE_NO_TRX_UNDO);
+ break;
+ default:
+ ut_error;
+ }
+
UT_LIST_REMOVE(undo_list, trx->rseg->update_undo_list,
trx->update_undo);
trx_undo_mem_free(trx->update_undo);
}
if (trx->insert_undo) {
- ut_a(trx->insert_undo->state == TRX_UNDO_PREPARED);
+ switch (trx->insert_undo->state) {
+ case TRX_UNDO_PREPARED:
+ break;
+ case TRX_UNDO_ACTIVE:
+ /* lock_trx_release_locks() assigns
+ trx->is_recovered=false */
+ ut_a(srv_read_only_mode
+ || srv_force_recovery >= SRV_FORCE_NO_TRX_UNDO);
+ break;
+ default:
+ ut_error;
+ }
+
UT_LIST_REMOVE(undo_list, trx->rseg->insert_undo_list,
trx->insert_undo);
trx_undo_mem_free(trx->insert_undo);
diff --git a/strings/strings_def.h b/strings/strings_def.h
index 8bdb806d1d2..f1fcfe2f7cc 100644
--- a/strings/strings_def.h
+++ b/strings/strings_def.h
@@ -13,7 +13,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
/* This file is to be include first in all files in the string directory */
diff --git a/strings/strmov.c b/strings/strmov.c
index b38d5db5d6e..0f594185688 100644
--- a/strings/strmov.c
+++ b/strings/strmov.c
@@ -40,6 +40,7 @@
char *strmov(register char *dst, register const char *src)
{
+ DBUG_ASSERT(src + strlen(src) < dst || dst + strlen(src) < src);
while ((*dst++ = *src++)) ;
return dst-1;
}
diff --git a/strings/strmov_overlapp.c b/strings/strmov_overlapp.c
index 59d980fc7c4..2a162c39903 100644
--- a/strings/strmov_overlapp.c
+++ b/strings/strmov_overlapp.c
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#include "strings_def.h"
diff --git a/support-files/CMakeLists.txt b/support-files/CMakeLists.txt
index c80de04d069..c9addecafa5 100644
--- a/support-files/CMakeLists.txt
+++ b/support-files/CMakeLists.txt
@@ -90,6 +90,8 @@ IF(UNIX)
SET(scriptdir ${INSTALL_SCRIPTDIRABS})
SET(libexecdir ${INSTALL_SBINDIRABS})
SET(pkgdatadir ${INSTALL_MYSQLSHAREDIRABS})
+ SET(sysconfdir ${INSTALL_SYSCONFDIR})
+ SET(sysconf2dir ${INSTALL_SYSCONF2DIR})
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/mysql.server.sh
${CMAKE_CURRENT_BINARY_DIR}/mysql.server @ONLY)
INSTALL(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/mysql.server
diff --git a/support-files/MacOSX/ReadMe.txt b/support-files/MacOSX/ReadMe.txt
index d81ec1f66d6..8b833049ad4 100644
--- a/support-files/MacOSX/ReadMe.txt
+++ b/support-files/MacOSX/ReadMe.txt
@@ -110,7 +110,7 @@ Note
Continue .
5. If you have downloaded the community version of MySQL, you
- will be shown a copy of the relevent GNU General Public
+ will be shown a copy of the relevant GNU General Public
License. Click Continue .
6. Select the drive you want to use to install the MySQL Startup
@@ -128,7 +128,7 @@ Note
will be given an Install Succeeded message.
Once you have completed the basic installation, you must complete
- the post-installation steps as specifed in Section 2.13,
+ the post-installation steps as specified in Section 2.13,
"Post-Installation Setup and Testing."
For convenience, you may also want to install the Section 2.7.2,
diff --git a/support-files/compiler_warnings.supp b/support-files/compiler_warnings.supp
index 6b82d83a8fe..249060108bf 100644
--- a/support-files/compiler_warnings.supp
+++ b/support-files/compiler_warnings.supp
@@ -153,7 +153,7 @@
# OpenSSL
#
# The following comes because of different prototype between yassl and openssl.
-# Save as the argument is a function withing the library.
+# Save as the argument is a function within the library.
.*/vio/viosslfactories\.c: discards ~const~ qualifier from pointer target type
#
diff --git a/support-files/mariadb.service.in b/support-files/mariadb.service.in
index 15f41c6377f..6a307b2c41f 100644
--- a/support-files/mariadb.service.in
+++ b/support-files/mariadb.service.in
@@ -67,19 +67,19 @@ PermissionsStartOnly=true
# It is always safe to unset _WSREP_START_POSITION environment variable.
# Do not panic if galera_recovery script is not available. (MDEV-10538)
ExecStartPre=/bin/sh -c "systemctl unset-environment _WSREP_START_POSITION"
-ExecStartPre=/bin/sh -c "[ ! -e /usr/bin/galera_recovery ] && VAR= || \
- VAR=`/usr/bin/galera_recovery`; [ $? -eq 0 ] \
+ExecStartPre=/bin/sh -c "[ ! -e @bindir@/galera_recovery ] && VAR= || \
+ VAR=`@bindir@/galera_recovery`; [ $? -eq 0 ] \
&& systemctl set-environment _WSREP_START_POSITION=$VAR || exit 1"
# Needed to create system tables etc.
-# ExecStartPre=/usr/bin/mysql_install_db -u mysql
+# ExecStartPre=@scriptdir@/mysql_install_db -u mysql
# Start main service
# MYSQLD_OPTS here is for users to set in /etc/systemd/system/mariadb.service.d/MY_SPECIAL.conf
# Use the [service] section and Environment="MYSQLD_OPTS=...".
# This isn't a replacement for my.cnf.
# _WSREP_NEW_CLUSTER is for the exclusive use of the script galera_new_cluster
-ExecStart=/usr/sbin/mysqld $MYSQLD_OPTS $_WSREP_NEW_CLUSTER $_WSREP_START_POSITION
+ExecStart=@sbindir@/mysqld $MYSQLD_OPTS $_WSREP_NEW_CLUSTER $_WSREP_START_POSITION
@SYSTEMD_EXECSTARTPOST@
# Unset _WSREP_START_POSITION environment variable.
@@ -136,7 +136,7 @@ LimitNOFILE=16364
# Timezone. previously [mysqld_safe] timezone
# Environment="TZ=UTC"
-# Library substitutions. previously [mysqld_safe] malloc-lib with explict paths
+# Library substitutions. previously [mysqld_safe] malloc-lib with explicit paths
# (in LD_LIBRARY_PATH) and library name (in LD_PRELOAD).
# Environment="LD_LIBRARY_PATH=/path1 /path2" "LD_PRELOAD=
@@ -145,7 +145,7 @@ LimitNOFILE=16364
# ExecStartPre=sysctl -q -w vm.drop_caches=3
# numa-interleave=1 equalivant
-# Change ExecStart=numactl --interleave=all /usr/sbin/mysqld......
+# Change ExecStart=numactl --interleave=all @sbindir@/mysqld......
# crash-script equalivent
# FailureAction=
diff --git a/support-files/mariadb@.service.in b/support-files/mariadb@.service.in
index e941f21526e..410e7433b2b 100644
--- a/support-files/mariadb@.service.in
+++ b/support-files/mariadb@.service.in
@@ -1,7 +1,7 @@
-# Multi instance version of mariadb. For if you run mutiple verions at once.
+# Multi instance version of mariadb. For if you run multiple versions at once.
# Also used for mariadb@bootstrap to bootstrap Galera.
#
-# create config file @INSTALL_SYSCONF2DIR@/my{instancename}.cnf
+# create config file @sysconf2dir@/my{instancename}.cnf
#
# start as systemctl start mariadb@{instancename}.server
@@ -22,7 +22,7 @@ Description=MariaDB database server
After=network.target
After=syslog.target
-ConditionPathExists=@INSTALL_SYSCONF2DIR@/my%I.cnf
+ConditionPathExists=@sysconf2dir@/my%I.cnf
[Install]
WantedBy=multi-user.target
@@ -73,19 +73,19 @@ PermissionsStartOnly=true
# Do not panic if galera_recovery script is not available. (MDEV-10538)
ExecStartPre=/bin/sh -c "systemctl unset-environment _WSREP_START_POSITION%I"
-ExecStartPre=/bin/sh -c "[ ! -e /usr/bin/galera_recovery ] && VAR= || \
- VAR=`/usr/bin/galera_recovery --defaults-file=@INSTALL_SYSCONF2DIR@/my%I.cnf`; [ $? -eq 0 ] \
+ExecStartPre=/bin/sh -c "[ ! -e @bindir@/galera_recovery ] && VAR= || \
+ VAR=`@bindir@/galera_recovery --defaults-file=@sysconf2dir@/my%I.cnf`; [ $? -eq 0 ] \
&& systemctl set-environment _WSREP_START_POSITION%I=$VAR || exit 1"
# Alternate: (remove ConditionPathExists above)
# use [mysqld.INSTANCENAME] as sections in my.cnf
#
-#ExecStartPre=/bin/sh -c "[ ! -e /usr/bin/galera_recovery ] && VAR= || \
-# VAR=`/usr/bin/galera_recovery --defaults-group-suffix=%I`; [ $? -eq 0 ] \
+#ExecStartPre=/bin/sh -c "[ ! -e @bindir@/galera_recovery ] && VAR= || \
+# VAR=`@bindir@/galera_recovery --defaults-group-suffix=%I`; [ $? -eq 0 ] \
# && systemctl set-environment _WSREP_START_POSITION%I=$VAR || exit 1"
# Needed to create system tables etc.
-# ExecStartPre=/usr/bin/mysql_install_db -u mysql
+# ExecStartPre=@scriptdir@/mysql_install_db -u mysql
# Start main service
# MYSQLD_OPTS here is for users to set in /etc/systemd/system/mariadb@.service.d/MY_SPECIAL.conf
@@ -95,12 +95,12 @@ ExecStartPre=/bin/sh -c "[ ! -e /usr/bin/galera_recovery ] && VAR= || \
# Note: Place $MYSQLD_OPTS at the very end for its options to take precedence.
-ExecStart=/usr/sbin/mysqld --defaults-file=@INSTALL_SYSCONF2DIR@/my%I.cnf \
+ExecStart=@sbindir@/mysqld --defaults-file=@sysconf2dir@/my%I.cnf \
$_WSREP_NEW_CLUSTER $_WSREP_START_POSITION%I $MYSQLD_OPTS
# Alternate: (remove ConditionPathExists above)
# use [mysqld.INSTANCENAME] as sections in my.cnf
#
-# ExecStart=/usr/sbin/mysqld --defaults-group-suffix=%I \
+# ExecStart=@sbindir@/mysqld --defaults-group-suffix=%I \
# $_WSREP_NEW_CLUSTER $_WSREP_START_POSITION%I $MYSQLD_OPTS
# Unset _WSREP_START_POSITION environment variable.
@@ -157,7 +157,7 @@ LimitNOFILE=16364
# Timezone. previously [mysqld_safe] timezone
# Environment="TZ=UTC"
-# Library substitutions. previously [mysqld_safe] malloc-lib with explict paths
+# Library substitutions. previously [mysqld_safe] malloc-lib with explicit paths
# (in LD_LIBRARY_PATH) and library name (in LD_PRELOAD).
# Environment="LD_LIBRARY_PATH=/path1 /path2" "LD_PRELOAD=
@@ -166,7 +166,7 @@ LimitNOFILE=16364
# ExecStartPre=sysctl -q -w vm.drop_caches=3
# numa-interleave=1 equalivant
-# Change ExecStart=numactl --interleave=all /usr/sbin/mysqld......
+# Change ExecStart=numactl --interleave=all @sbindir@/mysqld......
# crash-script equalivent
# FailureAction=
diff --git a/support-files/my-innodb-heavy-4G.cnf.sh b/support-files/my-innodb-heavy-4G.cnf.sh
index d934b23cf0d..2590ff5ddea 100644
--- a/support-files/my-innodb-heavy-4G.cnf.sh
+++ b/support-files/my-innodb-heavy-4G.cnf.sh
@@ -306,7 +306,7 @@ server-id = 1
# Make the slave read-only. Only users with the SUPER privilege and the
# replication slave thread will be able to modify data on it. You can
-# use this to ensure that no applications will accidently modify data on
+# use this to ensure that no applications will accidentally modify data on
# the slave instead of the master
#read_only
@@ -439,7 +439,7 @@ innodb_log_files_in_group = 3
#innodb_log_group_home_dir
# Maximum allowed percentage of dirty pages in the InnoDB buffer pool.
-# If it is reached, InnoDB will start flushing them out agressively to
+# If it is reached, InnoDB will start flushing them out aggressively to
# not run out of clean pages at all. This is a soft limit, not
# guaranteed to be held.
innodb_max_dirty_pages_pct = 90
diff --git a/support-files/mysql-log-rotate.sh b/support-files/mysql-log-rotate.sh
index 0ee78b0f7ca..5d1b30b208e 100644
--- a/support-files/mysql-log-rotate.sh
+++ b/support-files/mysql-log-rotate.sh
@@ -30,7 +30,8 @@
if test -x @bindir@/mysqladmin && \
@bindir@/mysqladmin ping &>/dev/null
then
- @bindir@/mysqladmin flush-logs
+ @bindir@/mysqladmin --local flush-error-log \
+ flush-engine-log flush-general-log flush-slow-log
fi
endscript
}
diff --git a/support-files/mysql-multi.server.sh b/support-files/mysql-multi.server.sh
index a036374a4b2..f90d662fa8c 100644
--- a/support-files/mysql-multi.server.sh
+++ b/support-files/mysql-multi.server.sh
@@ -12,7 +12,7 @@
# started and shut down when the systems goes down. The '.svr1' suffix can
# be used to identify one of a number of servers. Multiple symlinks can be
# created, one per instance. The 'svrN' suffix can then be used to
-# prefix configuration variables in a seperate section of /etc/my.cnf.
+# prefix configuration variables in a separate section of /etc/my.cnf.
# See example below.
#
# A typical multi-instance /etc/my.cnf file would look like:
diff --git a/support-files/rpm/server-postin.sh b/support-files/rpm/server-postin.sh
index 9ef9bec3e0d..08b046dc272 100644
--- a/support-files/rpm/server-postin.sh
+++ b/support-files/rpm/server-postin.sh
@@ -45,6 +45,11 @@ if [ $1 = 1 ] ; then
# The user may already exist, make sure it has the proper group nevertheless (BUG#12823)
usermod --gid %{mysqld_group} %{mysqld_user} 2> /dev/null || true
+ # Temporary Workaround for MDEV-11386 - will be corrected in Advance Toolchain 10.0-3 and 8.0-8
+ for ldconfig in /opt/at*/sbin/ldconfig; do
+ test -x $ldconfig && $ldconfig
+ done
+
# Change permissions so that the user that will run the MySQL daemon
# owns all database files.
chown -R %{mysqld_user}:%{mysqld_group} $datadir
@@ -69,36 +74,9 @@ fi
SETARGETDIR=/etc/selinux/targeted/src/policy
SEDOMPROG=$SETARGETDIR/domains/program
SECONPROG=$SETARGETDIR/file_contexts/program
-if [ -f /etc/redhat-release ] ; then
- if grep '\(Red Hat Enterprise Linux ..\|CentOS\) release 4' \
- /etc/redhat-release >/dev/null 2>&1; then
- echo
- echo
- echo 'Notes regarding SELinux on this platform:'
- echo '========================================='
- echo
- echo 'The default policy might cause server startup to fail because it is '
- echo 'not allowed to access critical files. In this case, please update '
- echo 'your installation. '
- echo
- echo 'The default policy might also cause inavailability of SSL related '
- echo 'features because the server is not allowed to access /dev/random '
- echo 'and /dev/urandom. If this is a problem, please do the following: '
- echo
- echo ' 1) install selinux-policy-targeted-sources from your OS vendor'
- echo ' 2) add the following two lines to '$SEDOMPROG/mysqld.te':'
- echo ' allow mysqld_t random_device_t:chr_file read;'
- echo ' allow mysqld_t urandom_device_t:chr_file read;'
- echo ' 3) cd to '$SETARGETDIR' and issue the following command:'
- echo ' make load'
- echo
- echo
- fi
- if grep 'CentOS release 6' /etc/redhat-release >/dev/null 2>&1; then
- if [ -x /usr/sbin/semodule ] ; then
- /usr/sbin/semodule -i /usr/share/mysql/policy/selinux/mariadb.pp
- fi
- fi
+
+if [ -x /usr/sbin/semodule ] ; then
+ /usr/sbin/semodule -i /usr/share/mysql/policy/selinux/mariadb.pp
fi
if [ -x sbin/restorecon ] ; then
diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c
index 5525a20271b..469a6ec5103 100644
--- a/tests/mysql_client_test.c
+++ b/tests/mysql_client_test.c
@@ -1,5 +1,5 @@
-/* Copyright (c) 2002, 2012, Oracle and/or its affiliates.
- Copyright (c) 2008, 2013, Monty Program Ab
+/* Copyright (c) 2002, 2014, Oracle and/or its affiliates.
+ Copyright (c) 2008, 2017, MariaDB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -19360,6 +19360,49 @@ static void test_mdev4326()
}
+/**
+ BUG#17512527: LIST HANDLING INCORRECT IN MYSQL_PRUNE_STMT_LIST()
+*/
+static void test_bug17512527()
+{
+ MYSQL *conn;
+ MYSQL_STMT *stmt1, *stmt2;
+ unsigned long thread_id;
+ char query[MAX_TEST_QUERY_LENGTH];
+ int rc;
+
+ conn= client_connect(0, MYSQL_PROTOCOL_SOCKET, 1);
+
+ stmt1 = mysql_stmt_init(conn);
+ check_stmt(stmt1);
+ rc= mysql_stmt_prepare(stmt1, STRING_WITH_LEN("SELECT 1"));
+ check_execute(stmt1, rc);
+
+ stmt2 = mysql_stmt_init(conn);
+ check_stmt(stmt2);
+
+ thread_id= mysql_thread_id(conn);
+ sprintf(query, "KILL %lu", thread_id);
+ if (thread_query(query))
+ exit(1);
+
+ rc= mysql_stmt_prepare(stmt2, STRING_WITH_LEN("SELECT 2"));
+ check_execute(stmt2, rc);
+
+ rc= mysql_stmt_execute(stmt1);
+ check_execute_r(stmt1, rc);
+
+ rc= mysql_stmt_execute(stmt2);
+ check_execute(stmt2, rc);
+
+ mysql_close(conn);
+
+ mysql_stmt_close(stmt2);
+ mysql_stmt_close(stmt1);
+}
+
+
+
/*
Check compressed protocol
*/
@@ -19758,6 +19801,9 @@ static struct my_tests_st my_tests[]= {
{ "test_bug13001491", test_bug13001491 },
{ "test_mdev4326", test_mdev4326 },
{ "test_ps_sp_out_params", test_ps_sp_out_params },
+#ifndef _WIN32
+ { "test_bug17512527", test_bug17512527},
+#endif
{ "test_compressed_protocol", test_compressed_protocol },
{ "test_big_packet", test_big_packet },
{ "test_prepare_analyze", test_prepare_analyze },
diff --git a/unittest/mysys/base64-t.c b/unittest/mysys/base64-t.c
index 97558083bef..58d0014dee1 100644
--- a/unittest/mysys/base64-t.c
+++ b/unittest/mysys/base64-t.c
@@ -16,7 +16,6 @@
#include <my_global.h>
#include <my_sys.h>
-#include <base64.h>
#include <tap.h>
#include <string.h>
diff --git a/unittest/mysys/waiting_threads-t.c b/unittest/mysys/waiting_threads-t.c
index 35e86aca319..56b2f967c00 100644
--- a/unittest/mysys/waiting_threads-t.c
+++ b/unittest/mysys/waiting_threads-t.c
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#include "thr_template.c"
#include <waiting_threads.h>
diff --git a/unittest/sql/mf_iocache-t.cc b/unittest/sql/mf_iocache-t.cc
index 8bbe4db53cf..a7db7c58713 100644
--- a/unittest/sql/mf_iocache-t.cc
+++ b/unittest/sql/mf_iocache-t.cc
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#include <my_sys.h>
#include <my_crypt.h>
diff --git a/unittest/sql/my_apc-t.cc b/unittest/sql/my_apc-t.cc
index 80bbc6b6e56..6d44859d164 100644
--- a/unittest/sql/my_apc-t.cc
+++ b/unittest/sql/my_apc-t.cc
@@ -12,7 +12,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
/*
This file does standalone APC system tests.
diff --git a/win/packaging/COPYING.rtf b/win/packaging/COPYING.rtf
index 9370fbcaa0c..ba5fa3f31f0 100644
--- a/win/packaging/COPYING.rtf
+++ b/win/packaging/COPYING.rtf
@@ -2,7 +2,7 @@
{\stylesheet{ Normal;}{\s1 heading 1;}{\s2 heading 2;}}
\viewkind4\uc1\pard\s2\sb100\sa100\b\f0\fs24 GNU GENERAL PUBLIC LICENSE\par
\pard\sb100\sa100\b0\fs20 Version 2, June 1991 \par
-\pard Copyright (C) 1989, 1991 Free Software Foundation, Inc. 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.\fs24 \par
+\pard Copyright (C) 1989, 1991 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301, USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.\fs24 \par
\pard\s2\sb100\sa100\b Preamble\par
\pard\sb100\sa100\b0\fs20 The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. \par
When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. \par
@@ -48,7 +48,7 @@ NO WARRANTY \par
How to Apply These Terms to Your New Programs\fs20\par
\pard\sb100\sa100\b0 If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. \par
To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. \par
-\pard one line to give the program's name and an idea of what it does. Copyright (C) yyyy name of author This program is free 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; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. \par
+\pard one line to give the program's name and an idea of what it does. Copyright (C) yyyy name of author This program is free 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; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301, USA. \par
\pard\sb100\sa100 Also add information on how to contact you by electronic and paper mail. \par
If the program is interactive, make it output a short notice like this when it starts in an interactive mode: \par
\pard Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. \par
diff --git a/win/packaging/ca/CustomAction.cpp b/win/packaging/ca/CustomAction.cpp
index 56df4ae791e..9a174b8529e 100644
--- a/win/packaging/ca/CustomAction.cpp
+++ b/win/packaging/ca/CustomAction.cpp
@@ -11,7 +11,7 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#ifndef UNICODE
#define UNICODE
diff --git a/wsrep/wsrep_dummy.c b/wsrep/wsrep_dummy.c
index eae084f1979..e48dcff39a1 100644
--- a/wsrep/wsrep_dummy.c
+++ b/wsrep/wsrep_dummy.c
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
*/
/*! @file Dummy wsrep API implementation. */
diff --git a/wsrep/wsrep_gtid.c b/wsrep/wsrep_gtid.c
index e618c5ab7d0..45148785c25 100644
--- a/wsrep/wsrep_gtid.c
+++ b/wsrep/wsrep_gtid.c
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
*/
/*! @file Helper functions to deal with GTID string representations */
diff --git a/wsrep/wsrep_loader.c b/wsrep/wsrep_loader.c
index f4d5991339e..1321538742f 100644
--- a/wsrep/wsrep_loader.c
+++ b/wsrep/wsrep_loader.c
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
*/
/*! @file wsrep implementation loader */
diff --git a/wsrep/wsrep_uuid.c b/wsrep/wsrep_uuid.c
index baa95b2578a..54ae4ab5ed5 100644
--- a/wsrep/wsrep_uuid.c
+++ b/wsrep/wsrep_uuid.c
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
*/
/*! @file Helper functions to deal with history UUID string representations */