From 6aff5fa27ae863670608ae88b134453fe53c3e17 Mon Sep 17 00:00:00 2001 From: Alexander Barkov Date: Mon, 26 Mar 2018 10:33:58 +0400 Subject: MDEV-15619 using CONVERT() inside AES_ENCRYPT() in an UPDATE corrupts data --- mysql-test/r/func_str.result | 37 +++++++++++++++++++++++++++++++++++++ mysql-test/t/func_str.test | 36 ++++++++++++++++++++++++++++++++++++ sql/item_strfunc.cc | 4 ++-- sql/item_strfunc.h | 19 +++++++++++++++---- 4 files changed, 90 insertions(+), 6 deletions(-) diff --git a/mysql-test/r/func_str.result b/mysql-test/r/func_str.result index 9a9b9f0d73d..ceaeb64fa01 100644 --- a/mysql-test/r/func_str.result +++ b/mysql-test/r/func_str.result @@ -4551,3 +4551,40 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select char(0xdf) AS `CHAR(0xDF)` +# +# MDEV-15619 using CONVERT() inside AES_ENCRYPT() in an UPDATE corrupts data +# +CREATE TABLE t1 ( +id int(11) NOT NULL, +session_id varchar(255) DEFAULT NULL, +directory mediumtext, +checksum int(10) DEFAULT NULL, +last_update datetime DEFAULT NULL, +PRIMARY KEY (id), +KEY lastupdate (last_update) +) DEFAULT CHARSET=latin1; +INSERT INTO t1 VALUES (1,'',NULL,38391,'2017-06-24 07:35:28'); +UPDATE t1 SET directory = AES_ENCRYPT(CONVERT('test stringrererejrjerjehrjekhrjkehrjkehrkjehrjkerhkjehrjekrhkjehrkjerhjkehrkjehrkjehrjkehrjkehrjkehrjkerjkehrjkehrjkehrjke rekjhrejrejhrjehgrehjgrhjerjhegrjherejhgrjhegrjehgrjhegrejhrgjehgrjhegrjhegrjhergjhegrjhegrhjegrjerhthkjjkdhjkgdfjkgjkdgdjkfjkhgjkfdhjgjkfdghkjdfghkjfdghfjkdghkdjfghdkjfghfjkdghfkjdghkjfdghfkjdghfkdjghfkjdghfdjkghjkdfhgdfjkghfjkdghfjkdghfjdkghfjkdghkfjdghfkjdghfkjdghkjdfghfjdkghjkfdghkjdfhgjkdfhgjkfdhgkjfdghkfjdhgkjfdgdjkejktjherjthkjrethkjrethjkerthjkerhtjkerhtkjerhtjkerhtjkerhtjkrehtkjerhtkjrehtjkrehtkjrehtkjerhtkjerhtjkrehtkjrehtjkrehtkjrethjkrethkjrehtkjethjkerhtjkrehtjkretkjerhtkjrehtjkerhtjkrehtjrehtkjrekjtrfgdsfgdhjsghjgfdhjsfhjdfgdhjshjdshjfghjdsfgjhsfgjhsdfgjhdsfgjdhsfgsjhfgjhsdfgsdjhfgjdhsfdjshfgdsjhfgjsdhfdjshfgdjhsfgdjshfgjdhsfgjhsdfgjhsdgfjhsdgfjhdsgfjhsgfjhsdgfjhdsgfhjsdehkjthrkjethjkre' USING latin1), '95F5A1F52A554'), last_update= NOW(); +SELECT directory IS NULL FROM t1; +directory IS NULL +0 +DROP TABLE t1; +CREATE TABLE t1 ( +id int(11) NOT NULL PRIMARY KEY, +directory mediumtext +) DEFAULT CHARSET=latin1; +INSERT INTO t1 VALUES (1,AES_ENCRYPT(CONVERT(REPEAT('a',800) USING latin1),'95F5A1F52A554')); +SELECT AES_DECRYPT(directory,'95F5A1F52A554') FROM t1; +AES_DECRYPT(directory,'95F5A1F52A554') +aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa +DROP TABLE t1; +SET @enc=AES_ENCRYPT(REPEAT(_latin1'a',800),'95F5A1F52A554'); +CREATE TABLE t1 ( +id int(11) NOT NULL PRIMARY KEY, +directory mediumtext +) DEFAULT CHARSET=latin1; +INSERT INTO t1 VALUES (1,AES_DECRYPT(CONVERT(@enc USING binary),'95F5A1F52A554')); +SELECT * FROM t1; +id directory +1 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa +DROP TABLE t1; diff --git a/mysql-test/t/func_str.test b/mysql-test/t/func_str.test index bdeca8d0d86..019d17518dd 100644 --- a/mysql-test/t/func_str.test +++ b/mysql-test/t/func_str.test @@ -1754,3 +1754,39 @@ EXECUTE stmt; EXPLAIN EXTENDED SELECT CHAR(0xDF USING latin1); EXPLAIN EXTENDED SELECT CHAR(0xDF USING `binary`); EXPLAIN EXTENDED SELECT CHAR(0xDF); + + +--echo # +--echo # MDEV-15619 using CONVERT() inside AES_ENCRYPT() in an UPDATE corrupts data +--echo # + +CREATE TABLE t1 ( + id int(11) NOT NULL, + session_id varchar(255) DEFAULT NULL, + directory mediumtext, + checksum int(10) DEFAULT NULL, + last_update datetime DEFAULT NULL, + PRIMARY KEY (id), + KEY lastupdate (last_update) +) DEFAULT CHARSET=latin1; +INSERT INTO t1 VALUES (1,'',NULL,38391,'2017-06-24 07:35:28'); +UPDATE t1 SET directory = AES_ENCRYPT(CONVERT('test stringrererejrjerjehrjekhrjkehrjkehrkjehrjkerhkjehrjekrhkjehrkjerhjkehrkjehrkjehrjkehrjkehrjkehrjkerjkehrjkehrjkehrjke rekjhrejrejhrjehgrehjgrhjerjhegrjherejhgrjhegrjehgrjhegrejhrgjehgrjhegrjhegrjhergjhegrjhegrhjegrjerhthkjjkdhjkgdfjkgjkdgdjkfjkhgjkfdhjgjkfdghkjdfghkjfdghfjkdghkdjfghdkjfghfjkdghfkjdghkjfdghfkjdghfkdjghfkjdghfdjkghjkdfhgdfjkghfjkdghfjkdghfjdkghfjkdghkfjdghfkjdghfkjdghkjdfghfjdkghjkfdghkjdfhgjkdfhgjkfdhgkjfdghkfjdhgkjfdgdjkejktjherjthkjrethkjrethjkerthjkerhtjkerhtkjerhtjkerhtjkerhtjkrehtkjerhtkjrehtjkrehtkjrehtkjerhtkjerhtjkrehtkjrehtjkrehtkjrethjkrethkjrehtkjethjkerhtjkrehtjkretkjerhtkjrehtjkerhtjkrehtjrehtkjrekjtrfgdsfgdhjsghjgfdhjsfhjdfgdhjshjdshjfghjdsfgjhsfgjhsdfgjhdsfgjdhsfgsjhfgjhsdfgsdjhfgjdhsfdjshfgdsjhfgjsdhfdjshfgdjhsfgdjshfgjdhsfgjhsdfgjhsdgfjhsdgfjhdsgfjhsgfjhsdgfjhdsgfhjsdehkjthrkjethjkre' USING latin1), '95F5A1F52A554'), last_update= NOW(); +SELECT directory IS NULL FROM t1; +DROP TABLE t1; + +CREATE TABLE t1 ( + id int(11) NOT NULL PRIMARY KEY, + directory mediumtext +) DEFAULT CHARSET=latin1; +INSERT INTO t1 VALUES (1,AES_ENCRYPT(CONVERT(REPEAT('a',800) USING latin1),'95F5A1F52A554')); +SELECT AES_DECRYPT(directory,'95F5A1F52A554') FROM t1; +DROP TABLE t1; + +SET @enc=AES_ENCRYPT(REPEAT(_latin1'a',800),'95F5A1F52A554'); +CREATE TABLE t1 ( + id int(11) NOT NULL PRIMARY KEY, + directory mediumtext +) DEFAULT CHARSET=latin1; +INSERT INTO t1 VALUES (1,AES_DECRYPT(CONVERT(@enc USING binary),'95F5A1F52A554')); +SELECT * FROM t1; +DROP TABLE t1; diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc index 378f23f3109..e0bd3cc2195 100644 --- a/sql/item_strfunc.cc +++ b/sql/item_strfunc.cc @@ -379,7 +379,7 @@ String *Item_func_aes_encrypt::val_str(String *str2) DBUG_ASSERT(fixed == 1); char key_buff[80]; String tmp_key_value(key_buff, sizeof(key_buff), system_charset_info); - String *sptr= args[0]->val_str(&str_value); // String to encrypt + String *sptr= args[0]->val_str(&tmp_value); // String to encrypt String *key= args[1]->val_str(&tmp_key_value); // key int aes_length; if (sptr && key) // we need both arguments to be not NULL @@ -418,7 +418,7 @@ String *Item_func_aes_decrypt::val_str(String *str) String *sptr, *key; DBUG_ENTER("Item_func_aes_decrypt::val_str"); - sptr= args[0]->val_str(&str_value); // String to decrypt + sptr= args[0]->val_str(&tmp_value); // String to decrypt key= args[1]->val_str(&tmp_key_value); // Key if (sptr && key) // Need to have both arguments not NULL { diff --git a/sql/item_strfunc.h b/sql/item_strfunc.h index 12c348aa9fa..1213faeec5c 100644 --- a/sql/item_strfunc.h +++ b/sql/item_strfunc.h @@ -134,19 +134,30 @@ public: }; -class Item_func_aes_encrypt :public Item_str_func +class Item_aes_crypt :public Item_str_func +{ +protected: + String tmp_value; +public: + Item_aes_crypt(Item *a, Item *b) + :Item_str_func(a, b) {} +}; + +class Item_func_aes_encrypt :public Item_aes_crypt { public: - Item_func_aes_encrypt(Item *a, Item *b) :Item_str_func(a,b) {} + Item_func_aes_encrypt(Item *a, Item *b): + Item_aes_crypt(a, b) {} String *val_str(String *); void fix_length_and_dec(); const char *func_name() const { return "aes_encrypt"; } }; -class Item_func_aes_decrypt :public Item_str_func +class Item_func_aes_decrypt :public Item_aes_crypt { public: - Item_func_aes_decrypt(Item *a, Item *b) :Item_str_func(a,b) {} + Item_func_aes_decrypt(Item *a, Item *b): + Item_aes_crypt(a,b) {} String *val_str(String *); void fix_length_and_dec(); const char *func_name() const { return "aes_decrypt"; } -- cgit v1.2.1 From 4d83b01537e3f1eb257a8e9a6416938e03adea59 Mon Sep 17 00:00:00 2001 From: Elena Stepanova Date: Mon, 26 Mar 2018 17:14:08 +0300 Subject: Updated list of unstable tests for 10.1.32 release --- mysql-test/unstable-tests | 101 +++++++++++++++++++++++++--------------------- 1 file changed, 55 insertions(+), 46 deletions(-) diff --git a/mysql-test/unstable-tests b/mysql-test/unstable-tests index 34639ef321f..4e60b356cd9 100644 --- a/mysql-test/unstable-tests +++ b/mysql-test/unstable-tests @@ -28,27 +28,28 @@ main.analyze_stmt_slow_query_log : MDEV-12237 - Wrong result main.auth_named_pipe : MDEV-14724 - System error 2 main.create : Modified in 10.1.31 main.create_delayed : MDEV-10605 - failed with timeout +main.ctype_latin1 : Modified in 10.1.32 main.ctype_utf16le : MDEV-10675: timeout or extra warnings -main.ctype_utf8 : Modified in 10.1.30 -main.ctype_utf8mb4 : Modified in 10.1.30 +main.ctype_utf8 : Modified in 10.1.32 main.derived : Modified in 10.1.31 -main.dyncol : Modified in 10.1.31 +main.dyncol : Modified in 10.1.32 main.events_2 : MDEV-13277 - Server crash main.events_bugs : MDEV-12892 - Crash in fill_schema_processlist +main.events_slowlog : MDEV-12821 - Wrong result main.events_restart : MDEV-12236 - Server shutdown problem +main.fast_prefix_index_fetch_innodb : Modified in 10.1.32 main.fulltext : Modified in 10.1.31 main.func_concat : Modified in 10.1.31 +main.func_date_add : Modified in 10.1.32 main.func_isnull : Modified in 10.1.31 -main.func_set : Modified in 10.1.30 -main.func_str : Modified in 10.1.30 -main.group_by : Modified in 10.1.30 -main.having : Modified in 10.1.30 +main.func_time : Modified in 10.1.32 +main.having : Modified in 10.1.32 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, timeout with valgrind main.innodb_mysql_lock : MDEV-7861 - sporadic lock detection failure main.join_cache : Modified in 10.1.31 -main.join_outer : Modified in 10.1.30 +main.join_outer : Modified in 10.1.32 main.kill_processlist-6619 : MDEV-10793 - wrong result in processlist main.mdev_14586 : Added in 10.1.31 main.mdev-504 : MDEV-10607 - sporadic "can't connect" @@ -63,11 +64,13 @@ main.mysqltest : MDEV-9269 - fails on Alpha main.order_by : Modified in 10.1.31 main.order_by_optimizer_innodb : MDEV-10683 - wrong execution plan main.partition : Modified in 10.1.31 +main.partition_debug_sync : MDEV-15669 - Deadlock found when trying to get lock main.partition_innodb_plugin : MDEV-12901 - Valgrind warnings main.ps : MDEV-11017 - sporadic wrong Prepared_stmt_count; modified in 10.1.31 +main.ps_qc_innodb : Added in 10.1.32 main.query_cache : MDEV-12895 - Wrong result -main.query_cache_debug : Modified in 10.1.31 -main.range_vs_index_merge_innodb : MDEV-12637 - Timeout +main.query_cache_debug : MDEV-15665 - Resize or similar command in progress; modified in 10.1.31 +main.range_vs_index_merge_innodb : MDEV-15283 - Server has gone away main.repair : Modified in 10.1.31 main.set_statement : MDEV-13183 - Wrong result main.show_explain : MDEV-10674 - sporadic failure @@ -75,16 +78,19 @@ main.sp : Modified in 10.1.31 main.sp-security : MDEV-10607 - sporadic "can't connect" main.status : MDEV-8510 - sporadic wrong result main.subselect : Modified in 10.1.31 +main.subselect4 : Modified in 10.1.32 main.subselect_innodb : MDEV-10614 - sporadic wrong results +main.subselect_mat : Modified in 10.1.32 main.symlink-aria-11902 : MDEV-15098 - error 40 from storage engine main.symlink-myisam-11902 : MDEV-15098 - error 40 from storage engine main.tc_heuristic_recover : MDEV-15200 - wrong error on mysqld_stub_cmd -main.trigger : Modified in 10.1.30 main.type_blob : MDEV-15195 - Wrong result main.type_datetime_hires : MDEV-10687 - timeout +main.type_time : Modified in 10.1.32 +main.type_time_6065 : Modified in 10.1.32 main.union : Modified in 10.1.31 main.update_innodb : Modified in 10.1.31 -main.view : Modified in 10.1.30 +main.view : Modified in 10.1.32 main.xa : Modified in 10.1.31 main.xml : Modified in 10.1.31 @@ -97,8 +103,7 @@ archive.mysqlhotcopy_archive : MDEV-14726 - Table is marked as crashed #---------------------------------------------------------------- binlog.binlog_commit_wait : MDEV-10150 - Error: too much time elapsed -binlog.binlog_flush_binlogs_delete_domain : MDEV-14431 - Wrong error code; added in 10.1.30 -binlog.binlog_gtid_delete_domain_debug : Added in 10.1.30 +binlog.binlog_flush_binlogs_delete_domain : MDEV-14431 - Wrong error code binlog.binlog_killed : MDEV-12925 - Wrong result binlog.binlog_xa_recover : MDEV-8517 - Extra checkpoint @@ -119,16 +124,21 @@ connect.zip : MDEV-13884 - Wrong result #---------------------------------------------------------------- +disks.disks : Added in 10.1.32 + +#---------------------------------------------------------------- + encryption.create_or_replace : MDEV-9359 - Assertion failure, MDEV-13516 - Assertion failure encryption.debug_key_management : MDEV-13841 - Timeout on wait condition; modified in 10.1.31 encryption.encrypt_and_grep : MDEV-13765 - Wrong result; modified in 10.1.31 +encryption.innodb-bad-key-change : Modified in 10.1.32 encryption.innodb-bad-key-change2 : MDEV-12632 - Valgrind warnings encryption.innodb-compressed-blob : MDEV-14728 - Unable to get certificate encryption.innodb-discard-import-change : MDEV-12632 - Valgrind warnings encryption.innodb_encryption : Modified in 10.1.31 encryption.innodb_encryption_discard_import : MDEV-12903 - Wrong result -encryption.innodb_encryption_filekeys : MDEV-9962 - timeouts -encryption.innodb_encryption-page-compression : MDEV-12630 - crash or assertion failure +encryption.innodb_encryption_filekeys : Modified in 10.1.32 +encryption.innodb_encryption-page-compression : MDEV-12630 - crash or assertion failure; modified in 10.1.32 encryption.innodb_encryption_tables : MDEV-9359 - Assertion failure encryption.innodb_first_page : MDEV-10689 - crashes encryption.innodb-first-page-read : MDEV-14356 - Timeout on wait condition @@ -139,6 +149,7 @@ encryption.innodb-redo-badkey : MDEV-12898 - Server hang on startu encryption.innodb_scrub : MDEV-8139 - scrubbing tests need fixing encryption.innodb_scrub_background : MDEV-8139 - scrubbing tests need fixing encryption.innodb_scrub_compressed : MDEV-8139 - scrubbing tests need fixing +encryption.tempfiles : Modified in 10.1.32 #---------------------------------------------------------------- @@ -182,13 +193,16 @@ galera.MW-328A : MDEV-13876 - Wrong result #---------------------------------------------------------------- innodb.binlog_consistent : MDEV-10618 - Server fails to start +innodb.default_row_format_alter : Added in 10.1.32 +innodb.default_row_format_compatibility : Added in 10.1.32 +innodb.default_row_format_create : Added in 10.1.32 innodb.doublewrite : MDEV-12905 - Lost connection to MySQL server +innodb.file_format_defaults : Added in 10.1.32 innodb_fts.fulltext2 : MDEV-14727 - Long semaphore wait innodb.innodb : Opt file modified in 10.1.31 innodb.innodb-64k-crash : MDEV-13872 - Failure and crash on startup innodb.innodb-alter-debug : MDEV-13182 - InnoDB: adjusting FSP_SPACE_FLAGS innodb.innodb-alter-table : MDEV-10619 - Testcase timeout -innodb.innodb-autoinc : Modified in 10.1.30 innodb.innodb-blob : MDEV-12053 - Client crash innodb.innodb_bug14147491 : MDEV-11808 - wrong error codes innodb.innodb_bug30423 : MDEV-7311 - Wrong number of rows in the plan @@ -204,16 +218,24 @@ innodb.innodb-replace-debug : Modified in 10.1.31 innodb.innodb_stats : MDEV-10682 - wrong result innodb.innodb_sys_semaphore_waits : MDEV-10331 - wrong result innodb.innodb_zip_innochecksum2 : MDEV-13882 - Warning: difficult to find free blocks -innodb.log_file_size : MDEV-15202 - Cannot resize log files in read-only mode -innodb.recovery_shutdown : Added in 10.1.30 +innodb.log_file_size : MDEV-15668 - Not found pattern +innodb.mvcc : Added in 10.1.32 +innodb.read_only_recover_committed : Added in 10.1.32 +innodb.recovery_shutdown : Modified in 10.1.32 +innodb.restart : Added in 10.1.32 innodb.row_format_redundant : MDEV-15192 - Trying to access missing tablespace innodb.table_definition_cache_debug : MDEV-14206 - Extra warning; opt file modified in 10.1.31 innodb.table_flags : MDEV-14363 - Operating system error number 2 innodb_fts.fulltext_misc : MDEV-12636 - Valgrind warnings +innodb_zip.innodb-create-options : Modified in 10.1.32 +innodb_zip.innodb-zip : Modified in 10.1.32 + #---------------------------------------------------------------- +maria.dynamic : Added in 10.1.32 +maria.insert_select : MDEV-15666 - Timeout maria.lock : Modified in 10.1.31 maria.maria : MDEV-14430 - Wrong result; modified in 10.1.31 maria.repair : Added in 10.1.31 @@ -221,8 +243,10 @@ maria.repair : Added in 10.1.31 #---------------------------------------------------------------- mariabackup.huge_lsn : Added in 10.1.31 -mariabackup.mdev-14447 : MDEV-15201 - Timeout; added in 10.1.30 +mariabackup.incremental_encrypted : MDEV-15667 - Timeout +mariabackup.mdev-14447 : MDEV-15201 - Timeout mariabackup.missing_ibd : Added in 10.1.31 +mariabackup.undo_space_id : Added in 10.1.32 mariabackup.xb_compressed_encrypted : MDEV-14812 - Segfault #---------------------------------------------------------------- @@ -235,12 +259,6 @@ mroonga/storage.index_multiple_column_unique_date_32bit_equal : Wrong resul mroonga/storage.index_multiple_column_unique_date_order_32bit_desc : Wrong result on Alpha mroonga/storage.index_multiple_column_unique_datetime_index_read : MDEV-8643 - valgrind warnings mroonga/storage.repair_table_no_index_file : MDEV-9364 - wrong result, MDEV-14807 - wrong error message -mroonga/storage.variable_query_log_file_disabled_empty_value : Modified in 10.1.30 -mroonga/storage.variable_query_log_file_disabled_null_value : Modified in 10.1.30 -mroonga/storage.variable_query_log_file_enabled_empty_value : Modified in 10.1.30 -mroonga/storage.variable_query_log_file_enabled_null_value : Modified in 10.1.30 -mroonga/storage.variable_query_log_file_new_value : Modified in 10.1.30 -mroonga/storage.variable_query_log_file_same_value : Modified in 10.1.30 mroonga/wrapper.repair_table_no_index_file : MDEV-14807 - Wrong error message @@ -255,11 +273,11 @@ multi_source.status_vars : MDEV-4632 - failed while waiting for Slave_received_h #---------------------------------------------------------------- -parts.partition_alter_innodb : Added in 10.1.30 -parts.partition_alter_maria : Modified in 10.1.30 -parts.partition_alter_myisam : Modified in 10.1.31 +parts.partition_alter_maria : Modified in 10.1.32 +parts.partition_alter_myisam : Modified in 10.1.32 parts.partition_alter2_2_maria : MDEV-14364 - Lost connection to MySQL server during query parts.partition_auto_increment_maria : MDEV-14430 - Wrong result +parts.partition_basic_symlink_innodb : Modified in 10.1.32 parts.partition_debug_innodb : MDEV-15095 - table does not exist parts.partition_innodb_status_file : MDEV-12901 - Valgrind @@ -267,7 +285,6 @@ parts.partition_innodb_status_file : MDEV-12901 - Valgrind perfschema.func_file_io : MDEV-5708 - fails for s390x perfschema.func_mutex : MDEV-5708 - fails for s390x -perfschema.misc : Modified in 10.1.30 perfschema.privilege_table_io : MDEV-13184 - Extra lines perfschema.setup_actors : MDEV-10679 - rare crash perfschema.socket_summary_by_event_name_func : MDEV-10622 - Socket summary tables do not match @@ -277,18 +294,12 @@ perfschema.threads_mysql : MDEV-10677 - sporadic wrong resul #---------------------------------------------------------------- -plugins.binlog-simple_plugin_check : Added in 10.1.30 plugins.feedback_plugin_send : MDEV-7932 - ssl failed for url -plugins.server_audit : MDEV-9562 - crashes on sol10-sparc +plugins.server_audit : MDEV-9562 - crashes on sol10-sparc; modified in 10.1.32 plugins.thread_pool_server_audit : MDEV-9562 - crashes on sol10-sparc #---------------------------------------------------------------- -roles.flush_roles-12366 : Added in 10.1.30 -roles.set_role-13655 : Added in 10.1.30 - -#---------------------------------------------------------------- - 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 @@ -299,7 +310,7 @@ rpl.rpl_domain_id_filter_io_crash : MDEV-14357 - Wrong result 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_delete_domain : MDEV-14463 - Timeout in include; added in 10.1.30 +rpl.rpl_gtid_delete_domain : MDEV-14463 - Timeout in include rpl.rpl_gtid_mdev9033 : MDEV-10680 - warnings rpl.rpl_gtid_reconnect : MDEV-14497 - Timeout rpl.rpl_gtid_stop_start : MDEV-10629 - Crash on shutdown, MDEV-12629 - Valgrind warnings @@ -330,21 +341,19 @@ rpl.rpl_row_img_blobs : MDEV-13875 - command "diff_files" failed rpl.rpl_row_img_eng_min : MDEV-13875 - command "diff_files" failed rpl.rpl_row_img_eng_noblob : MDEV-13875 - command "diff_files" failed rpl.rpl_row_index_choice : MDEV-15196 - Slave crash -rpl.rpl_row_log : Include file modified in 10.1.30 -rpl.rpl_row_log_innodb : Include file modified in 10.1.30 rpl.rpl_row_mixing_engines : MDEV-14491 - Long semaphore wait rpl.rpl_row_sp001 : MDEV-9329 - Fails on Ubuntu/s390x rpl.rpl_semi_sync : MDEV-11220 - Wrong result rpl.rpl_semi_sync_after_sync : MDEV-14366 - Wrong result rpl.rpl_semi_sync_after_sync_row : MDEV-14366 - Wrong result rpl.rpl_semi_sync_event_after_sync : MDEV-11806 - warnings +rpl.rpl_semi_sync_skip_repl : Added in 10.1.32 rpl.rpl_semi_sync_uninstall_plugin : MDEV-7140 - Wrong plugin status rpl.rpl_semi_sync_wait_point : MDEV-11807 - timeout in wait condition rpl.rpl_show_slave_hosts : MDEV-10681 - server startup problem rpl.rpl_skip_replication : MDEV-9268 - Fails with timeout in sync_slave_with_master on Alpha rpl.rpl_slave_grp_exec : MDEV-10514 - Unexpected deadlock rpl.rpl_start_stop_slave : MDEV-13567 - Replication failure -rpl.rpl_stm_log : Include file modified in 10.1.30 rpl.rpl_stm_mixing_engines : MDEV-14489 - Sync slave with master failed rpl.rpl_stm_relay_ign_space : MDEV-14360 - Test assertion rpl.rpl_sync : MDEV-10633 - Database page corruption @@ -386,12 +395,13 @@ stress.ddl_innodb : MDEV-10635 - Testcase timeout sys_vars.autocommit_func2 : MDEV-9329 - Fails on Ubuntu/s390x sys_vars.keep_files_on_create_basic : MDEV-10676 - timeout -sys_vars.innodb_fatal_semaphore_wait_threshold : MDEV-10513 - crashes +sys_vars.innodb_default_row_format_basic : Added in 10.1.32 sys_vars.innodb_print_lock_wait_timeout_info_basic : Added in 10.1.31 sys_vars.log_slow_admin_statements_func : MDEV-12235 - Server crash sys_vars.rpl_init_slave_func : MDEV-10149 - wrong results sys_vars.thread_cache_size_func : MDEV-11775 - Wrong result sys_vars.wait_timeout_func : MDEV-12896 - Wrong result +sys_vars.wsrep_sst_receive_address_basic : Modified in 10.1.32 #---------------------------------------------------------------- @@ -414,26 +424,25 @@ tokudb.nonflushing_analyze_debug : Added in 10.1.31 tokudb.row_format : Modified in 10.1.31 tokudb.rows-32m-rand-insert : MDEV-12640 - Crash tokudb.rows-32m-seq-insert : MDEV-12640 - Crash +tokudb.savepoint-5 : MDEV-15280 - Wrong result tokudb.type_datetime : MDEV-15193 - Wrong result tokudb_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_mariadb.mdev6657 : MDEV-12737 - Wrong plan, valgrind warnings +tokudb_mariadb.mdev6657 : Modified in 10.1.32 tokudb_parts.nonflushing_analyze_debug : Added in 10.1.31 tokudb_perfschema.crash_tokudb : Added in 10.1.31 tokudb_perfschema.start_server_tokudb : Added in 10.1.31 -rpl-tokudb.rpl_tokudb_row_log : Include file modified in 10.1.30 -rpl-tokudb.rpl_tokudb_stm_log : Include file modified in 10.1.30 - #---------------------------------------------------------------- unit.lf : MDEV-12897 - Signal 11 thrown unit.ma_test_loghandler : MDEV-10638 - record read not ok +unit.my_atomic : MDEV-15670 - Signal 11 thrown #---------------------------------------------------------------- -- cgit v1.2.1 From ca0c96fc8925d36ea0c5121520bf7d8f12ad90a5 Mon Sep 17 00:00:00 2001 From: Monty Date: Thu, 22 Mar 2018 20:03:54 +0200 Subject: Adjust table_open_cache to avoid getting error 24 (too many open files) MDEV--15609 engines/funcs.crash_manytables_number crashes with error 24 (too many open files) MDEV-10286 Adjustment of table_open_cache according to system limits does not work when open-files-limit option is provided Fixed by adjusting tc_size downwards if there is not enough file descriptors to use. Other changes: - Ensure that there is 30 (was 10) extra file descriptors for other usage - Decrease TABLE_OPEN_CACHE_MIN to 200 as it's better to have a smaller table cache than getting error 24 - Increase minimum of max_connections and table_open_cache from 1 to 10 as 1 is not usable for any real application, only for testing. --- mysql-test/mysql-test-run.pl | 1 + mysql-test/r/connect.result | 9 ++- mysql-test/r/mdev375.result | 2 +- mysql-test/r/myisam.result | 4 +- mysql-test/r/mysqld--help,win.rdiff | 4 +- mysql-test/r/mysqld--help.result | 4 +- mysql-test/r/sp.result | 2 +- mysql-test/r/variables.result | 4 +- .../perfschema/r/hostcache_ipv4_max_con.result | 2 +- .../perfschema/r/hostcache_ipv6_max_con.result | 2 +- .../suite/perfschema/t/hostcache_ipv4_max_con.test | 17 ++++- .../suite/perfschema/t/hostcache_ipv6_max_con.test | 17 ++++- .../suite/sys_vars/r/max_connections_basic.result | 20 +++-- .../sys_vars/r/sysvars_server_embedded.result | 8 +- .../sys_vars/r/sysvars_server_notembedded.result | 8 +- .../suite/sys_vars/r/table_open_cache_basic.result | 24 +++--- mysql-test/suite/sys_vars/t/sysvars_innodb.opt | 1 + .../suite/sys_vars/t/sysvars_server_embedded.opt | 1 + .../sys_vars/t/sysvars_server_notembedded.opt | 1 + mysql-test/t/connect.test | 18 ++++- mysql-test/t/mdev375.test | 11 ++- mysql-test/t/myisam.test | 4 +- mysql-test/t/sp.test | 2 +- sql/mysqld.cc | 88 +++++++++++++--------- sql/set_var.h | 10 +++ sql/sql_const.h | 2 +- sql/sys_vars.cc | 4 +- .../tokudb/mysql-test/tokudb_bugs/r/db917.result | 4 +- storage/tokudb/mysql-test/tokudb_bugs/t/db917.test | 4 +- 29 files changed, 193 insertions(+), 85 deletions(-) create mode 100644 mysql-test/suite/sys_vars/t/sysvars_server_embedded.opt create mode 100644 mysql-test/suite/sys_vars/t/sysvars_server_notembedded.opt diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index 2581eb7b503..313b62ad7cc 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -4458,6 +4458,7 @@ sub extract_warning_lines ($$) { qr|SSL error: Failed to set ciphers to use|, qr/Plugin 'InnoDB' will be forced to shutdown/, qr|Could not increase number of max_open_files to more than|, + qr|Changed limits: max_open_files|, qr/InnoDB: Error table encrypted but encryption service not available.*/, qr/InnoDB: Could not find a valid tablespace file for*/, qr/InnoDB: Tablespace open failed for*/, diff --git a/mysql-test/r/connect.result b/mysql-test/r/connect.result index 315aea0ef46..cb66ff483e1 100644 --- a/mysql-test/r/connect.result +++ b/mysql-test/r/connect.result @@ -147,7 +147,7 @@ drop table t1; CREATE USER mysqltest_u1@localhost; GRANT USAGE ON *.* TO mysqltest_u1@localhost; -SET GLOBAL max_connections = 3; +SET GLOBAL max_connections = 10; SET GLOBAL event_scheduler = ON; # -- Waiting for Event Scheduler to start... @@ -191,6 +191,13 @@ event_scheduler mysqltest_u1 mysqltest_u1 mysqltest_u1 +mysqltest_u1 +mysqltest_u1 +mysqltest_u1 +mysqltest_u1 +mysqltest_u1 +mysqltest_u1 +mysqltest_u1 root # -- Resetting variables... diff --git a/mysql-test/r/mdev375.result b/mysql-test/r/mdev375.result index 32580804686..b3b83af0988 100644 --- a/mysql-test/r/mdev375.result +++ b/mysql-test/r/mdev375.result @@ -1,5 +1,5 @@ SET GLOBAL log_warnings=4; -SET GLOBAL max_connections=2; +SET GLOBAL max_connections=10; SELECT 1; 1 1 diff --git a/mysql-test/r/myisam.result b/mysql-test/r/myisam.result index e114f424ede..0f865c151fa 100644 --- a/mysql-test/r/myisam.result +++ b/mysql-test/r/myisam.result @@ -1906,9 +1906,9 @@ DROP TABLE t1; # # BUG#48438 - crash with error in unioned query against merge table and view... # -SET GLOBAL table_open_cache=3; +SET GLOBAL table_open_cache=10; CREATE TABLE t1(a INT); -SELECT 1 FROM t1 AS a1, t1 AS a2, t1 AS a3, t1 AS a4 FOR UPDATE; +SELECT 1 FROM t1 AS a1, t1 AS a2, t1 AS a3, t1 AS a4, t1 AS a5, t1 AS a6, t1 AS a7, t1 AS a8, t1 AS a9, t1 AS a10, t1 AS a11 FOR UPDATE; 1 SELECT TABLE_ROWS, DATA_LENGTH FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test' AND TABLE_NAME='t1'; diff --git a/mysql-test/r/mysqld--help,win.rdiff b/mysql-test/r/mysqld--help,win.rdiff index 06116a2e630..6e18d16feaf 100644 --- a/mysql-test/r/mysqld--help,win.rdiff +++ b/mysql-test/r/mysqld--help,win.rdiff @@ -121,10 +121,10 @@ sync-relay-log 10000 sync-relay-log-info 10000 sysdate-is-now FALSE --table-cache 431 +-table-cache 421 +table-cache 2000 table-definition-cache 400 --table-open-cache 431 +-table-open-cache 421 +table-open-cache 2000 tc-heuristic-recover OFF thread-cache-size 0 diff --git a/mysql-test/r/mysqld--help.result b/mysql-test/r/mysqld--help.result index e84921bfa0a..7b78eae185e 100644 --- a/mysql-test/r/mysqld--help.result +++ b/mysql-test/r/mysqld--help.result @@ -1438,9 +1438,9 @@ sync-master-info 10000 sync-relay-log 10000 sync-relay-log-info 10000 sysdate-is-now FALSE -table-cache 431 +table-cache 421 table-definition-cache 400 -table-open-cache 431 +table-open-cache 421 tc-heuristic-recover OFF thread-cache-size 0 thread-pool-idle-timeout 60 diff --git a/mysql-test/r/sp.result b/mysql-test/r/sp.result index 57d704c36be..ad5bddda035 100644 --- a/mysql-test/r/sp.result +++ b/mysql-test/r/sp.result @@ -7946,7 +7946,7 @@ CLOSE cur1; end| set @tmp_toc= @@table_open_cache; set @tmp_tdc= @@table_definition_cache; -set global table_open_cache=1; +set global table_open_cache=10; set global table_definition_cache=1; Warnings: Warning 1292 Truncated incorrect table_definition_cache value: '1' diff --git a/mysql-test/r/variables.result b/mysql-test/r/variables.result index b621fc13ee4..a01c8f48a4d 100644 --- a/mysql-test/r/variables.result +++ b/mysql-test/r/variables.result @@ -748,10 +748,10 @@ Warnings: Warning 1292 Truncated incorrect table_open_cache value: '-1' SHOW VARIABLES LIKE 'table_open_cache'; Variable_name Value -table_open_cache 1 +table_open_cache 10 SELECT * FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME LIKE 'table_open_cache'; VARIABLE_NAME VARIABLE_VALUE -TABLE_OPEN_CACHE 1 +TABLE_OPEN_CACHE 10 SET GLOBAL table_open_cache=DEFAULT; set character_set_results=NULL; select ifnull(@@character_set_results,"really null"); diff --git a/mysql-test/suite/perfschema/r/hostcache_ipv4_max_con.result b/mysql-test/suite/perfschema/r/hostcache_ipv4_max_con.result index 31e4bc9f843..69e1ddb29f5 100644 --- a/mysql-test/suite/perfschema/r/hostcache_ipv4_max_con.result +++ b/mysql-test/suite/perfschema/r/hostcache_ipv4_max_con.result @@ -525,7 +525,7 @@ COUNT_UNKNOWN_ERRORS 0 FIRST_ERROR_SEEN set LAST_ERROR_SEEN set set global max_user_connections = 0; -set global max_connections = 3; +set global max_connections = 10; flush user_resources; select "Con4a is alive"; Con4a is alive diff --git a/mysql-test/suite/perfschema/r/hostcache_ipv6_max_con.result b/mysql-test/suite/perfschema/r/hostcache_ipv6_max_con.result index 4416b78d009..56eb6fe6ac6 100644 --- a/mysql-test/suite/perfschema/r/hostcache_ipv6_max_con.result +++ b/mysql-test/suite/perfschema/r/hostcache_ipv6_max_con.result @@ -525,7 +525,7 @@ COUNT_UNKNOWN_ERRORS 0 FIRST_ERROR_SEEN set LAST_ERROR_SEEN set set global max_user_connections = 0; -set global max_connections = 3; +set global max_connections = 10; flush user_resources; select "Con4a is alive"; Con4a is alive diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv4_max_con.test b/mysql-test/suite/perfschema/t/hostcache_ipv4_max_con.test index 3bf5ef3b68d..a76e04ea35e 100644 --- a/mysql-test/suite/perfschema/t/hostcache_ipv4_max_con.test +++ b/mysql-test/suite/perfschema/t/hostcache_ipv4_max_con.test @@ -176,9 +176,17 @@ disconnect con4c; --source ../include/wait_for_pfs_thread_count.inc set global max_user_connections = 0; -set global max_connections = 3; +set global max_connections = 10; flush user_resources; +connect (tmp_con1,localhost,root,,); +connect (tmp_con2,localhost,root,,); +connect (tmp_con3,localhost,root,,); +connect (tmp_con4,localhost,root,,); +connect (tmp_con5,localhost,root,,); +connect (tmp_con6,localhost,root,,); +connect (tmp_con7,localhost,root,,); + connect (con5a,"127.0.0.1",quota,,test,$MASTER_MYPORT,); select "Con4a is alive"; select current_user(); @@ -233,6 +241,13 @@ connect (con5d,"127.0.0.1",quota,,test,$MASTER_MYPORT,); disconnect con5a; disconnect con5b; +--disconnect tmp_con1 +--disconnect tmp_con2 +--disconnect tmp_con3 +--disconnect tmp_con4 +--disconnect tmp_con5 +--disconnect tmp_con6 +--disconnect tmp_con7 # Wait for all disconnects --source ../include/wait_for_pfs_thread_count.inc diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv6_max_con.test b/mysql-test/suite/perfschema/t/hostcache_ipv6_max_con.test index 0ced79544a3..96a5d10d6e1 100644 --- a/mysql-test/suite/perfschema/t/hostcache_ipv6_max_con.test +++ b/mysql-test/suite/perfschema/t/hostcache_ipv6_max_con.test @@ -177,9 +177,17 @@ disconnect con4c; --source ../include/wait_for_pfs_thread_count.inc set global max_user_connections = 0; -set global max_connections = 3; +set global max_connections = 10; flush user_resources; +connect (tmp_con1,localhost,root,,); +connect (tmp_con2,localhost,root,,); +connect (tmp_con3,localhost,root,,); +connect (tmp_con4,localhost,root,,); +connect (tmp_con5,localhost,root,,); +connect (tmp_con6,localhost,root,,); +connect (tmp_con7,localhost,root,,); + connect (con5a,"::1",quota,,test,$MASTER_MYPORT,); select "Con4a is alive"; select current_user(); @@ -215,6 +223,13 @@ connect (con5d,"::1",quota,,test,$MASTER_MYPORT,); disconnect con5a; disconnect con5b; +--disconnect tmp_con1 +--disconnect tmp_con2 +--disconnect tmp_con3 +--disconnect tmp_con4 +--disconnect tmp_con5 +--disconnect tmp_con6 +--disconnect tmp_con7 # Wait for all disconnects --source ../include/wait_for_pfs_thread_count.inc diff --git a/mysql-test/suite/sys_vars/r/max_connections_basic.result b/mysql-test/suite/sys_vars/r/max_connections_basic.result index 708342b016d..f9b2c034400 100644 --- a/mysql-test/suite/sys_vars/r/max_connections_basic.result +++ b/mysql-test/suite/sys_vars/r/max_connections_basic.result @@ -27,20 +27,24 @@ SELECT @@global.max_connections; @@global.max_connections 65536 SET @@global.max_connections = 1; +Warnings: +Warning 1292 Truncated incorrect max_connections value: '1' SELECT @@global.max_connections; @@global.max_connections -1 +10 SET @@global.max_connections = 2; +Warnings: +Warning 1292 Truncated incorrect max_connections value: '2' SELECT @@global.max_connections; @@global.max_connections -2 +10 '#--------------------FN_DYNVARS_074_04-------------------------#' SET @@global.max_connections = -1; Warnings: Warning 1292 Truncated incorrect max_connections value: '-1' SELECT @@global.max_connections; @@global.max_connections -1 +10 SET @@global.max_connections = 100000000000; Warnings: Warning 1292 Truncated incorrect max_connections value: '100000000000' @@ -57,13 +61,13 @@ Warnings: Warning 1292 Truncated incorrect max_connections value: '-1024' SELECT @@global.max_connections; @@global.max_connections -1 +10 SET @@global.max_connections = 0; Warnings: Warning 1292 Truncated incorrect max_connections value: '0' SELECT @@global.max_connections; @@global.max_connections -1 +10 SET @@global.max_connections = 100001; Warnings: Warning 1292 Truncated incorrect max_connections value: '100001' @@ -98,15 +102,17 @@ WHERE VARIABLE_NAME='max_connections'; 1 '#---------------------FN_DYNVARS_074_07----------------------#' SET @@global.max_connections = TRUE; +Warnings: +Warning 1292 Truncated incorrect max_connections value: '1' SELECT @@global.max_connections; @@global.max_connections -1 +10 SET @@global.max_connections = FALSE; Warnings: Warning 1292 Truncated incorrect max_connections value: '0' SELECT @@global.max_connections; @@global.max_connections -1 +10 '#---------------------FN_DYNVARS_074_08----------------------#' SET @@global.max_connections = 5000; SELECT @@max_connections = @@global.max_connections; diff --git a/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result b/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result index f851dfcc5a4..6a84765cf60 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result +++ b/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result @@ -1837,7 +1837,7 @@ DEFAULT_VALUE 151 VARIABLE_SCOPE GLOBAL VARIABLE_TYPE BIGINT UNSIGNED VARIABLE_COMMENT The number of simultaneous clients allowed -NUMERIC_MIN_VALUE 1 +NUMERIC_MIN_VALUE 10 NUMERIC_MAX_VALUE 100000 NUMERIC_BLOCK_SIZE 1 ENUM_VALUE_LIST NULL @@ -3847,13 +3847,13 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME TABLE_OPEN_CACHE SESSION_VALUE NULL -GLOBAL_VALUE 2000 -GLOBAL_VALUE_ORIGIN COMPILE-TIME +GLOBAL_VALUE 100 +GLOBAL_VALUE_ORIGIN CONFIG DEFAULT_VALUE 2000 VARIABLE_SCOPE GLOBAL VARIABLE_TYPE BIGINT UNSIGNED VARIABLE_COMMENT The number of cached open tables -NUMERIC_MIN_VALUE 1 +NUMERIC_MIN_VALUE 10 NUMERIC_MAX_VALUE 1048576 NUMERIC_BLOCK_SIZE 1 ENUM_VALUE_LIST NULL diff --git a/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result b/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result index 5bc6a6e1743..413ef1ca58d 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result +++ b/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result @@ -2019,7 +2019,7 @@ DEFAULT_VALUE 151 VARIABLE_SCOPE GLOBAL VARIABLE_TYPE BIGINT UNSIGNED VARIABLE_COMMENT The number of simultaneous clients allowed -NUMERIC_MIN_VALUE 1 +NUMERIC_MIN_VALUE 10 NUMERIC_MAX_VALUE 100000 NUMERIC_BLOCK_SIZE 1 ENUM_VALUE_LIST NULL @@ -4547,13 +4547,13 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME TABLE_OPEN_CACHE SESSION_VALUE NULL -GLOBAL_VALUE 2000 -GLOBAL_VALUE_ORIGIN COMPILE-TIME +GLOBAL_VALUE 100 +GLOBAL_VALUE_ORIGIN CONFIG DEFAULT_VALUE 2000 VARIABLE_SCOPE GLOBAL VARIABLE_TYPE BIGINT UNSIGNED VARIABLE_COMMENT The number of cached open tables -NUMERIC_MIN_VALUE 1 +NUMERIC_MIN_VALUE 10 NUMERIC_MAX_VALUE 1048576 NUMERIC_BLOCK_SIZE 1 ENUM_VALUE_LIST NULL diff --git a/mysql-test/suite/sys_vars/r/table_open_cache_basic.result b/mysql-test/suite/sys_vars/r/table_open_cache_basic.result index 4c635783753..bc373003e1d 100644 --- a/mysql-test/suite/sys_vars/r/table_open_cache_basic.result +++ b/mysql-test/suite/sys_vars/r/table_open_cache_basic.result @@ -1,7 +1,7 @@ SET @start_value = @@global.table_open_cache ; SELECT @start_value; @start_value -2000 +421 '#--------------------FN_DYNVARS_001_01------------------------#' SET @@global.table_open_cache = 99; SET @@global.table_open_cache = DeFAULT; @@ -15,13 +15,17 @@ SELECT @@global.table_open_cache = 400; 0 '#--------------------FN_DYNVARS_001_03------------------------#' SET @@global.table_open_cache = 8; +Warnings: +Warning 1292 Truncated incorrect table_open_cache value: '8' SELECT @@global.table_open_cache ; @@global.table_open_cache -8 +10 SET @@global.table_open_cache = 1; +Warnings: +Warning 1292 Truncated incorrect table_open_cache value: '1' SELECT @@global.table_open_cache ; @@global.table_open_cache -1 +10 SET @@global.table_open_cache = 1073741824; Warnings: Warning 1292 Truncated incorrect table_open_cache value: '1073741824' @@ -42,7 +46,7 @@ Warnings: Warning 1292 Truncated incorrect table_open_cache value: '-1' SELECT @@global.table_open_cache ; @@global.table_open_cache -1 +10 SET @@global.table_open_cache = 100000000000; Warnings: Warning 1292 Truncated incorrect table_open_cache value: '100000000000' @@ -54,13 +58,13 @@ Warnings: Warning 1292 Truncated incorrect table_open_cache value: '-1024' SELECT @@global.table_open_cache ; @@global.table_open_cache -1 +10 SET @@global.table_open_cache = 0; Warnings: Warning 1292 Truncated incorrect table_open_cache value: '0' SELECT @@global.table_open_cache ; @@global.table_open_cache -1 +10 SET @@global.table_open_cache = 10000.01; ERROR 42000: Incorrect argument type to variable 'table_open_cache' SET @@global.table_open_cache = ON; @@ -78,15 +82,17 @@ SELECT @@global.table_open_cache = VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL 1 '#---------------------FN_DYNVARS_001_09----------------------#' SET @@global.table_open_cache = TRUE; +Warnings: +Warning 1292 Truncated incorrect table_open_cache value: '1' SELECT @@global.table_open_cache ; @@global.table_open_cache -1 +10 SET @@global.table_open_cache = FALSE; Warnings: Warning 1292 Truncated incorrect table_open_cache value: '0' SELECT @@global.table_open_cache ; @@global.table_open_cache -1 +10 '#---------------------FN_DYNVARS_001_10----------------------#' SET @@global.table_open_cache = 10; SELECT @@table_open_cache = @@global.table_open_cache ; @@ -104,4 +110,4 @@ ERROR 42S22: Unknown column 'table_open_cache' in 'field list' SET @@global.table_open_cache = @start_value; SELECT @@global.table_open_cache ; @@global.table_open_cache -2000 +421 diff --git a/mysql-test/suite/sys_vars/t/sysvars_innodb.opt b/mysql-test/suite/sys_vars/t/sysvars_innodb.opt index 462e83d98b6..c3eec59bc17 100644 --- a/mysql-test/suite/sys_vars/t/sysvars_innodb.opt +++ b/mysql-test/suite/sys_vars/t/sysvars_innodb.opt @@ -1 +1,2 @@ --loose-innodb-flush-log-at-timeout=3 +--table_open_cache=200 diff --git a/mysql-test/suite/sys_vars/t/sysvars_server_embedded.opt b/mysql-test/suite/sys_vars/t/sysvars_server_embedded.opt new file mode 100644 index 00000000000..c3f0d3bd51f --- /dev/null +++ b/mysql-test/suite/sys_vars/t/sysvars_server_embedded.opt @@ -0,0 +1 @@ +--table_open_cache=100 diff --git a/mysql-test/suite/sys_vars/t/sysvars_server_notembedded.opt b/mysql-test/suite/sys_vars/t/sysvars_server_notembedded.opt new file mode 100644 index 00000000000..c3f0d3bd51f --- /dev/null +++ b/mysql-test/suite/sys_vars/t/sysvars_server_notembedded.opt @@ -0,0 +1 @@ +--table_open_cache=100 diff --git a/mysql-test/t/connect.test b/mysql-test/t/connect.test index 20989e70ef9..c2d44c08e22 100644 --- a/mysql-test/t/connect.test +++ b/mysql-test/t/connect.test @@ -143,9 +143,18 @@ GRANT USAGE ON *.* TO mysqltest_u1@localhost; --echo let $saved_max_connections = `SELECT @@global.max_connections`; -SET GLOBAL max_connections = 3; +SET GLOBAL max_connections = 10; SET GLOBAL event_scheduler = ON; +connect (tmp_con1,localhost,mysqltest_u1,,); +connect (tmp_con2,localhost,mysqltest_u1,,); +connect (tmp_con3,localhost,mysqltest_u1,,); +connect (tmp_con4,localhost,mysqltest_u1,,); +connect (tmp_con5,localhost,mysqltest_u1,,); +connect (tmp_con6,localhost,mysqltest_u1,,); +connect (tmp_con7,localhost,mysqltest_u1,,); +connection default; + --echo --echo # -- Waiting for Event Scheduler to start... let $wait_condition = @@ -230,6 +239,13 @@ let $wait_condition = --disconnect con_2 --disconnect con_3 --disconnect con_super_1 +--disconnect tmp_con1 +--disconnect tmp_con2 +--disconnect tmp_con3 +--disconnect tmp_con4 +--disconnect tmp_con5 +--disconnect tmp_con6 +--disconnect tmp_con7 --echo --echo # -- Restoring default connection... diff --git a/mysql-test/t/mdev375.test b/mysql-test/t/mdev375.test index fe259b37808..7380e7a32e1 100644 --- a/mysql-test/t/mdev375.test +++ b/mysql-test/t/mdev375.test @@ -4,7 +4,16 @@ --source include/not_embedded.inc SET GLOBAL log_warnings=4; -SET GLOBAL max_connections=2; +SET GLOBAL max_connections=10; + +--connect (tmp_con1,localhost,root,,) +--connect (tmp_con2,localhost,root,,) +--connect (tmp_con3,localhost,root,,) +--connect (tmp_con4,localhost,root,,) +--connect (tmp_con5,localhost,root,,) +--connect (tmp_con6,localhost,root,,) +--connect (tmp_con7,localhost,root,,) +--connect (tmp_con8,localhost,root,,) --connect (con1,localhost,root,,) SELECT 1; diff --git a/mysql-test/t/myisam.test b/mysql-test/t/myisam.test index 62260ba43aa..8c7ad012a65 100644 --- a/mysql-test/t/myisam.test +++ b/mysql-test/t/myisam.test @@ -1216,9 +1216,9 @@ DROP TABLE t1; --echo # --echo # BUG#48438 - crash with error in unioned query against merge table and view... --echo # -SET GLOBAL table_open_cache=3; +SET GLOBAL table_open_cache=10; CREATE TABLE t1(a INT); -SELECT 1 FROM t1 AS a1, t1 AS a2, t1 AS a3, t1 AS a4 FOR UPDATE; +SELECT 1 FROM t1 AS a1, t1 AS a2, t1 AS a3, t1 AS a4, t1 AS a5, t1 AS a6, t1 AS a7, t1 AS a8, t1 AS a9, t1 AS a10, t1 AS a11 FOR UPDATE; SELECT TABLE_ROWS, DATA_LENGTH FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test' AND TABLE_NAME='t1'; DROP TABLE t1; diff --git a/mysql-test/t/sp.test b/mysql-test/t/sp.test index 4b2230ea7da..eeabb0486ca 100644 --- a/mysql-test/t/sp.test +++ b/mysql-test/t/sp.test @@ -9408,7 +9408,7 @@ DELIMITER ;| set @tmp_toc= @@table_open_cache; set @tmp_tdc= @@table_definition_cache; -set global table_open_cache=1; +set global table_open_cache=10; set global table_definition_cache=1; call p1(); diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 4f57d6d1910..7875d41d706 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -4287,11 +4287,20 @@ static int init_common_variables() /* connections and databases needs lots of files */ { - uint files, wanted_files, max_open_files; + uint files, wanted_files, max_open_files, min_tc_size, extra_files, + min_connections; + ulong org_max_connections, org_tc_size; + /* Number of files reserved for temporary files */ + extra_files= 30; + min_connections= 10; /* MyISAM requires two file handles per table. */ - wanted_files= (10 + max_connections + extra_max_connections + + wanted_files= (extra_files + max_connections + extra_max_connections + tc_size * 2); + min_tc_size= MY_MIN(tc_size, TABLE_OPEN_CACHE_MIN); + org_max_connections= max_connections; + org_tc_size= tc_size; + /* We are trying to allocate no less than max_connections*5 file handles (i.e. we are trying to set the limit so that they will @@ -4303,41 +4312,52 @@ static int init_common_variables() requested (value of wanted_files). */ max_open_files= MY_MAX(MY_MAX(wanted_files, - (max_connections + extra_max_connections)*5), - open_files_limit); + (max_connections + extra_max_connections)*5), + open_files_limit); files= my_set_max_open_files(max_open_files); + SYSVAR_AUTOSIZE_IF_CHANGED(open_files_limit, files, ulong); - if (files < wanted_files) - { - if (!open_files_limit) - { - /* - If we have requested too much file handles than we bring - max_connections in supported bounds. - */ - SYSVAR_AUTOSIZE(max_connections, - (ulong) MY_MIN(files-10-TABLE_OPEN_CACHE_MIN*2, max_connections)); - /* - Decrease tc_size according to max_connections, but - not below TABLE_OPEN_CACHE_MIN. Outer MY_MIN() ensures that we - never increase tc_size automatically (that could - happen if max_connections is decreased above). - */ - SYSVAR_AUTOSIZE(tc_size, - (ulong) MY_MIN(MY_MAX((files - 10 - max_connections) / 2, - TABLE_OPEN_CACHE_MIN), tc_size)); - DBUG_PRINT("warning", - ("Changed limits: max_open_files: %u max_connections: %ld table_cache: %ld", - files, max_connections, tc_size)); - if (global_system_variables.log_warnings > 1) - sql_print_warning("Changed limits: max_open_files: %u max_connections: %ld table_cache: %ld", - files, max_connections, tc_size); - } - else if (global_system_variables.log_warnings) - sql_print_warning("Could not increase number of max_open_files to more than %u (request: %u)", files, wanted_files); - } - SYSVAR_AUTOSIZE(open_files_limit, files); + if (files < wanted_files && global_system_variables.log_warnings) + sql_print_warning("Could not increase number of max_open_files to more than %u (request: %u)", files, wanted_files); + + /* + If we have requested too much file handles than we bring + max_connections in supported bounds. Still leave at least + 'min_connections' connections + */ + SYSVAR_AUTOSIZE_IF_CHANGED(max_connections, + (ulong) MY_MAX(MY_MIN(files- extra_files- + min_tc_size*2, + max_connections), + min_connections), + ulong); + + /* + Decrease tc_size according to max_connections, but + not below min_tc_size. Outer MY_MIN() ensures that we + never increase tc_size automatically (that could + happen if max_connections is decreased above). + */ + SYSVAR_AUTOSIZE_IF_CHANGED(tc_size, + (ulong) MY_MIN(MY_MAX((files - extra_files - + max_connections) / 2, + min_tc_size), + tc_size), ulong); + DBUG_PRINT("warning", + ("Current limits: max_open_files: %u max_connections: %ld table_cache: %ld", + files, max_connections, tc_size)); + if (global_system_variables.log_warnings > 1 && + (max_connections < org_max_connections || + tc_size < org_tc_size)) + sql_print_warning("Changed limits: max_open_files: %u max_connections: %lu (was %lu) table_cache: %lu (was %lu)", + files, max_connections, org_max_connections, + tc_size, org_tc_size); } + /* + Max_connections and tc_cache are now set. + Now we can fix other variables depending on this variable. + */ + unireg_init(opt_specialflag); /* Set up extern variabels */ if (!(my_default_lc_messages= my_locale_by_name(lc_messages))) diff --git a/sql/set_var.h b/sql/set_var.h index cf86ecf18fa..fe66eaff775 100644 --- a/sql/set_var.h +++ b/sql/set_var.h @@ -394,6 +394,16 @@ int sql_set_variables(THD *thd, List *var_list, bool free); set_sys_var_value_origin(&VAR, sys_var::AUTO); \ } while(0) +#define SYSVAR_AUTOSIZE_IF_CHANGED(VAR,VAL,TYPE) \ + do { \ + TYPE tmp= (VAL); \ + if (VAR != tmp) \ + { \ + VAR= (VAL); \ + set_sys_var_value_origin(&VAR, sys_var::AUTO); \ + } \ + } while(0) + void set_sys_var_value_origin(void *ptr, enum sys_var::where here); enum sys_var::where get_sys_var_value_origin(void *ptr); diff --git a/sql/sql_const.h b/sql/sql_const.h index 946cf13e2ae..0cd214d8bc7 100644 --- a/sql/sql_const.h +++ b/sql/sql_const.h @@ -124,7 +124,7 @@ #define MAX_ACCEPT_RETRY 10 // Test accept this many times #define MAX_FIELDS_BEFORE_HASH 32 #define USER_VARS_HASH_SIZE 16 -#define TABLE_OPEN_CACHE_MIN 400 +#define TABLE_OPEN_CACHE_MIN 200 #define TABLE_OPEN_CACHE_DEFAULT 2000 #define TABLE_DEF_CACHE_DEFAULT 400 /** diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc index 2ec886f0528..8f4ab34e4c4 100644 --- a/sql/sys_vars.cc +++ b/sql/sys_vars.cc @@ -1387,7 +1387,7 @@ static bool fix_max_connections(sys_var *self, THD *thd, enum_var_type type) static Sys_var_ulong Sys_max_connections( "max_connections", "The number of simultaneous clients allowed", PARSED_EARLY GLOBAL_VAR(max_connections), CMD_LINE(REQUIRED_ARG), - VALID_RANGE(1, 100000), + VALID_RANGE(10, 100000), DEFAULT(MAX_CONNECTIONS_DEFAULT), BLOCK_SIZE(1), NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0), ON_UPDATE(fix_max_connections)); @@ -3192,7 +3192,7 @@ static bool fix_table_open_cache(sys_var *, THD *, enum_var_type) static Sys_var_ulong Sys_table_cache_size( "table_open_cache", "The number of cached open tables", GLOBAL_VAR(tc_size), CMD_LINE(REQUIRED_ARG), - VALID_RANGE(1, 1024*1024), DEFAULT(TABLE_OPEN_CACHE_DEFAULT), + VALID_RANGE(10, 1024*1024), DEFAULT(TABLE_OPEN_CACHE_DEFAULT), BLOCK_SIZE(1), NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0), ON_UPDATE(fix_table_open_cache)); diff --git a/storage/tokudb/mysql-test/tokudb_bugs/r/db917.result b/storage/tokudb/mysql-test/tokudb_bugs/r/db917.result index 9c29033429e..9276664f84f 100644 --- a/storage/tokudb/mysql-test/tokudb_bugs/r/db917.result +++ b/storage/tokudb/mysql-test/tokudb_bugs/r/db917.result @@ -1,8 +1,8 @@ drop table if exists t1; set @orig_table_open_cache = @@global.table_open_cache; create table t1(a int) engine = tokudb partition by key(a) partitions 2 (partition p0 engine = tokudb, partition p1 engine = tokudb); -lock tables t1 read; -set @@global.table_open_cache = 1; +lock tables t1 read,t1 as t2 read,t1 as t3 read, t1 as t4 read, t1 as t5 read, t1 as t6 read, t1 as t7 read, t1 as t8 read, t1 as t9 read, t1 as t10 read; +set @@global.table_open_cache = 10; begin; insert into t1 values(1),(1); select * from t1 where c like _ucs2 0x039C0025 collate ucs2_unicode_ci; diff --git a/storage/tokudb/mysql-test/tokudb_bugs/t/db917.test b/storage/tokudb/mysql-test/tokudb_bugs/t/db917.test index ae94d7b30de..781fdb012f1 100644 --- a/storage/tokudb/mysql-test/tokudb_bugs/t/db917.test +++ b/storage/tokudb/mysql-test/tokudb_bugs/t/db917.test @@ -7,8 +7,8 @@ drop table if exists t1; enable_warnings; set @orig_table_open_cache = @@global.table_open_cache; create table t1(a int) engine = tokudb partition by key(a) partitions 2 (partition p0 engine = tokudb, partition p1 engine = tokudb); -lock tables t1 read; -set @@global.table_open_cache = 1; +lock tables t1 read,t1 as t2 read,t1 as t3 read, t1 as t4 read, t1 as t5 read, t1 as t6 read, t1 as t7 read, t1 as t8 read, t1 as t9 read, t1 as t10 read; +set @@global.table_open_cache = 10; begin; insert into t1 values(1),(1); # when the bug is present, this results in a lock wait timeout -- cgit v1.2.1 From 9aa1ab5a597341d0cac25a7dc0771ff5e68c5c1c Mon Sep 17 00:00:00 2001 From: Monty Date: Fri, 23 Mar 2018 14:52:14 +0200 Subject: Fixed compiler warning --- sql/mdl.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/mdl.cc b/sql/mdl.cc index 56515d42c58..86fc5fa39fc 100644 --- a/sql/mdl.cc +++ b/sql/mdl.cc @@ -674,7 +674,7 @@ int mdl_iterate(int (*callback)(MDL_ticket *ticket, void *arg), void *arg) my_hash_value_type mdl_hash_function(CHARSET_INFO *cs, const uchar *key, size_t length) { - MDL_key *mdl_key= (MDL_key*) (key - offsetof(MDL_key, m_ptr)); + MDL_key *mdl_key= (MDL_key*) (key - my_offsetof(MDL_key, m_ptr)); return mdl_key->hash_value(); } -- cgit v1.2.1 From 8bb51f612e5dbd9598e48bb4d850c2fe55cc05ca Mon Sep 17 00:00:00 2001 From: Monty Date: Sun, 25 Mar 2018 13:38:12 +0300 Subject: disable some galera tests that fails regurarly --- mysql-test/suite/galera/disabled.def | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mysql-test/suite/galera/disabled.def b/mysql-test/suite/galera/disabled.def index 49081918bfd..26ff545ac90 100644 --- a/mysql-test/suite/galera/disabled.def +++ b/mysql-test/suite/galera/disabled.def @@ -50,3 +50,5 @@ galera_gtid : MDEV-13549 Galera test failures 10.1 galera_gtid_slave : MDEV-13549 Galera test failures 10.1 galera_unicode_identifiers : MDEV-13549 Galera test failures 10.1 galera.galera_gcs_fc_limit : MDEV-13549 Galera test failures 10.1 +galera.MW-329 : wsrep_local_replays not stable +galera.MW-328A : have_deadlocks test not stable -- cgit v1.2.1 From 2f2e7f8c9db48eba968ce3b9e1f696c3edd4651e Mon Sep 17 00:00:00 2001 From: Monty Date: Sun, 25 Mar 2018 14:05:30 +0300 Subject: Fixed compiler warnings in sphinx --- storage/sphinx/snippets_udf.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/storage/sphinx/snippets_udf.cc b/storage/sphinx/snippets_udf.cc index 2a290bd8de9..ea8246c46f3 100644 --- a/storage/sphinx/snippets_udf.cc +++ b/storage/sphinx/snippets_udf.cc @@ -178,10 +178,10 @@ enum SEARCHD_WARNING = 3 ///< general success, warning message and command-specific reply follow }; -#define SPHINXSE_DEFAULT_SCHEME "sphinx" -#define SPHINXSE_DEFAULT_HOST "127.0.0.1" +#define SPHINXSE_DEFAULT_SCHEME (char*) "sphinx" +#define SPHINXSE_DEFAULT_HOST (char*) "127.0.0.1" #define SPHINXSE_DEFAULT_PORT 9312 -#define SPHINXSE_DEFAULT_INDEX "*" +#define SPHINXSE_DEFAULT_INDEX (char*) "*" class CSphBuffer { @@ -447,7 +447,7 @@ int CSphUrl::Connect() uint uServerVersion; uint uClientVersion = htonl ( SPHINX_SEARCHD_PROTO ); int iSocket = -1; - char * pError = NULL; + const char * pError = NULL; do { iSocket = socket ( iDomain, SOCK_STREAM, 0 ); -- cgit v1.2.1 From e8c2366bf87a89f87feac16d1cf98551ddb6bd40 Mon Sep 17 00:00:00 2001 From: Alexander Barkov Date: Tue, 27 Mar 2018 09:40:10 +0400 Subject: MDEV-15620 Crash when using "SET @@NEW.a=expr" inside a trigger A simple patch fixing the problem in 5.5. Note, a full patch was previously fixed to 10.3. --- mysql-test/r/parser.result | 7 +++++++ mysql-test/t/parser.test | 9 +++++++++ sql/sql_yacc.yy | 5 +++++ 3 files changed, 21 insertions(+) diff --git a/mysql-test/r/parser.result b/mysql-test/r/parser.result index 9a14c0e324b..70dc7a4c1cf 100644 --- a/mysql-test/r/parser.result +++ b/mysql-test/r/parser.result @@ -672,3 +672,10 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp PREPARE stmt FROM 'CREATE TRIGGER tr AFTER DELETE ON t1 FOR EACH ROW SET @a = 1\\'; ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '\' at line 1 DROP TABLE t1; +# +# MDEV-15620 Crash when using "SET @@NEW.a=expr" inside a trigger +# +CREATE TABLE t1 (a INT); +CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW SET @@NEW.a=0; +ERROR HY000: Unknown system variable 'NEW' +DROP TABLE t1; diff --git a/mysql-test/t/parser.test b/mysql-test/t/parser.test index 1e3458eafdf..06ec3164ad1 100644 --- a/mysql-test/t/parser.test +++ b/mysql-test/t/parser.test @@ -780,3 +780,12 @@ CREATE TRIGGER tr AFTER DELETE ON t1 FOR EACH ROW SET @a = 1\; --error ER_PARSE_ERROR PREPARE stmt FROM 'CREATE TRIGGER tr AFTER DELETE ON t1 FOR EACH ROW SET @a = 1\\'; DROP TABLE t1; + +--echo # +--echo # MDEV-15620 Crash when using "SET @@NEW.a=expr" inside a trigger +--echo # + +CREATE TABLE t1 (a INT); +--error ER_UNKNOWN_SYSTEM_VARIABLE +CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW SET @@NEW.a=0; +DROP TABLE t1; diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index e1c6b5b6276..bf47153c0c1 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -13567,6 +13567,11 @@ option_value: | '@' '@' opt_var_ident_type internal_variable_name equal set_expr_or_default { struct sys_var_with_base tmp= $4; + if (tmp.var == trg_new_row_fake_var) + { + my_error(ER_UNKNOWN_SYSTEM_VARIABLE, MYF(0), "NEW"); + MYSQL_YYABORT; + } /* Lookup if necessary: must be a system variable. */ if (tmp.var == NULL) { -- cgit v1.2.1 From bdab8b74ff24a25ecbc7aa96addc54767a6c7146 Mon Sep 17 00:00:00 2001 From: Varun Gupta Date: Sat, 24 Mar 2018 03:31:18 +0530 Subject: MDEV-11274: Executing EXPLAIN of complex query over join limit causes server to crash For this case we have a view that is mergeable but we are not able to merge it in the parent select because that would exceed the maximum tables allowed in the join list, so we materialise this view TABLE_LIST::dervied is NULL for such views, it is only set for views which have ALGORITHM=TEMPTABLE Fixed by making sure TABLE_LIST::derived is set for views that could not be merged --- mysql-test/r/view.result | 197 +++++++++++++++++++++++++++++++++++++++++++++++ mysql-test/t/view.test | 196 ++++++++++++++++++++++++++++++++++++++++++++++ sql/table.h | 1 + 3 files changed, 394 insertions(+) diff --git a/mysql-test/r/view.result b/mysql-test/r/view.result index 1d12c50954f..7fc3c48c3a0 100644 --- a/mysql-test/r/view.result +++ b/mysql-test/r/view.result @@ -5535,6 +5535,203 @@ View Create View character_set_client collation_connection v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select group_concat(`t1`.`str` separator '\\') AS `GROUP_CONCAT(str SEPARATOR '\\')` from `t1` latin1 latin1_swedish_ci drop view v1; drop table t1; +CREATE TABLE IF NOT EXISTS t0 (f0 INT); +CREATE TABLE IF NOT EXISTS t1 (f1 INT); +CREATE TABLE IF NOT EXISTS t2 (f2 INT); +CREATE TABLE IF NOT EXISTS t3 (f3 INT); +CREATE TABLE IF NOT EXISTS t4 (f4 INT); +CREATE TABLE IF NOT EXISTS t5 (f5 INT); +CREATE TABLE IF NOT EXISTS t6 (f6 INT); +CREATE TABLE IF NOT EXISTS t7 (f7 INT); +CREATE TABLE IF NOT EXISTS t8 (f8 INT); +CREATE TABLE IF NOT EXISTS t9 (f9 INT); +CREATE TABLE IF NOT EXISTS t10 (f10 INT); +CREATE TABLE IF NOT EXISTS t11 (f11 INT); +CREATE TABLE IF NOT EXISTS t12 (f12 INT); +CREATE TABLE IF NOT EXISTS t13 (f13 INT); +CREATE TABLE IF NOT EXISTS t14 (f14 INT); +CREATE TABLE IF NOT EXISTS t15 (f15 INT); +CREATE TABLE IF NOT EXISTS t16 (f16 INT); +CREATE TABLE IF NOT EXISTS t17 (f17 INT); +CREATE TABLE IF NOT EXISTS t18 (f18 INT); +CREATE TABLE IF NOT EXISTS t19 (f19 INT); +CREATE TABLE IF NOT EXISTS t20 (f20 INT); +CREATE TABLE IF NOT EXISTS t21 (f21 INT); +CREATE TABLE IF NOT EXISTS t22 (f22 INT); +CREATE TABLE IF NOT EXISTS t23 (f23 INT); +CREATE TABLE IF NOT EXISTS t24 (f24 INT); +CREATE TABLE IF NOT EXISTS t25 (f25 INT); +CREATE TABLE IF NOT EXISTS t26 (f26 INT); +CREATE TABLE IF NOT EXISTS t27 (f27 INT); +CREATE TABLE IF NOT EXISTS t28 (f28 INT); +CREATE TABLE IF NOT EXISTS t29 (f29 INT); +CREATE TABLE IF NOT EXISTS t30 (f30 INT); +CREATE TABLE IF NOT EXISTS t31 (f31 INT); +CREATE TABLE IF NOT EXISTS t32 (f32 INT); +CREATE TABLE IF NOT EXISTS t33 (f33 INT); +CREATE TABLE IF NOT EXISTS t34 (f34 INT); +CREATE TABLE IF NOT EXISTS t35 (f35 INT); +CREATE TABLE IF NOT EXISTS t36 (f36 INT); +CREATE TABLE IF NOT EXISTS t37 (f37 INT); +CREATE TABLE IF NOT EXISTS t38 (f38 INT); +CREATE TABLE IF NOT EXISTS t39 (f39 INT); +CREATE TABLE IF NOT EXISTS t40 (f40 INT); +CREATE TABLE IF NOT EXISTS t41 (f41 INT); +CREATE TABLE IF NOT EXISTS t42 (f42 INT); +CREATE TABLE IF NOT EXISTS t43 (f43 INT); +CREATE TABLE IF NOT EXISTS t44 (f44 INT); +CREATE TABLE IF NOT EXISTS t45 (f45 INT); +CREATE TABLE IF NOT EXISTS t46 (f46 INT); +CREATE TABLE IF NOT EXISTS t47 (f47 INT); +CREATE TABLE IF NOT EXISTS t48 (f48 INT); +CREATE TABLE IF NOT EXISTS t49 (f49 INT); +CREATE TABLE IF NOT EXISTS t50 (f50 INT); +CREATE TABLE IF NOT EXISTS t51 (f51 INT); +CREATE TABLE IF NOT EXISTS t52 (f52 INT); +CREATE TABLE IF NOT EXISTS t53 (f53 INT); +CREATE TABLE IF NOT EXISTS t54 (f54 INT); +CREATE TABLE IF NOT EXISTS t55 (f55 INT); +CREATE TABLE IF NOT EXISTS t56 (f56 INT); +CREATE TABLE IF NOT EXISTS t57 (f57 INT); +CREATE TABLE IF NOT EXISTS t58 (f58 INT); +CREATE TABLE IF NOT EXISTS t59 (f59 INT); +CREATE TABLE IF NOT EXISTS t60 (f60 INT); +CREATE OR REPLACE VIEW v60 AS SELECT * FROM t60; +EXPLAIN +SELECT t0.* +FROM t0 +JOIN t1 +ON t1.f1 = t0.f0 +LEFT JOIN t2 +ON t0.f0 = t2.f2 +LEFT JOIN t3 +ON t0.f0 = t3.f3 +LEFT JOIN t4 +ON t0.f0 = t4.f4 +LEFT JOIN t5 +ON t4.f4 = t5.f5 +LEFT JOIN t6 +ON t0.f0 = t6.f6 +LEFT JOIN t7 +ON t0.f0 = t7.f7 +LEFT JOIN t8 +ON t0.f0 = t8.f8 +LEFT JOIN t9 +ON t0.f0 = t9.f9 +LEFT JOIN t10 +ON t0.f0 = t10.f10 +LEFT JOIN t11 +ON t0.f0 = t11.f11 +LEFT JOIN t12 +ON t0.f0 = t12.f12 +LEFT JOIN t13 +ON t0.f0 = t13.f13 +LEFT JOIN t14 +ON t0.f0 = t14.f14 +LEFT JOIN t15 +ON t0.f0 = t15.f15 +LEFT JOIN t16 +ON t0.f0 = t16.f16 +LEFT JOIN t17 +ON t0.f0 = t17.f17 +LEFT JOIN t18 +ON t0.f0 = t18.f18 +LEFT JOIN t19 +ON t18.f18 = t19.f19 +LEFT JOIN t20 +ON t20.f20 = t19.f19 +LEFT JOIN t21 +ON t20.f20 = t21.f21 +LEFT JOIN t22 +ON t19.f19 = t22.f22 +LEFT JOIN t23 +ON t23.f23 = t0.f0 +LEFT JOIN t24 +ON t24.f24 = t23.f23 +LEFT JOIN t25 +ON t0.f0 = t25.f25 +LEFT JOIN t26 +ON t26.f26 = t0.f0 +LEFT JOIN t27 +ON t27.f27 = t0.f0 +LEFT JOIN t28 +ON t0.f0 = t28.f28 +LEFT JOIN t29 +ON t0.f0 = t29.f29 +LEFT JOIN t30 +ON t30.f30 = t0.f0 +LEFT JOIN t31 +ON t0.f0 = t31.f31 +LEFT JOIN t32 +ON t32.f32 = t31.f31 +LEFT JOIN t33 +ON t33.f33 = t0.f0 +LEFT JOIN t34 +ON t33.f33 = t34.f34 +LEFT JOIN t35 +ON t33.f33 = t35.f35 +LEFT JOIN t36 +ON t36.f36 = t0.f0 +LEFT JOIN t37 +ON t32.f32 = t37.f37 +LEFT JOIN t38 +ON t31.f31 = t38.f38 +LEFT JOIN t39 +ON t39.f39 = t0.f0 +LEFT JOIN t40 +ON t40.f40 = t39.f39 +LEFT JOIN t41 +ON t41.f41 = t0.f0 +LEFT JOIN t42 +ON t42.f42 = t41.f41 +LEFT JOIN t43 +ON t43.f43 = t41.f41 +LEFT JOIN t44 +ON t44.f44 = t0.f0 +LEFT JOIN t45 +ON t45.f45 = t0.f0 +LEFT JOIN t46 +ON t46.f46 = t0.f0 +LEFT JOIN t47 +ON t47.f47 = t0.f0 +LEFT JOIN t48 +ON t48.f48 = t0.f0 +LEFT JOIN t49 +ON t0.f0 = t49.f49 +LEFT JOIN t50 +ON t0.f0 = t50.f50 +LEFT JOIN t51 +ON t0.f0 = t51.f51 +LEFT JOIN t52 +ON t52.f52 = t0.f0 +LEFT JOIN t53 +ON t53.f53 = t0.f0 +LEFT JOIN t54 +ON t54.f54 = t0.f0 +LEFT JOIN t55 +ON t55.f55 = t0.f0 +LEFT JOIN t56 +ON t56.f56 = t0.f0 +LEFT JOIN t57 +ON t57.f57 = t0.f0 +LEFT JOIN t58 +ON t58.f58 = t57.f57 +LEFT JOIN t59 +ON t36.f36 = t59.f59 +LEFT JOIN v60 +ON t36.f36 = v60.f60 +; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL no matching row in const table +drop table t0, t1, t2, t3, t4, t5, t6, t7, t8, t9, +t10, t11, t12, t13, t14, t15, t16, t17, t18, +t19, t20, t21, t22, t23, t24, t25, t26, t27, +t28, t29, t30, t31, t32, t33, t34, t35, t36, +t37, t38, t39, t40, t41, t42, t43, t44, t45, +t46, t47, t48, t49, t50, t51, t52, t53, t54, +t55, t56, t57, t58, t59,t60; +drop view v60; # ----------------------------------------------------------------- # -- End of 5.5 tests. # ----------------------------------------------------------------- diff --git a/mysql-test/t/view.test b/mysql-test/t/view.test index 4b3537df2de..835f12957d4 100644 --- a/mysql-test/t/view.test +++ b/mysql-test/t/view.test @@ -5478,6 +5478,202 @@ SHOW CREATE VIEW v1; drop view v1; drop table t1; +CREATE TABLE IF NOT EXISTS t0 (f0 INT); +CREATE TABLE IF NOT EXISTS t1 (f1 INT); +CREATE TABLE IF NOT EXISTS t2 (f2 INT); +CREATE TABLE IF NOT EXISTS t3 (f3 INT); +CREATE TABLE IF NOT EXISTS t4 (f4 INT); +CREATE TABLE IF NOT EXISTS t5 (f5 INT); +CREATE TABLE IF NOT EXISTS t6 (f6 INT); +CREATE TABLE IF NOT EXISTS t7 (f7 INT); +CREATE TABLE IF NOT EXISTS t8 (f8 INT); +CREATE TABLE IF NOT EXISTS t9 (f9 INT); +CREATE TABLE IF NOT EXISTS t10 (f10 INT); +CREATE TABLE IF NOT EXISTS t11 (f11 INT); +CREATE TABLE IF NOT EXISTS t12 (f12 INT); +CREATE TABLE IF NOT EXISTS t13 (f13 INT); +CREATE TABLE IF NOT EXISTS t14 (f14 INT); +CREATE TABLE IF NOT EXISTS t15 (f15 INT); +CREATE TABLE IF NOT EXISTS t16 (f16 INT); +CREATE TABLE IF NOT EXISTS t17 (f17 INT); +CREATE TABLE IF NOT EXISTS t18 (f18 INT); +CREATE TABLE IF NOT EXISTS t19 (f19 INT); +CREATE TABLE IF NOT EXISTS t20 (f20 INT); +CREATE TABLE IF NOT EXISTS t21 (f21 INT); +CREATE TABLE IF NOT EXISTS t22 (f22 INT); +CREATE TABLE IF NOT EXISTS t23 (f23 INT); +CREATE TABLE IF NOT EXISTS t24 (f24 INT); +CREATE TABLE IF NOT EXISTS t25 (f25 INT); +CREATE TABLE IF NOT EXISTS t26 (f26 INT); +CREATE TABLE IF NOT EXISTS t27 (f27 INT); +CREATE TABLE IF NOT EXISTS t28 (f28 INT); +CREATE TABLE IF NOT EXISTS t29 (f29 INT); +CREATE TABLE IF NOT EXISTS t30 (f30 INT); +CREATE TABLE IF NOT EXISTS t31 (f31 INT); +CREATE TABLE IF NOT EXISTS t32 (f32 INT); +CREATE TABLE IF NOT EXISTS t33 (f33 INT); +CREATE TABLE IF NOT EXISTS t34 (f34 INT); +CREATE TABLE IF NOT EXISTS t35 (f35 INT); +CREATE TABLE IF NOT EXISTS t36 (f36 INT); +CREATE TABLE IF NOT EXISTS t37 (f37 INT); +CREATE TABLE IF NOT EXISTS t38 (f38 INT); +CREATE TABLE IF NOT EXISTS t39 (f39 INT); +CREATE TABLE IF NOT EXISTS t40 (f40 INT); +CREATE TABLE IF NOT EXISTS t41 (f41 INT); +CREATE TABLE IF NOT EXISTS t42 (f42 INT); +CREATE TABLE IF NOT EXISTS t43 (f43 INT); +CREATE TABLE IF NOT EXISTS t44 (f44 INT); +CREATE TABLE IF NOT EXISTS t45 (f45 INT); +CREATE TABLE IF NOT EXISTS t46 (f46 INT); +CREATE TABLE IF NOT EXISTS t47 (f47 INT); +CREATE TABLE IF NOT EXISTS t48 (f48 INT); +CREATE TABLE IF NOT EXISTS t49 (f49 INT); +CREATE TABLE IF NOT EXISTS t50 (f50 INT); +CREATE TABLE IF NOT EXISTS t51 (f51 INT); +CREATE TABLE IF NOT EXISTS t52 (f52 INT); +CREATE TABLE IF NOT EXISTS t53 (f53 INT); +CREATE TABLE IF NOT EXISTS t54 (f54 INT); +CREATE TABLE IF NOT EXISTS t55 (f55 INT); +CREATE TABLE IF NOT EXISTS t56 (f56 INT); +CREATE TABLE IF NOT EXISTS t57 (f57 INT); +CREATE TABLE IF NOT EXISTS t58 (f58 INT); +CREATE TABLE IF NOT EXISTS t59 (f59 INT); +CREATE TABLE IF NOT EXISTS t60 (f60 INT); +CREATE OR REPLACE VIEW v60 AS SELECT * FROM t60; + +EXPLAIN + SELECT t0.* +FROM t0 +JOIN t1 + ON t1.f1 = t0.f0 +LEFT JOIN t2 + ON t0.f0 = t2.f2 +LEFT JOIN t3 + ON t0.f0 = t3.f3 +LEFT JOIN t4 + ON t0.f0 = t4.f4 +LEFT JOIN t5 + ON t4.f4 = t5.f5 +LEFT JOIN t6 + ON t0.f0 = t6.f6 +LEFT JOIN t7 + ON t0.f0 = t7.f7 +LEFT JOIN t8 + ON t0.f0 = t8.f8 +LEFT JOIN t9 + ON t0.f0 = t9.f9 +LEFT JOIN t10 + ON t0.f0 = t10.f10 +LEFT JOIN t11 + ON t0.f0 = t11.f11 +LEFT JOIN t12 + ON t0.f0 = t12.f12 +LEFT JOIN t13 + ON t0.f0 = t13.f13 +LEFT JOIN t14 + ON t0.f0 = t14.f14 +LEFT JOIN t15 + ON t0.f0 = t15.f15 +LEFT JOIN t16 + ON t0.f0 = t16.f16 +LEFT JOIN t17 + ON t0.f0 = t17.f17 +LEFT JOIN t18 + ON t0.f0 = t18.f18 +LEFT JOIN t19 + ON t18.f18 = t19.f19 +LEFT JOIN t20 + ON t20.f20 = t19.f19 +LEFT JOIN t21 + ON t20.f20 = t21.f21 +LEFT JOIN t22 + ON t19.f19 = t22.f22 +LEFT JOIN t23 + ON t23.f23 = t0.f0 +LEFT JOIN t24 + ON t24.f24 = t23.f23 +LEFT JOIN t25 + ON t0.f0 = t25.f25 +LEFT JOIN t26 + ON t26.f26 = t0.f0 +LEFT JOIN t27 + ON t27.f27 = t0.f0 +LEFT JOIN t28 + ON t0.f0 = t28.f28 +LEFT JOIN t29 + ON t0.f0 = t29.f29 +LEFT JOIN t30 + ON t30.f30 = t0.f0 +LEFT JOIN t31 + ON t0.f0 = t31.f31 +LEFT JOIN t32 + ON t32.f32 = t31.f31 +LEFT JOIN t33 + ON t33.f33 = t0.f0 +LEFT JOIN t34 + ON t33.f33 = t34.f34 +LEFT JOIN t35 + ON t33.f33 = t35.f35 +LEFT JOIN t36 + ON t36.f36 = t0.f0 +LEFT JOIN t37 + ON t32.f32 = t37.f37 +LEFT JOIN t38 + ON t31.f31 = t38.f38 +LEFT JOIN t39 + ON t39.f39 = t0.f0 +LEFT JOIN t40 + ON t40.f40 = t39.f39 +LEFT JOIN t41 + ON t41.f41 = t0.f0 +LEFT JOIN t42 + ON t42.f42 = t41.f41 +LEFT JOIN t43 + ON t43.f43 = t41.f41 +LEFT JOIN t44 + ON t44.f44 = t0.f0 +LEFT JOIN t45 + ON t45.f45 = t0.f0 +LEFT JOIN t46 + ON t46.f46 = t0.f0 +LEFT JOIN t47 + ON t47.f47 = t0.f0 +LEFT JOIN t48 + ON t48.f48 = t0.f0 +LEFT JOIN t49 + ON t0.f0 = t49.f49 +LEFT JOIN t50 + ON t0.f0 = t50.f50 +LEFT JOIN t51 + ON t0.f0 = t51.f51 +LEFT JOIN t52 + ON t52.f52 = t0.f0 +LEFT JOIN t53 + ON t53.f53 = t0.f0 +LEFT JOIN t54 + ON t54.f54 = t0.f0 +LEFT JOIN t55 + ON t55.f55 = t0.f0 +LEFT JOIN t56 + ON t56.f56 = t0.f0 +LEFT JOIN t57 + ON t57.f57 = t0.f0 +LEFT JOIN t58 + ON t58.f58 = t57.f57 +LEFT JOIN t59 + ON t36.f36 = t59.f59 +LEFT JOIN v60 + ON t36.f36 = v60.f60 +; +drop table t0, t1, t2, t3, t4, t5, t6, t7, t8, t9, +t10, t11, t12, t13, t14, t15, t16, t17, t18, +t19, t20, t21, t22, t23, t24, t25, t26, t27, +t28, t29, t30, t31, t32, t33, t34, t35, t36, +t37, t38, t39, t40, t41, t42, t43, t44, t45, +t46, t47, t48, t49, t50, t51, t52, t53, t54, +t55, t56, t57, t58, t59,t60; +drop view v60; + --echo # ----------------------------------------------------------------- --echo # -- End of 5.5 tests. --echo # ----------------------------------------------------------------- diff --git a/sql/table.h b/sql/table.h index 98f8c7ad73f..fcf214d3582 100644 --- a/sql/table.h +++ b/sql/table.h @@ -2125,6 +2125,7 @@ struct TABLE_LIST DBUG_PRINT("enter", ("Alias: '%s' Unit: %p", (alias ? alias : ""), get_unit())); + derived= get_unit(); derived_type= ((derived_type & (derived ? DTYPE_MASK : DTYPE_VIEW)) | DTYPE_TABLE | DTYPE_MATERIALIZE); set_check_materialized(); -- cgit v1.2.1 From 832025b512b2ddfb22d01358964f27471c678c2f Mon Sep 17 00:00:00 2001 From: Daniele Sciascia Date: Tue, 27 Mar 2018 12:05:33 +0200 Subject: MDEV-13549 Fix and re-enable test galera.galera_suspend_slave Test galera_suspend_slave checks that after suspending a galera node, like this: ``` --perl my $pid_filename = $ENV{'NODE_2_PIDFILE'}; my $mysqld_pid = `cat $pid_filename`; chomp($mysqld_pid); system("kill -SIGSTOP $mysqld_pid"); exit(0); EOF ``` the remaining one node cluster is no longer able to successfully INSERT new rows: ``` --error ER_UNKNOWN_COM_ERROR,ER_LOCK_WAIT_TIMEOUT,ER_LOCK_DEADLOCK,ER_ERROR_DURING_COMMIT INSERT INTO t1 VALUES (1); ``` On rare occasions when the system is overloaded, it appears that suspending the process with ```system("kill -SIGSTOP $mysqld_pid")``` takes some time, enough for the subsequent INSERT to succeed. In which case the test fails because it rightly expects the INSERT to fail. To fix the problem, the patch makes sure that the cluster has shrinked to one node, before trying to INSERT the new value. --- mysql-test/suite/galera/disabled.def | 1 - mysql-test/suite/galera/r/galera_suspend_slave.result | 4 ++-- mysql-test/suite/galera/t/galera_suspend_slave.test | 9 ++++++--- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/mysql-test/suite/galera/disabled.def b/mysql-test/suite/galera/disabled.def index 26ff545ac90..6efafd522aa 100644 --- a/mysql-test/suite/galera/disabled.def +++ b/mysql-test/suite/galera/disabled.def @@ -45,7 +45,6 @@ galera_as_master: MDEV-13549 Galera test failures 10.1 galera_pc_ignore_sb : MDEV-13549 Galera test failures 10.1 galera_lock_table : MDEV-13549 Galera test failures 10.1 MW-284 : MDEV-13549 Galera test failures 10.1 -galera_suspend_slave : MDEV-13549 Galera test failures 10.1 galera_gtid : MDEV-13549 Galera test failures 10.1 galera_gtid_slave : MDEV-13549 Galera test failures 10.1 galera_unicode_identifiers : MDEV-13549 Galera test failures 10.1 diff --git a/mysql-test/suite/galera/r/galera_suspend_slave.result b/mysql-test/suite/galera/r/galera_suspend_slave.result index 357a0d4f78e..ebddb4c449d 100644 --- a/mysql-test/suite/galera/r/galera_suspend_slave.result +++ b/mysql-test/suite/galera/r/galera_suspend_slave.result @@ -1,11 +1,11 @@ CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; Suspending node_2 ... +SET SESSION wsrep_sync_wait = 0; INSERT INTO t1 VALUES (1); Got one of the listed errors Resuming node_2 ... -SET SESSION wsrep_sync_wait = 1; INSERT INTO t1 VALUES (1); -SET SESSION wsrep_sync_wait = 1; +SET SESSION wsrep_sync_wait = 0; SELECT COUNT(*) = 1 FROM t1; COUNT(*) = 1 1 diff --git a/mysql-test/suite/galera/t/galera_suspend_slave.test b/mysql-test/suite/galera/t/galera_suspend_slave.test index aa4543cf81c..6f0f8014397 100644 --- a/mysql-test/suite/galera/t/galera_suspend_slave.test +++ b/mysql-test/suite/galera/t/galera_suspend_slave.test @@ -29,6 +29,11 @@ CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; exit(0); EOF +SET SESSION wsrep_sync_wait = 0; + +--let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--source include/wait_condition.inc + --error ER_UNKNOWN_COM_ERROR,ER_LOCK_WAIT_TIMEOUT,ER_LOCK_DEADLOCK,ER_ERROR_DURING_COMMIT INSERT INTO t1 VALUES (1); @@ -41,8 +46,6 @@ INSERT INTO t1 VALUES (1); exit(0); EOF -SET SESSION wsrep_sync_wait = 1; ---sleep 10 --source include/wait_until_ready.inc INSERT INTO t1 VALUES (1); @@ -51,7 +54,7 @@ INSERT INTO t1 VALUES (1); --source include/galera_connect.inc --connection node_2a -SET SESSION wsrep_sync_wait = 1; +SET SESSION wsrep_sync_wait = 0; --source include/wait_until_ready.inc SELECT COUNT(*) = 1 FROM t1; -- cgit v1.2.1 From 58fad0400c8b4ae1f8c16698e300086f92c3d9d2 Mon Sep 17 00:00:00 2001 From: Daniele Sciascia Date: Tue, 27 Mar 2018 14:23:45 +0200 Subject: MDEV-13549 Fix and re-enable MTR test galera.galera_as_master Was failing due to missing RESET MASTER --- mysql-test/suite/galera/disabled.def | 1 - mysql-test/suite/galera/r/galera_as_master.result | 1 + mysql-test/suite/galera/t/galera_as_master.test | 6 ++++-- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/mysql-test/suite/galera/disabled.def b/mysql-test/suite/galera/disabled.def index 26ff545ac90..0a4c59f45ee 100644 --- a/mysql-test/suite/galera/disabled.def +++ b/mysql-test/suite/galera/disabled.def @@ -41,7 +41,6 @@ lp1376747 : MDEV-13549 Galera test failures galera_toi_ddl_nonconflicting : MDEV-13549 Galera test failures galera_parallel_simple : MDEV-13549 Galera test failures galera_admin : MDEV-13549 Galera test failures -galera_as_master: MDEV-13549 Galera test failures 10.1 galera_pc_ignore_sb : MDEV-13549 Galera test failures 10.1 galera_lock_table : MDEV-13549 Galera test failures 10.1 MW-284 : MDEV-13549 Galera test failures 10.1 diff --git a/mysql-test/suite/galera/r/galera_as_master.result b/mysql-test/suite/galera/r/galera_as_master.result index e96d39aea0c..06de9ccf016 100644 --- a/mysql-test/suite/galera/r/galera_as_master.result +++ b/mysql-test/suite/galera/r/galera_as_master.result @@ -47,3 +47,4 @@ DROP TABLE t2, t3; STOP SLAVE; RESET SLAVE ALL; CALL mtr.add_suppression('You need to use --log-bin to make --binlog-format work'); +RESET MASTER; diff --git a/mysql-test/suite/galera/t/galera_as_master.test b/mysql-test/suite/galera/t/galera_as_master.test index 93f9224b258..49f3c993256 100644 --- a/mysql-test/suite/galera/t/galera_as_master.test +++ b/mysql-test/suite/galera/t/galera_as_master.test @@ -35,14 +35,14 @@ SELECT * FROM t3; SELECT * FROM t4; --connection node_3 -SHOW TABLES; - --let $wait_condition = SELECT COUNT(*) = 2 FROM t1; --source include/wait_condition.inc --let $wait_condition = SELECT COUNT(*) = 3 FROM t4; --source include/wait_condition.inc +SHOW TABLES; + SELECT * FROM t1; SELECT * FROM t4; @@ -63,3 +63,5 @@ RESET SLAVE ALL; CALL mtr.add_suppression('You need to use --log-bin to make --binlog-format work'); +--connection node_1 +RESET MASTER; -- cgit v1.2.1 From db16ae54f657870098f4ee22248192ac9bd48681 Mon Sep 17 00:00:00 2001 From: Daniel Bartholomew Date: Tue, 27 Mar 2018 12:56:59 -0400 Subject: bump the VERSION --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 95c724d2776..5fe6561ce82 100644 --- a/VERSION +++ b/VERSION @@ -1,3 +1,3 @@ MYSQL_VERSION_MAJOR=10 MYSQL_VERSION_MINOR=1 -MYSQL_VERSION_PATCH=32 +MYSQL_VERSION_PATCH=33 -- cgit v1.2.1 From e376122460f0ef45d8c81eb0a144761038175575 Mon Sep 17 00:00:00 2001 From: Daniele Sciascia Date: Wed, 28 Mar 2018 11:35:09 +0200 Subject: MDEV-13549 Fix and re-enable MTR test galera.galera_gtid_slave This patch makes two changes: * It replaces `--sleep 1` with appropriate wait_conditions, and removes another `--sleep 1` which is no longer necessary, after MDEV-14144 has been fixed. * It moves the `RESET MASTER` from node_1 at the very end, when it it sure that the other nodes have applied the the final cleanup `DROP TABLE t1,t2.` This solves the problem with the `DROP TABLE` not being replicated to the asynchronous slaves, which would make the test fail with: `Timeout in wait_condition.inc for SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';` --- mysql-test/suite/galera/disabled.def | 1 - mysql-test/suite/galera/r/galera_gtid_slave.result | 2 +- mysql-test/suite/galera/t/galera_gtid_slave.test | 19 ++++++++++--------- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/mysql-test/suite/galera/disabled.def b/mysql-test/suite/galera/disabled.def index 6efafd522aa..580a1a99ec1 100644 --- a/mysql-test/suite/galera/disabled.def +++ b/mysql-test/suite/galera/disabled.def @@ -46,7 +46,6 @@ galera_pc_ignore_sb : MDEV-13549 Galera test failures 10.1 galera_lock_table : MDEV-13549 Galera test failures 10.1 MW-284 : MDEV-13549 Galera test failures 10.1 galera_gtid : MDEV-13549 Galera test failures 10.1 -galera_gtid_slave : MDEV-13549 Galera test failures 10.1 galera_unicode_identifiers : MDEV-13549 Galera test failures 10.1 galera.galera_gcs_fc_limit : MDEV-13549 Galera test failures 10.1 galera.MW-329 : wsrep_local_replays not stable diff --git a/mysql-test/suite/galera/r/galera_gtid_slave.result b/mysql-test/suite/galera/r/galera_gtid_slave.result index 40f3f1c0d53..58a9d3f5971 100644 --- a/mysql-test/suite/galera/r/galera_gtid_slave.result +++ b/mysql-test/suite/galera/r/galera_gtid_slave.result @@ -19,8 +19,8 @@ SELECT @@global.gtid_binlog_state; @@global.gtid_binlog_state 1-1-4,2-2-2,2-3-3 DROP TABLE t1,t2; -reset master; STOP SLAVE; RESET SLAVE ALL; reset master; reset master; +reset master; diff --git a/mysql-test/suite/galera/t/galera_gtid_slave.test b/mysql-test/suite/galera/t/galera_gtid_slave.test index 8ef87452a5b..19bfd8e17db 100644 --- a/mysql-test/suite/galera/t/galera_gtid_slave.test +++ b/mysql-test/suite/galera/t/galera_gtid_slave.test @@ -38,7 +38,13 @@ SELECT @@global.gtid_binlog_state; --let $wait_condition = SELECT COUNT(*) = 1 FROM t1; --source include/wait_condition.inc ---sleep 1 + +--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't2'; +--source include/wait_condition.inc + +--let $wait_condition = SELECT COUNT(*) = 2 FROM t2; +--source include/wait_condition.inc + INSERT INTO t1 VALUES(2); INSERT INTO t1 VALUES(3); SELECT @@global.gtid_binlog_state; @@ -52,14 +58,6 @@ SELECT @@global.gtid_binlog_state; --connection node_1 DROP TABLE t1,t2; -reset master; -# -# Unfortunately without the sleep below the following statement fails with "query returned no rows", which -# is difficult to understand given that it is an aggregate query. A "query execution was interrupted" -# warning is also reported by MTR, which is also weird. -# - ---sleep 1 --connection node_2 --let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1'; @@ -76,3 +74,6 @@ reset master; --connection node_3 reset master; + +--connection node_1 +reset master; -- cgit v1.2.1 From 390e5ab79415c5db1864b36661161b2cf261a7cb Mon Sep 17 00:00:00 2001 From: Daniele Sciascia Date: Thu, 29 Mar 2018 15:50:06 +0200 Subject: MDEV-13549 Fix and re-enable MTR test galera.mysql-wsrep#90 Test was missing DEBUG_SYNC cleanup `SET DEBUG_SYNC ='RESET'`. --- mysql-test/suite/galera/disabled.def | 1 - mysql-test/suite/galera/r/mysql-wsrep#90.result | 2 ++ mysql-test/suite/galera/t/mysql-wsrep#90.test | 2 ++ 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/mysql-test/suite/galera/disabled.def b/mysql-test/suite/galera/disabled.def index 38fdc50f14d..c5e7f4521f6 100644 --- a/mysql-test/suite/galera/disabled.def +++ b/mysql-test/suite/galera/disabled.def @@ -17,7 +17,6 @@ galera_binlog_rows_query_log_events: MariaDB does not support binlog_rows_query_ GAL-419 : MDEV-13549 Galera test failures galera_toi_ddl_fk_insert : MDEV-13549 Galera test failures galera_var_notify_cmd : MDEV-13549 Galera test failures -mysql-wsrep#90 : MDEV-13549 Galera test failures galera_as_master_gtid : Requires MySQL GTID galera_as_master_gtid_change_master : Requires MySQL GTID galera_as_slave_replication_bundle : MDEV-13549 Galera test failures diff --git a/mysql-test/suite/galera/r/mysql-wsrep#90.result b/mysql-test/suite/galera/r/mysql-wsrep#90.result index da57b9d0068..7ecaff7707e 100644 --- a/mysql-test/suite/galera/r/mysql-wsrep#90.result +++ b/mysql-test/suite/galera/r/mysql-wsrep#90.result @@ -12,6 +12,7 @@ SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1'; COUNT(*) = 2 1 DROP TABLE t1; +SET DEBUG_SYNC = 'RESET'; CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) Engine=InnoDB; SET GLOBAL wsrep_OSU_method = "TOI"; SET DEBUG_SYNC = 'alter_table_before_open_tables WAIT_FOR continue'; @@ -29,3 +30,4 @@ COUNT(*) = 2 INSERT INTO t1 VALUES (3,4); DROP TABLE t1; SET GLOBAL WSREP_OSU_METHOD = TOI; +SET DEBUG_SYNC = 'RESET'; diff --git a/mysql-test/suite/galera/t/mysql-wsrep#90.test b/mysql-test/suite/galera/t/mysql-wsrep#90.test index 5af86fb2872..11ef6416526 100644 --- a/mysql-test/suite/galera/t/mysql-wsrep#90.test +++ b/mysql-test/suite/galera/t/mysql-wsrep#90.test @@ -31,6 +31,7 @@ SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1'; --connection node_1 DROP TABLE t1; +SET DEBUG_SYNC = 'RESET'; CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) Engine=InnoDB; @@ -63,3 +64,4 @@ INSERT INTO t1 VALUES (3,4); DROP TABLE t1; SET GLOBAL WSREP_OSU_METHOD = TOI; +SET DEBUG_SYNC = 'RESET'; -- cgit v1.2.1 From 10f6b7001bd7b683c013ae407c2c48793caa3633 Mon Sep 17 00:00:00 2001 From: Varun Gupta Date: Mon, 2 Apr 2018 13:14:30 +0300 Subject: MDEV-9744: session optimizer_use_condition_selectivity=5 causing SQL Error (1918): Encountered illegal value '' when converting to DECIMAL The issue was that EITS data was allocated but then not read for some reason (one being to avoid a deadlock), then the optimizer was using these bzero'ed buffers as EITS statistics. This should not be allowed, we should use statistcs for a table only when we have successfully loaded/read the stats from the statistical tables. --- mysql-test/r/statistics.result | 18 ++++++++++++++++++ mysql-test/t/statistics.test | 20 ++++++++++++++++++++ sql/sql_statistics.cc | 39 +++++++++++++++++++++++++++++++++------ sql/sql_statistics.h | 1 + 4 files changed, 72 insertions(+), 6 deletions(-) diff --git a/mysql-test/r/statistics.result b/mysql-test/r/statistics.result index bd6a0849e3d..74997c92d3e 100644 --- a/mysql-test/r/statistics.result +++ b/mysql-test/r/statistics.result @@ -1641,3 +1641,21 @@ FROM mysql.column_stats; db_name table_name column_name HEX(min_value) HEX(max_value) nulls_ratio avg_frequency hist_size hist_type HEX(histogram) test t1 a D879626AF872675F73E662F8 D879626AF872675F73E662F8 0.0000 1.0000 0 NULL NULL drop table t1; +# +# MDEB-9744: session optimizer_use_condition_selectivity=5 causing SQL Error (1918): +# Encountered illegal value '' when converting to DECIMAL +# +set @save_optimizer_use_condition_selectivity= @@optimizer_use_condition_selectivity; +set optimizer_use_condition_selectivity=3, use_stat_tables=preferably; +create table t1 (id int(10),cost decimal(9,2)) engine=innodb; +ANALYZE TABLE t1 PERSISTENT FOR ALL; +Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected +test.t1 analyze status OK +create temporary table t2 (id int); +insert into t2 (id) select id from t1 where cost > 0; +select * from t2; +id +set use_stat_tables=@save_use_stat_tables; +set optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity; +drop table t1,t2; diff --git a/mysql-test/t/statistics.test b/mysql-test/t/statistics.test index 2c8dec307cc..0ab42453125 100644 --- a/mysql-test/t/statistics.test +++ b/mysql-test/t/statistics.test @@ -717,3 +717,23 @@ select db_name, table_name, column_name, FROM mysql.column_stats; drop table t1; + +--echo # +--echo # MDEB-9744: session optimizer_use_condition_selectivity=5 causing SQL Error (1918): +--echo # Encountered illegal value '' when converting to DECIMAL +--echo # + +set @save_optimizer_use_condition_selectivity= @@optimizer_use_condition_selectivity; +set optimizer_use_condition_selectivity=3, use_stat_tables=preferably; + +create table t1 (id int(10),cost decimal(9,2)) engine=innodb; +ANALYZE TABLE t1 PERSISTENT FOR ALL; + +create temporary table t2 (id int); +insert into t2 (id) select id from t1 where cost > 0; +select * from t2; + +set use_stat_tables=@save_use_stat_tables; +set optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity; +drop table t1,t2; + diff --git a/sql/sql_statistics.cc b/sql/sql_statistics.cc index 70080a6b4f1..6c42efd6068 100644 --- a/sql/sql_statistics.cc +++ b/sql/sql_statistics.cc @@ -2944,18 +2944,19 @@ bool statistics_for_tables_is_needed(THD *thd, TABLE_LIST *tables) return FALSE; /* - Do not read statistics for any query over non-user tables. - If the query references some statistical tables, but not all - of them, reading the statistics may lead to a deadlock - */ + Do not read statistics for any query that explicity involves + statistical tables, failure to to do so we may end up + in a deadlock. + */ + for (TABLE_LIST *tl= tables; tl; tl= tl->next_global) { if (!tl->is_view_or_derived() && tl->table) { TABLE_SHARE *table_share= tl->table->s; if (table_share && - (table_share->table_category != TABLE_CATEGORY_USER || - table_share->tmp_table != NO_TMP_TABLE)) + table_share->table_category != TABLE_CATEGORY_USER + && is_stat_table(tl->db, tl->alias)) return FALSE; } } @@ -3634,6 +3635,15 @@ double get_column_range_cardinality(Field *field, if (!col_stats) return tab_records; + /* + Use statistics for a table only when we have actually read + the statistics from the stat tables. For example due to + chances of getting a deadlock we disable reading statistics for + a table. + */ + + if (!table->stats_is_read) + return tab_records; double col_nulls= tab_records * col_stats->get_nulls_ratio(); @@ -3840,3 +3850,20 @@ double Histogram::point_selectivity(double pos, double avg_sel) return sel; } +/* + Check whether the table is one of the persistent statistical tables. +*/ +bool is_stat_table(const char *db, const char *table) +{ + DBUG_ASSERT(db && table); + + if (!memcmp(db, stat_tables_db_name.str, stat_tables_db_name.length)) + { + for (uint i= 0; i < STATISTICS_TABLES; i ++) + { + if (!memcmp(table, stat_table_name[i].str, stat_table_name[i].length)) + return true; + } + } + return false; +} \ No newline at end of file diff --git a/sql/sql_statistics.h b/sql/sql_statistics.h index 8e5f8107849..20b2eb66449 100644 --- a/sql/sql_statistics.h +++ b/sql/sql_statistics.h @@ -107,6 +107,7 @@ double get_column_range_cardinality(Field *field, key_range *min_endp, key_range *max_endp, uint range_flag); +bool is_stat_table(const char *db, const char *table); class Histogram { -- cgit v1.2.1 From d970f805e62c864e08bb7bb7f13f39f3465ffca7 Mon Sep 17 00:00:00 2001 From: Daniele Sciascia Date: Thu, 14 Sep 2017 13:46:34 +0200 Subject: MW-405 Make sure wsrep is ready in wait_until_connected_again.inc wait_until_connected_again issues 'SHOW STATUS' query repeatedly until mysqld replies without errors. However, SHOW STATUS is treated specially by wsrep in that it is allowed to proceed even if wsrep is not yet in ready state. As a consequence, after returning from wait_until_connected_again, wsrep may not be ready yet and subsequent queries may fail with error "1047 WSREP has not yet prepared node for application use". To avoid those errors, the patch includes wait_wsrep_ready.inc at the end of the wait_until_connected_again. --- mysql-test/include/restart_mysqld.inc | 3 --- mysql-test/include/start_mysqld.inc | 3 --- mysql-test/include/wait_until_connected_again.inc | 8 +++++++- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/mysql-test/include/restart_mysqld.inc b/mysql-test/include/restart_mysqld.inc index a0447280ff5..940e081c431 100644 --- a/mysql-test/include/restart_mysqld.inc +++ b/mysql-test/include/restart_mysqld.inc @@ -50,9 +50,6 @@ if (!$restart_parameters) # Call script that will poll the server waiting for it to be back online again --source include/wait_until_connected_again.inc -# Wait for wsrep ---source include/wait_wsrep_ready.inc - # Turn off reconnect again --disable_reconnect diff --git a/mysql-test/include/start_mysqld.inc b/mysql-test/include/start_mysqld.inc index 04dff714d49..e31f26aad8c 100644 --- a/mysql-test/include/start_mysqld.inc +++ b/mysql-test/include/start_mysqld.inc @@ -16,9 +16,6 @@ if (!$restart_parameters) # Call script that will poll the server waiting for it to be back online again --source include/wait_until_connected_again.inc -# Wait for wsrep ---source include/wait_wsrep_ready.inc - # Turn off reconnect again --disable_reconnect diff --git a/mysql-test/include/wait_until_connected_again.inc b/mysql-test/include/wait_until_connected_again.inc index 6f64ef45440..265f110fe72 100644 --- a/mysql-test/include/wait_until_connected_again.inc +++ b/mysql-test/include/wait_until_connected_again.inc @@ -14,7 +14,7 @@ while ($mysql_errno) # Strangely enough, the server might return "Too many connections" # while being shutdown, thus 1040 is an "allowed" error # See BUG#36228 - --error 0,1040,1053,2002,2003,2005,2006,2013,1927 + --error 0,1040,1053,1205,2002,2003,2005,2006,2013,1927 show status; dec $counter; @@ -26,3 +26,9 @@ while ($mysql_errno) } --enable_query_log --enable_result_log + +# WSREP: SHOW STATUS queries are allowed even if wsrep +# is not ready. Make sure wsrep is ready before +# returning from this script + +--source include/wait_wsrep_ready.inc -- cgit v1.2.1 From fc26fd1c47f5a6b240c29332f1223c0791aa8152 Mon Sep 17 00:00:00 2001 From: Daniele Sciascia Date: Thu, 14 Sep 2017 11:48:50 +0200 Subject: MW-405 Remove redundant conditions Remove clause on `thd->variables.wsrep_on` in the following code: if (WSREP(thd)) { ... if (thd->variables.wsrep_on && ... In the above snippet, `WSREP(thd)` already ensures thd->variables.wsrep_on --- sql/sql_parse.cc | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 9271e231197..0c40c4852f6 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -1088,22 +1088,25 @@ bool do_command(THD *thd) command_name[command].str)); #ifdef WITH_WSREP - /* - Bail out if DB snapshot has not been installed. - */ - if (thd->variables.wsrep_on && !thd->wsrep_applier && + if (WSREP(thd)) + { + /* + Bail out if DB snapshot has not been installed. + */ + if (!thd->wsrep_applier && (!wsrep_ready || wsrep_reject_queries != WSREP_REJECT_NONE) && (server_command_flags[command] & CF_SKIP_WSREP_CHECK) == 0) - { - thd->protocol->end_statement(); + { + thd->protocol->end_statement(); - /* Performance Schema Interface instrumentation end. */ - MYSQL_END_STATEMENT(thd->m_statement_psi, thd->get_stmt_da()); - thd->m_statement_psi= NULL; - thd->m_digest= NULL; + /* Performance Schema Interface instrumentation end. */ + MYSQL_END_STATEMENT(thd->m_statement_psi, thd->get_stmt_da()); + thd->m_statement_psi= NULL; + thd->m_digest= NULL; - return_value= FALSE; - goto out; + return_value= FALSE; + goto out; + } } #endif @@ -2666,8 +2669,7 @@ mysql_execute_command(THD *thd) * allow SET and SHOW queries and reads from information schema * and dirty reads (if configured) */ - if (thd->variables.wsrep_on && - !thd->wsrep_applier && + if (!thd->wsrep_applier && !(wsrep_ready && wsrep_reject_queries == WSREP_REJECT_NONE) && !(thd->variables.wsrep_dirty_reads && (sql_command_flags[lex->sql_command] & CF_CHANGES_DATA) == 0) && -- cgit v1.2.1 From 54652161a235530e6df07a32df0aa02938ea5802 Mon Sep 17 00:00:00 2001 From: Daniele Sciascia Date: Thu, 14 Sep 2017 16:54:53 +0200 Subject: MW-405 Adjust galera_pc_weight to new wait_until_connected_again Test galera_3nodes.galera_pc_weight started to fail because it expects to use wait_until_connected_again while remaining in non-primary view. Hopefully this is the only test which makes this assumption, and fortunately those wait_until_connected_again seem unnecessary, so this patch removes them. --- mysql-test/suite/galera_3nodes/t/galera_pc_weight.test | 5 ----- 1 file changed, 5 deletions(-) diff --git a/mysql-test/suite/galera_3nodes/t/galera_pc_weight.test b/mysql-test/suite/galera_3nodes/t/galera_pc_weight.test index c118b7481bc..d69881aa5eb 100644 --- a/mysql-test/suite/galera_3nodes/t/galera_pc_weight.test +++ b/mysql-test/suite/galera_3nodes/t/galera_pc_weight.test @@ -9,16 +9,12 @@ --connection node_1 SET GLOBAL wsrep_provider_options = 'pc.weight=3'; - ---source include/wait_until_connected_again.inc --source include/galera_suspend.inc --sleep 10 --connection node_2 # Do not wait for causality as we are no longer in the primary component SET SESSION wsrep_sync_wait=0; ---source include/wait_until_connected_again.inc - SET SESSION wsrep_on=OFF; --let $wait_condition = SELECT VARIABLE_VALUE = 'non-Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status' --source include/wait_condition.inc @@ -39,7 +35,6 @@ SHOW STATUS LIKE 'wsrep_local_state_comment'; --source include/galera_connect.inc --connection node_3 SET SESSION wsrep_sync_wait=0; ---source include/wait_until_connected_again.inc SHOW STATUS LIKE 'wsrep_cluster_size'; SHOW STATUS LIKE 'wsrep_cluster_status'; -- cgit v1.2.1 From 992370693fef97023dde874a569d9c4e089fbeca Mon Sep 17 00:00:00 2001 From: Daniele Sciascia Date: Fri, 15 Sep 2017 16:56:36 +0200 Subject: MW-405 Remove wait_until_connected_again.inc from kill_galera.inc kill_galera.inc can no longer rely on wait_until_connected_again.inc. This is because wait_until_connected_again now tries to make sure that the server it is connected eventually transition to ready state. Whereas some tests may need to kill galera while the server is in a non-primary view. --- mysql-test/suite/galera/include/kill_galera.inc | 1 - 1 file changed, 1 deletion(-) diff --git a/mysql-test/suite/galera/include/kill_galera.inc b/mysql-test/suite/galera/include/kill_galera.inc index c61bad8e19d..d7f665df6c7 100644 --- a/mysql-test/suite/galera/include/kill_galera.inc +++ b/mysql-test/suite/galera/include/kill_galera.inc @@ -1,7 +1,6 @@ --echo Killing server ... # Write file to make mysql-test-run.pl expect the crash, but don't start it ---source include/wait_until_connected_again.inc --let $_server_id= `SELECT @@server_id` --let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.$_server_id.expect --exec echo "wait" > $_expect_file_name -- cgit v1.2.1 From 7ffa82b03c8da12062223d5e332e972d6f828d44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= Date: Thu, 22 Mar 2018 08:51:43 +0200 Subject: MDEV-14616: WSREP has not yet prepared node for application use error MariaDB adjustments. mysqltest.cc : Allow 12 error codes at --error wait_until_connected_again.inc: Replace numeric error codes with symbols mysqltest.test: Add error codes to test that tests too many errorcodes --- client/mysqltest.cc | 4 ++-- mysql-test/include/wait_until_connected_again.inc | 2 +- mysql-test/t/mysqltest.test | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/client/mysqltest.cc b/client/mysqltest.cc index 895c837f68b..77584e70afe 100644 --- a/client/mysqltest.cc +++ b/client/mysqltest.cc @@ -520,7 +520,7 @@ struct st_match_err struct st_expected_errors { - struct st_match_err err[10]; + struct st_match_err err[12]; uint count; }; static struct st_expected_errors saved_expected_errors; @@ -1462,7 +1462,7 @@ void free_used_memory() dynstr_free(&(*q)->content); my_free((*q)); } - for (i= 0; i < 10; i++) + for (i= 0; i < 12; i++) { if (var_reg[i].alloced_len) my_free(var_reg[i].str_val); diff --git a/mysql-test/include/wait_until_connected_again.inc b/mysql-test/include/wait_until_connected_again.inc index 265f110fe72..b13d07e94bb 100644 --- a/mysql-test/include/wait_until_connected_again.inc +++ b/mysql-test/include/wait_until_connected_again.inc @@ -14,7 +14,7 @@ while ($mysql_errno) # Strangely enough, the server might return "Too many connections" # while being shutdown, thus 1040 is an "allowed" error # See BUG#36228 - --error 0,1040,1053,1205,2002,2003,2005,2006,2013,1927 + --error 0,ER_CON_COUNT_ERROR,ER_SERVER_SHUTDOWN,ER_LOCK_WAIT_TIMEOUT,ER_CONNECTION_KILLED,2002,2003,2005,2006,2013 show status; dec $counter; diff --git a/mysql-test/t/mysqltest.test b/mysql-test/t/mysqltest.test index b2eb101a37c..60f41042d56 100644 --- a/mysql-test/t/mysqltest.test +++ b/mysql-test/t/mysqltest.test @@ -685,7 +685,7 @@ remove_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql; # Too many errorcodes specified --error 1 ---exec echo "--error 1,2,3,4,5,6,7,8,9,10,11" | $MYSQL_TEST 2>&1 +--exec echo "--error 1,2,3,4,5,6,7,8,9,10,11,12,13" | $MYSQL_TEST 2>&1 # ---------------------------------------------------------------------------- -- cgit v1.2.1 From 8ffbb825e6a09d3055f46ed4b456573aef5c474c Mon Sep 17 00:00:00 2001 From: Daniel Black Date: Tue, 27 Mar 2018 07:55:56 +1100 Subject: increase upper value of max_prepared_stmt_count to UINT32_MAX The upper 1M limit for max_prepared_stmt_count was set over 10 years ago. It doesn't suite current hardware and a sysbench oltp_read_write test with 512 threads will hit this limit. --- mysql-test/r/perror.result | 2 +- mysql-test/r/ps.result | 2 +- .../sys_vars/r/max_prepared_stmt_count_basic.result | 20 ++++++++++---------- .../sys_vars/t/max_prepared_stmt_count_basic.test | 4 ++-- sql/mysqld.cc | 4 ++-- sql/mysqld.h | 2 +- sql/share/errmsg-utf8.txt | 4 ++-- sql/sys_vars.cc | 4 ++-- 8 files changed, 21 insertions(+), 21 deletions(-) diff --git a/mysql-test/r/perror.result b/mysql-test/r/perror.result index 30a56840b1b..9e17addf704 100644 --- a/mysql-test/r/perror.result +++ b/mysql-test/r/perror.result @@ -3,4 +3,4 @@ MySQL error code 1062 (ER_DUP_ENTRY): Duplicate entry '%-.192s' for key %d MySQL error code 1408 (ER_STARTUP): %s: ready for connections. Version: '%s' socket: '%s' port: %d %s MySQL error code 1459 (ER_TABLE_NEEDS_UPGRADE): Table upgrade required. Please do "REPAIR TABLE `%-.32s`" or dump/reload to fix it! -MySQL error code 1461 (ER_MAX_PREPARED_STMT_COUNT_REACHED): Can't create more than max_prepared_stmt_count statements (current value: %lu) +MySQL error code 1461 (ER_MAX_PREPARED_STMT_COUNT_REACHED): Can't create more than max_prepared_stmt_count statements (current value: %u) diff --git a/mysql-test/r/ps.result b/mysql-test/r/ps.result index 0217af9ed61..d3fbc595f17 100644 --- a/mysql-test/r/ps.result +++ b/mysql-test/r/ps.result @@ -820,7 +820,7 @@ Warnings: Warning 1292 Truncated incorrect max_prepared_stmt_count value: '10000000000000000' select @@max_prepared_stmt_count; @@max_prepared_stmt_count -1048576 +4294967295 set global max_prepared_stmt_count=default; select @@max_prepared_stmt_count; @@max_prepared_stmt_count diff --git a/mysql-test/suite/sys_vars/r/max_prepared_stmt_count_basic.result b/mysql-test/suite/sys_vars/r/max_prepared_stmt_count_basic.result index 9419f251930..d3de7707f84 100644 --- a/mysql-test/suite/sys_vars/r/max_prepared_stmt_count_basic.result +++ b/mysql-test/suite/sys_vars/r/max_prepared_stmt_count_basic.result @@ -46,40 +46,40 @@ Warnings: Warning 1292 Truncated incorrect max_prepared_stmt_count value: '100000000000' SELECT @@global.max_prepared_stmt_count; @@global.max_prepared_stmt_count -1048576 +4294967295 SET @@global.max_prepared_stmt_count = 10000.01; ERROR 42000: Incorrect argument type to variable 'max_prepared_stmt_count' SELECT @@global.max_prepared_stmt_count; @@global.max_prepared_stmt_count -1048576 +4294967295 SET @@global.max_prepared_stmt_count = -1024; Warnings: Warning 1292 Truncated incorrect max_prepared_stmt_count value: '-1024' SELECT @@global.max_prepared_stmt_count; @@global.max_prepared_stmt_count 0 -SET @@global.max_prepared_stmt_count = 1048577; +SET @@global.max_prepared_stmt_count = 4294967296; Warnings: -Warning 1292 Truncated incorrect max_prepared_stmt_count value: '1048577' +Warning 1292 Truncated incorrect max_prepared_stmt_count value: '4294967296' SELECT @@global.max_prepared_stmt_count; @@global.max_prepared_stmt_count -1048576 -SET @@global.max_prepared_stmt_count = 104857612; +4294967295 +SET @@global.max_prepared_stmt_count = 4294967295*1024; Warnings: -Warning 1292 Truncated incorrect max_prepared_stmt_count value: '104857612' +Warning 1292 Truncated incorrect max_prepared_stmt_count value: '4398046510080' SELECT @@global.max_prepared_stmt_count; @@global.max_prepared_stmt_count -1048576 +4294967295 SET @@global.max_prepared_stmt_count = ON; ERROR 42000: Incorrect argument type to variable 'max_prepared_stmt_count' SELECT @@global.max_prepared_stmt_count; @@global.max_prepared_stmt_count -1048576 +4294967295 SET @@global.max_prepared_stmt_count = 'test'; ERROR 42000: Incorrect argument type to variable 'max_prepared_stmt_count' SELECT @@global.max_prepared_stmt_count; @@global.max_prepared_stmt_count -1048576 +4294967295 '#-------------------FN_DYNVARS_081_05----------------------------#' SET @@session.max_prepared_stmt_count = 4096; ERROR HY000: Variable 'max_prepared_stmt_count' is a GLOBAL variable and should be set with SET GLOBAL diff --git a/mysql-test/suite/sys_vars/t/max_prepared_stmt_count_basic.test b/mysql-test/suite/sys_vars/t/max_prepared_stmt_count_basic.test index 5bf5d9c8834..a97256d84a4 100644 --- a/mysql-test/suite/sys_vars/t/max_prepared_stmt_count_basic.test +++ b/mysql-test/suite/sys_vars/t/max_prepared_stmt_count_basic.test @@ -92,9 +92,9 @@ SET @@global.max_prepared_stmt_count = 10000.01; SELECT @@global.max_prepared_stmt_count; SET @@global.max_prepared_stmt_count = -1024; SELECT @@global.max_prepared_stmt_count; -SET @@global.max_prepared_stmt_count = 1048577; +SET @@global.max_prepared_stmt_count = 4294967296; SELECT @@global.max_prepared_stmt_count; -SET @@global.max_prepared_stmt_count = 104857612; +SET @@global.max_prepared_stmt_count = 4294967295*1024; SELECT @@global.max_prepared_stmt_count; --Error ER_WRONG_TYPE_FOR_VAR diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 435fb07279f..f9089ed9eb9 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -532,7 +532,7 @@ bool max_user_connections_checking=0; Limit of the total number of prepared statements in the server. Is necessary to protect the server against out-of-memory attacks. */ -ulong max_prepared_stmt_count; +uint max_prepared_stmt_count; /** Current total number of prepared statements in the server. This number is exact, and therefore may not be equal to the difference between @@ -543,7 +543,7 @@ ulong max_prepared_stmt_count; two different connections, this counts as two distinct prepared statements. */ -ulong prepared_stmt_count=0; +uint prepared_stmt_count=0; ulong thread_id=1L,current_pid; ulong slow_launch_threads = 0; uint sync_binlog_period= 0, sync_relaylog_period= 0, diff --git a/sql/mysqld.h b/sql/mysqld.h index 78e832e4abc..188ac0449c8 100644 --- a/sql/mysqld.h +++ b/sql/mysqld.h @@ -178,7 +178,7 @@ extern ulong slave_trans_retries; extern uint slave_net_timeout; extern int max_user_connections; extern ulong what_to_log,flush_time; -extern ulong max_prepared_stmt_count, prepared_stmt_count; +extern uint max_prepared_stmt_count, prepared_stmt_count; extern ulong open_files_limit; extern ulonglong binlog_cache_size, binlog_stmt_cache_size; extern ulonglong max_binlog_cache_size, max_binlog_stmt_cache_size; diff --git a/sql/share/errmsg-utf8.txt b/sql/share/errmsg-utf8.txt index 4958473c73d..19611758ee0 100644 --- a/sql/share/errmsg-utf8.txt +++ b/sql/share/errmsg-utf8.txt @@ -5577,8 +5577,8 @@ ER_SP_NO_AGGREGATE 42000 eng "AGGREGATE is not supported for stored functions" ger "AGGREGATE wird bei gespeicherten Funktionen nicht unterstützt" ER_MAX_PREPARED_STMT_COUNT_REACHED 42000 - eng "Can't create more than max_prepared_stmt_count statements (current value: %lu)" - ger "Kann nicht mehr Anweisungen als max_prepared_stmt_count erzeugen (aktueller Wert: %lu)" + eng "Can't create more than max_prepared_stmt_count statements (current value: %u)" + ger "Kann nicht mehr Anweisungen als max_prepared_stmt_count erzeugen (aktueller Wert: %u)" ER_VIEW_RECURSIVE eng "`%-.192s`.`%-.192s` contains view recursion" ger "`%-.192s`.`%-.192s` enthält View-Rekursion" diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc index 8d164ea86f5..edcfd712e3b 100644 --- a/sql/sys_vars.cc +++ b/sql/sys_vars.cc @@ -1932,11 +1932,11 @@ static Sys_var_ulong Sys_max_long_data_size( BLOCK_SIZE(1)); static PolyLock_mutex PLock_prepared_stmt_count(&LOCK_prepared_stmt_count); -static Sys_var_ulong Sys_max_prepared_stmt_count( +static Sys_var_uint Sys_max_prepared_stmt_count( "max_prepared_stmt_count", "Maximum number of prepared statements in the server", GLOBAL_VAR(max_prepared_stmt_count), CMD_LINE(REQUIRED_ARG), - VALID_RANGE(0, 1024*1024), DEFAULT(16382), BLOCK_SIZE(1), + VALID_RANGE(0, UINT_MAX32), DEFAULT(16382), BLOCK_SIZE(1), &PLock_prepared_stmt_count); static Sys_var_ulong Sys_max_sort_length( -- cgit v1.2.1 From 606e21867c0f5765f61efd2478c9f12cf33da71e Mon Sep 17 00:00:00 2001 From: Alexander Barkov Date: Tue, 3 Apr 2018 16:28:52 +0400 Subject: MDEV-15630 uuid() function evaluates at wrong time in query --- mysql-test/r/func_misc.result | 11 +++++++++++ mysql-test/t/func_misc.test | 12 ++++++++++++ sql/item_strfunc.h | 1 + 3 files changed, 24 insertions(+) diff --git a/mysql-test/r/func_misc.result b/mysql-test/r/func_misc.result index 1c106acf333..66e3cfd4ff4 100644 --- a/mysql-test/r/func_misc.result +++ b/mysql-test/r/func_misc.result @@ -572,6 +572,17 @@ N AVG 0 NULL drop table t1; # +# MDEV-15630 uuid() function evaluates at wrong time in query +# +CREATE TABLE t1 (id INT); +INSERT INTO t1 VALUES (1),(2),(3); +SELECT COUNT(1), UUID() as uid FROM t1 GROUP BY uid; +COUNT(1) uid +1 xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx +1 xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx +1 xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx +DROP TABLE t1; +# # End of 5.5 tests # SELECT NAME_CONST('a', -(1 OR 2)) OR 1; diff --git a/mysql-test/t/func_misc.test b/mysql-test/t/func_misc.test index d7eda5ee4e6..c21630c0c7b 100644 --- a/mysql-test/t/func_misc.test +++ b/mysql-test/t/func_misc.test @@ -596,6 +596,18 @@ AND 57813X540X1723 = 'Test'; drop table t1; + +--echo # +--echo # MDEV-15630 uuid() function evaluates at wrong time in query +--echo # + +CREATE TABLE t1 (id INT); +INSERT INTO t1 VALUES (1),(2),(3); +--replace_column 2 xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx +SELECT COUNT(1), UUID() as uid FROM t1 GROUP BY uid; +DROP TABLE t1; + + --echo # --echo # End of 5.5 tests --echo # diff --git a/sql/item_strfunc.h b/sql/item_strfunc.h index 00ae60a7fb1..006b1b90081 100644 --- a/sql/item_strfunc.h +++ b/sql/item_strfunc.h @@ -997,6 +997,7 @@ public: DERIVATION_COERCIBLE, MY_REPERTOIRE_ASCII); fix_char_length(MY_UUID_STRING_LENGTH); } + table_map used_tables() const { return RAND_TABLE_BIT; } const char *func_name() const{ return "uuid"; } String *val_str(String *); bool check_vcol_func_processor(uchar *int_arg) -- cgit v1.2.1 From df6197c8b93bd686cfc25e72890c28070b22f195 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Fri, 23 Feb 2018 18:50:12 +0100 Subject: compiler warning warning: format '%p' expects argument of type 'void *', but argument 4 has type 'long int' --- mysys/my_addr_resolve.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mysys/my_addr_resolve.c b/mysys/my_addr_resolve.c index f831ad5121f..02f71fd72bd 100644 --- a/mysys/my_addr_resolve.c +++ b/mysys/my_addr_resolve.c @@ -204,7 +204,7 @@ int my_addr_resolve(void *ptr, my_addr_loc *loc) strnmov(addr2line_binary, info.dli_fname, sizeof(addr2line_binary)); } offset = info.dli_fbase; - len= my_snprintf(input, sizeof(input), "%p\n", ptr - offset); + len= my_snprintf(input, sizeof(input), "%08x\n", (ulonglong)(ptr - offset)); if (write(in[1], input, len) <= 0) return 1; if (read(out[0], output, sizeof(output)) <= 0) -- cgit v1.2.1 From f5369faf5bbfb56b5e945836eb3f7c7ee88b4079 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Thu, 29 Mar 2018 15:25:08 +0200 Subject: don't disable SSL when connecting via libmysqld --- sql-common/client.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sql-common/client.c b/sql-common/client.c index 7d92f71d69f..fc591e21616 100644 --- a/sql-common/client.c +++ b/sql-common/client.c @@ -2532,10 +2532,10 @@ static int send_client_reply_packet(MCPVIO_EXT *mpvio, if (mysql->client_flag & CLIENT_MULTI_STATEMENTS) mysql->client_flag|= CLIENT_MULTI_RESULTS; -#if defined(HAVE_OPENSSL) && !defined(EMBEDDED_LIBRARY) +#ifdef HAVE_OPENSSL if (mysql->options.use_ssl) mysql->client_flag|= CLIENT_SSL; -#endif /* HAVE_OPENSSL && !EMBEDDED_LIBRARY*/ +#endif /* HAVE_OPENSSL */ if (mpvio->db) mysql->client_flag|= CLIENT_CONNECT_WITH_DB; -- cgit v1.2.1 From ed33296246091780439bdbcb087027d2a8bf8eeb Mon Sep 17 00:00:00 2001 From: Michael Gmelin Date: Fri, 19 Jan 2018 00:24:39 +0100 Subject: Fix LibreSSL X509 (SSL) certificate hostname checking. (Currently) LibreSSL doesn't calculate the string length of the hostname that's passed to X509_check_host automatically in case namelen/chklen is 0. This causes server certificate validation to fail when building MariaDB with LibreSSL. The proposed fix makes MariaDB determine the string length passed to X509_check_host. As there are no ill side-effects (OpenSSL's X509_check_host also simply calls strlen if namelen == 0, see also X509_check_host(3)), this wasn't wrapped in any #ifdef like constructs. Please see here for a proposed patch to modify LibreSSL's behavior: https://github.com/libressl-portable/openbsd/pull/87 --- sql-common/client.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sql-common/client.c b/sql-common/client.c index da18a0fdea1..e2d4a0949df 100644 --- a/sql-common/client.c +++ b/sql-common/client.c @@ -1821,7 +1821,8 @@ static int ssl_verify_server_cert(Vio *vio, const char* server_hostname, const c */ #ifdef HAVE_X509_check_host - ret_validation= X509_check_host(server_cert, server_hostname, 0, 0, 0) != 1; + ret_validation= X509_check_host(server_cert, server_hostname, + strlen(server_hostname), 0, 0) != 1; #else subject= X509_get_subject_name(server_cert); cn_loc= X509_NAME_get_index_by_NID(subject, NID_commonName, -1); -- cgit v1.2.1 From eeb684221dd4e473d3aa1c95ba75cd54b76bbcd3 Mon Sep 17 00:00:00 2001 From: Daniele Sciascia Date: Tue, 3 Apr 2018 16:30:58 +0200 Subject: MDEV-13549 Fix and re-enable MTR test galera.galera_gra_log Test galera checks that a `GRA_x_x.log` file is created whenever wsrep applier fails to apply some replication event. The file contains the corresponding binlog event that failed to apply. The test creates a new file by concatenating a pre-recorded file containing the binlog header (see `std-data/binlog-header.log`) and the `GRA_x_x.log` file. The test then checks that the resulting file, containing the binlog header and the event that failed to apply, is correctly read by `mysqlbinlog` program. The test fails in MariaDB because the GRA_x_x.log file created by MariaDB already contains the binlog header (see MDEV-7867). This patch fixes/simplifies test `galera.galera_gra_log` so that it doesn't concatenate `std-data/binlog-header.log` with the `GRA_x_x.log` file. File `std-data/binlog-header.log` is deleted altoghether, because not used by any other test. --- mysql-test/std_data/binlog-header.log | Bin 120 -> 0 bytes mysql-test/suite/galera/disabled.def | 1 - mysql-test/suite/galera/r/galera_gra_log.result | 13 ++----------- mysql-test/suite/galera/t/galera_gra_log.test | 13 +++---------- 4 files changed, 5 insertions(+), 22 deletions(-) delete mode 100644 mysql-test/std_data/binlog-header.log diff --git a/mysql-test/std_data/binlog-header.log b/mysql-test/std_data/binlog-header.log deleted file mode 100644 index c415a57e616..00000000000 Binary files a/mysql-test/std_data/binlog-header.log and /dev/null differ diff --git a/mysql-test/suite/galera/disabled.def b/mysql-test/suite/galera/disabled.def index 38fdc50f14d..9d4e90c19e9 100644 --- a/mysql-test/suite/galera/disabled.def +++ b/mysql-test/suite/galera/disabled.def @@ -9,7 +9,6 @@ # Do not use any TAB characters for whitespace. # ############################################################################## -galera_gra_log : MDEV-13549 Galera test failures galera_flush : MDEV-13549 Galera test failures galera_account_management : MariaDB 10.0 does not support ALTER USER galera_binlog_row_image : MariaDB 10.0 does not support binlog_row_image diff --git a/mysql-test/suite/galera/r/galera_gra_log.result b/mysql-test/suite/galera/r/galera_gra_log.result index 9f5cbdd75fc..6b816d0127f 100644 --- a/mysql-test/suite/galera/r/galera_gra_log.result +++ b/mysql-test/suite/galera/r/galera_gra_log.result @@ -8,22 +8,13 @@ COUNT(*) = 0 /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; -# at 4 - server id 2 end_log_pos 120 Start: binlog v 4, server v 5.6.24-debug-log created 150804 11:37:14 at startup -# Warning: this binlog is either in use or was not closed properly. ROLLBACK/*!*/; -BINLOG ' -unnAVQ8CAAAAdAAAAHgAAAABAAQANS42LjI0LWRlYnVnLWxvZwAAAAAAAAAAAAAAAAAAAAAAAAAA -AAAAAAAAAAAAAAAAAAC6ecBVEzgNAAgAEgAEBAQEEgAAXAAEGggAAAAICAgCAAAACgoKGRkAAKNu -Jfk= -'/*!*/; -# at 120 - server id 1 end_log_pos 91 Query thread_id= exec_time=0 error_code=0 +ROLLBACK/*!*/; use `test`/*!*/; SET TIMESTAMP=/*!*/; SET @@session.pseudo_thread_id=/*!*/; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/; -SET @@session.sql_mode=1073741824/*!*/; +SET @@session.sql_mode=1342177280/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; diff --git a/mysql-test/suite/galera/t/galera_gra_log.test b/mysql-test/suite/galera/t/galera_gra_log.test index 5329dc24546..adb37de9188 100644 --- a/mysql-test/suite/galera/t/galera_gra_log.test +++ b/mysql-test/suite/galera/t/galera_gra_log.test @@ -19,17 +19,10 @@ CREATE TABLE t1 (f1 INTEGER); --connection node_2 SELECT COUNT(*) = 0 FROM t1; -# Compose a valid binlog from a header file and the GRA file +# Make sure the GRA file produced is readable and contains the failure ---let $gra_binlog_file = $MYSQLTEST_VARDIR/tmp/gra.log ---exec rm -rf $gra_binlog_file - ---exec cp std_data/binlog-header.log $gra_binlog_file ---exec cat $MYSQLTEST_VARDIR/mysqld.2/data/GRA_*.log >> $gra_binlog_file - -# Make sure the binlog thus produced is readable and contains the failure ---replace_regex /SET TIMESTAMP=[0-9]+/SET TIMESTAMP=/ /#[0-9]+ +[0-9]+:[0-9]+:[0-9]+// /pseudo_thread_id=[0-9]+/pseudo_thread_id=/ /thread_id=[0-9]+/thread_id=/ ---exec $MYSQL_BINLOG $gra_binlog_file +--replace_regex /SET TIMESTAMP=[0-9]+/SET TIMESTAMP=/ /pseudo_thread_id=[0-9]+/pseudo_thread_id=/ +--exec $MYSQL_BINLOG --short-form $MYSQLTEST_VARDIR/mysqld.2/data/GRA_*.log SET SESSION wsrep_on=ON; -- cgit v1.2.1 From 87d763015af09c79b97745a538e25fb9b1730b04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= Date: Thu, 5 Apr 2018 10:31:42 +0300 Subject: MDEV-13549: Galera test failures Fix test failure on galera_toi_dll_fk_insert. DEFAULT value seems to be 3 but test expects it to be 1. --- mysql-test/suite/galera/disabled.def | 7 +++---- mysql-test/suite/galera/r/galera_toi_ddl_fk_insert.result | 2 +- mysql-test/suite/galera/t/galera_toi_ddl_fk_insert.test | 2 +- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/mysql-test/suite/galera/disabled.def b/mysql-test/suite/galera/disabled.def index 0b41f52abe4..5817776d5d9 100644 --- a/mysql-test/suite/galera/disabled.def +++ b/mysql-test/suite/galera/disabled.def @@ -9,12 +9,12 @@ # Do not use any TAB characters for whitespace. # ############################################################################## -galera_flush : MDEV-13549 Galera test failures + +galera_flush : MariaDB does not have global.thread_statistics galera_account_management : MariaDB 10.0 does not support ALTER USER -galera_binlog_row_image : MariaDB 10.0 does not support binlog_row_image galera_binlog_rows_query_log_events: MariaDB does not support binlog_rows_query_log_events +galera_migrate : MariaDB does not support START SLAVE USER GAL-419 : MDEV-13549 Galera test failures -galera_toi_ddl_fk_insert : MDEV-13549 Galera test failures galera_var_notify_cmd : MDEV-13549 Galera test failures galera_as_master_gtid : Requires MySQL GTID galera_as_master_gtid_change_master : Requires MySQL GTID @@ -26,7 +26,6 @@ galera_gcache_recover_full_gcache : MDEV-13549 Galera test failures galera_gcache_recover_manytrx : MDEV-13549 Galera test failures galera_ist_mysqldump : MDEV-13549 Galera test failures mysql-wsrep#31 : MDEV-13549 Galera test failures -galera_migrate : MariaDB 10.0 does not support START SLAVE USER galera_wsrep_desync_wsrep_on : MDEV-13549 Galera test failures galera_ssl_upgrade : MDEV-13549 Galera test failures mysql-wsrep#33 : MDEV-13549 Galera test failures diff --git a/mysql-test/suite/galera/r/galera_toi_ddl_fk_insert.result b/mysql-test/suite/galera/r/galera_toi_ddl_fk_insert.result index 81781fbeae7..1726bb6445f 100644 --- a/mysql-test/suite/galera/r/galera_toi_ddl_fk_insert.result +++ b/mysql-test/suite/galera/r/galera_toi_ddl_fk_insert.result @@ -9,7 +9,7 @@ CREATE TABLE child ( id INT PRIMARY KEY AUTO_INCREMENT, parent_id INT ) ENGINE=InnoDB; -INSERT INTO parent VALUES (DEFAULT, 0); +INSERT INTO parent VALUES (1, 0); INSERT INTO child (parent_id) SELECT 1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4;; INSERT INTO parent (f2) SELECT 1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4;; INSERT INTO parent (f2) SELECT 2 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4;; diff --git a/mysql-test/suite/galera/t/galera_toi_ddl_fk_insert.test b/mysql-test/suite/galera/t/galera_toi_ddl_fk_insert.test index 1f446938775..9f161afc52e 100644 --- a/mysql-test/suite/galera/t/galera_toi_ddl_fk_insert.test +++ b/mysql-test/suite/galera/t/galera_toi_ddl_fk_insert.test @@ -20,7 +20,7 @@ CREATE TABLE child ( parent_id INT ) ENGINE=InnoDB; -INSERT INTO parent VALUES (DEFAULT, 0); +INSERT INTO parent VALUES (1, 0); --connection node_2 --send INSERT INTO child (parent_id) SELECT 1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4; -- cgit v1.2.1 From 890115578007af9da9907c87d53f639166d564e7 Mon Sep 17 00:00:00 2001 From: Ian Gilfillan Date: Wed, 4 Apr 2018 23:35:47 +0200 Subject: Update contributors --- CREDITS | 3 +-- mysql-test/r/contributors.result | 3 +-- sql/contributors.h | 3 +-- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/CREDITS b/CREDITS index 7572f6f5dd9..1788b6304fe 100644 --- a/CREDITS +++ b/CREDITS @@ -5,15 +5,14 @@ The current main sponsors of the MariaDB Foundation are: Alibaba Cloud https://www.alibabacloud.com/ (2017) Booking.com https://www.booking.com (2013) +MariaDB Corporation https://www.mariadb.com (2013) Microsoft https://microsoft.com/ (2017) Tencent Cloud https://cloud.tencent.com (2017) Development Bank of Singapore https://dbs.com (2016) IBM https://www.ibm.com (2017) -MariaDB Corporation https://www.mariadb.com (2013) Visma https://visma.com (2015) Acronis http://acronis.com (2016) Nexedi https://www.nexedi.com (2016) -Automattic https://automattic.com (2014) Tencent Game DBA http://tencentdba.com/about (2016) Tencent TDSQL http://tdsql.org (2016) Verkkokauppa.com https://www.verkkokauppa.com (2015) diff --git a/mysql-test/r/contributors.result b/mysql-test/r/contributors.result index 927c0bcccbf..36d033f4cb3 100644 --- a/mysql-test/r/contributors.result +++ b/mysql-test/r/contributors.result @@ -4,13 +4,12 @@ Booking.com https://www.booking.com Founding member, Platinum Sponsor of the Mar Alibaba Cloud https://www.alibabacloud.com/ Platinum Sponsor of the MariaDB Foundation Tencent Cloud https://cloud.tencent.com Platinum Sponsor of the MariaDB Foundation Microsoft https://microsoft.com/ Platinum Sponsor of the MariaDB Foundation -MariaDB Corporation https://mariadb.com Founding member, Gold Sponsor of the MariaDB Foundation +MariaDB Corporation https://mariadb.com Founding member, Platinum 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 IBM https://www.ibm.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://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 diff --git a/sql/contributors.h b/sql/contributors.h index 7369dcd141d..a0d05af3fa6 100644 --- a/sql/contributors.h +++ b/sql/contributors.h @@ -41,13 +41,12 @@ struct show_table_contributors_st show_table_contributors[]= { {"Alibaba Cloud", "https://www.alibabacloud.com/", "Platinum Sponsor of the MariaDB Foundation"}, {"Tencent Cloud", "https://cloud.tencent.com", "Platinum Sponsor of the MariaDB Foundation"}, {"Microsoft", "https://microsoft.com/", "Platinum Sponsor of the MariaDB Foundation"}, - {"MariaDB Corporation", "https://mariadb.com", "Founding member, Gold Sponsor of the MariaDB Foundation"}, + {"MariaDB Corporation", "https://mariadb.com", "Founding member, Platinum 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"}, {"IBM", "https://www.ibm.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://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"}, -- cgit v1.2.1 From 45eca6178eb92c88e7c8901c6a03390a7cf8442a Mon Sep 17 00:00:00 2001 From: Daniele Sciascia Date: Tue, 27 Mar 2018 14:29:43 +0200 Subject: MDEV-13549 Fix and re-enable MTR test galera.MW-284 The following changes are committed: * `RESET MASTER` at the end of the test. This was necessary to allow the test to run on repeated runs. * `--source include/galera_wait_ready.inc` after setting `gmcast.isolate=0` to get back to a primary component. * Fix for assertion in `Protocol::end_statement()`. The assertion is due to the fact that function `do_command()` calls `thd->protocol->end_statement()`, without setting an error, when it is detected that galera is not ready yet. Following line somehow disappeared in a past merge: ``` my_message(ER_UNKNOWN_COM_ERROR, "WSREP has not yet prepared node for application use", MYF(0)); ``` --- mysql-test/suite/galera/disabled.def | 1 - mysql-test/suite/galera/r/MW-284.result | 3 +++ mysql-test/suite/galera/t/MW-284.test | 9 ++++++++- sql/sql_parse.cc | 6 ++++-- 4 files changed, 15 insertions(+), 4 deletions(-) diff --git a/mysql-test/suite/galera/disabled.def b/mysql-test/suite/galera/disabled.def index 5817776d5d9..76e6d588be3 100644 --- a/mysql-test/suite/galera/disabled.def +++ b/mysql-test/suite/galera/disabled.def @@ -40,7 +40,6 @@ galera_parallel_simple : MDEV-13549 Galera test failures galera_admin : MDEV-13549 Galera test failures galera_pc_ignore_sb : MDEV-13549 Galera test failures 10.1 galera_lock_table : MDEV-13549 Galera test failures 10.1 -MW-284 : MDEV-13549 Galera test failures 10.1 galera_gtid : MDEV-13549 Galera test failures 10.1 galera_unicode_identifiers : MDEV-13549 Galera test failures 10.1 galera.galera_gcs_fc_limit : MDEV-13549 Galera test failures 10.1 diff --git a/mysql-test/suite/galera/r/MW-284.result b/mysql-test/suite/galera/r/MW-284.result index 9d1c3e5660d..c9c0069889b 100644 --- a/mysql-test/suite/galera/r/MW-284.result +++ b/mysql-test/suite/galera/r/MW-284.result @@ -14,3 +14,6 @@ STOP SLAVE; RESET SLAVE ALL; CALL mtr.add_suppression('failed registering on master'); CALL mtr.add_suppression('You need to use --log-bin to make --binlog-format work'); +RESET MASTER; +CALL mtr.add_suppression('WSREP: Last Applied Action message in non-primary configuration from member'); +CALL mtr.add_suppression('WSREP: Last Applied Action message in non-primary configuration from member'); diff --git a/mysql-test/suite/galera/t/MW-284.test b/mysql-test/suite/galera/t/MW-284.test index 7add82f1227..5e17baa1bdb 100644 --- a/mysql-test/suite/galera/t/MW-284.test +++ b/mysql-test/suite/galera/t/MW-284.test @@ -24,7 +24,6 @@ SET global wsrep_sync_wait=0; --connection node_3 START SLAVE; ---sleep 1 --let $slave_param= Slave_IO_Running --let $slave_param_value= Connecting --source include/wait_for_slave_param.inc @@ -38,6 +37,7 @@ SET GLOBAL wsrep_provider_options='gmcast.isolate=0'; --source include/wait_for_slave_to_start.inc --connection node_1 +--source include/galera_wait_ready.inc INSERT INTO t1 VALUES (1); --connection node_3 @@ -61,3 +61,10 @@ RESET SLAVE ALL; CALL mtr.add_suppression('failed registering on master'); CALL mtr.add_suppression('You need to use --log-bin to make --binlog-format work'); + +--connection node_1 +RESET MASTER; +CALL mtr.add_suppression('WSREP: Last Applied Action message in non-primary configuration from member'); + +--connection node_2 +CALL mtr.add_suppression('WSREP: Last Applied Action message in non-primary configuration from member'); \ No newline at end of file diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 0c40c4852f6..cb432eb7ccd 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -1094,9 +1094,11 @@ bool do_command(THD *thd) Bail out if DB snapshot has not been installed. */ if (!thd->wsrep_applier && - (!wsrep_ready || wsrep_reject_queries != WSREP_REJECT_NONE) && - (server_command_flags[command] & CF_SKIP_WSREP_CHECK) == 0) + (!wsrep_ready || wsrep_reject_queries != WSREP_REJECT_NONE) && + (server_command_flags[command] & CF_SKIP_WSREP_CHECK) == 0) { + my_message(ER_UNKNOWN_COM_ERROR, + "WSREP has not yet prepared node for application use", MYF(0)); thd->protocol->end_statement(); /* Performance Schema Interface instrumentation end. */ -- cgit v1.2.1 From a41bd33d3b3c9c724312a4068cd94e123d514c1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= Date: Thu, 5 Apr 2018 12:23:53 +0300 Subject: MDEV-13549: Galera test failures Fix test failure on galera_gcs_fragment. Test requires Galera debug library with debug_sync functionality. --- mysql-test/suite/galera/disabled.def | 8 +++----- mysql-test/suite/galera/t/galera_gcs_fragment.test | 1 + 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/mysql-test/suite/galera/disabled.def b/mysql-test/suite/galera/disabled.def index 76e6d588be3..d5c03c28df4 100644 --- a/mysql-test/suite/galera/disabled.def +++ b/mysql-test/suite/galera/disabled.def @@ -14,18 +14,16 @@ galera_flush : MariaDB does not have global.thread_statistics galera_account_management : MariaDB 10.0 does not support ALTER USER galera_binlog_rows_query_log_events: MariaDB does not support binlog_rows_query_log_events galera_migrate : MariaDB does not support START SLAVE USER -GAL-419 : MDEV-13549 Galera test failures -galera_var_notify_cmd : MDEV-13549 Galera test failures galera_as_master_gtid : Requires MySQL GTID galera_as_master_gtid_change_master : Requires MySQL GTID -galera_as_slave_replication_bundle : MDEV-13549 Galera test failures galera_as_slave_preordered : wsrep-preordered feature not merged to MariaDB -galera_gcs_fragment : MDEV-13549 Galera test failures +GAL-419 : MDEV-13549 Galera test failures +galera_var_notify_cmd : MDEV-13549 Galera test failures +galera_as_slave_replication_bundle : MDEV-13549 Galera test failures galera_gcache_recover : MDEV-13549 Galera test failures galera_gcache_recover_full_gcache : MDEV-13549 Galera test failures galera_gcache_recover_manytrx : MDEV-13549 Galera test failures galera_ist_mysqldump : MDEV-13549 Galera test failures -mysql-wsrep#31 : MDEV-13549 Galera test failures galera_wsrep_desync_wsrep_on : MDEV-13549 Galera test failures galera_ssl_upgrade : MDEV-13549 Galera test failures mysql-wsrep#33 : MDEV-13549 Galera test failures diff --git a/mysql-test/suite/galera/t/galera_gcs_fragment.test b/mysql-test/suite/galera/t/galera_gcs_fragment.test index ae1e0d8bab0..0436e312f6e 100644 --- a/mysql-test/suite/galera/t/galera_gcs_fragment.test +++ b/mysql-test/suite/galera/t/galera_gcs_fragment.test @@ -1,6 +1,7 @@ # Test fragmentation over configuration changes --source include/galera_cluster.inc --source include/have_innodb.inc +--source suite/galera/include/galera_have_debug_sync.inc # Prepare table CREATE TABLE t1 (f1 INT PRIMARY KEY, f2 TEXT); -- cgit v1.2.1 From b1bf571e3df56c6f710420176b996df1ed47604a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= Date: Thu, 5 Apr 2018 12:40:11 +0300 Subject: MDEV-13549: Galera test failures galera_wsrep_desync_wsrep_on test does work on 10.1 --- mysql-test/suite/galera/disabled.def | 1 - 1 file changed, 1 deletion(-) diff --git a/mysql-test/suite/galera/disabled.def b/mysql-test/suite/galera/disabled.def index d5c03c28df4..93d1f79960a 100644 --- a/mysql-test/suite/galera/disabled.def +++ b/mysql-test/suite/galera/disabled.def @@ -24,7 +24,6 @@ galera_gcache_recover : MDEV-13549 Galera test failures galera_gcache_recover_full_gcache : MDEV-13549 Galera test failures galera_gcache_recover_manytrx : MDEV-13549 Galera test failures galera_ist_mysqldump : MDEV-13549 Galera test failures -galera_wsrep_desync_wsrep_on : MDEV-13549 Galera test failures galera_ssl_upgrade : MDEV-13549 Galera test failures mysql-wsrep#33 : MDEV-13549 Galera test failures galera_var_auto_inc_control_on : MDEV-13549 Galera test failures -- cgit v1.2.1 From 33b103b4ca64abd5ba6e955dc10541090469424d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= Date: Thu, 5 Apr 2018 13:30:41 +0300 Subject: MDEV-13549: Galera test failures Test did not reset modified variables correctly. --- mysql-test/suite/galera/disabled.def | 1 - mysql-test/suite/galera/r/mysql-wsrep#33.result | 5 +++-- mysql-test/suite/galera/t/mysql-wsrep#33.test | 10 ++++++---- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/mysql-test/suite/galera/disabled.def b/mysql-test/suite/galera/disabled.def index 93d1f79960a..c23b51de098 100644 --- a/mysql-test/suite/galera/disabled.def +++ b/mysql-test/suite/galera/disabled.def @@ -25,7 +25,6 @@ galera_gcache_recover_full_gcache : MDEV-13549 Galera test failures galera_gcache_recover_manytrx : MDEV-13549 Galera test failures galera_ist_mysqldump : MDEV-13549 Galera test failures galera_ssl_upgrade : MDEV-13549 Galera test failures -mysql-wsrep#33 : MDEV-13549 Galera test failures galera_var_auto_inc_control_on : MDEV-13549 Galera test failures MW-44 : MDEV-13549 Galera test failures galera_var_retry_autocommit : MDEV-13549 Galera test failures diff --git a/mysql-test/suite/galera/r/mysql-wsrep#33.result b/mysql-test/suite/galera/r/mysql-wsrep#33.result index fc647a2000d..3e8cfdb42d3 100644 --- a/mysql-test/suite/galera/r/mysql-wsrep#33.result +++ b/mysql-test/suite/galera/r/mysql-wsrep#33.result @@ -1,4 +1,6 @@ Setting SST method to mysqldump ... +call mtr.add_suppression("WSREP: wsrep_sst_method is set to 'mysqldump' yet mysqld bind_address is set to '127.0.0.1'"); +call mtr.add_suppression("Failed to load slave replication state from table mysql.gtid_slave_pos"); CREATE USER 'sst'; GRANT ALL PRIVILEGES ON *.* TO 'sst'; SET GLOBAL wsrep_sst_auth = 'sst:'; @@ -100,5 +102,4 @@ CALL mtr.add_suppression("Can't open and lock time zone table"); CALL mtr.add_suppression("Can't open and lock privilege tables"); CALL mtr.add_suppression("Info table is not ready to be used"); CALL mtr.add_suppression("Native table .* has the wrong structure"); -SET GLOBAL general_log = ON; -SET GLOBAL slow_query_log = ON; +Restarting server ... diff --git a/mysql-test/suite/galera/t/mysql-wsrep#33.test b/mysql-test/suite/galera/t/mysql-wsrep#33.test index acc7c735849..351e457f165 100644 --- a/mysql-test/suite/galera/t/mysql-wsrep#33.test +++ b/mysql-test/suite/galera/t/mysql-wsrep#33.test @@ -3,6 +3,9 @@ --source include/galera_cluster.inc --source include/have_innodb.inc +--let $node_1=node_1 +--let $node_2=node_2 +--source suite/galera/include/auto_increment_offset_save.inc --source suite/galera/include/galera_sst_set_mysqldump.inc --source suite/galera/include/galera_st_disconnect_slave.inc @@ -10,9 +13,8 @@ --source suite/galera/include/galera_sst_restore.inc --connection node_2 -# We have to manually restore global_log and slow_query_log due to mysql-wsrep#108 -# Otherwise MTR's check_testcases complains -SET GLOBAL general_log = ON; -SET GLOBAL slow_query_log = ON; +--echo Restarting server ... +--source include/restart_mysqld.inc +--source suite/galera/include/auto_increment_offset_restore.inc -- cgit v1.2.1 From 6449f0559bbefc45571c0f9a63938ca66da481e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= Date: Thu, 5 Apr 2018 14:18:57 +0300 Subject: MDEV-13549: Galera test failures Fix test case MW-44 by disabling Galera replication of MyISAM tables (mysql.general_log especially) to avoid MDL lock wait later. --- mysql-test/suite/galera/disabled.def | 1 - mysql-test/suite/galera/r/MW-44.result | 11 +++++++++++ mysql-test/suite/galera/t/MW-44.test | 5 +++++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/mysql-test/suite/galera/disabled.def b/mysql-test/suite/galera/disabled.def index c23b51de098..a0bc777074d 100644 --- a/mysql-test/suite/galera/disabled.def +++ b/mysql-test/suite/galera/disabled.def @@ -26,7 +26,6 @@ galera_gcache_recover_manytrx : MDEV-13549 Galera test failures galera_ist_mysqldump : MDEV-13549 Galera test failures galera_ssl_upgrade : MDEV-13549 Galera test failures galera_var_auto_inc_control_on : MDEV-13549 Galera test failures -MW-44 : MDEV-13549 Galera test failures galera_var_retry_autocommit : MDEV-13549 Galera test failures pxc-421 : MDEV-13549 Galera test failures lp1376747-2 : MDEV-13549 Galera test failures diff --git a/mysql-test/suite/galera/r/MW-44.result b/mysql-test/suite/galera/r/MW-44.result index 28a6f1ac8dd..03de2205772 100644 --- a/mysql-test/suite/galera/r/MW-44.result +++ b/mysql-test/suite/galera/r/MW-44.result @@ -1,5 +1,15 @@ +SET @@global.wsrep_replicate_myisam=OFF; TRUNCATE TABLE mysql.general_log; +SELECT COUNT(*) from mysql.general_log; +COUNT(*) +1 TRUNCATE TABLE mysql.general_log; +SELECT COUNT(*) from mysql.general_log; +COUNT(*) +1 +SELECT COUNT(*) from mysql.general_log; +COUNT(*) +1 SET SESSION wsrep_osu_method=TOI; CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB; SET SESSION wsrep_osu_method=RSU; @@ -12,3 +22,4 @@ SELECT COUNT(*) = 0 FROM mysql.general_log WHERE argument NOT LIKE 'SELECT%'; COUNT(*) = 0 1 DROP TABLE t1; +SET @@global.wsrep_replicate_myisam=Default; diff --git a/mysql-test/suite/galera/t/MW-44.test b/mysql-test/suite/galera/t/MW-44.test index 55a3fd57f80..b0e58e2bafd 100644 --- a/mysql-test/suite/galera/t/MW-44.test +++ b/mysql-test/suite/galera/t/MW-44.test @@ -5,13 +5,17 @@ --source include/galera_cluster.inc --source include/have_innodb.inc +SET @@global.wsrep_replicate_myisam=OFF; --connection node_1 TRUNCATE TABLE mysql.general_log; +SELECT COUNT(*) from mysql.general_log; --connection node_2 TRUNCATE TABLE mysql.general_log; +SELECT COUNT(*) from mysql.general_log; --connection node_1 +SELECT COUNT(*) from mysql.general_log; SET SESSION wsrep_osu_method=TOI; CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB; SET SESSION wsrep_osu_method=RSU; @@ -23,3 +27,4 @@ SELECT COUNT(*) = 2 FROM mysql.general_log WHERE argument LIKE 'CREATE%' OR argu --connection node_2 SELECT COUNT(*) = 0 FROM mysql.general_log WHERE argument NOT LIKE 'SELECT%'; DROP TABLE t1; +SET @@global.wsrep_replicate_myisam=Default; -- cgit v1.2.1 From afbd45a791a4a8cde19e0b3d5b883f79a2ccc305 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= Date: Thu, 5 Apr 2018 15:23:13 +0300 Subject: MDEV-13549: Galera test failures Enable tests that pass on 10.1: galera_var_auto_inc_control_on galera_var_retry_autocommit pxc-421 lp1376747-2 lp1376747 galera_toi_ddl_nonconflicting galera_parallel_simple galera_admin galera_pc_ignore_sb galera_lock_table galera_unicode_identifiers galera.galera_gcs_fc_limit galera.galera_gtid --- mysql-test/suite/galera/disabled.def | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/mysql-test/suite/galera/disabled.def b/mysql-test/suite/galera/disabled.def index a0bc777074d..96cafe25fba 100644 --- a/mysql-test/suite/galera/disabled.def +++ b/mysql-test/suite/galera/disabled.def @@ -25,18 +25,5 @@ galera_gcache_recover_full_gcache : MDEV-13549 Galera test failures galera_gcache_recover_manytrx : MDEV-13549 Galera test failures galera_ist_mysqldump : MDEV-13549 Galera test failures galera_ssl_upgrade : MDEV-13549 Galera test failures -galera_var_auto_inc_control_on : MDEV-13549 Galera test failures -galera_var_retry_autocommit : MDEV-13549 Galera test failures -pxc-421 : MDEV-13549 Galera test failures -lp1376747-2 : MDEV-13549 Galera test failures -lp1376747 : MDEV-13549 Galera test failures -galera_toi_ddl_nonconflicting : MDEV-13549 Galera test failures -galera_parallel_simple : MDEV-13549 Galera test failures -galera_admin : MDEV-13549 Galera test failures -galera_pc_ignore_sb : MDEV-13549 Galera test failures 10.1 -galera_lock_table : MDEV-13549 Galera test failures 10.1 -galera_gtid : MDEV-13549 Galera test failures 10.1 -galera_unicode_identifiers : MDEV-13549 Galera test failures 10.1 -galera.galera_gcs_fc_limit : MDEV-13549 Galera test failures 10.1 galera.MW-329 : wsrep_local_replays not stable galera.MW-328A : have_deadlocks test not stable -- cgit v1.2.1 From 3a6283cb3cc0d17a028cd962e308a6094e29516c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= Date: Fri, 6 Apr 2018 08:48:11 +0300 Subject: Fix out of array access. --- client/mysqltest.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/mysqltest.cc b/client/mysqltest.cc index 77584e70afe..734b263df66 100644 --- a/client/mysqltest.cc +++ b/client/mysqltest.cc @@ -1462,7 +1462,7 @@ void free_used_memory() dynstr_free(&(*q)->content); my_free((*q)); } - for (i= 0; i < 12; i++) + for (i= 0; i < 10; i++) { if (var_reg[i].alloced_len) my_free(var_reg[i].str_val); -- cgit v1.2.1 From 76ec37f5225eda9f8a23760091bfb60287927715 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Thu, 5 Apr 2018 18:15:10 +0300 Subject: MDEV-14705: Do not rollback on InnoDB shutdown row_undo_step(): If fast shutdown has been requested, abort the rollback of any non-DDL transactions. Starting with MDEV-12323, we aborted the rollback of recovered transactions. These transactions would be rolled back on subsequent server startup. trx_roll_report_progress(): Renamed from trx_roll_must_shutdown(), now that the shutdown check has been moved to the only caller. --- storage/innobase/include/trx0roll.h | 9 +++------ storage/innobase/row/row0undo.cc | 9 +++++++-- storage/innobase/trx/trx0roll.cc | 17 ++--------------- storage/xtradb/include/trx0roll.h | 9 +++------ storage/xtradb/row/row0undo.cc | 9 +++++++-- storage/xtradb/trx/trx0roll.cc | 17 ++--------------- 6 files changed, 24 insertions(+), 46 deletions(-) diff --git a/storage/innobase/include/trx0roll.h b/storage/innobase/include/trx0roll.h index 274a3b038ba..09d6a6e8b4c 100644 --- a/storage/innobase/include/trx0roll.h +++ b/storage/innobase/include/trx0roll.h @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, MariaDB Corporation. +Copyright (c) 2017, 2018, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -105,11 +105,8 @@ trx_undo_rec_release( /*=================*/ trx_t* trx, /*!< in/out: transaction */ undo_no_t undo_no);/*!< in: undo number */ -/** Report progress when rolling back a row of a recovered transaction. -@return whether the rollback should be aborted due to pending shutdown */ -UNIV_INTERN -bool -trx_roll_must_shutdown(); +/** Report progress when rolling back a row of a recovered transaction. */ +UNIV_INTERN void trx_roll_report_progress(); /*******************************************************************//** Rollback or clean up any incomplete transactions which were encountered in crash recovery. If the transaction already was diff --git a/storage/innobase/row/row0undo.cc b/storage/innobase/row/row0undo.cc index 552b99ab4d4..5362e2f321d 100644 --- a/storage/innobase/row/row0undo.cc +++ b/storage/innobase/row/row0undo.cc @@ -45,6 +45,7 @@ Created 1/8/1997 Heikki Tuuri #include "row0upd.h" #include "row0mysql.h" #include "srv0srv.h" +#include "srv0start.h" /* How to undo row operations? (1) For an insert, we have stored a prefix of the clustered index record @@ -349,13 +350,17 @@ row_undo_step( ut_ad(que_node_get_type(node) == QUE_NODE_UNDO); - if (UNIV_UNLIKELY(trx == trx_roll_crash_recv_trx) - && trx_roll_must_shutdown()) { + if (UNIV_UNLIKELY(trx_get_dict_operation(trx) == TRX_DICT_OP_NONE + && !srv_undo_sources && srv_fast_shutdown)) { /* Shutdown has been initiated. */ trx->error_state = DB_INTERRUPTED; return(NULL); } + if (UNIV_UNLIKELY(trx == trx_roll_crash_recv_trx)) { + trx_roll_report_progress(); + } + err = row_undo(node, thr); trx->error_state = err; diff --git a/storage/innobase/trx/trx0roll.cc b/storage/innobase/trx/trx0roll.cc index e5c57aa21ce..fc237ca1c16 100644 --- a/storage/innobase/trx/trx0roll.cc +++ b/storage/innobase/trx/trx0roll.cc @@ -719,21 +719,9 @@ fake_prepared: goto func_exit; } -/** Report progress when rolling back a row of a recovered transaction. -@return whether the rollback should be aborted due to pending shutdown */ -UNIV_INTERN -bool -trx_roll_must_shutdown() +/** Report progress when rolling back a row of a recovered transaction. */ +UNIV_INTERN void trx_roll_report_progress() { - const trx_t* trx = trx_roll_crash_recv_trx; - ut_ad(trx); - ut_ad(trx_state_eq(trx, TRX_STATE_ACTIVE)); - - if (trx_get_dict_operation(trx) == TRX_DICT_OP_NONE - && !srv_undo_sources && srv_fast_shutdown) { - return true; - } - ib_time_t time = ut_time(); mutex_enter(&trx_sys->mutex); mutex_enter(&recv_sys->mutex); @@ -761,7 +749,6 @@ trx_roll_must_shutdown() mutex_exit(&recv_sys->mutex); mutex_exit(&trx_sys->mutex); - return false; } /*******************************************************************//** diff --git a/storage/xtradb/include/trx0roll.h b/storage/xtradb/include/trx0roll.h index 565079b17b4..248a2c78e1a 100644 --- a/storage/xtradb/include/trx0roll.h +++ b/storage/xtradb/include/trx0roll.h @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, MariaDB Corporation. +Copyright (c) 2017, 2018, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -106,11 +106,8 @@ trx_undo_rec_release( /*=================*/ trx_t* trx, /*!< in/out: transaction */ undo_no_t undo_no);/*!< in: undo number */ -/** Report progress when rolling back a row of a recovered transaction. -@return whether the rollback should be aborted due to pending shutdown */ -UNIV_INTERN -bool -trx_roll_must_shutdown(); +/** Report progress when rolling back a row of a recovered transaction. */ +UNIV_INTERN void trx_roll_report_progress(); /*******************************************************************//** Rollback or clean up any incomplete transactions which were encountered in crash recovery. If the transaction already was diff --git a/storage/xtradb/row/row0undo.cc b/storage/xtradb/row/row0undo.cc index 552b99ab4d4..5362e2f321d 100644 --- a/storage/xtradb/row/row0undo.cc +++ b/storage/xtradb/row/row0undo.cc @@ -45,6 +45,7 @@ Created 1/8/1997 Heikki Tuuri #include "row0upd.h" #include "row0mysql.h" #include "srv0srv.h" +#include "srv0start.h" /* How to undo row operations? (1) For an insert, we have stored a prefix of the clustered index record @@ -349,13 +350,17 @@ row_undo_step( ut_ad(que_node_get_type(node) == QUE_NODE_UNDO); - if (UNIV_UNLIKELY(trx == trx_roll_crash_recv_trx) - && trx_roll_must_shutdown()) { + if (UNIV_UNLIKELY(trx_get_dict_operation(trx) == TRX_DICT_OP_NONE + && !srv_undo_sources && srv_fast_shutdown)) { /* Shutdown has been initiated. */ trx->error_state = DB_INTERRUPTED; return(NULL); } + if (UNIV_UNLIKELY(trx == trx_roll_crash_recv_trx)) { + trx_roll_report_progress(); + } + err = row_undo(node, thr); trx->error_state = err; diff --git a/storage/xtradb/trx/trx0roll.cc b/storage/xtradb/trx/trx0roll.cc index 1075064a2d6..9066e4fac4f 100644 --- a/storage/xtradb/trx/trx0roll.cc +++ b/storage/xtradb/trx/trx0roll.cc @@ -731,21 +731,9 @@ fake_prepared: goto func_exit; } -/** Report progress when rolling back a row of a recovered transaction. -@return whether the rollback should be aborted due to pending shutdown */ -UNIV_INTERN -bool -trx_roll_must_shutdown() +/** Report progress when rolling back a row of a recovered transaction. */ +UNIV_INTERN void trx_roll_report_progress() { - const trx_t* trx = trx_roll_crash_recv_trx; - ut_ad(trx); - ut_ad(trx_state_eq(trx, TRX_STATE_ACTIVE)); - - if (trx_get_dict_operation(trx) == TRX_DICT_OP_NONE - && !srv_undo_sources && srv_fast_shutdown) { - return true; - } - ib_time_t time = ut_time(); mutex_enter(&trx_sys->mutex); mutex_enter(&recv_sys->mutex); @@ -773,7 +761,6 @@ trx_roll_must_shutdown() mutex_exit(&recv_sys->mutex); mutex_exit(&trx_sys->mutex); - return false; } /*******************************************************************//** -- cgit v1.2.1 From e7f4e61f6e013e8879a64dae3ab0370ec137a121 Mon Sep 17 00:00:00 2001 From: Daniel Black Date: Sat, 24 Mar 2018 17:44:19 +1100 Subject: MDEV-14705: Speed up InnoDB shutdown Suggested by Marko on github pr #576 buf_all_freed only needs to be called once, not 3 times. buf_all_freed will always return TRUE if it returns. It will crash if any page was not flushed so its effectively an assert anyway. The following calls are likely redundant and could be removed: fil_flush_file_spaces(FIL_TYPE_TABLESPACE); fil_flush_file_spaces(FIL_TYPE_LOG); --- storage/innobase/log/log0log.cc | 23 +---------------------- storage/xtradb/log/log0log.cc | 23 +---------------------- 2 files changed, 2 insertions(+), 44 deletions(-) diff --git a/storage/innobase/log/log0log.cc b/storage/innobase/log/log0log.cc index 7a242b76e85..4929106b22c 100644 --- a/storage/innobase/log/log0log.cc +++ b/storage/innobase/log/log0log.cc @@ -3441,23 +3441,6 @@ wait_suspend_loop: mutex_exit(&log_sys->mutex); - fil_flush_file_spaces(FIL_TABLESPACE); - fil_flush_file_spaces(FIL_LOG); - - /* The call fil_write_flushed_lsn_to_data_files() will - bypass the buffer pool: therefore it is essential that - the buffer pool has been completely flushed to disk! */ - - if (!buf_all_freed()) { - if (srv_print_verbose_log && count > 600) { - ib_logf(IB_LOG_LEVEL_INFO, - "Waiting for dirty buffer pages" - " to be flushed"); - count = 0; - } - - goto loop; - } } else { lsn = srv_start_lsn; } @@ -3468,8 +3451,7 @@ wait_suspend_loop: srv_thread_type type = srv_get_active_thread_type(); ut_a(type == SRV_NONE); - bool freed = buf_all_freed(); - ut_a(freed); + buf_all_freed(); ut_a(lsn == log_sys->lsn); @@ -3499,9 +3481,6 @@ wait_suspend_loop: type = srv_get_active_thread_type(); ut_a(type == SRV_NONE); - freed = buf_all_freed(); - ut_a(freed); - ut_a(lsn == log_sys->lsn); } diff --git a/storage/xtradb/log/log0log.cc b/storage/xtradb/log/log0log.cc index 8f8984f8880..ee23bc49850 100644 --- a/storage/xtradb/log/log0log.cc +++ b/storage/xtradb/log/log0log.cc @@ -3758,23 +3758,6 @@ wait_suspend_loop: mutex_exit(&log_sys->mutex); - fil_flush_file_spaces(FIL_TABLESPACE); - fil_flush_file_spaces(FIL_LOG); - - /* The call fil_write_flushed_lsn_to_data_files() will - bypass the buffer pool: therefore it is essential that - the buffer pool has been completely flushed to disk! */ - - if (!buf_all_freed()) { - if (srv_print_verbose_log && count > 600) { - ib_logf(IB_LOG_LEVEL_INFO, - "Waiting for dirty buffer pages" - " to be flushed"); - count = 0; - } - - goto loop; - } } else { lsn = srv_start_lsn; } @@ -3791,8 +3774,7 @@ wait_suspend_loop: srv_thread_type type = srv_get_active_thread_type(); ut_a(type == SRV_NONE); - bool freed = buf_all_freed(); - ut_a(freed); + buf_all_freed(); ut_a(lsn == log_sys->lsn); ut_ad(srv_force_recovery >= SRV_FORCE_NO_LOG_REDO @@ -3824,9 +3806,6 @@ wait_suspend_loop: type = srv_get_active_thread_type(); ut_a(type == SRV_NONE); - freed = buf_all_freed(); - ut_a(freed); - ut_a(lsn == log_sys->lsn); } -- cgit v1.2.1 From 1479273cdbbca57675f3c8295ebcacc768d125d5 Mon Sep 17 00:00:00 2001 From: Daniel Black Date: Thu, 30 Nov 2017 13:37:59 +1100 Subject: MDEV-14705: slow innodb startup/shutdown can exceed systemd timeout Use systemd EXTEND_TIMEOUT_USEC to advise systemd of progress Move towards progress measures rather than pure time based measures. Progress reporting at numberious shutdown/startup locations incuding: * For innodb_fast_shutdown=0 trx_roll_must_shutdown() for rolling back incomplete transactions. * For merging the change buffer (in srv_shutdown(bool ibuf_merge)) * For purging history, srv_do_purge Thanks Marko for feedback and suggestions. --- include/my_service_manager.h | 39 +++++++++++++++++++++++++++++++++++ include/my_systemd.h | 34 ------------------------------ sql/mysqld.cc | 6 +++--- storage/innobase/buf/buf0dump.cc | 9 ++++++++ storage/innobase/buf/buf0flu.cc | 10 +++++++++ storage/innobase/handler/ha_innodb.cc | 2 +- storage/innobase/include/univ.i | 4 ++++ storage/innobase/log/log0log.cc | 26 ++++++++++++++++++----- storage/innobase/log/log0recv.cc | 9 +++++--- storage/innobase/srv/srv0srv.cc | 10 +++++++++ storage/innobase/trx/trx0roll.cc | 12 ++++++++--- storage/xtradb/buf/buf0dump.cc | 9 ++++++++ storage/xtradb/buf/buf0flu.cc | 10 +++++++++ storage/xtradb/handler/ha_innodb.cc | 2 +- storage/xtradb/include/univ.i | 4 ++++ storage/xtradb/log/log0log.cc | 26 ++++++++++++++++++----- storage/xtradb/log/log0recv.cc | 9 +++++--- storage/xtradb/srv/srv0srv.cc | 10 +++++++++ storage/xtradb/trx/trx0roll.cc | 12 ++++++++--- 19 files changed, 182 insertions(+), 61 deletions(-) create mode 100644 include/my_service_manager.h delete mode 100644 include/my_systemd.h diff --git a/include/my_service_manager.h b/include/my_service_manager.h new file mode 100644 index 00000000000..4d88e992b5e --- /dev/null +++ b/include/my_service_manager.h @@ -0,0 +1,39 @@ +/* + Copyright (c) 2015 Daniel Black. All rights reserved. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA +*/ + + +#ifndef MY_SERVICE_MANAGER_INCLUDED +#define MY_SERVICE_MANAGER_INCLUDED + +#if defined(HAVE_SYSTEMD) && !defined(EMBEDDED_LIBRARY) +/* + sd-daemon.h may include inttypes.h. Explicitly request format macros before + the first inclusion of inttypes.h. +*/ +#define __STDC_FORMAT_MACROS +#include +/** INTERVAL in seconds followed by printf style status */ +#define service_manager_extend_timeout(INTERVAL, FMTSTR, ...) \ + sd_notifyf(0, "STATUS=" FMTSTR "\nEXTEND_TIMEOUT_USEC=%u\n", ##__VA_ARGS__, INTERVAL * 1000000) + +#else +#define sd_notify(X, Y) +#define sd_notifyf(E, F, ...) +#define service_manager_extend_timeout(I, FMTSTR, ...) +#endif + +#endif /* MY_SERVICE_MANAGER_INCLUDED */ diff --git a/include/my_systemd.h b/include/my_systemd.h deleted file mode 100644 index bef75576422..00000000000 --- a/include/my_systemd.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - Copyright (c) 2015 Daniel Black. All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA -*/ - - -#ifndef MY_SYSTEMD_INCLUDED -#define MY_SYSTEMD_INCLUDED - -#if defined(HAVE_SYSTEMD) && !defined(EMBEDDED_LIBRARY) -/* - sd-daemon.h may include inttypes.h. Explicitly request format macros before - the first inclusion of inttypes.h. -*/ -#define __STDC_FORMAT_MACROS -#include -#else -#define sd_notify(X, Y) -#define sd_notifyf(E, F, ...) -#endif - -#endif /* MY_SYSTEMD_INCLUDED */ diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 7875d41d706..fc633a4fc46 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -111,7 +111,7 @@ #include #endif -#include +#include #define mysqld_charset &my_charset_latin1 @@ -6482,7 +6482,7 @@ void handle_connections_sockets() #endif sd_notify(0, "READY=1\n" - "STATUS=Taking your SQL requests now..."); + "STATUS=Taking your SQL requests now...\n"); DBUG_PRINT("general",("Waiting for connections.")); MAYBE_BROKEN_SYSCALL; @@ -6700,7 +6700,7 @@ void handle_connections_sockets() set_current_thd(0); } sd_notify(0, "STOPPING=1\n" - "STATUS=Shutdown in progress"); + "STATUS=Shutdown in progress\n"); DBUG_VOID_RETURN; } diff --git a/storage/innobase/buf/buf0dump.cc b/storage/innobase/buf/buf0dump.cc index bd9b6c92994..7d9dbc74951 100644 --- a/storage/innobase/buf/buf0dump.cc +++ b/storage/innobase/buf/buf0dump.cc @@ -42,6 +42,7 @@ Created April 08, 2011 Vasil Dimov #include "ut0byte.h" /* ut_ull_create() */ #include "ut0sort.h" /* UT_SORT_FUNCTION_BODY */ #include "mysql/service_wsrep.h" /* wsrep_recovery */ +#include enum status_severity { STATUS_INFO, @@ -333,6 +334,14 @@ buf_dump( i + 1, srv_buf_pool_instances, j + 1, n_pages); } + if ( (j % 1024) == 0) { + service_manager_extend_timeout(INNODB_EXTEND_TIMEOUT_INTERVAL, + "Dumping buffer pool " + ULINTPF "/" ULINTPF ", " + "page " ULINTPF "/" ULINTPF, + i + 1, srv_buf_pool_instances, + j + 1, n_pages); + } } ut_free(dump); diff --git a/storage/innobase/buf/buf0flu.cc b/storage/innobase/buf/buf0flu.cc index dacddfca385..ef73ea51696 100644 --- a/storage/innobase/buf/buf0flu.cc +++ b/storage/innobase/buf/buf0flu.cc @@ -54,6 +54,8 @@ Created 11/11/1995 Heikki Tuuri #include "mysql/service_thd_wait.h" #include "fil0pagecompress.h" +#include + /** Number of pages flushed through non flush_list flushes. */ static ulint buf_lru_flush_page_count = 0; @@ -528,6 +530,14 @@ buf_flush_remove( buf_pool_t* buf_pool = buf_pool_from_bpage(bpage); ulint zip_size; + /* TODO Marko: "I think that it might be useful to have a global time base for the shutdown progress reporting and extending the timeout intervals." */ + if (UNIV_UNLIKELY(srv_shutdown_state == SRV_SHUTDOWN_FLUSH_PHASE)) { + service_manager_extend_timeout(INNODB_EXTEND_TIMEOUT_INTERVAL, + "Flush and remove page with tablespace id %d" + ", Poolid %d, flush list length %d", + bpage->space, buf_pool->instance_no, UT_LIST_GET_LEN(buf_pool->flush_list)); + } + ut_ad(buf_pool_mutex_own(buf_pool)); ut_ad(mutex_own(buf_page_get_mutex(bpage))); ut_ad(bpage->in_flush_list); diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 7c412344920..9401f737a06 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -55,7 +55,7 @@ MYSQL_PLUGIN_IMPORT extern char mysql_unpacked_real_data_home[]; #include #endif -#include +#include /** @file ha_innodb.cc */ diff --git a/storage/innobase/include/univ.i b/storage/innobase/include/univ.i index 24bcab56870..0d5657b30ff 100644 --- a/storage/innobase/include/univ.i +++ b/storage/innobase/include/univ.i @@ -65,6 +65,10 @@ component, i.e. we show M.N.P as M.N */ IB_TO_STR(INNODB_VERSION_MAJOR) "." \ IB_TO_STR(INNODB_VERSION_MINOR) "/en/" +/** How far ahead should we tell the service manager the timeout +(time in seconds) */ +#define INNODB_EXTEND_TIMEOUT_INTERVAL 30 + #ifdef MYSQL_DYNAMIC_PLUGIN /* In the dynamic plugin, redefine some externally visible symbols in order not to conflict with the symbols of a builtin InnoDB. */ diff --git a/storage/innobase/log/log0log.cc b/storage/innobase/log/log0log.cc index 4929106b22c..1d562a6ef68 100644 --- a/storage/innobase/log/log0log.cc +++ b/storage/innobase/log/log0log.cc @@ -39,7 +39,7 @@ Created 12/9/1995 Heikki Tuuri #ifndef UNIV_HOTBACKUP #if MYSQL_VERSION_ID < 100200 -# include /* sd_notifyf() */ +# include #endif #include "mem0mem.h" @@ -1443,6 +1443,11 @@ log_write_up_to( return; } + if (srv_shutdown_state != SRV_SHUTDOWN_NONE) { + service_manager_extend_timeout(INNODB_EXTEND_TIMEOUT_INTERVAL, + "log write up to: %llu", lsn); + } + loop: ut_ad(++loop_count < 100); @@ -2351,8 +2356,9 @@ loop: 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); + service_manager_extend_timeout(INNODB_EXTEND_TIMEOUT_INTERVAL, + "Read redo log up to LSN=" LSN_PF, + start_lsn); } if (start_lsn != end_lsn) { @@ -3320,10 +3326,16 @@ wait_suspend_loop: before proceeding further. */ count = 0; +#define COUNT_INTERVAL 600 +#define CHECK_INTERVAL 100000 + service_manager_extend_timeout(COUNT_INTERVAL * CHECK_INTERVAL/1000000 * 2, + "Waiting for page cleaner"); while (buf_page_cleaner_is_active) { ++count; - os_thread_sleep(100000); - if (srv_print_verbose_log && count > 600) { + os_thread_sleep(CHECK_INTERVAL); + if (srv_print_verbose_log && count > COUNT_INTERVAL) { + service_manager_extend_timeout(COUNT_INTERVAL * CHECK_INTERVAL/1000000 * 2, + "Waiting for page cleaner"); ib_logf(IB_LOG_LEVEL_INFO, "Waiting for page_cleaner to " "finish flushing of buffer pool"); @@ -3408,6 +3420,8 @@ wait_suspend_loop: } if (!srv_read_only_mode) { + service_manager_extend_timeout(INNODB_EXTEND_TIMEOUT_INTERVAL, + "ensuring dirty buffer pool are written to log"); log_make_checkpoint_at(LSN_MAX, TRUE); mutex_enter(&log_sys->mutex); @@ -3451,6 +3465,8 @@ wait_suspend_loop: srv_thread_type type = srv_get_active_thread_type(); ut_a(type == SRV_NONE); + service_manager_extend_timeout(INNODB_EXTEND_TIMEOUT_INTERVAL, + "Free innodb buffer pool"); buf_all_freed(); ut_a(lsn == log_sys->lsn); diff --git a/storage/innobase/log/log0recv.cc b/storage/innobase/log/log0recv.cc index 6e6d8aae25e..deaf5e88d7c 100644 --- a/storage/innobase/log/log0recv.cc +++ b/storage/innobase/log/log0recv.cc @@ -30,7 +30,7 @@ Created 9/20/1997 Heikki Tuuri #include // Solaris/x86 header file bug #include -#include +#include #include "log0recv.h" @@ -1717,8 +1717,8 @@ recv_recover_page_func( 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); + service_manager_extend_timeout( + INNODB_EXTEND_TIMEOUT_INTERVAL, "To recover: " ULINTPF " pages from log", n); } } @@ -2911,6 +2911,9 @@ recv_init_crash_recovery(void) and restore them from the doublewrite buffer if possible */ + service_manager_extend_timeout( + INNODB_EXTEND_TIMEOUT_INTERVAL, "Starting Innodb crash recovery"); + if (srv_force_recovery < SRV_FORCE_NO_LOG_REDO) { buf_dblwr_process(); diff --git a/storage/innobase/srv/srv0srv.cc b/storage/innobase/srv/srv0srv.cc index 561df0bd060..4f25672d4aa 100644 --- a/storage/innobase/srv/srv0srv.cc +++ b/storage/innobase/srv/srv0srv.cc @@ -77,6 +77,12 @@ Created 10/8/1995 Heikki Tuuri #include "fil0pagecompress.h" #include "btr0scrub.h" +#include + +#ifdef WITH_WSREP +extern int wsrep_debug; +extern int wsrep_trx_is_aborting(void *thd_ptr); +#endif /* The following is the maximum allowed duration of a lock wait. */ UNIV_INTERN ulong srv_fatal_semaphore_wait_threshold = DEFAULT_SRV_FATAL_SEMAPHORE_TIMEOUT; @@ -2727,6 +2733,10 @@ srv_do_purge( *n_total_purged += n_pages_purged; + if (n_pages_purged > 0) { + service_manager_extend_timeout( + INNODB_EXTEND_TIMEOUT_INTERVAL, "Innodb %d pages purged", n_pages_purged); + } } while (!srv_purge_should_exit(n_pages_purged) && n_pages_purged > 0 && purge_sys->state == PURGE_STATE_RUN); diff --git a/storage/innobase/trx/trx0roll.cc b/storage/innobase/trx/trx0roll.cc index fc237ca1c16..d91988d56cd 100644 --- a/storage/innobase/trx/trx0roll.cc +++ b/storage/innobase/trx/trx0roll.cc @@ -25,7 +25,7 @@ Created 3/26/1996 Heikki Tuuri *******************************************************/ #include "my_config.h" -#include +#include #include "trx0roll.h" @@ -740,11 +740,17 @@ UNIV_INTERN void trx_roll_report_progress() n_rows += t->undo_no; } } + + if (n_rows > 0) { + service_manager_extend_timeout( + INNODB_EXTEND_TIMEOUT_INTERVAL, + "To roll back: " ULINTPF " transactions, " + "%llu rows", n_trx, n_rows); + } + ib_logf(IB_LOG_LEVEL_INFO, "To roll back: " ULINTPF " transactions, " "%llu rows", n_trx, n_rows); - sd_notifyf(0, "STATUS=To roll back: " ULINTPF " transactions, " - "%llu rows", n_trx, n_rows); } mutex_exit(&recv_sys->mutex); diff --git a/storage/xtradb/buf/buf0dump.cc b/storage/xtradb/buf/buf0dump.cc index 1cc40fcfbad..ce21a308960 100644 --- a/storage/xtradb/buf/buf0dump.cc +++ b/storage/xtradb/buf/buf0dump.cc @@ -42,6 +42,7 @@ Created April 08, 2011 Vasil Dimov #include "ut0byte.h" /* ut_ull_create() */ #include "ut0sort.h" /* UT_SORT_FUNCTION_BODY */ #include "mysql/service_wsrep.h" /* wsrep_recovery */ +#include enum status_severity { STATUS_INFO, @@ -333,6 +334,14 @@ buf_dump( i + 1, srv_buf_pool_instances, j + 1, n_pages); } + if ( (j % 1024) == 0) { + service_manager_extend_timeout(INNODB_EXTEND_TIMEOUT_INTERVAL, + "Dumping buffer pool " + ULINTPF "/" ULINTPF ", " + "page " ULINTPF "/" ULINTPF, + i + 1, srv_buf_pool_instances, + j + 1, n_pages); + } } ut_free(dump); diff --git a/storage/xtradb/buf/buf0flu.cc b/storage/xtradb/buf/buf0flu.cc index abbcd5141cf..2b4d796d1d6 100644 --- a/storage/xtradb/buf/buf0flu.cc +++ b/storage/xtradb/buf/buf0flu.cc @@ -54,6 +54,8 @@ Created 11/11/1995 Heikki Tuuri #include "mysql/service_thd_wait.h" #include "fil0pagecompress.h" +#include + /** Number of pages flushed through non flush_list flushes. */ // static ulint buf_lru_flush_page_count = 0; @@ -575,6 +577,14 @@ buf_flush_remove( buf_pool_t* buf_pool = buf_pool_from_bpage(bpage); ulint zip_size; + /* TODO Marko: "I think that it might be useful to have a global time base for the shutdown progress reporting and extending the timeout intervals." */ + if (UNIV_UNLIKELY(srv_shutdown_state == SRV_SHUTDOWN_FLUSH_PHASE)) { + service_manager_extend_timeout(INNODB_EXTEND_TIMEOUT_INTERVAL, + "Flush and remove page with tablespace id %d" + ", Poolid %d, flush list length %d", + bpage->space, buf_pool->instance_no, UT_LIST_GET_LEN(buf_pool->flush_list)); + } + ut_ad(mutex_own(buf_page_get_mutex(bpage))); #if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG ut_ad(buf_page_get_state(bpage) != BUF_BLOCK_ZIP_DIRTY diff --git a/storage/xtradb/handler/ha_innodb.cc b/storage/xtradb/handler/ha_innodb.cc index 2b7dc01238c..25c8f3c6495 100644 --- a/storage/xtradb/handler/ha_innodb.cc +++ b/storage/xtradb/handler/ha_innodb.cc @@ -50,7 +50,7 @@ this program; if not, write to the Free Software Foundation, Inc., #include #endif -#include +#include /** @file ha_innodb.cc */ diff --git a/storage/xtradb/include/univ.i b/storage/xtradb/include/univ.i index e6c4917f532..f4adc2e8e54 100644 --- a/storage/xtradb/include/univ.i +++ b/storage/xtradb/include/univ.i @@ -73,6 +73,10 @@ component, i.e. we show M.N.P as M.N */ IB_TO_STR(INNODB_VERSION_MAJOR) "." \ IB_TO_STR(INNODB_VERSION_MINOR) "/en/" +/** How far ahead should we tell the service manager the timeout +(time in seconds) */ +#define INNODB_EXTEND_TIMEOUT_INTERVAL 30 + #ifdef MYSQL_DYNAMIC_PLUGIN /* In the dynamic plugin, redefine some externally visible symbols in order not to conflict with the symbols of a builtin InnoDB. */ diff --git a/storage/xtradb/log/log0log.cc b/storage/xtradb/log/log0log.cc index ee23bc49850..4387dddc16a 100644 --- a/storage/xtradb/log/log0log.cc +++ b/storage/xtradb/log/log0log.cc @@ -49,7 +49,7 @@ Created 12/9/1995 Heikki Tuuri #ifndef UNIV_HOTBACKUP #if MYSQL_VERSION_ID < 100200 -# include /* sd_notifyf() */ +# include #endif #include "mem0mem.h" @@ -1561,6 +1561,11 @@ log_write_up_to( return; } + if (srv_shutdown_state != SRV_SHUTDOWN_NONE) { + service_manager_extend_timeout(INNODB_EXTEND_TIMEOUT_INTERVAL, + "log write up to: %llu", lsn); + } + loop: ut_ad(++loop_count < 100); @@ -2602,8 +2607,9 @@ loop: if (recv_recovery_is_on() && recv_sys && 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); + service_manager_extend_timeout(INNODB_EXTEND_TIMEOUT_INTERVAL, + "Read redo log up to LSN=" LSN_PF, + start_lsn); } if (start_lsn != end_lsn) { @@ -3636,6 +3642,10 @@ wait_suspend_loop: before proceeding further. */ count = 0; +#define COUNT_INTERVAL 600 +#define CHECK_INTERVAL 100000 + service_manager_extend_timeout(COUNT_INTERVAL * CHECK_INTERVAL/1000000 * 2, + "Waiting for page cleaner"); os_rmb; while (buf_page_cleaner_is_active || buf_lru_manager_is_active) { if (srv_print_verbose_log && count == 0) { @@ -3644,8 +3654,10 @@ wait_suspend_loop: "finish flushing of buffer pool"); } ++count; - os_thread_sleep(100000); - if (count > 600) { + os_thread_sleep(CHECK_INTERVAL); + if (srv_print_verbose_log && count > COUNT_INTERVAL) { + service_manager_extend_timeout(COUNT_INTERVAL * CHECK_INTERVAL/1000000 * 2, + "Waiting for page cleaner"); count = 0; } os_rmb; @@ -3730,6 +3742,8 @@ wait_suspend_loop: } if (!srv_read_only_mode) { + service_manager_extend_timeout(INNODB_EXTEND_TIMEOUT_INTERVAL, + "ensuring dirty buffer pool are written to log"); log_make_checkpoint_at(LSN_MAX, TRUE); mutex_enter(&log_sys->mutex); @@ -3774,6 +3788,8 @@ wait_suspend_loop: srv_thread_type type = srv_get_active_thread_type(); ut_a(type == SRV_NONE); + service_manager_extend_timeout(INNODB_EXTEND_TIMEOUT_INTERVAL, + "Free innodb buffer pool"); buf_all_freed(); ut_a(lsn == log_sys->lsn); diff --git a/storage/xtradb/log/log0recv.cc b/storage/xtradb/log/log0recv.cc index 1943fb51f37..d8e90de45e9 100644 --- a/storage/xtradb/log/log0recv.cc +++ b/storage/xtradb/log/log0recv.cc @@ -30,7 +30,7 @@ Created 9/20/1997 Heikki Tuuri #include // Solaris/x86 header file bug #include -#include +#include #include "log0recv.h" @@ -1804,8 +1804,8 @@ recv_recover_page_func( 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); + service_manager_extend_timeout( + INNODB_EXTEND_TIMEOUT_INTERVAL, "To recover: " ULINTPF " pages from log", n); } } @@ -3001,6 +3001,9 @@ recv_init_crash_recovery(void) and restore them from the doublewrite buffer if possible */ + service_manager_extend_timeout( + INNODB_EXTEND_TIMEOUT_INTERVAL, "Starting Innodb crash recovery"); + if (srv_force_recovery < SRV_FORCE_NO_LOG_REDO) { buf_dblwr_process(); diff --git a/storage/xtradb/srv/srv0srv.cc b/storage/xtradb/srv/srv0srv.cc index f431c47de4d..b53948d9371 100644 --- a/storage/xtradb/srv/srv0srv.cc +++ b/storage/xtradb/srv/srv0srv.cc @@ -86,6 +86,12 @@ ibool innobase_get_slow_log(); in the server */ UNIV_INTERN ulint srv_activity_count = 0; +#include + +#ifdef WITH_WSREP +extern int wsrep_debug; +extern int wsrep_trx_is_aborting(void *thd_ptr); +#endif /* The following is the maximum allowed duration of a lock wait. */ UNIV_INTERN ulong srv_fatal_semaphore_wait_threshold = DEFAULT_SRV_FATAL_SEMAPHORE_TIMEOUT; @@ -3435,6 +3441,10 @@ srv_do_purge( *n_total_purged += n_pages_purged; + if (n_pages_purged > 0) { + service_manager_extend_timeout( + INNODB_EXTEND_TIMEOUT_INTERVAL, "Innodb %d pages purged", n_pages_purged); + } } while (!srv_purge_should_exit(n_pages_purged) && n_pages_purged > 0 && purge_sys->state == PURGE_STATE_RUN); diff --git a/storage/xtradb/trx/trx0roll.cc b/storage/xtradb/trx/trx0roll.cc index 9066e4fac4f..a031217e51d 100644 --- a/storage/xtradb/trx/trx0roll.cc +++ b/storage/xtradb/trx/trx0roll.cc @@ -25,7 +25,7 @@ Created 3/26/1996 Heikki Tuuri *******************************************************/ #include "my_config.h" -#include +#include #include "trx0roll.h" @@ -752,11 +752,17 @@ UNIV_INTERN void trx_roll_report_progress() n_rows += t->undo_no; } } + + if (n_rows > 0) { + service_manager_extend_timeout( + INNODB_EXTEND_TIMEOUT_INTERVAL, + "To roll back: " ULINTPF " transactions, " + "%llu rows", n_trx, n_rows); + } + ib_logf(IB_LOG_LEVEL_INFO, "To roll back: " ULINTPF " transactions, " "%llu rows", n_trx, n_rows); - sd_notifyf(0, "STATUS=To roll back: " ULINTPF " transactions, " - "%llu rows", n_trx, n_rows); } mutex_exit(&recv_sys->mutex); -- cgit v1.2.1 From d61ed5dd8a7e63cebf52efc2d067706263df2061 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= Date: Fri, 6 Apr 2018 12:27:18 +0300 Subject: MDEV-13549: Galera test failures Fix test case galera.pxc-421 to reset auto_increment_offset correctly. --- mysql-test/suite/galera/r/pxc-421.result | 2 -- mysql-test/suite/galera/t/pxc-421.test | 10 +++++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/mysql-test/suite/galera/r/pxc-421.result b/mysql-test/suite/galera/r/pxc-421.result index f5c0fabcd6e..ba1f3d66720 100644 --- a/mysql-test/suite/galera/r/pxc-421.result +++ b/mysql-test/suite/galera/r/pxc-421.result @@ -26,7 +26,6 @@ SET GLOBAL wsrep_slave_threads = 1; SELECT COUNT(*) FROM t1; COUNT(*) 16 -SET GLOBAL auto_increment_offset = 2; SELECT COUNT(*) FROM t1; COUNT(*) 15 @@ -35,4 +34,3 @@ Variable_name Value wsrep_slave_threads 12 SET GLOBAL wsrep_slave_threads = 1; DROP TABLE t1; -SET GLOBAL auto_increment_offset = 1; diff --git a/mysql-test/suite/galera/t/pxc-421.test b/mysql-test/suite/galera/t/pxc-421.test index 381f9bb4494..7bb2354853b 100644 --- a/mysql-test/suite/galera/t/pxc-421.test +++ b/mysql-test/suite/galera/t/pxc-421.test @@ -6,6 +6,11 @@ --source include/galera_cluster.inc --source include/have_innodb.inc +# Save original auto_increment_offset values. +--let $node_1=node_1 +--let $node_2=node_2 +--source include/auto_increment_offset_save.inc + --connection node_1 --let $wsrep_slave_1 = `SELECT @@wsrep_slave_threads` set GLOBAL wsrep_slave_threads=26; @@ -54,12 +59,11 @@ show global variables like 'wsrep_slave_threads'; --eval SET GLOBAL wsrep_slave_threads = $wsrep_slave_2 SELECT COUNT(*) FROM t1; -SET GLOBAL auto_increment_offset = 2; - --connection node_1 SELECT COUNT(*) FROM t1; show global variables like 'wsrep_slave_threads'; --eval SET GLOBAL wsrep_slave_threads = $wsrep_slave_1 DROP TABLE t1; -SET GLOBAL auto_increment_offset = 1; +--source include/auto_increment_offset_restore.inc + -- cgit v1.2.1 From 3498a656c90a579ab0bb26a3566c14474b5ad6aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Fri, 6 Apr 2018 12:25:41 +0300 Subject: MDEV-14705: Follow-up fixes buf_flush_remove(): Disable the output for now, because we certainly do not want this after every page flush on shutdown. It must be rate-limited somehow. There already is a timeout extension for waiting the page cleaner to exit in logs_empty_and_mark_files_at_shutdown(). log_write_up_to(): Use correct format. srv_purge_should_exit(): Move the timeout extension to the appropriate place, from one of the callers. --- storage/innobase/buf/buf0flu.cc | 13 ++++++++----- storage/innobase/log/log0log.cc | 4 ++-- storage/innobase/srv/srv0srv.cc | 8 +++----- storage/xtradb/buf/buf0flu.cc | 13 ++++++++----- storage/xtradb/log/log0log.cc | 4 ++-- storage/xtradb/srv/srv0srv.cc | 8 +++----- 6 files changed, 26 insertions(+), 24 deletions(-) diff --git a/storage/innobase/buf/buf0flu.cc b/storage/innobase/buf/buf0flu.cc index ef73ea51696..66704ac1344 100644 --- a/storage/innobase/buf/buf0flu.cc +++ b/storage/innobase/buf/buf0flu.cc @@ -530,13 +530,16 @@ buf_flush_remove( buf_pool_t* buf_pool = buf_pool_from_bpage(bpage); ulint zip_size; - /* TODO Marko: "I think that it might be useful to have a global time base for the shutdown progress reporting and extending the timeout intervals." */ +#if 0 // FIXME: Rate-limit the output. Move this to the page cleaner? if (UNIV_UNLIKELY(srv_shutdown_state == SRV_SHUTDOWN_FLUSH_PHASE)) { - service_manager_extend_timeout(INNODB_EXTEND_TIMEOUT_INTERVAL, - "Flush and remove page with tablespace id %d" - ", Poolid %d, flush list length %d", - bpage->space, buf_pool->instance_no, UT_LIST_GET_LEN(buf_pool->flush_list)); + service_manager_extend_timeout( + INNODB_EXTEND_TIMEOUT_INTERVAL, + "Flush and remove page with tablespace id %u" + ", Poolid " ULINTPF ", flush list length " ULINTPF, + bpage->space, buf_pool->instance_no, + UT_LIST_GET_LEN(buf_pool->flush_list)); } +#endif ut_ad(buf_pool_mutex_own(buf_pool)); ut_ad(mutex_own(buf_page_get_mutex(bpage))); diff --git a/storage/innobase/log/log0log.cc b/storage/innobase/log/log0log.cc index 1d562a6ef68..97459cfffb2 100644 --- a/storage/innobase/log/log0log.cc +++ b/storage/innobase/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. +Copyright (c) 2014, 2018, MariaDB Corporation. Portions of this file contain modifications contributed and copyrighted by Google, Inc. Those modifications are gratefully acknowledged and are described @@ -1445,7 +1445,7 @@ log_write_up_to( if (srv_shutdown_state != SRV_SHUTDOWN_NONE) { service_manager_extend_timeout(INNODB_EXTEND_TIMEOUT_INTERVAL, - "log write up to: %llu", lsn); + "log write up to: " LSNPF, lsn); } loop: diff --git a/storage/innobase/srv/srv0srv.cc b/storage/innobase/srv/srv0srv.cc index 4f25672d4aa..6e8ed7893d6 100644 --- a/storage/innobase/srv/srv0srv.cc +++ b/storage/innobase/srv/srv0srv.cc @@ -2542,6 +2542,9 @@ srv_purge_should_exit(ulint n_purged) } /* Slow shutdown was requested. */ if (n_purged) { + service_manager_extend_timeout( + INNODB_EXTEND_TIMEOUT_INTERVAL, + "InnoDB " ULINTPF " pages purged", n_purged); /* The previous round still did some work. */ return(false); } @@ -2732,11 +2735,6 @@ srv_do_purge( (++count % TRX_SYS_N_RSEGS) == 0); *n_total_purged += n_pages_purged; - - if (n_pages_purged > 0) { - service_manager_extend_timeout( - INNODB_EXTEND_TIMEOUT_INTERVAL, "Innodb %d pages purged", n_pages_purged); - } } while (!srv_purge_should_exit(n_pages_purged) && n_pages_purged > 0 && purge_sys->state == PURGE_STATE_RUN); diff --git a/storage/xtradb/buf/buf0flu.cc b/storage/xtradb/buf/buf0flu.cc index 2b4d796d1d6..de59bbcd4c0 100644 --- a/storage/xtradb/buf/buf0flu.cc +++ b/storage/xtradb/buf/buf0flu.cc @@ -577,13 +577,16 @@ buf_flush_remove( buf_pool_t* buf_pool = buf_pool_from_bpage(bpage); ulint zip_size; - /* TODO Marko: "I think that it might be useful to have a global time base for the shutdown progress reporting and extending the timeout intervals." */ +#if 0 // FIXME: Rate-limit the output. Move this to the page cleaner? if (UNIV_UNLIKELY(srv_shutdown_state == SRV_SHUTDOWN_FLUSH_PHASE)) { - service_manager_extend_timeout(INNODB_EXTEND_TIMEOUT_INTERVAL, - "Flush and remove page with tablespace id %d" - ", Poolid %d, flush list length %d", - bpage->space, buf_pool->instance_no, UT_LIST_GET_LEN(buf_pool->flush_list)); + service_manager_extend_timeout( + INNODB_EXTEND_TIMEOUT_INTERVAL, + "Flush and remove page with tablespace id %u" + ", Poolid " ULINTPF ", flush list length " ULINTPF, + bpage->space, buf_pool->instance_no, + UT_LIST_GET_LEN(buf_pool->flush_list)); } +#endif ut_ad(mutex_own(buf_page_get_mutex(bpage))); #if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG diff --git a/storage/xtradb/log/log0log.cc b/storage/xtradb/log/log0log.cc index 4387dddc16a..6acafeb4dab 100644 --- a/storage/xtradb/log/log0log.cc +++ b/storage/xtradb/log/log0log.cc @@ -2,7 +2,7 @@ Copyright (c) 1995, 2017, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2009, Google Inc. -Copyright (c) 2014, 2017, MariaDB Corporation. +Copyright (c) 2014, 2018, MariaDB Corporation. Portions of this file contain modifications contributed and copyrighted by Google, Inc. Those modifications are gratefully acknowledged and are described @@ -1563,7 +1563,7 @@ log_write_up_to( if (srv_shutdown_state != SRV_SHUTDOWN_NONE) { service_manager_extend_timeout(INNODB_EXTEND_TIMEOUT_INTERVAL, - "log write up to: %llu", lsn); + "log write up to: " LSNPF, lsn); } loop: diff --git a/storage/xtradb/srv/srv0srv.cc b/storage/xtradb/srv/srv0srv.cc index b53948d9371..31e87095934 100644 --- a/storage/xtradb/srv/srv0srv.cc +++ b/storage/xtradb/srv/srv0srv.cc @@ -3236,6 +3236,9 @@ srv_purge_should_exit(ulint n_purged) } /* Slow shutdown was requested. */ if (n_purged) { + service_manager_extend_timeout( + INNODB_EXTEND_TIMEOUT_INTERVAL, + "InnoDB " ULINTPF " pages purged", n_purged); /* The previous round still did some work. */ return(false); } @@ -3440,11 +3443,6 @@ srv_do_purge( (++count % TRX_SYS_N_RSEGS) == 0); *n_total_purged += n_pages_purged; - - if (n_pages_purged > 0) { - service_manager_extend_timeout( - INNODB_EXTEND_TIMEOUT_INTERVAL, "Innodb %d pages purged", n_pages_purged); - } } while (!srv_purge_should_exit(n_pages_purged) && n_pages_purged > 0 && purge_sys->state == PURGE_STATE_RUN); -- cgit v1.2.1 From 400a8eb60f832030a04a248e2c96552aa3f44055 Mon Sep 17 00:00:00 2001 From: Sergey Vojtovich Date: Fri, 6 Apr 2018 13:33:08 +0400 Subject: MDEV-15291 - OQGraph fails to build on FreeBSD Boost includes sys/param.h on FreeBSD, which in turn defines setbit() macro. This macro is conflicting with open_query::judy_bitset::setbit(). Reordered includes such that oqgraph_judy.h never sees this macro. Also removed duplicate includes of graphcore-config.h, which is included by graphcore-graph.h/oqgraph_shim.h/oqgraph_thunk.h. --- storage/oqgraph/graphcore-graph.cc | 1 - storage/oqgraph/graphcore.cc | 1 - storage/oqgraph/oqgraph_shim.h | 2 +- 3 files changed, 1 insertion(+), 3 deletions(-) diff --git a/storage/oqgraph/graphcore-graph.cc b/storage/oqgraph/graphcore-graph.cc index 31d62c5f4c2..cf6c7ccccdc 100644 --- a/storage/oqgraph/graphcore-graph.cc +++ b/storage/oqgraph/graphcore-graph.cc @@ -22,6 +22,5 @@ ====================================================================== */ -#include "graphcore-config.h" #include "graphcore-graph.h" diff --git a/storage/oqgraph/graphcore.cc b/storage/oqgraph/graphcore.cc index 4a6d631be04..7006e51e220 100644 --- a/storage/oqgraph/graphcore.cc +++ b/storage/oqgraph/graphcore.cc @@ -25,7 +25,6 @@ #include #include -#include "graphcore-config.h" #include "graphcore-graph.h" #include diff --git a/storage/oqgraph/oqgraph_shim.h b/storage/oqgraph/oqgraph_shim.h index c3e5ee6a832..d3e7d044e86 100644 --- a/storage/oqgraph/oqgraph_shim.h +++ b/storage/oqgraph/oqgraph_shim.h @@ -24,8 +24,8 @@ #pragma once -#include "oqgraph_thunk.h" #include "oqgraph_judy.h" +#include "oqgraph_thunk.h" #define BOOST_NO_HASH 1 #define BOOST_NO_SLIST 1 -- cgit v1.2.1 From 3be6cef59364e6673f861b5ae0bf4fb4da8b8751 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= Date: Fri, 6 Apr 2018 12:35:25 +0300 Subject: MDEV-13549: Galera test failures Fix test case galera_toi_ddl_nonconflicting as we need to wait until both alter tables are finished on that Galera node. --- mysql-test/suite/galera/t/galera_toi_ddl_nonconflicting.test | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/mysql-test/suite/galera/t/galera_toi_ddl_nonconflicting.test b/mysql-test/suite/galera/t/galera_toi_ddl_nonconflicting.test index 821f7a6eb2c..dbd2510cba3 100644 --- a/mysql-test/suite/galera/t/galera_toi_ddl_nonconflicting.test +++ b/mysql-test/suite/galera/t/galera_toi_ddl_nonconflicting.test @@ -17,12 +17,23 @@ CREATE TABLE t1 (f1 INTEGER PRIMARY KEY AUTO_INCREMENT, f2 INTEGER); --reap INSERT INTO t1 (f1, f2) VALUES (DEFAULT, 234); +--let $wait_condition = SELECT COUNT(*) = 3 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1'; +--source include/wait_condition.inc +--let $wait_condition = SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.STATISTICS WHERE TABLE_NAME = 't1'; +--source include/wait_condition.inc + SELECT COUNT(*) = 3 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1'; SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.STATISTICS WHERE TABLE_NAME = 't1'; SELECT COUNT(*) = 2 FROM t1; --connection node_1 --reap + +--let $wait_condition = SELECT COUNT(*) = 3 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1'; +--source include/wait_condition.inc +--let $wait_condition = SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.STATISTICS WHERE TABLE_NAME = 't1'; +--source include/wait_condition.inc + SELECT COUNT(*) = 3 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1'; SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.STATISTICS WHERE TABLE_NAME = 't1'; SELECT COUNT(*) = 2 FROM t1; -- cgit v1.2.1 From 81075d45c6c7a63f43ea7268c3517bfa55ce2017 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= Date: Fri, 6 Apr 2018 12:55:43 +0300 Subject: MDEV-15566: System tablespace does not easily key rotate to unencrypted Problem was that key rotation from encrypted to unecrypted was skipped when encryption is disabled (i.e. set global innodb-encrypt-tables=OFF). fil_crypt_needs_rotation If encryption is disabled (i.e. innodb-encrypt-tables=off) and there is tablespaces using default encryption (e.g. system tablespace) that are still encrypted state we need to rotate them from encrypted state to unencrypted state. --- .../encryption/r/innodb-remove-encryption.result | 41 +++++++++++++++ .../encryption/t/innodb-remove-encryption.test | 59 ++++++++++++++++++++++ storage/innobase/fil/fil0crypt.cc | 46 ++++++++++------- storage/xtradb/fil/fil0crypt.cc | 46 ++++++++++------- 4 files changed, 156 insertions(+), 36 deletions(-) create mode 100644 mysql-test/suite/encryption/r/innodb-remove-encryption.result create mode 100644 mysql-test/suite/encryption/t/innodb-remove-encryption.test diff --git a/mysql-test/suite/encryption/r/innodb-remove-encryption.result b/mysql-test/suite/encryption/r/innodb-remove-encryption.result new file mode 100644 index 00000000000..06f1c986a25 --- /dev/null +++ b/mysql-test/suite/encryption/r/innodb-remove-encryption.result @@ -0,0 +1,41 @@ +set global innodb_file_per_table=OFF; +call mtr.add_suppression("mysqld: file-key-management-filename is not set"); +call mtr.add_suppression("Plugin 'file_key_management' init function returned error."); +call mtr.add_suppression("Plugin 'file_key_management' registration as a ENCRYPTION failed."); +flush tables; +create table t1(a int not null primary key, b char(200)) engine=innodb; + +# Restart server with encryption +# Wait until encryption threads have encrypted all tablespaces +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 +./ibdata1 +# Success! +SELECT * from t1; +a b +# Now turn off encryption and wait for threads to decrypt all tablespaces +SET GLOBAL innodb_encrypt_tables = off; +SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0; +NAME +mysql/innodb_table_stats +mysql/innodb_index_stats +./ibdata1 +SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0; +NAME +# Success! + +# Restart server with no encryption setup, there should be no crashes +SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0; +NAME +mysql/innodb_table_stats +mysql/innodb_index_stats +./ibdata1 +SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0; +NAME +SELECT * from t1; +a b +DROP TABLE t1; diff --git a/mysql-test/suite/encryption/t/innodb-remove-encryption.test b/mysql-test/suite/encryption/t/innodb-remove-encryption.test new file mode 100644 index 00000000000..24e00a00a02 --- /dev/null +++ b/mysql-test/suite/encryption/t/innodb-remove-encryption.test @@ -0,0 +1,59 @@ +--source include/have_innodb.inc +# Test uses restart +--source include/not_embedded.inc +--source filekeys_plugin.inc + +# +# MDEV-15566: System tablespace does not easily key rotate to unencrypted +# + +set global innodb_file_per_table=OFF; + +call mtr.add_suppression("mysqld: file-key-management-filename is not set"); +call mtr.add_suppression("Plugin 'file_key_management' init function returned error."); +call mtr.add_suppression("Plugin 'file_key_management' registration as a ENCRYPTION failed."); +flush tables; + +create table t1(a int not null primary key, b char(200)) engine=innodb; + +--echo +--echo # Restart server with encryption +-- let $restart_parameters=--plugin-load-add=$FILE_KEY_MANAGEMENT_SO --loose-file-key-management --loose-file-key-management-filename=$MYSQL_TEST_DIR/std_data/keys.txt --file-key-management-encryption-algorithm=aes_cbc --innodb-encrypt-tables=ON --innodb-encryption-threads=4 --innodb-tablespaces-encryption --innodb-encryption-rotate-key-age=15 +-- source include/restart_mysqld.inc + +--echo # Wait until encryption threads have encrypted all tablespaces + +--let $tables_count= `select count(*) from information_schema.tables where engine = 'InnoDB'` +--let $wait_timeout= 600 +--let $wait_condition=SELECT COUNT(*) = $tables_count FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0 AND ROTATING_OR_FLUSHING = 0; +--source include/wait_condition.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; + +--echo # Success! + +SELECT * from t1; + +--echo # Now turn off encryption and wait for threads to decrypt all tablespaces +SET GLOBAL innodb_encrypt_tables = off; + +--let $wait_condition=SELECT COUNT(*) = $tables_count FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0 AND ROTATING_OR_FLUSHING = 0; +--source include/wait_condition.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; + +--echo # Success! + +--echo +--echo # Restart server with no encryption setup, there should be no crashes +--let $restart_parameters=--skip-file-key-management --innodb-encrypt-tables=OFF --innodb-encryption-threads=0 --innodb-tablespaces-encryption +-- source include/restart_mysqld.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; + +SELECT * from t1; +DROP TABLE t1; + diff --git a/storage/innobase/fil/fil0crypt.cc b/storage/innobase/fil/fil0crypt.cc index 3095503cfc5..a9e887ad10c 100644 --- a/storage/innobase/fil/fil0crypt.cc +++ b/storage/innobase/fil/fil0crypt.cc @@ -1,6 +1,6 @@ /***************************************************************************** Copyright (C) 2013, 2015, Google Inc. All Rights Reserved. -Copyright (c) 2014, 2017, MariaDB Corporation. All Rights Reserved. +Copyright (c) 2014, 2018, 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 @@ -114,17 +114,17 @@ extern my_bool srv_background_scrub_data_compressed; /*********************************************************************** Check if a key needs rotation given a key_state -@param[in] encrypt_mode Encryption mode +@param[in] crypt_data Encryption information @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, - uint key_version, - uint latest_key_version, - uint rotate_key_age) + const fil_space_crypt_t* crypt_data, + uint key_version, + uint latest_key_version, + uint rotate_key_age) MY_ATTRIBUTE((warn_unused_result)); /********************************************************************* @@ -187,7 +187,8 @@ fil_crypt_get_latest_key_version( if (crypt_data->is_key_found()) { - if (fil_crypt_needs_rotation(crypt_data->encryption, + if (fil_crypt_needs_rotation( + crypt_data, crypt_data->min_key_version, key_version, srv_fil_crypt_rotate_key_age)) { @@ -963,17 +964,17 @@ fil_crypt_get_key_state( /*********************************************************************** Check if a key needs rotation given a key_state -@param[in] encrypt_mode Encryption mode +@param[in] crypt_data Encryption information @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, - uint key_version, - uint latest_key_version, - uint rotate_key_age) + const fil_space_crypt_t* crypt_data, + uint key_version, + uint latest_key_version, + uint rotate_key_age) { if (key_version == ENCRYPTION_KEY_VERSION_INVALID) { return false; @@ -986,13 +987,20 @@ fil_crypt_needs_rotation( } if (latest_key_version == 0 && key_version != 0) { - if (encrypt_mode == FIL_ENCRYPTION_DEFAULT) { + if (crypt_data->encryption == FIL_ENCRYPTION_DEFAULT) { /* this is rotation encrypted => unencrypted */ return true; } return false; } + if (crypt_data->encryption == FIL_ENCRYPTION_DEFAULT + && crypt_data->type == CRYPT_SCHEME_1 + && srv_encrypt_tables == 0 ) { + /* This is rotation encrypted => unencrypted */ + return true; + } + /* this is rotation encrypted => encrypted, * only reencrypt if key is sufficiently old */ if (key_version + rotate_key_age < latest_key_version) { @@ -1272,9 +1280,10 @@ fil_crypt_space_needs_rotation( } bool need_key_rotation = fil_crypt_needs_rotation( - crypt_data->encryption, + crypt_data, crypt_data->min_key_version, - key_state->key_version, key_state->rotate_key_age); + key_state->key_version, + key_state->rotate_key_age); crypt_data->rotate_state.scrubbing.is_active = btr_scrub_start_space(space->id, &state->scrub_data); @@ -1862,9 +1871,10 @@ fil_crypt_rotate_page( ut_ad(kv == 0); ut_ad(page_get_space_id(frame) == 0); } else if (fil_crypt_needs_rotation( - crypt_data->encryption, - kv, key_state->key_version, - key_state->rotate_key_age)) { + crypt_data, + kv, + key_state->key_version, + key_state->rotate_key_age)) { modified = true; diff --git a/storage/xtradb/fil/fil0crypt.cc b/storage/xtradb/fil/fil0crypt.cc index 3095503cfc5..a9e887ad10c 100644 --- a/storage/xtradb/fil/fil0crypt.cc +++ b/storage/xtradb/fil/fil0crypt.cc @@ -1,6 +1,6 @@ /***************************************************************************** Copyright (C) 2013, 2015, Google Inc. All Rights Reserved. -Copyright (c) 2014, 2017, MariaDB Corporation. All Rights Reserved. +Copyright (c) 2014, 2018, 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 @@ -114,17 +114,17 @@ extern my_bool srv_background_scrub_data_compressed; /*********************************************************************** Check if a key needs rotation given a key_state -@param[in] encrypt_mode Encryption mode +@param[in] crypt_data Encryption information @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, - uint key_version, - uint latest_key_version, - uint rotate_key_age) + const fil_space_crypt_t* crypt_data, + uint key_version, + uint latest_key_version, + uint rotate_key_age) MY_ATTRIBUTE((warn_unused_result)); /********************************************************************* @@ -187,7 +187,8 @@ fil_crypt_get_latest_key_version( if (crypt_data->is_key_found()) { - if (fil_crypt_needs_rotation(crypt_data->encryption, + if (fil_crypt_needs_rotation( + crypt_data, crypt_data->min_key_version, key_version, srv_fil_crypt_rotate_key_age)) { @@ -963,17 +964,17 @@ fil_crypt_get_key_state( /*********************************************************************** Check if a key needs rotation given a key_state -@param[in] encrypt_mode Encryption mode +@param[in] crypt_data Encryption information @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, - uint key_version, - uint latest_key_version, - uint rotate_key_age) + const fil_space_crypt_t* crypt_data, + uint key_version, + uint latest_key_version, + uint rotate_key_age) { if (key_version == ENCRYPTION_KEY_VERSION_INVALID) { return false; @@ -986,13 +987,20 @@ fil_crypt_needs_rotation( } if (latest_key_version == 0 && key_version != 0) { - if (encrypt_mode == FIL_ENCRYPTION_DEFAULT) { + if (crypt_data->encryption == FIL_ENCRYPTION_DEFAULT) { /* this is rotation encrypted => unencrypted */ return true; } return false; } + if (crypt_data->encryption == FIL_ENCRYPTION_DEFAULT + && crypt_data->type == CRYPT_SCHEME_1 + && srv_encrypt_tables == 0 ) { + /* This is rotation encrypted => unencrypted */ + return true; + } + /* this is rotation encrypted => encrypted, * only reencrypt if key is sufficiently old */ if (key_version + rotate_key_age < latest_key_version) { @@ -1272,9 +1280,10 @@ fil_crypt_space_needs_rotation( } bool need_key_rotation = fil_crypt_needs_rotation( - crypt_data->encryption, + crypt_data, crypt_data->min_key_version, - key_state->key_version, key_state->rotate_key_age); + key_state->key_version, + key_state->rotate_key_age); crypt_data->rotate_state.scrubbing.is_active = btr_scrub_start_space(space->id, &state->scrub_data); @@ -1862,9 +1871,10 @@ fil_crypt_rotate_page( ut_ad(kv == 0); ut_ad(page_get_space_id(frame) == 0); } else if (fil_crypt_needs_rotation( - crypt_data->encryption, - kv, key_state->key_version, - key_state->rotate_key_age)) { + crypt_data, + kv, + key_state->key_version, + key_state->rotate_key_age)) { modified = true; -- cgit v1.2.1 From 8325d71f6c990e18ca93be64ea23f2d8ec878b3d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Fri, 6 Apr 2018 13:10:01 +0300 Subject: Fix a compilation error --- storage/innobase/log/log0log.cc | 3 ++- storage/xtradb/log/log0log.cc | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/storage/innobase/log/log0log.cc b/storage/innobase/log/log0log.cc index 97459cfffb2..9f0e129e320 100644 --- a/storage/innobase/log/log0log.cc +++ b/storage/innobase/log/log0log.cc @@ -1445,7 +1445,8 @@ log_write_up_to( if (srv_shutdown_state != SRV_SHUTDOWN_NONE) { service_manager_extend_timeout(INNODB_EXTEND_TIMEOUT_INTERVAL, - "log write up to: " LSNPF, lsn); + "log write up to: " LSN_PF, + lsn); } loop: diff --git a/storage/xtradb/log/log0log.cc b/storage/xtradb/log/log0log.cc index 6acafeb4dab..1ec2831f3e2 100644 --- a/storage/xtradb/log/log0log.cc +++ b/storage/xtradb/log/log0log.cc @@ -1563,7 +1563,8 @@ log_write_up_to( if (srv_shutdown_state != SRV_SHUTDOWN_NONE) { service_manager_extend_timeout(INNODB_EXTEND_TIMEOUT_INTERVAL, - "log write up to: " LSNPF, lsn); + "log write up to: " LSN_PF, + lsn); } loop: -- cgit v1.2.1 From 7925cdff6be3f7c4b024842452ec906d45e2387e Mon Sep 17 00:00:00 2001 From: Daniele Sciascia Date: Fri, 6 Apr 2018 14:59:16 +0200 Subject: MDEV-13549 Fix test galera.galera_wsrep_desync_wsrep_on The test tends to fail if many parallel instances of it are executed: ``` mysqltest: At line 23: query 'ALTER TABLE t1 ADD PRIMARY KEY (f1)' failed: 1317: Query execution was interrupted ``` The `ALTER` fails because it is BF aborted due to an earlier `INSERT SELECT` that is being applied: ``` INSERT INTO t1 (f1) SELECT ... --connection node_2 SET GLOBAL wsrep_desync = TRUE; SET SESSION wsrep_on = FALSE; ALTER TABLE t1 ADD PRIMARY KEY (f1); SET SESSION wsrep_on = TRUE; SET GLOBAL wsrep_desync = FALSE; ``` And because the `ALTER` is executed with `wsrep_on = OFF`, it does not run in total order isolation. To avoid the problem it must be ensured that the `ALTER` only after the large `INSERT SELECT` is done. To do so it is sufficient to issue `SELECT COUNT(*) FROM t1;` from `node_2` before turning off wsrep. The `SELECT` will trigger `wsrep_sync_wait` and proceed only after the `INSERT SELECT` from node_1 is done. --- mysql-test/suite/galera/r/galera_wsrep_desync_wsrep_on.result | 3 +++ mysql-test/suite/galera/t/galera_wsrep_desync_wsrep_on.test | 2 ++ 2 files changed, 5 insertions(+) diff --git a/mysql-test/suite/galera/r/galera_wsrep_desync_wsrep_on.result b/mysql-test/suite/galera/r/galera_wsrep_desync_wsrep_on.result index 06fc27ae7ed..5bde4874809 100644 --- a/mysql-test/suite/galera/r/galera_wsrep_desync_wsrep_on.result +++ b/mysql-test/suite/galera/r/galera_wsrep_desync_wsrep_on.result @@ -2,6 +2,9 @@ CREATE TABLE ten (f1 INTEGER); INSERT INTO ten VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); CREATE TABLE t1 (f1 INTEGER) Engine=InnoDB; INSERT INTO t1 (f1) SELECT 000000 + (10000 * a1.f1) + (1000 * a2.f1) + (100 * a3.f1) + (10 * a4.f1) + a5.f1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4, ten AS a5; +SELECT COUNT(*) = 100000 FROM t1; +COUNT(*) = 100000 +1 SET GLOBAL wsrep_desync = TRUE; SET SESSION wsrep_on = FALSE; ALTER TABLE t1 ADD PRIMARY KEY (f1); diff --git a/mysql-test/suite/galera/t/galera_wsrep_desync_wsrep_on.test b/mysql-test/suite/galera/t/galera_wsrep_desync_wsrep_on.test index 3c7988a4924..ecf255f59c3 100644 --- a/mysql-test/suite/galera/t/galera_wsrep_desync_wsrep_on.test +++ b/mysql-test/suite/galera/t/galera_wsrep_desync_wsrep_on.test @@ -17,6 +17,8 @@ CREATE TABLE t1 (f1 INTEGER) Engine=InnoDB; INSERT INTO t1 (f1) SELECT 000000 + (10000 * a1.f1) + (1000 * a2.f1) + (100 * a3.f1) + (10 * a4.f1) + a5.f1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4, ten AS a5; --connection node_2 +SELECT COUNT(*) = 100000 FROM t1; + SET GLOBAL wsrep_desync = TRUE; SET SESSION wsrep_on = FALSE; -- cgit v1.2.1 From c0b781d25eed2903433fdd33ebd1d2dc2030303a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= Date: Fri, 6 Apr 2018 16:33:41 +0300 Subject: Disable test galera_var_auto_inc_control_on as it fails. --- mysql-test/suite/galera/disabled.def | 1 + .../suite/galera/r/galera_var_auto_inc_control_on.result | 12 ++++++++++++ .../suite/galera/t/galera_var_auto_inc_control_on.test | 9 +++++++++ 3 files changed, 22 insertions(+) diff --git a/mysql-test/suite/galera/disabled.def b/mysql-test/suite/galera/disabled.def index 96cafe25fba..a21b4212cb6 100644 --- a/mysql-test/suite/galera/disabled.def +++ b/mysql-test/suite/galera/disabled.def @@ -27,3 +27,4 @@ galera_ist_mysqldump : MDEV-13549 Galera test failures galera_ssl_upgrade : MDEV-13549 Galera test failures galera.MW-329 : wsrep_local_replays not stable galera.MW-328A : have_deadlocks test not stable +galera_var_retry_autocommit: MDEV-15794 Test failure on galera.galera_var_retry_autocommit diff --git a/mysql-test/suite/galera/r/galera_var_auto_inc_control_on.result b/mysql-test/suite/galera/r/galera_var_auto_inc_control_on.result index c1bb065975b..0cbba2fa124 100644 --- a/mysql-test/suite/galera/r/galera_var_auto_inc_control_on.result +++ b/mysql-test/suite/galera/r/galera_var_auto_inc_control_on.result @@ -1,4 +1,10 @@ CREATE TABLE t1 (f1 INTEGER AUTO_INCREMENT PRIMARY KEY, node VARCHAR(10)) ENGINE=InnoDB; +SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +VARIABLE_VALUE +2 +SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_index'; +VARIABLE_VALUE +0 SELECT @@auto_increment_increment = (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'); @@auto_increment_increment = (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size') 1 @@ -7,6 +13,12 @@ SELECT @@global.auto_increment_offset = (SELECT VARIABLE_VALUE FROM INFORMATION_ 1 INSERT INTO t1 VALUES (DEFAULT, 'node1');; INSERT INTO t1 VALUES (DEFAULT, 'node2');; +SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +VARIABLE_VALUE +2 +SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_index'; +VARIABLE_VALUE +1 SELECT @@auto_increment_increment = (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'); @@auto_increment_increment = (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size') 1 diff --git a/mysql-test/suite/galera/t/galera_var_auto_inc_control_on.test b/mysql-test/suite/galera/t/galera_var_auto_inc_control_on.test index d65a35be4d1..6abaecb144b 100644 --- a/mysql-test/suite/galera/t/galera_var_auto_inc_control_on.test +++ b/mysql-test/suite/galera/t/galera_var_auto_inc_control_on.test @@ -5,6 +5,11 @@ --source include/galera_cluster.inc --source include/have_innodb.inc +# Save original auto_increment_offset values. +--let $node_1=node_1 +--let $node_2=node_2 +--source include/auto_increment_offset_save.inc + --connection node_1 CREATE TABLE t1 (f1 INTEGER AUTO_INCREMENT PRIMARY KEY, node VARCHAR(10)) ENGINE=InnoDB; @@ -12,6 +17,8 @@ CREATE TABLE t1 (f1 INTEGER AUTO_INCREMENT PRIMARY KEY, node VARCHAR(10)) ENGINE # auto_increment_increment is equal to the number of nodes # auto_increment_offset is equal to the ID of the node +SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_index'; SELECT @@auto_increment_increment = (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'); SELECT @@global.auto_increment_offset = (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_index') + 1; @@ -27,6 +34,8 @@ SELECT @@global.auto_increment_offset = (SELECT VARIABLE_VALUE FROM INFORMATION_ --connection node_2 --reap +SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_index'; SELECT @@auto_increment_increment = (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'); SELECT @@global.auto_increment_offset = (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_index') + 1; -- cgit v1.2.1 From 4ede2fec4cb7165a469776bfdbf247db86acb297 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= Date: Sat, 7 Apr 2018 08:52:24 +0300 Subject: Disable galera_var_auto_inc_control_on test. --- mysql-test/suite/galera/disabled.def | 2 ++ mysql-test/suite/galera/t/galera_var_auto_inc_control_on.opt | 1 + 2 files changed, 3 insertions(+) create mode 100644 mysql-test/suite/galera/t/galera_var_auto_inc_control_on.opt diff --git a/mysql-test/suite/galera/disabled.def b/mysql-test/suite/galera/disabled.def index a21b4212cb6..105c5a0cbbe 100644 --- a/mysql-test/suite/galera/disabled.def +++ b/mysql-test/suite/galera/disabled.def @@ -28,3 +28,5 @@ galera_ssl_upgrade : MDEV-13549 Galera test failures galera.MW-329 : wsrep_local_replays not stable galera.MW-328A : have_deadlocks test not stable galera_var_retry_autocommit: MDEV-15794 Test failure on galera.galera_var_retry_autocommit +galera_var_auto_inc_control_on: MDEV-15803 Test failure on galera.galera_var_auto_inc_control_on + diff --git a/mysql-test/suite/galera/t/galera_var_auto_inc_control_on.opt b/mysql-test/suite/galera/t/galera_var_auto_inc_control_on.opt new file mode 100644 index 00000000000..0a03610888c --- /dev/null +++ b/mysql-test/suite/galera/t/galera_var_auto_inc_control_on.opt @@ -0,0 +1 @@ +--wsrep-auto-increment-control=ON -- cgit v1.2.1 From d9c85ee45a5b33ff823d8db1261d21426e89dfb0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Sat, 7 Apr 2018 19:52:35 +0300 Subject: MDEV-15752 Possible race between DDL and accessing I_S.INNODB_TABLESPACES_ENCRYPTION fil_crypt_read_crypt_data(): Do not attempt to read the tablespace if the file is unaccessible due to a pending DDL operation, such as renaming the file or DROP TABLE or TRUNCATE TABLE. This is only reducing the probability of the race condition, not completely preventing it. --- storage/innobase/fil/fil0crypt.cc | 11 +++++++++-- storage/xtradb/fil/fil0crypt.cc | 11 +++++++++-- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/storage/innobase/fil/fil0crypt.cc b/storage/innobase/fil/fil0crypt.cc index a9e887ad10c..cb499121c86 100644 --- a/storage/innobase/fil/fil0crypt.cc +++ b/storage/innobase/fil/fil0crypt.cc @@ -1016,10 +1016,17 @@ static inline void fil_crypt_read_crypt_data(fil_space_t* space) { - if (space->crypt_data || space->size) { + if (space->crypt_data || space->size + || !fil_space_get_size(space->id)) { /* The encryption metadata has already been read, or the tablespace is not encrypted and the file has been - opened already. */ + opened already, or the file cannot be accessed, + likely due to a concurrent TRUNCATE or + RENAME or DROP (possibly as part of ALTER TABLE). + FIXME: The file can become unaccessible any time + after this check! We should really remove this + function and instead make crypt_data an integral + part of fil_space_t. */ return; } diff --git a/storage/xtradb/fil/fil0crypt.cc b/storage/xtradb/fil/fil0crypt.cc index a9e887ad10c..cb499121c86 100644 --- a/storage/xtradb/fil/fil0crypt.cc +++ b/storage/xtradb/fil/fil0crypt.cc @@ -1016,10 +1016,17 @@ static inline void fil_crypt_read_crypt_data(fil_space_t* space) { - if (space->crypt_data || space->size) { + if (space->crypt_data || space->size + || !fil_space_get_size(space->id)) { /* The encryption metadata has already been read, or the tablespace is not encrypted and the file has been - opened already. */ + opened already, or the file cannot be accessed, + likely due to a concurrent TRUNCATE or + RENAME or DROP (possibly as part of ALTER TABLE). + FIXME: The file can become unaccessible any time + after this check! We should really remove this + function and instead make crypt_data an integral + part of fil_space_t. */ return; } -- cgit v1.2.1 From c4b1a57b131e767955aaf85170039977200c050d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= Date: Sun, 8 Apr 2018 08:24:36 +0300 Subject: MDEV-13549: Galera test failures Disable occasionally failing test cases pxc-421 query_cache galera_parallel_simple --- mysql-test/suite/galera/disabled.def | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/mysql-test/suite/galera/disabled.def b/mysql-test/suite/galera/disabled.def index 105c5a0cbbe..3388d2328ca 100644 --- a/mysql-test/suite/galera/disabled.def +++ b/mysql-test/suite/galera/disabled.def @@ -27,6 +27,8 @@ galera_ist_mysqldump : MDEV-13549 Galera test failures galera_ssl_upgrade : MDEV-13549 Galera test failures galera.MW-329 : wsrep_local_replays not stable galera.MW-328A : have_deadlocks test not stable -galera_var_retry_autocommit: MDEV-15794 Test failure on galera.galera_var_retry_autocommit -galera_var_auto_inc_control_on: MDEV-15803 Test failure on galera.galera_var_auto_inc_control_on - +galera_var_retry_autocommit : MDEV-15794 Test failure on galera.galera_var_retry_autocommit +galera_var_auto_inc_control_on : MDEV-15803 Test failure on galera.galera_var_auto_inc_control_on +pxc-421 : MDEV-15804 Test failure on galera.pxc-421 +query_cache : MDEV-15805 Test failure on galera.query_cache +galera_parallel_simple : MDEV-15806 Test failure on galera.galera_parallel_simple \ No newline at end of file -- cgit v1.2.1 From 1568950a7d0d4f184af6a8779d820d0100170529 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= Date: Sun, 8 Apr 2018 09:03:55 +0300 Subject: MDEV-15806: Test failure on galera.galera_parallel_simple Make sure DDL's (create tables) are replicated before continuing to lock table. --- mysql-test/suite/galera/disabled.def | 1 - mysql-test/suite/galera/r/galera_parallel_simple.result | 4 ++++ mysql-test/suite/galera/t/galera_parallel_simple.test | 7 +++++++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/mysql-test/suite/galera/disabled.def b/mysql-test/suite/galera/disabled.def index 3388d2328ca..cfee87d9686 100644 --- a/mysql-test/suite/galera/disabled.def +++ b/mysql-test/suite/galera/disabled.def @@ -31,4 +31,3 @@ galera_var_retry_autocommit : MDEV-15794 Test failure on galera.galera_var_retry galera_var_auto_inc_control_on : MDEV-15803 Test failure on galera.galera_var_auto_inc_control_on pxc-421 : MDEV-15804 Test failure on galera.pxc-421 query_cache : MDEV-15805 Test failure on galera.query_cache -galera_parallel_simple : MDEV-15806 Test failure on galera.galera_parallel_simple \ No newline at end of file diff --git a/mysql-test/suite/galera/r/galera_parallel_simple.result b/mysql-test/suite/galera/r/galera_parallel_simple.result index 3b10815c63d..0b19ef7da8f 100644 --- a/mysql-test/suite/galera/r/galera_parallel_simple.result +++ b/mysql-test/suite/galera/r/galera_parallel_simple.result @@ -1,6 +1,10 @@ CREATE TABLE t1 (id INT) ENGINE=InnoDB; CREATE TABLE t2 (id INT) ENGINE=InnoDB; SET GLOBAL wsrep_slave_threads = 2; +SELECT NAME FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE NAME LIKE 'test/t%'; +NAME +test/t1 +test/t2 LOCK TABLE t1 WRITE; INSERT INTO t1 VALUES (1); INSERT INTO t2 VALUES (1); diff --git a/mysql-test/suite/galera/t/galera_parallel_simple.test b/mysql-test/suite/galera/t/galera_parallel_simple.test index 41cd0c8e6fa..2cd840123cf 100644 --- a/mysql-test/suite/galera/t/galera_parallel_simple.test +++ b/mysql-test/suite/galera/t/galera_parallel_simple.test @@ -13,6 +13,13 @@ CREATE TABLE t2 (id INT) ENGINE=InnoDB; --connection node_2 SET GLOBAL wsrep_slave_threads = 2; + +# Wait until above DDL's are replicated +--let $wait_condition = SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE NAME LIKE 'test/t%'; +--source include/wait_condition.inc + +SELECT NAME FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE NAME LIKE 'test/t%'; + LOCK TABLE t1 WRITE; --connection node_1 -- cgit v1.2.1 From 8bb40f2404909fc9c8070008f8a6e86180f2d74b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= Date: Sun, 8 Apr 2018 13:04:38 +0300 Subject: MDEV-13549: Galera test failures Disable more occasionally failing test cases. galera.galera_lock_table galera.galera_gra_log galera.MW-44 galera.lp1376747 galera.lp1376747-2 galera.galera_pc_ignore_sb --- mysql-test/suite/galera/disabled.def | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/mysql-test/suite/galera/disabled.def b/mysql-test/suite/galera/disabled.def index cfee87d9686..13bb2d01ffb 100644 --- a/mysql-test/suite/galera/disabled.def +++ b/mysql-test/suite/galera/disabled.def @@ -31,3 +31,10 @@ galera_var_retry_autocommit : MDEV-15794 Test failure on galera.galera_var_retry galera_var_auto_inc_control_on : MDEV-15803 Test failure on galera.galera_var_auto_inc_control_on pxc-421 : MDEV-15804 Test failure on galera.pxc-421 query_cache : MDEV-15805 Test failure on galera.query_cache +galera.galera_lock_table : MDEV-15807 +galera.galera_gra_log : MDEV-15808 Test failure on galera.galera_gra_log +galera.MW-44 : MDEV-15809 Test failure on galera.MW-44 +galera.lp1376747 : MDEV-15810 Test failure on galera.lp1376747 +galera.lp1376747-2 : MDEV-15810 Test failure on galera.lp1376747-2 +galera.galera_pc_ignore_sb : MDEV-15811 Test failure on galera_pc_ignore_sb + -- cgit v1.2.1 From 767d6ce38cafd735aa70fcd6d6e4fa682d5548af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= Date: Mon, 9 Apr 2018 07:28:13 +0300 Subject: MDEV-15807: Test failure on galera.galera_lock_table Wait until create tables are replicated to the slave before trying lock table. --- mysql-test/suite/galera/disabled.def | 1 - mysql-test/suite/galera/r/galera_lock_table.result | 4 ++++ mysql-test/suite/galera/t/galera_lock_table.test | 7 +++++++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/mysql-test/suite/galera/disabled.def b/mysql-test/suite/galera/disabled.def index 13bb2d01ffb..4861223ba4b 100644 --- a/mysql-test/suite/galera/disabled.def +++ b/mysql-test/suite/galera/disabled.def @@ -31,7 +31,6 @@ galera_var_retry_autocommit : MDEV-15794 Test failure on galera.galera_var_retry galera_var_auto_inc_control_on : MDEV-15803 Test failure on galera.galera_var_auto_inc_control_on pxc-421 : MDEV-15804 Test failure on galera.pxc-421 query_cache : MDEV-15805 Test failure on galera.query_cache -galera.galera_lock_table : MDEV-15807 galera.galera_gra_log : MDEV-15808 Test failure on galera.galera_gra_log galera.MW-44 : MDEV-15809 Test failure on galera.MW-44 galera.lp1376747 : MDEV-15810 Test failure on galera.lp1376747 diff --git a/mysql-test/suite/galera/r/galera_lock_table.result b/mysql-test/suite/galera/r/galera_lock_table.result index 16e9037a4de..0d40ac16565 100644 --- a/mysql-test/suite/galera/r/galera_lock_table.result +++ b/mysql-test/suite/galera/r/galera_lock_table.result @@ -1,5 +1,9 @@ CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB; CREATE TABLE t2 (id INT PRIMARY KEY) ENGINE=InnoDB; +SELECT NAME FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE NAME LIKE 'test/t%'; +NAME +test/t1 +test/t2 LOCK TABLE t1 READ; INSERT INTO t1 VALUES (1); INSERT INTO t2 VALUES (1); diff --git a/mysql-test/suite/galera/t/galera_lock_table.test b/mysql-test/suite/galera/t/galera_lock_table.test index bd581842f6f..2745bfe5faf 100644 --- a/mysql-test/suite/galera/t/galera_lock_table.test +++ b/mysql-test/suite/galera/t/galera_lock_table.test @@ -12,6 +12,13 @@ CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB; CREATE TABLE t2 (id INT PRIMARY KEY) ENGINE=InnoDB; --connection node_2 + +# Wait until above DDL's are replicated +--let $wait_condition = SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE NAME LIKE 'test/t%'; +--source include/wait_condition.inc + +SELECT NAME FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE NAME LIKE 'test/t%'; + LOCK TABLE t1 READ; --connection node_1 -- cgit v1.2.1 From fe61e287e952e47c9a2c317790b8e9324c5051b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= Date: Mon, 9 Apr 2018 07:49:00 +0300 Subject: MDEV-15810: Test failure on galera.lp1376747 and galera.lp1376747-2 Wait until create table is replicated before continuing. --- mysql-test/suite/galera/disabled.def | 2 -- mysql-test/suite/galera/r/lp1376747-2.result | 3 +++ mysql-test/suite/galera/r/lp1376747.result | 3 +++ mysql-test/suite/galera/t/lp1376747-2.test | 7 +++++++ mysql-test/suite/galera/t/lp1376747.test | 7 +++++++ 5 files changed, 20 insertions(+), 2 deletions(-) diff --git a/mysql-test/suite/galera/disabled.def b/mysql-test/suite/galera/disabled.def index 4861223ba4b..f8929bbe65f 100644 --- a/mysql-test/suite/galera/disabled.def +++ b/mysql-test/suite/galera/disabled.def @@ -33,7 +33,5 @@ pxc-421 : MDEV-15804 Test failure on galera.pxc-421 query_cache : MDEV-15805 Test failure on galera.query_cache galera.galera_gra_log : MDEV-15808 Test failure on galera.galera_gra_log galera.MW-44 : MDEV-15809 Test failure on galera.MW-44 -galera.lp1376747 : MDEV-15810 Test failure on galera.lp1376747 -galera.lp1376747-2 : MDEV-15810 Test failure on galera.lp1376747-2 galera.galera_pc_ignore_sb : MDEV-15811 Test failure on galera_pc_ignore_sb diff --git a/mysql-test/suite/galera/r/lp1376747-2.result b/mysql-test/suite/galera/r/lp1376747-2.result index 3b8aee61ed2..0c91e10acd7 100644 --- a/mysql-test/suite/galera/r/lp1376747-2.result +++ b/mysql-test/suite/galera/r/lp1376747-2.result @@ -1,5 +1,8 @@ CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB; INSERT INTO t1 VALUES (1); +SELECT NAME FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE NAME LIKE 'test/t%'; +NAME +test/t1 FLUSH TABLES t1 FOR EXPORT; ALTER TABLE t1 ADD COLUMN f2 INTEGER; INSERT INTO t1 VALUES (2,3); diff --git a/mysql-test/suite/galera/r/lp1376747.result b/mysql-test/suite/galera/r/lp1376747.result index 4617d5952bb..ec6c4a6e6f4 100644 --- a/mysql-test/suite/galera/r/lp1376747.result +++ b/mysql-test/suite/galera/r/lp1376747.result @@ -1,5 +1,8 @@ CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB; INSERT INTO t1 VALUES (1); +SELECT NAME FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE NAME LIKE 'test/t%'; +NAME +test/t1 FLUSH TABLES t1 WITH READ LOCK; ALTER TABLE t1 ADD COLUMN f2 INTEGER; INSERT INTO t1 VALUES (2,3); diff --git a/mysql-test/suite/galera/t/lp1376747-2.test b/mysql-test/suite/galera/t/lp1376747-2.test index 360681d7674..c570dd7d143 100644 --- a/mysql-test/suite/galera/t/lp1376747-2.test +++ b/mysql-test/suite/galera/t/lp1376747-2.test @@ -5,6 +5,13 @@ CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB; INSERT INTO t1 VALUES (1); --connection node_2 + +# Wait until above DDL's are replicated +--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE NAME LIKE 'test/t%'; +--source include/wait_condition.inc + +SELECT NAME FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE NAME LIKE 'test/t%'; + FLUSH TABLES t1 FOR EXPORT; --connection node_1 diff --git a/mysql-test/suite/galera/t/lp1376747.test b/mysql-test/suite/galera/t/lp1376747.test index 769bb665c77..7daa544686f 100644 --- a/mysql-test/suite/galera/t/lp1376747.test +++ b/mysql-test/suite/galera/t/lp1376747.test @@ -5,6 +5,13 @@ CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB; INSERT INTO t1 VALUES (1); --connection node_2 + +# Wait until above DDL's are replicated +--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE NAME LIKE 'test/t%'; +--source include/wait_condition.inc + +SELECT NAME FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE NAME LIKE 'test/t%'; + FLUSH TABLES t1 WITH READ LOCK; --connection node_1 -- cgit v1.2.1 From 803ded51484255aa0c3201aebecfe45e11482653 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= Date: Mon, 9 Apr 2018 14:43:32 +0300 Subject: MDEV-13549: Galera test failures Disable occasionally failing test case galera.galera_var_slave_threads. --- mysql-test/suite/galera/disabled.def | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mysql-test/suite/galera/disabled.def b/mysql-test/suite/galera/disabled.def index f8929bbe65f..69b7e6bfde1 100644 --- a/mysql-test/suite/galera/disabled.def +++ b/mysql-test/suite/galera/disabled.def @@ -34,4 +34,4 @@ query_cache : MDEV-15805 Test failure on galera.query_cache galera.galera_gra_log : MDEV-15808 Test failure on galera.galera_gra_log galera.MW-44 : MDEV-15809 Test failure on galera.MW-44 galera.galera_pc_ignore_sb : MDEV-15811 Test failure on galera_pc_ignore_sb - +galera.galera_var_slave_threads : MDEV-15785 Test failure on galera.galera_var_slave_threads -- cgit v1.2.1 From 8ff897265a32898dd533c8da504937872ffa3935 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vicen=C8=9Biu=20Ciorbaru?= Date: Mon, 9 Apr 2018 16:49:41 +0300 Subject: Update test cases post MDEV-10286 Table_open_cache gets adjusted on server startup to prevent an out of file descriptor error. However this means that when we reset its value to default, it does not get re-adjusted. This leads to the mtr consistency check to fail with different server status at the end of the test case as opposed to when it started. To fix the problem, do not make use of the DEFAULT keyword to set the variable back, instead save the value before any modifications and restore it from there. --- mysql-test/r/myisam.result | 3 ++- mysql-test/r/myisam_recover.result | 3 ++- mysql-test/r/variables.result | 3 ++- mysql-test/t/myisam.test | 3 ++- mysql-test/t/myisam_recover.test | 3 ++- mysql-test/t/variables.test | 3 ++- 6 files changed, 12 insertions(+), 6 deletions(-) diff --git a/mysql-test/r/myisam.result b/mysql-test/r/myisam.result index 0f865c151fa..3af64bbd0de 100644 --- a/mysql-test/r/myisam.result +++ b/mysql-test/r/myisam.result @@ -1906,6 +1906,7 @@ DROP TABLE t1; # # BUG#48438 - crash with error in unioned query against merge table and view... # +SET @save_table_open_cache=@@table_open_cache; SET GLOBAL table_open_cache=10; CREATE TABLE t1(a INT); SELECT 1 FROM t1 AS a1, t1 AS a2, t1 AS a3, t1 AS a4, t1 AS a5, t1 AS a6, t1 AS a7, t1 AS a8, t1 AS a9, t1 AS a10, t1 AS a11 FOR UPDATE; @@ -1915,7 +1916,7 @@ WHERE TABLE_SCHEMA='test' AND TABLE_NAME='t1'; TABLE_ROWS DATA_LENGTH 0 0 DROP TABLE t1; -SET GLOBAL table_open_cache=DEFAULT; +SET GLOBAL table_open_cache=@save_table_open_cache; End of 5.0 tests create table t1 (a int not null, key `a` (a) key_block_size=1024); show create table t1; diff --git a/mysql-test/r/myisam_recover.result b/mysql-test/r/myisam_recover.result index 0829c1e8b82..6ae282cb2b6 100644 --- a/mysql-test/r/myisam_recover.result +++ b/mysql-test/r/myisam_recover.result @@ -18,6 +18,7 @@ call mtr.add_suppression("Got an error from thread_id=.*ha_myisam.cc:"); call mtr.add_suppression("MySQL thread id .*, query id .* localhost.*root Checking table"); call mtr.add_suppression(" '\..test.t1'"); +set @save_table_open_cache=@@table_open_cache; set global table_open_cache=256; set global table_definition_cache=400; drop procedure if exists p_create; @@ -102,7 +103,7 @@ prepare stmt from @drop_table_stmt; execute stmt; deallocate prepare stmt; set @@global.table_definition_cache=default; -set @@global.table_open_cache=default; +set @@global.table_open_cache=@save_table_open_cache; # # 18075170 - sql node restart required to avoid deadlock after # restore diff --git a/mysql-test/r/variables.result b/mysql-test/r/variables.result index a01c8f48a4d..df0d16237ac 100644 --- a/mysql-test/r/variables.result +++ b/mysql-test/r/variables.result @@ -568,6 +568,7 @@ set sql_safe_updates=1; set sql_select_limit=1; set sql_select_limit=default; set sql_warnings=1; +set @save_table_open_cache=@@table_open_cache; set global table_open_cache=100; set default_storage_engine=myisam; set global thread_cache_size=100; @@ -752,7 +753,7 @@ table_open_cache 10 SELECT * FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME LIKE 'table_open_cache'; VARIABLE_NAME VARIABLE_VALUE TABLE_OPEN_CACHE 10 -SET GLOBAL table_open_cache=DEFAULT; +SET GLOBAL table_open_cache=@save_table_open_cache; set character_set_results=NULL; select ifnull(@@character_set_results,"really null"); ifnull(@@character_set_results,"really null") diff --git a/mysql-test/t/myisam.test b/mysql-test/t/myisam.test index 8c7ad012a65..cbf12d81cad 100644 --- a/mysql-test/t/myisam.test +++ b/mysql-test/t/myisam.test @@ -1216,13 +1216,14 @@ DROP TABLE t1; --echo # --echo # BUG#48438 - crash with error in unioned query against merge table and view... --echo # +SET @save_table_open_cache=@@table_open_cache; SET GLOBAL table_open_cache=10; CREATE TABLE t1(a INT); SELECT 1 FROM t1 AS a1, t1 AS a2, t1 AS a3, t1 AS a4, t1 AS a5, t1 AS a6, t1 AS a7, t1 AS a8, t1 AS a9, t1 AS a10, t1 AS a11 FOR UPDATE; SELECT TABLE_ROWS, DATA_LENGTH FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test' AND TABLE_NAME='t1'; DROP TABLE t1; -SET GLOBAL table_open_cache=DEFAULT; +SET GLOBAL table_open_cache=@save_table_open_cache; --echo End of 5.0 tests diff --git a/mysql-test/t/myisam_recover.test b/mysql-test/t/myisam_recover.test index 49fe9c33460..670dfd1aa49 100644 --- a/mysql-test/t/myisam_recover.test +++ b/mysql-test/t/myisam_recover.test @@ -24,6 +24,7 @@ call mtr.add_suppression("Got an error from thread_id=.*ha_myisam.cc:"); call mtr.add_suppression("MySQL thread id .*, query id .* localhost.*root Checking table"); call mtr.add_suppression(" '\..test.t1'"); +set @save_table_open_cache=@@table_open_cache; set global table_open_cache=256; set global table_definition_cache=400; --disable_warnings @@ -111,7 +112,7 @@ prepare stmt from @drop_table_stmt; execute stmt; deallocate prepare stmt; set @@global.table_definition_cache=default; -set @@global.table_open_cache=default; +set @@global.table_open_cache=@save_table_open_cache; disconnect con1; connection default; --enable_ps_protocol diff --git a/mysql-test/t/variables.test b/mysql-test/t/variables.test index 8f29528ac25..458327328e4 100644 --- a/mysql-test/t/variables.test +++ b/mysql-test/t/variables.test @@ -343,6 +343,7 @@ set sql_select_limit=1; # reset it, so later tests don't get confused set sql_select_limit=default; set sql_warnings=1; +set @save_table_open_cache=@@table_open_cache; set global table_open_cache=100; set default_storage_engine=myisam; set global thread_cache_size=100; @@ -502,7 +503,7 @@ SELECT * FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME LIKE 'MYI SET GLOBAL table_open_cache=-1; SHOW VARIABLES LIKE 'table_open_cache'; SELECT * FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME LIKE 'table_open_cache'; -SET GLOBAL table_open_cache=DEFAULT; +SET GLOBAL table_open_cache=@save_table_open_cache; # # Bugs12363: character_set_results is nullable, -- cgit v1.2.1 From 37f24806fc9c3ca5abdba9b986186cbe9f223a2a Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Mon, 9 Apr 2018 16:22:15 +0100 Subject: MDEV-15825 Mariabackup help mentions Percona and PXC but not MariaDB --- extra/mariabackup/innobackupex.cc | 2 +- extra/mariabackup/xtrabackup.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/extra/mariabackup/innobackupex.cc b/extra/mariabackup/innobackupex.cc index 7e97b258489..a134abb314d 100644 --- a/extra/mariabackup/innobackupex.cc +++ b/extra/mariabackup/innobackupex.cc @@ -255,7 +255,7 @@ static struct my_option ibx_long_options[] = {"galera-info", OPT_GALERA_INFO, "This options creates the " "xtrabackup_galera_info file which contains the local node state at " "the time of the backup. Option should be used when performing the " - "backup of Percona-XtraDB-Cluster. Has no effect when backup locks " + "backup of MariaDB Galera Cluster. Has no effect when backup locks " "are used to create the backup.", (uchar *) &opt_ibx_galera_info, (uchar *) &opt_ibx_galera_info, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, diff --git a/extra/mariabackup/xtrabackup.cc b/extra/mariabackup/xtrabackup.cc index b4931b5ebe7..478c31d0027 100644 --- a/extra/mariabackup/xtrabackup.cc +++ b/extra/mariabackup/xtrabackup.cc @@ -694,7 +694,7 @@ struct my_option xb_client_options[] = {"galera-info", OPT_GALERA_INFO, "This options creates the " "xtrabackup_galera_info file which contains the local node state at " "the time of the backup. Option should be used when performing the " - "backup of Percona-XtraDB-Cluster. Has no effect when backup locks " + "backup of MariaDB Galera Cluster. Has no effect when backup locks " "are used to create the backup.", (uchar *) &opt_galera_info, (uchar *) &opt_galera_info, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, -- cgit v1.2.1 From ecf6675cfc0a4394fd72f156ca1660e13232e2a6 Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Mon, 9 Apr 2018 19:16:50 +0100 Subject: MDEV-15713 mariabackup: throw warning, if --stream is used without --backup --- extra/mariabackup/xtrabackup.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/extra/mariabackup/xtrabackup.cc b/extra/mariabackup/xtrabackup.cc index 478c31d0027..02432dbb5b1 100644 --- a/extra/mariabackup/xtrabackup.cc +++ b/extra/mariabackup/xtrabackup.cc @@ -6699,6 +6699,10 @@ int main(int argc, char **argv) xtrabackup_incremental = NULL; } + if (xtrabackup_stream && !xtrabackup_backup) { + msg("Warning: --stream parameter is ignored, it only works together with --backup.\n"); + } + if (!xb_init()) { exit(EXIT_FAILURE); } -- cgit v1.2.1 From 8eff803a1bc9999fdf88607539f7b0af53cacbfa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Tue, 10 Apr 2018 08:29:29 +0300 Subject: Revert "MDEV-14705: Do not rollback on InnoDB shutdown" This reverts commit 76ec37f5225eda9f8a23760091bfb60287927715. This behaviour change will be done separately in: MDEV-15832 With innodb_fast_shutdown=3, skip the rollback of connected transactions --- storage/innobase/include/trx0roll.h | 9 ++++++--- storage/innobase/row/row0undo.cc | 9 ++------- storage/innobase/trx/trx0roll.cc | 17 +++++++++++++++-- storage/xtradb/include/trx0roll.h | 9 ++++++--- storage/xtradb/row/row0undo.cc | 9 ++------- storage/xtradb/trx/trx0roll.cc | 17 +++++++++++++++-- 6 files changed, 46 insertions(+), 24 deletions(-) diff --git a/storage/innobase/include/trx0roll.h b/storage/innobase/include/trx0roll.h index 09d6a6e8b4c..274a3b038ba 100644 --- a/storage/innobase/include/trx0roll.h +++ b/storage/innobase/include/trx0roll.h @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, 2018, MariaDB Corporation. +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 @@ -105,8 +105,11 @@ trx_undo_rec_release( /*=================*/ trx_t* trx, /*!< in/out: transaction */ undo_no_t undo_no);/*!< in: undo number */ -/** Report progress when rolling back a row of a recovered transaction. */ -UNIV_INTERN void trx_roll_report_progress(); +/** Report progress when rolling back a row of a recovered transaction. +@return whether the rollback should be aborted due to pending shutdown */ +UNIV_INTERN +bool +trx_roll_must_shutdown(); /*******************************************************************//** Rollback or clean up any incomplete transactions which were encountered in crash recovery. If the transaction already was diff --git a/storage/innobase/row/row0undo.cc b/storage/innobase/row/row0undo.cc index 5362e2f321d..552b99ab4d4 100644 --- a/storage/innobase/row/row0undo.cc +++ b/storage/innobase/row/row0undo.cc @@ -45,7 +45,6 @@ Created 1/8/1997 Heikki Tuuri #include "row0upd.h" #include "row0mysql.h" #include "srv0srv.h" -#include "srv0start.h" /* How to undo row operations? (1) For an insert, we have stored a prefix of the clustered index record @@ -350,17 +349,13 @@ row_undo_step( ut_ad(que_node_get_type(node) == QUE_NODE_UNDO); - if (UNIV_UNLIKELY(trx_get_dict_operation(trx) == TRX_DICT_OP_NONE - && !srv_undo_sources && srv_fast_shutdown)) { + if (UNIV_UNLIKELY(trx == trx_roll_crash_recv_trx) + && trx_roll_must_shutdown()) { /* Shutdown has been initiated. */ trx->error_state = DB_INTERRUPTED; return(NULL); } - if (UNIV_UNLIKELY(trx == trx_roll_crash_recv_trx)) { - trx_roll_report_progress(); - } - err = row_undo(node, thr); trx->error_state = err; diff --git a/storage/innobase/trx/trx0roll.cc b/storage/innobase/trx/trx0roll.cc index d91988d56cd..3fd71aff23a 100644 --- a/storage/innobase/trx/trx0roll.cc +++ b/storage/innobase/trx/trx0roll.cc @@ -719,9 +719,21 @@ fake_prepared: goto func_exit; } -/** Report progress when rolling back a row of a recovered transaction. */ -UNIV_INTERN void trx_roll_report_progress() +/** Report progress when rolling back a row of a recovered transaction. +@return whether the rollback should be aborted due to pending shutdown */ +UNIV_INTERN +bool +trx_roll_must_shutdown() { + const trx_t* trx = trx_roll_crash_recv_trx; + ut_ad(trx); + ut_ad(trx_state_eq(trx, TRX_STATE_ACTIVE)); + + if (trx_get_dict_operation(trx) == TRX_DICT_OP_NONE + && !srv_undo_sources && srv_fast_shutdown) { + return true; + } + ib_time_t time = ut_time(); mutex_enter(&trx_sys->mutex); mutex_enter(&recv_sys->mutex); @@ -755,6 +767,7 @@ UNIV_INTERN void trx_roll_report_progress() mutex_exit(&recv_sys->mutex); mutex_exit(&trx_sys->mutex); + return false; } /*******************************************************************//** diff --git a/storage/xtradb/include/trx0roll.h b/storage/xtradb/include/trx0roll.h index 248a2c78e1a..565079b17b4 100644 --- a/storage/xtradb/include/trx0roll.h +++ b/storage/xtradb/include/trx0roll.h @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, 2018, MariaDB Corporation. +Copyright (c) 2017, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -106,8 +106,11 @@ trx_undo_rec_release( /*=================*/ trx_t* trx, /*!< in/out: transaction */ undo_no_t undo_no);/*!< in: undo number */ -/** Report progress when rolling back a row of a recovered transaction. */ -UNIV_INTERN void trx_roll_report_progress(); +/** Report progress when rolling back a row of a recovered transaction. +@return whether the rollback should be aborted due to pending shutdown */ +UNIV_INTERN +bool +trx_roll_must_shutdown(); /*******************************************************************//** Rollback or clean up any incomplete transactions which were encountered in crash recovery. If the transaction already was diff --git a/storage/xtradb/row/row0undo.cc b/storage/xtradb/row/row0undo.cc index 5362e2f321d..552b99ab4d4 100644 --- a/storage/xtradb/row/row0undo.cc +++ b/storage/xtradb/row/row0undo.cc @@ -45,7 +45,6 @@ Created 1/8/1997 Heikki Tuuri #include "row0upd.h" #include "row0mysql.h" #include "srv0srv.h" -#include "srv0start.h" /* How to undo row operations? (1) For an insert, we have stored a prefix of the clustered index record @@ -350,17 +349,13 @@ row_undo_step( ut_ad(que_node_get_type(node) == QUE_NODE_UNDO); - if (UNIV_UNLIKELY(trx_get_dict_operation(trx) == TRX_DICT_OP_NONE - && !srv_undo_sources && srv_fast_shutdown)) { + if (UNIV_UNLIKELY(trx == trx_roll_crash_recv_trx) + && trx_roll_must_shutdown()) { /* Shutdown has been initiated. */ trx->error_state = DB_INTERRUPTED; return(NULL); } - if (UNIV_UNLIKELY(trx == trx_roll_crash_recv_trx)) { - trx_roll_report_progress(); - } - err = row_undo(node, thr); trx->error_state = err; diff --git a/storage/xtradb/trx/trx0roll.cc b/storage/xtradb/trx/trx0roll.cc index a031217e51d..56b7120fa34 100644 --- a/storage/xtradb/trx/trx0roll.cc +++ b/storage/xtradb/trx/trx0roll.cc @@ -731,9 +731,21 @@ fake_prepared: goto func_exit; } -/** Report progress when rolling back a row of a recovered transaction. */ -UNIV_INTERN void trx_roll_report_progress() +/** Report progress when rolling back a row of a recovered transaction. +@return whether the rollback should be aborted due to pending shutdown */ +UNIV_INTERN +bool +trx_roll_must_shutdown() { + const trx_t* trx = trx_roll_crash_recv_trx; + ut_ad(trx); + ut_ad(trx_state_eq(trx, TRX_STATE_ACTIVE)); + + if (trx_get_dict_operation(trx) == TRX_DICT_OP_NONE + && !srv_undo_sources && srv_fast_shutdown) { + return true; + } + ib_time_t time = ut_time(); mutex_enter(&trx_sys->mutex); mutex_enter(&recv_sys->mutex); @@ -767,6 +779,7 @@ UNIV_INTERN void trx_roll_report_progress() mutex_exit(&recv_sys->mutex); mutex_exit(&trx_sys->mutex); + return false; } /*******************************************************************//** -- cgit v1.2.1 From f932d3f879b6bfa4014cdbb8240b2e5a16c3e491 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Tue, 10 Apr 2018 08:40:08 +0300 Subject: MDEV-14705: Extend timeout for waiting for transactions If innodb_fast_shutdown<2, all transactions of active connections will be rolled back on shutdown. This can take a long time, and the systemd shutdown timeout should be extended during the wait. logs_empty_and_mark_files_at_shutdown(): Extend the timeout when waiting for other threads to complete. --- storage/innobase/log/log0log.cc | 16 +++++++++++----- storage/xtradb/log/log0log.cc | 16 +++++++++++----- 2 files changed, 22 insertions(+), 10 deletions(-) diff --git a/storage/innobase/log/log0log.cc b/storage/innobase/log/log0log.cc index 9f0e129e320..112ab80dc83 100644 --- a/storage/innobase/log/log0log.cc +++ b/storage/innobase/log/log0log.cc @@ -3244,7 +3244,9 @@ loop: os_event_set(lock_sys->timeout_event); os_event_set(dict_stats_event); } - os_thread_sleep(100000); +#define COUNT_INTERVAL 600 +#define CHECK_INTERVAL 100000 + os_thread_sleep(CHECK_INTERVAL); count++; @@ -3256,7 +3258,10 @@ loop: 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) { + if (srv_print_verbose_log && count > COUNT_INTERVAL) { + service_manager_extend_timeout( + COUNT_INTERVAL * CHECK_INTERVAL/1000000 * 2, + "Waiting for %lu active transactions to finish"); ib_logf(IB_LOG_LEVEL_INFO, "Waiting for %lu active transactions to finish", (ulong) total_trx); @@ -3291,7 +3296,10 @@ loop: if (thread_name) { ut_ad(!srv_read_only_mode); wait_suspend_loop: - if (srv_print_verbose_log && count > 600) { + service_manager_extend_timeout( + COUNT_INTERVAL * CHECK_INTERVAL/1000000 * 2, + "Waiting for %s to exit", thread_name); + if (srv_print_verbose_log && count > COUNT_INTERVAL) { ib_logf(IB_LOG_LEVEL_INFO, "Waiting for %s to exit", thread_name); count = 0; @@ -3327,8 +3335,6 @@ wait_suspend_loop: before proceeding further. */ count = 0; -#define COUNT_INTERVAL 600 -#define CHECK_INTERVAL 100000 service_manager_extend_timeout(COUNT_INTERVAL * CHECK_INTERVAL/1000000 * 2, "Waiting for page cleaner"); while (buf_page_cleaner_is_active) { diff --git a/storage/xtradb/log/log0log.cc b/storage/xtradb/log/log0log.cc index 1ec2831f3e2..d25d15111d1 100644 --- a/storage/xtradb/log/log0log.cc +++ b/storage/xtradb/log/log0log.cc @@ -3560,7 +3560,9 @@ loop: os_event_set(lock_sys->timeout_event); os_event_set(dict_stats_event); } - os_thread_sleep(100000); +#define COUNT_INTERVAL 600 +#define CHECK_INTERVAL 100000 + os_thread_sleep(CHECK_INTERVAL); count++; @@ -3572,7 +3574,10 @@ loop: 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) { + if (srv_print_verbose_log && count > COUNT_INTERVAL) { + service_manager_extend_timeout( + COUNT_INTERVAL * CHECK_INTERVAL/1000000 * 2, + "Waiting for %lu active transactions to finish"); ib_logf(IB_LOG_LEVEL_INFO, "Waiting for %lu active transactions to finish", (ulong) total_trx); @@ -3607,7 +3612,10 @@ loop: if (thread_name) { ut_ad(!srv_read_only_mode); wait_suspend_loop: - if (srv_print_verbose_log && count > 600) { + service_manager_extend_timeout( + COUNT_INTERVAL * CHECK_INTERVAL/1000000 * 2, + "Waiting for %s to exit", thread_name); + if (srv_print_verbose_log && count > COUNT_INTERVAL) { ib_logf(IB_LOG_LEVEL_INFO, "Waiting for %s to exit", thread_name); count = 0; @@ -3643,8 +3651,6 @@ wait_suspend_loop: before proceeding further. */ count = 0; -#define COUNT_INTERVAL 600 -#define CHECK_INTERVAL 100000 service_manager_extend_timeout(COUNT_INTERVAL * CHECK_INTERVAL/1000000 * 2, "Waiting for page cleaner"); os_rmb; -- cgit v1.2.1 From 1fd07d21a72ca4c2a5a628bd18af347776ca9b96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= Date: Tue, 10 Apr 2018 13:25:19 +0300 Subject: MDEV-15823: Test failure on galera.galera_var_slave_threads Wait drop table to be replicated before continuing. --- mysql-test/suite/galera/disabled.def | 1 - mysql-test/suite/galera/r/galera_var_slave_threads.result | 2 ++ mysql-test/suite/galera/t/galera_var_slave_threads.test | 7 +++++++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/mysql-test/suite/galera/disabled.def b/mysql-test/suite/galera/disabled.def index 69b7e6bfde1..4a9edd1bf32 100644 --- a/mysql-test/suite/galera/disabled.def +++ b/mysql-test/suite/galera/disabled.def @@ -34,4 +34,3 @@ query_cache : MDEV-15805 Test failure on galera.query_cache galera.galera_gra_log : MDEV-15808 Test failure on galera.galera_gra_log galera.MW-44 : MDEV-15809 Test failure on galera.MW-44 galera.galera_pc_ignore_sb : MDEV-15811 Test failure on galera_pc_ignore_sb -galera.galera_var_slave_threads : MDEV-15785 Test failure on galera.galera_var_slave_threads diff --git a/mysql-test/suite/galera/r/galera_var_slave_threads.result b/mysql-test/suite/galera/r/galera_var_slave_threads.result index 89026bce907..70f3b8ee257 100644 --- a/mysql-test/suite/galera/r/galera_var_slave_threads.result +++ b/mysql-test/suite/galera/r/galera_var_slave_threads.result @@ -109,6 +109,8 @@ INSERT INTO t1 VALUES (DEFAULT); INSERT INTO t1 VALUES (DEFAULT); INSERT INTO t1 VALUES (DEFAULT); DROP TABLE t1; +SELECT NAME FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE NAME LIKE 'test/t%'; +NAME SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE LIKE '%wsrep aborter%'; COUNT(*) = 1 1 diff --git a/mysql-test/suite/galera/t/galera_var_slave_threads.test b/mysql-test/suite/galera/t/galera_var_slave_threads.test index 5c775e67450..0afda948ed5 100644 --- a/mysql-test/suite/galera/t/galera_var_slave_threads.test +++ b/mysql-test/suite/galera/t/galera_var_slave_threads.test @@ -88,6 +88,13 @@ INSERT INTO t1 VALUES (DEFAULT); DROP TABLE t1; --connection node_2 + +# Wait until above DDL is replicated +--let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE NAME LIKE 'test/t%'; +--source include/wait_condition.inc + +SELECT NAME FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE NAME LIKE 'test/t%'; + # # make sure that we are left with exactly one applier thread before we leaving the test # -- cgit v1.2.1 From 2e91eb7547dfc7c9a999568bd8245832bbcfefaa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vicen=C8=9Biu=20Ciorbaru?= Date: Tue, 10 Apr 2018 17:34:56 +0300 Subject: Fix warnings in InnoDB & XtraDB post MDEV-14705 There was a missing argument to service_manager_extend_timeout call and the signness of arguments did not match. --- storage/innobase/log/log0log.cc | 7 ++++--- storage/xtradb/log/log0log.cc | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/storage/innobase/log/log0log.cc b/storage/innobase/log/log0log.cc index 112ab80dc83..3d9fa801e52 100644 --- a/storage/innobase/log/log0log.cc +++ b/storage/innobase/log/log0log.cc @@ -3244,8 +3244,8 @@ loop: os_event_set(lock_sys->timeout_event); os_event_set(dict_stats_event); } -#define COUNT_INTERVAL 600 -#define CHECK_INTERVAL 100000 +#define COUNT_INTERVAL 600U +#define CHECK_INTERVAL 100000U os_thread_sleep(CHECK_INTERVAL); count++; @@ -3261,7 +3261,8 @@ loop: if (srv_print_verbose_log && count > COUNT_INTERVAL) { service_manager_extend_timeout( COUNT_INTERVAL * CHECK_INTERVAL/1000000 * 2, - "Waiting for %lu active transactions to finish"); + "Waiting for %lu active transactions to finish", + (ulong) total_trx); ib_logf(IB_LOG_LEVEL_INFO, "Waiting for %lu active transactions to finish", (ulong) total_trx); diff --git a/storage/xtradb/log/log0log.cc b/storage/xtradb/log/log0log.cc index d25d15111d1..cb61e3fb0c6 100644 --- a/storage/xtradb/log/log0log.cc +++ b/storage/xtradb/log/log0log.cc @@ -3560,8 +3560,8 @@ loop: os_event_set(lock_sys->timeout_event); os_event_set(dict_stats_event); } -#define COUNT_INTERVAL 600 -#define CHECK_INTERVAL 100000 +#define COUNT_INTERVAL 600U +#define CHECK_INTERVAL 100000U os_thread_sleep(CHECK_INTERVAL); count++; @@ -3577,7 +3577,8 @@ loop: if (srv_print_verbose_log && count > COUNT_INTERVAL) { service_manager_extend_timeout( COUNT_INTERVAL * CHECK_INTERVAL/1000000 * 2, - "Waiting for %lu active transactions to finish"); + "Waiting for %lu active transactions to finish", + (ulong) total_trx); ib_logf(IB_LOG_LEVEL_INFO, "Waiting for %lu active transactions to finish", (ulong) total_trx); -- cgit v1.2.1