From eadcf09bc48eb573316c01382cff2be1b91c8ce4 Mon Sep 17 00:00:00 2001 From: Elena Stepanova Date: Fri, 27 Oct 2017 03:17:23 +0300 Subject: [PATCH 1/5] MDEV-13860 CONNECT engine does not build with JDBC without ODBC Re-apply the patch cb1b466c0c3fa72a058fe6462261f70b11d45c53, the change disappeared after the merge --- storage/connect/ha_connect.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/storage/connect/ha_connect.cc b/storage/connect/ha_connect.cc index c738f39c668..787ec2affc1 100644 --- a/storage/connect/ha_connect.cc +++ b/storage/connect/ha_connect.cc @@ -5398,10 +5398,10 @@ static int connect_assisted_discovery(handlerton *, THD* thd, #endif // __WIN__ //int hdr, mxe; int port = 0, mxr = 0, rc = 0, mul = 0, lrecl = 0; + PCSZ tabtyp = NULL; #if defined(ODBC_SUPPORT) POPARM sop= NULL; PCSZ ucnc= NULL; - PCSZ tabtyp = NULL; bool cnc= false; int cto= -1, qto= -1; #endif // ODBC_SUPPORT From c3592ca7b8864a2492d98db4d45a7684e979301d Mon Sep 17 00:00:00 2001 From: Elena Stepanova Date: Fri, 27 Oct 2017 03:19:59 +0300 Subject: [PATCH 2/5] List of unstable tests for 10.0.33 release --- mysql-test/unstable-tests | 236 ++++++++++++++++++++++---------------- 1 file changed, 136 insertions(+), 100 deletions(-) diff --git a/mysql-test/unstable-tests b/mysql-test/unstable-tests index 520567a0e9b..47d21391d6e 100644 --- a/mysql-test/unstable-tests +++ b/mysql-test/unstable-tests @@ -23,53 +23,52 @@ # ############################################################################## -main.alter_table_online : Modified in 10.0.32 -main.binary_to_hex : Modified in 10.0.32 -main.bootstrap : Modified in 10.0.32 -main.count_distinct : Modified in 10.0.32 +main.alter_table : Modified in 10.0.33 +main.case : Modified in 10.0.33 +main.count_distinct : Modified in 10.0.33 main.count_distinct2 : MDEV-11768 - timeout main.create_delayed : MDEV-10605 - failed with timeout -main.ctype_ucs : Modified in 10.0.32 +main.ctype_gbk : Modified in 10.0.33 +main.ctype_latin1 : Modified in 10.0.33 +main.ctype_ucs : Modified in 10.0.33 +main.ctype_utf32 : Modified in 10.0.33 +main.ctype_utf8 : Modified in 10.0.33 main.debug_sync : MDEV-10607 - internal error +main.delete_returning : Modified in 10.0.33 main.derived_opt : MDEV-11768 - timeout -main.engine_error_in_alter-8453 : Added in 10.0.32 main.events_slowlog : MDEV-12821 - wrong result -main.func_concat : Modified in 10.0.32 -main.func_crypt : Modified in 10.0.32 -main.func_regexp_pcre : MDEV-13412 - crash, wrong result; modified in 10.0.32 -main.gis : MDEV-13411 - wrong result on P8; modified in 10.0.32 -main.gis-alter_table_online : Added in 10.0.32 -main.gis-rt-precise : Modified in 10.0.32 -main.group_by : Modified in 10.0.32 +main.func_in : Modified in 10.0.33 +main.func_misc : Modified in 10.0.33 +main.func_regexp_pcre : Modified in 10.0.33 +main.func_time : Modified in 10.0.33 +main.gis : MDEV-13411 - wrong result on P8 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 result main.innodb_mysql_lock : MDEV-7861 - sporadic lock detection failure -main.join_outer : Modified in 10.0.32 -main.loadxml : Data file modified in 10.0.32 -main.log_tables-big : MDEV-13408 - wrong result +main.insert : Modified in 10.0.33 +main.log_tables-big : MDEV-13408 - wrong result; modified in 10.0.33 main.mdev-504 : MDEV-10607 - sporadic "can't connect" +main.mdev13607 : Added in 10.0.33 main.mdev375 : MDEV-10607 - sporadic "can't connect" main.merge : MDEV-10607 - sporadic "can't connect" -main.mysql : Modified in 10.0.32 +main.myisam : Modified in 10.0.33 main.mysqlhotcopy_myisam : MDEV-10995 - test hangs on debug build -main.mysqltest : MDEV-9269 - fails on Alpha; modified in 10.0.32 -main.mysql_upgrade : Modified in 10.0.32 -main.ps : MDEV-11017 - sporadic wrong Prepared_stmt_count -main.read_only : Modified in 10.0.32 +main.mysqltest : MDEV-9269 - fails on Alpha +main.partition_datatype : Modified in 10.0.33 +main.ps : MDEV-11017 - sporadic wrong Prepared_stmt_count; modified in 10.0.33 +main.range_vs_index_merge : Modified in 10.0.33 +main.read_only : Modified in 10.0.33 main.show_explain : MDEV-10674 - wrong result +main.show_function_with_pad_char_to_full_length : Added in 10.0.33 main.sp_notembedded : MDEV-10607 - internal error main.sp-security : MDEV-10607 - sporadic "can't connect" -main.subselect : Modified in 10.0.32 +main.stat_tables_par_innodb : MDEV-14155 - wrong rounding main.subselect_innodb : MDEV-10614 - sporadic wrong results -main.subselect_mat_cost_bugs : Modified in 10.0.32 -main.subselect_nulls : Modified in 10.0.32 -main.subselect_sj2_mat : Modified in 10.0.32 -main.subselect_sj_mat : MOdified in 10.0.32 -main.symlink-aria-11902 : MDEV-12215 - Wrong error number -main.symlink-myisam-11902 : MDEV-12215 - Wrong error number -main.union : Modified in 10.0.32 -main.view : Modified in 10.0.32 +main.subselect_mat_cost_bugs : Modified in 10.0.33 +main.tc_heuristic_recover : Added in 10.0.33 +main.type_varchar : Modified in 10.0.33 +main.view : Modified in 10.0.33 main.xa : MDEV-11769 - lock wait timeout #---------------------------------------------------------------- @@ -82,20 +81,44 @@ archive.mysqlhotcopy_archive : MDEV-10995 - test hangs on debug build #---------------------------------------------------------------- binlog.binlog_commit_wait : MDEV-10150 - Error: too much time elapsed -binlog.binlog_unsafe : Modified in 10.0.32 binlog.binlog_xa_recover : MDEV-8517 - Extra checkpoint #---------------------------------------------------------------- -connect.drop-open-error : Added in 10.0.32 -connect.grant2 : Modified in 10.0.32 -connect.infoschema-9739 : Added in 10.0.32 -connect.json : Sporadic wrong result, tentative fix in 10.0.32 -connect.mysql_new : Modified in 10.0.32 -connect.odbc_firebird : Added in 10.0.32 -connect.secure_file_priv : Modified in 10.0.32 -connect.tbl : MDEV-9844, MDEV-10179 - sporadic crashes, valgrind warnings, wrong results -connect.zip : Sporadic wrong result, tentative fix expected in 10.0.32 +connect.alter_xml : Modified in 10.0.33 +connect.alter_xml2 : Added in 10.0.33 +connect.infoschema-9739 : Modified in 10.0.33 +connect.infoschema2-9739 : Added in 10.0.33 +connect.jdbc_new : Modified in 10.0.33 +connect.json : Sporadic wrong result; modified in 10.0.33 +connect.json_java_2 : Added in 10.0.33 +connect.json_java_3 : Added in 10.0.33 +connect.json_mongo_c : Added in 10.0.33 +connect.json_udf : Modified in 10.0.33 +connect.json_udf_bin : Modified in 10.0.33 +connect.mongo_c : Added in 10.0.33 +connect.mongo_java_2 : Added in 10.0.33 +connect.mongo_java_3 : Added in 10.0.33 +connect.mul_new : Added in 10.0.33 +connect.mysql_exec : Modified in 10.0.33 +connect.mysql_new : Modified in 10.0.33 +connect.tbl : MDEV-9844, MDEV-10179 - sporadic crashes, valgrind warnings, wrong results; modified in 10.0.33 +connect.tbl_thread : MDEV-9844, MDEV-10179 - sporadic crashes, valgrind warnings, wrong results; added in 10.0.33 +connect.unsigned : Modified in 10.0.33 +connect.upd : Modified in 10.0.33 +connect.xml : Modified in 10.0.33 +connect.xml2 : Added in 10.0.33 +connect.xml2_grant : Added in 10.0.33 +connect.xml2_html : Added in 10.0.33 +connect.xml2_mdev5261 : Added in 10.0.33 +connect.xml2_mult : Added in 10.0.33 +connect.xml2_zip : Added in 10.0.33 +connect.xml_grant : Modified in 10.0.33 +connect.xml_html : Modified in 10.0.33 +connect.xml_mdev5261 : Modified in 10.0.33 +connect.xml_mult : Modified in 10.0.33 +connect.xml_zip : Modified in 10.0.33 +connect.zip : Sporadic wrong result; modified in 10.0.33 #---------------------------------------------------------------- @@ -118,28 +141,43 @@ funcs_2/charset.* : MDEV-10999 - test not maintained #---------------------------------------------------------------- +innodb.alter_rename_existing : Added in 10.0.33 innodb.binlog_consistent : MDEV-10618 - Server fails to start -innodb.drop_table_background : MDEV-13407 - Tablespace exists; added in 10.0.32 +innodb.create-index-debug : Added in 10.0.33 +innodb.drop_table_background : MDEV-13407 - Tablespace exists +innodb.group_commit_crash : MDEV-11770 - checksum mismatch innodb.group_commit_crash_no_optimize_thread : MDEV-11770 - checksum mismatch -innodb.innodb-alter-debug : Modified in 10.0.32 -innodb.innodb-alter-discard : Modified in 10.0.32 -innodb.innodb-alter-nullable : Modified in 10.0.32 -innodb.innodb-alter-table : MDEV-10619 - Testcase timeout; modified in 10.0.32 -innodb.innodb-alter-tempfile : Modified in 10.0.32 +innodb.index_tree_operation : Added in 10.0.33 +innodb.innodb-alter : Added in 10.0.33 +innodb.innodb-alter-autoinc : Added in 10.0.33 +innodb.innodb-alter-table : MDEV-10619 - Testcase timeout; modified in 10.0.33 innodb.innodb_bug30423 : MDEV-7311 - Wrong number of rows in the plan -innodb.innodb-get-fk : Modified in 10.0.32 +innodb.innodb-get-fk : Modified in 10.0.33 +innodb.innodb-index-debug : Added in 10.0.33 +innodb.innodb-index-online : Added in 10.0.33 +innodb.innodb-index-online-delete : Added in 10.0.33 +innodb.innodb-index-online-fk : Added in 10.0.33 +innodb.innodb-index-online-purge : Added in 10.0.33 innodb.innodb_monitor : MDEV-10939 - Testcase timeout -innodb.log_file_size : Modified in 10.0.32 -innodb.row_format_redundant : Added in 10.0.32 -innodb.table_flags : Added in 10.0.32 +innodb.innodb-table-online : Added in 10.0.33 +innodb.innodb-wl5980-alter : Added in 10.0.33 +innodb.log_file_name : MDEV-14029 - Unexpected files +innodb.table_definition_cache_debug : Added in 10.0.33 +innodb.undo_log : Added in 10.0.33 +innodb.xa_recovery : Modified in 10.0.33 -innodb_zip.innodb_bug36169 : Modified in 10.0.32 -innodb_zip.innodb_bug36172 : Modified in 10.0.32 -innodb_zip.innodb_bug52745 : Modified in 10.0.32 -innodb_zip.innodb_bug53591 : Modified in 10.0.32 -innodb_zip.innodb_bug56680 : Modified in 10.0.32 -innodb_zip.innodb-create-options : Modified in 10.0.32 -innodb_zip.innodb-zip : Modified in 10.0.32 +innodb_fts.concurrent_insert : Added in 10.0.33 +innodb_fts.fulltext : Modified in 10.0.33 +innodb_fts.innodb-fts-fic : MDEV-14154 - Assertion failure +innodb_fts.innodb_fts_misc_debug : MDEV-14156 - Unexpected warning + +innodb_zip.innodb_prefix_index_liftedlimit : Modified in 10.0.33 +innodb_zip.wl5522_debug_zip : MDEV-14140 - Assertion failure + + +#---------------------------------------------------------------- + +maria.maria : Modified in 10.0.33 #---------------------------------------------------------------- @@ -160,9 +198,8 @@ multi_source.status_vars : MDEV-4632 - failed while waiting for Slave_received_h #---------------------------------------------------------------- -parts.longname : Added in 10.0.32 +parts.partition_alter_maria : Added in 10.0.33 parts.partition_exch_qa_10 : MDEV-11765 - wrong result -parts.quoting : Added in 10.0.32 #---------------------------------------------------------------- @@ -183,12 +220,10 @@ plugins.thread_pool_server_audit : MDEV-9562 - crashes on sol10-sparc #---------------------------------------------------------------- roles.create_and_grant_role : MDEV-11772 - wrong result -roles.current_role_view-12666 : Added in 10.0.32 -roles.show_create_database-10463 : Added in 10.0.32 +roles.definer : Modified in 10.0.33 #---------------------------------------------------------------- -rpl.circular_serverid0 : Added in 10.0.32 rpl.last_insert_id : MDEV-10625 - warnings in error log rpl.rpl_auto_increment : MDEV-10417 - Fails on Mips rpl.rpl_auto_increment_bug45679 : MDEV-10417 - Fails on Mips @@ -207,11 +242,7 @@ rpl.rpl_mdev6020 : MDEV-10630, MDEV-10417 - Timeouts, fails rpl.rpl_parallel : MDEV-10653 - Timeouts rpl.rpl_parallel_mdev6589 : MDEV-12979 - Assertion failure rpl.rpl_parallel_temptable : MDEV-10356 - Crash in close_thread_tables -rpl.rpl_parallel_tokudb_delete_pk : Opt file modified in 10.0.32 -rpl.rpl_parallel_tokudb_update_pk_uc0_lookup0 : Modified in 10.0.32 -rpl.rpl_parallel_tokudb_write_pk : Modified in 10.0.32 rpl.rpl_partition_innodb : MDEV-10417 - Fails on Mips -rpl.rpl_reset_slave_fail : Added in 10.0.32 rpl.rpl_row_basic_11bugs : MDEV-12171 - Server failed to start rpl.rpl_row_index_choice : MDEV-13409 - Server crash rpl.rpl_row_sp001 : MDEV-9329 - Fails on Ubuntu/s390x @@ -220,6 +251,7 @@ rpl.rpl_semi_sync_uninstall_plugin : MDEV-7140 - Wrong plugin status rpl.rpl_show_slave_hosts : MDEV-12171 - Server failed to start 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_sp_variables : Modified in 10.0.33 rpl.rpl_sync : MDEV-10633 - Database page corruption rpl.rpl_temporary_error2 : MDEV-10634 - Wrong number of retries @@ -244,13 +276,16 @@ sphinx.* : MDEV-10986 - sphinx tests fail in buildbot and outside #---------------------------------------------------------------- +storage_engine* : Tests are not always timely maintained + +#---------------------------------------------------------------- + stress.ddl_innodb : MDEV-10635 - Testcase timeout #---------------------------------------------------------------- sys_vars.autocommit_func2 : MDEV-9329 - Fails on Ubuntu/s390x sys_vars.innodb_buffer_pool_dump_pct_basic : MDEV-10651 - sporadic failure on file_exists -sys_vars.innodb_sched_priority_cleaner_basic : Modified in 10.0.32 sys_vars.thread_cache_size_func : MDEV-11775 - wrong result #---------------------------------------------------------------- @@ -259,12 +294,13 @@ tokudb.change_column_all_1000_10 : MDEV-12640 - Lost connection during query tokudb.change_column_bin : MDEV-12640 - Lost connection during query tokudb.change_column_char : MDEV-12822 - Lost connection during query tokudb.cluster_filter_unpack_varchar : MDEV-10636 - Wrong execution plan -tokudb.dir_per_db : MDEV-11537 - wrong result +tokudb.dir_per_db : MDEV-11537 - wrong result; modified in 10.0.33 tokudb.dir_per_db_rename_to_nonexisting_schema : MDEV-12823 - Valgrind +tokudb.hotindex-insert-bigchar : MDEV-13870 - ASAN failures tokudb.hotindex-update-1 : MDEV-12640 - Lost connection during query -tokudb.kill_query_blocked_in_lt : Added in 10.0.32 +tokudb.kill_query_blocked_in_lt : Added in 10.0.33 tokudb.locks-select-update-1 : MDEV-13406 - Lock wait timeout -tokudb.locks-select-update-3 : Modified in 10.0.32 +tokudb.locks-select-update-3 : Modified in 10.0.33 tokudb.rows-32m-rand-insert : MDEV-12640 - Lost connection during query tokudb.rows-32m-seq-insert : MDEV-12640 - Lost connection during query @@ -277,42 +313,41 @@ tokudb_bugs.frm_store2 : MDEV-12823 - Valgrind tokudb_bugs.frm_store3 : MDEV-12823 - Valgrind tokudb_bugs.xa : MDEV-11804 - Lock wait timeout -tokudb_mariadb.mdev12972 : Added in 10.0.32 - tokudb_rpl.* : MDEV-11001 - tests don't work tokudb_sys_vars.* : MDEV-11001 - tests don't work -rpl-tokudb.rpl_deadlock_tokudb : Modified in 10.0.32 -rpl-tokudb.rpl_not_null_tokudb : Modified in 10.0.32 -rpl-tokudb.rpl_rfr_disable_on_expl_pk_absence : Modified in 10.0.32 -rpl-tokudb.rpl_row_basic_3tokudb : Modified in 10.0.32 -rpl-tokudb.rpl_stm_tokudb : Modified in 10.0.32 -rpl-tokudb.rpl_tokudb_commit_after_flush : Added in 10.0.32 -rpl-tokudb.rpl_tokudb_insert_id : Added in 10.0.32 -rpl-tokudb.rpl_tokudb_insert_id_pk : Added in 10.0.32 -rpl-tokudb.rpl_tokudb_multi_update : Added in 10.0.32 -rpl-tokudb.rpl_tokudb_multi_update2 : Added in 10.0.32 -rpl-tokudb.rpl_tokudb_multi_update3 : Added in 10.0.32 -rpl-tokudb.rpl_tokudb_rfr_partition_table : Added in 10.0.32 -rpl-tokudb.rpl_tokudb_row_crash_safe : Added in 10.0.32 -rpl-tokudb.rpl_tokudb_row_img_blobs : Added in 10.0.32 -rpl-tokudb.rpl_tokudb_row_img_eng_full : Added in 10.0.32 -rpl-tokudb.rpl_tokudb_row_img_eng_min : Added in 10.0.32 -rpl-tokudb.rpl_tokudb_row_img_eng_noblob : Added in 10.0.32 -rpl-tokudb.rpl_tokudb_row_img_idx_full : Added in 10.0.32 -rpl-tokudb.rpl_tokudb_row_img_idx_min : Added in 10.0.32 -rpl-tokudb.rpl_tokudb_row_img_idx_noblob : Added in 10.0.32 -rpl-tokudb.rpl_tokudb_row_log : Added in 10.0.32 -rpl-tokudb.rpl_tokudb_row_lower_case_table_names : Added in 10.0.32 -rpl-tokudb.rpl_tokudb_row_sp003 : Added in 10.0.32 -rpl-tokudb.rpl_tokudb_row_sp006 : Added in 10.0.32 -rpl-tokudb.rpl_tokudb_row_trig004 : Added in 10.0.32 -rpl-tokudb.rpl_tokudb_stm_log : Added in 10.0.32 -rpl-tokudb.rpl_tokudb_stm_mixed_crash_safe : Added in 10.0.32 -rpl-tokudb.rpl_tokudb_stm_mixed_lower_case_table_names : Added in 10.0.32 +rpl-tokudb.rpl_parallel_tokudb_delete_pk : Opt file modified in 10.0.33 +rpl-tokudb.rpl_parallel_tokudb_update_pk_uc0_lookup0 : Modified in 10.0.33 +rpl-tokudb.rpl_parallel_tokudb_write_pk : Modified in 10.0.33 +rpl-tokudb.rpl_rfr_disable_on_expl_pk_absence : Added in 10.0.33 +rpl-tokudb.rpl_row_basic_3tokudb : Modified in 10.0.33 +rpl-tokudb.rpl_tokudb_commit_after_flush : Added in 10.0.33 +rpl-tokudb.rpl_tokudb_insert_id : Added in 10.0.33 +rpl-tokudb.rpl_tokudb_insert_id_pk : Added in 10.0.33 +rpl-tokudb.rpl_tokudb_multi_update : Added in 10.0.33 +rpl-tokudb.rpl_tokudb_multi_update2 : Added in 10.0.33 +rpl-tokudb.rpl_tokudb_multi_update3 : Added in 10.0.33 +rpl-tokudb.rpl_tokudb_rfr_partition_table : Added in 10.0.33 +rpl-tokudb.rpl_tokudb_row_crash_safe : Added in 10.0.33 +rpl-tokudb.rpl_tokudb_row_img_blobs : Added in 10.0.33 +rpl-tokudb.rpl_tokudb_row_img_eng_full : Added in 10.0.33 +rpl-tokudb.rpl_tokudb_row_img_eng_min : Added in 10.0.33 +rpl-tokudb.rpl_tokudb_row_img_eng_noblob : Added in 10.0.33 +rpl-tokudb.rpl_tokudb_row_img_idx_full : Added in 10.0.33 +rpl-tokudb.rpl_tokudb_row_img_idx_min : Added in 10.0.33 +rpl-tokudb.rpl_tokudb_row_img_idx_noblob : Added in 10.0.33 +rpl-tokudb.rpl_tokudb_row_log : Added in 10.0.33 +rpl-tokudb.rpl_tokudb_row_lower_case_table_names : Added in 10.0.33 +rpl-tokudb.rpl_tokudb_row_sp003 : Added in 10.0.33 +rpl-tokudb.rpl_tokudb_row_sp006 : Added in 10.0.33 +rpl-tokudb.rpl_tokudb_row_trig004 : Added in 10.0.33 +rpl-tokudb.rpl_tokudb_stm_log : Added in 10.0.33 +rpl-tokudb.rpl_tokudb_stm_mixed_crash_safe : Added in 10.0.33 +rpl-tokudb.rpl_tokudb_stm_mixed_lower_case_table_names : Added in 10.0.33 #---------------------------------------------------------------- +unit.lf : MDEV-12897 - Unexpected return code unit.ma_test_loghandler : MDEV-10638 - record read not ok unit.pfs : MySQL:84457 - unittest pft-t failing @@ -320,5 +355,6 @@ unit.pfs : MySQL:84457 - unittest pft-t failing vcol.not_supported : MDEV-10639 - Testcase timeout vcol.vcol_keys_innodb : MDEV-10639 - Testcase timeout +vcol.vcol_misc : Modified in 10.0.33 #---------------------------------------------------------------- From 2b332ab79527e9f7dd2560d3dcd53436282be95a Mon Sep 17 00:00:00 2001 From: Daniel Bartholomew Date: Mon, 30 Oct 2017 12:31:40 -0400 Subject: [PATCH 3/5] bump the VERSION --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 5a19a706528..24d355ca91e 100644 --- a/VERSION +++ b/VERSION @@ -1,3 +1,3 @@ MYSQL_VERSION_MAJOR=10 MYSQL_VERSION_MINOR=0 -MYSQL_VERSION_PATCH=33 +MYSQL_VERSION_PATCH=34 From d11001d11bd4657008afb5a901003689a23f768c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Fri, 27 Oct 2017 11:36:32 +0300 Subject: [PATCH 4/5] Backport MDEV-13890 from 10.2 (InnoDB/XtraDB shutdown failure) If InnoDB or XtraDB recovered committed transactions at server startup, but the processing of recovered transactions was prevented by innodb_read_only or by innodb_force_recovery, an assertion would fail at shutdown. This bug was originally reproduced when Mariabackup executed InnoDB shutdown after preparing (applying redo log into) a backup. trx_free_prepared(): Allow TRX_STATE_COMMITTED_IN_MEMORY. trx_undo_free_prepared(): Allow any undo log state. For transactions that were resurrected in TRX_STATE_COMMITTED_IN_MEMORY the undo log state would have been reset by trx_undo_set_state_at_finish(). --- storage/innobase/trx/trx0trx.cc | 5 +++-- storage/innobase/trx/trx0undo.cc | 14 +++++++++++++- storage/xtradb/trx/trx0trx.cc | 5 +++-- storage/xtradb/trx/trx0undo.cc | 14 +++++++++++++- 4 files changed, 32 insertions(+), 6 deletions(-) diff --git a/storage/innobase/trx/trx0trx.cc b/storage/innobase/trx/trx0trx.cc index c38c9bf7188..8974bfc2904 100644 --- a/storage/innobase/trx/trx0trx.cc +++ b/storage/innobase/trx/trx0trx.cc @@ -309,8 +309,9 @@ trx_free_prepared( trx_t* trx) /*!< in, own: trx object */ { ut_a(trx_state_eq(trx, TRX_STATE_PREPARED) - || (trx_state_eq(trx, TRX_STATE_ACTIVE) - && trx->is_recovered + || (trx->is_recovered + && (trx_state_eq(trx, TRX_STATE_ACTIVE) + || trx_state_eq(trx, TRX_STATE_COMMITTED_IN_MEMORY)) && (srv_read_only_mode || srv_force_recovery >= SRV_FORCE_NO_TRX_UNDO))); ut_a(trx->magic_n == TRX_MAGIC_N); diff --git a/storage/innobase/trx/trx0undo.cc b/storage/innobase/trx/trx0undo.cc index 220589dd9ff..1836d282cd4 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) 2014, 2017, MariaDB Corporation. 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 @@ -2015,6 +2015,12 @@ trx_undo_free_prepared( switch (trx->update_undo->state) { case TRX_UNDO_PREPARED: break; + case TRX_UNDO_CACHED: + case TRX_UNDO_TO_FREE: + case TRX_UNDO_TO_PURGE: + ut_ad(trx_state_eq(trx, + TRX_STATE_COMMITTED_IN_MEMORY)); + /* fall through */ case TRX_UNDO_ACTIVE: /* lock_trx_release_locks() assigns trx->is_recovered=false */ @@ -2033,6 +2039,12 @@ trx_undo_free_prepared( switch (trx->insert_undo->state) { case TRX_UNDO_PREPARED: break; + case TRX_UNDO_CACHED: + case TRX_UNDO_TO_FREE: + case TRX_UNDO_TO_PURGE: + ut_ad(trx_state_eq(trx, + TRX_STATE_COMMITTED_IN_MEMORY)); + /* fall through */ case TRX_UNDO_ACTIVE: /* lock_trx_release_locks() assigns trx->is_recovered=false */ diff --git a/storage/xtradb/trx/trx0trx.cc b/storage/xtradb/trx/trx0trx.cc index d3b1f1da054..45578283235 100644 --- a/storage/xtradb/trx/trx0trx.cc +++ b/storage/xtradb/trx/trx0trx.cc @@ -475,8 +475,9 @@ trx_free_prepared( trx_t* trx) /*!< in, own: trx object */ { ut_a(trx_state_eq(trx, TRX_STATE_PREPARED) - || (trx_state_eq(trx, TRX_STATE_ACTIVE) - && trx->is_recovered + || (trx->is_recovered + && (trx_state_eq(trx, TRX_STATE_ACTIVE) + || trx_state_eq(trx, TRX_STATE_COMMITTED_IN_MEMORY)) && (srv_read_only_mode || srv_force_recovery >= SRV_FORCE_NO_TRX_UNDO))); ut_a(trx->magic_n == TRX_MAGIC_N); diff --git a/storage/xtradb/trx/trx0undo.cc b/storage/xtradb/trx/trx0undo.cc index 220589dd9ff..1836d282cd4 100644 --- a/storage/xtradb/trx/trx0undo.cc +++ b/storage/xtradb/trx/trx0undo.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2014, 2017, MariaDB Corporation. 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 @@ -2015,6 +2015,12 @@ trx_undo_free_prepared( switch (trx->update_undo->state) { case TRX_UNDO_PREPARED: break; + case TRX_UNDO_CACHED: + case TRX_UNDO_TO_FREE: + case TRX_UNDO_TO_PURGE: + ut_ad(trx_state_eq(trx, + TRX_STATE_COMMITTED_IN_MEMORY)); + /* fall through */ case TRX_UNDO_ACTIVE: /* lock_trx_release_locks() assigns trx->is_recovered=false */ @@ -2033,6 +2039,12 @@ trx_undo_free_prepared( switch (trx->insert_undo->state) { case TRX_UNDO_PREPARED: break; + case TRX_UNDO_CACHED: + case TRX_UNDO_TO_FREE: + case TRX_UNDO_TO_PURGE: + ut_ad(trx_state_eq(trx, + TRX_STATE_COMMITTED_IN_MEMORY)); + /* fall through */ case TRX_UNDO_ACTIVE: /* lock_trx_release_locks() assigns trx->is_recovered=false */ From 88edb1b3edcea0dad82659ca6622448e535a3fa6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Mon, 30 Oct 2017 18:47:43 +0200 Subject: [PATCH 5/5] MDEV-14219 Allow online table rebuild when encryption or compression parameters change When MariaDB 10.1.0 introduced table options for encryption and compression, it unnecessarily changed ha_innobase::check_if_supported_inplace_alter() so that ALGORITHM=COPY is forced when these parameters differ. A better solution is to move the check to innobase_need_rebuild(). In that way, the ALGORITHM=INPLACE interface (yes, the syntax is very misleading) can be used for rebuilding the table much more efficiently, with merge sort, with no undo logging, and allowing concurrent DML operations. --- .../encryption/r/encryption_force.result | 4 +- .../encryption/r/filekeys_encfile.result | 2 +- .../encryption/r/filekeys_encfile_file.result | 2 +- .../r/innodb-encryption-alter.result | 5 +- .../suite/encryption/t/encryption_force.test | 6 +- .../suite/encryption/t/filekeys_goodtest.inc | 4 +- .../encryption/t/innodb-encryption-alter.test | 4 +- .../r/innodb-page_compression_tables.result | 5 +- .../suite/innodb/r/innodb-table-online.result | 6 +- .../t/innodb-page_compression_tables.test | 4 +- .../suite/innodb/t/innodb-table-online.test | 7 +- storage/innobase/handler/handler0alter.cc | 88 ++++++++++--------- storage/xtradb/handler/handler0alter.cc | 88 ++++++++++--------- 13 files changed, 116 insertions(+), 109 deletions(-) diff --git a/mysql-test/suite/encryption/r/encryption_force.result b/mysql-test/suite/encryption/r/encryption_force.result index de5f7da60a8..9d42b360e7c 100644 --- a/mysql-test/suite/encryption/r/encryption_force.result +++ b/mysql-test/suite/encryption/r/encryption_force.result @@ -34,11 +34,11 @@ t4 CREATE TABLE `t4` ( /*!50100 PARTITION BY HASH (a) PARTITIONS 2 */ alter table t1 encrypted=no; -ERROR HY000: Can't create table `test`.`#sql-temporary` (errno: 140 "Wrong create options") +ERROR HY000: Table storage engine 'InnoDB' does not support the create option 'ENCRYPTED' alter table t2 encrypted=yes; alter table t3 encrypted=default; alter table t4 encrypted=no; -ERROR HY000: Can't create table `test`.`#sql-temporary` (errno: 140 "Wrong create options") +ERROR HY000: Table storage engine 'InnoDB' does not support the create option 'ENCRYPTED' show create table t1; Table Create Table t1 CREATE TABLE `t1` ( diff --git a/mysql-test/suite/encryption/r/filekeys_encfile.result b/mysql-test/suite/encryption/r/filekeys_encfile.result index add6f312fda..6d5baa1b7ff 100644 --- a/mysql-test/suite/encryption/r/filekeys_encfile.result +++ b/mysql-test/suite/encryption/r/filekeys_encfile.result @@ -14,7 +14,7 @@ t1 CREATE TABLE `t1` ( `b` char(200) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 `encrypted`=yes `encryption_key_id`=2 alter table t1 encryption_key_id=3; -ERROR HY000: Can't create table `test`.`#sql-temporary` (errno: 140 "Wrong create options") +ERROR HY000: Table storage engine 'InnoDB' does not support the create option 'ENCRYPTION_KEY_ID' show create table t1; Table Create Table t1 CREATE TABLE `t1` ( diff --git a/mysql-test/suite/encryption/r/filekeys_encfile_file.result b/mysql-test/suite/encryption/r/filekeys_encfile_file.result index add6f312fda..6d5baa1b7ff 100644 --- a/mysql-test/suite/encryption/r/filekeys_encfile_file.result +++ b/mysql-test/suite/encryption/r/filekeys_encfile_file.result @@ -14,7 +14,7 @@ t1 CREATE TABLE `t1` ( `b` char(200) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 `encrypted`=yes `encryption_key_id`=2 alter table t1 encryption_key_id=3; -ERROR HY000: Can't create table `test`.`#sql-temporary` (errno: 140 "Wrong create options") +ERROR HY000: Table storage engine 'InnoDB' does not support the create option 'ENCRYPTION_KEY_ID' show create table t1; Table Create Table t1 CREATE TABLE `t1` ( diff --git a/mysql-test/suite/encryption/r/innodb-encryption-alter.result b/mysql-test/suite/encryption/r/innodb-encryption-alter.result index 5869c5d7000..9ff0f492034 100644 --- a/mysql-test/suite/encryption/r/innodb-encryption-alter.result +++ b/mysql-test/suite/encryption/r/innodb-encryption-alter.result @@ -43,11 +43,10 @@ CREATE TABLE t2 (pk INT PRIMARY KEY AUTO_INCREMENT, c VARCHAR(256)) ENGINE=INNOD Warnings: Warning 140 InnoDB: Ignored ENCRYPTION_KEY_ID 1 when encryption is disabled ALTER TABLE t1 ENCRYPTION_KEY_ID=99; -ERROR HY000: Can't create table `test`.`#sql-temporary` (errno: 140 "Wrong create options") +ERROR HY000: Table storage engine 'InnoDB' does not support the create option 'ENCRYPTION_KEY_ID' SHOW WARNINGS; Level Code Message Warning 140 InnoDB: ENCRYPTION_KEY_ID 99 not available -Error 1005 Can't create table `test`.`#sql-temporary` (errno: 140 "Wrong create options") -Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB +Error 1478 Table storage engine 'InnoDB' does not support the create option 'ENCRYPTION_KEY_ID' set innodb_default_encryption_key_id = 1; drop table t1,t2; diff --git a/mysql-test/suite/encryption/t/encryption_force.test b/mysql-test/suite/encryption/t/encryption_force.test index 3e09dd91839..3c6f039184b 100644 --- a/mysql-test/suite/encryption/t/encryption_force.test +++ b/mysql-test/suite/encryption/t/encryption_force.test @@ -22,13 +22,11 @@ show create table t2; show create table t3; show create table t4; ---replace_regex /#sql-[0-9a-f_]*/#sql-temporary/ ---error ER_CANT_CREATE_TABLE +--error ER_ILLEGAL_HA_CREATE_OPTION alter table t1 encrypted=no; alter table t2 encrypted=yes; alter table t3 encrypted=default; ---replace_regex /#sql-[0-9a-f_]*/#sql-temporary/ ---error ER_CANT_CREATE_TABLE +--error ER_ILLEGAL_HA_CREATE_OPTION alter table t4 encrypted=no; show create table t1; diff --git a/mysql-test/suite/encryption/t/filekeys_goodtest.inc b/mysql-test/suite/encryption/t/filekeys_goodtest.inc index 146a570412c..5317eeb3d12 100644 --- a/mysql-test/suite/encryption/t/filekeys_goodtest.inc +++ b/mysql-test/suite/encryption/t/filekeys_goodtest.inc @@ -7,8 +7,7 @@ insert t1 values (12345, repeat('1234567890', 20)); alter table t1 encryption_key_id=2; show create table t1; ---replace_regex /#sql-[0-9a-f_]*/#sql-temporary/ ---error ER_CANT_CREATE_TABLE +--error ER_ILLEGAL_HA_CREATE_OPTION alter table t1 encryption_key_id=3; show create table t1; alter table t1 encryption_key_id=33; @@ -17,4 +16,3 @@ alter table t1 encryption_key_id=4; show create table t1; drop table t1; - diff --git a/mysql-test/suite/encryption/t/innodb-encryption-alter.test b/mysql-test/suite/encryption/t/innodb-encryption-alter.test index 316ece1c16b..9420fb74a4c 100644 --- a/mysql-test/suite/encryption/t/innodb-encryption-alter.test +++ b/mysql-test/suite/encryption/t/innodb-encryption-alter.test @@ -33,10 +33,8 @@ DROP TABLE t1; CREATE TABLE t1 (pk INT PRIMARY KEY AUTO_INCREMENT, c VARCHAR(256)) ENGINE=INNODB; SHOW CREATE TABLE t1; CREATE TABLE t2 (pk INT PRIMARY KEY AUTO_INCREMENT, c VARCHAR(256)) ENGINE=INNODB ENCRYPTED=NO ENCRYPTION_KEY_ID=1; ---replace_regex /#sql-[0-9a-f_]*/#sql-temporary/ ---error 1005 +--error ER_ILLEGAL_HA_CREATE_OPTION ALTER TABLE t1 ENCRYPTION_KEY_ID=99; ---replace_regex /#sql-[0-9a-f_]*/#sql-temporary/ SHOW WARNINGS; set innodb_default_encryption_key_id = 1; diff --git a/mysql-test/suite/innodb/r/innodb-page_compression_tables.result b/mysql-test/suite/innodb/r/innodb-page_compression_tables.result index 98de5db3c12..072f1d1e440 100644 --- a/mysql-test/suite/innodb/r/innodb-page_compression_tables.result +++ b/mysql-test/suite/innodb/r/innodb-page_compression_tables.result @@ -38,12 +38,11 @@ innodb_redundant CREATE TABLE `innodb_redundant` ( `b` char(200) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=REDUNDANT alter table innodb_redundant page_compressed=1; -ERROR HY000: Can't create table `test`.`#sql-temporary` (errno: 140 "Wrong create options") +ERROR HY000: Table storage engine 'InnoDB' does not support the create option 'PAGE_COMPRESSED' show warnings; Level Code Message Warning 140 InnoDB: PAGE_COMPRESSED table can't have ROW_TYPE=REDUNDANT -Error 1005 Can't create table `test`.`#sql-temporary` (errno: 140 "Wrong create options") -Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB +Error 1478 Table storage engine 'InnoDB' does not support the create option 'PAGE_COMPRESSED' show create table innodb_redundant; Table Create Table innodb_redundant CREATE TABLE `innodb_redundant` ( diff --git a/mysql-test/suite/innodb/r/innodb-table-online.result b/mysql-test/suite/innodb/r/innodb-table-online.result index cc4df79c10a..9b1097b3afa 100644 --- a/mysql-test/suite/innodb/r/innodb-table-online.result +++ b/mysql-test/suite/innodb/r/innodb-table-online.result @@ -3,6 +3,8 @@ call mtr.add_suppression("InnoDB: Error: table 'test/t1'"); call mtr.add_suppression("MySQL is trying to open a table handle but the .ibd file for"); SET @global_innodb_file_per_table_orig = @@global.innodb_file_per_table; SET GLOBAL innodb_file_per_table = on; +SET @file_format = @@GLOBAL.innodb_file_format; +SET GLOBAL innodb_file_format = Barracuda; CREATE TABLE t1 (c1 INT PRIMARY KEY, c2 INT NOT NULL, c3 CHAR(255) NOT NULL) ENGINE = InnoDB; INSERT INTO t1 VALUES (1,1,''), (2,2,''), (3,3,''), (4,4,''), (5,5,''); @@ -203,7 +205,8 @@ t1 CREATE TABLE `t1` ( ALTER TABLE t1 ROW_FORMAT=REDUNDANT; SET DEBUG_SYNC = 'row_log_table_apply1_before SIGNAL rebuilt2 WAIT_FOR dml2_done'; SET lock_wait_timeout = 10; -ALTER TABLE t1 ROW_FORMAT=COMPACT, ALGORITHM = INPLACE; +ALTER TABLE t1 ROW_FORMAT=COMPACT +PAGE_COMPRESSED = YES PAGE_COMPRESSION_LEVEL = 1, ALGORITHM = INPLACE; # session default INSERT INTO t1 SELECT 80 + c1, c2, c3 FROM t1; INSERT INTO t1 SELECT 160 + c1, c2, c3 FROM t1; @@ -438,5 +441,6 @@ SET DEBUG_SYNC = 'RESET'; SET GLOBAL innodb_monitor_disable = module_ddl; DROP TABLE t1; SET GLOBAL innodb_file_per_table = @global_innodb_file_per_table_orig; +SET GLOBAL innodb_file_format = @file_format; SET GLOBAL innodb_monitor_enable = default; SET GLOBAL innodb_monitor_disable = default; diff --git a/mysql-test/suite/innodb/t/innodb-page_compression_tables.test b/mysql-test/suite/innodb/t/innodb-page_compression_tables.test index 41d844d26b4..d8a85d7f273 100644 --- a/mysql-test/suite/innodb/t/innodb-page_compression_tables.test +++ b/mysql-test/suite/innodb/t/innodb-page_compression_tables.test @@ -32,10 +32,8 @@ create table innodb_redundant(c1 bigint not null, b char(200)) engine=innodb row show warnings; create table innodb_redundant(c1 bigint not null, b char(200)) engine=innodb row_format=redundant; show create table innodb_redundant; ---replace_regex /#sql-[0-9a-f_]*`/#sql-temporary`/ ---error 1005 +--error ER_ILLEGAL_HA_CREATE_OPTION alter table innodb_redundant page_compressed=1; ---replace_regex /#sql-[0-9a-f_]*`/#sql-temporary`/ show warnings; show create table innodb_redundant; alter table innodb_redundant row_format=compact page_compressed=1; diff --git a/mysql-test/suite/innodb/t/innodb-table-online.test b/mysql-test/suite/innodb/t/innodb-table-online.test index 938025359c5..b9c9dc085d6 100644 --- a/mysql-test/suite/innodb/t/innodb-table-online.test +++ b/mysql-test/suite/innodb/t/innodb-table-online.test @@ -14,6 +14,9 @@ call mtr.add_suppression("MySQL is trying to open a table handle but the .ibd fi # DISCARD TABLESPACE needs file-per-table SET @global_innodb_file_per_table_orig = @@global.innodb_file_per_table; SET GLOBAL innodb_file_per_table = on; +# PAGE_COMPRESSED needs innodb_file_format!=Antelope +SET @file_format = @@GLOBAL.innodb_file_format; +SET GLOBAL innodb_file_format = Barracuda; # Save the initial number of concurrent sessions. --source include/count_sessions.inc @@ -215,7 +218,8 @@ SET DEBUG_SYNC = 'row_log_table_apply1_before SIGNAL rebuilt2 WAIT_FOR dml2_done # Ensure that the ALTER TABLE will be executed even with some concurrent DML. SET lock_wait_timeout = 10; --send -ALTER TABLE t1 ROW_FORMAT=COMPACT, ALGORITHM = INPLACE; +ALTER TABLE t1 ROW_FORMAT=COMPACT +PAGE_COMPRESSED = YES PAGE_COMPRESSION_LEVEL = 1, ALGORITHM = INPLACE; # Generate some log (delete-mark, delete-unmark, insert etc.) # while the index creation is blocked. Some of this may run @@ -443,6 +447,7 @@ DROP TABLE t1; --source include/wait_until_count_sessions.inc SET GLOBAL innodb_file_per_table = @global_innodb_file_per_table_orig; +SET GLOBAL innodb_file_format = @file_format; --disable_warnings SET GLOBAL innodb_monitor_enable = default; SET GLOBAL innodb_monitor_disable = default; diff --git a/storage/innobase/handler/handler0alter.cc b/storage/innobase/handler/handler0alter.cc index a1f0fbb1e7e..bdc4987b5c9 100644 --- a/storage/innobase/handler/handler0alter.cc +++ b/storage/innobase/handler/handler0alter.cc @@ -208,32 +208,44 @@ innobase_fulltext_exist( return(false); } -/*******************************************************************//** -Determine if ALTER TABLE needs to rebuild the table. -@param ha_alter_info the DDL operation -@param altered_table MySQL original table +/** Determine if ALTER TABLE needs to rebuild the table. +@param ha_alter_info the DDL operation +@param table metadata before ALTER TABLE @return whether it is necessary to rebuild the table */ static MY_ATTRIBUTE((nonnull, warn_unused_result)) bool innobase_need_rebuild( -/*==================*/ const Alter_inplace_info* ha_alter_info, - const TABLE* altered_table) + const TABLE* table) { Alter_inplace_info::HA_ALTER_FLAGS alter_inplace_flags = - ha_alter_info->handler_flags & ~(INNOBASE_INPLACE_IGNORE); + ha_alter_info->handler_flags & ~INNOBASE_INPLACE_IGNORE; - if (alter_inplace_flags - == Alter_inplace_info::CHANGE_CREATE_OPTION + if (alter_inplace_flags & Alter_inplace_info::CHANGE_CREATE_OPTION) { + const ha_table_option_struct& alt_opt= + *ha_alter_info->create_info->option_struct; + const ha_table_option_struct& opt= *table->s->option_struct; + + if (alt_opt.page_compressed != opt.page_compressed + || alt_opt.page_compression_level + != opt.page_compression_level + || alt_opt.encryption != opt.encryption + || alt_opt.encryption_key_id != opt.encryption_key_id) { + return(true); + } + } + + if (alter_inplace_flags == Alter_inplace_info::CHANGE_CREATE_OPTION && !(ha_alter_info->create_info->used_fields & (HA_CREATE_USED_ROW_FORMAT | HA_CREATE_USED_KEY_BLOCK_SIZE))) { /* Any other CHANGE_CREATE_OPTION than changing - ROW_FORMAT or KEY_BLOCK_SIZE is ignored. */ + ROW_FORMAT or KEY_BLOCK_SIZE can be done without + rebuilding the table. */ return(false); } - return(!!(ha_alter_info->handler_flags & INNOBASE_ALTER_REBUILD)); + return(!!(alter_inplace_flags & INNOBASE_ALTER_REBUILD)); } /** Check if InnoDB supports a particular alter table in-place @@ -283,29 +295,6 @@ ha_innobase::check_if_supported_inplace_alter( update_thd(); trx_search_latch_release_if_reserved(prebuilt->trx); - /* Change on engine specific table options require rebuild of the - table */ - if (ha_alter_info->handler_flags - & Alter_inplace_info::CHANGE_CREATE_OPTION) { - ha_table_option_struct *new_options= ha_alter_info->create_info->option_struct; - ha_table_option_struct *old_options= table->s->option_struct; - - if (new_options->page_compressed != old_options->page_compressed || - new_options->page_compression_level != old_options->page_compression_level || - new_options->atomic_writes != old_options->atomic_writes) { - ha_alter_info->unsupported_reason = innobase_get_err_msg( - ER_ALTER_OPERATION_NOT_SUPPORTED_REASON); - DBUG_RETURN(HA_ALTER_INPLACE_NOT_SUPPORTED); - } - - if (new_options->encryption != old_options->encryption || - new_options->encryption_key_id != old_options->encryption_key_id) { - ha_alter_info->unsupported_reason = innobase_get_err_msg( - ER_ALTER_OPERATION_NOT_SUPPORTED_REASON); - DBUG_RETURN(HA_ALTER_INPLACE_NOT_SUPPORTED); - } - } - if (ha_alter_info->handler_flags & ~(INNOBASE_INPLACE_IGNORE | INNOBASE_ALTER_NOREBUILD @@ -584,7 +573,7 @@ ha_innobase::check_if_supported_inplace_alter( operation is possible. */ } else if (((ha_alter_info->handler_flags & Alter_inplace_info::ADD_PK_INDEX) - || innobase_need_rebuild(ha_alter_info, table)) + || innobase_need_rebuild(ha_alter_info, table)) && (innobase_fulltext_exist(altered_table))) { /* Refuse to rebuild the table online, if fulltext indexes are to survive the rebuild. */ @@ -2863,7 +2852,6 @@ prepare_inplace_alter_table_dict( to rebuild the table with a temporary name. */ if (new_clustered) { - fil_space_crypt_t* crypt_data; const char* new_table_name = dict_mem_create_temporary_tablename( ctx->heap, @@ -2874,13 +2862,29 @@ prepare_inplace_alter_table_dict( ulint key_id = FIL_DEFAULT_ENCRYPTION_KEY; fil_encryption_t mode = FIL_ENCRYPTION_DEFAULT; - fil_space_t* space = fil_space_acquire(ctx->prebuilt->table->space); - crypt_data = space->crypt_data; - fil_space_release(space); + if (fil_space_t* space + = fil_space_acquire(ctx->prebuilt->table->space)) { + if (const fil_space_crypt_t* crypt_data + = space->crypt_data) { + key_id = crypt_data->key_id; + mode = crypt_data->encryption; + } - if (crypt_data) { - key_id = crypt_data->key_id; - mode = crypt_data->encryption; + fil_space_release(space); + } + + if (ha_alter_info->handler_flags + & Alter_inplace_info::CHANGE_CREATE_OPTION) { + const ha_table_option_struct& alt_opt= + *ha_alter_info->create_info->option_struct; + const ha_table_option_struct& opt= + *old_table->s->option_struct; + if (alt_opt.encryption != opt.encryption + || alt_opt.encryption_key_id + != opt.encryption_key_id) { + key_id = alt_opt.encryption_key_id; + mode = fil_encryption_t(alt_opt.encryption); + } } if (innobase_check_foreigns( diff --git a/storage/xtradb/handler/handler0alter.cc b/storage/xtradb/handler/handler0alter.cc index 0842d11d178..b2f0d301815 100644 --- a/storage/xtradb/handler/handler0alter.cc +++ b/storage/xtradb/handler/handler0alter.cc @@ -212,32 +212,44 @@ innobase_fulltext_exist( return(false); } -/*******************************************************************//** -Determine if ALTER TABLE needs to rebuild the table. -@param ha_alter_info the DDL operation -@param altered_table MySQL original table +/** Determine if ALTER TABLE needs to rebuild the table. +@param ha_alter_info the DDL operation +@param table metadata before ALTER TABLE @return whether it is necessary to rebuild the table */ static MY_ATTRIBUTE((nonnull, warn_unused_result)) bool innobase_need_rebuild( -/*==================*/ const Alter_inplace_info* ha_alter_info, - const TABLE* altered_table) + const TABLE* table) { Alter_inplace_info::HA_ALTER_FLAGS alter_inplace_flags = - ha_alter_info->handler_flags & ~(INNOBASE_INPLACE_IGNORE); + ha_alter_info->handler_flags & ~INNOBASE_INPLACE_IGNORE; - if (alter_inplace_flags - == Alter_inplace_info::CHANGE_CREATE_OPTION + if (alter_inplace_flags & Alter_inplace_info::CHANGE_CREATE_OPTION) { + const ha_table_option_struct& alt_opt= + *ha_alter_info->create_info->option_struct; + const ha_table_option_struct& opt= *table->s->option_struct; + + if (alt_opt.page_compressed != opt.page_compressed + || alt_opt.page_compression_level + != opt.page_compression_level + || alt_opt.encryption != opt.encryption + || alt_opt.encryption_key_id != opt.encryption_key_id) { + return(true); + } + } + + if (alter_inplace_flags == Alter_inplace_info::CHANGE_CREATE_OPTION && !(ha_alter_info->create_info->used_fields & (HA_CREATE_USED_ROW_FORMAT | HA_CREATE_USED_KEY_BLOCK_SIZE))) { /* Any other CHANGE_CREATE_OPTION than changing - ROW_FORMAT or KEY_BLOCK_SIZE is ignored. */ + ROW_FORMAT or KEY_BLOCK_SIZE can be done without + rebuilding the table. */ return(false); } - return(!!(ha_alter_info->handler_flags & INNOBASE_ALTER_REBUILD)); + return(!!(alter_inplace_flags & INNOBASE_ALTER_REBUILD)); } /** Check if InnoDB supports a particular alter table in-place @@ -287,29 +299,6 @@ ha_innobase::check_if_supported_inplace_alter( update_thd(); trx_search_latch_release_if_reserved(prebuilt->trx); - /* Change on engine specific table options require rebuild of the - table */ - if (ha_alter_info->handler_flags - & Alter_inplace_info::CHANGE_CREATE_OPTION) { - ha_table_option_struct *new_options= ha_alter_info->create_info->option_struct; - ha_table_option_struct *old_options= table->s->option_struct; - - if (new_options->page_compressed != old_options->page_compressed || - new_options->page_compression_level != old_options->page_compression_level || - new_options->atomic_writes != old_options->atomic_writes) { - ha_alter_info->unsupported_reason = innobase_get_err_msg( - ER_ALTER_OPERATION_NOT_SUPPORTED_REASON); - DBUG_RETURN(HA_ALTER_INPLACE_NOT_SUPPORTED); - } - - if (new_options->encryption != old_options->encryption || - new_options->encryption_key_id != old_options->encryption_key_id) { - ha_alter_info->unsupported_reason = innobase_get_err_msg( - ER_ALTER_OPERATION_NOT_SUPPORTED_REASON); - DBUG_RETURN(HA_ALTER_INPLACE_NOT_SUPPORTED); - } - } - if (ha_alter_info->handler_flags & ~(INNOBASE_INPLACE_IGNORE | INNOBASE_ALTER_NOREBUILD @@ -589,7 +578,7 @@ ha_innobase::check_if_supported_inplace_alter( operation is possible. */ } else if (((ha_alter_info->handler_flags & Alter_inplace_info::ADD_PK_INDEX) - || innobase_need_rebuild(ha_alter_info, table)) + || innobase_need_rebuild(ha_alter_info, table)) && (innobase_fulltext_exist(altered_table))) { /* Refuse to rebuild the table online, if fulltext indexes are to survive the rebuild. */ @@ -2870,7 +2859,6 @@ prepare_inplace_alter_table_dict( to rebuild the table with a temporary name. */ if (new_clustered) { - fil_space_crypt_t* crypt_data; const char* new_table_name = dict_mem_create_temporary_tablename( ctx->heap, @@ -2881,13 +2869,29 @@ prepare_inplace_alter_table_dict( ulint key_id = FIL_DEFAULT_ENCRYPTION_KEY; fil_encryption_t mode = FIL_ENCRYPTION_DEFAULT; - fil_space_t* space = fil_space_acquire(ctx->prebuilt->table->space); - crypt_data = space->crypt_data; - fil_space_release(space); + if (fil_space_t* space + = fil_space_acquire(ctx->prebuilt->table->space)) { + if (const fil_space_crypt_t* crypt_data + = space->crypt_data) { + key_id = crypt_data->key_id; + mode = crypt_data->encryption; + } - if (crypt_data) { - key_id = crypt_data->key_id; - mode = crypt_data->encryption; + fil_space_release(space); + } + + if (ha_alter_info->handler_flags + & Alter_inplace_info::CHANGE_CREATE_OPTION) { + const ha_table_option_struct& alt_opt= + *ha_alter_info->create_info->option_struct; + const ha_table_option_struct& opt= + *old_table->s->option_struct; + if (alt_opt.encryption != opt.encryption + || alt_opt.encryption_key_id + != opt.encryption_key_id) { + key_id = alt_opt.encryption_key_id; + mode = fil_encryption_t(alt_opt.encryption); + } } if (innobase_check_foreigns(