From e8bb94ccc80d02a9792257b971b748b389a014a1 Mon Sep 17 00:00:00 2001 From: Eugene Kosov Date: Fri, 30 Nov 2018 01:15:30 +0300 Subject: [PATCH 01/18] MDEV-16499 [10.1] ER_NO_SUCH_TABLE_IN_ENGINE followed by "Please drop the table and recreate" upon adding FULLTEXT key to table with virtual column There was an incorrect check for MariaDB and InnoDB tables fields count. Corruption was reported when there was no corruption. Also, a warning message had incorrect field numbers for both MariaDB and InnoDB tables. ha_innobase::open(): fixed check and message --- .../suite/innodb/r/innodb-virtual-columns.result | 15 +++++++++++++++ .../suite/innodb/t/innodb-virtual-columns.test | 11 +++++++++++ storage/innobase/handler/ha_innodb.cc | 16 +++++++++------- storage/xtradb/handler/ha_innodb.cc | 16 +++++++++------- 4 files changed, 44 insertions(+), 14 deletions(-) diff --git a/mysql-test/suite/innodb/r/innodb-virtual-columns.result b/mysql-test/suite/innodb/r/innodb-virtual-columns.result index 558bb23de0a..900fca8309e 100644 --- a/mysql-test/suite/innodb/r/innodb-virtual-columns.result +++ b/mysql-test/suite/innodb/r/innodb-virtual-columns.result @@ -320,3 +320,18 @@ term uw_id plan wdraw_rsn admit_term 1035 2 CSM ACAD 1009 drop table grad_degree; drop table gso_grad_supr; +CREATE TABLE t1 (a INT, b CHAR(12), c INT AS (a) VIRTUAL, FULLTEXT KEY(b)) ENGINE=InnoDB; +INSERT INTO t1 (a,b) VALUES (1,'foo'); +SELECT * FROM t1; +a b c +1 foo 1 +DROP TABLE t1; +CREATE TABLE t1 (a INT, b CHAR(12), c INT AS (a) VIRTUAL) ENGINE=InnoDB; +INSERT INTO t1 (a,b) VALUES (1,'foo'); +ALTER TABLE t1 ADD FULLTEXT KEY(b); +Warnings: +Warning 124 InnoDB rebuilding table to add column FTS_DOC_ID +SELECT * FROM t1; +a b c +1 foo 1 +DROP TABLE t1; diff --git a/mysql-test/suite/innodb/t/innodb-virtual-columns.test b/mysql-test/suite/innodb/t/innodb-virtual-columns.test index 368c6fc8cb1..99f550eb667 100644 --- a/mysql-test/suite/innodb/t/innodb-virtual-columns.test +++ b/mysql-test/suite/innodb/t/innodb-virtual-columns.test @@ -300,3 +300,14 @@ select * from gso_grad_supr; drop table grad_degree; drop table gso_grad_supr; + +CREATE TABLE t1 (a INT, b CHAR(12), c INT AS (a) VIRTUAL, FULLTEXT KEY(b)) ENGINE=InnoDB; +INSERT INTO t1 (a,b) VALUES (1,'foo'); +SELECT * FROM t1; +DROP TABLE t1; + +CREATE TABLE t1 (a INT, b CHAR(12), c INT AS (a) VIRTUAL) ENGINE=InnoDB; +INSERT INTO t1 (a,b) VALUES (1,'foo'); +ALTER TABLE t1 ADD FULLTEXT KEY(b); +SELECT * FROM t1; +DROP TABLE t1; diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 85c5529a096..33ece9c47af 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -5312,19 +5312,21 @@ ha_innobase::open( ib_table = dict_table_open_on_name(norm_name, FALSE, TRUE, ignore_err); if (ib_table - && ((!DICT_TF2_FLAG_IS_SET(ib_table, DICT_TF2_FTS_HAS_DOC_ID) - && table->s->stored_fields != dict_table_get_n_user_cols(ib_table)) - || (DICT_TF2_FLAG_IS_SET(ib_table, DICT_TF2_FTS_HAS_DOC_ID) - && (table->s->fields - != dict_table_get_n_user_cols(ib_table) - 1)))) { + && (table->s->stored_fields != dict_table_get_n_user_cols(ib_table) + - (DICT_TF2_FLAG_IS_SET(ib_table, DICT_TF2_FTS_HAS_DOC_ID) + ? 1 : 0))) { ib_logf(IB_LOG_LEVEL_WARN, "table %s contains %lu user defined columns " "in InnoDB, but %lu columns in MySQL. Please " "check INFORMATION_SCHEMA.INNODB_SYS_COLUMNS and " REFMAN "innodb-troubleshooting.html " "for how to resolve it", - norm_name, (ulong) dict_table_get_n_user_cols(ib_table), - (ulong) table->s->fields); + norm_name, + (ulong) (dict_table_get_n_user_cols(ib_table) + - DICT_TF2_FLAG_IS_SET(ib_table, + DICT_TF2_FTS_HAS_DOC_ID) + ? 1 : 0), + (ulong) table->s->stored_fields); /* Mark this table as corrupted, so the drop table or force recovery can still use it, but not others. */ diff --git a/storage/xtradb/handler/ha_innodb.cc b/storage/xtradb/handler/ha_innodb.cc index 52ef0b01534..320f7b3d088 100644 --- a/storage/xtradb/handler/ha_innodb.cc +++ b/storage/xtradb/handler/ha_innodb.cc @@ -5984,19 +5984,21 @@ ha_innobase::open( ib_table = dict_table_open_on_name(norm_name, FALSE, TRUE, ignore_err); if (ib_table - && ((!DICT_TF2_FLAG_IS_SET(ib_table, DICT_TF2_FTS_HAS_DOC_ID) - && table->s->stored_fields != dict_table_get_n_user_cols(ib_table)) - || (DICT_TF2_FLAG_IS_SET(ib_table, DICT_TF2_FTS_HAS_DOC_ID) - && (table->s->fields - != dict_table_get_n_user_cols(ib_table) - 1)))) { + && (table->s->stored_fields != dict_table_get_n_user_cols(ib_table) + - (DICT_TF2_FLAG_IS_SET(ib_table, DICT_TF2_FTS_HAS_DOC_ID) + ? 1 : 0))) { ib_logf(IB_LOG_LEVEL_WARN, "table %s contains %lu user defined columns " "in InnoDB, but %lu columns in MySQL. Please " "check INFORMATION_SCHEMA.INNODB_SYS_COLUMNS and " REFMAN "innodb-troubleshooting.html " "for how to resolve it", - norm_name, (ulong) dict_table_get_n_user_cols(ib_table), - (ulong) table->s->fields); + norm_name, + (ulong) (dict_table_get_n_user_cols(ib_table) + - DICT_TF2_FLAG_IS_SET(ib_table, + DICT_TF2_FTS_HAS_DOC_ID) + ? 1 : 0), + (ulong) table->s->stored_fields); /* Mark this table as corrupted, so the drop table or force recovery can still use it, but not others. */ From d0d0f88f2cd4da23c2c2da702da51fb533e7fb8a Mon Sep 17 00:00:00 2001 From: Varun Gupta Date: Sun, 6 Jan 2019 23:15:25 +0530 Subject: [PATCH 02/18] MDEV-13784: query causes seg fault When we have a nested subquery then a subquery that was a dependent subquery may change to an independent one when we optimizer the inner subqueries. This is handled st_select_lex::optimize_unflattened_subqueries. Currently a subquery that was changed to independent from dependent after optimization phase incorrectly shows dependent in the output of Explain, this happens because we don't update used_tables for the WHERE clause, ON clause, etc after the optimization phase. --- mysql-test/r/subselect_exists2in.result | 4 +-- mysql-test/r/union.result | 38 +++++++++++++++++++++++++ mysql-test/r/view.result | 4 +-- mysql-test/t/union.test | 35 +++++++++++++++++++++++ sql/sql_lex.cc | 1 + 5 files changed, 78 insertions(+), 4 deletions(-) diff --git a/mysql-test/r/subselect_exists2in.result b/mysql-test/r/subselect_exists2in.result index d47e446fe8f..b6b2f5b476f 100644 --- a/mysql-test/r/subselect_exists2in.result +++ b/mysql-test/r/subselect_exists2in.result @@ -330,7 +330,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 3 MATERIALIZED t3 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1276 Field or reference 'test.t2.b' of SELECT #3 was resolved in SELECT #2 -Note 1003 select (select 1 from dual where (not(((1 is not null) and (1,1 in ( (select `test`.`t3`.`c` from `test`.`t3` where (`test`.`t3`.`c` is not null) ), (1 in on distinct_key where ((1 = ``.`c`))))))))) AS `( SELECT b FROM t2 WHERE NOT EXISTS ( SELECT c FROM t3 WHERE c = b ) )` from `test`.`t1` +Note 1003 select (select 1 from dual where (not(((1 is not null) and (1,1 in ((1 in on distinct_key where ((1 = ``.`c`))))))))) AS `( SELECT b FROM t2 WHERE NOT EXISTS ( SELECT c FROM t3 WHERE c = b ) )` from `test`.`t1` SELECT ( SELECT b FROM t2 WHERE NOT EXISTS ( SELECT c FROM t3 WHERE c = b ) ) FROM t1; ( SELECT b FROM t2 WHERE NOT EXISTS ( SELECT c FROM t3 WHERE c = b ) ) 1 @@ -344,7 +344,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 3 MATERIALIZED t3 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1276 Field or reference 'test.t2.b' of SELECT #3 was resolved in SELECT #2 -Note 1003 select (select 1 from dual where (not(((1 is not null) and (1,1 in ( (select `test`.`t3`.`c` from `test`.`t3` where (`test`.`t3`.`c` is not null) ), (1 in on distinct_key where ((1 = ``.`c`))))))))) AS `( SELECT b FROM t2 WHERE NOT EXISTS ( SELECT c FROM t3 WHERE c = b ) )` from `test`.`t1` +Note 1003 select (select 1 from dual where (not(((1 is not null) and (1,1 in ((1 in on distinct_key where ((1 = ``.`c`))))))))) AS `( SELECT b FROM t2 WHERE NOT EXISTS ( SELECT c FROM t3 WHERE c = b ) )` from `test`.`t1` SELECT ( SELECT b FROM t2 WHERE NOT EXISTS ( SELECT c FROM t3 WHERE c = b ) ) FROM t1; ( SELECT b FROM t2 WHERE NOT EXISTS ( SELECT c FROM t3 WHERE c = b ) ) 1 diff --git a/mysql-test/r/union.result b/mysql-test/r/union.result index 5ea0f975a91..9b7a361fdc5 100644 --- a/mysql-test/r/union.result +++ b/mysql-test/r/union.result @@ -2049,3 +2049,41 @@ a 1000003.0 1.0 End of 5.5 tests +# +# MDEV-13784: query causes seg fault +# +CREATE TABLE t1 (`bug_id` int NOT NULL PRIMARY KEY, `product_id` int NOT NULL); +INSERT INTO t1 VALUES (45199,1184); +CREATE TABLE t2 (`product_id` int NOT NULL,`userid` int NOT NULL, PRIMARY KEY (`product_id`,`userid`)); +INSERT INTO t2 VALUES (1184,103),(1184,624),(1184,1577),(1184,1582); +CREATE TABLE t3 (`id` int NOT NULL PRIMARY KEY,`name` varchar(64)); +CREATE TABLE t4 ( `userid` int NOT NULL PRIMARY KEY, `login_name` varchar(255)); +INSERT INTO t4 VALUES (103,'foo'),(624,'foo'),(1577,'foo'),(1582,'foo'); +CREATE TABLE t5 (`id` int NOT NULL PRIMARY KEY, `name` varchar(64)); +explain select +( +select login_name from t4 where userId = ( +select userid from t2 where product_id = t1.product_id +union +select userid from t2 where product_id = ( +select id from t5 where name = (select name from t3 where id = t1.product_id)) limit 1 ) +) as x from t1 where (t1.bug_id=45199); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t1 system PRIMARY NULL NULL NULL 1 +2 SUBQUERY t4 eq_ref PRIMARY PRIMARY 4 func 1 Using where +3 SUBQUERY t2 ref PRIMARY PRIMARY 4 const 3 Using index +4 UNION t2 ref PRIMARY PRIMARY 4 func 1 Using where; Using index +5 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +6 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +NULL UNION RESULT ALL NULL NULL NULL NULL NULL +select +( +select login_name from t4 where userId = ( +select userid from t2 where product_id = t1.product_id +union +select userid from t2 where product_id = ( +select id from t5 where name = (select name from t3 where id = t1.product_id)) limit 1 ) +) as x from t1 where (t1.bug_id=45199); +x +foo +drop table t1, t2, t3, t4, t5; diff --git a/mysql-test/r/view.result b/mysql-test/r/view.result index 4e3146052e9..3088704e911 100644 --- a/mysql-test/r/view.result +++ b/mysql-test/r/view.result @@ -4633,7 +4633,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 2 DEPENDENT SUBQUERY t4 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1 -Note 1003 select `test`.`t1`.`a` AS `a`,10 AS `a` from `test`.`t1` where (not(<10,`test`.`t1`.`a`>((10,(select NULL from `test`.`t4` where ((`test`.`t4`.`a` >= `test`.`t1`.`a`) and trigcond((((10) = NULL) or (isnull(NULL))))) having trigcond((NULL))))))) +Note 1003 select `test`.`t1`.`a` AS `a`,10 AS `a` from `test`.`t1` where (not(<10,`test`.`t1`.`a`>((10,(select NULL from `test`.`t4` where ((`test`.`t4`.`a` >= `test`.`t1`.`a`) and trigcond((((10) = NULL) or 1))) having trigcond((NULL))))))) SELECT * FROM t1, t2 WHERE t2.a NOT IN (SELECT t3.b FROM t3 RIGHT JOIN t4 ON (t4.a = t3.a) WHERE t4.a >= t1.a); @@ -4649,7 +4649,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 2 DEPENDENT SUBQUERY t4 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1276 Field or reference 'v1.a' of SELECT #2 was resolved in SELECT #1 -Note 1003 select `test`.`t1`.`a` AS `a`,10 AS `a` from `test`.`t1` where (not(<10,`test`.`t1`.`a`>((10,(select NULL from `test`.`t4` where ((`test`.`t4`.`a` >= `test`.`t1`.`a`) and trigcond((((10) = NULL) or (isnull(NULL))))) having trigcond((NULL))))))) +Note 1003 select `test`.`t1`.`a` AS `a`,10 AS `a` from `test`.`t1` where (not(<10,`test`.`t1`.`a`>((10,(select NULL from `test`.`t4` where ((`test`.`t4`.`a` >= `test`.`t1`.`a`) and trigcond((((10) = NULL) or 1))) having trigcond((NULL))))))) SELECT * FROM v1, t2 WHERE t2.a NOT IN (SELECT t3.b FROM t3 RIGHT JOIN t4 ON (t4.a = t3.a) WHERE t4.a >= v1.a); diff --git a/mysql-test/t/union.test b/mysql-test/t/union.test index 240115837c7..8ef8f7c4017 100644 --- a/mysql-test/t/union.test +++ b/mysql-test/t/union.test @@ -1437,3 +1437,38 @@ SET @advertAcctId = 1000003; select @advertAcctId as a from dual union all select 1.0 from dual; --echo End of 5.5 tests + +--echo # +--echo # MDEV-13784: query causes seg fault +--echo # + +CREATE TABLE t1 (`bug_id` int NOT NULL PRIMARY KEY, `product_id` int NOT NULL); +INSERT INTO t1 VALUES (45199,1184); + +CREATE TABLE t2 (`product_id` int NOT NULL,`userid` int NOT NULL, PRIMARY KEY (`product_id`,`userid`)); +INSERT INTO t2 VALUES (1184,103),(1184,624),(1184,1577),(1184,1582); + +CREATE TABLE t3 (`id` int NOT NULL PRIMARY KEY,`name` varchar(64)); + + +CREATE TABLE t4 ( `userid` int NOT NULL PRIMARY KEY, `login_name` varchar(255)); +INSERT INTO t4 VALUES (103,'foo'),(624,'foo'),(1577,'foo'),(1582,'foo'); +CREATE TABLE t5 (`id` int NOT NULL PRIMARY KEY, `name` varchar(64)); + +explain select +( + select login_name from t4 where userId = ( + select userid from t2 where product_id = t1.product_id + union + select userid from t2 where product_id = ( + select id from t5 where name = (select name from t3 where id = t1.product_id)) limit 1 ) +) as x from t1 where (t1.bug_id=45199); +select +( + select login_name from t4 where userId = ( + select userid from t2 where product_id = t1.product_id + union + select userid from t2 where product_id = ( + select id from t5 where name = (select name from t3 where id = t1.product_id)) limit 1 ) +) as x from t1 where (t1.bug_id=45199); +drop table t1, t2, t3, t4, t5; diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index 891cf9987c6..08c169c5999 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -3551,6 +3551,7 @@ bool st_select_lex::optimize_unflattened_subqueries(bool const_only) inner_join->select_options|= SELECT_DESCRIBE; } res= inner_join->optimize(); + sl->update_used_tables(); sl->update_correlated_cache(); is_correlated_unit|= sl->is_correlated; inner_join->select_options= save_options; From a06a3e467029cafc3c7f432fff9603fe9030c480 Mon Sep 17 00:00:00 2001 From: Eugene Kosov Date: Mon, 14 Jan 2019 22:14:56 +0300 Subject: [PATCH 03/18] MDEV-18233 Moving the hash_node_t to improve locality of reference When performing a hash search via HASH_SEARCH we first look at a key of a node and then at its pointer to the next node in chain. If we have those in one cache line instead of a two we reduce memory reads. I found dict_table_t, fil_space_t and buf_page_t suitable for such improvement. --- storage/innobase/include/buf0buf.h | 6 +++--- storage/innobase/include/dict0mem.h | 4 ++-- storage/innobase/include/fil0fil.h | 4 ++-- storage/xtradb/include/buf0buf.h | 6 +++--- storage/xtradb/include/dict0mem.h | 4 ++-- storage/xtradb/include/fil0fil.h | 4 ++-- 6 files changed, 14 insertions(+), 14 deletions(-) diff --git a/storage/innobase/include/buf0buf.h b/storage/innobase/include/buf0buf.h index cddab05f84d..a5a493ab769 100644 --- a/storage/innobase/include/buf0buf.h +++ b/storage/innobase/include/buf0buf.h @@ -1443,6 +1443,9 @@ struct buf_page_t{ by buf_pool->mutex. */ ib_uint32_t offset; /*!< page number; also protected by buf_pool->mutex. */ + buf_page_t* hash; /*!< node used in chaining to + buf_pool->page_hash or + buf_pool->zip_hash */ /** count of how manyfold this block is currently bufferfixed */ #ifdef PAGE_ATOMIC_REF_COUNT ib_uint32_t buf_fix_count; @@ -1489,9 +1492,6 @@ struct buf_page_t{ zip.data == NULL means an active buf_pool->watch */ #ifndef UNIV_HOTBACKUP - buf_page_t* hash; /*!< node used in chaining to - buf_pool->page_hash or - buf_pool->zip_hash */ #ifdef UNIV_DEBUG ibool in_page_hash; /*!< TRUE if in buf_pool->page_hash */ ibool in_zip_hash; /*!< TRUE if in buf_pool->zip_hash */ diff --git a/storage/innobase/include/dict0mem.h b/storage/innobase/include/dict0mem.h index 872db7865d3..73f104fdef1 100644 --- a/storage/innobase/include/dict0mem.h +++ b/storage/innobase/include/dict0mem.h @@ -926,8 +926,10 @@ struct dict_table_t{ table_id_t id; /*!< id of the table */ + hash_node_t id_hash; /*!< hash chain node */ mem_heap_t* heap; /*!< memory heap */ char* name; /*!< table name */ + hash_node_t name_hash; /*!< hash chain node */ const char* dir_path_of_temp_table;/*!< NULL or the directory path where a TEMPORARY table that was explicitly created by a user should be placed if @@ -983,8 +985,6 @@ struct dict_table_t{ dictionary information and MySQL FRM information mismatch. */ #ifndef UNIV_HOTBACKUP - hash_node_t name_hash; /*!< hash chain node */ - hash_node_t id_hash; /*!< hash chain node */ UT_LIST_BASE_NODE_T(dict_index_t) indexes; /*!< list of indexes of the table */ diff --git a/storage/innobase/include/fil0fil.h b/storage/innobase/include/fil0fil.h index 6e772e31772..7c0f623d890 100644 --- a/storage/innobase/include/fil0fil.h +++ b/storage/innobase/include/fil0fil.h @@ -245,7 +245,9 @@ struct fil_node_t { struct fil_space_t { char* name; /*!< space name = the path to the first file in it */ + hash_node_t name_hash;/*!< hash chain the name_hash table */ ulint id; /*!< space id */ + hash_node_t hash; /*!< hash chain node */ ib_int64_t tablespace_version; /*!< in DISCARD/IMPORT this timestamp is used to check if we should ignore @@ -292,8 +294,6 @@ struct fil_space_t { trying to read a block. Dropping of the tablespace is forbidden if this is positive */ - hash_node_t hash; /*!< hash chain node */ - hash_node_t name_hash;/*!< hash chain the name_hash table */ #ifndef UNIV_HOTBACKUP rw_lock_t latch; /*!< latch protecting the file space storage allocation */ diff --git a/storage/xtradb/include/buf0buf.h b/storage/xtradb/include/buf0buf.h index a5b5cc84166..0f6b8b67250 100644 --- a/storage/xtradb/include/buf0buf.h +++ b/storage/xtradb/include/buf0buf.h @@ -1477,6 +1477,9 @@ struct buf_page_t{ ib_uint32_t space; /*!< tablespace id. */ ib_uint32_t offset; /*!< page number. */ + buf_page_t* hash; /*!< node used in chaining to + buf_pool->page_hash or + buf_pool->zip_hash */ /** count of how manyfold this block is currently bufferfixed */ #ifdef PAGE_ATOMIC_REF_COUNT ib_uint32_t buf_fix_count; @@ -1530,9 +1533,6 @@ struct buf_page_t{ zip.data == NULL means an active buf_pool->watch */ #ifndef UNIV_HOTBACKUP - buf_page_t* hash; /*!< node used in chaining to - buf_pool->page_hash or - buf_pool->zip_hash */ #ifdef UNIV_DEBUG ibool in_page_hash; /*!< TRUE if in buf_pool->page_hash */ ibool in_zip_hash; /*!< TRUE if in buf_pool->zip_hash */ diff --git a/storage/xtradb/include/dict0mem.h b/storage/xtradb/include/dict0mem.h index e6c0aa1f252..0c6a84523a4 100644 --- a/storage/xtradb/include/dict0mem.h +++ b/storage/xtradb/include/dict0mem.h @@ -937,8 +937,10 @@ struct dict_table_t{ table_id_t id; /*!< id of the table */ + hash_node_t id_hash; /*!< hash chain node */ mem_heap_t* heap; /*!< memory heap */ char* name; /*!< table name */ + hash_node_t name_hash; /*!< hash chain node */ const char* dir_path_of_temp_table;/*!< NULL or the directory path where a TEMPORARY table that was explicitly created by a user should be placed if @@ -994,8 +996,6 @@ struct dict_table_t{ dictionary information and MySQL FRM information mismatch. */ #ifndef UNIV_HOTBACKUP - hash_node_t name_hash; /*!< hash chain node */ - hash_node_t id_hash; /*!< hash chain node */ UT_LIST_BASE_NODE_T(dict_index_t) indexes; /*!< list of indexes of the table */ diff --git a/storage/xtradb/include/fil0fil.h b/storage/xtradb/include/fil0fil.h index 86b1c561349..1f3574d4f71 100644 --- a/storage/xtradb/include/fil0fil.h +++ b/storage/xtradb/include/fil0fil.h @@ -238,7 +238,9 @@ struct fil_node_t { struct fil_space_t { char* name; /*!< space name = the path to the first file in it */ + hash_node_t name_hash;/*!< hash chain the name_hash table */ ulint id; /*!< space id */ + hash_node_t hash; /*!< hash chain node */ ib_int64_t tablespace_version; /*!< in DISCARD/IMPORT this timestamp is used to check if we should ignore @@ -285,8 +287,6 @@ struct fil_space_t { trying to read a block. Dropping of the tablespace is forbidden if this is positive */ - hash_node_t hash; /*!< hash chain node */ - hash_node_t name_hash;/*!< hash chain the name_hash table */ #ifndef UNIV_HOTBACKUP prio_rw_lock_t latch; /*!< latch protecting the file space storage allocation */ From 61b600079b1e5d9b6cb11645f66e37bc95393eab Mon Sep 17 00:00:00 2001 From: sjaakola Date: Tue, 15 Jan 2019 09:47:34 +0200 Subject: [PATCH 04/18] MDEV-16690 node hang due to conflicting inserts in FK child table Add the test case. The actual bug was fixed in MDEV-17541. Closes #811 --- .../galera_FK_duplicate_client_insert.result | 380 ++++++++++++++++++ .../t/galera_FK_duplicate_client_insert.test | 161 ++++++++ 2 files changed, 541 insertions(+) create mode 100644 mysql-test/suite/galera/r/galera_FK_duplicate_client_insert.result create mode 100644 mysql-test/suite/galera/t/galera_FK_duplicate_client_insert.test diff --git a/mysql-test/suite/galera/r/galera_FK_duplicate_client_insert.result b/mysql-test/suite/galera/r/galera_FK_duplicate_client_insert.result new file mode 100644 index 00000000000..3eb638ca49a --- /dev/null +++ b/mysql-test/suite/galera/r/galera_FK_duplicate_client_insert.result @@ -0,0 +1,380 @@ +CREATE TABLE user(id int primary key, j int) ENGINE=InnoDB; +CREATE TABLE user_session(id int primary key, fk1 int, fk2 int) ENGINE=InnoDB; +alter table user_session add foreign key (fk1) references user(id); +INSERT INTO user values (1,0), (2,0), (3,0), (4,0); +INSERT INTO user_session values (1,1,1); +connect node_1_u, 127.0.0.1, root, , test, $NODE_MYPORT_1; +connect node_1_i, 127.0.0.1, root, , test, $NODE_MYPORT_1; +connect node_2_i, 127.0.0.1, root, , test, $NODE_MYPORT_2; +"Phase 1: plain SQL statements" +connection node_1; +connection node_1_u; +begin; +update user set j = j + 1 WHERE id > 0; +connection node_1_i; +set debug_sync='lock_wait_suspend_thread_enter SIGNAL ins_waiting WAIT_FOR cont_ins'; +insert into user_session(id,fk1,fk2) values (2, 2, 2); +connection node_1; +set debug_sync='now WAIT_FOR ins_waiting'; +connection node_2_i; +insert into user_session(id,fk1,fk2) values (2, 2, 3); +connection node_1; +set debug_sync='now SIGNAL cont_ins'; +connection node_1_i; +connection node_1_u; +commit; +connection node_1; +truncate user_session; +set debug_sync = reset; +connection node_1_u; +begin; +update user set j = j + 1 WHERE id > 0; +connection node_1_i; +set debug_sync='lock_wait_suspend_thread_enter SIGNAL ins_waiting WAIT_FOR cont_ins'; +insert into user_session(id,fk1,fk2) values (2, 2, 2); +connection node_1; +set debug_sync='now WAIT_FOR ins_waiting'; +connection node_2_i; +insert into user_session(id,fk1,fk2) values (2, 2, 3); +connection node_1; +set debug_sync='now SIGNAL cont_ins'; +connection node_1_i; +connection node_1_u; +commit; +connection node_1; +truncate user_session; +set debug_sync = reset; +connection node_1_u; +begin; +update user set j = j + 1 WHERE id > 0; +connection node_1_i; +set debug_sync='lock_wait_suspend_thread_enter SIGNAL ins_waiting WAIT_FOR cont_ins'; +insert into user_session(id,fk1,fk2) values (2, 2, 2); +connection node_1; +set debug_sync='now WAIT_FOR ins_waiting'; +connection node_2_i; +insert into user_session(id,fk1,fk2) values (2, 2, 3); +connection node_1; +set debug_sync='now SIGNAL cont_ins'; +connection node_1_i; +connection node_1_u; +commit; +connection node_1; +truncate user_session; +set debug_sync = reset; +connection node_1_u; +begin; +update user set j = j + 1 WHERE id > 0; +connection node_1_i; +set debug_sync='lock_wait_suspend_thread_enter SIGNAL ins_waiting WAIT_FOR cont_ins'; +insert into user_session(id,fk1,fk2) values (2, 2, 2); +connection node_1; +set debug_sync='now WAIT_FOR ins_waiting'; +connection node_2_i; +insert into user_session(id,fk1,fk2) values (2, 2, 3); +connection node_1; +set debug_sync='now SIGNAL cont_ins'; +connection node_1_i; +connection node_1_u; +commit; +connection node_1; +truncate user_session; +set debug_sync = reset; +connection node_1_u; +begin; +update user set j = j + 1 WHERE id > 0; +connection node_1_i; +set debug_sync='lock_wait_suspend_thread_enter SIGNAL ins_waiting WAIT_FOR cont_ins'; +insert into user_session(id,fk1,fk2) values (2, 2, 2); +connection node_1; +set debug_sync='now WAIT_FOR ins_waiting'; +connection node_2_i; +insert into user_session(id,fk1,fk2) values (2, 2, 3); +connection node_1; +set debug_sync='now SIGNAL cont_ins'; +connection node_1_i; +connection node_1_u; +commit; +connection node_1; +truncate user_session; +set debug_sync = reset; +connection node_1_u; +begin; +update user set j = j + 1 WHERE id > 0; +connection node_1_i; +set debug_sync='lock_wait_suspend_thread_enter SIGNAL ins_waiting WAIT_FOR cont_ins'; +insert into user_session(id,fk1,fk2) values (2, 2, 2); +connection node_1; +set debug_sync='now WAIT_FOR ins_waiting'; +connection node_2_i; +insert into user_session(id,fk1,fk2) values (2, 2, 3); +connection node_1; +set debug_sync='now SIGNAL cont_ins'; +connection node_1_i; +connection node_1_u; +commit; +connection node_1; +truncate user_session; +set debug_sync = reset; +connection node_1_u; +begin; +update user set j = j + 1 WHERE id > 0; +connection node_1_i; +set debug_sync='lock_wait_suspend_thread_enter SIGNAL ins_waiting WAIT_FOR cont_ins'; +insert into user_session(id,fk1,fk2) values (2, 2, 2); +connection node_1; +set debug_sync='now WAIT_FOR ins_waiting'; +connection node_2_i; +insert into user_session(id,fk1,fk2) values (2, 2, 3); +connection node_1; +set debug_sync='now SIGNAL cont_ins'; +connection node_1_i; +connection node_1_u; +commit; +connection node_1; +truncate user_session; +set debug_sync = reset; +connection node_1_u; +begin; +update user set j = j + 1 WHERE id > 0; +connection node_1_i; +set debug_sync='lock_wait_suspend_thread_enter SIGNAL ins_waiting WAIT_FOR cont_ins'; +insert into user_session(id,fk1,fk2) values (2, 2, 2); +connection node_1; +set debug_sync='now WAIT_FOR ins_waiting'; +connection node_2_i; +insert into user_session(id,fk1,fk2) values (2, 2, 3); +connection node_1; +set debug_sync='now SIGNAL cont_ins'; +connection node_1_i; +connection node_1_u; +commit; +connection node_1; +truncate user_session; +set debug_sync = reset; +connection node_1_u; +begin; +update user set j = j + 1 WHERE id > 0; +connection node_1_i; +set debug_sync='lock_wait_suspend_thread_enter SIGNAL ins_waiting WAIT_FOR cont_ins'; +insert into user_session(id,fk1,fk2) values (2, 2, 2); +connection node_1; +set debug_sync='now WAIT_FOR ins_waiting'; +connection node_2_i; +insert into user_session(id,fk1,fk2) values (2, 2, 3); +connection node_1; +set debug_sync='now SIGNAL cont_ins'; +connection node_1_i; +connection node_1_u; +commit; +connection node_1; +truncate user_session; +set debug_sync = reset; +connection node_1_u; +begin; +update user set j = j + 1 WHERE id > 0; +connection node_1_i; +set debug_sync='lock_wait_suspend_thread_enter SIGNAL ins_waiting WAIT_FOR cont_ins'; +insert into user_session(id,fk1,fk2) values (2, 2, 2); +connection node_1; +set debug_sync='now WAIT_FOR ins_waiting'; +connection node_2_i; +insert into user_session(id,fk1,fk2) values (2, 2, 3); +connection node_1; +set debug_sync='now SIGNAL cont_ins'; +connection node_1_i; +connection node_1_u; +commit; +connection node_1; +truncate user_session; +set debug_sync = reset; +"Phase 2: prepared statements" +connection node_1_u; +prepare upd from 'update user set j = j + 1 WHERE id > 0'; +connection node_1_i; +prepare ins1 from 'insert into user_session(id,fk1,fk2) values (2, 2, 2)'; +connection node_2_i; +prepare ins2 from 'insert into user_session(id,fk1,fk2) values (2, 2, 3)'; +connection node_1; +connection node_1_u; +begin; +execute upd; +connection node_1_i; +set debug_sync='lock_wait_suspend_thread_enter SIGNAL ins_waiting WAIT_FOR cont_ins'; +execute ins1; +connection node_1; +set debug_sync='now WAIT_FOR ins_waiting'; +connection node_2_i; +execute ins2; +connection node_1; +set debug_sync='now SIGNAL cont_ins'; +connection node_1_i; +connection node_1_u; +commit; +connection node_1; +truncate user_session; +set debug_sync = reset; +connection node_1_u; +begin; +execute upd; +connection node_1_i; +set debug_sync='lock_wait_suspend_thread_enter SIGNAL ins_waiting WAIT_FOR cont_ins'; +execute ins1; +connection node_1; +set debug_sync='now WAIT_FOR ins_waiting'; +connection node_2_i; +execute ins2; +connection node_1; +set debug_sync='now SIGNAL cont_ins'; +connection node_1_i; +connection node_1_u; +commit; +connection node_1; +truncate user_session; +set debug_sync = reset; +connection node_1_u; +begin; +execute upd; +connection node_1_i; +set debug_sync='lock_wait_suspend_thread_enter SIGNAL ins_waiting WAIT_FOR cont_ins'; +execute ins1; +connection node_1; +set debug_sync='now WAIT_FOR ins_waiting'; +connection node_2_i; +execute ins2; +connection node_1; +set debug_sync='now SIGNAL cont_ins'; +connection node_1_i; +connection node_1_u; +commit; +connection node_1; +truncate user_session; +set debug_sync = reset; +connection node_1_u; +begin; +execute upd; +connection node_1_i; +set debug_sync='lock_wait_suspend_thread_enter SIGNAL ins_waiting WAIT_FOR cont_ins'; +execute ins1; +connection node_1; +set debug_sync='now WAIT_FOR ins_waiting'; +connection node_2_i; +execute ins2; +connection node_1; +set debug_sync='now SIGNAL cont_ins'; +connection node_1_i; +connection node_1_u; +commit; +connection node_1; +truncate user_session; +set debug_sync = reset; +connection node_1_u; +begin; +execute upd; +connection node_1_i; +set debug_sync='lock_wait_suspend_thread_enter SIGNAL ins_waiting WAIT_FOR cont_ins'; +execute ins1; +connection node_1; +set debug_sync='now WAIT_FOR ins_waiting'; +connection node_2_i; +execute ins2; +connection node_1; +set debug_sync='now SIGNAL cont_ins'; +connection node_1_i; +connection node_1_u; +commit; +connection node_1; +truncate user_session; +set debug_sync = reset; +connection node_1_u; +begin; +execute upd; +connection node_1_i; +set debug_sync='lock_wait_suspend_thread_enter SIGNAL ins_waiting WAIT_FOR cont_ins'; +execute ins1; +connection node_1; +set debug_sync='now WAIT_FOR ins_waiting'; +connection node_2_i; +execute ins2; +connection node_1; +set debug_sync='now SIGNAL cont_ins'; +connection node_1_i; +connection node_1_u; +commit; +connection node_1; +truncate user_session; +set debug_sync = reset; +connection node_1_u; +begin; +execute upd; +connection node_1_i; +set debug_sync='lock_wait_suspend_thread_enter SIGNAL ins_waiting WAIT_FOR cont_ins'; +execute ins1; +connection node_1; +set debug_sync='now WAIT_FOR ins_waiting'; +connection node_2_i; +execute ins2; +connection node_1; +set debug_sync='now SIGNAL cont_ins'; +connection node_1_i; +connection node_1_u; +commit; +connection node_1; +truncate user_session; +set debug_sync = reset; +connection node_1_u; +begin; +execute upd; +connection node_1_i; +set debug_sync='lock_wait_suspend_thread_enter SIGNAL ins_waiting WAIT_FOR cont_ins'; +execute ins1; +connection node_1; +set debug_sync='now WAIT_FOR ins_waiting'; +connection node_2_i; +execute ins2; +connection node_1; +set debug_sync='now SIGNAL cont_ins'; +connection node_1_i; +connection node_1_u; +commit; +connection node_1; +truncate user_session; +set debug_sync = reset; +connection node_1_u; +begin; +execute upd; +connection node_1_i; +set debug_sync='lock_wait_suspend_thread_enter SIGNAL ins_waiting WAIT_FOR cont_ins'; +execute ins1; +connection node_1; +set debug_sync='now WAIT_FOR ins_waiting'; +connection node_2_i; +execute ins2; +connection node_1; +set debug_sync='now SIGNAL cont_ins'; +connection node_1_i; +connection node_1_u; +commit; +connection node_1; +truncate user_session; +set debug_sync = reset; +connection node_1_u; +begin; +execute upd; +connection node_1_i; +set debug_sync='lock_wait_suspend_thread_enter SIGNAL ins_waiting WAIT_FOR cont_ins'; +execute ins1; +connection node_1; +set debug_sync='now WAIT_FOR ins_waiting'; +connection node_2_i; +execute ins2; +connection node_1; +set debug_sync='now SIGNAL cont_ins'; +connection node_1_i; +connection node_1_u; +commit; +connection node_1; +truncate user_session; +set debug_sync = reset; +connection node_1; +drop table user_session,user; diff --git a/mysql-test/suite/galera/t/galera_FK_duplicate_client_insert.test b/mysql-test/suite/galera/t/galera_FK_duplicate_client_insert.test new file mode 100644 index 00000000000..02322fc02ec --- /dev/null +++ b/mysql-test/suite/galera/t/galera_FK_duplicate_client_insert.test @@ -0,0 +1,161 @@ +--source include/have_innodb.inc +--source include/have_debug.inc +--source include/have_debug_sync.inc +--source include/galera_cluster.inc +# +# This test will reproduce regressions of bugs +# https://github.com/codership/mysql-wsrep/issues/335 +# https://github.com/codership/mysql-wsrep/issues/336 +# +# The test will issue duplicate inserts into a table, which has foreign key +# constraint for a parent table. +# The inserts happen in separate nodes, and the +# The test outline is as follows: +# 1. in node 1, an update is done for the FK parent row, in a transaction, +# which is left open. The purpose of this is just to establish a X lock on +# the parent row. +# 2. in node 1, an insert for the child table is sent. The insert will have to wait +# for the parent row X lock, because it needs S lock on the same row. +# However, we have set an DBUG sync point just before the insert will call for +# innodb suspend +# 3. in node 2, a similar insert is issued. This will replicate to node 1 and try to +# abort the conflicting update and blocked insert +# 4. the inserts dbug sync point is relased, and insert should continue and abort +# gracefully +# 5. update is continued to commit, and it should also observe the deadlock +# +# This test is run in 3 phases: +# +# 1. with plain SQL statement +# 2. as SQL prepared statements +# 3. as SQl stored procedures +# +# The test phase 3 is for reproducing the issue in bug #336 specifically +# + +# +# create the test tables and foreign key constraint between them +# +CREATE TABLE user(id int primary key, j int) ENGINE=InnoDB; +CREATE TABLE user_session(id int primary key, fk1 int, fk2 int) ENGINE=InnoDB; +alter table user_session add foreign key (fk1) references user(id); + +# populate a few initial rows +INSERT INTO user values (1,0), (2,0), (3,0), (4,0); +INSERT INTO user_session values (1,1,1); + +# +# prepare test connections, for: +# update of parent row in node1 +# insert of child row in node1 +# insert of child row in node2 + +--connect node_1_u, 127.0.0.1, root, , test, $NODE_MYPORT_1 +--connect node_1_i, 127.0.0.1, root, , test, $NODE_MYPORT_1 +--connect node_2_i, 127.0.0.1, root, , test, $NODE_MYPORT_2 + + +# +# test phase 1: plain SQL statements +# +--echo "Phase 1: plain SQL statements" + + +--connection node_1 +let $counter=10; +let $sleep_period=1; + +while($counter > 0) +{ + --connection node_1_u + begin; + update user set j = j + 1 WHERE id > 0; + + --connection node_1_i + set debug_sync='lock_wait_suspend_thread_enter SIGNAL ins_waiting WAIT_FOR cont_ins'; + send insert into user_session(id,fk1,fk2) values (2, 2, 2); + + --connection node_1 + set debug_sync='now WAIT_FOR ins_waiting'; + + --connection node_2_i + insert into user_session(id,fk1,fk2) values (2, 2, 3); + + --connection node_1 + set debug_sync='now SIGNAL cont_ins'; + + --connection node_1_i + --error 0,ER_LOCK_DEADLOCK,ER_DUP_ENTRY + reap; + + --connection node_1_u + --error 0,ER_LOCK_DEADLOCK + commit; + + --connection node_1 + --error 0,ER_LOCK_DEADLOCK + truncate user_session; + set debug_sync = reset; + + dec $counter; +} + +# +# test phase 2: prepared statements +# +--echo "Phase 2: prepared statements" + +--connection node_1_u +prepare upd from 'update user set j = j + 1 WHERE id > 0'; + +--connection node_1_i +prepare ins1 from 'insert into user_session(id,fk1,fk2) values (2, 2, 2)'; + +--connection node_2_i +prepare ins2 from 'insert into user_session(id,fk1,fk2) values (2, 2, 3)'; + +--connection node_1 +let $counter=10; +let $sleep_period=1; + +while($counter > 0) +{ + --connection node_1_u + begin; + execute upd; + #update user set j = j + 1 WHERE id > 0; + + --connection node_1_i + set debug_sync='lock_wait_suspend_thread_enter SIGNAL ins_waiting WAIT_FOR cont_ins'; + send execute ins1; + + --connection node_1 + set debug_sync='now WAIT_FOR ins_waiting'; + + --connection node_2_i + execute ins2; + + --connection node_1 + set debug_sync='now SIGNAL cont_ins'; + + --connection node_1_i + --error 0,ER_LOCK_DEADLOCK,ER_DUP_ENTRY + reap; + + --connection node_1_u + --error 0,ER_LOCK_DEADLOCK + commit; + + --connection node_1 + + --error 0,ER_LOCK_DEADLOCK + truncate user_session; + set debug_sync = reset; + + dec $counter; +} + + +--connection node_1 + +drop table user_session,user; From 7d3161def8af04690e294d87d7483d3e0d54bbce Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Mon, 14 Jan 2019 13:09:27 +0100 Subject: [PATCH 05/18] MDEV-18225 Avoid use of LOCK_prepared_stmt_count mutex in Statement_map destructo This mutex can be freed when server shuts down (when thread_count goes down to 0) , but it is still used inside THD::~THD() when Statement_map is destroyed. The fix is to call Statement_map::reset() at the point where thread_count is still positive, and avoid locking LOCK_prepared_stmt_count in THD destructor. --- sql/sql_class.cc | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/sql/sql_class.cc b/sql/sql_class.cc index 2a42de1a11f..8424b4477c3 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -1518,6 +1518,7 @@ void THD::cleanup(void) sp_cache_clear(&sp_func_cache); mysql_ull_cleanup(this); + stmt_map.reset(); /* All metadata locks must have been released by now. */ DBUG_ASSERT(!mdl_context.has_locks()); @@ -3777,11 +3778,13 @@ void Statement_map::erase(Statement *statement) void Statement_map::reset() { /* Must be first, hash_free will reset st_hash.records */ - mysql_mutex_lock(&LOCK_prepared_stmt_count); - DBUG_ASSERT(prepared_stmt_count >= st_hash.records); - prepared_stmt_count-= st_hash.records; - mysql_mutex_unlock(&LOCK_prepared_stmt_count); - + if (st_hash.records) + { + mysql_mutex_lock(&LOCK_prepared_stmt_count); + DBUG_ASSERT(prepared_stmt_count >= st_hash.records); + prepared_stmt_count-= st_hash.records; + mysql_mutex_unlock(&LOCK_prepared_stmt_count); + } my_hash_reset(&names_hash); my_hash_reset(&st_hash); last_found_statement= 0; @@ -3790,12 +3793,8 @@ void Statement_map::reset() Statement_map::~Statement_map() { - /* Must go first, hash_free will reset st_hash.records */ - mysql_mutex_lock(&LOCK_prepared_stmt_count); - DBUG_ASSERT(prepared_stmt_count >= st_hash.records); - prepared_stmt_count-= st_hash.records; - mysql_mutex_unlock(&LOCK_prepared_stmt_count); - + /* Statement_map::reset() should be called prior to destructor. */ + DBUG_ASSERT(!st_hash.records); my_hash_free(&names_hash); my_hash_free(&st_hash); } From 71e9f0d123e201141c80a240d50347ab36ce126f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Tue, 15 Jan 2019 11:50:15 +0200 Subject: [PATCH 06/18] MDEV-17797 Add ASAN poisoning for mem_heap_t The merge commit d833bb65d53b9a4375fa71cc485b4719fdb0ee53 did not correctly merge the commit 03eb15933da9944e821bc8c787f84de50e823da0. Closes #948 --- storage/innobase/include/univ.i | 11 +++++------ storage/innobase/row/row0ftsort.cc | 7 +++---- storage/xtradb/include/univ.i | 11 +++++------ storage/xtradb/row/row0ftsort.cc | 7 +++---- 4 files changed, 16 insertions(+), 20 deletions(-) diff --git a/storage/innobase/include/univ.i b/storage/innobase/include/univ.i index a9d886607c0..5027b9cab5e 100644 --- a/storage/innobase/include/univ.i +++ b/storage/innobase/include/univ.i @@ -585,12 +585,14 @@ typedef void* os_thread_ret_t; #include "ut0dbg.h" #include "ut0ut.h" #include "db0err.h" +#include +/* define UNIV macros in terms of my_valgrind.h */ +#define UNIV_MEM_INVALID(addr, size) MEM_UNDEFINED(addr, size) +#define UNIV_MEM_FREE(addr, size) MEM_NOACCESS(addr, size) +#define UNIV_MEM_ALLOC(addr, size) UNIV_MEM_INVALID(addr, size) #ifdef UNIV_DEBUG_VALGRIND # include # define UNIV_MEM_VALID(addr, size) VALGRIND_MAKE_MEM_DEFINED(addr, size) -# define UNIV_MEM_INVALID(addr, size) VALGRIND_MAKE_MEM_UNDEFINED(addr, size) -# define UNIV_MEM_FREE(addr, size) VALGRIND_MAKE_MEM_NOACCESS(addr, size) -# define UNIV_MEM_ALLOC(addr, size) VALGRIND_MAKE_MEM_UNDEFINED(addr, size) # define UNIV_MEM_DESC(addr, size) VALGRIND_CREATE_BLOCK(addr, size, #addr) # define UNIV_MEM_UNDESC(b) VALGRIND_DISCARD(b) # define UNIV_MEM_ASSERT_RW_LOW(addr, size, should_abort) do { \ @@ -625,9 +627,6 @@ typedef void* os_thread_ret_t; } while (0) #else # define UNIV_MEM_VALID(addr, size) do {} while(0) -# define UNIV_MEM_INVALID(addr, size) do {} while(0) -# define UNIV_MEM_FREE(addr, size) do {} while(0) -# define UNIV_MEM_ALLOC(addr, size) do {} while(0) # define UNIV_MEM_DESC(addr, size) do {} while(0) # define UNIV_MEM_UNDESC(b) do {} while(0) # define UNIV_MEM_ASSERT_RW_LOW(addr, size, should_abort) do {} while(0) diff --git a/storage/innobase/row/row0ftsort.cc b/storage/innobase/row/row0ftsort.cc index 757e268c3a7..ccc26478c72 100644 --- a/storage/innobase/row/row0ftsort.cc +++ b/storage/innobase/row/row0ftsort.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 2010, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, 2018, MariaDB Corporation. +Copyright (c) 2017, 2019, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -741,7 +741,7 @@ loop: goto func_exit; } - UNIV_MEM_INVALID(block[t_ctx.buf_used][0], srv_sort_buf_size); + UNIV_MEM_INVALID(block[t_ctx.buf_used], srv_sort_buf_size); buf[t_ctx.buf_used] = row_merge_buf_empty(buf[t_ctx.buf_used]); mycount[t_ctx.buf_used] += t_ctx.rows_added[t_ctx.buf_used]; t_ctx.rows_added[t_ctx.buf_used] = 0; @@ -834,8 +834,7 @@ exit: goto func_exit; } - UNIV_MEM_INVALID(block[i][0], - srv_sort_buf_size); + UNIV_MEM_INVALID(block[i], srv_sort_buf_size); } buf[i] = row_merge_buf_empty(buf[i]); diff --git a/storage/xtradb/include/univ.i b/storage/xtradb/include/univ.i index 5df8a10bcf9..e9ff9103fdd 100644 --- a/storage/xtradb/include/univ.i +++ b/storage/xtradb/include/univ.i @@ -607,12 +607,14 @@ typedef void* os_thread_ret_t; #include "ut0dbg.h" #include "ut0ut.h" #include "db0err.h" +#include +/* define UNIV macros in terms of my_valgrind.h */ +#define UNIV_MEM_INVALID(addr, size) MEM_UNDEFINED(addr, size) +#define UNIV_MEM_FREE(addr, size) MEM_NOACCESS(addr, size) +#define UNIV_MEM_ALLOC(addr, size) UNIV_MEM_INVALID(addr, size) #ifdef UNIV_DEBUG_VALGRIND # include # define UNIV_MEM_VALID(addr, size) VALGRIND_MAKE_MEM_DEFINED(addr, size) -# define UNIV_MEM_INVALID(addr, size) VALGRIND_MAKE_MEM_UNDEFINED(addr, size) -# define UNIV_MEM_FREE(addr, size) VALGRIND_MAKE_MEM_NOACCESS(addr, size) -# define UNIV_MEM_ALLOC(addr, size) VALGRIND_MAKE_MEM_UNDEFINED(addr, size) # define UNIV_MEM_DESC(addr, size) VALGRIND_CREATE_BLOCK(addr, size, #addr) # define UNIV_MEM_UNDESC(b) VALGRIND_DISCARD(b) # define UNIV_MEM_ASSERT_RW_LOW(addr, size, should_abort) do { \ @@ -647,9 +649,6 @@ typedef void* os_thread_ret_t; } while (0) #else # define UNIV_MEM_VALID(addr, size) do {} while(0) -# define UNIV_MEM_INVALID(addr, size) do {} while(0) -# define UNIV_MEM_FREE(addr, size) do {} while(0) -# define UNIV_MEM_ALLOC(addr, size) do {} while(0) # define UNIV_MEM_DESC(addr, size) do {} while(0) # define UNIV_MEM_UNDESC(b) do {} while(0) # define UNIV_MEM_ASSERT_RW_LOW(addr, size, should_abort) do {} while(0) diff --git a/storage/xtradb/row/row0ftsort.cc b/storage/xtradb/row/row0ftsort.cc index bb9821d4484..d5df122c9a8 100644 --- a/storage/xtradb/row/row0ftsort.cc +++ b/storage/xtradb/row/row0ftsort.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 2010, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, 2018, MariaDB Corporation. +Copyright (c) 2017, 2019, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -744,7 +744,7 @@ loop: goto func_exit; } - UNIV_MEM_INVALID(block[t_ctx.buf_used][0], srv_sort_buf_size); + UNIV_MEM_INVALID(block[t_ctx.buf_used], srv_sort_buf_size); buf[t_ctx.buf_used] = row_merge_buf_empty(buf[t_ctx.buf_used]); mycount[t_ctx.buf_used] += t_ctx.rows_added[t_ctx.buf_used]; t_ctx.rows_added[t_ctx.buf_used] = 0; @@ -837,8 +837,7 @@ exit: goto func_exit; } - UNIV_MEM_INVALID(block[i][0], - srv_sort_buf_size); + UNIV_MEM_INVALID(block[i], srv_sort_buf_size); } buf[i] = row_merge_buf_empty(buf[i]); From 69328c31ed31048e5f60b9e8e5a21bbe3220f968 Mon Sep 17 00:00:00 2001 From: mkaruza Date: Tue, 15 Jan 2019 09:58:35 +0100 Subject: [PATCH 07/18] MDEV-18176 Galera test failure on galera.galera_gtid_slave_sst_rsync If galera.galera_gtid_slave_sst_rsync is repeated more than once it will fail due incorrect GTID position. After stopping SLAVE node reset also GTID_SLAVE_POS variable. --- mysql-test/suite/galera/r/galera_gtid_slave_sst_rsync.result | 1 + mysql-test/suite/galera/t/galera_gtid_slave_sst_rsync.test | 3 +++ 2 files changed, 4 insertions(+) diff --git a/mysql-test/suite/galera/r/galera_gtid_slave_sst_rsync.result b/mysql-test/suite/galera/r/galera_gtid_slave_sst_rsync.result index 81fae57d731..7953910b385 100644 --- a/mysql-test/suite/galera/r/galera_gtid_slave_sst_rsync.result +++ b/mysql-test/suite/galera/r/galera_gtid_slave_sst_rsync.result @@ -123,6 +123,7 @@ DROP TABLE t2,t1; #Connection 2 STOP SLAVE; RESET SLAVE ALL; +set global gtid_slave_pos=""; reset master; #Connection 3 reset master; diff --git a/mysql-test/suite/galera/t/galera_gtid_slave_sst_rsync.test b/mysql-test/suite/galera/t/galera_gtid_slave_sst_rsync.test index 3fe94ad16b7..3ed7ec1d09e 100644 --- a/mysql-test/suite/galera/t/galera_gtid_slave_sst_rsync.test +++ b/mysql-test/suite/galera/t/galera_gtid_slave_sst_rsync.test @@ -196,6 +196,9 @@ DROP TABLE t2,t1; --connection node_2 STOP SLAVE; RESET SLAVE ALL; +--disable_warnings +set global gtid_slave_pos=""; +--enable_warnings reset master; --echo #Connection 3 From e0633f25e8cd954197d450902f863cc824d99755 Mon Sep 17 00:00:00 2001 From: Eugene Kosov Date: Tue, 15 Jan 2019 14:55:12 +0300 Subject: [PATCH 08/18] MDEV-18243 incorrect ASAN instrumentation Poisoning memory after munmap() and friends is totally incorrect as this memory could be anything. os_mem_free_large(): remove memory poisoning --- storage/innobase/os/os0proc.cc | 3 --- storage/xtradb/os/os0proc.cc | 3 --- 2 files changed, 6 deletions(-) diff --git a/storage/innobase/os/os0proc.cc b/storage/innobase/os/os0proc.cc index ff6d65e4ae6..f711fbb025b 100644 --- a/storage/innobase/os/os0proc.cc +++ b/storage/innobase/os/os0proc.cc @@ -192,7 +192,6 @@ os_mem_free_large( ut_a(ut_total_allocated_memory >= size); ut_total_allocated_memory -= size; os_fast_mutex_unlock(&ut_list_mutex); - UNIV_MEM_FREE(ptr, size); return; } #endif /* HAVE_LARGE_PAGES && UNIV_LINUX */ @@ -208,7 +207,6 @@ os_mem_free_large( ut_a(ut_total_allocated_memory >= size); ut_total_allocated_memory -= size; os_fast_mutex_unlock(&ut_list_mutex); - UNIV_MEM_FREE(ptr, size); } #elif !defined OS_MAP_ANON ut_free(ptr); @@ -226,7 +224,6 @@ os_mem_free_large( ut_a(ut_total_allocated_memory >= size); ut_total_allocated_memory -= size; os_fast_mutex_unlock(&ut_list_mutex); - UNIV_MEM_FREE(ptr, size); } #endif } diff --git a/storage/xtradb/os/os0proc.cc b/storage/xtradb/os/os0proc.cc index 6c9116e1397..c64c37705b5 100644 --- a/storage/xtradb/os/os0proc.cc +++ b/storage/xtradb/os/os0proc.cc @@ -247,7 +247,6 @@ os_mem_free_large( ut_a(ut_total_allocated_memory >= size); ut_total_allocated_memory -= size; os_fast_mutex_unlock(&ut_list_mutex); - UNIV_MEM_FREE(ptr, size); return; } #endif /* HAVE_LARGE_PAGES && UNIV_LINUX */ @@ -263,7 +262,6 @@ os_mem_free_large( ut_a(ut_total_allocated_memory >= size); ut_total_allocated_memory -= size; os_fast_mutex_unlock(&ut_list_mutex); - UNIV_MEM_FREE(ptr, size); } #elif !defined OS_MAP_ANON ut_free(ptr); @@ -281,7 +279,6 @@ os_mem_free_large( ut_a(ut_total_allocated_memory >= size); ut_total_allocated_memory -= size; os_fast_mutex_unlock(&ut_list_mutex); - UNIV_MEM_FREE(ptr, size); } #endif } From a8a27e65a8d2f7284b1a4e8c45d0f6759b97a79f Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Mon, 14 Jan 2019 22:28:23 +0100 Subject: [PATCH 09/18] MDEV-18212 mariabackup: Make output format uniform whenever possible --- extra/mariabackup/CMakeLists.txt | 26 +- extra/mariabackup/backup_copy.cc | 127 +++---- extra/mariabackup/backup_mysql.cc | 108 +++--- extra/mariabackup/changed_page_bitmap.cc | 26 +- extra/mariabackup/common.h | 70 ++-- extra/mariabackup/{datasink.c => datasink.cc} | 4 +- .../{ds_archive.c => ds_archive.cc} | 0 .../mariabackup/{ds_buffer.c => ds_buffer.cc} | 2 +- .../{ds_compress.c => ds_compress.cc} | 8 +- .../mariabackup/{ds_stdout.c => ds_stdout.cc} | 2 +- .../{ds_tmpfile.c => ds_tmpfile.cc} | 14 +- .../{ds_xbstream.c => ds_xbstream.cc} | 12 +- extra/mariabackup/encryption_plugin.cc | 8 +- extra/mariabackup/fil_cur.cc | 32 +- extra/mariabackup/innobackupex.cc | 2 +- extra/mariabackup/write_filt.cc | 11 +- extra/mariabackup/{xbstream.c => xbstream.cc} | 37 +- extra/mariabackup/xbstream.h | 2 +- .../{xbstream_read.c => xbstream_read.cc} | 24 +- .../{xbstream_write.c => xbstream_write.cc} | 6 +- extra/mariabackup/xtrabackup.cc | 350 ++++++++---------- extra/mariabackup/xtrabackup.h | 14 +- 22 files changed, 408 insertions(+), 477 deletions(-) rename extra/mariabackup/{datasink.c => datasink.cc} (97%) rename extra/mariabackup/{ds_archive.c => ds_archive.cc} (100%) rename extra/mariabackup/{ds_buffer.c => ds_buffer.cc} (98%) rename extra/mariabackup/{ds_compress.c => ds_compress.cc} (98%) rename extra/mariabackup/{ds_stdout.c => ds_stdout.cc} (97%) rename extra/mariabackup/{ds_tmpfile.c => ds_tmpfile.cc} (94%) rename extra/mariabackup/{ds_xbstream.c => ds_xbstream.cc} (94%) rename extra/mariabackup/{xbstream.c => xbstream.cc} (92%) rename extra/mariabackup/{xbstream_read.c => xbstream_read.cc} (89%) rename extra/mariabackup/{xbstream_write.c => xbstream_write.cc} (96%) diff --git a/extra/mariabackup/CMakeLists.txt b/extra/mariabackup/CMakeLists.txt index e71f24e0b92..aaff58ebf76 100644 --- a/extra/mariabackup/CMakeLists.txt +++ b/extra/mariabackup/CMakeLists.txt @@ -57,19 +57,19 @@ MYSQL_ADD_EXECUTABLE(mariabackup xtrabackup.cc innobackupex.cc changed_page_bitmap.cc - datasink.c - ds_buffer.c - ds_compress.c + datasink.cc + ds_buffer.cc + ds_compress.cc ds_local.cc - ds_stdout.c - ds_tmpfile.c - ds_xbstream.c + ds_stdout.cc + ds_tmpfile.cc + ds_xbstream.cc fil_cur.cc quicklz/quicklz.c read_filt.cc write_filt.cc wsrep.cc - xbstream_write.c + xbstream_write.cc backup_mysql.cc backup_copy.cc encryption_plugin.cc @@ -96,13 +96,13 @@ ENDIF() # xbstream binary ######################################################################## MYSQL_ADD_EXECUTABLE(mbstream - ds_buffer.c + ds_buffer.cc ds_local.cc - ds_stdout.c - datasink.c - xbstream.c - xbstream_read.c - xbstream_write.c + ds_stdout.cc + datasink.cc + xbstream.cc + xbstream_read.cc + xbstream_write.cc COMPONENT backup ) diff --git a/extra/mariabackup/backup_copy.cc b/extra/mariabackup/backup_copy.cc index 54b369805a7..1fb5dd0fda6 100644 --- a/extra/mariabackup/backup_copy.cc +++ b/extra/mariabackup/backup_copy.cc @@ -237,7 +237,7 @@ datadir_iter_next_database(datadir_iter_t *it) if (os_file_closedir(it->dbdir) != 0) { msg("Warning: could not" - " close database directory %s\n", it->dbpath); + " close database directory %s", it->dbpath); it->err = DB_ERROR; @@ -278,7 +278,7 @@ datadir_iter_next_database(datadir_iter_t *it) } if (check_if_skip_database_by_path(it->dbpath)) { - msg("Skipping db: %s\n", it->dbpath); + msg("Skipping db: %s", it->dbpath); continue; } @@ -522,19 +522,15 @@ datafile_open(const char *file, datafile_cur_t *cursor, uint thread_n) /* The following call prints an error message */ os_file_get_last_error(TRUE); - msg("[%02u] error: cannot open " - "file %s\n", - thread_n, cursor->abs_path); + msg(thread_n,"error: cannot open " + "file %s", cursor->abs_path); return(false); } if (!my_stat(cursor->abs_path, &cursor->statinfo, 0)) { - msg("[%02u] error: cannot stat %s\n", - thread_n, cursor->abs_path); - + msg(thread_n, "error: cannot stat %s", cursor->abs_path); datafile_close(cursor); - return(false); } @@ -728,9 +724,8 @@ directory_exists(const char *dir, bool create) if (mkdirp(dir, 0777, MYF(0)) < 0) { my_strerror(errbuf, sizeof(errbuf), my_errno); - msg("Can not create directory %s: %s\n", dir, errbuf); + msg("Can not create directory %s: %s", dir, errbuf); return(false); - } } @@ -739,7 +734,7 @@ directory_exists(const char *dir, bool create) if (os_dir == NULL) { my_strerror(errbuf, sizeof(errbuf), my_errno); - msg("Can not open directory %s: %s\n", dir, + msg("Can not open directory %s: %s", dir, errbuf); return(false); @@ -768,7 +763,7 @@ directory_exists_and_empty(const char *dir, const char *comment) os_dir = os_file_opendir(dir, FALSE); if (os_dir == NULL) { - msg("%s can not open directory %s\n", comment, dir); + msg("%s can not open directory %s", comment, dir); return(false); } @@ -777,7 +772,7 @@ directory_exists_and_empty(const char *dir, const char *comment) os_file_closedir(os_dir); if (!empty) { - msg("%s directory %s is not empty!\n", comment, dir); + msg("%s directory %s is not empty!", comment, dir); } return(empty); @@ -826,7 +821,7 @@ datafile_copy_backup(const char *filepath, uint thread_n) of the filters value. */ if (check_if_skip_table(filepath)) { - msg_ts("[%02u] Skipping %s.\n", thread_n, filepath); + msg(thread_n,"Skipping %s.", filepath); return(true); } @@ -892,14 +887,13 @@ backup_file_vprintf(const char *filename, const char *fmt, va_list ap) dstfile = ds_open(ds_data, filename, &stat); if (dstfile == NULL) { - msg("[%02u] error: " - "cannot open the destination stream for %s\n", - 0, filename); + msg("error: Can't open the destination stream for %s", + filename); goto error; } action = xb_get_copy_action("Writing"); - msg_ts("[%02u] %s %s\n", 0, action, filename); + msg("%s %s", action, filename); if (buf_len == -1) { goto error; @@ -910,7 +904,7 @@ backup_file_vprintf(const char *filename, const char *fmt, va_list ap) } /* close */ - msg_ts("[%02u] ...done\n", 0); + msg(" ...done"); free(buf); if (ds_close(dstfile)) { @@ -926,7 +920,7 @@ error: } error_close: - msg("[%02u] Error: backup file failed.\n", 0); + msg("Error: backup file failed."); return(false); /*ERROR*/ } @@ -986,7 +980,7 @@ run_data_threads(datadir_iter_t *it, os_thread_func_t func, uint n) for (i = 0; i < n; i++) { ret = data_threads[i].ret && ret; if (!data_threads[i].ret) { - msg("Error: thread %u failed.\n", i); + msg("Error: thread %u failed.", i); } } @@ -1021,14 +1015,12 @@ copy_file(ds_ctxt_t *datasink, dstfile = ds_open(datasink, dst_path, &cursor.statinfo); if (dstfile == NULL) { - msg("[%02u] error: " - "cannot open the destination stream for %s\n", - thread_n, dst_name); + msg(thread_n,"error: " + "cannot open the destination stream for %s", dst_name); goto error; } - msg_ts("[%02u] %s %s to %s\n", - thread_n, xb_get_copy_action(), src_file_path, dstfile->path); + msg(thread_n, "%s %s to %s", xb_get_copy_action(), src_file_path, dstfile->path); /* The main copy loop */ while ((res = datafile_read(&cursor)) == XB_FIL_CUR_SUCCESS) { @@ -1043,7 +1035,7 @@ copy_file(ds_ctxt_t *datasink, } /* close */ - msg_ts("[%02u] ...done\n", thread_n); + msg(thread_n," ...done"); datafile_close(&cursor); if (ds_close(dstfile)) { goto error_close; @@ -1057,7 +1049,7 @@ error: } error_close: - msg("[%02u] Error: copy_file() failed.\n", thread_n); + msg(thread_n,"Error: copy_file() failed."); return(false); /*ERROR*/ } @@ -1089,36 +1081,34 @@ move_file(ds_ctxt_t *datasink, if (file_exists(dst_file_path_abs)) { msg("Error: Move file %s to %s failed: Destination " - "file exists\n", - src_file_path, dst_file_path_abs); + "file exists", src_file_path, dst_file_path_abs); return(false); } - msg_ts("[%02u] Moving %s to %s\n", - thread_n, src_file_path, dst_file_path_abs); + msg(thread_n,"Moving %s to %s", src_file_path, dst_file_path_abs); if (my_rename(src_file_path, dst_file_path_abs, MYF(0)) != 0) { if (my_errno == EXDEV) { bool ret; ret = copy_file(datasink, src_file_path, dst_file_path, thread_n); - msg_ts("[%02u] Removing %s\n", thread_n, src_file_path); + msg(thread_n,"Removing %s", src_file_path); if (unlink(src_file_path) != 0) { my_strerror(errbuf, sizeof(errbuf), errno); - msg("Error: unlink %s failed: %s\n", + msg("Error: unlink %s failed: %s", src_file_path, errbuf); } return(ret); } my_strerror(errbuf, sizeof(errbuf), my_errno); - msg("Can not move file %s to %s: %s\n", + msg("Can not move file %s to %s: %s", src_file_path, dst_file_path_abs, errbuf); return(false); } - msg_ts("[%02u] ...done\n", thread_n); + msg(thread_n," ...done"); return(true); } @@ -1270,13 +1260,13 @@ backup_files(const char *from, bool prep_mode) prep_mode ? 1 : 2); rsync_tmpfile = fopen(rsync_tmpfile_name, "w"); if (rsync_tmpfile == NULL) { - msg("Error: can't create file %s\n", + msg("Error: can't create file %s", rsync_tmpfile_name); return(false); } } - msg_ts("Starting %s non-InnoDB tables and files\n", + msg("Starting %s non-InnoDB tables and files", prep_mode ? "prep copy of" : "to backup"); datadir_node_init(&node); @@ -1292,7 +1282,7 @@ backup_files(const char *from, bool prep_mode) ret = datafile_copy_backup(node.filepath, 1); } if (!ret) { - msg("Failed to copy file %s\n", node.filepath); + msg("Failed to copy file %s", node.filepath); goto out; } } else if (!prep_mode) { @@ -1302,7 +1292,7 @@ backup_files(const char *from, bool prep_mode) "%s/db.opt", node.filepath); if (!(ret = backup_file_printf( trim_dotslash(path), "%s", ""))) { - msg("Failed to create file %s\n", path); + msg("Failed to create file %s", path); goto out; } } @@ -1327,13 +1317,13 @@ backup_files(const char *from, bool prep_mode) cmd << "rsync -t . --files-from=" << rsync_tmpfile_name << " " << xtrabackup_target_dir; - msg_ts("Starting rsync as: %s\n", cmd.str().c_str()); + msg("Starting rsync as: %s", cmd.str().c_str()); if ((err = system(cmd.str().c_str()) && !prep_mode) != 0) { - msg_ts("Error: rsync failed with error code %d\n", err); + msg("Error: rsync failed with error code %d", err); ret = false; goto out; } - msg_ts("rsync finished successfully.\n"); + msg("rsync finished successfully."); if (!prep_mode && !opt_no_lock) { char path[FN_REFLEN]; @@ -1349,7 +1339,7 @@ backup_files(const char *from, bool prep_mode) rsync_tmpfile = fopen(rsync_tmpfile_name, "r"); if (rsync_tmpfile == NULL) { - msg("Error: can't open file %s\n", + msg("Error: can't open file %s", rsync_tmpfile_name); ret = false; goto out; @@ -1365,7 +1355,7 @@ backup_files(const char *from, bool prep_mode) snprintf(dst_path, sizeof(dst_path), "%s/%s", xtrabackup_target_dir, path); - msg_ts("Removing %s\n", dst_path); + msg("Removing %s", dst_path); unlink(dst_path); } } @@ -1375,7 +1365,7 @@ backup_files(const char *from, bool prep_mode) } } - msg_ts("Finished %s non-InnoDB tables and files\n", + msg("Finished %s non-InnoDB tables and files", prep_mode ? "a prep copy of" : "backing up"); out: @@ -1447,7 +1437,7 @@ bool backup_start() rocksdb_create_checkpoint(); } - msg_ts("Waiting for log copy thread to read lsn %llu\n", (ulonglong)server_lsn_after_lock); + msg("Waiting for log copy thread to read lsn %llu", (ulonglong)server_lsn_after_lock); backup_wait_for_lsn(server_lsn_after_lock); backup_fix_ddl(); @@ -1490,7 +1480,7 @@ bool backup_start() } if (have_flush_engine_logs && !opt_no_lock) { - msg_ts("Executing FLUSH NO_WRITE_TO_BINLOG ENGINE LOGS...\n"); + msg("Executing FLUSH NO_WRITE_TO_BINLOG ENGINE LOGS..."); xb_mysql_query(mysql_connection, "FLUSH NO_WRITE_TO_BINLOG ENGINE LOGS", false); } @@ -1514,7 +1504,7 @@ void backup_release() } if (opt_safe_slave_backup && sql_thread_started) { - msg("Starting slave SQL thread\n"); + msg("Starting slave SQL thread"); xb_mysql_query(mysql_connection, "START SLAVE SQL_THREAD", false); } @@ -1540,12 +1530,12 @@ bool backup_finish() rocksdb_backup_checkpoint(); } - msg_ts("Backup created in directory '%s'\n", xtrabackup_target_dir); + msg("Backup created in directory '%s'", xtrabackup_target_dir); if (mysql_binlog_position != NULL) { - msg("MySQL binlog position: %s\n", mysql_binlog_position); + msg("MySQL binlog position: %s", mysql_binlog_position); } if (mysql_slave_position && opt_slave_info) { - msg("MySQL slave binlog position: %s\n", + msg("MySQL slave binlog position: %s", mysql_slave_position); } @@ -1605,7 +1595,7 @@ ibx_copy_incremental_over_full() if (!(ret = copy_file(ds_data, node.filepath, node.filepath_rel, 1))) { - msg("Failed to copy file %s\n", + msg("Failed to copy file %s", node.filepath); goto cleanup; } @@ -1745,7 +1735,7 @@ copy_back() /* cd to backup directory */ if (my_setwd(xtrabackup_target_dir, MYF(MY_WME))) { - msg("cannot my_setwd %s\n", xtrabackup_target_dir); + msg("Can't my_setwd %s", xtrabackup_target_dir); return(false); } @@ -1758,7 +1748,7 @@ copy_back() srv_sys_space.set_path("."); if (!srv_sys_space.parse_params(innobase_data_file_path, true)) { - msg("syntax error in innodb_data_file_path\n"); + msg("syntax error in innodb_data_file_path"); return(false); } @@ -1872,12 +1862,12 @@ copy_back() snprintf(path, sizeof(path), "%s/%s", mysql_data_home, node.filepath_rel); - msg_ts("[%02u] Creating directory %s\n", 1, path); + msg("Creating directory %s", path); if (mkdirp(path, 0777, MYF(0)) < 0) { char errbuf[MYSYS_STRERROR_SIZE]; my_strerror(errbuf, sizeof(errbuf), my_errno); - msg("Can not create directory %s: %s\n", + msg("Can not create directory %s: %s", path, errbuf); ret = false; @@ -1885,7 +1875,7 @@ copy_back() } - msg_ts("[%02u] ...done.", 1); + msg(" ...done."); continue; } @@ -1995,14 +1985,14 @@ decrypt_decompress_file(const char *filepath, uint thread_n) if (needs_action) { - msg_ts("[%02u] %s\n", thread_n, message.str().c_str()); + msg(thread_n,"%s\n", message.str().c_str()); if (system(cmd.str().c_str()) != 0) { return(false); } if (opt_remove_original) { - msg_ts("[%02u] removing %s\n", thread_n, filepath); + msg(thread_n, "Removing %s", filepath); if (my_delete(filepath, MYF(MY_WME)) != 0) { return(false); } @@ -2065,7 +2055,7 @@ decrypt_decompress() /* cd to backup directory */ if (my_setwd(xtrabackup_target_dir, MYF(MY_WME))) { - msg("cannot my_setwd %s\n", xtrabackup_target_dir); + msg("Can't my_setwd %s", xtrabackup_target_dir); return(false); } @@ -2215,8 +2205,7 @@ static void copy_or_move_dir(const char *from, const char *to, bool do_copy, boo rc = make_hardlink(from_path, to_path); if (rc) { - msg_ts("[%02u] Creating hardlink from %s to %s\n", - 1, from_path, to_path); + msg("Creating hardlink from %s to %s",from_path, to_path); } else { @@ -2250,14 +2239,14 @@ static void copy_or_move_dir(const char *from, const char *to, bool do_copy, boo */ static void rocksdb_lock_checkpoint() { - msg_ts("Obtaining rocksdb checkpoint lock.\n"); + msg("Obtaining rocksdb checkpoint lock."); MYSQL_RES *res = xb_mysql_query(mysql_connection, "SELECT GET_LOCK('mariabackup_rocksdb_checkpoint',3600)", true, true); MYSQL_ROW r = mysql_fetch_row(res); if (r && r[0] && strcmp(r[0], "1")) { - msg_ts("Could not obtain rocksdb checkpont lock\n"); + msg("Could not obtain rocksdb checkpont lock."); exit(EXIT_FAILURE); } mysql_free_result(res); @@ -2311,7 +2300,7 @@ static void rocksdb_create_checkpoint() if (!access(rocksdb_checkpoint_dir, 0)) { - msg_ts("Removing rocksdb checkpoint from previous backup attempt.\n"); + msg("Removing rocksdb checkpoint from previous backup attempt."); rocksdb_remove_checkpoint_directory(); } @@ -2327,14 +2316,14 @@ static void rocksdb_create_checkpoint() */ static void rocksdb_backup_checkpoint() { - msg_ts("Backing up rocksdb files.\n"); + msg("Backing up rocksdb files."); char rocksdb_backup_dir[FN_REFLEN]; snprintf(rocksdb_backup_dir, sizeof(rocksdb_backup_dir), "%s/" ROCKSDB_BACKUP_DIR , xtrabackup_target_dir); bool backup_to_directory = xtrabackup_backup && xtrabackup_stream_fmt == XB_STREAM_FMT_NONE; if (backup_to_directory) { if (my_mkdir(rocksdb_backup_dir, 0777, MYF(0))){ - msg_ts("Can't create rocksdb backup directory %s\n", rocksdb_backup_dir); + msg("Can't create rocksdb backup directory %s", rocksdb_backup_dir); exit(EXIT_FAILURE); } } diff --git a/extra/mariabackup/backup_mysql.cc b/extra/mariabackup/backup_mysql.cc index 94b3baf5c3d..0dbd2425363 100644 --- a/extra/mariabackup/backup_mysql.cc +++ b/extra/mariabackup/backup_mysql.cc @@ -104,7 +104,7 @@ xb_mysql_connect() sprintf(mysql_port_str, "%d", opt_port); if (connection == NULL) { - msg("Failed to init MySQL struct: %s.\n", + msg("Failed to init MySQL struct: %s.", mysql_error(connection)); return(NULL); } @@ -120,8 +120,8 @@ xb_mysql_connect() mysql_options(connection, MYSQL_OPT_PROTOCOL, &opt_protocol); mysql_options(connection,MYSQL_SET_CHARSET_NAME, "utf8"); - msg_ts("Connecting to MySQL server host: %s, user: %s, password: %s, " - "port: %s, socket: %s\n", opt_host ? opt_host : "localhost", + msg("Connecting to MySQL server host: %s, user: %s, password: %s, " + "port: %s, socket: %s", opt_host ? opt_host : "localhost", opt_user ? opt_user : "not set", opt_password ? "set" : "not set", opt_port != 0 ? mysql_port_str : "not set", @@ -147,8 +147,7 @@ xb_mysql_connect() opt_password, "" /*database*/, opt_port, opt_socket, 0)) { - msg("Failed to connect to MySQL server: %s.\n", - mysql_error(connection)); + msg("Failed to connect to MySQL server: %s.", mysql_error(connection)); mysql_close(connection); return(NULL); } @@ -168,8 +167,7 @@ xb_mysql_query(MYSQL *connection, const char *query, bool use_result, MYSQL_RES *mysql_result = NULL; if (mysql_query(connection, query)) { - msg("Error: failed to execute query %s: %s\n", query, - mysql_error(connection)); + msg("Error: failed to execute query %s: %s", query, mysql_error(connection)); if (die_on_error) { exit(EXIT_FAILURE); } @@ -179,7 +177,7 @@ xb_mysql_query(MYSQL *connection, const char *query, bool use_result, /* store result set on client if there is a result */ if (mysql_field_count(connection) > 0) { if ((mysql_result = mysql_store_result(connection)) == NULL) { - msg("Error: failed to fetch query result %s: %s\n", + msg("Error: failed to fetch query result %s: %s", query, mysql_error(connection)); exit(EXIT_FAILURE); } @@ -316,11 +314,11 @@ check_server_version(unsigned long version_number, msg("Error: Built-in InnoDB in MySQL 5.1 is not " "supported in this release. You can either use " "Percona XtraBackup 2.0, or upgrade to InnoDB " - "plugin.\n"); + "plugin."); } else if (!version_supported) { msg("Error: Unsupported server version: '%s'. Please " "report a bug at " - "https://bugs.launchpad.net/percona-xtrabackup\n", + "https://bugs.launchpad.net/percona-xtrabackup", version_string); } @@ -407,7 +405,7 @@ get_mysql_vars(MYSQL *connection) opt_binlog_info == BINLOG_INFO_LOCKLESS) { msg("Error: --binlog-info=LOCKLESS is not supported by the " - "server\n"); + "server"); return(false); } @@ -445,7 +443,7 @@ get_mysql_vars(MYSQL *connection) have_gtid_slave = true; } - msg("Using server version %s\n", version_var); + msg("Using server version %s", version_var); if (!(ret = detect_mysql_capabilities_for_backup())) { goto out; @@ -455,17 +453,17 @@ get_mysql_vars(MYSQL *connection) if (check_if_param_set("datadir")) { if (!directory_exists(mysql_data_home, false)) { msg("Warning: option 'datadir' points to " - "nonexistent directory '%s'\n", mysql_data_home); + "nonexistent directory '%s'", mysql_data_home); } if (!directory_exists(datadir_var, false)) { msg("Warning: MySQL variable 'datadir' points to " - "nonexistent directory '%s'\n", datadir_var); + "nonexistent directory '%s'", datadir_var); } if (!equal_paths(mysql_data_home, datadir_var)) { msg("Warning: option 'datadir' has different " "values:\n" " '%s' in defaults file\n" - " '%s' in SHOW VARIABLES\n", + " '%s' in SHOW VARIABLES", mysql_data_home, datadir_var); } } @@ -564,14 +562,14 @@ detect_mysql_capabilities_for_backup() if (opt_galera_info && !have_galera_enabled) { msg("--galera-info is specified on the command " "line, but the server does not support Galera " - "replication. Ignoring the option.\n"); + "replication. Ignoring the option."); opt_galera_info = false; } if (opt_slave_info && have_multi_threaded_slave && !have_gtid_slave) { msg("The --slave-info option requires GTID enabled for a " - "multi-threaded slave.\n"); + "multi-threaded slave."); return(false); } @@ -618,7 +616,7 @@ select_incremental_lsn_from_history(lsn_t *incremental_lsn) const MYSQL_ROW row = mysql_fetch_row(mysql_result); if (row) { *incremental_lsn = strtoull(row[0], NULL, 10); - msg("Found and using lsn: " LSN_PF " for %s %s\n", + msg("Found and using lsn: " LSN_PF " for %s %s", *incremental_lsn, opt_incremental_history_uuid ? "uuid" : "name", opt_incremental_history_uuid ? @@ -626,7 +624,7 @@ select_incremental_lsn_from_history(lsn_t *incremental_lsn) opt_incremental_history_name); } else { msg("Error while attempting to find history record " - "for %s %s\n", + "for %s %s", opt_incremental_history_uuid ? "uuid" : "name", opt_incremental_history_uuid ? opt_incremental_history_uuid : @@ -736,7 +734,7 @@ have_queries_to_wait_for(MYSQL *connection, uint threshold) && duration >= (int)threshold && ((all_queries && is_query(info)) || is_update_query(info))) { - msg_ts("Waiting for query %s (duration %d sec): %s", + msg("Waiting for query %s (duration %d sec): %s", id, duration, info); have_to_wait = true; break; @@ -765,7 +763,7 @@ kill_long_queries(MYSQL *connection, time_t timeout) (time_t)duration >= timeout && ((all_queries && is_query(info)) || is_select_query(info))) { - msg_ts("Killing query %s (duration %d sec): %s\n", + msg("Killing query %s (duration %d sec): %s", id, (int)duration, info); snprintf(kill_stmt, sizeof(kill_stmt), "KILL %s", id); @@ -784,8 +782,8 @@ wait_for_no_updates(MYSQL *connection, uint timeout, uint threshold) start_time = time(NULL); - msg_ts("Waiting %u seconds for queries running longer than %u seconds " - "to finish\n", timeout, threshold); + msg("Waiting %u seconds for queries running longer than %u seconds " + "to finish", timeout, threshold); while (time(NULL) <= (time_t)(start_time + timeout)) { if (!have_queries_to_wait_for(connection, threshold)) { @@ -794,7 +792,7 @@ wait_for_no_updates(MYSQL *connection, uint timeout, uint threshold) os_thread_sleep(1000000); } - msg_ts("Unable to obtain lock. Please try again later."); + msg("Unable to obtain lock. Please try again later."); return(false); } @@ -812,7 +810,7 @@ kill_query_thread( os_event_set(kill_query_thread_started); - msg_ts("Kill query timeout %d seconds.\n", + msg("Kill query timeout %d seconds.", opt_kill_long_queries_timeout); while (time(NULL) - start_time < @@ -824,7 +822,7 @@ kill_query_thread( } if ((mysql = xb_mysql_connect()) == NULL) { - msg("Error: kill query thread failed\n"); + msg("Error: kill query thread failed"); goto stop_thread; } @@ -839,7 +837,7 @@ kill_query_thread( mysql_close(mysql); stop_thread: - msg_ts("Kill query thread stopped\n"); + msg("Kill query thread stopped"); os_event_set(kill_query_thread_stopped); @@ -889,7 +887,7 @@ DECLARE_THREAD(kill_mdl_waiters_thread(void *)) { MYSQL *mysql; if ((mysql = xb_mysql_connect()) == NULL) { - msg("Error: kill mdl waiters thread failed to connect\n"); + msg("Error: kill mdl waiters thread failed to connect"); goto stop_thread; } @@ -908,11 +906,11 @@ DECLARE_THREAD(kill_mdl_waiters_thread(void *)) if (row[1] && !strcmp(row[1], "Killed")) continue; - msg_ts("Killing MDL waiting %s ('%s') on connection %s\n", + msg("Killing MDL waiting %s ('%s') on connection %s", row[1], row[2], row[0]); snprintf(query, sizeof(query), "KILL QUERY %s", row[0]); if (mysql_query(mysql, query) && (mysql_errno(mysql) != ER_NO_SUCH_THREAD)) { - msg("Error: failed to execute query %s: %s\n", query,mysql_error(mysql)); + msg("Error: failed to execute query %s: %s", query,mysql_error(mysql)); exit(EXIT_FAILURE); } } @@ -922,7 +920,7 @@ DECLARE_THREAD(kill_mdl_waiters_thread(void *)) mysql_close(mysql); stop_thread: - msg_ts("Kill mdl waiters thread stopped\n"); + msg("Kill mdl waiters thread stopped"); os_event_set(mdl_killer_finished_event); os_thread_exit(); return os_thread_ret_t(0); @@ -964,7 +962,7 @@ lock_tables(MYSQL *connection) } if (have_backup_locks) { - msg_ts("Executing LOCK TABLES FOR BACKUP...\n"); + msg("Executing LOCK TABLES FOR BACKUP..."); xb_mysql_query(connection, "LOCK TABLES FOR BACKUP", false); return(true); } @@ -987,7 +985,7 @@ lock_tables(MYSQL *connection) compatible with this trick. */ - msg_ts("Executing FLUSH NO_WRITE_TO_BINLOG TABLES...\n"); + msg("Executing FLUSH NO_WRITE_TO_BINLOG TABLES..."); xb_mysql_query(connection, "FLUSH NO_WRITE_TO_BINLOG TABLES", false); @@ -1000,7 +998,7 @@ lock_tables(MYSQL *connection) } } - msg_ts("Executing FLUSH TABLES WITH READ LOCK...\n"); + msg("Executing FLUSH TABLES WITH READ LOCK..."); if (opt_kill_long_queries_timeout) { start_query_killer(); @@ -1033,7 +1031,7 @@ bool lock_binlog_maybe(MYSQL *connection) { if (have_backup_locks && !opt_no_lock && !binlog_locked) { - msg_ts("Executing LOCK BINLOG FOR BACKUP...\n"); + msg("Executing LOCK BINLOG FOR BACKUP..."); xb_mysql_query(connection, "LOCK BINLOG FOR BACKUP", false); binlog_locked = true; @@ -1052,20 +1050,20 @@ void unlock_all(MYSQL *connection) { if (opt_debug_sleep_before_unlock) { - msg_ts("Debug sleep for %u seconds\n", + msg("Debug sleep for %u seconds", opt_debug_sleep_before_unlock); os_thread_sleep(opt_debug_sleep_before_unlock * 1000); } if (binlog_locked) { - msg_ts("Executing UNLOCK BINLOG\n"); + msg("Executing UNLOCK BINLOG"); xb_mysql_query(connection, "UNLOCK BINLOG", false); } - msg_ts("Executing UNLOCK TABLES\n"); + msg("Executing UNLOCK TABLES"); xb_mysql_query(connection, "UNLOCK TABLES", false); - msg_ts("All tables unlocked\n"); + msg("All tables unlocked"); } @@ -1116,7 +1114,7 @@ wait_for_safe_slave(MYSQL *connection) if (!(read_master_log_pos && slave_sql_running)) { msg("Not checking slave open temp tables for " - "--safe-slave-backup because host is not a slave\n"); + "--safe-slave-backup because host is not a slave"); goto cleanup; } @@ -1130,36 +1128,36 @@ wait_for_safe_slave(MYSQL *connection) } open_temp_tables = get_open_temp_tables(connection); - msg_ts("Slave open temp tables: %d\n", open_temp_tables); + msg("Slave open temp tables: %d", open_temp_tables); while (open_temp_tables && n_attempts--) { - msg_ts("Starting slave SQL thread, waiting %d seconds, then " + msg("Starting slave SQL thread, waiting %d seconds, then " "checking Slave_open_temp_tables again (%d attempts " - "remaining)...\n", sleep_time, n_attempts); + "remaining)...", sleep_time, n_attempts); xb_mysql_query(connection, "START SLAVE SQL_THREAD", false); os_thread_sleep(sleep_time * 1000000); xb_mysql_query(connection, "STOP SLAVE SQL_THREAD", false); open_temp_tables = get_open_temp_tables(connection); - msg_ts("Slave open temp tables: %d\n", open_temp_tables); + msg("Slave open temp tables: %d", open_temp_tables); } /* Restart the slave if it was running at start */ if (open_temp_tables == 0) { - msg_ts("Slave is safe to backup\n"); + msg("Slave is safe to backup"); goto cleanup; } result = false; if (sql_thread_started) { - msg_ts("Restarting slave SQL thread.\n"); + msg("Restarting slave SQL thread."); xb_mysql_query(connection, "START SLAVE SQL_THREAD", false); } - msg_ts("Slave_open_temp_tables did not become zero after " - "%d seconds\n", opt_safe_slave_backup_timeout); + msg("Slave_open_temp_tables did not become zero after " + "%d seconds", opt_safe_slave_backup_timeout); cleanup: free_mysql_variables(status); @@ -1201,10 +1199,8 @@ write_slave_info(MYSQL *connection) if (master == NULL || filename == NULL || position == NULL) { msg("Failed to get master binlog coordinates " - "from SHOW SLAVE STATUS\n"); - msg("This means that the server is not a " - "replication slave. Ignoring the --slave-info " - "option\n"); + "from SHOW SLAVE STATUS.This means that the server is not a " + "replication slave. Ignoring the --slave-info option"); /* we still want to continue the backup */ result = true; goto cleanup; @@ -1287,7 +1283,7 @@ write_galera_info(MYSQL *connection) if ((state_uuid == NULL && state_uuid55 == NULL) || (last_committed == NULL && last_committed55 == NULL)) { - msg("Failed to get master wsrep state from SHOW STATUS.\n"); + msg("Failed to get master wsrep state from SHOW STATUS."); result = false; goto cleanup; } @@ -1800,9 +1796,9 @@ mdl_lock_table(ulint space_id) std::ostringstream lock_query; lock_query << "SELECT 1 FROM " << full_table_name << " LIMIT 0"; - msg_ts("Locking MDL for %s\n", full_table_name.c_str()); + msg("Locking MDL for %s", full_table_name.c_str()); if (mysql_query(mdl_con, lock_query.str().c_str())) { - msg_ts("Warning : locking MDL failed for space id %zu, name %s\n", space_id, full_table_name.c_str()); + msg("Warning : locking MDL failed for space id %zu, name %s", space_id, full_table_name.c_str()); } else { MYSQL_RES *r = mysql_store_result(mdl_con); mysql_free_result(r); @@ -1812,7 +1808,7 @@ mdl_lock_table(ulint space_id) void mdl_unlock_all() { - msg_ts("Unlocking MDL for all tables\n"); + msg("Unlocking MDL for all tables"); xb_mysql_query(mdl_con, "COMMIT", false, true); mysql_close(mdl_con); spaceid_to_tablename.clear(); diff --git a/extra/mariabackup/changed_page_bitmap.cc b/extra/mariabackup/changed_page_bitmap.cc index 46bb3a7bcb5..c336aa1229d 100644 --- a/extra/mariabackup/changed_page_bitmap.cc +++ b/extra/mariabackup/changed_page_bitmap.cc @@ -202,7 +202,7 @@ log_online_read_bitmap_page( /* The following call prints an error message */ os_file_get_last_error(TRUE); msg("InnoDB: Warning: failed reading changed page bitmap " - "file \'%s\'\n", bitmap_file->name); + "file \'%s\'", bitmap_file->name); return FALSE; } @@ -281,7 +281,7 @@ log_online_setup_bitmap_file_range( bitmap_dir = os_file_opendir(srv_data_home, FALSE); if (UNIV_UNLIKELY(!bitmap_dir)) { - msg("InnoDB: Error: failed to open bitmap directory \'%s\'\n", + msg("InnoDB: Error: failed to open bitmap directory \'%s\'", srv_data_home); return FALSE; } @@ -331,7 +331,7 @@ log_online_setup_bitmap_file_range( if (UNIV_UNLIKELY(os_file_closedir(bitmap_dir))) { os_file_get_last_error(TRUE); - msg("InnoDB: Error: cannot close \'%s\'\n",srv_data_home); + msg("InnoDB: Error: cannot close \'%s\'",srv_data_home); return FALSE; } @@ -348,7 +348,7 @@ log_online_setup_bitmap_file_range( bitmap_dir = os_file_opendir(srv_data_home, FALSE); if (UNIV_UNLIKELY(!bitmap_dir)) { - msg("InnoDB: Error: failed to open bitmap directory \'%s\'\n", + msg("InnoDB: Error: failed to open bitmap directory \'%s\'", srv_data_home); return FALSE; } @@ -379,7 +379,7 @@ log_online_setup_bitmap_file_range( if (UNIV_UNLIKELY(array_pos >= bitmap_files->count)) { msg("InnoDB: Error: inconsistent bitmap file " - "directory\n"); + "directory"); free(bitmap_files->files); return FALSE; } @@ -399,7 +399,7 @@ log_online_setup_bitmap_file_range( if (UNIV_UNLIKELY(os_file_closedir(bitmap_dir))) { os_file_get_last_error(TRUE); - msg("InnoDB: Error: cannot close \'%s\'\n", srv_data_home); + msg("InnoDB: Error: cannot close \'%s\'", srv_data_home); free(bitmap_files->files); return FALSE; } @@ -450,7 +450,7 @@ log_online_open_bitmap_file_read_only( /* Here and below assume that bitmap file names do not contain apostrophes, thus no need for ut_print_filename(). */ msg("InnoDB: Warning: error opening the changed page " - "bitmap \'%s\'\n", bitmap_file->name); + "bitmap \'%s\'", bitmap_file->name); return success; } @@ -494,7 +494,7 @@ log_online_diagnose_bitmap_eof( itself. */ msg("InnoDB: Warning: junk at the end of changed " - "page bitmap file \'%s\'.\n", bitmap_file->name); + "page bitmap file \'%s\'.", bitmap_file->name); } if (UNIV_UNLIKELY(!last_page_in_run)) { @@ -505,7 +505,7 @@ log_online_diagnose_bitmap_eof( for the whole server */ msg("InnoDB: Warning: changed page bitmap " "file \'%s\' does not contain a complete run " - "at the end.\n", bitmap_file->name); + "at the end.", bitmap_file->name); return FALSE; } } @@ -536,7 +536,7 @@ xb_msg_missing_lsn_data( lsn_t missing_interval_end) /*!datasink = ds; } else { - msg("Error: failed to initialize datasink.\n"); + msg("Error: failed to initialize datasink."); exit(EXIT_FAILURE); } diff --git a/extra/mariabackup/ds_archive.c b/extra/mariabackup/ds_archive.cc similarity index 100% rename from extra/mariabackup/ds_archive.c rename to extra/mariabackup/ds_archive.cc diff --git a/extra/mariabackup/ds_buffer.c b/extra/mariabackup/ds_buffer.cc similarity index 98% rename from extra/mariabackup/ds_buffer.c rename to extra/mariabackup/ds_buffer.cc index 8e13e878953..71ee323537a 100644 --- a/extra/mariabackup/ds_buffer.c +++ b/extra/mariabackup/ds_buffer.cc @@ -71,7 +71,7 @@ buffer_init(const char *root) ds_ctxt_t *ctxt; ds_buffer_ctxt_t *buffer_ctxt; - ctxt = my_malloc(sizeof(ds_ctxt_t) + sizeof(ds_buffer_ctxt_t), + ctxt = (ds_ctxt_t *)my_malloc(sizeof(ds_ctxt_t) + sizeof(ds_buffer_ctxt_t), MYF(MY_FAE)); buffer_ctxt = (ds_buffer_ctxt_t *) (ctxt + 1); buffer_ctxt->buffer_size = DS_DEFAULT_BUFFER_SIZE; diff --git a/extra/mariabackup/ds_compress.c b/extra/mariabackup/ds_compress.cc similarity index 98% rename from extra/mariabackup/ds_compress.c rename to extra/mariabackup/ds_compress.cc index 88f50857362..16dbe4ffb34 100644 --- a/extra/mariabackup/ds_compress.c +++ b/extra/mariabackup/ds_compress.cc @@ -95,7 +95,7 @@ compress_init(const char *root) /* Create and initialize the worker threads */ threads = create_worker_threads(xtrabackup_compress_threads); if (threads == NULL) { - msg("compress: failed to create worker threads.\n"); + msg("compress: failed to create worker threads."); return NULL; } @@ -243,7 +243,7 @@ compress_write(ds_file_t *file, const uchar *buf, size_t len) write_uint64_le(dest_file, comp_file->bytes_processed)) { msg("compress: write to the destination stream " - "failed.\n"); + "failed."); return 1; } @@ -253,7 +253,7 @@ compress_write(ds_file_t *file, const uchar *buf, size_t len) ds_write(dest_file, threads[i].to, threads[i].to_len)) { msg("compress: write to the destination stream " - "failed.\n"); + "failed."); return 1; } @@ -367,7 +367,7 @@ create_worker_threads(uint n) if (pthread_create(&thd->id, NULL, compress_worker_thread_func, thd)) { msg("compress: pthread_create() failed: " - "errno = %d\n", errno); + "errno = %d", errno); goto err; } } diff --git a/extra/mariabackup/ds_stdout.c b/extra/mariabackup/ds_stdout.cc similarity index 97% rename from extra/mariabackup/ds_stdout.c rename to extra/mariabackup/ds_stdout.cc index 391a3455195..4fdfd35d7e4 100644 --- a/extra/mariabackup/ds_stdout.c +++ b/extra/mariabackup/ds_stdout.cc @@ -48,7 +48,7 @@ stdout_init(const char *root) { ds_ctxt_t *ctxt; - ctxt = my_malloc(sizeof(ds_ctxt_t), MYF(MY_FAE)); + ctxt = (ds_ctxt_t *)my_malloc(sizeof(ds_ctxt_t), MYF(MY_FAE)); ctxt->root = my_strdup(root, MYF(MY_FAE)); diff --git a/extra/mariabackup/ds_tmpfile.c b/extra/mariabackup/ds_tmpfile.cc similarity index 94% rename from extra/mariabackup/ds_tmpfile.c rename to extra/mariabackup/ds_tmpfile.cc index 27a8d9688f4..25f535100ec 100644 --- a/extra/mariabackup/ds_tmpfile.c +++ b/extra/mariabackup/ds_tmpfile.cc @@ -60,7 +60,7 @@ tmpfile_init(const char *root) ds_ctxt_t *ctxt; ds_tmpfile_ctxt_t *tmpfile_ctxt; - ctxt = my_malloc(sizeof(ds_ctxt_t) + sizeof(ds_tmpfile_ctxt_t), + ctxt = (ds_ctxt_t *)my_malloc(sizeof(ds_ctxt_t) + sizeof(ds_tmpfile_ctxt_t), MYF(MY_FAE)); tmpfile_ctxt = (ds_tmpfile_ctxt_t *) (ctxt + 1); tmpfile_ctxt->file_list = NULL; @@ -191,11 +191,11 @@ tmpfile_deinit(ds_ctxt_t *ctxt) /* Walk the files in the order they have been added */ list = list_reverse(list); while (list != NULL) { - tmp_file = list->data; + tmp_file = (ds_tmp_file_t *)list->data; /* Stat the file to replace size and mtime on the original * mystat struct */ if (my_fstat(tmp_file->fd, &mystat, MYF(0))) { - msg("error: my_fstat() failed.\n"); + msg("error: my_fstat() failed."); exit(EXIT_FAILURE); } tmp_file->mystat.st_size = mystat.st_size; @@ -205,7 +205,7 @@ tmpfile_deinit(ds_ctxt_t *ctxt) &tmp_file->mystat); if (dst_file == NULL) { msg("error: could not stream a temporary file to " - "'%s'\n", tmp_file->orig_path); + "'%s'", tmp_file->orig_path); exit(EXIT_FAILURE); } @@ -213,17 +213,17 @@ tmpfile_deinit(ds_ctxt_t *ctxt) posix_fadvise(tmp_file->fd, 0, 0, POSIX_FADV_SEQUENTIAL); if (my_seek(tmp_file->fd, 0, SEEK_SET, MYF(0)) == MY_FILEPOS_ERROR) { - msg("error: my_seek() failed for '%s', errno = %d.\n", + msg("error: my_seek() failed for '%s', errno = %d.", tmp_file->file->path, my_errno); exit(EXIT_FAILURE); } offset = 0; - while ((bytes = my_read(tmp_file->fd, buf, buf_size, + while ((bytes = my_read(tmp_file->fd, (unsigned char *)buf, buf_size, MYF(MY_WME))) > 0) { posix_fadvise(tmp_file->fd, offset, buf_size, POSIX_FADV_DONTNEED); offset += buf_size; if (ds_write(dst_file, buf, bytes)) { - msg("error: cannot write to stream for '%s'.\n", + msg("error: cannot write to stream for '%s'.", tmp_file->orig_path); exit(EXIT_FAILURE); } diff --git a/extra/mariabackup/ds_xbstream.c b/extra/mariabackup/ds_xbstream.cc similarity index 94% rename from extra/mariabackup/ds_xbstream.c rename to extra/mariabackup/ds_xbstream.cc index 544929fb24c..c4e063d030b 100644 --- a/extra/mariabackup/ds_xbstream.c +++ b/extra/mariabackup/ds_xbstream.cc @@ -79,18 +79,18 @@ xbstream_init(const char *root __attribute__((unused))) ds_stream_ctxt_t *stream_ctxt; xb_wstream_t *xbstream; - ctxt = my_malloc(sizeof(ds_ctxt_t) + sizeof(ds_stream_ctxt_t), + ctxt = (ds_ctxt_t *)my_malloc(sizeof(ds_ctxt_t) + sizeof(ds_stream_ctxt_t), MYF(MY_FAE)); stream_ctxt = (ds_stream_ctxt_t *)(ctxt + 1); if (pthread_mutex_init(&stream_ctxt->mutex, NULL)) { - msg("xbstream_init: pthread_mutex_init() failed.\n"); + msg("xbstream_init: pthread_mutex_init() failed."); goto err; } xbstream = xb_stream_write_new(); if (xbstream == NULL) { - msg("xb_stream_write_new() failed.\n"); + msg("xb_stream_write_new() failed."); goto err; } stream_ctxt->xbstream = xbstream; @@ -143,7 +143,7 @@ xbstream_open(ds_ctxt_t *ctxt, const char *path, MY_STAT *mystat) my_xbstream_write_callback); if (xbstream_file == NULL) { - msg("xb_stream_write_open() failed.\n"); + msg("xb_stream_write_open() failed."); goto err; } @@ -177,7 +177,7 @@ xbstream_write(ds_file_t *file, const uchar *buf, size_t len) xbstream_file = stream_file->xbstream_file; if (xb_stream_write_data(xbstream_file, buf, len)) { - msg("xb_stream_write_data() failed.\n"); + msg("xb_stream_write_data() failed."); return 1; } @@ -209,7 +209,7 @@ xbstream_deinit(ds_ctxt_t *ctxt) stream_ctxt = (ds_stream_ctxt_t *) ctxt->ptr; if (xb_stream_write_done(stream_ctxt->xbstream)) { - msg("xb_stream_done() failed.\n"); + msg("xb_stream_done() failed."); } if (stream_ctxt->dest_file) { diff --git a/extra/mariabackup/encryption_plugin.cc b/extra/mariabackup/encryption_plugin.cc index 91dc526b2f2..78a74c7b7a8 100644 --- a/extra/mariabackup/encryption_plugin.cc +++ b/extra/mariabackup/encryption_plugin.cc @@ -45,7 +45,7 @@ static std::string get_encryption_plugin_from_cnf() FILE *f = fopen("backup-my.cnf", "r"); if (!f) { - msg("cannot open backup-my.cnf for reading\n"); + msg("Can't open backup-my.cnf for reading"); exit(EXIT_FAILURE); } char line[512]; @@ -167,7 +167,7 @@ void encryption_plugin_prepare_init(int argc, char **argv) std::string plugin_load= get_encryption_plugin_from_cnf(); if (plugin_load.size()) { - msg("Loading encryption plugin from %s\n", plugin_load.c_str()); + msg("Loading encryption plugin from %s", plugin_load.c_str()); } else { @@ -193,9 +193,9 @@ static void encryption_plugin_init(int argc, char **argv) { /* Patch optional and mandatory plugins, we only need to load the one in xb_plugin_load. */ mysql_optional_plugins[0] = mysql_mandatory_plugins[0] = 0; - msg("Loading encryption plugin\n"); + msg("Loading encryption plugin"); for (int i= 1; i < argc; i++) - msg("\t Encryption plugin parameter : '%s'\n", argv[i]); + msg("\t Encryption plugin parameter : '%s'", argv[i]); plugin_init(&argc, argv, PLUGIN_INIT_SKIP_PLUGIN_TABLE); } diff --git a/extra/mariabackup/fil_cur.cc b/extra/mariabackup/fil_cur.cc index e1b7c670f57..a156b8895f0 100644 --- a/extra/mariabackup/fil_cur.cc +++ b/extra/mariabackup/fil_cur.cc @@ -174,9 +174,8 @@ xb_fil_cur_open( /* The following call prints an error message */ os_file_get_last_error(TRUE); - msg("[%02u] mariabackup: error: cannot open " - "tablespace %s\n", - thread_n, cursor->abs_path); + msg(thread_n, "mariabackup: error: cannot open " + "tablespace %s", cursor->abs_path); return(XB_FIL_CUR_SKIP); } @@ -217,8 +216,8 @@ xb_fil_cur_open( cursor->statinfo.st_size = (ulonglong)max_file_size; } if (err) { - msg("[%02u] mariabackup: error: cannot fstat %s\n", - thread_n, cursor->abs_path); + msg(thread_n, "mariabackup: error: cannot fstat %s", + cursor->abs_path); xb_fil_cur_close(cursor); @@ -262,8 +261,6 @@ xb_fil_cur_open( mutex_exit(&fil_system->mutex); } - /*msg("crypt: %s,%u\n", node->name, node->space->crypt_data->type);*/ - cursor->space_size = (ulint)(cursor->statinfo.st_size / page_size.physical()); @@ -413,14 +410,8 @@ xb_fil_cur_read( && offset + to_read == cursor->statinfo.st_size) { if (to_read < (ib_int64_t) page_size) { - msg("[%02u] mariabackup: Warning: junk at the end of " - "%s:\n", cursor->thread_n, cursor->abs_path); - msg("[%02u] mariabackup: Warning: offset = %llu, " - "to_read = %llu\n", - cursor->thread_n, - (unsigned long long) offset, - (unsigned long long) to_read); - + msg(cursor->thread_n, "Warning: junk at the end of " + "%s, offset = %llu, to_read = %llu",cursor->abs_path, (ulonglong) offset, (ulonglong) to_read); return(XB_FIL_CUR_EOF); } @@ -464,20 +455,17 @@ read_retry: retry_count--; if (retry_count == 0) { - msg("[%02u] mariabackup: " + msg(cursor->thread_n, "Error: failed to read page after " "10 retries. File %s seems to be " - "corrupted.\n", cursor->thread_n, - cursor->abs_path); + "corrupted.", cursor->abs_path); ret = XB_FIL_CUR_ERROR; buf_page_print(page, cursor->page_size); break; } - msg("[%02u] mariabackup: " - "Database page corruption detected at page " - ULINTPF ", retrying...\n", cursor->thread_n, + msg(cursor->thread_n, "Database page corruption detected at page " + ULINTPF ", retrying...", page_no); - os_thread_sleep(100000); goto read_retry; } diff --git a/extra/mariabackup/innobackupex.cc b/extra/mariabackup/innobackupex.cc index 3f74f25f5ba..ac2272bf9b0 100644 --- a/extra/mariabackup/innobackupex.cc +++ b/extra/mariabackup/innobackupex.cc @@ -738,7 +738,7 @@ ibx_get_one_option(int optid, exit(0); break; case 'v': - msg("innobackupex version %s %s (%s)\n", + printf("innobackupex version %s %s (%s)", MYSQL_SERVER_VERSION, SYSTEM_TYPE, MACHINE_TYPE); exit(0); diff --git a/extra/mariabackup/write_filt.cc b/extra/mariabackup/write_filt.cc index 40ecef6ff79..836fa5e6e95 100644 --- a/extra/mariabackup/write_filt.cc +++ b/extra/mariabackup/write_filt.cc @@ -79,9 +79,8 @@ wf_incremental_init(xb_write_filt_ctxt_t *ctxt, char *dst_name, cp->delta_buf = (unsigned char *)os_mem_alloc_large(&cp->delta_buf_size); if (!cp->delta_buf) { - msg("[%02u] mariabackup: Error: " - "cannot allocate %zu bytes\n", - cursor->thread_n, (size_t) cp->delta_buf_size); + msg(cursor->thread_n,"Can't allocate %zu bytes", + (size_t) cp->delta_buf_size); return (FALSE); } @@ -90,9 +89,9 @@ wf_incremental_init(xb_write_filt_ctxt_t *ctxt, char *dst_name, XB_DELTA_INFO_SUFFIX); const xb_delta_info_t info(cursor->page_size, cursor->space_id); if (!xb_write_delta_metadata(meta_name, &info)) { - msg("[%02u] mariabackup: Error: " - "failed to write meta info for %s\n", - cursor->thread_n, cursor->rel_path); + msg(cursor->thread_n,"Error: " + "failed to write meta info for %s", + cursor->rel_path); return(FALSE); } diff --git a/extra/mariabackup/xbstream.c b/extra/mariabackup/xbstream.cc similarity index 92% rename from extra/mariabackup/xbstream.c rename to extra/mariabackup/xbstream.cc index fa250132c04..203853a27d7 100644 --- a/extra/mariabackup/xbstream.c +++ b/extra/mariabackup/xbstream.cc @@ -45,7 +45,6 @@ datasink_t datasink_archive; datasink_t datasink_xbstream; datasink_t datasink_compress; datasink_t datasink_tmpfile; -datasink_t datasink_buffer; static run_mode_t opt_mode; static char * opt_directory = NULL; @@ -106,7 +105,7 @@ main(int argc, char **argv) } if (opt_mode == RUN_MODE_NONE) { - msg("%s: either -c or -x must be specified.\n", my_progname); + msg("%s: either -c or -x must be specified.", my_progname); goto err; } @@ -184,7 +183,7 @@ int set_run_mode(run_mode_t mode) { if (opt_mode != RUN_MODE_NONE) { - msg("%s: can't set specify both -c and -x.\n", my_progname); + msg("%s: can't set specify both -c and -x.", my_progname); return 1; } @@ -233,7 +232,7 @@ stream_one_file(File file, xb_wstream_file_t *xbfile) while ((bytes = (ssize_t)my_read(file, buf, XBSTREAM_BUFFER_SIZE, MYF(MY_WME))) > 0) { if (xb_stream_write_data(xbfile, buf, bytes)) { - msg("%s: xb_stream_write_data() failed.\n", + msg("%s: xb_stream_write_data() failed.", my_progname); my_free(buf); return 1; @@ -262,13 +261,13 @@ mode_create(int argc, char **argv) xb_wstream_t *stream; if (argc < 1) { - msg("%s: no files are specified.\n", my_progname); + msg("%s: no files are specified.", my_progname); return 1; } stream = xb_stream_write_new(); if (stream == NULL) { - msg("%s: xb_stream_write_new() failed.\n", my_progname); + msg("%s: xb_stream_write_new() failed.", my_progname); return 1; } @@ -281,13 +280,13 @@ mode_create(int argc, char **argv) goto err; } if (!MY_S_ISREG(mystat.st_mode)) { - msg("%s: %s is not a regular file, exiting.\n", + msg("%s: %s is not a regular file, exiting.", my_progname, filepath); goto err; } if ((src_file = my_open(filepath, O_RDONLY, MYF(MY_WME))) < 0) { - msg("%s: failed to open %s.\n", my_progname, filepath); + msg("%s: failed to open %s.", my_progname, filepath); goto err; } @@ -297,7 +296,7 @@ mode_create(int argc, char **argv) } if (opt_verbose) { - msg("%s\n", filepath); + msg("%s", filepath); } if (stream_one_file(src_file, file) || @@ -338,12 +337,12 @@ file_entry_new(extract_ctxt_t *ctxt, const char *path, uint pathlen) file = ds_open(ctxt->ds_ctxt, path, NULL); if (file == NULL) { - msg("%s: failed to create file.\n", my_progname); + msg("%s: failed to create file.", my_progname); goto err; } if (opt_verbose) { - msg("%s\n", entry->path); + msg("%s", entry->path); } entry->file = file; @@ -425,7 +424,7 @@ extract_worker_thread_func(void *arg) break; } if (my_hash_insert(ctxt->filehash, (uchar *) entry)) { - msg("%s: my_hash_insert() failed.\n", + msg("%s: my_hash_insert() failed.", my_progname); pthread_mutex_unlock(ctxt->mutex); break; @@ -454,7 +453,7 @@ extract_worker_thread_func(void *arg) if (entry->offset != chunk.offset) { msg("%s: out-of-order chunk: real offset = 0x%llx, " - "expected offset = 0x%llx\n", my_progname, + "expected offset = 0x%llx", my_progname, chunk.offset, entry->offset); pthread_mutex_unlock(&entry->mutex); res = XB_STREAM_READ_ERROR; @@ -462,7 +461,7 @@ extract_worker_thread_func(void *arg) } if (ds_write(entry->file, chunk.data, chunk.length)) { - msg("%s: my_write() failed.\n", my_progname); + msg("%s: my_write() failed.", my_progname); pthread_mutex_unlock(&entry->mutex); res = XB_STREAM_READ_ERROR; break; @@ -500,12 +499,12 @@ mode_extract(int n_threads, int argc __attribute__((unused)), if (my_hash_init(&filehash, &my_charset_bin, START_FILE_HASH_SIZE, 0, 0, (my_hash_get_key) get_file_entry_key, (my_hash_free_key) file_entry_free, MYF(0))) { - msg("%s: failed to initialize file hash.\n", my_progname); + msg("%s: failed to initialize file hash.", my_progname); return 1; } if (pthread_mutex_init(&mutex, NULL)) { - msg("%s: failed to initialize mutex.\n", my_progname); + msg("%s: failed to initialize mutex.", my_progname); my_hash_free(&filehash); return 1; } @@ -520,7 +519,7 @@ mode_extract(int n_threads, int argc __attribute__((unused)), stream = xb_stream_read_new(); if (stream == NULL) { - msg("%s: xb_stream_read_new() failed.\n", my_progname); + msg("%s: xb_stream_read_new() failed.", my_progname); pthread_mutex_destroy(&mutex); ret = 1; goto exit; @@ -531,8 +530,8 @@ mode_extract(int n_threads, int argc __attribute__((unused)), ctxt.ds_ctxt = ds_ctxt; ctxt.mutex = &mutex; - tids = calloc(n_threads, sizeof(pthread_t)); - retvals = calloc(n_threads, sizeof(void*)); + tids = (pthread_t *)calloc(n_threads, sizeof(pthread_t)); + retvals = (void **)calloc(n_threads, sizeof(void*)); for (i = 0; i < n_threads; i++) pthread_create(tids + i, NULL, extract_worker_thread_func, diff --git a/extra/mariabackup/xbstream.h b/extra/mariabackup/xbstream.h index 08b017ca5ce..5ee909d0a8e 100644 --- a/extra/mariabackup/xbstream.h +++ b/extra/mariabackup/xbstream.h @@ -101,6 +101,6 @@ xb_rstream_result_t xb_stream_read_chunk(xb_rstream_t *stream, int xb_stream_read_done(xb_rstream_t *stream); -int xb_stream_validate_checksum(xb_rstream_chunk_t *chunk); +xb_rstream_result_t xb_stream_validate_checksum(xb_rstream_chunk_t *chunk); #endif diff --git a/extra/mariabackup/xbstream_read.c b/extra/mariabackup/xbstream_read.cc similarity index 89% rename from extra/mariabackup/xbstream_read.c rename to extra/mariabackup/xbstream_read.cc index 8d19242301b..b34ecb4c08d 100644 --- a/extra/mariabackup/xbstream_read.c +++ b/extra/mariabackup/xbstream_read.cc @@ -67,15 +67,15 @@ validate_chunk_type(uchar code) } } -int +xb_rstream_result_t xb_stream_validate_checksum(xb_rstream_chunk_t *chunk) { ulong checksum; - checksum = crc32_iso3309(0, chunk->data, (uint)chunk->length); + checksum = crc32_iso3309(0, (unsigned char *)chunk->data, (uint)chunk->length); if (checksum != chunk->checksum) { msg("xb_stream_read_chunk(): invalid checksum at offset " - "0x%llx: expected 0x%lx, read 0x%lx.\n", + "0x%llx: expected 0x%lx, read 0x%lx.", (ulonglong) chunk->checksum_offset, chunk->checksum, checksum); return XB_STREAM_READ_ERROR; @@ -86,8 +86,8 @@ xb_stream_validate_checksum(xb_rstream_chunk_t *chunk) #define F_READ(buf,len) \ do { \ - if (xb_read_full(fd, buf, len) < len) { \ - msg("xb_stream_read_chunk(): my_read() failed.\n"); \ + if (xb_read_full(fd, (uchar *)buf, len) < len) { \ + msg("xb_stream_read_chunk(): my_read() failed."); \ goto err; \ } \ } while (0) @@ -111,7 +111,7 @@ xb_stream_read_chunk(xb_rstream_t *stream, xb_rstream_chunk_t *chunk) return XB_STREAM_READ_EOF; } else if (tbytes < CHUNK_HEADER_CONSTANT_LEN) { msg("xb_stream_read_chunk(): unexpected end of stream at " - "offset 0x%llx.\n", stream->offset); + "offset 0x%llx.", stream->offset); goto err; } @@ -120,7 +120,7 @@ xb_stream_read_chunk(xb_rstream_t *stream, xb_rstream_chunk_t *chunk) /* Chunk magic value */ if (memcmp(tmpbuf, XB_STREAM_CHUNK_MAGIC, 8)) { msg("xb_stream_read_chunk(): wrong chunk magic at offset " - "0x%llx.\n", (ulonglong) stream->offset); + "0x%llx.", (ulonglong) stream->offset); goto err; } ptr += 8; @@ -135,7 +135,7 @@ xb_stream_read_chunk(xb_rstream_t *stream, xb_rstream_chunk_t *chunk) if (chunk->type == XB_CHUNK_TYPE_UNKNOWN && !(chunk->flags & XB_STREAM_FLAG_IGNORABLE)) { msg("xb_stream_read_chunk(): unknown chunk type 0x%lu at " - "offset 0x%llx.\n", (ulong) *ptr, + "offset 0x%llx.", (ulong) *ptr, (ulonglong) stream->offset); goto err; } @@ -146,7 +146,7 @@ xb_stream_read_chunk(xb_rstream_t *stream, xb_rstream_chunk_t *chunk) pathlen = uint4korr(ptr); if (pathlen >= FN_REFLEN) { msg("xb_stream_read_chunk(): path length (%lu) is too large at " - "offset 0x%llx.\n", (ulong) pathlen, stream->offset); + "offset 0x%llx.", (ulong) pathlen, stream->offset); goto err; } chunk->pathlen = pathlen; @@ -170,7 +170,7 @@ xb_stream_read_chunk(xb_rstream_t *stream, xb_rstream_chunk_t *chunk) ullval = uint8korr(tmpbuf); if (ullval > (ulonglong) SIZE_T_MAX) { msg("xb_stream_read_chunk(): chunk length is too large at " - "offset 0x%llx: 0x%llx.\n", (ulonglong) stream->offset, + "offset 0x%llx: 0x%llx.", (ulonglong) stream->offset, ullval); goto err; } @@ -181,7 +181,7 @@ xb_stream_read_chunk(xb_rstream_t *stream, xb_rstream_chunk_t *chunk) ullval = uint8korr(tmpbuf + 8); if (ullval > (ulonglong) MY_OFF_T_MAX) { msg("xb_stream_read_chunk(): chunk offset is too large at " - "offset 0x%llx: 0x%llx.\n", (ulonglong) stream->offset, + "offset 0x%llx: 0x%llx.", (ulonglong) stream->offset, ullval); goto err; } @@ -194,7 +194,7 @@ xb_stream_read_chunk(xb_rstream_t *stream, xb_rstream_chunk_t *chunk) MYF(MY_WME | MY_ALLOW_ZERO_PTR)); if (chunk->data == NULL) { msg("xb_stream_read_chunk(): failed to increase buffer " - "to %lu bytes.\n", (ulong) chunk->length); + "to %lu bytes.", (ulong) chunk->length); goto err; } chunk->buflen = chunk->length; diff --git a/extra/mariabackup/xbstream_write.c b/extra/mariabackup/xbstream_write.cc similarity index 96% rename from extra/mariabackup/xbstream_write.c rename to extra/mariabackup/xbstream_write.cc index 978be71e7dd..1168c77e38d 100644 --- a/extra/mariabackup/xbstream_write.c +++ b/extra/mariabackup/xbstream_write.cc @@ -55,7 +55,7 @@ xb_stream_default_write_callback(xb_wstream_file_t *file __attribute__((unused)) void *userdata __attribute__((unused)), const void *buf, size_t len) { - if (my_write(my_fileno(stdout), buf, len, MYF(MY_WME | MY_NABP))) + if (my_write(my_fileno(stdout), (const uchar *)buf, len, MYF(MY_WME | MY_NABP))) return -1; return len; } @@ -83,7 +83,7 @@ xb_stream_write_open(xb_wstream_t *stream, const char *path, path_len = strlen(path); if (path_len > FN_REFLEN) { - msg("xb_stream_write_open(): file path is too long.\n"); + msg("xb_stream_write_open(): file path is too long."); return NULL; } @@ -216,7 +216,7 @@ xb_stream_write_chunk(xb_wstream_file_t *file, const void *buf, size_t len) int8store(ptr, len); /* Payload length */ ptr += 8; - checksum = crc32_iso3309(0, buf, (uint)len); /* checksum */ + checksum = crc32_iso3309(0, (const uchar *)buf, (uint)len); /* checksum */ pthread_mutex_lock(&stream->mutex); diff --git a/extra/mariabackup/xtrabackup.cc b/extra/mariabackup/xtrabackup.cc index 3ec6523c6dd..9d183ea3087 100644 --- a/extra/mariabackup/xtrabackup.cc +++ b/extra/mariabackup/xtrabackup.cc @@ -185,7 +185,7 @@ xb_stream_fmt_t xtrabackup_stream_fmt = XB_STREAM_FMT_NONE; ibool xtrabackup_stream = FALSE; const char *xtrabackup_compress_alg = NULL; -ibool xtrabackup_compress = FALSE; +uint xtrabackup_compress = FALSE; uint xtrabackup_compress_threads; ulonglong xtrabackup_compress_chunk_size = 0; @@ -531,13 +531,13 @@ static os_event_t dbug_start_query_thread( if (exists) { goto end; } - msg_ts("Waiting for query '%s' on connection %lu to " + msg("Waiting for query '%s' on connection %lu to " " reach state '%s'", query, mysql_thread_id(par->con), wait_state); my_sleep(1000); } end: - msg_ts("query '%s' on connection %lu reached state '%s'", query, + msg("query '%s' on connection %lu reached state '%s'", query, mysql_thread_id(par->con), wait_state); return par->done_event; } @@ -608,16 +608,16 @@ static void backup_file_op(ulint space_id, const byte* flags, if (flags) { ddl_tracker.id_to_name[space_id] = filename_to_spacename(name, len); - msg("DDL tracking : create %zu \"%.*s\": %x\n", + msg("DDL tracking : create %zu \"%.*s\": %x", space_id, int(len), name, mach_read_from_4(flags)); } else if (new_name) { ddl_tracker.id_to_name[space_id] = filename_to_spacename(new_name, new_len); - msg("DDL tracking : rename %zu \"%.*s\",\"%.*s\"\n", + msg("DDL tracking : rename %zu \"%.*s\",\"%.*s\"", space_id, int(len), name, int(new_len), new_name); } else { ddl_tracker.drops.insert(space_id); - msg("DDL tracking : delete %zu \"%.*s\"\n", space_id, int(len), name); + msg("DDL tracking : delete %zu \"%.*s\"", space_id, int(len), name); } pthread_mutex_unlock(&backup_mutex); } @@ -639,13 +639,13 @@ static void backup_file_op_fail(ulint space_id, const byte* flags, ut_a(opt_no_lock); bool fail; if (flags) { - msg("DDL tracking : create %zu \"%.*s\": %x\n", + msg("DDL tracking : create %zu \"%.*s\": %x", space_id, int(len), name, mach_read_from_4(flags)); std::string spacename = filename_to_spacename(name, len); fail = !check_if_skip_table(spacename.c_str()); } else if (new_name) { - msg("DDL tracking : rename %zu \"%.*s\",\"%.*s\"\n", + msg("DDL tracking : rename %zu \"%.*s\",\"%.*s\"", space_id, int(len), name, int(new_len), new_name); std::string spacename = filename_to_spacename(name, len); std::string new_spacename = filename_to_spacename(new_name, new_len); @@ -654,11 +654,11 @@ static void backup_file_op_fail(ulint space_id, const byte* flags, else { std::string spacename = filename_to_spacename(name, len); fail = !check_if_skip_table(spacename.c_str()); - msg("DDL tracking : delete %zu \"%.*s\"\n", space_id, int(len), name); + msg("DDL tracking : delete %zu \"%.*s\"", space_id, int(len), name); } if (fail) { msg("ERROR : DDL operation detected in the late phase of backup." - "Backup is inconsistent. Remove --no-lock option to fix.\n"); + "Backup is inconsistent. Remove --no-lock option to fix."); exit(EXIT_FAILURE); } } @@ -679,10 +679,10 @@ static void backup_optimized_ddl_op(ulint space_id) */ static void backup_optimized_ddl_op_fail(ulint space_id) { ut_a(opt_no_lock); - msg("DDL tracking : optimized DDL on space %zu\n", space_id); + msg("DDL tracking : optimized DDL on space %zu", space_id); if (ddl_tracker.tables_in_backup.find(space_id) != ddl_tracker.tables_in_backup.end()) { msg("ERROR : Optimized DDL operation detected in the late phase of backup." - "Backup is inconsistent. Remove --no-lock option to fix.\n"); + "Backup is inconsistent. Remove --no-lock option to fix."); exit(EXIT_FAILURE); } } @@ -691,7 +691,7 @@ static void backup_optimized_ddl_op_fail(ulint space_id) { /** Callback whenever MLOG_TRUNCATE happens. */ static void backup_truncate_fail() { - msg("mariabackup: Incompatible TRUNCATE operation detected.%s\n", + msg("mariabackup: Incompatible TRUNCATE operation detected.%s", opt_lock_ddl_per_table ? "" : " Use --lock-ddl-per-table to lock all tables before backup."); @@ -1457,14 +1457,14 @@ debug_sync_point(const char *name) xtrabackup_target_dir); fp = fopen(pid_path, "w"); if (fp == NULL) { - msg("mariabackup: Error: cannot open %s\n", pid_path); + msg("mariabackup: Error: cannot open %s", pid_path); exit(EXIT_FAILURE); } fprintf(fp, "%u\n", (uint) pid); fclose(fp); msg("mariabackup: DEBUG: Suspending at debug sync point '%s'. " - "Resume with 'kill -SIGCONT %u'.\n", name, (uint) pid); + "Resume with 'kill -SIGCONT %u'.", name, (uint) pid); debug_sync_resumed= 0; kill(pid, SIGSTOP); @@ -1473,7 +1473,7 @@ debug_sync_point(const char *name) } /* On resume */ - msg("mariabackup: DEBUG: removing the pid file.\n"); + msg("mariabackup: DEBUG: removing the pid file."); my_delete(pid_path, MYF(MY_WME)); #endif } @@ -1593,7 +1593,7 @@ static const char *xb_server_default_groups[]= static void print_version(void) { - msg("%s based on MariaDB server %s %s (%s) \n", + msg("%s based on MariaDB server %s %s (%s)", my_progname, MYSQL_SERVER_VERSION, SYSTEM_TYPE, MACHINE_TYPE); } @@ -1717,7 +1717,7 @@ xb_get_one_option(int optid, xtrabackup_stream_fmt = XB_STREAM_FMT_XBSTREAM; else { - msg("Invalid --stream argument: %s\n", argument); + msg("Invalid --stream argument: %s", argument); return 1; } xtrabackup_stream = TRUE; @@ -1727,7 +1727,7 @@ xb_get_one_option(int optid, xtrabackup_compress_alg = "quicklz"; else if (strcasecmp(argument, "quicklz")) { - msg("Invalid --compress argument: %s\n", argument); + msg("Invalid --compress argument: %s", argument); return 1; } xtrabackup_compress = TRUE; @@ -1808,8 +1808,8 @@ innodb_init_param(void) if (n_shift >= 12 && n_shift <= UNIV_PAGE_SIZE_SHIFT_MAX) { srv_page_size_shift = n_shift; srv_page_size = 1 << n_shift; - msg("InnoDB: The universal page size of the " - "database is set to %lu.\n", srv_page_size); + msg("InnoDB: The page size of the " + "database is set to %lu.", srv_page_size); } else { msg("InnoDB: Error: invalid value of " "innobase_page_size: %lld", innobase_page_size); @@ -1824,12 +1824,12 @@ innodb_init_param(void) if (sizeof(ulint) == 4) { if (xtrabackup_use_memory > UINT_MAX32) { msg("mariabackup: use-memory can't be over 4GB" - " on 32-bit systems\n"); + " on 32-bit systems"); } if (innobase_buffer_pool_size > UINT_MAX32) { msg("mariabackup: innobase_buffer_pool_size can't be " - "over 4GB on 32-bit systems\n"); + "over 4GB on 32-bit systems"); goto error; } @@ -1842,10 +1842,10 @@ innodb_init_param(void) read from MySQL .cnf file */ if (xtrabackup_backup) { - msg("mariabackup: using the following InnoDB configuration:\n"); + msg("mariabackup: using the following InnoDB configuration:"); } else { msg("mariabackup: using the following InnoDB configuration " - "for recovery:\n"); + "for recovery:"); } /*--------------- Data files -------------------------*/ @@ -1854,7 +1854,7 @@ innodb_init_param(void) srv_data_home = (xtrabackup_backup && innobase_data_home_dir ? innobase_data_home_dir : default_path); - msg("mariabackup: innodb_data_home_dir = %s\n", srv_data_home); + msg("innodb_data_home_dir = %s", srv_data_home); /* Set default InnoDB data file size to 10 MB and let it be auto-extending. Thus users can use InnoDB in >= 4.0 without having @@ -1863,7 +1863,7 @@ innodb_init_param(void) if (!innobase_data_file_path) { innobase_data_file_path = (char*) "ibdata1:10M:autoextend"; } - msg("mariabackup: innodb_data_file_path = %s\n", + msg("innodb_data_file_path = %s", innobase_data_file_path); /* This is the first time univ_page_size is used. @@ -1890,13 +1890,12 @@ innodb_init_param(void) if (xtrabackup_prepare && xtrabackup_incremental_dir) { srv_log_group_home_dir = xtrabackup_incremental_dir; } - msg("mariabackup: innodb_log_group_home_dir = %s\n", + msg("innodb_log_group_home_dir = %s", srv_log_group_home_dir); os_normalize_path(srv_log_group_home_dir); if (strchr(srv_log_group_home_dir, ';')) { - msg("syntax error in innodb_log_group_home_dir, "); goto error; } @@ -1963,8 +1962,7 @@ innodb_init_param(void) #elif defined(LINUX_NATIVE_AIO) if (srv_use_native_aio) { - ut_print_timestamp(stderr); - msg(" InnoDB: Using Linux native AIO\n"); + msg("InnoDB: Using Linux native AIO"); } #else /* Currently native AIO is supported only on windows and linux @@ -1991,7 +1989,7 @@ innodb_init_param(void) return(FALSE); error: - msg("mariabackup: innodb_init_param(): Error occured.\n"); + msg("innodb_init_param(): Error occured."); return(TRUE); } @@ -1999,7 +1997,7 @@ static bool innodb_init() { dberr_t err = innobase_start_or_create_for_mysql(); if (err != DB_SUCCESS) { - msg("mariabackup: innodb_init() returned %d (%s).\n", + msg("mariabackup: innodb_init() returned %d (%s).", err, ut_strerr(err)); innodb_shutdown(); return(TRUE); @@ -2023,7 +2021,7 @@ xtrabackup_read_metadata(char *filename) fp = fopen(filename,"r"); if(!fp) { - msg("mariabackup: Error: cannot open %s\n", filename); + msg("Error: cannot open %s", filename); return(FALSE); } @@ -2102,8 +2100,7 @@ xtrabackup_stream_metadata(ds_ctxt_t *ds_ctxt) stream = ds_open(ds_ctxt, XTRABACKUP_METADATA_FILENAME, &mystat); if (stream == NULL) { - msg("mariabackup: Error: cannot open output stream " - "for %s\n", XTRABACKUP_METADATA_FILENAME); + msg("Error: cannot open output stream for %s", XTRABACKUP_METADATA_FILENAME); return(FALSE); } @@ -2135,7 +2132,7 @@ xtrabackup_write_metadata(const char *filepath) fp = fopen(filepath, "w"); if(!fp) { - msg("mariabackup: Error: cannot open %s\n", filepath); + msg("Error: cannot open %s", filepath); return(FALSE); } if (fwrite(buf, len, 1, fp) < 1) { @@ -2184,7 +2181,7 @@ xb_read_delta_metadata(const char *filepath, xb_delta_info_t *info) fclose(fp); if (page_size == ULINT_UNDEFINED) { - msg("mariabackup: page_size is required in %s\n", filepath); + msg("page_size is required in %s", filepath); r = FALSE; } else { info->page_size = page_size_t(zip_size ? zip_size : page_size, @@ -2194,7 +2191,7 @@ xb_read_delta_metadata(const char *filepath, xb_delta_info_t *info) if (info->space_id == ULINT_UNDEFINED) { msg("mariabackup: Warning: This backup was taken with XtraBackup 2.0.1 " "or earlier, some DDL operations between full and incremental " - "backups may be handled incorrectly\n"); + "backups may be handled incorrectly"); } return(r); @@ -2227,8 +2224,7 @@ xb_write_delta_metadata(const char *filename, const xb_delta_info_t *info) f = ds_open(ds_meta, filename, &mystat); if (f == NULL) { - msg("mariabackup: Error: cannot open output stream for %s\n", - filename); + msg("Error: Can't open output stream for %s",filename); return(FALSE); } @@ -2536,7 +2532,7 @@ xtrabackup_copy_datafile(fil_node_t* node, uint thread_n, const char *dest_name= if (fil_is_user_tablespace_id(node->space->id) && check_if_skip_table(node_name)) { - msg("[%02u] Skipping %s.\n", thread_n, node_name); + msg(thread_n, "Skipping %s.", node_name); return(FALSE); } @@ -2578,26 +2574,22 @@ xtrabackup_copy_datafile(fil_node_t* node, uint thread_n, const char *dest_name= if (write_filter->init != NULL && !write_filter->init(&write_filt_ctxt, dst_name, &cursor)) { - msg("[%02u] mariabackup: error: " - "failed to initialize page write filter.\n", thread_n); + msg (thread_n, "mariabackup: error: failed to initialize page write filter."); goto error; } dstfile = ds_open(ds_data, dst_name, &cursor.statinfo); if (dstfile == NULL) { - msg("[%02u] mariabackup: error: " - "cannot open the destination stream for %s\n", - thread_n, dst_name); + msg(thread_n,"mariabackup: error: can't open the destination stream for %s", dst_name); goto error; } action = xb_get_copy_action(); if (xtrabackup_stream) { - msg_ts("[%02u] %s %s\n", thread_n, action, node_path); + msg(thread_n, "%s %s", action, node_path); } else { - msg_ts("[%02u] %s %s to %s\n", thread_n, action, - node_path, dstfile->path); + msg(thread_n, "%s %s to %s", action, node_path, dstfile->path); } /* The main copy loop */ @@ -2621,7 +2613,7 @@ xtrabackup_copy_datafile(fil_node_t* node, uint thread_n, const char *dest_name= pthread_mutex_unlock(&backup_mutex); /* close */ - msg_ts("[%02u] ...done\n", thread_n); + msg(thread_n," ...done"); xb_fil_cur_close(&cursor); if (ds_close(dstfile)) { rc = TRUE; @@ -2639,8 +2631,7 @@ error: if (write_filter && write_filter->deinit) { write_filter->deinit(&write_filt_ctxt);; } - msg("[%02u] mariabackup: Error: " - "xtrabackup_copy_datafile() failed.\n", thread_n); + msg(thread_n, "mariabackup: xtrabackup_copy_datafile() failed."); return(TRUE); /*ERROR*/ skip: @@ -2651,11 +2642,7 @@ skip: if (write_filter && write_filter->deinit) { write_filter->deinit(&write_filt_ctxt); } - msg("[%02u] mariabackup: Warning: We assume the " - "table was dropped during xtrabackup execution " - "and ignore the file.\n", thread_n); - msg("[%02u] mariabackup: Warning: skipping tablespace %s.\n", - thread_n, node_name); + msg(thread_n,"Warning: We assume the table was dropped during xtrabackup execution and ignore the tablespace %s", node_name); return(FALSE); } @@ -2680,9 +2667,8 @@ static lsn_t xtrabackup_copy_log(lsn_t start_lsn, lsn_t end_lsn, bool last) && scanned_checkpoint - checkpoint >= 0x80000000UL) { /* Garbage from a log buffer flush which was made before the most recent database recovery */ - msg("mariabackup: checkpoint wrap: " - LSN_PF ",%zx,%zx\n", - scanned_lsn, scanned_checkpoint, checkpoint); + msg(0,"checkpoint wrap: " LSN_PF ",%zx,%zx", + scanned_lsn, scanned_checkpoint, checkpoint); break; } @@ -2703,8 +2689,7 @@ static lsn_t xtrabackup_copy_log(lsn_t start_lsn, lsn_t end_lsn, bool last) >= OS_FILE_LOG_BLOCK_SIZE - LOG_BLOCK_TRL_SIZE || data_len <= LOG_BLOCK_HDR_SIZE) { /* We got a garbage block (abrupt end of the log). */ - msg("mariabackup: garbage block: " LSN_PF ",%zu\n", - scanned_lsn, data_len); + msg(0,"garbage block: " LSN_PF ",%zu",scanned_lsn, data_len); break; } else { /* We got a partial block (abrupt end of the log). */ @@ -2715,7 +2700,7 @@ static lsn_t xtrabackup_copy_log(lsn_t start_lsn, lsn_t end_lsn, bool last) if (more_data && recv_parse_log_recs(0, STORE_NO, false)) { - msg("mariabackup: copying the log failed \n"); + msg("Error: copying the log failed"); return(0); } @@ -2734,8 +2719,7 @@ static lsn_t xtrabackup_copy_log(lsn_t start_lsn, lsn_t end_lsn, bool last) } if (ds_write(dst_log_file, log_sys->buf, write_size)) { - msg("mariabackup: Error: " - "write to logfile failed\n"); + msg("Error: write to logfile failed\n"); return(0); } } @@ -2772,7 +2756,7 @@ static bool xtrabackup_copy_logfile(bool last = false) || lsn != start_lsn) { break; } - msg("Retrying read of log at LSN=" LSN_PF "\n", lsn); + msg("Retrying read of log at LSN=" LSN_PF, lsn); my_sleep(1000); } @@ -2782,15 +2766,14 @@ static bool xtrabackup_copy_logfile(bool last = false) log_mutex_exit(); if (!start_lsn) { - msg("mariabackup: Error: xtrabackup_copy_logfile()" - " failed.\n"); + msg("Error: xtrabackup_copy_logfile() failed."); exit(EXIT_FAILURE); } } while (start_lsn == end_lsn); ut_ad(start_lsn == log_sys->log.scanned_lsn); - msg_ts(">> log scanned up to (" LSN_PF ")\n", start_lsn); + msg(">> log scanned up to (" LSN_PF ")", start_lsn); /* update global variable*/ pthread_mutex_lock(&backup_mutex); @@ -2899,7 +2882,7 @@ static void dbug_mariabackup_event(const char *event,const char *key) } char *sql = getenv(envvar); if (sql) { - msg("dbug_mariabackup_event : executing '%s'\n", sql); + msg("dbug_mariabackup_event : executing '%s'", sql); xb_mysql_query(mysql_connection, sql, false, true); } @@ -2930,14 +2913,10 @@ data_copy_thread_func( debug_sync_point("data_copy_thread_func"); while ((node = datafiles_iter_next(ctxt->it)) != NULL) { - DBUG_MARIABACKUP_EVENT("before_copy", node->space->name); - - /* copy the datafile */ if(xtrabackup_copy_datafile(node, num)) { - msg("[%02u] mariabackup: Error: " - "failed to copy datafile.\n", num); + msg(num,"mariabackup: Error: failed to copy datafile."); exit(EXIT_FAILURE); } @@ -3115,7 +3094,7 @@ xb_load_single_table_tablespace( Datafile *file = xb_new_datafile(name, is_remote); if (file->open_read_only(true) != DB_SUCCESS) { - msg("Can't open datafile %s\n", name); + msg("Can't open datafile %s", name); ut_free(name); exit(EXIT_FAILURE); } @@ -3318,7 +3297,7 @@ static dberr_t xb_assign_undo_space_start() OS_FILE_OPEN, OS_FILE_NORMAL, OS_DATA_FILE, true, &ret); if (!ret) { - msg("mariabackup: Error in opening %s\n", srv_sys_space.first_datafile()->filepath()); + msg("Error opening %s", srv_sys_space.first_datafile()->filepath()); return DB_ERROR; } @@ -3328,7 +3307,7 @@ static dberr_t xb_assign_undo_space_start() retry: if (!os_file_read(IORequestRead, file, page, TRX_SYS_PAGE_NO * UNIV_PAGE_SIZE, UNIV_PAGE_SIZE)) { - msg("mariabackup: Reading TRX_SYS page failed.\n"); + msg("Reading TRX_SYS page failed."); error = DB_ERROR; goto func_exit; } @@ -3386,8 +3365,7 @@ xb_load_tablespaces() /* create_new_db must not be true. */ if (err != DB_SUCCESS || create_new_db) { - msg("mariabackup: could not find data files at the " - "specified datadir\n"); + msg("Could not find data files at the specified datadir"); return(DB_ERROR); } @@ -3402,7 +3380,7 @@ xb_load_tablespaces() } if (err != DB_SUCCESS) { - msg("mariabackup: Could not open data files.\n"); + msg("Could not open data files.\n"); return(err); } @@ -3424,7 +3402,7 @@ xb_load_tablespaces() srv_undo_tablespaces_init(), because fil_is_user_tablespace_id() * relies on srv_undo_tablespaces_open to be properly initialized */ - msg("mariabackup: Generating a list of tablespaces\n"); + msg("mariabackup: Generating a list of tablespaces"); err = enumerate_ibd_files(xb_load_single_table_tablespace); if (err != DB_SUCCESS) { @@ -3527,12 +3505,12 @@ xb_validate_name( /* perform only basic validation. validate length and path symbols */ if (len > NAME_LEN) { - msg("mariabackup: name `%s` is too long.\n", name); + msg("mariabackup: name `%s` is too long.", name); exit(EXIT_FAILURE); } p = strpbrk(name, "/\\~"); if (p && (uint) (p - name) < NAME_LEN) { - msg("mariabackup: name `%s` is not valid.\n", name); + msg("mariabackup: name `%s` is not valid.", name); exit(EXIT_FAILURE); } } @@ -3611,7 +3589,7 @@ xb_register_table( const char* name) /*!< in: name of table */ { if (strchr(name, '.') == NULL) { - msg("mariabackup: `%s` is not fully qualified name.\n", name); + msg("mariabackup: `%s` is not fully qualified name.", name); exit(EXIT_FAILURE); } @@ -3633,7 +3611,7 @@ xb_add_regex_to_list( if (ret != 0) { regerror(ret, &compiled_regex, errbuf, sizeof(errbuf)); - msg("mariabackup: error: %s regcomp(%s): %s\n", + msg("mariabackup: error: %s regcomp(%s): %s", error_context, regex, errbuf); exit(EXIT_FAILURE); } @@ -3702,7 +3680,7 @@ xb_load_list_file( /* read and store the filenames */ fp = fopen(filename, "r"); if (!fp) { - msg("mariabackup: cannot open %s\n", + msg("mariabackup: cannot open %s", filename); exit(EXIT_FAILURE); } @@ -3965,11 +3943,11 @@ static bool xtrabackup_backup_low() } metadata_to_lsn = mach_read_from_8( log_sys->checkpoint_buf + LOG_CHECKPOINT_LSN); - msg("mariabackup: The latest check point" - " (for incremental): '" LSN_PF "'\n", + msg("The latest check point" + " (for incremental): '" LSN_PF "'", metadata_to_lsn); } else { - msg("mariabackup: Error: recv_find_max_checkpoint() failed.\n"); + msg("Error: recv_find_max_checkpoint() failed."); } log_mutex_exit(); } @@ -3999,7 +3977,7 @@ static bool xtrabackup_backup_low() metadata_last_lsn = log_copy_scanned_lsn; if (!xtrabackup_stream_metadata(ds_meta)) { - msg("mariabackup: Error: failed to stream metadata.\n"); + msg("Error: failed to stream metadata."); return false; } if (xtrabackup_extra_lsndir) { @@ -4008,15 +3986,15 @@ static bool xtrabackup_backup_low() sprintf(filename, "%s/%s", xtrabackup_extra_lsndir, XTRABACKUP_METADATA_FILENAME); if (!xtrabackup_write_metadata(filename)) { - msg("mariabackup: Error: failed to write metadata " - "to '%s'.\n", filename); + msg("Error: failed to write metadata " + "to '%s'.", filename); return false; } sprintf(filename, "%s/%s", xtrabackup_extra_lsndir, XTRABACKUP_INFO); if (!write_xtrabackup_info(mysql_connection, filename, false)) { - msg("mariabackup: Error: failed to write info " - "to '%s'.\n", filename); + msg("Error: failed to write info " + "to '%s'.", filename); return false; } } @@ -4039,19 +4017,19 @@ xtrabackup_backup_func() pthread_cond_init(&scanned_lsn_cond, NULL); #ifdef USE_POSIX_FADVISE - msg("mariabackup: uses posix_fadvise().\n"); + msg("uses posix_fadvise()."); #endif /* cd to datadir */ if (my_setwd(mysql_real_data_home,MYF(MY_WME))) { - msg("mariabackup: cannot my_setwd %s\n", mysql_real_data_home); + msg("my_setwd() failed , %s", mysql_real_data_home); return(false); } - msg("mariabackup: cd to %s\n", mysql_real_data_home); + msg("cd to %s", mysql_real_data_home); encryption_plugin_backup_init(mysql_connection); - msg("mariabackup: open files limit requested %u, set to %u\n", + msg("open files limit requested %u, set to %u", (uint) xb_open_files_limit, xb_set_max_open_files(xb_open_files_limit)); @@ -4066,12 +4044,6 @@ xtrabackup_backup_func() log_file_op = backup_file_op; metadata_to_lsn = 0; - if (xb_close_files) - msg("mariabackup: warning: close-files specified. Use it " - "at your own risk. If there are DDL operations like table DROP TABLE " - "or RENAME TABLE during the backup, inconsistent backup will be " - "produced.\n"); - /* initialize components */ if(innodb_init_param()) { fail: @@ -4100,21 +4072,21 @@ fail: } else if (0 == ut_strcmp(srv_file_flush_method_str, "O_DIRECT")) { srv_file_flush_method = SRV_O_DIRECT; - msg("mariabackup: using O_DIRECT\n"); + msg("using O_DIRECT"); } else if (0 == ut_strcmp(srv_file_flush_method_str, "littlesync")) { srv_file_flush_method = SRV_LITTLESYNC; } else if (0 == ut_strcmp(srv_file_flush_method_str, "nosync")) { srv_file_flush_method = SRV_NOSYNC; } else if (0 == ut_strcmp(srv_file_flush_method_str, "ALL_O_DIRECT")) { srv_file_flush_method = SRV_ALL_O_DIRECT_FSYNC; - msg("mariabackup: using ALL_O_DIRECT\n"); + msg("using ALL_O_DIRECT"); } else if (0 == ut_strcmp(srv_file_flush_method_str, "O_DIRECT_NO_FSYNC")) { srv_file_flush_method = SRV_O_DIRECT_NO_FSYNC; - msg("mariabackup: using O_DIRECT_NO_FSYNC\n"); + msg("using O_DIRECT_NO_FSYNC"); } else { - msg("mariabackup: Unrecognized value %s for " - "innodb_flush_method\n", srv_file_flush_method_str); + msg("Unrecognized value %s for " + "innodb_flush_method", srv_file_flush_method_str); goto fail; } @@ -4179,7 +4151,7 @@ fail: if (xtrabackup_extra_lsndir &&!my_stat(xtrabackup_extra_lsndir,&stat_info,MYF(0)) && (my_mkdir(xtrabackup_extra_lsndir,0777,MYF(0)) < 0)) { - msg("mariabackup: Error: cannot mkdir %d: %s\n", + msg("Error: cannot mkdir %d: %s\n", my_errno, xtrabackup_extra_lsndir); goto fail; } @@ -4187,7 +4159,7 @@ fail: /* create target dir if not exist */ if (!xtrabackup_stream_str && !my_stat(xtrabackup_target_dir,&stat_info,MYF(0)) && (my_mkdir(xtrabackup_target_dir,0777,MYF(0)) < 0)){ - msg("mariabackup: Error: cannot mkdir %d: %s\n", + msg("Error: cannot mkdir %d: %s\n", my_errno, xtrabackup_target_dir); goto fail; } @@ -4214,8 +4186,8 @@ log_fail: if (log_sys->log.format == 0) { old_format: - msg("mariabackup: Error: cannot process redo log" - " before MariaDB 10.2.2\n"); + msg("Error: cannot process redo log" + " before MariaDB 10.2.2"); log_mutex_exit(); goto log_fail; } @@ -4254,8 +4226,8 @@ reread_log_header: memset(&stat_info, 0, sizeof(MY_STAT)); dst_log_file = ds_open(ds_redo, "ib_logfile0", &stat_info); if (dst_log_file == NULL) { - msg("mariabackup: error: failed to open the target stream for " - "'ib_logfile0'.\n"); + msg("§rror: failed to open the target stream for " + "'ib_logfile0'."); goto fail; } @@ -4274,7 +4246,7 @@ reread_log_header: /* Write the log header. */ if (ds_write(dst_log_file, log_hdr, sizeof log_hdr)) { log_write_fail: - msg("mariabackup: error: write to logfile failed\n"); + msg("error: write to logfile failed"); goto fail; } /* Adjust the checkpoint page. */ @@ -4309,8 +4281,8 @@ reread_log_header: /* Populate fil_system with tablespaces to copy */ err = xb_load_tablespaces(); if (err != DB_SUCCESS) { - msg("mariabackup: error: xb_load_tablespaces() failed with" - " error %s.\n", ut_strerr(err)); + msg("merror: xb_load_tablespaces() failed with" + " error %s.", ut_strerr(err)); fail_before_log_copying_thread_start: log_copying_running = false; goto fail; @@ -4339,7 +4311,7 @@ fail_before_log_copying_thread_start: if (xtrabackup_parallel > 1) { msg("mariabackup: Starting %u threads for parallel data " - "files transfer\n", xtrabackup_parallel); + "files transfer", xtrabackup_parallel); } if (opt_lock_ddl_per_table) { @@ -4353,7 +4325,7 @@ fail_before_log_copying_thread_start: datafiles_iter_t *it = datafiles_iter_new(fil_system); if (it == NULL) { - msg("mariabackup: Error: datafiles_iter_new() failed.\n"); + msg("mariabackup: Error: datafiles_iter_new() failed."); goto fail; } @@ -4414,16 +4386,16 @@ fail_before_log_copying_thread_start: } xtrabackup_destroy_datasinks(); - msg("mariabackup: Redo log (from LSN " LSN_PF " to " LSN_PF - ") was copied.\n", checkpoint_lsn_start, log_copy_scanned_lsn); + msg("Redo log (from LSN " LSN_PF " to " LSN_PF + ") was copied.", checkpoint_lsn_start, log_copy_scanned_lsn); xb_filters_free(); xb_data_files_close(); /* Make sure that the latest checkpoint was included */ if (metadata_to_lsn > log_copy_scanned_lsn) { - msg("mariabackup: error: failed to copy enough redo log (" - "LSN=" LSN_PF "; checkpoint LSN=" LSN_PF ").\n", + msg("Error: failed to copy enough redo log (" + "LSN=" LSN_PF "; checkpoint LSN=" LSN_PF ").", log_copy_scanned_lsn, metadata_to_lsn); goto fail; } @@ -4576,7 +4548,7 @@ void backup_fix_ddl(void) const char *dbname = buf; char *p = strchr(buf, '/'); if (p == 0) { - msg("Unexpected tablespace %s filename %s\n", space_name, name.c_str()); + msg("Unexpected tablespace %s filename %s", space_name, name.c_str()); ut_a(0); } ut_a(p); @@ -4595,16 +4567,6 @@ void backup_fix_ddl(void) continue; std::string dest_name(node->space->name); dest_name.append(".new"); -#if 0 - bool do_full_copy = ddl_tracker.optimized_ddl.find(n->space->id) != ddl_tracker.optimized_ddl.end(); - if (do_full_copy) { - msg( - "Performing a full copy of the tablespace %s, because optimized (without redo logging) DDL operation" - "ran during backup. You can use set innodb_log_optimize_ddl=OFF to improve backup performance" - "in the future.\n", - n->space->name); - } -#endif xtrabackup_copy_datafile(node, 0, dest_name.c_str()/*, do_full_copy ? ULONGLONG_MAX:UNIV_PAGE_SIZE */); } @@ -4659,14 +4621,14 @@ xb_space_create_file( *file = os_file_create_simple_no_error_handling( 0, path, OS_FILE_CREATE, OS_FILE_READ_WRITE, false, &ret); if (!ret) { - msg("mariabackup: cannot create file %s\n", path); + msg("Can't create file %s", path); return ret; } ret = os_file_set_size(path, *file, FIL_IBD_FILE_INITIAL_SIZE * UNIV_PAGE_SIZE); if (!ret) { - msg("mariabackup: cannot set size for file %s\n", path); + msg("mariabackup: cannot set size for file %s", path); os_file_close(*file); os_file_delete(0, path); return ret; @@ -4710,7 +4672,7 @@ xb_space_create_file( free(buf); if (!ret) { - msg("mariabackup: could not write the first page to %s\n", + msg("mariabackup: could not write the first page to %s", path); os_file_close(*file); os_file_delete(0, path); @@ -4771,7 +4733,7 @@ xb_delta_open_matching_space( /* Create the database directory if it doesn't exist yet */ if (!os_file_create_directory(dest_dir, FALSE)) { - msg("mariabackup: error: cannot create dir %s\n", dest_dir); + msg("mariabackup: error: cannot create dir %s", dest_dir); return file; } @@ -4818,7 +4780,7 @@ exit: snprintf(tmpname, FN_REFLEN, "%s/xtrabackup_tmp_#" ULINTPF, dbname, fil_space->id); - msg("mariabackup: Renaming %s to %s.ibd\n", + msg("mariabackup: Renaming %s to %s.ibd", fil_space->name, tmpname); if (!fil_rename_tablespace( @@ -4826,7 +4788,7 @@ exit: fil_space->chain.start->name, tmpname, NULL)) { - msg("mariabackup: Cannot rename %s to %s\n", + msg("mariabackup: Cannot rename %s to %s", fil_space->name, tmpname); goto exit; } @@ -4847,7 +4809,7 @@ exit: strncpy(tmpname, dest_space_name, FN_REFLEN); - msg("mariabackup: Renaming %s to %s\n", + msg("mariabackup: Renaming %s to %s", fil_space->name, dest_space_name); if (!fil_rename_tablespace(fil_space->id, @@ -4855,7 +4817,7 @@ exit: tmpname, NULL)) { - msg("mariabackup: Cannot rename %s to %s\n", + msg("mariabackup: Cannot rename %s to %s", fil_space->name, dest_space_name); goto exit; } @@ -4883,8 +4845,7 @@ exit: *success = xb_space_create_file(real_name, info.space_id, flags, &file); } else { - msg("mariabackup: Cannot create tablespace %s\n", - dest_space_name); + msg("Can't create tablespace %s\n", dest_space_name); } goto exit; @@ -4954,12 +4915,12 @@ xtrabackup_apply_delta( page_size = info.page_size.physical(); page_size_shift = get_bit_shift(page_size); - msg("mariabackup: page size for %s is %zu bytes\n", + msg("page size for %s is %zu bytes", src_path, page_size); if (page_size_shift < 10 || page_size_shift > UNIV_PAGE_SIZE_SHIFT_MAX) { - msg("mariabackup: error: invalid value of page_size " - "(%zu bytes) read from %s\n", page_size, meta_path); + msg("error: invalid value of page_size " + "(%zu bytes) read from %s", page_size, meta_path); goto error; } @@ -4968,7 +4929,7 @@ xtrabackup_apply_delta( OS_FILE_OPEN, OS_FILE_READ_WRITE, false, &success); if (!success) { os_file_get_last_error(TRUE); - msg("mariabackup: error: cannot open %s\n", src_path); + msg("error: can't open %s", src_path); goto error; } @@ -4978,7 +4939,7 @@ xtrabackup_apply_delta( dbname, space_name, info, dst_path, sizeof(dst_path), &success); if (!success) { - msg("mariabackup: error: cannot open %s\n", dst_path); + msg("error: can't open %s", dst_path); goto error; } @@ -4991,7 +4952,7 @@ xtrabackup_apply_delta( (ut_align(incremental_buffer_base, page_size)); - msg("Applying %s to %s...\n", src_path, dst_path); + msg("Applying %s to %s...", src_path, dst_path); while (!last_buffer) { ulint cluster_header; @@ -5014,8 +4975,8 @@ xtrabackup_apply_delta( last_buffer = TRUE; break; default: - msg("mariabackup: error: %s seems not " - ".delta file.\n", src_path); + msg("error: %s seems not " + ".delta file.", src_path); goto error; } @@ -5114,7 +5075,7 @@ error: os_file_close(src_file); if (dst_file != OS_FILE_CLOSED) os_file_close(dst_file); - msg("mariabackup: Error: xtrabackup_apply_delta(): " + msg("Error: xtrabackup_apply_delta(): " "failed to apply %s to %s.\n", src_path, dst_path); return FALSE; } @@ -5132,7 +5093,7 @@ std::string change_extension(std::string filename, std::string new_ext) { static void rename_file(const char *from,const char *to) { msg("Renaming %s to %s\n", from, to); if (my_rename(from, to, MY_WME)) { - msg("Cannot rename %s to %s errno %d", from, to, errno); + msg("Can't rename %s to %s errno %d", from, to, errno); exit(EXIT_FAILURE); } } @@ -5154,7 +5115,7 @@ typedef ibool (*handle_datadir_entry_func_t)( /** Rename, and replace destination file, if exists */ static void rename_force(const char *from, const char *to) { if (access(to, R_OK) == 0) { - msg("Removing %s\n", to); + msg("Removing %s", to); if (my_delete(to, MYF(MY_WME))) { msg("Can't remove %s, errno %d", to, errno); exit(EXIT_FAILURE); @@ -5274,16 +5235,14 @@ next_file_item_1: os_file_closedir(dbdir); } else { - msg("mariabackup: Cannot open dir %s\n", - path); + msg("Can't open dir %s", path); } /* single table tablespaces */ dir = os_file_opendir(path, FALSE); if (dir == NULL) { - msg("mariabackup: Cannot open dir %s\n", - path); + msg("Can't open dir %s", path); } ret = fil_file_readdir_next_file(&err, path, dir, @@ -5379,7 +5338,7 @@ store_binlog_info(const char* filename, const char* name, ulonglong pos) FILE *fp = fopen(filename, "w"); if (!fp) { - msg("mariabackup: failed to open '%s'\n", filename); + msg("mariabackup: failed to open '%s'", filename); return(false); } @@ -5400,7 +5359,7 @@ static std::string read_file_as_string(const std::string file) { char content[FN_REFLEN]; FILE *f = fopen(file.c_str(), "r"); if (!f) { - msg("Can not open %s\n", file.c_str()); + msg("Can not open %s", file.c_str()); } size_t len = fread(content, 1, FN_REFLEN, f); fclose(f); @@ -5497,11 +5456,10 @@ xtrabackup_prepare_func(char** argv) if (my_setwd(xtrabackup_real_target_dir,MYF(MY_WME))) { - msg("mariabackup: cannot my_setwd %s\n", - xtrabackup_real_target_dir); + msg("can't my_setwd %s", xtrabackup_real_target_dir); return(false); } - msg("mariabackup: cd to %s\n", xtrabackup_real_target_dir); + msg("cd to %s", xtrabackup_real_target_dir); fil_path_to_mysql_datadir = "."; @@ -5537,32 +5495,31 @@ xtrabackup_prepare_func(char** argv) XTRABACKUP_METADATA_FILENAME); if (!xtrabackup_read_metadata(metadata_path)) { - msg("mariabackup: Error: failed to read metadata from '%s'\n", + msg("Error: failed to read metadata from '%s'\n", metadata_path); return(false); } if (!strcmp(metadata_type, "full-backuped")) { if (xtrabackup_incremental) { - msg("mariabackup: error: applying incremental backup " - "needs a prepared target.\n"); + msg("error: applying incremental backup " + "needs a prepared target."); return(false); } - msg("mariabackup: This target seems to be not prepared yet.\n"); + msg("This target seems to be not prepared yet."); } else if (!strcmp(metadata_type, "log-applied")) { - msg("mariabackup: This target seems to be already prepared.\n"); + msg("This target seems to be already prepared."); } else { - msg("mariabackup: This target does not have correct metadata.\n"); + msg("This target does not have correct metadata."); return(false); } bool ok = !xtrabackup_incremental || metadata_to_lsn == incremental_lsn; if (!ok) { - msg("mariabackup: error: This incremental backup seems " - "not to be proper for the target.\n" - "mariabackup: Check 'to_lsn' of the target and " - "'from_lsn' of the incremental.\n"); + msg("error: This incremental backup seems " + "not to be proper for the target. Check 'to_lsn' of the target and " + "'from_lsn' of the incremental."); return(false); } @@ -5639,9 +5596,10 @@ xtrabackup_prepare_func(char** argv) srv_n_write_io_threads = 4; } - msg("mariabackup: Starting InnoDB instance for recovery.\n" - "mariabackup: Using %lld bytes for buffer pool " - "(set by --use-memory parameter)\n", xtrabackup_use_memory); + msg("Starting InnoDB instance for recovery."); + + msg("mariabackup: Using %lld bytes for buffer pool " + "(set by --use-memory parameter)", xtrabackup_use_memory); srv_max_buf_pool_modified_pct = (double)max_buf_pool_modified_pct; @@ -5669,7 +5627,7 @@ xtrabackup_prepare_func(char** argv) const char* name = reinterpret_cast( TRX_SYS_MYSQL_LOG_INFO + TRX_SYS_MYSQL_LOG_NAME + sys_header); - msg("Last binlog file %s, position %llu\n", name, pos); + msg("Last binlog file %s, position %llu", name, pos); /* output to xtrabackup_binlog_pos_innodb and (if backup_safe_binlog_info was available on @@ -5692,7 +5650,7 @@ xtrabackup_prepare_func(char** argv) && srv_start_lsn < target_lsn) { msg("mariabackup: error: " "The log was only applied up to LSN " LSN_PF - ", instead of " LSN_PF "\n", + ", instead of " LSN_PF, srv_start_lsn, target_lsn); ok = false; } @@ -5720,13 +5678,13 @@ xtrabackup_prepare_func(char** argv) if (!xtrabackup_write_metadata(filename)) { msg("mariabackup: Error: failed to write metadata " - "to '%s'\n", filename); + "to '%s'", filename); ok = false; } else if (xtrabackup_extra_lsndir) { sprintf(filename, "%s/%s", xtrabackup_extra_lsndir, XTRABACKUP_METADATA_FILENAME); if (!xtrabackup_write_metadata(filename)) { msg("mariabackup: Error: failed to write " - "metadata to '%s'\n", filename); + "metadata to '%s'", filename); ok = false; } } @@ -5841,7 +5799,7 @@ int check_privilege( { if (!has_privilege(granted_priv, required, target_database, target_table)) { - msg("%s: missing required privilege %s on %s.%s\n", + msg("%s: missing required privilege %s on %s.%s", (error == PRIVILEGE_ERROR ? "Error" : "Warning"), required, target_database, target_table); return error; @@ -5930,7 +5888,7 @@ xb_init() && !opt_safe_slave_backup) { msg("Error: --slave-info is used with --no-lock but " "without --safe-slave-backup. The binlog position " - "cannot be consistent with the backup data.\n"); + "cannot be consistent with the backup data."); return(false); } @@ -6156,7 +6114,7 @@ handle_options(int argc, char **argv, char ***argv_client, char ***argv_server) msg("mariabackup: Error: --defaults-file " "must be specified first on the command " - "line\n"); + "line"); exit(EXIT_FAILURE); } if (optend - argv[i] == 21 && @@ -6213,7 +6171,7 @@ handle_options(int argc, char **argv, char ***argv_client, char ***argv_server) if (!server_option) { msg("mariabackup: Error:" - " unknown argument: '%s'\n", opt); + " unknown argument: '%s'", opt); exit(EXIT_FAILURE); } } @@ -6313,7 +6271,7 @@ int main(int argc, char **argv) mysql_mutex_destroy(&LOCK_error_log); if (status == EXIT_SUCCESS) { - msg_ts("completed OK!\n"); + msg("completed OK!"); } return status; @@ -6331,7 +6289,7 @@ static int main_low(char** argv) && !strcmp(mysql_data_home, "./")) { if (!xtrabackup_print_param) usage(); - msg("\nmariabackup: Error: Please set parameter 'datadir'\n"); + msg("mariabackup: Error: Please set parameter 'datadir'"); return(EXIT_FAILURE); } @@ -6402,7 +6360,7 @@ static int main_low(char** argv) if (error) { msg("mariabackup: value '%s' may be wrong format for " - "incremental option.\n", xtrabackup_incremental); + "incremental option.", xtrabackup_incremental); return(EXIT_FAILURE); } } else if (xtrabackup_backup && xtrabackup_incremental_basedir) { @@ -6412,7 +6370,7 @@ static int main_low(char** argv) if (!xtrabackup_read_metadata(filename)) { msg("mariabackup: error: failed to read metadata from " - "%s\n", filename); + "%s", filename); return(EXIT_FAILURE); } @@ -6425,7 +6383,7 @@ static int main_low(char** argv) if (!xtrabackup_read_metadata(filename)) { msg("mariabackup: error: failed to read metadata from " - "%s\n", filename); + "%s", filename); return(EXIT_FAILURE); } @@ -6443,7 +6401,7 @@ static int main_low(char** argv) } if (xtrabackup_stream && !xtrabackup_backup) { - msg("Warning: --stream parameter is ignored, it only works together with --backup.\n"); + msg("Warning: --stream parameter is ignored, it only works together with --backup."); } if (!xb_init()) { @@ -6458,13 +6416,13 @@ static int main_low(char** argv) print_version(); if (xtrabackup_incremental) { - msg("incremental backup from " LSN_PF " is enabled.\n", + msg("incremental backup from " LSN_PF " is enabled.", incremental_lsn); } if (xtrabackup_export && innobase_file_per_table == FALSE) { msg("mariabackup: auto-enabling --innodb-file-per-table due to " - "the --export option\n"); + "the --export option"); innobase_file_per_table = TRUE; } diff --git a/extra/mariabackup/xtrabackup.h b/extra/mariabackup/xtrabackup.h index c16e19d1b18..8e0e09f6f07 100644 --- a/extra/mariabackup/xtrabackup.h +++ b/extra/mariabackup/xtrabackup.h @@ -71,7 +71,7 @@ extern char *xtrabackup_databases_file; extern char *xtrabackup_tables_exclude; extern char *xtrabackup_databases_exclude; -extern ibool xtrabackup_compress; +extern uint xtrabackup_compress; extern my_bool xtrabackup_backup; extern my_bool xtrabackup_prepare; @@ -86,14 +86,10 @@ extern int xtrabackup_parallel; extern my_bool xb_close_files; extern const char *xtrabackup_compress_alg; -#ifdef __cplusplus -extern "C"{ -#endif - extern uint xtrabackup_compress_threads; - extern ulonglong xtrabackup_compress_chunk_size; -#ifdef __cplusplus -} -#endif + +extern uint xtrabackup_compress_threads; +extern ulonglong xtrabackup_compress_chunk_size; + extern my_bool xtrabackup_export; extern char *xtrabackup_extra_lsndir; extern ulint xtrabackup_log_copy_interval; From 2153aaf66eeff70b2191806e187c2b845b91f3a2 Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Tue, 15 Jan 2019 22:47:54 +0100 Subject: [PATCH 10/18] mariabackup : use die() macro for fatal exit with error message. --- extra/mariabackup/backup_copy.cc | 5 +- extra/mariabackup/backup_mysql.cc | 11 ++-- extra/mariabackup/common.h | 29 ++++++---- extra/mariabackup/datasink.cc | 9 ++-- extra/mariabackup/ds_buffer.cc | 2 +- extra/mariabackup/ds_tmpfile.cc | 14 ++--- extra/mariabackup/encryption_plugin.cc | 3 +- extra/mariabackup/wsrep.cc | 7 ++- extra/mariabackup/xtrabackup.cc | 73 +++++++++----------------- 9 files changed, 63 insertions(+), 90 deletions(-) diff --git a/extra/mariabackup/backup_copy.cc b/extra/mariabackup/backup_copy.cc index 1fb5dd0fda6..b0ad000cb90 100644 --- a/extra/mariabackup/backup_copy.cc +++ b/extra/mariabackup/backup_copy.cc @@ -2221,7 +2221,7 @@ static void copy_or_move_dir(const char *from, const char *to, bool do_copy, boo to, 1)); } if (!rc) - exit(EXIT_FAILURE); + die("copy or move file failed"); } datadir_iter_free(it); datadir_node_free(&node); @@ -2323,8 +2323,7 @@ static void rocksdb_backup_checkpoint() if (backup_to_directory) { if (my_mkdir(rocksdb_backup_dir, 0777, MYF(0))){ - msg("Can't create rocksdb backup directory %s", rocksdb_backup_dir); - exit(EXIT_FAILURE); + die("Can't create rocksdb backup directory %s", rocksdb_backup_dir); } } copy_or_move_dir(rocksdb_checkpoint_dir, ROCKSDB_BACKUP_DIR, true, backup_to_directory); diff --git a/extra/mariabackup/backup_mysql.cc b/extra/mariabackup/backup_mysql.cc index 0dbd2425363..8936b577a9e 100644 --- a/extra/mariabackup/backup_mysql.cc +++ b/extra/mariabackup/backup_mysql.cc @@ -167,9 +167,10 @@ xb_mysql_query(MYSQL *connection, const char *query, bool use_result, MYSQL_RES *mysql_result = NULL; if (mysql_query(connection, query)) { - msg("Error: failed to execute query %s: %s", query, mysql_error(connection)); if (die_on_error) { - exit(EXIT_FAILURE); + die("failed to execute query %s: %s", query, mysql_error(connection)); + } else { + msg("Error: failed to execute query %s: %s", query, mysql_error(connection)); } return(NULL); } @@ -177,9 +178,8 @@ xb_mysql_query(MYSQL *connection, const char *query, bool use_result, /* store result set on client if there is a result */ if (mysql_field_count(connection) > 0) { if ((mysql_result = mysql_store_result(connection)) == NULL) { - msg("Error: failed to fetch query result %s: %s", + die("failed to fetch query result %s: %s", query, mysql_error(connection)); - exit(EXIT_FAILURE); } if (!use_result) { @@ -910,8 +910,7 @@ DECLARE_THREAD(kill_mdl_waiters_thread(void *)) row[1], row[2], row[0]); snprintf(query, sizeof(query), "KILL QUERY %s", row[0]); if (mysql_query(mysql, query) && (mysql_errno(mysql) != ER_NO_SUCH_THREAD)) { - msg("Error: failed to execute query %s: %s", query,mysql_error(mysql)); - exit(EXIT_FAILURE); + die("failed to execute query %s: %s", query,mysql_error(mysql)); } } mysql_free_result(result); diff --git a/extra/mariabackup/common.h b/extra/mariabackup/common.h index bdc5e618a6a..2426f090888 100644 --- a/extra/mariabackup/common.h +++ b/extra/mariabackup/common.h @@ -86,9 +86,7 @@ static inline int asprintf(char **strp, const char *fmt,...) #define XB_DELTA_INFO_SUFFIX ".meta" - -static inline int msg1(unsigned int thread_num, const char *fmt, ...) ATTRIBUTE_FORMAT(printf, 2, 3); -static inline int msg1(uint thread_num, const char *fmt, va_list args) +static inline int msg1(uint thread_num, const char *prefix, const char *fmt, va_list args) { int result; time_t t = time(NULL); @@ -98,35 +96,44 @@ static inline int msg1(uint thread_num, const char *fmt, va_list args) result = vasprintf(&line, fmt, args); if (result != -1) { if (fmt && fmt[strlen(fmt)] != '\n') - result = fprintf(stderr, "[%02u] %s %s\n", thread_num, date, line); + result = fprintf(stderr, "[%02u] %s%s %s\n", thread_num, prefix, date, line); else - result = fprintf(stderr, "[%02u] %s %s", thread_num, date, line); + result = fprintf(stderr, "[%02u] %s%s %s", thread_num, prefix, date, line); free(line); } return result; } -static inline int msg(unsigned int, const char *fmt, ...) ATTRIBUTE_FORMAT(printf, 2, 3); -static inline int msg(unsigned int thread_num, const char *fmt, ...) + +static inline ATTRIBUTE_FORMAT(printf, 2, 3) int msg(unsigned int thread_num, const char *fmt, ...) { int result; va_list args; va_start(args, fmt); - result = msg1(thread_num, fmt, args); + result = msg1(thread_num,"", fmt, args); va_end(args); return result; } -static inline int msg(const char *fmt, ...) ATTRIBUTE_FORMAT(printf, 1, 2); -static inline int msg(const char *fmt, ...) +static inline ATTRIBUTE_FORMAT(printf, 1, 2) int msg(const char *fmt, ...) { int result; va_list args; va_start(args, fmt); - result = msg1(0, fmt, args); + result = msg1(0, "", fmt, args); va_end(args); return result; } +static inline ATTRIBUTE_FORMAT(printf, 1,2) ATTRIBUTE_NORETURN void die(const char *fmt, ...) +{ + va_list args; + va_start(args, fmt); + msg1(0, "FATAL ERROR: ", fmt, args); + va_end(args); + fflush(stderr); + _exit(EXIT_FAILURE); +} + /* Use POSIX_FADV_NORMAL when available */ diff --git a/extra/mariabackup/datasink.cc b/extra/mariabackup/datasink.cc index 6cd06a09de5..4d12b51a905 100644 --- a/extra/mariabackup/datasink.cc +++ b/extra/mariabackup/datasink.cc @@ -48,8 +48,7 @@ ds_create(const char *root, ds_type_t type) #ifdef HAVE_LIBARCHIVE ds = &datasink_archive; #else - msg("Error : mariabackup was built without libarchive support"); - exit(EXIT_FAILURE); + die("mariabackup was built without libarchive support"); #endif break; case DS_TYPE_XBSTREAM: @@ -60,8 +59,7 @@ ds_create(const char *root, ds_type_t type) break; case DS_TYPE_ENCRYPT: case DS_TYPE_DECRYPT: - msg("Error : mariabackup does not support encrypted backups."); - exit(EXIT_FAILURE); + die("mariabackup does not support encrypted backups."); break; case DS_TYPE_TMPFILE: @@ -80,8 +78,7 @@ ds_create(const char *root, ds_type_t type) if (ctxt != NULL) { ctxt->datasink = ds; } else { - msg("Error: failed to initialize datasink."); - exit(EXIT_FAILURE); + die("failed to initialize datasink."); } return ctxt; diff --git a/extra/mariabackup/ds_buffer.cc b/extra/mariabackup/ds_buffer.cc index 71ee323537a..933c443a4c0 100644 --- a/extra/mariabackup/ds_buffer.cc +++ b/extra/mariabackup/ds_buffer.cc @@ -96,7 +96,7 @@ buffer_open(ds_ctxt_t *ctxt, const char *path, MY_STAT *mystat) dst_file = ds_open(pipe_ctxt, path, mystat); if (dst_file == NULL) { - exit(EXIT_FAILURE); + die("ds_open(%s) failed", path); } buffer_ctxt = (ds_buffer_ctxt_t *) ctxt->ptr; diff --git a/extra/mariabackup/ds_tmpfile.cc b/extra/mariabackup/ds_tmpfile.cc index 25f535100ec..5337fce8e96 100644 --- a/extra/mariabackup/ds_tmpfile.cc +++ b/extra/mariabackup/ds_tmpfile.cc @@ -195,8 +195,7 @@ tmpfile_deinit(ds_ctxt_t *ctxt) /* Stat the file to replace size and mtime on the original * mystat struct */ if (my_fstat(tmp_file->fd, &mystat, MYF(0))) { - msg("error: my_fstat() failed."); - exit(EXIT_FAILURE); + die("my_fstat() failed."); } tmp_file->mystat.st_size = mystat.st_size; tmp_file->mystat.st_mtime = mystat.st_mtime; @@ -204,18 +203,16 @@ tmpfile_deinit(ds_ctxt_t *ctxt) dst_file = ds_open(pipe_ctxt, tmp_file->orig_path, &tmp_file->mystat); if (dst_file == NULL) { - msg("error: could not stream a temporary file to " + die("could not stream a temporary file to " "'%s'", tmp_file->orig_path); - exit(EXIT_FAILURE); } /* copy to the destination datasink */ posix_fadvise(tmp_file->fd, 0, 0, POSIX_FADV_SEQUENTIAL); if (my_seek(tmp_file->fd, 0, SEEK_SET, MYF(0)) == MY_FILEPOS_ERROR) { - msg("error: my_seek() failed for '%s', errno = %d.", + die("my_seek() failed for '%s', errno = %d.", tmp_file->file->path, my_errno); - exit(EXIT_FAILURE); } offset = 0; while ((bytes = my_read(tmp_file->fd, (unsigned char *)buf, buf_size, @@ -223,13 +220,12 @@ tmpfile_deinit(ds_ctxt_t *ctxt) posix_fadvise(tmp_file->fd, offset, buf_size, POSIX_FADV_DONTNEED); offset += buf_size; if (ds_write(dst_file, buf, bytes)) { - msg("error: cannot write to stream for '%s'.", + die("cannot write to stream for '%s'.", tmp_file->orig_path); - exit(EXIT_FAILURE); } } if (bytes == (size_t) -1) { - exit(EXIT_FAILURE); + die("my_read failed for %s", tmp_file->orig_path); } my_close(tmp_file->fd, MYF(MY_WME)); diff --git a/extra/mariabackup/encryption_plugin.cc b/extra/mariabackup/encryption_plugin.cc index 78a74c7b7a8..be530d63ee2 100644 --- a/extra/mariabackup/encryption_plugin.cc +++ b/extra/mariabackup/encryption_plugin.cc @@ -45,8 +45,7 @@ static std::string get_encryption_plugin_from_cnf() FILE *f = fopen("backup-my.cnf", "r"); if (!f) { - msg("Can't open backup-my.cnf for reading"); - exit(EXIT_FAILURE); + die("Can't open backup-my.cnf for reading"); } char line[512]; std::string plugin_load; diff --git a/extra/mariabackup/wsrep.cc b/extra/mariabackup/wsrep.cc index 8e755171647..1db0f9ccd6e 100644 --- a/extra/mariabackup/wsrep.cc +++ b/extra/mariabackup/wsrep.cc @@ -193,7 +193,7 @@ xb_write_galera_info(bool incremental_prepare) fp = fopen(XB_GALERA_INFO_FILENAME, "w"); if (fp == NULL) { - msg("mariabackup: error: " + die( "could not create " XB_GALERA_INFO_FILENAME ", errno = %d\n", errno); @@ -207,11 +207,10 @@ xb_write_galera_info(bool incremental_prepare) if (fprintf(fp, "%s:%lld", uuid_str, (long long) seqno) < 0) { - msg("mariabackup: error: " + die( "could not write to " XB_GALERA_INFO_FILENAME ", errno = %d\n", - errno); - exit(EXIT_FAILURE); + errno);; } fclose(fp); diff --git a/extra/mariabackup/xtrabackup.cc b/extra/mariabackup/xtrabackup.cc index 9d183ea3087..03037e56696 100644 --- a/extra/mariabackup/xtrabackup.cc +++ b/extra/mariabackup/xtrabackup.cc @@ -657,9 +657,8 @@ static void backup_file_op_fail(ulint space_id, const byte* flags, msg("DDL tracking : delete %zu \"%.*s\"", space_id, int(len), name); } if (fail) { - msg("ERROR : DDL operation detected in the late phase of backup." + die("DDL operation detected in the late phase of backup." "Backup is inconsistent. Remove --no-lock option to fix."); - exit(EXIT_FAILURE); } } @@ -1457,8 +1456,7 @@ debug_sync_point(const char *name) xtrabackup_target_dir); fp = fopen(pid_path, "w"); if (fp == NULL) { - msg("mariabackup: Error: cannot open %s", pid_path); - exit(EXIT_FAILURE); + die("Can't open open %s", pid_path); } fprintf(fp, "%u\n", (uint) pid); fclose(fp); @@ -1794,7 +1792,7 @@ innodb_init_param(void) memset((G_PTR) &mysql_tmpdir_list, 0, sizeof(mysql_tmpdir_list)); if (init_tmpdir(&mysql_tmpdir_list, opt_mysql_tmpdir)) - exit(EXIT_FAILURE); + die("init_tmpdir() failed"); xtrabackup_tmpdir = my_tmpdir(&mysql_tmpdir_list); /* dummy for initialize all_charsets[] */ get_charset_name(0); @@ -1811,9 +1809,8 @@ innodb_init_param(void) msg("InnoDB: The page size of the " "database is set to %lu.", srv_page_size); } else { - msg("InnoDB: Error: invalid value of " + die("invalid value of " "innobase_page_size: %lld", innobase_page_size); - exit(EXIT_FAILURE); } } else { srv_page_size_shift = 14; @@ -2766,8 +2763,7 @@ static bool xtrabackup_copy_logfile(bool last = false) log_mutex_exit(); if (!start_lsn) { - msg("Error: xtrabackup_copy_logfile() failed."); - exit(EXIT_FAILURE); + die("xtrabackup_copy_logfile() failed."); } } while (start_lsn == end_lsn); @@ -2916,8 +2912,7 @@ data_copy_thread_func( DBUG_MARIABACKUP_EVENT("before_copy", node->space->name); /* copy the datafile */ if(xtrabackup_copy_datafile(node, num)) { - msg(num,"mariabackup: Error: failed to copy datafile."); - exit(EXIT_FAILURE); + die("failed to copy datafile."); } DBUG_MARIABACKUP_EVENT("after_copy", node->space->name); @@ -3094,9 +3089,7 @@ xb_load_single_table_tablespace( Datafile *file = xb_new_datafile(name, is_remote); if (file->open_read_only(true) != DB_SUCCESS) { - msg("Can't open datafile %s", name); - ut_free(name); - exit(EXIT_FAILURE); + die("Can't open datafile %s", name); } err = file->validate_first_page(&flush_lsn); @@ -3134,7 +3127,7 @@ xb_load_single_table_tablespace( if (err != DB_SUCCESS && err != DB_CORRUPTION && xtrabackup_backup) { /* allow corrupted first page for xtrabackup, it could be just zero-filled page, which we restore from redo log later */ - exit(EXIT_FAILURE); + die("Failed to not validate first page of the file %s, error %d",name, (int)err); } } @@ -3505,13 +3498,11 @@ xb_validate_name( /* perform only basic validation. validate length and path symbols */ if (len > NAME_LEN) { - msg("mariabackup: name `%s` is too long.", name); - exit(EXIT_FAILURE); + die("name `%s` is too long.", name); } p = strpbrk(name, "/\\~"); if (p && (uint) (p - name) < NAME_LEN) { - msg("mariabackup: name `%s` is not valid.", name); - exit(EXIT_FAILURE); + die("name `%s` is not valid.", name); } } @@ -3589,8 +3580,7 @@ xb_register_table( const char* name) /*!< in: name of table */ { if (strchr(name, '.') == NULL) { - msg("mariabackup: `%s` is not fully qualified name.", name); - exit(EXIT_FAILURE); + die("`%s` is not fully qualified name.", name); } xb_register_include_filter_entry(name); @@ -3680,17 +3670,15 @@ xb_load_list_file( /* read and store the filenames */ fp = fopen(filename, "r"); if (!fp) { - msg("mariabackup: cannot open %s", + die("Can't open %s", filename); - exit(EXIT_FAILURE); } while (fgets(name_buf, sizeof(name_buf), fp) != NULL) { char* p = strchr(name_buf, '\n'); if (p) { *p = '\0'; } else { - msg("mariabackup: `%s...` name is too long", name_buf); - exit(EXIT_FAILURE); + die("`%s...` name is too long", name_buf); } ins(name_buf); @@ -4797,9 +4785,8 @@ exit: if (info.space_id == ULINT_UNDEFINED) { - msg("mariabackup: Error: Cannot handle DDL operation on tablespace " + die("Can't handle DDL operation on tablespace " "%s\n", dest_space_name); - exit(EXIT_FAILURE); } mutex_enter(&fil_system->mutex); fil_space = fil_space_get_by_id(info.space_id); @@ -5093,8 +5080,7 @@ std::string change_extension(std::string filename, std::string new_ext) { static void rename_file(const char *from,const char *to) { msg("Renaming %s to %s\n", from, to); if (my_rename(from, to, MY_WME)) { - msg("Can't rename %s to %s errno %d", from, to, errno); - exit(EXIT_FAILURE); + die("Can't rename %s to %s errno %d", from, to, errno); } } @@ -5371,8 +5357,7 @@ static void delete_file(const std::string& file, bool if_exists = false) { if (if_exists && !file_exists(file)) return; if (my_delete(file.c_str(), MYF(MY_WME))) { - msg("Can't remove %s, errno %d", file.c_str(), errno); - exit(EXIT_FAILURE); + die("Can't remove %s, errno %d", file.c_str(), errno); } } @@ -5757,7 +5742,7 @@ has_privilege(const std::list &granted, required, db_name, table_name); if (written < 0 || written == sizeof(buffer) || regcomp(&priv_re, buffer, REG_EXTENDED)) { - exit(EXIT_FAILURE); + die("regcomp() failed for '%s'", buffer); } typedef std::list::const_iterator string_iter; @@ -5871,7 +5856,7 @@ check_all_privileges() if (check_result & PRIVILEGE_ERROR) { mysql_close(mysql_connection); - exit(EXIT_FAILURE); + die("Insufficient privileges"); } } @@ -6110,21 +6095,13 @@ handle_options(int argc, char **argv, char ***argv_client, char ***argv_server) char *optend = strcend((argv)[i], '='); if (optend - argv[i] == 15 && - !strncmp(argv[i], "--defaults-file", optend - argv[i])) { - - msg("mariabackup: Error: --defaults-file " - "must be specified first on the command " - "line"); - exit(EXIT_FAILURE); + !strncmp(argv[i], "--defaults-file", optend - argv[i])) { + die("--defaults-file must be specified first on the command line"); } - if (optend - argv[i] == 21 && - !strncmp(argv[i], "--defaults-extra-file", - optend - argv[i])) { - - msg("mariabackup: Error: --defaults-extra-file " - "must be specified first on the command " - "line\n"); - exit(EXIT_FAILURE); + if (optend - argv[i] == 21 && + !strncmp(argv[i], "--defaults-extra-file", + optend - argv[i])) { + die("--defaults-extra-file must be specified first on the command line"); } } @@ -6227,7 +6204,7 @@ int main(int argc, char **argv) if (mysql_server_init(-1, NULL, NULL)) { - exit(EXIT_FAILURE); + die("mysql_server_init() failed"); } system_charset_info = &my_charset_utf8_general_ci; From 802e8d6b89b4e1de1714cad56f53c643d58597c2 Mon Sep 17 00:00:00 2001 From: Anel Husakovic Date: Sun, 7 Oct 2018 04:51:46 -0700 Subject: [PATCH 11/18] Backport INFORMATION_SCHEMA.CHECK_CONSTRAINTS Implement according to standard SQL specification 2008. The check_constraints table is used for fetching metadata about the constraints defined for tables in all databases. There were some result files which failed after running mtr. These files are updated with newly create record with mtr --record. --- mysql-test/r/information_schema.result | 2 + .../r/information_schema_all_engines.result | 8 +- .../funcs_1/r/is_check_constraint.result | 121 ++++++++++++++++++ .../suite/funcs_1/r/is_columns_is.result | 10 ++ .../funcs_1/r/is_columns_is_embedded.result | 10 ++ .../suite/funcs_1/r/is_tables_is.result | 46 +++++++ .../funcs_1/r/is_tables_is_embedded.result | 46 +++++++ .../suite/funcs_1/t/is_check_constraint.test | 91 +++++++++++++ sql/handler.h | 1 + sql/sql_show.cc | 45 +++++++ 10 files changed, 379 insertions(+), 1 deletion(-) create mode 100644 mysql-test/suite/funcs_1/r/is_check_constraint.result create mode 100644 mysql-test/suite/funcs_1/t/is_check_constraint.test diff --git a/mysql-test/r/information_schema.result b/mysql-test/r/information_schema.result index 5d2d960ad6f..ca76cc8100a 100644 --- a/mysql-test/r/information_schema.result +++ b/mysql-test/r/information_schema.result @@ -51,6 +51,7 @@ c ALL_PLUGINS APPLICABLE_ROLES CHARACTER_SETS +CHECK_CONSTRAINTS CLIENT_STATISTICS COLLATIONS COLLATION_CHARACTER_SET_APPLICABILITY @@ -922,6 +923,7 @@ connection user10261; SELECT TABLE_NAME, COLUMN_NAME, PRIVILEGES FROM INFORMATION_SCHEMA.COLUMNS where COLUMN_NAME='TABLE_NAME' and table_name not like 'innodb%'; TABLE_NAME COLUMN_NAME PRIVILEGES +CHECK_CONSTRAINTS TABLE_NAME select COLUMNS TABLE_NAME select COLUMN_PRIVILEGES TABLE_NAME select FILES TABLE_NAME select diff --git a/mysql-test/r/information_schema_all_engines.result b/mysql-test/r/information_schema_all_engines.result index 126a6f4bccd..0ce9f15f753 100644 --- a/mysql-test/r/information_schema_all_engines.result +++ b/mysql-test/r/information_schema_all_engines.result @@ -4,6 +4,7 @@ Tables_in_information_schema ALL_PLUGINS APPLICABLE_ROLES CHARACTER_SETS +CHECK_CONSTRAINTS CLIENT_STATISTICS COLLATIONS COLLATION_CHARACTER_SET_APPLICABILITY @@ -83,6 +84,7 @@ table_name column_name ALL_PLUGINS PLUGIN_NAME APPLICABLE_ROLES GRANTEE CHARACTER_SETS CHARACTER_SET_NAME +CHECK_CONSTRAINTS CONSTRAINT_SCHEMA CLIENT_STATISTICS CLIENT COLLATIONS COLLATION_NAME COLLATION_CHARACTER_SET_APPLICABILITY COLLATION_NAME @@ -162,6 +164,7 @@ table_name column_name ALL_PLUGINS PLUGIN_NAME APPLICABLE_ROLES GRANTEE CHARACTER_SETS CHARACTER_SET_NAME +CHECK_CONSTRAINTS CONSTRAINT_SCHEMA CLIENT_STATISTICS CLIENT COLLATIONS COLLATION_NAME COLLATION_CHARACTER_SET_APPLICABILITY COLLATION_NAME @@ -247,6 +250,7 @@ table_name group_concat(t.table_schema, '.', t.table_name) num1 ALL_PLUGINS information_schema.ALL_PLUGINS 1 APPLICABLE_ROLES information_schema.APPLICABLE_ROLES 1 CHARACTER_SETS information_schema.CHARACTER_SETS 1 +CHECK_CONSTRAINTS information_schema.CHECK_CONSTRAINTS 1 CLIENT_STATISTICS information_schema.CLIENT_STATISTICS 1 COLLATIONS information_schema.COLLATIONS 1 COLLATION_CHARACTER_SET_APPLICABILITY information_schema.COLLATION_CHARACTER_SET_APPLICABILITY 1 @@ -315,6 +319,7 @@ Database: information_schema | ALL_PLUGINS | | APPLICABLE_ROLES | | CHARACTER_SETS | +| CHECK_CONSTRAINTS | | CLIENT_STATISTICS | | COLLATIONS | | COLLATION_CHARACTER_SET_APPLICABILITY | @@ -384,6 +389,7 @@ Database: INFORMATION_SCHEMA | ALL_PLUGINS | | APPLICABLE_ROLES | | CHARACTER_SETS | +| CHECK_CONSTRAINTS | | CLIENT_STATISTICS | | COLLATIONS | | COLLATION_CHARACTER_SET_APPLICABILITY | @@ -453,5 +459,5 @@ Wildcard: inf_rmation_schema | information_schema | SELECT table_schema, count(*) FROM information_schema.TABLES WHERE table_schema IN ('mysql', 'INFORMATION_SCHEMA', 'test', 'mysqltest') GROUP BY TABLE_SCHEMA; table_schema count(*) -information_schema 64 +information_schema 65 mysql 30 diff --git a/mysql-test/suite/funcs_1/r/is_check_constraint.result b/mysql-test/suite/funcs_1/r/is_check_constraint.result new file mode 100644 index 00000000000..e36db395eb9 --- /dev/null +++ b/mysql-test/suite/funcs_1/r/is_check_constraint.result @@ -0,0 +1,121 @@ +# +# MDEV-17323: Backport INFORMATION_SCHEMA.CHECK_CONSTRAINTS to 10.2 +# +CREATE user boo1; +GRANT select,create,alter,drop on foo.* to boo1; +SHOW GRANTS for boo1; +Grants for boo1@% +GRANT USAGE ON *.* TO 'boo1'@'%' +GRANT SELECT, CREATE, DROP, ALTER ON `foo`.* TO 'boo1'@'%' +CREATE user boo2; +create database foo; +CONNECT con1,localhost, boo1,, foo; +SET check_constraint_checks=1; +CREATE TABLE t0 +( +t int, check (t>32) # table constraint +) ENGINE=myisam; +SELECT * from information_schema.check_constraints; +CONSTRAINT_CATALOG CONSTRAINT_SCHEMA TABLE_NAME CONSTRAINT_NAME CHECK_CLAUSE +def foo t0 CONSTRAINT_1 `t` > 32 +ALTER TABLE t0 +ADD CONSTRAINT CHK_t0_t CHECK(t<100); +SELECT * from information_schema.check_constraints; +CONSTRAINT_CATALOG CONSTRAINT_SCHEMA TABLE_NAME CONSTRAINT_NAME CHECK_CLAUSE +def foo t0 CHK_t0_t `t` < 100 +def foo t0 CONSTRAINT_1 `t` > 32 +ALTER TABLE t0 +DROP CONSTRAINT CHK_t0_t; +SELECT * from information_schema.check_constraints; +CONSTRAINT_CATALOG CONSTRAINT_SCHEMA TABLE_NAME CONSTRAINT_NAME CHECK_CLAUSE +def foo t0 CONSTRAINT_1 `t` > 32 +ALTER TABLE t0 +ADD CONSTRAINT CHECK(t<50); +SELECT * from information_schema.check_constraints; +CONSTRAINT_CATALOG CONSTRAINT_SCHEMA TABLE_NAME CONSTRAINT_NAME CHECK_CLAUSE +def foo t0 CONSTRAINT_1 `t` > 32 +def foo t0 CONSTRAINT_2 `t` < 50 +CREATE TABLE t1 +( t int CHECK(t>2), # field constraint +tt int, +CONSTRAINT CHECK (tt > 32), CONSTRAINT CHECK (tt <50),# autogenerated names table constraints +CONSTRAINT CHK_tt CHECK(tt<100) # named table constraint +) ENGINE=InnoDB; +SELECT * from information_schema.check_constraints; +CONSTRAINT_CATALOG CONSTRAINT_SCHEMA TABLE_NAME CONSTRAINT_NAME CHECK_CLAUSE +def foo t0 CONSTRAINT_1 `t` > 32 +def foo t0 CONSTRAINT_2 `t` < 50 +def foo t1 CHK_tt `tt` < 100 +def foo t1 CONSTRAINT_1 `tt` > 32 +def foo t1 CONSTRAINT_2 `tt` < 50 +def foo t1 t `t` > 2 +ALTER TABLE t1 +DROP CONSTRAINT CHK_tt; +SELECT * from information_schema.check_constraints; +CONSTRAINT_CATALOG CONSTRAINT_SCHEMA TABLE_NAME CONSTRAINT_NAME CHECK_CLAUSE +def foo t0 CONSTRAINT_1 `t` > 32 +def foo t0 CONSTRAINT_2 `t` < 50 +def foo t1 CONSTRAINT_1 `tt` > 32 +def foo t1 CONSTRAINT_2 `tt` < 50 +def foo t1 t `t` > 2 +CREATE TABLE t2 +( +name VARCHAR(30) CHECK(CHAR_LENGTH(name)>2), #field constraint +start_date DATE, +end_date DATE, +CONSTRAINT CHK_dates CHECK(start_date IS NULL) #table constraint +)ENGINE=Innodb; +SELECT * from information_schema.check_constraints; +CONSTRAINT_CATALOG CONSTRAINT_SCHEMA TABLE_NAME CONSTRAINT_NAME CHECK_CLAUSE +def foo t0 CONSTRAINT_1 `t` > 32 +def foo t0 CONSTRAINT_2 `t` < 50 +def foo t1 CONSTRAINT_1 `tt` > 32 +def foo t1 CONSTRAINT_2 `tt` < 50 +def foo t1 t `t` > 2 +def foo t2 CHK_dates `start_date` is null +def foo t2 name char_length(`name`) > 2 +ALTER TABLE t1 +ADD CONSTRAINT CHK_new_ CHECK(t>tt); +SELECT * from information_schema.check_constraints; +CONSTRAINT_CATALOG CONSTRAINT_SCHEMA TABLE_NAME CONSTRAINT_NAME CHECK_CLAUSE +def foo t0 CONSTRAINT_1 `t` > 32 +def foo t0 CONSTRAINT_2 `t` < 50 +def foo t1 CHK_new_ `t` > `tt` +def foo t1 CONSTRAINT_1 `tt` > 32 +def foo t1 CONSTRAINT_2 `tt` < 50 +def foo t1 t `t` > 2 +def foo t2 CHK_dates `start_date` is null +def foo t2 name char_length(`name`) > 2 +CREATE TABLE t3 +( +a int, +b int check (b>0), # field constraint named 'b' +CONSTRAINT b check (b>10) # table constraint +) ENGINE=InnoDB; +SELECT * from information_schema.check_constraints; +CONSTRAINT_CATALOG CONSTRAINT_SCHEMA TABLE_NAME CONSTRAINT_NAME CHECK_CLAUSE +def foo t0 CONSTRAINT_1 `t` > 32 +def foo t0 CONSTRAINT_2 `t` < 50 +def foo t1 CHK_new_ `t` > `tt` +def foo t1 CONSTRAINT_1 `tt` > 32 +def foo t1 CONSTRAINT_2 `tt` < 50 +def foo t1 t `t` > 2 +def foo t2 CHK_dates `start_date` is null +def foo t2 name char_length(`name`) > 2 +def foo t3 b `b` > 0 +def foo t3 b `b` > 10 +disconnect con1; +CONNECT con2, localhost, boo2,, test; +SELECT * from information_schema.check_constraints; +CONSTRAINT_CATALOG CONSTRAINT_SCHEMA TABLE_NAME CONSTRAINT_NAME CHECK_CLAUSE +disconnect con2; +CONNECT con1, localhost, boo1,,foo; +DROP TABLE t0; +DROP TABLE t1; +DROP TABLE t2; +DROP TABLE t3; +DROP DATABASE foo; +disconnect con1; +connection default; +DROP USER boo1; +DROP USER boo2; diff --git a/mysql-test/suite/funcs_1/r/is_columns_is.result b/mysql-test/suite/funcs_1/r/is_columns_is.result index 58105c8d945..a34668daff3 100644 --- a/mysql-test/suite/funcs_1/r/is_columns_is.result +++ b/mysql-test/suite/funcs_1/r/is_columns_is.result @@ -24,6 +24,11 @@ def information_schema CHARACTER_SETS CHARACTER_SET_NAME 1 '' NO varchar 32 96 N def information_schema CHARACTER_SETS DEFAULT_COLLATE_NAME 2 '' NO varchar 32 96 NULL NULL NULL utf8 utf8_general_ci varchar(32) select NEVER NULL def information_schema CHARACTER_SETS DESCRIPTION 3 '' NO varchar 60 180 NULL NULL NULL utf8 utf8_general_ci varchar(60) select NEVER NULL def information_schema CHARACTER_SETS MAXLEN 4 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(3) select NEVER NULL +def information_schema CHECK_CONSTRAINTS CHECK_CLAUSE 5 '' NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) select NEVER NULL +def information_schema CHECK_CONSTRAINTS CONSTRAINT_CATALOG 1 '' NO varchar 512 1536 NULL NULL NULL utf8 utf8_general_ci varchar(512) select NEVER NULL +def information_schema CHECK_CONSTRAINTS CONSTRAINT_NAME 4 '' NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) select NEVER NULL +def information_schema CHECK_CONSTRAINTS CONSTRAINT_SCHEMA 2 '' NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) select NEVER NULL +def information_schema CHECK_CONSTRAINTS TABLE_NAME 3 '' NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) select NEVER NULL def information_schema CLIENT_STATISTICS ACCESS_DENIED 22 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL def information_schema CLIENT_STATISTICS BINLOG_BYTES_WRITTEN 9 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL def information_schema CLIENT_STATISTICS BUSY_TIME 5 0 NO double NULL NULL 21 NULL NULL NULL NULL double select NEVER NULL @@ -554,6 +559,11 @@ COL_CML TABLE_SCHEMA TABLE_NAME COLUMN_NAME DATA_TYPE CHARACTER_MAXIMUM_LENGTH C 3.0000 information_schema CHARACTER_SETS DEFAULT_COLLATE_NAME varchar 32 96 utf8 utf8_general_ci varchar(32) 3.0000 information_schema CHARACTER_SETS DESCRIPTION varchar 60 180 utf8 utf8_general_ci varchar(60) NULL information_schema CHARACTER_SETS MAXLEN bigint NULL NULL NULL NULL bigint(3) +3.0000 information_schema CHECK_CONSTRAINTS CONSTRAINT_CATALOG varchar 512 1536 utf8 utf8_general_ci varchar(512) +3.0000 information_schema CHECK_CONSTRAINTS CONSTRAINT_SCHEMA varchar 64 192 utf8 utf8_general_ci varchar(64) +3.0000 information_schema CHECK_CONSTRAINTS TABLE_NAME varchar 64 192 utf8 utf8_general_ci varchar(64) +3.0000 information_schema CHECK_CONSTRAINTS CONSTRAINT_NAME varchar 64 192 utf8 utf8_general_ci varchar(64) +3.0000 information_schema CHECK_CONSTRAINTS CHECK_CLAUSE varchar 64 192 utf8 utf8_general_ci varchar(64) 3.0000 information_schema CLIENT_STATISTICS CLIENT varchar 64 192 utf8 utf8_general_ci varchar(64) NULL information_schema CLIENT_STATISTICS TOTAL_CONNECTIONS bigint NULL NULL NULL NULL bigint(21) NULL information_schema CLIENT_STATISTICS CONCURRENT_CONNECTIONS bigint NULL NULL NULL NULL bigint(21) diff --git a/mysql-test/suite/funcs_1/r/is_columns_is_embedded.result b/mysql-test/suite/funcs_1/r/is_columns_is_embedded.result index 4e12db06817..ac3130d58b0 100644 --- a/mysql-test/suite/funcs_1/r/is_columns_is_embedded.result +++ b/mysql-test/suite/funcs_1/r/is_columns_is_embedded.result @@ -24,6 +24,11 @@ def information_schema CHARACTER_SETS CHARACTER_SET_NAME 1 '' NO varchar 32 96 N def information_schema CHARACTER_SETS DEFAULT_COLLATE_NAME 2 '' NO varchar 32 96 NULL NULL NULL utf8 utf8_general_ci varchar(32) NEVER NULL def information_schema CHARACTER_SETS DESCRIPTION 3 '' NO varchar 60 180 NULL NULL NULL utf8 utf8_general_ci varchar(60) NEVER NULL def information_schema CHARACTER_SETS MAXLEN 4 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(3) NEVER NULL +def information_schema CHECK_CONSTRAINTS CHECK_CLAUSE 5 '' NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) NEVER NULL +def information_schema CHECK_CONSTRAINTS CONSTRAINT_CATALOG 1 '' NO varchar 512 1536 NULL NULL NULL utf8 utf8_general_ci varchar(512) NEVER NULL +def information_schema CHECK_CONSTRAINTS CONSTRAINT_NAME 4 '' NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) NEVER NULL +def information_schema CHECK_CONSTRAINTS CONSTRAINT_SCHEMA 2 '' NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) NEVER NULL +def information_schema CHECK_CONSTRAINTS TABLE_NAME 3 '' NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) NEVER NULL def information_schema CLIENT_STATISTICS ACCESS_DENIED 22 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL def information_schema CLIENT_STATISTICS BINLOG_BYTES_WRITTEN 9 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL def information_schema CLIENT_STATISTICS BUSY_TIME 5 0 NO double NULL NULL 21 NULL NULL NULL NULL double NEVER NULL @@ -554,6 +559,11 @@ COL_CML TABLE_SCHEMA TABLE_NAME COLUMN_NAME DATA_TYPE CHARACTER_MAXIMUM_LENGTH C 3.0000 information_schema CHARACTER_SETS DEFAULT_COLLATE_NAME varchar 32 96 utf8 utf8_general_ci varchar(32) 3.0000 information_schema CHARACTER_SETS DESCRIPTION varchar 60 180 utf8 utf8_general_ci varchar(60) NULL information_schema CHARACTER_SETS MAXLEN bigint NULL NULL NULL NULL bigint(3) +3.0000 information_schema CHECK_CONSTRAINTS CONSTRAINT_CATALOG varchar 512 1536 utf8 utf8_general_ci varchar(512) +3.0000 information_schema CHECK_CONSTRAINTS CONSTRAINT_SCHEMA varchar 64 192 utf8 utf8_general_ci varchar(64) +3.0000 information_schema CHECK_CONSTRAINTS TABLE_NAME varchar 64 192 utf8 utf8_general_ci varchar(64) +3.0000 information_schema CHECK_CONSTRAINTS CONSTRAINT_NAME varchar 64 192 utf8 utf8_general_ci varchar(64) +3.0000 information_schema CHECK_CONSTRAINTS CHECK_CLAUSE varchar 64 192 utf8 utf8_general_ci varchar(64) 3.0000 information_schema CLIENT_STATISTICS CLIENT varchar 64 192 utf8 utf8_general_ci varchar(64) NULL information_schema CLIENT_STATISTICS TOTAL_CONNECTIONS bigint NULL NULL NULL NULL bigint(21) NULL information_schema CLIENT_STATISTICS CONCURRENT_CONNECTIONS bigint NULL NULL NULL NULL bigint(21) diff --git a/mysql-test/suite/funcs_1/r/is_tables_is.result b/mysql-test/suite/funcs_1/r/is_tables_is.result index 54bc727fb74..9022e057ae5 100644 --- a/mysql-test/suite/funcs_1/r/is_tables_is.result +++ b/mysql-test/suite/funcs_1/r/is_tables_is.result @@ -83,6 +83,29 @@ user_comment Separator ----------------------------------------------------- TABLE_CATALOG def TABLE_SCHEMA information_schema +TABLE_NAME CHECK_CONSTRAINTS +TABLE_TYPE SYSTEM VIEW +ENGINE MEMORY +VERSION 11 +ROW_FORMAT Fixed +TABLE_ROWS #TBLR# +AVG_ROW_LENGTH #ARL# +DATA_LENGTH #DL# +MAX_DATA_LENGTH #MDL# +INDEX_LENGTH #IL# +DATA_FREE #DF# +AUTO_INCREMENT NULL +CREATE_TIME #CRT# +UPDATE_TIME #UT# +CHECK_TIME #CT# +TABLE_COLLATION utf8_general_ci +CHECKSUM NULL +CREATE_OPTIONS #CO# +TABLE_COMMENT #TC# +user_comment +Separator ----------------------------------------------------- +TABLE_CATALOG def +TABLE_SCHEMA information_schema TABLE_NAME CLIENT_STATISTICS TABLE_TYPE SYSTEM VIEW ENGINE MEMORY @@ -1019,6 +1042,29 @@ user_comment Separator ----------------------------------------------------- TABLE_CATALOG def TABLE_SCHEMA information_schema +TABLE_NAME CHECK_CONSTRAINTS +TABLE_TYPE SYSTEM VIEW +ENGINE MEMORY +VERSION 11 +ROW_FORMAT Fixed +TABLE_ROWS #TBLR# +AVG_ROW_LENGTH #ARL# +DATA_LENGTH #DL# +MAX_DATA_LENGTH #MDL# +INDEX_LENGTH #IL# +DATA_FREE #DF# +AUTO_INCREMENT NULL +CREATE_TIME #CRT# +UPDATE_TIME #UT# +CHECK_TIME #CT# +TABLE_COLLATION utf8_general_ci +CHECKSUM NULL +CREATE_OPTIONS #CO# +TABLE_COMMENT #TC# +user_comment +Separator ----------------------------------------------------- +TABLE_CATALOG def +TABLE_SCHEMA information_schema TABLE_NAME CLIENT_STATISTICS TABLE_TYPE SYSTEM VIEW ENGINE MEMORY diff --git a/mysql-test/suite/funcs_1/r/is_tables_is_embedded.result b/mysql-test/suite/funcs_1/r/is_tables_is_embedded.result index 54bc727fb74..9022e057ae5 100644 --- a/mysql-test/suite/funcs_1/r/is_tables_is_embedded.result +++ b/mysql-test/suite/funcs_1/r/is_tables_is_embedded.result @@ -83,6 +83,29 @@ user_comment Separator ----------------------------------------------------- TABLE_CATALOG def TABLE_SCHEMA information_schema +TABLE_NAME CHECK_CONSTRAINTS +TABLE_TYPE SYSTEM VIEW +ENGINE MEMORY +VERSION 11 +ROW_FORMAT Fixed +TABLE_ROWS #TBLR# +AVG_ROW_LENGTH #ARL# +DATA_LENGTH #DL# +MAX_DATA_LENGTH #MDL# +INDEX_LENGTH #IL# +DATA_FREE #DF# +AUTO_INCREMENT NULL +CREATE_TIME #CRT# +UPDATE_TIME #UT# +CHECK_TIME #CT# +TABLE_COLLATION utf8_general_ci +CHECKSUM NULL +CREATE_OPTIONS #CO# +TABLE_COMMENT #TC# +user_comment +Separator ----------------------------------------------------- +TABLE_CATALOG def +TABLE_SCHEMA information_schema TABLE_NAME CLIENT_STATISTICS TABLE_TYPE SYSTEM VIEW ENGINE MEMORY @@ -1019,6 +1042,29 @@ user_comment Separator ----------------------------------------------------- TABLE_CATALOG def TABLE_SCHEMA information_schema +TABLE_NAME CHECK_CONSTRAINTS +TABLE_TYPE SYSTEM VIEW +ENGINE MEMORY +VERSION 11 +ROW_FORMAT Fixed +TABLE_ROWS #TBLR# +AVG_ROW_LENGTH #ARL# +DATA_LENGTH #DL# +MAX_DATA_LENGTH #MDL# +INDEX_LENGTH #IL# +DATA_FREE #DF# +AUTO_INCREMENT NULL +CREATE_TIME #CRT# +UPDATE_TIME #UT# +CHECK_TIME #CT# +TABLE_COLLATION utf8_general_ci +CHECKSUM NULL +CREATE_OPTIONS #CO# +TABLE_COMMENT #TC# +user_comment +Separator ----------------------------------------------------- +TABLE_CATALOG def +TABLE_SCHEMA information_schema TABLE_NAME CLIENT_STATISTICS TABLE_TYPE SYSTEM VIEW ENGINE MEMORY diff --git a/mysql-test/suite/funcs_1/t/is_check_constraint.test b/mysql-test/suite/funcs_1/t/is_check_constraint.test new file mode 100644 index 00000000000..116ac3f4ab1 --- /dev/null +++ b/mysql-test/suite/funcs_1/t/is_check_constraint.test @@ -0,0 +1,91 @@ +--source include/have_innodb.inc +--echo # +--echo # MDEV-17323: Backport INFORMATION_SCHEMA.CHECK_CONSTRAINTS to 10.2 +--echo # +CREATE user boo1; +GRANT select,create,alter,drop on foo.* to boo1; +SHOW GRANTS for boo1; +CREATE user boo2; +create database foo; +# Connect with user boo1 +CONNECT(con1,localhost, boo1,, foo); + +SET check_constraint_checks=1; +CREATE TABLE t0 +( + t int, check (t>32) # table constraint +) ENGINE=myisam; +--sorted_result +SELECT * from information_schema.check_constraints; + +ALTER TABLE t0 +ADD CONSTRAINT CHK_t0_t CHECK(t<100); +--sorted_result +SELECT * from information_schema.check_constraints; + +ALTER TABLE t0 +DROP CONSTRAINT CHK_t0_t; +--sorted_result +SELECT * from information_schema.check_constraints; + +ALTER TABLE t0 +ADD CONSTRAINT CHECK(t<50); +--sorted_result +SELECT * from information_schema.check_constraints; + +CREATE TABLE t1 +( t int CHECK(t>2), # field constraint + tt int, + CONSTRAINT CHECK (tt > 32), CONSTRAINT CHECK (tt <50),# autogenerated names table constraints + CONSTRAINT CHK_tt CHECK(tt<100) # named table constraint +) ENGINE=InnoDB; + --sorted_result +SELECT * from information_schema.check_constraints; + +ALTER TABLE t1 +DROP CONSTRAINT CHK_tt; +--sorted_result +SELECT * from information_schema.check_constraints; + +CREATE TABLE t2 +( +name VARCHAR(30) CHECK(CHAR_LENGTH(name)>2), #field constraint +start_date DATE, +end_date DATE, +CONSTRAINT CHK_dates CHECK(start_date IS NULL) #table constraint +)ENGINE=Innodb; + --sorted_result +SELECT * from information_schema.check_constraints; + +ALTER TABLE t1 +ADD CONSTRAINT CHK_new_ CHECK(t>tt); +--sorted_result +SELECT * from information_schema.check_constraints; + +# Create table with same field and table check constraint name +CREATE TABLE t3 +( +a int, +b int check (b>0), # field constraint named 'b' +CONSTRAINT b check (b>10) # table constraint +) ENGINE=InnoDB; + --sorted_result +SELECT * from information_schema.check_constraints; + +DISCONNECT con1; +CONNECT(con2, localhost, boo2,, test); + --sorted_result +SELECT * from information_schema.check_constraints; + +DISCONNECT con2; +CONNECT(con1, localhost, boo1,,foo); +DROP TABLE t0; +DROP TABLE t1; +DROP TABLE t2; +DROP TABLE t3; +DROP DATABASE foo; + +DISCONNECT con1; +--CONNECTION default +DROP USER boo1; +DROP USER boo2; diff --git a/sql/handler.h b/sql/handler.h index 8569cd53410..284fed7cd7e 100644 --- a/sql/handler.h +++ b/sql/handler.h @@ -727,6 +727,7 @@ enum enum_schema_tables SCH_ALL_PLUGINS, SCH_APPLICABLE_ROLES, SCH_CHARSETS, + SCH_CHECK_CONSTRAINTS, SCH_COLLATIONS, SCH_COLLATION_CHARACTER_SET_APPLICABILITY, SCH_COLUMNS, diff --git a/sql/sql_show.cc b/sql/sql_show.cc index fe5454f1051..39763451dfb 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -6468,6 +6468,40 @@ bool store_constraints(THD *thd, TABLE *table, LEX_STRING *db_name, return schema_table_store_record(thd, table); } +static int get_check_constraints_record(THD *thd, TABLE_LIST *tables, + TABLE *table, bool res, + LEX_STRING *db_name, + LEX_STRING *table_name) +{ + DBUG_ENTER("get_check_constraints_record"); + if(res) + { + if (thd->is_error()) + push_warning(thd, Sql_condition::WARN_LEVEL_WARN, + thd->get_stmt_da()->sql_errno(), + thd->get_stmt_da()->message()); + thd->clear_error(); + DBUG_RETURN(0); + } + if(!tables->view) + { + StringBuffer str(system_charset_info); + for (uint i= 0; i < tables->table->s->table_check_constraints; i++) + { + Virtual_column_info *check= tables->table->check_constraints[i]; + table->field[0]->store(STRING_WITH_LEN("def"), system_charset_info); + table->field[3]->store(check->name.str, check->name.length, + system_charset_info); + str.length(0); + check->print(&str); + table->field[4]->store(str.ptr(), str.length(), system_charset_info); + if (schema_table_store_record(thd, table)) + DBUG_RETURN(1); + } + } + + DBUG_RETURN(0); +} static int get_schema_constraints_record(THD *thd, TABLE_LIST *tables, TABLE *table, bool res, @@ -9283,6 +9317,15 @@ ST_FIELD_INFO spatial_ref_sys_fields_info[]= }; #endif /*HAVE_SPATIAL*/ +ST_FIELD_INFO check_constraints_fields_info[]= +{ + {"CONSTRAINT_CATALOG", FN_REFLEN, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FULL_TABLE}, + {"CONSTRAINT_SCHEMA", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FULL_TABLE}, + {"TABLE_NAME", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FULL_TABLE}, + {"CONSTRAINT_NAME", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FULL_TABLE}, + {"CHECK_CLAUSE", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FULL_TABLE}, + {0, 0, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE } +}; /* Description of ST_FIELD_INFO in table.h @@ -9299,6 +9342,8 @@ ST_SCHEMA_TABLE schema_tables[]= fill_schema_applicable_roles, 0, 0, -1, -1, 0, 0}, {"CHARACTER_SETS", charsets_fields_info, 0, fill_schema_charsets, make_character_sets_old_format, 0, -1, -1, 0, 0}, + {"CHECK_CONSTRAINTS", check_constraints_fields_info, 0, get_all_tables, 0, + get_check_constraints_record, 1, 2, 0, OPTIMIZE_I_S_TABLE|OPEN_TABLE_ONLY}, {"COLLATIONS", collation_fields_info, 0, fill_schema_collation, make_old_format, 0, -1, -1, 0, 0}, {"COLLATION_CHARACTER_SET_APPLICABILITY", coll_charset_app_fields_info, From f3e9d9a6e6b2614bf5d57ccf9434c980e4a90424 Mon Sep 17 00:00:00 2001 From: Anel Husakovic Date: Fri, 12 Oct 2018 01:43:12 -0700 Subject: [PATCH 12/18] Change information_schema-big to include innodb --- mysql-test/r/information_schema-big.result | 4 ++-- mysql-test/t/information_schema-big.test | 8 +------- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/mysql-test/r/information_schema-big.result b/mysql-test/r/information_schema-big.result index 112d4842e42..d4aa6deb2e2 100644 --- a/mysql-test/r/information_schema-big.result +++ b/mysql-test/r/information_schema-big.result @@ -1,5 +1,3 @@ -DROP TABLE IF EXISTS t0,t1,t2,t3,t4,t5; -DROP VIEW IF EXISTS v1; # # Bug#18925: subqueries with MIN/MAX functions on INFORMATION_SCHEMA # @@ -22,6 +20,7 @@ table_name column_name ALL_PLUGINS PLUGIN_NAME APPLICABLE_ROLES GRANTEE CHARACTER_SETS CHARACTER_SET_NAME +CHECK_CONSTRAINTS CONSTRAINT_SCHEMA CLIENT_STATISTICS CLIENT COLLATIONS COLLATION_NAME COLLATION_CHARACTER_SET_APPLICABILITY COLLATION_NAME @@ -79,6 +78,7 @@ table_name column_name ALL_PLUGINS PLUGIN_NAME APPLICABLE_ROLES GRANTEE CHARACTER_SETS CHARACTER_SET_NAME +CHECK_CONSTRAINTS CONSTRAINT_SCHEMA CLIENT_STATISTICS CLIENT COLLATIONS COLLATION_NAME COLLATION_CHARACTER_SET_APPLICABILITY COLLATION_NAME diff --git a/mysql-test/t/information_schema-big.test b/mysql-test/t/information_schema-big.test index 717c22f8f6a..9212348649e 100644 --- a/mysql-test/t/information_schema-big.test +++ b/mysql-test/t/information_schema-big.test @@ -1,18 +1,12 @@ # This test uses grants, which can't get tested for embedded server -- source include/big_test.inc -- source include/not_embedded.inc --- source include/have_xtradb.inc +-- source include/have_innodb.inc # check that CSV engine was compiled in, as the result of the test depends # on the presence of the log tables (which are CSV-based). --source include/have_csv.inc ---disable_warnings -DROP TABLE IF EXISTS t0,t1,t2,t3,t4,t5; -DROP VIEW IF EXISTS v1; ---enable_warnings - - --echo # --echo # Bug#18925: subqueries with MIN/MAX functions on INFORMATION_SCHEMA --echo # From db469b6907a02b1441b16eac1d464673f48f9ef4 Mon Sep 17 00:00:00 2001 From: Oleksandr Byelkin Date: Fri, 11 Jan 2019 11:55:07 +0100 Subject: [PATCH 13/18] MDEV-17475: Increase maximum possible value for table_definition_cache to match table_open_cache Allow table definition cache be bigger than open table cache (due to problem with VIEWs and prepared statements). --- .../r/table_definition_cache_basic.result | 16 ++++++++-------- .../sys_vars/t/table_definition_cache_basic.test | 6 +++--- sql/sys_vars.cc | 8 ++++++-- 3 files changed, 17 insertions(+), 13 deletions(-) diff --git a/mysql-test/suite/sys_vars/r/table_definition_cache_basic.result b/mysql-test/suite/sys_vars/r/table_definition_cache_basic.result index f6befe51bc1..f7ce3f53bfc 100644 --- a/mysql-test/suite/sys_vars/r/table_definition_cache_basic.result +++ b/mysql-test/suite/sys_vars/r/table_definition_cache_basic.result @@ -28,14 +28,14 @@ Warning 1292 Truncated incorrect table_definition_cache value: '2' SELECT @@global.table_definition_cache; @@global.table_definition_cache 400 -SET @@global.table_definition_cache = 524287; +SET @@global.table_definition_cache = 2097151; SELECT @@global.table_definition_cache; @@global.table_definition_cache -524287 -SET @@global.table_definition_cache = 524288; +2097151 +SET @@global.table_definition_cache = 2097152; SELECT @@global.table_definition_cache; @@global.table_definition_cache -524288 +2097152 '#--------------------FN_DYNVARS_019_04-------------------------#' SET @@global.table_definition_cache = 0; Warnings: @@ -49,18 +49,18 @@ Warning 1292 Truncated incorrect table_definition_cache value: '-1024' SELECT @@global.table_definition_cache; @@global.table_definition_cache 400 -SET @@global.table_definition_cache = 524289; +SET @@global.table_definition_cache = 2097153; Warnings: -Warning 1292 Truncated incorrect table_definition_cache value: '524289' +Warning 1292 Truncated incorrect table_definition_cache value: '2097153' SELECT @@global.table_definition_cache; @@global.table_definition_cache -524288 +2097152 SET @@global.table_definition_cache = 42949672950; Warnings: Warning 1292 Truncated incorrect table_definition_cache value: '42949672950' SELECT @@global.table_definition_cache; @@global.table_definition_cache -524288 +2097152 SET @@global.table_definition_cache = 21221204.10; ERROR 42000: Incorrect argument type to variable 'table_definition_cache' SET @@global.table_definition_cache = ON; diff --git a/mysql-test/suite/sys_vars/t/table_definition_cache_basic.test b/mysql-test/suite/sys_vars/t/table_definition_cache_basic.test index 69f29108645..183d1d0316e 100644 --- a/mysql-test/suite/sys_vars/t/table_definition_cache_basic.test +++ b/mysql-test/suite/sys_vars/t/table_definition_cache_basic.test @@ -64,9 +64,9 @@ SET @@global.table_definition_cache = 1; SELECT @@global.table_definition_cache; SET @@global.table_definition_cache = 2; SELECT @@global.table_definition_cache; -SET @@global.table_definition_cache = 524287; +SET @@global.table_definition_cache = 2097151; SELECT @@global.table_definition_cache; -SET @@global.table_definition_cache = 524288; +SET @@global.table_definition_cache = 2097152; SELECT @@global.table_definition_cache; @@ -79,7 +79,7 @@ SET @@global.table_definition_cache = 0; SELECT @@global.table_definition_cache; SET @@global.table_definition_cache = -1024; SELECT @@global.table_definition_cache; -SET @@global.table_definition_cache = 524289; +SET @@global.table_definition_cache = 2097153; SELECT @@global.table_definition_cache; SET @@global.table_definition_cache = 42949672950; SELECT @@global.table_definition_cache; diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc index a21fe5df247..71fdfa8f219 100644 --- a/sql/sys_vars.cc +++ b/sql/sys_vars.cc @@ -3039,11 +3039,15 @@ static Sys_var_charptr Sys_system_time_zone( NO_CMD_LINE, IN_SYSTEM_CHARSET, DEFAULT(system_time_zone)); +/* + If One use views with prepared statements this should be bigger than + table_open_cache (now we allow 2 times bigger value) +*/ static Sys_var_ulong Sys_table_def_size( "table_definition_cache", "The number of cached table definitions", GLOBAL_VAR(tdc_size), CMD_LINE(REQUIRED_ARG), - VALID_RANGE(TABLE_DEF_CACHE_MIN, 512*1024), + VALID_RANGE(TABLE_DEF_CACHE_MIN, 2*1024*1024), DEFAULT(TABLE_DEF_CACHE_DEFAULT), BLOCK_SIZE(1)); @@ -3055,7 +3059,7 @@ static bool fix_table_open_cache(sys_var *, THD *, enum_var_type) return false; } - +/* Check the table_definition_cache comment if makes changes */ 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), From 038785e1f898db74f6486fe7b9209d842c76308b Mon Sep 17 00:00:00 2001 From: Thirunarayanan Balathandayuthapani Date: Wed, 16 Jan 2019 23:02:39 +0530 Subject: [PATCH 14/18] MDEV-18183 Server startup fails while dropping garbage encrypted tablespace - There is no need to wait for crypt thread to stop accessing space while dropping the garbage encrypted tablespace during recover. --- storage/innobase/fil/fil0crypt.cc | 3 ++- storage/xtradb/fil/fil0crypt.cc | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/storage/innobase/fil/fil0crypt.cc b/storage/innobase/fil/fil0crypt.cc index 03cfa8d9fbc..ded17736177 100644 --- a/storage/innobase/fil/fil0crypt.cc +++ b/storage/innobase/fil/fil0crypt.cc @@ -2413,7 +2413,8 @@ void fil_space_crypt_close_tablespace( const fil_space_t* space) { - if (!srv_encrypt_tables || !space->crypt_data) { + if (!srv_encrypt_tables || !space->crypt_data + || srv_n_fil_crypt_threads == 0) { return; } diff --git a/storage/xtradb/fil/fil0crypt.cc b/storage/xtradb/fil/fil0crypt.cc index 03cfa8d9fbc..ded17736177 100644 --- a/storage/xtradb/fil/fil0crypt.cc +++ b/storage/xtradb/fil/fil0crypt.cc @@ -2413,7 +2413,8 @@ void fil_space_crypt_close_tablespace( const fil_space_t* space) { - if (!srv_encrypt_tables || !space->crypt_data) { + if (!srv_encrypt_tables || !space->crypt_data + || srv_n_fil_crypt_threads == 0) { return; } From 19a7656fb12bfae7472658056f400bb81ab99c2f Mon Sep 17 00:00:00 2001 From: Daniel Black Date: Mon, 21 May 2018 10:42:44 +1000 Subject: [PATCH 15/18] safemalloc: warn, flush after fprintf Corrects 94d722b6a43b86ee760f07915921cf58f9869a5d --- mysys/safemalloc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mysys/safemalloc.c b/mysys/safemalloc.c index 5d19647c989..08e43d0a80a 100644 --- a/mysys/safemalloc.c +++ b/mysys/safemalloc.c @@ -282,8 +282,8 @@ static void warn(const char *format,...) va_list args; DBUG_PRINT("error", ("%s", format)); va_start(args,format); - fflush(stderr); vfprintf(stderr, format, args); + fflush(stderr); va_end(args); #ifdef HAVE_BACKTRACE From a84be48e005ff5b77afca0d71ce3e4e851c87796 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Thu, 17 Jan 2019 09:39:20 +0200 Subject: [PATCH 16/18] Update ,32bit.rdiff --- .../r/sysvars_server_embedded,32bit.rdiff | 265 +++++++++-------- .../r/sysvars_server_notembedded,32bit.rdiff | 273 +++++++++--------- 2 files changed, 264 insertions(+), 274 deletions(-) diff --git a/mysql-test/suite/sys_vars/r/sysvars_server_embedded,32bit.rdiff b/mysql-test/suite/sys_vars/r/sysvars_server_embedded,32bit.rdiff index 0569b2755d5..d5d41e3a2a6 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_server_embedded,32bit.rdiff +++ b/mysql-test/suite/sys_vars/r/sysvars_server_embedded,32bit.rdiff @@ -89,7 +89,7 @@ VARIABLE_COMMENT The number of seconds the mysqld server is waiting for a connect packet before responding with 'Bad handshake' NUMERIC_MIN_VALUE 2 NUMERIC_MAX_VALUE 31536000 -@@ -519,7 +519,7 @@ +@@ -533,7 +533,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 15 VARIABLE_SCOPE SESSION @@ -98,7 +98,7 @@ VARIABLE_COMMENT Long search depth for the two-step deadlock detection NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 33 -@@ -533,7 +533,7 @@ +@@ -547,7 +547,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 4 VARIABLE_SCOPE SESSION @@ -107,7 +107,7 @@ VARIABLE_COMMENT Short search depth for the two-step deadlock detection NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 32 -@@ -547,7 +547,7 @@ +@@ -561,7 +561,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 50000000 VARIABLE_SCOPE SESSION @@ -116,7 +116,7 @@ VARIABLE_COMMENT Long timeout for the two-step deadlock detection (in microseconds) NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 4294967295 -@@ -561,7 +561,7 @@ +@@ -575,7 +575,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 10000 VARIABLE_SCOPE SESSION @@ -125,7 +125,7 @@ VARIABLE_COMMENT Short timeout for the two-step deadlock detection (in microseconds) NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 4294967295 -@@ -617,7 +617,7 @@ +@@ -631,7 +631,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 0 VARIABLE_SCOPE SESSION @@ -134,7 +134,7 @@ VARIABLE_COMMENT The default week format used by WEEK() functions NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 7 -@@ -631,7 +631,7 @@ +@@ -645,7 +645,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 100 VARIABLE_SCOPE GLOBAL @@ -143,7 +143,7 @@ VARIABLE_COMMENT After inserting delayed_insert_limit rows, the INSERT DELAYED handler will check if there are any SELECT statements pending. If so, it allows these to execute before continuing. NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 4294967295 -@@ -645,7 +645,7 @@ +@@ -659,7 +659,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 300 VARIABLE_SCOPE GLOBAL @@ -152,7 +152,7 @@ VARIABLE_COMMENT How long a INSERT DELAYED thread should wait for INSERT statements before terminating NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 31536000 -@@ -659,7 +659,7 @@ +@@ -673,7 +673,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 1000 VARIABLE_SCOPE GLOBAL @@ -161,7 +161,7 @@ VARIABLE_COMMENT What size queue (in rows) should be allocated for handling INSERT DELAYED. If the queue becomes full, any client that does INSERT DELAYED will wait until there is room in the queue again NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 4294967295 -@@ -687,7 +687,7 @@ +@@ -701,7 +701,7 @@ GLOBAL_VALUE_ORIGIN SQL DEFAULT_VALUE 4 VARIABLE_SCOPE SESSION @@ -170,7 +170,7 @@ VARIABLE_COMMENT Precision of the result of '/' operator will be increased on that value NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 30 -@@ -785,7 +785,7 @@ +@@ -799,7 +799,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 0 VARIABLE_SCOPE GLOBAL @@ -179,7 +179,7 @@ VARIABLE_COMMENT If non-zero, binary logs will be purged after expire_logs_days days; possible purges happen at startup and at binary log rotation NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 99 -@@ -827,7 +827,7 @@ +@@ -841,7 +841,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 1 VARIABLE_SCOPE GLOBAL @@ -188,7 +188,7 @@ VARIABLE_COMMENT The number of connections on extra-port NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 100000 -@@ -869,7 +869,7 @@ +@@ -883,7 +883,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 0 VARIABLE_SCOPE GLOBAL @@ -197,7 +197,7 @@ VARIABLE_COMMENT A dedicated thread is created to flush all tables at the given interval NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 31536000 -@@ -911,7 +911,7 @@ +@@ -925,7 +925,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 84 VARIABLE_SCOPE GLOBAL @@ -206,7 +206,7 @@ VARIABLE_COMMENT The maximum length of the word to be included in a FULLTEXT index. Note: FULLTEXT indexes must be rebuilt after changing this variable NUMERIC_MIN_VALUE 10 NUMERIC_MAX_VALUE 84 -@@ -925,7 +925,7 @@ +@@ -939,7 +939,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 4 VARIABLE_SCOPE GLOBAL @@ -215,7 +215,7 @@ VARIABLE_COMMENT The minimum length of the word to be included in a FULLTEXT index. Note: FULLTEXT indexes must be rebuilt after changing this variable NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 84 -@@ -939,7 +939,7 @@ +@@ -953,7 +953,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 20 VARIABLE_SCOPE GLOBAL @@ -224,7 +224,7 @@ VARIABLE_COMMENT Number of best matches to use for query expansion NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 1000 -@@ -998,7 +998,7 @@ +@@ -1012,7 +1012,7 @@ VARIABLE_TYPE BIGINT UNSIGNED VARIABLE_COMMENT The maximum length of the result of function GROUP_CONCAT() NUMERIC_MIN_VALUE 4 @@ -233,7 +233,7 @@ NUMERIC_BLOCK_SIZE 1 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -1149,7 +1149,7 @@ +@@ -1163,7 +1163,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 0 VARIABLE_SCOPE SESSION @@ -242,7 +242,7 @@ VARIABLE_COMMENT Number of bytes used for a histogram. If set to 0, no histograms are created by ANALYZE. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 255 -@@ -1177,7 +1177,7 @@ +@@ -1191,7 +1191,7 @@ GLOBAL_VALUE_ORIGIN AUTO DEFAULT_VALUE 128 VARIABLE_SCOPE GLOBAL @@ -251,7 +251,7 @@ VARIABLE_COMMENT How many host names should be cached to avoid resolving. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 65536 -@@ -1289,7 +1289,7 @@ +@@ -1303,7 +1303,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 28800 VARIABLE_SCOPE SESSION @@ -260,7 +260,7 @@ VARIABLE_COMMENT The number of seconds the server waits for activity on an interactive connection before closing it NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 31536000 -@@ -1320,7 +1320,7 @@ +@@ -1334,7 +1334,7 @@ VARIABLE_TYPE BIGINT UNSIGNED VARIABLE_COMMENT The size of the buffer that is used for joins NUMERIC_MIN_VALUE 128 @@ -269,7 +269,7 @@ NUMERIC_BLOCK_SIZE 128 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -1345,7 +1345,7 @@ +@@ -1359,7 +1359,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 2 VARIABLE_SCOPE SESSION @@ -278,7 +278,7 @@ VARIABLE_COMMENT Controls what join operations can be executed with join buffers. Odd numbers are used for plain join buffers while even numbers are used for linked buffers NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 8 -@@ -1376,7 +1376,7 @@ +@@ -1390,7 +1390,7 @@ VARIABLE_TYPE BIGINT UNSIGNED VARIABLE_COMMENT The size of the buffer used for index blocks for MyISAM tables. Increase this to get better index handling (for all reads and multiple writes) to as much as you can afford NUMERIC_MIN_VALUE 0 @@ -287,7 +287,7 @@ NUMERIC_BLOCK_SIZE 4096 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -1583,7 +1583,7 @@ +@@ -1597,7 +1597,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 31536000 VARIABLE_SCOPE SESSION @@ -296,7 +296,7 @@ VARIABLE_COMMENT Timeout in seconds to wait for a lock before returning an error. NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 31536000 -@@ -1695,7 +1695,7 @@ +@@ -1709,7 +1709,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 1 VARIABLE_SCOPE SESSION @@ -305,7 +305,7 @@ VARIABLE_COMMENT Write to slow log every #th slow query. Set to 1 to log everything. Increase it to reduce the size of the slow or the performance impact of slow logging NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 4294967295 -@@ -1737,7 +1737,7 @@ +@@ -1751,7 +1751,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 1 VARIABLE_SCOPE SESSION @@ -314,7 +314,7 @@ VARIABLE_COMMENT Log some not critical warnings to the general log file.Value can be between 0 and 11. Higher values mean more verbosity NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 4294967295 -@@ -1779,7 +1779,7 @@ +@@ -1793,7 +1793,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 4194304 VARIABLE_SCOPE SESSION @@ -323,7 +323,7 @@ VARIABLE_COMMENT Max packet length to send to or receive from the server NUMERIC_MIN_VALUE 1024 NUMERIC_MAX_VALUE 1073741824 -@@ -1789,14 +1789,14 @@ +@@ -1803,14 +1803,14 @@ COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME MAX_BINLOG_CACHE_SIZE SESSION_VALUE NULL @@ -341,7 +341,7 @@ NUMERIC_BLOCK_SIZE 4096 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -1807,7 +1807,7 @@ +@@ -1821,7 +1821,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 1073741824 VARIABLE_SCOPE GLOBAL @@ -350,7 +350,7 @@ VARIABLE_COMMENT Binary log will be rotated automatically when the size exceeds this value. NUMERIC_MIN_VALUE 4096 NUMERIC_MAX_VALUE 1073741824 -@@ -1817,14 +1817,14 @@ +@@ -1831,14 +1831,14 @@ COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME MAX_BINLOG_STMT_CACHE_SIZE SESSION_VALUE NULL @@ -368,16 +368,16 @@ NUMERIC_BLOCK_SIZE 4096 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -1835,7 +1835,7 @@ +@@ -1849,7 +1849,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 151 VARIABLE_SCOPE GLOBAL -VARIABLE_TYPE BIGINT UNSIGNED +VARIABLE_TYPE INT UNSIGNED VARIABLE_COMMENT The number of simultaneous clients allowed - NUMERIC_MIN_VALUE 1 + NUMERIC_MIN_VALUE 10 NUMERIC_MAX_VALUE 100000 -@@ -1849,7 +1849,7 @@ +@@ -1863,7 +1863,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 100 VARIABLE_SCOPE GLOBAL @@ -386,7 +386,7 @@ VARIABLE_COMMENT If there is more than this number of interrupted connections from a host this host will be blocked from further connections NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 4294967295 -@@ -1863,7 +1863,7 @@ +@@ -1877,7 +1877,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 20 VARIABLE_SCOPE SESSION @@ -395,7 +395,7 @@ VARIABLE_COMMENT Don't start more than this number of threads to handle INSERT DELAYED statements. If set to zero INSERT DELAYED will be not used NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 16384 -@@ -1891,7 +1891,7 @@ +@@ -1905,7 +1905,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 64 VARIABLE_SCOPE SESSION @@ -404,7 +404,7 @@ VARIABLE_COMMENT Max number of errors/warnings to store for a statement NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 65535 -@@ -1908,7 +1908,7 @@ +@@ -1922,7 +1922,7 @@ VARIABLE_TYPE BIGINT UNSIGNED VARIABLE_COMMENT Don't allow creation of heap tables bigger than this NUMERIC_MIN_VALUE 16384 @@ -413,7 +413,7 @@ NUMERIC_BLOCK_SIZE 1024 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -1919,7 +1919,7 @@ +@@ -1933,7 +1933,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 20 VARIABLE_SCOPE SESSION @@ -422,7 +422,7 @@ VARIABLE_COMMENT Don't start more than this number of threads to handle INSERT DELAYED statements. If set to zero INSERT DELAYED will be not used NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 16384 -@@ -1947,7 +1947,7 @@ +@@ -1961,7 +1961,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 1024 VARIABLE_SCOPE SESSION @@ -431,7 +431,7 @@ VARIABLE_COMMENT Max number of bytes in sorted records NUMERIC_MIN_VALUE 4 NUMERIC_MAX_VALUE 8388608 -@@ -1961,7 +1961,7 @@ +@@ -1975,7 +1975,7 @@ GLOBAL_VALUE_ORIGIN AUTO DEFAULT_VALUE 1048576 VARIABLE_SCOPE GLOBAL @@ -440,16 +440,7 @@ VARIABLE_COMMENT The maximum BLOB length to send to server from mysql_send_long_data API. Deprecated option; use max_allowed_packet instead. NUMERIC_MIN_VALUE 1024 NUMERIC_MAX_VALUE 4294967295 -@@ -1975,7 +1975,7 @@ - GLOBAL_VALUE_ORIGIN COMPILE-TIME - DEFAULT_VALUE 16382 - VARIABLE_SCOPE GLOBAL --VARIABLE_TYPE BIGINT UNSIGNED -+VARIABLE_TYPE INT UNSIGNED - VARIABLE_COMMENT Maximum number of prepared statements in the server - NUMERIC_MIN_VALUE 0 - NUMERIC_MAX_VALUE 1048576 -@@ -1989,7 +1989,7 @@ +@@ -2003,7 +2003,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 4294967295 VARIABLE_SCOPE SESSION @@ -458,7 +449,7 @@ VARIABLE_COMMENT Limit assumed max number of seeks when looking up rows based on a key NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 4294967295 -@@ -2017,7 +2017,7 @@ +@@ -2031,7 +2031,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 1024 VARIABLE_SCOPE SESSION @@ -467,7 +458,7 @@ VARIABLE_COMMENT The number of bytes to use when sorting BLOB or TEXT values (only the first max_sort_length bytes of each value are used; the rest are ignored) NUMERIC_MIN_VALUE 4 NUMERIC_MAX_VALUE 8388608 -@@ -2031,7 +2031,7 @@ +@@ -2045,7 +2045,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 0 VARIABLE_SCOPE SESSION @@ -476,7 +467,7 @@ VARIABLE_COMMENT Maximum stored procedure recursion depth NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 255 -@@ -2059,7 +2059,7 @@ +@@ -2073,7 +2073,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 32 VARIABLE_SCOPE SESSION @@ -485,7 +476,7 @@ VARIABLE_COMMENT Unused, will be removed. NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 4294967295 -@@ -2087,7 +2087,7 @@ +@@ -2101,7 +2101,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 4294967295 VARIABLE_SCOPE GLOBAL @@ -494,7 +485,7 @@ VARIABLE_COMMENT After this many write locks, allow some read locks to run in between NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 4294967295 -@@ -2101,7 +2101,7 @@ +@@ -2115,7 +2115,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 1024 VARIABLE_SCOPE GLOBAL @@ -503,7 +494,7 @@ VARIABLE_COMMENT Unused NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 1048576 -@@ -2115,7 +2115,7 @@ +@@ -2129,7 +2129,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 8 VARIABLE_SCOPE GLOBAL @@ -512,7 +503,7 @@ VARIABLE_COMMENT Unused NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 1024 -@@ -2129,7 +2129,7 @@ +@@ -2143,7 +2143,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 0 VARIABLE_SCOPE SESSION @@ -521,7 +512,7 @@ VARIABLE_COMMENT Don't write queries to slow log that examine fewer rows than that NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 4294967295 -@@ -2143,7 +2143,7 @@ +@@ -2157,7 +2157,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 262144 VARIABLE_SCOPE SESSION @@ -530,7 +521,7 @@ VARIABLE_COMMENT Size of buffer to use when using MRR with range access NUMERIC_MIN_VALUE 8192 NUMERIC_MAX_VALUE 2147483647 -@@ -2157,10 +2157,10 @@ +@@ -2171,10 +2171,10 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 256 VARIABLE_SCOPE SESSION @@ -543,7 +534,7 @@ NUMERIC_BLOCK_SIZE 1 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -2171,7 +2171,7 @@ +@@ -2185,7 +2185,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 1024 VARIABLE_SCOPE GLOBAL @@ -552,7 +543,7 @@ VARIABLE_COMMENT Block size to be used for MyISAM index pages NUMERIC_MIN_VALUE 1024 NUMERIC_MAX_VALUE 16384 -@@ -2185,7 +2185,7 @@ +@@ -2199,7 +2199,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 6 VARIABLE_SCOPE GLOBAL @@ -561,7 +552,7 @@ VARIABLE_COMMENT Default pointer size to be used for MyISAM tables NUMERIC_MIN_VALUE 2 NUMERIC_MAX_VALUE 7 -@@ -2195,9 +2195,9 @@ +@@ -2209,9 +2209,9 @@ COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME MYISAM_MAX_SORT_FILE_SIZE SESSION_VALUE NULL @@ -573,7 +564,7 @@ VARIABLE_SCOPE GLOBAL VARIABLE_TYPE BIGINT UNSIGNED VARIABLE_COMMENT Don't use the fast sort index method to created index if the temporary file would get bigger than this -@@ -2209,14 +2209,14 @@ +@@ -2223,14 +2223,14 @@ COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME MYISAM_MMAP_SIZE SESSION_VALUE NULL @@ -591,7 +582,7 @@ NUMERIC_BLOCK_SIZE 1 ENUM_VALUE_LIST NULL READ_ONLY YES -@@ -2241,10 +2241,10 @@ +@@ -2255,10 +2255,10 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 1 VARIABLE_SCOPE SESSION @@ -604,7 +595,7 @@ NUMERIC_BLOCK_SIZE 1 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -2258,7 +2258,7 @@ +@@ -2272,7 +2272,7 @@ VARIABLE_TYPE BIGINT UNSIGNED VARIABLE_COMMENT The buffer that is allocated when sorting the index when doing a REPAIR or when creating indexes with CREATE INDEX or ALTER TABLE NUMERIC_MIN_VALUE 4096 @@ -613,7 +604,7 @@ NUMERIC_BLOCK_SIZE 1 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -2311,7 +2311,7 @@ +@@ -2325,7 +2325,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 16384 VARIABLE_SCOPE SESSION @@ -622,7 +613,7 @@ VARIABLE_COMMENT Buffer length for TCP/IP and socket communication NUMERIC_MIN_VALUE 1024 NUMERIC_MAX_VALUE 1048576 -@@ -2325,7 +2325,7 @@ +@@ -2339,7 +2339,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 30 VARIABLE_SCOPE SESSION @@ -631,7 +622,7 @@ VARIABLE_COMMENT Number of seconds to wait for more data from a connection before aborting the read NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 31536000 -@@ -2339,7 +2339,7 @@ +@@ -2353,7 +2353,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 10 VARIABLE_SCOPE SESSION @@ -640,7 +631,7 @@ VARIABLE_COMMENT If a read on a communication port is interrupted, retry this many times before giving up NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 4294967295 -@@ -2353,7 +2353,7 @@ +@@ -2367,7 +2367,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 60 VARIABLE_SCOPE SESSION @@ -649,7 +640,7 @@ VARIABLE_COMMENT Number of seconds to wait for a block to be written to a connection before aborting the write NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 31536000 -@@ -2423,7 +2423,7 @@ +@@ -2437,7 +2437,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 1 VARIABLE_SCOPE SESSION @@ -658,7 +649,7 @@ VARIABLE_COMMENT Controls the heuristic(s) applied during query optimization to prune less-promising partial plans from the optimizer search space. Meaning: 0 - do not apply any heuristic, thus perform exhaustive search; 1 - prune plans based on number of retrieved rows NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 1 -@@ -2437,7 +2437,7 @@ +@@ -2451,7 +2451,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 62 VARIABLE_SCOPE SESSION @@ -667,7 +658,7 @@ VARIABLE_COMMENT Maximum depth of search performed by the query optimizer. Values larger than the number of relations in a query result in better query plans, but take longer to compile a query. Values smaller than the number of tables in a relation result in faster optimization, but may produce very bad query plans. If set to 0, the system will automatically pick a reasonable value; if set to 63, the optimizer will switch to the original find_best search. NOTE: The value 63 and its associated behaviour is deprecated. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 63 -@@ -2451,7 +2451,7 @@ +@@ -2465,7 +2465,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 100 VARIABLE_SCOPE SESSION @@ -676,7 +667,7 @@ VARIABLE_COMMENT Controls number of record samples to check condition selectivity NUMERIC_MIN_VALUE 10 NUMERIC_MAX_VALUE 4294967295 -@@ -2479,7 +2479,7 @@ +@@ -2493,7 +2493,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 1 VARIABLE_SCOPE SESSION @@ -685,7 +676,7 @@ VARIABLE_COMMENT Controls selectivity of which conditions the optimizer takes into account to calculate cardinality of a partial join when it searches for the best execution plan Meaning: 1 - use selectivity of index backed range conditions to calculate the cardinality of a partial join if the last joined table is accessed by full table scan or an index scan, 2 - use selectivity of index backed range conditions to calculate the cardinality of a partial join in any case, 3 - additionally always use selectivity of range conditions that are not backed by any index to calculate the cardinality of a partial join, 4 - use histograms to calculate selectivity of range conditions that are not backed by any index to calculate the cardinality of a partial join.5 - additionally use selectivity of certain non-range predicates calculated on record samples NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 5 -@@ -2507,7 +2507,7 @@ +@@ -2521,7 +2521,7 @@ GLOBAL_VALUE_ORIGIN CONFIG DEFAULT_VALUE -1 VARIABLE_SCOPE GLOBAL @@ -694,7 +685,7 @@ VARIABLE_COMMENT Maximum number of instrumented user@host accounts. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 1048576 -@@ -2521,7 +2521,7 @@ +@@ -2535,7 +2535,7 @@ GLOBAL_VALUE_ORIGIN CONFIG DEFAULT_VALUE -1 VARIABLE_SCOPE GLOBAL @@ -703,7 +694,7 @@ VARIABLE_COMMENT Size of the statement digest. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 200 -@@ -2535,7 +2535,7 @@ +@@ -2549,7 +2549,7 @@ GLOBAL_VALUE_ORIGIN CONFIG DEFAULT_VALUE -1 VARIABLE_SCOPE GLOBAL @@ -712,7 +703,7 @@ VARIABLE_COMMENT Number of rows in EVENTS_STAGES_HISTORY_LONG. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 1048576 -@@ -2549,7 +2549,7 @@ +@@ -2563,7 +2563,7 @@ GLOBAL_VALUE_ORIGIN CONFIG DEFAULT_VALUE -1 VARIABLE_SCOPE GLOBAL @@ -721,7 +712,7 @@ VARIABLE_COMMENT Number of rows per thread in EVENTS_STAGES_HISTORY. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 1024 -@@ -2563,7 +2563,7 @@ +@@ -2577,7 +2577,7 @@ GLOBAL_VALUE_ORIGIN CONFIG DEFAULT_VALUE -1 VARIABLE_SCOPE GLOBAL @@ -730,7 +721,7 @@ VARIABLE_COMMENT Number of rows in EVENTS_STATEMENTS_HISTORY_LONG. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 1048576 -@@ -2577,7 +2577,7 @@ +@@ -2591,7 +2591,7 @@ GLOBAL_VALUE_ORIGIN CONFIG DEFAULT_VALUE -1 VARIABLE_SCOPE GLOBAL @@ -739,7 +730,7 @@ VARIABLE_COMMENT Number of rows per thread in EVENTS_STATEMENTS_HISTORY. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 1024 -@@ -2591,7 +2591,7 @@ +@@ -2605,7 +2605,7 @@ GLOBAL_VALUE_ORIGIN CONFIG DEFAULT_VALUE -1 VARIABLE_SCOPE GLOBAL @@ -748,7 +739,7 @@ VARIABLE_COMMENT Number of rows in EVENTS_WAITS_HISTORY_LONG. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 1048576 -@@ -2605,7 +2605,7 @@ +@@ -2619,7 +2619,7 @@ GLOBAL_VALUE_ORIGIN CONFIG DEFAULT_VALUE -1 VARIABLE_SCOPE GLOBAL @@ -757,7 +748,7 @@ VARIABLE_COMMENT Number of rows per thread in EVENTS_WAITS_HISTORY. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 1024 -@@ -2619,7 +2619,7 @@ +@@ -2633,7 +2633,7 @@ GLOBAL_VALUE_ORIGIN CONFIG DEFAULT_VALUE -1 VARIABLE_SCOPE GLOBAL @@ -766,7 +757,7 @@ VARIABLE_COMMENT Maximum number of instrumented hosts. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 1048576 -@@ -2633,7 +2633,7 @@ +@@ -2647,7 +2647,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 80 VARIABLE_SCOPE GLOBAL @@ -775,7 +766,7 @@ VARIABLE_COMMENT Maximum number of condition instruments. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 256 -@@ -2647,7 +2647,7 @@ +@@ -2661,7 +2661,7 @@ GLOBAL_VALUE_ORIGIN CONFIG DEFAULT_VALUE -1 VARIABLE_SCOPE GLOBAL @@ -784,7 +775,7 @@ VARIABLE_COMMENT Maximum number of instrumented condition objects. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 1048576 -@@ -2661,7 +2661,7 @@ +@@ -2675,7 +2675,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 1024 VARIABLE_SCOPE GLOBAL @@ -793,7 +784,7 @@ VARIABLE_COMMENT Maximum length considered for digest text, when stored in performance_schema tables. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 1048576 -@@ -2675,7 +2675,7 @@ +@@ -2689,7 +2689,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 50 VARIABLE_SCOPE GLOBAL @@ -802,7 +793,7 @@ VARIABLE_COMMENT Maximum number of file instruments. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 256 -@@ -2689,7 +2689,7 @@ +@@ -2703,7 +2703,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 32768 VARIABLE_SCOPE GLOBAL @@ -811,7 +802,7 @@ VARIABLE_COMMENT Maximum number of opened instrumented files. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 1048576 -@@ -2703,7 +2703,7 @@ +@@ -2717,7 +2717,7 @@ GLOBAL_VALUE_ORIGIN CONFIG DEFAULT_VALUE -1 VARIABLE_SCOPE GLOBAL @@ -820,7 +811,7 @@ VARIABLE_COMMENT Maximum number of instrumented files. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 1048576 -@@ -2717,7 +2717,7 @@ +@@ -2731,7 +2731,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 200 VARIABLE_SCOPE GLOBAL @@ -829,7 +820,7 @@ VARIABLE_COMMENT Maximum number of mutex instruments. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 256 -@@ -2731,7 +2731,7 @@ +@@ -2745,7 +2745,7 @@ GLOBAL_VALUE_ORIGIN CONFIG DEFAULT_VALUE -1 VARIABLE_SCOPE GLOBAL @@ -838,7 +829,7 @@ VARIABLE_COMMENT Maximum number of instrumented MUTEX objects. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 104857600 -@@ -2745,7 +2745,7 @@ +@@ -2759,7 +2759,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 40 VARIABLE_SCOPE GLOBAL @@ -847,7 +838,7 @@ VARIABLE_COMMENT Maximum number of rwlock instruments. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 256 -@@ -2759,7 +2759,7 @@ +@@ -2773,7 +2773,7 @@ GLOBAL_VALUE_ORIGIN CONFIG DEFAULT_VALUE -1 VARIABLE_SCOPE GLOBAL @@ -856,7 +847,7 @@ VARIABLE_COMMENT Maximum number of instrumented RWLOCK objects. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 104857600 -@@ -2773,7 +2773,7 @@ +@@ -2787,7 +2787,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 10 VARIABLE_SCOPE GLOBAL @@ -865,7 +856,7 @@ VARIABLE_COMMENT Maximum number of socket instruments. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 256 -@@ -2787,7 +2787,7 @@ +@@ -2801,7 +2801,7 @@ GLOBAL_VALUE_ORIGIN CONFIG DEFAULT_VALUE -1 VARIABLE_SCOPE GLOBAL @@ -874,7 +865,7 @@ VARIABLE_COMMENT Maximum number of opened instrumented sockets. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 1048576 -@@ -2801,7 +2801,7 @@ +@@ -2815,7 +2815,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 150 VARIABLE_SCOPE GLOBAL @@ -883,7 +874,7 @@ VARIABLE_COMMENT Maximum number of stage instruments. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 256 -@@ -2815,7 +2815,7 @@ +@@ -2829,7 +2829,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 178 VARIABLE_SCOPE GLOBAL @@ -892,7 +883,7 @@ VARIABLE_COMMENT Maximum number of statement instruments. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 256 -@@ -2829,7 +2829,7 @@ +@@ -2843,7 +2843,7 @@ GLOBAL_VALUE_ORIGIN CONFIG DEFAULT_VALUE -1 VARIABLE_SCOPE GLOBAL @@ -901,7 +892,7 @@ VARIABLE_COMMENT Maximum number of opened instrumented tables. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 1048576 -@@ -2843,7 +2843,7 @@ +@@ -2857,7 +2857,7 @@ GLOBAL_VALUE_ORIGIN CONFIG DEFAULT_VALUE -1 VARIABLE_SCOPE GLOBAL @@ -910,7 +901,7 @@ VARIABLE_COMMENT Maximum number of instrumented tables. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 1048576 -@@ -2857,7 +2857,7 @@ +@@ -2871,7 +2871,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 50 VARIABLE_SCOPE GLOBAL @@ -919,7 +910,7 @@ VARIABLE_COMMENT Maximum number of thread instruments. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 256 -@@ -2871,7 +2871,7 @@ +@@ -2885,7 +2885,7 @@ GLOBAL_VALUE_ORIGIN CONFIG DEFAULT_VALUE -1 VARIABLE_SCOPE GLOBAL @@ -928,7 +919,7 @@ VARIABLE_COMMENT Maximum number of instrumented threads. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 1048576 -@@ -2885,7 +2885,7 @@ +@@ -2899,7 +2899,7 @@ GLOBAL_VALUE_ORIGIN CONFIG DEFAULT_VALUE -1 VARIABLE_SCOPE GLOBAL @@ -937,7 +928,7 @@ VARIABLE_COMMENT Size of session attribute string buffer per thread. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 1048576 -@@ -2899,7 +2899,7 @@ +@@ -2913,7 +2913,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 100 VARIABLE_SCOPE GLOBAL @@ -946,7 +937,7 @@ VARIABLE_COMMENT Maximum number of rows in SETUP_ACTORS. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 1024 -@@ -2913,7 +2913,7 @@ +@@ -2927,7 +2927,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 100 VARIABLE_SCOPE GLOBAL @@ -955,7 +946,7 @@ VARIABLE_COMMENT Maximum number of rows in SETUP_OBJECTS. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 1048576 -@@ -2927,7 +2927,7 @@ +@@ -2941,7 +2941,7 @@ GLOBAL_VALUE_ORIGIN CONFIG DEFAULT_VALUE -1 VARIABLE_SCOPE GLOBAL @@ -964,7 +955,7 @@ VARIABLE_COMMENT Maximum number of instrumented users. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 1048576 -@@ -2997,7 +2997,7 @@ +@@ -3011,7 +3011,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 32768 VARIABLE_SCOPE SESSION @@ -973,7 +964,7 @@ VARIABLE_COMMENT The size of the buffer that is allocated when preloading indexes NUMERIC_MIN_VALUE 1024 NUMERIC_MAX_VALUE 1073741824 -@@ -3025,7 +3025,7 @@ +@@ -3039,7 +3039,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 15 VARIABLE_SCOPE SESSION @@ -982,7 +973,7 @@ VARIABLE_COMMENT Number of statements about which profiling information is maintained. If set to 0, no profiles are stored. See SHOW PROFILES. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 100 -@@ -3039,7 +3039,7 @@ +@@ -3053,7 +3053,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 5 VARIABLE_SCOPE SESSION @@ -991,7 +982,7 @@ VARIABLE_COMMENT Seconds between sending progress reports to the client for time-consuming statements. Set to 0 to disable progress reporting. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 4294967295 -@@ -3095,10 +3095,10 @@ +@@ -3109,10 +3109,10 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 0 VARIABLE_SCOPE SESSION ONLY @@ -1004,7 +995,7 @@ NUMERIC_BLOCK_SIZE 1 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -3109,7 +3109,7 @@ +@@ -3123,7 +3123,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 16384 VARIABLE_SCOPE SESSION @@ -1013,7 +1004,7 @@ VARIABLE_COMMENT Allocation block size for query parsing and execution NUMERIC_MIN_VALUE 1024 NUMERIC_MAX_VALUE 4294967295 -@@ -3123,7 +3123,7 @@ +@@ -3137,7 +3137,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 1048576 VARIABLE_SCOPE GLOBAL @@ -1022,7 +1013,7 @@ VARIABLE_COMMENT Don't cache results that are bigger than this NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 4294967295 -@@ -3137,7 +3137,7 @@ +@@ -3151,7 +3151,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 4096 VARIABLE_SCOPE GLOBAL @@ -1031,7 +1022,7 @@ VARIABLE_COMMENT The minimum size for blocks allocated by the query cache NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 4294967295 -@@ -3154,7 +3154,7 @@ +@@ -3168,7 +3168,7 @@ VARIABLE_TYPE BIGINT UNSIGNED VARIABLE_COMMENT The memory allocated to store results from old queries NUMERIC_MIN_VALUE 0 @@ -1040,7 +1031,7 @@ NUMERIC_BLOCK_SIZE 1024 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -3207,7 +3207,7 @@ +@@ -3221,7 +3221,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 24576 VARIABLE_SCOPE SESSION @@ -1049,7 +1040,7 @@ VARIABLE_COMMENT Persistent buffer for query parsing and execution NUMERIC_MIN_VALUE 1024 NUMERIC_MAX_VALUE 4294967295 -@@ -3221,7 +3221,7 @@ +@@ -3235,7 +3235,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 4096 VARIABLE_SCOPE SESSION @@ -1058,7 +1049,7 @@ VARIABLE_COMMENT Allocation block size for storing ranges during optimization NUMERIC_MIN_VALUE 4096 NUMERIC_MAX_VALUE 4294967295 -@@ -3235,7 +3235,7 @@ +@@ -3249,7 +3249,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 131072 VARIABLE_SCOPE SESSION @@ -1067,7 +1058,7 @@ VARIABLE_COMMENT Each thread that does a sequential scan allocates a buffer of this size for each table it scans. If you do many sequential scans, you may want to increase this value NUMERIC_MIN_VALUE 8192 NUMERIC_MAX_VALUE 2147483647 -@@ -3263,7 +3263,7 @@ +@@ -3277,7 +3277,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 262144 VARIABLE_SCOPE SESSION @@ -1076,7 +1067,7 @@ VARIABLE_COMMENT When reading rows in sorted order after a sort, the rows are read through this buffer to avoid a disk seeks NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 2147483647 -@@ -3277,10 +3277,10 @@ +@@ -3291,10 +3291,10 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 8388608 VARIABLE_SCOPE SESSION @@ -1089,7 +1080,7 @@ NUMERIC_BLOCK_SIZE 1 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -3319,7 +3319,7 @@ +@@ -3333,7 +3333,7 @@ GLOBAL_VALUE_ORIGIN CONFIG DEFAULT_VALUE 0 VARIABLE_SCOPE SESSION @@ -1098,7 +1089,7 @@ VARIABLE_COMMENT Uniquely identifies the server instance in the community of replication partners NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 4294967295 -@@ -3417,7 +3417,7 @@ +@@ -3431,7 +3431,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 1073741824 VARIABLE_SCOPE GLOBAL @@ -1107,7 +1098,7 @@ VARIABLE_COMMENT The maximum packet length to sent successfully from the master to slave. NUMERIC_MIN_VALUE 1024 NUMERIC_MAX_VALUE 1073741824 -@@ -3431,7 +3431,7 @@ +@@ -3445,7 +3445,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 2 VARIABLE_SCOPE GLOBAL @@ -1116,7 +1107,7 @@ VARIABLE_COMMENT If creating the thread takes longer than this value (in seconds), the Slow_launch_threads counter will be incremented NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 31536000 -@@ -3490,7 +3490,7 @@ +@@ -3504,7 +3504,7 @@ VARIABLE_TYPE BIGINT UNSIGNED VARIABLE_COMMENT Each thread that needs to do a sort allocates a buffer of this size NUMERIC_MIN_VALUE 1024 @@ -1125,7 +1116,7 @@ NUMERIC_BLOCK_SIZE 1 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -3767,7 +3767,7 @@ +@@ -3781,7 +3781,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 256 VARIABLE_SCOPE GLOBAL @@ -1134,7 +1125,7 @@ VARIABLE_COMMENT The soft upper limit for number of cached stored routines for one connection. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 524288 -@@ -3837,7 +3837,7 @@ +@@ -3851,10 +3851,10 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 400 VARIABLE_SCOPE GLOBAL @@ -1142,17 +1133,21 @@ +VARIABLE_TYPE INT UNSIGNED VARIABLE_COMMENT The number of cached table definitions NUMERIC_MIN_VALUE 400 - NUMERIC_MAX_VALUE 524288 -@@ -3851,7 +3851,7 @@ - GLOBAL_VALUE_ORIGIN COMPILE-TIME +-NUMERIC_MAX_VALUE 524288 ++NUMERIC_MAX_VALUE 2097152 + NUMERIC_BLOCK_SIZE 1 + ENUM_VALUE_LIST NULL + READ_ONLY NO +@@ -3865,7 +3865,7 @@ + GLOBAL_VALUE_ORIGIN CONFIG DEFAULT_VALUE 2000 VARIABLE_SCOPE GLOBAL -VARIABLE_TYPE BIGINT UNSIGNED +VARIABLE_TYPE INT UNSIGNED VARIABLE_COMMENT The number of cached open tables - NUMERIC_MIN_VALUE 1 + NUMERIC_MIN_VALUE 10 NUMERIC_MAX_VALUE 1048576 -@@ -3865,7 +3865,7 @@ +@@ -3879,7 +3879,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 0 VARIABLE_SCOPE GLOBAL @@ -1161,7 +1156,7 @@ VARIABLE_COMMENT How many threads we should keep in a cache for reuse NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 16384 -@@ -3879,7 +3879,7 @@ +@@ -3893,7 +3893,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 10 VARIABLE_SCOPE GLOBAL @@ -1170,7 +1165,7 @@ VARIABLE_COMMENT Permits the application to give the threads system a hint for the desired number of threads that should be run at the same time.This variable has no effect, and is deprecated. It will be removed in a future release. NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 512 -@@ -3994,7 +3994,7 @@ +@@ -4008,7 +4008,7 @@ VARIABLE_TYPE BIGINT UNSIGNED VARIABLE_COMMENT If an internal in-memory temporary table exceeds this size, MariaDB will automatically convert it to an on-disk MyISAM or Aria table. NUMERIC_MIN_VALUE 1024 @@ -1179,7 +1174,7 @@ NUMERIC_BLOCK_SIZE 1 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -4005,7 +4005,7 @@ +@@ -4019,7 +4019,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 8192 VARIABLE_SCOPE SESSION @@ -1188,7 +1183,7 @@ VARIABLE_COMMENT Allocation block size for transactions to be stored in binary log NUMERIC_MIN_VALUE 1024 NUMERIC_MAX_VALUE 134217728 -@@ -4019,7 +4019,7 @@ +@@ -4033,7 +4033,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 4096 VARIABLE_SCOPE SESSION @@ -1197,7 +1192,7 @@ VARIABLE_COMMENT Persistent buffer for transactions to be stored in binary log NUMERIC_MIN_VALUE 1024 NUMERIC_MAX_VALUE 134217728 -@@ -4117,7 +4117,7 @@ +@@ -4131,7 +4131,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 28800 VARIABLE_SCOPE SESSION @@ -1206,7 +1201,7 @@ VARIABLE_COMMENT The number of seconds the server waits for activity on a connection before closing it NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 31536000 -@@ -4221,7 +4221,7 @@ +@@ -4235,7 +4235,7 @@ COMMAND_LINE_ARGUMENT OPTIONAL VARIABLE_NAME OPEN_FILES_LIMIT VARIABLE_SCOPE GLOBAL @@ -1215,7 +1210,7 @@ VARIABLE_COMMENT If this is not 0, then mysqld will use this value to reserve file descriptors to use with setrlimit(). If this value is 0 then mysqld will reserve max_connections*5 or max_connections + table_cache*2 (whichever is larger) number of file descriptors NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 4294967295 -@@ -4234,7 +4234,7 @@ +@@ -4248,7 +4248,7 @@ VARIABLE_TYPE BIGINT UNSIGNED VARIABLE_COMMENT Sets the internal state of the RAND() generator for replication purposes NUMERIC_MIN_VALUE 0 @@ -1224,7 +1219,7 @@ NUMERIC_BLOCK_SIZE 1 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -4244,7 +4244,7 @@ +@@ -4258,7 +4258,7 @@ VARIABLE_TYPE BIGINT UNSIGNED VARIABLE_COMMENT Sets the internal state of the RAND() generator for replication purposes NUMERIC_MIN_VALUE 0 @@ -1233,7 +1228,7 @@ NUMERIC_BLOCK_SIZE 1 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -4329,7 +4329,7 @@ +@@ -4343,7 +4343,7 @@ VARIABLE_NAME LOG_TC_SIZE GLOBAL_VALUE_ORIGIN AUTO VARIABLE_SCOPE GLOBAL diff --git a/mysql-test/suite/sys_vars/r/sysvars_server_notembedded,32bit.rdiff b/mysql-test/suite/sys_vars/r/sysvars_server_notembedded,32bit.rdiff index 980b06a1055..93febe46928 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_server_notembedded,32bit.rdiff +++ b/mysql-test/suite/sys_vars/r/sysvars_server_notembedded,32bit.rdiff @@ -89,7 +89,7 @@ VARIABLE_COMMENT The number of seconds the mysqld server is waiting for a connect packet before responding with 'Bad handshake' NUMERIC_MIN_VALUE 2 NUMERIC_MAX_VALUE 31536000 -@@ -519,7 +519,7 @@ +@@ -533,7 +533,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 15 VARIABLE_SCOPE SESSION @@ -98,7 +98,7 @@ VARIABLE_COMMENT Long search depth for the two-step deadlock detection NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 33 -@@ -533,7 +533,7 @@ +@@ -547,7 +547,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 4 VARIABLE_SCOPE SESSION @@ -107,7 +107,7 @@ VARIABLE_COMMENT Short search depth for the two-step deadlock detection NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 32 -@@ -547,7 +547,7 @@ +@@ -561,7 +561,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 50000000 VARIABLE_SCOPE SESSION @@ -116,7 +116,7 @@ VARIABLE_COMMENT Long timeout for the two-step deadlock detection (in microseconds) NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 4294967295 -@@ -561,7 +561,7 @@ +@@ -575,7 +575,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 10000 VARIABLE_SCOPE SESSION @@ -125,7 +125,7 @@ VARIABLE_COMMENT Short timeout for the two-step deadlock detection (in microseconds) NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 4294967295 -@@ -631,7 +631,7 @@ +@@ -645,7 +645,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 0 VARIABLE_SCOPE SESSION @@ -134,7 +134,7 @@ VARIABLE_COMMENT The default week format used by WEEK() functions NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 7 -@@ -645,7 +645,7 @@ +@@ -659,7 +659,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 100 VARIABLE_SCOPE GLOBAL @@ -143,7 +143,7 @@ VARIABLE_COMMENT After inserting delayed_insert_limit rows, the INSERT DELAYED handler will check if there are any SELECT statements pending. If so, it allows these to execute before continuing. NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 4294967295 -@@ -659,7 +659,7 @@ +@@ -673,7 +673,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 300 VARIABLE_SCOPE GLOBAL @@ -152,7 +152,7 @@ VARIABLE_COMMENT How long a INSERT DELAYED thread should wait for INSERT statements before terminating NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 31536000 -@@ -673,7 +673,7 @@ +@@ -687,7 +687,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 1000 VARIABLE_SCOPE GLOBAL @@ -161,7 +161,7 @@ VARIABLE_COMMENT What size queue (in rows) should be allocated for handling INSERT DELAYED. If the queue becomes full, any client that does INSERT DELAYED will wait until there is room in the queue again NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 4294967295 -@@ -701,7 +701,7 @@ +@@ -715,7 +715,7 @@ GLOBAL_VALUE_ORIGIN SQL DEFAULT_VALUE 4 VARIABLE_SCOPE SESSION @@ -170,7 +170,7 @@ VARIABLE_COMMENT Precision of the result of '/' operator will be increased on that value NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 30 -@@ -813,7 +813,7 @@ +@@ -827,7 +827,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 0 VARIABLE_SCOPE GLOBAL @@ -179,7 +179,7 @@ VARIABLE_COMMENT If non-zero, binary logs will be purged after expire_logs_days days; possible purges happen at startup and at binary log rotation NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 99 -@@ -855,7 +855,7 @@ +@@ -869,7 +869,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 1 VARIABLE_SCOPE GLOBAL @@ -188,7 +188,7 @@ VARIABLE_COMMENT The number of connections on extra-port NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 100000 -@@ -897,7 +897,7 @@ +@@ -911,7 +911,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 0 VARIABLE_SCOPE GLOBAL @@ -197,7 +197,7 @@ VARIABLE_COMMENT A dedicated thread is created to flush all tables at the given interval NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 31536000 -@@ -939,7 +939,7 @@ +@@ -953,7 +953,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 84 VARIABLE_SCOPE GLOBAL @@ -206,7 +206,7 @@ VARIABLE_COMMENT The maximum length of the word to be included in a FULLTEXT index. Note: FULLTEXT indexes must be rebuilt after changing this variable NUMERIC_MIN_VALUE 10 NUMERIC_MAX_VALUE 84 -@@ -953,7 +953,7 @@ +@@ -967,7 +967,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 4 VARIABLE_SCOPE GLOBAL @@ -215,7 +215,7 @@ VARIABLE_COMMENT The minimum length of the word to be included in a FULLTEXT index. Note: FULLTEXT indexes must be rebuilt after changing this variable NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 84 -@@ -967,7 +967,7 @@ +@@ -981,7 +981,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 20 VARIABLE_SCOPE GLOBAL @@ -224,7 +224,7 @@ VARIABLE_COMMENT Number of best matches to use for query expansion NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 1000 -@@ -1026,7 +1026,7 @@ +@@ -1040,7 +1040,7 @@ VARIABLE_TYPE BIGINT UNSIGNED VARIABLE_COMMENT The maximum length of the result of function GROUP_CONCAT() NUMERIC_MIN_VALUE 4 @@ -233,7 +233,7 @@ NUMERIC_BLOCK_SIZE 1 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -1261,7 +1261,7 @@ +@@ -1275,7 +1275,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 0 VARIABLE_SCOPE SESSION @@ -242,7 +242,7 @@ VARIABLE_COMMENT Number of bytes used for a histogram. If set to 0, no histograms are created by ANALYZE. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 255 -@@ -1289,7 +1289,7 @@ +@@ -1303,7 +1303,7 @@ GLOBAL_VALUE_ORIGIN AUTO DEFAULT_VALUE 128 VARIABLE_SCOPE GLOBAL @@ -251,7 +251,7 @@ VARIABLE_COMMENT How many host names should be cached to avoid resolving. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 65536 -@@ -1401,7 +1401,7 @@ +@@ -1415,7 +1415,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 28800 VARIABLE_SCOPE SESSION @@ -260,7 +260,7 @@ VARIABLE_COMMENT The number of seconds the server waits for activity on an interactive connection before closing it NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 31536000 -@@ -1432,7 +1432,7 @@ +@@ -1446,7 +1446,7 @@ VARIABLE_TYPE BIGINT UNSIGNED VARIABLE_COMMENT The size of the buffer that is used for joins NUMERIC_MIN_VALUE 128 @@ -269,7 +269,7 @@ NUMERIC_BLOCK_SIZE 128 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -1457,7 +1457,7 @@ +@@ -1471,7 +1471,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 2 VARIABLE_SCOPE SESSION @@ -278,7 +278,7 @@ VARIABLE_COMMENT Controls what join operations can be executed with join buffers. Odd numbers are used for plain join buffers while even numbers are used for linked buffers NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 8 -@@ -1488,7 +1488,7 @@ +@@ -1502,7 +1502,7 @@ VARIABLE_TYPE BIGINT UNSIGNED VARIABLE_COMMENT The size of the buffer used for index blocks for MyISAM tables. Increase this to get better index handling (for all reads and multiple writes) to as much as you can afford NUMERIC_MIN_VALUE 0 @@ -287,7 +287,7 @@ NUMERIC_BLOCK_SIZE 4096 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -1709,7 +1709,7 @@ +@@ -1723,7 +1723,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 31536000 VARIABLE_SCOPE SESSION @@ -296,7 +296,7 @@ VARIABLE_COMMENT Timeout in seconds to wait for a lock before returning an error. NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 31536000 -@@ -1863,7 +1863,7 @@ +@@ -1877,7 +1877,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 1 VARIABLE_SCOPE SESSION @@ -305,7 +305,7 @@ VARIABLE_COMMENT Write to slow log every #th slow query. Set to 1 to log everything. Increase it to reduce the size of the slow or the performance impact of slow logging NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 4294967295 -@@ -1905,7 +1905,7 @@ +@@ -1919,7 +1919,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 1 VARIABLE_SCOPE SESSION @@ -314,7 +314,7 @@ VARIABLE_COMMENT Log some not critical warnings to the general log file.Value can be between 0 and 11. Higher values mean more verbosity NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 4294967295 -@@ -1961,7 +1961,7 @@ +@@ -1975,7 +1975,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 4194304 VARIABLE_SCOPE SESSION @@ -323,7 +323,7 @@ VARIABLE_COMMENT Max packet length to send to or receive from the server NUMERIC_MIN_VALUE 1024 NUMERIC_MAX_VALUE 1073741824 -@@ -1971,14 +1971,14 @@ +@@ -1985,14 +1985,14 @@ COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME MAX_BINLOG_CACHE_SIZE SESSION_VALUE NULL @@ -341,7 +341,7 @@ NUMERIC_BLOCK_SIZE 4096 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -1989,7 +1989,7 @@ +@@ -2003,7 +2003,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 1073741824 VARIABLE_SCOPE GLOBAL @@ -350,7 +350,7 @@ VARIABLE_COMMENT Binary log will be rotated automatically when the size exceeds this value. NUMERIC_MIN_VALUE 4096 NUMERIC_MAX_VALUE 1073741824 -@@ -1999,14 +1999,14 @@ +@@ -2013,14 +2013,14 @@ COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME MAX_BINLOG_STMT_CACHE_SIZE SESSION_VALUE NULL @@ -368,16 +368,16 @@ NUMERIC_BLOCK_SIZE 4096 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -2017,7 +2017,7 @@ +@@ -2031,7 +2031,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 151 VARIABLE_SCOPE GLOBAL -VARIABLE_TYPE BIGINT UNSIGNED +VARIABLE_TYPE INT UNSIGNED VARIABLE_COMMENT The number of simultaneous clients allowed - NUMERIC_MIN_VALUE 1 + NUMERIC_MIN_VALUE 10 NUMERIC_MAX_VALUE 100000 -@@ -2031,7 +2031,7 @@ +@@ -2045,7 +2045,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 100 VARIABLE_SCOPE GLOBAL @@ -386,7 +386,7 @@ VARIABLE_COMMENT If there is more than this number of interrupted connections from a host this host will be blocked from further connections NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 4294967295 -@@ -2045,7 +2045,7 @@ +@@ -2059,7 +2059,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 20 VARIABLE_SCOPE SESSION @@ -395,7 +395,7 @@ VARIABLE_COMMENT Don't start more than this number of threads to handle INSERT DELAYED statements. If set to zero INSERT DELAYED will be not used NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 16384 -@@ -2073,7 +2073,7 @@ +@@ -2087,7 +2087,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 64 VARIABLE_SCOPE SESSION @@ -404,7 +404,7 @@ VARIABLE_COMMENT Max number of errors/warnings to store for a statement NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 65535 -@@ -2090,7 +2090,7 @@ +@@ -2104,7 +2104,7 @@ VARIABLE_TYPE BIGINT UNSIGNED VARIABLE_COMMENT Don't allow creation of heap tables bigger than this NUMERIC_MIN_VALUE 16384 @@ -413,7 +413,7 @@ NUMERIC_BLOCK_SIZE 1024 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -2101,7 +2101,7 @@ +@@ -2115,7 +2115,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 20 VARIABLE_SCOPE SESSION @@ -422,7 +422,7 @@ VARIABLE_COMMENT Don't start more than this number of threads to handle INSERT DELAYED statements. If set to zero INSERT DELAYED will be not used NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 16384 -@@ -2129,7 +2129,7 @@ +@@ -2143,7 +2143,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 1024 VARIABLE_SCOPE SESSION @@ -431,7 +431,7 @@ VARIABLE_COMMENT Max number of bytes in sorted records NUMERIC_MIN_VALUE 4 NUMERIC_MAX_VALUE 8388608 -@@ -2143,7 +2143,7 @@ +@@ -2157,7 +2157,7 @@ GLOBAL_VALUE_ORIGIN AUTO DEFAULT_VALUE 1048576 VARIABLE_SCOPE GLOBAL @@ -440,16 +440,7 @@ VARIABLE_COMMENT The maximum BLOB length to send to server from mysql_send_long_data API. Deprecated option; use max_allowed_packet instead. NUMERIC_MIN_VALUE 1024 NUMERIC_MAX_VALUE 4294967295 -@@ -2157,7 +2157,7 @@ - GLOBAL_VALUE_ORIGIN COMPILE-TIME - DEFAULT_VALUE 16382 - VARIABLE_SCOPE GLOBAL --VARIABLE_TYPE BIGINT UNSIGNED -+VARIABLE_TYPE INT UNSIGNED - VARIABLE_COMMENT Maximum number of prepared statements in the server - NUMERIC_MIN_VALUE 0 - NUMERIC_MAX_VALUE 1048576 -@@ -2185,7 +2185,7 @@ +@@ -2199,7 +2199,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 4294967295 VARIABLE_SCOPE SESSION @@ -458,7 +449,7 @@ VARIABLE_COMMENT Limit assumed max number of seeks when looking up rows based on a key NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 4294967295 -@@ -2213,7 +2213,7 @@ +@@ -2227,7 +2227,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 1024 VARIABLE_SCOPE SESSION @@ -467,7 +458,7 @@ VARIABLE_COMMENT The number of bytes to use when sorting BLOB or TEXT values (only the first max_sort_length bytes of each value are used; the rest are ignored) NUMERIC_MIN_VALUE 4 NUMERIC_MAX_VALUE 8388608 -@@ -2227,7 +2227,7 @@ +@@ -2241,7 +2241,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 0 VARIABLE_SCOPE SESSION @@ -476,7 +467,7 @@ VARIABLE_COMMENT Maximum stored procedure recursion depth NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 255 -@@ -2255,7 +2255,7 @@ +@@ -2269,7 +2269,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 32 VARIABLE_SCOPE SESSION @@ -485,7 +476,7 @@ VARIABLE_COMMENT Unused, will be removed. NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 4294967295 -@@ -2283,7 +2283,7 @@ +@@ -2297,7 +2297,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 4294967295 VARIABLE_SCOPE GLOBAL @@ -494,7 +485,7 @@ VARIABLE_COMMENT After this many write locks, allow some read locks to run in between NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 4294967295 -@@ -2297,7 +2297,7 @@ +@@ -2311,7 +2311,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 1024 VARIABLE_SCOPE GLOBAL @@ -503,7 +494,7 @@ VARIABLE_COMMENT Unused NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 1048576 -@@ -2311,7 +2311,7 @@ +@@ -2325,7 +2325,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 8 VARIABLE_SCOPE GLOBAL @@ -512,7 +503,7 @@ VARIABLE_COMMENT Unused NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 1024 -@@ -2325,7 +2325,7 @@ +@@ -2339,7 +2339,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 0 VARIABLE_SCOPE SESSION @@ -521,7 +512,7 @@ VARIABLE_COMMENT Don't write queries to slow log that examine fewer rows than that NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 4294967295 -@@ -2339,7 +2339,7 @@ +@@ -2353,7 +2353,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 262144 VARIABLE_SCOPE SESSION @@ -530,7 +521,7 @@ VARIABLE_COMMENT Size of buffer to use when using MRR with range access NUMERIC_MIN_VALUE 8192 NUMERIC_MAX_VALUE 2147483647 -@@ -2353,10 +2353,10 @@ +@@ -2367,10 +2367,10 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 256 VARIABLE_SCOPE SESSION @@ -543,7 +534,7 @@ NUMERIC_BLOCK_SIZE 1 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -2367,7 +2367,7 @@ +@@ -2381,7 +2381,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 1024 VARIABLE_SCOPE GLOBAL @@ -552,7 +543,7 @@ VARIABLE_COMMENT Block size to be used for MyISAM index pages NUMERIC_MIN_VALUE 1024 NUMERIC_MAX_VALUE 16384 -@@ -2381,7 +2381,7 @@ +@@ -2395,7 +2395,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 6 VARIABLE_SCOPE GLOBAL @@ -561,7 +552,7 @@ VARIABLE_COMMENT Default pointer size to be used for MyISAM tables NUMERIC_MIN_VALUE 2 NUMERIC_MAX_VALUE 7 -@@ -2391,9 +2391,9 @@ +@@ -2405,9 +2405,9 @@ COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME MYISAM_MAX_SORT_FILE_SIZE SESSION_VALUE NULL @@ -573,7 +564,7 @@ VARIABLE_SCOPE GLOBAL VARIABLE_TYPE BIGINT UNSIGNED VARIABLE_COMMENT Don't use the fast sort index method to created index if the temporary file would get bigger than this -@@ -2405,14 +2405,14 @@ +@@ -2419,14 +2419,14 @@ COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME MYISAM_MMAP_SIZE SESSION_VALUE NULL @@ -591,7 +582,7 @@ NUMERIC_BLOCK_SIZE 1 ENUM_VALUE_LIST NULL READ_ONLY YES -@@ -2437,10 +2437,10 @@ +@@ -2451,10 +2451,10 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 1 VARIABLE_SCOPE SESSION @@ -604,7 +595,7 @@ NUMERIC_BLOCK_SIZE 1 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -2454,7 +2454,7 @@ +@@ -2468,7 +2468,7 @@ VARIABLE_TYPE BIGINT UNSIGNED VARIABLE_COMMENT The buffer that is allocated when sorting the index when doing a REPAIR or when creating indexes with CREATE INDEX or ALTER TABLE NUMERIC_MIN_VALUE 4096 @@ -613,7 +604,7 @@ NUMERIC_BLOCK_SIZE 1 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -2507,7 +2507,7 @@ +@@ -2521,7 +2521,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 16384 VARIABLE_SCOPE SESSION @@ -622,7 +613,7 @@ VARIABLE_COMMENT Buffer length for TCP/IP and socket communication NUMERIC_MIN_VALUE 1024 NUMERIC_MAX_VALUE 1048576 -@@ -2521,7 +2521,7 @@ +@@ -2535,7 +2535,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 30 VARIABLE_SCOPE SESSION @@ -631,7 +622,7 @@ VARIABLE_COMMENT Number of seconds to wait for more data from a connection before aborting the read NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 31536000 -@@ -2535,7 +2535,7 @@ +@@ -2549,7 +2549,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 10 VARIABLE_SCOPE SESSION @@ -640,7 +631,7 @@ VARIABLE_COMMENT If a read on a communication port is interrupted, retry this many times before giving up NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 4294967295 -@@ -2549,7 +2549,7 @@ +@@ -2563,7 +2563,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 60 VARIABLE_SCOPE SESSION @@ -649,7 +640,7 @@ VARIABLE_COMMENT Number of seconds to wait for a block to be written to a connection before aborting the write NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 31536000 -@@ -2619,7 +2619,7 @@ +@@ -2633,7 +2633,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 1 VARIABLE_SCOPE SESSION @@ -658,7 +649,7 @@ VARIABLE_COMMENT Controls the heuristic(s) applied during query optimization to prune less-promising partial plans from the optimizer search space. Meaning: 0 - do not apply any heuristic, thus perform exhaustive search; 1 - prune plans based on number of retrieved rows NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 1 -@@ -2633,7 +2633,7 @@ +@@ -2647,7 +2647,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 62 VARIABLE_SCOPE SESSION @@ -667,7 +658,7 @@ VARIABLE_COMMENT Maximum depth of search performed by the query optimizer. Values larger than the number of relations in a query result in better query plans, but take longer to compile a query. Values smaller than the number of tables in a relation result in faster optimization, but may produce very bad query plans. If set to 0, the system will automatically pick a reasonable value; if set to 63, the optimizer will switch to the original find_best search. NOTE: The value 63 and its associated behaviour is deprecated. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 63 -@@ -2647,7 +2647,7 @@ +@@ -2661,7 +2661,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 100 VARIABLE_SCOPE SESSION @@ -676,7 +667,7 @@ VARIABLE_COMMENT Controls number of record samples to check condition selectivity NUMERIC_MIN_VALUE 10 NUMERIC_MAX_VALUE 4294967295 -@@ -2675,7 +2675,7 @@ +@@ -2689,7 +2689,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 1 VARIABLE_SCOPE SESSION @@ -685,7 +676,7 @@ VARIABLE_COMMENT Controls selectivity of which conditions the optimizer takes into account to calculate cardinality of a partial join when it searches for the best execution plan Meaning: 1 - use selectivity of index backed range conditions to calculate the cardinality of a partial join if the last joined table is accessed by full table scan or an index scan, 2 - use selectivity of index backed range conditions to calculate the cardinality of a partial join in any case, 3 - additionally always use selectivity of range conditions that are not backed by any index to calculate the cardinality of a partial join, 4 - use histograms to calculate selectivity of range conditions that are not backed by any index to calculate the cardinality of a partial join.5 - additionally use selectivity of certain non-range predicates calculated on record samples NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 5 -@@ -2703,7 +2703,7 @@ +@@ -2717,7 +2717,7 @@ GLOBAL_VALUE_ORIGIN CONFIG DEFAULT_VALUE -1 VARIABLE_SCOPE GLOBAL @@ -694,7 +685,7 @@ VARIABLE_COMMENT Maximum number of instrumented user@host accounts. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 1048576 -@@ -2717,7 +2717,7 @@ +@@ -2731,7 +2731,7 @@ GLOBAL_VALUE_ORIGIN CONFIG DEFAULT_VALUE -1 VARIABLE_SCOPE GLOBAL @@ -703,7 +694,7 @@ VARIABLE_COMMENT Size of the statement digest. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 200 -@@ -2731,7 +2731,7 @@ +@@ -2745,7 +2745,7 @@ GLOBAL_VALUE_ORIGIN CONFIG DEFAULT_VALUE -1 VARIABLE_SCOPE GLOBAL @@ -712,7 +703,7 @@ VARIABLE_COMMENT Number of rows in EVENTS_STAGES_HISTORY_LONG. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 1048576 -@@ -2745,7 +2745,7 @@ +@@ -2759,7 +2759,7 @@ GLOBAL_VALUE_ORIGIN CONFIG DEFAULT_VALUE -1 VARIABLE_SCOPE GLOBAL @@ -721,7 +712,7 @@ VARIABLE_COMMENT Number of rows per thread in EVENTS_STAGES_HISTORY. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 1024 -@@ -2759,7 +2759,7 @@ +@@ -2773,7 +2773,7 @@ GLOBAL_VALUE_ORIGIN CONFIG DEFAULT_VALUE -1 VARIABLE_SCOPE GLOBAL @@ -730,7 +721,7 @@ VARIABLE_COMMENT Number of rows in EVENTS_STATEMENTS_HISTORY_LONG. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 1048576 -@@ -2773,7 +2773,7 @@ +@@ -2787,7 +2787,7 @@ GLOBAL_VALUE_ORIGIN CONFIG DEFAULT_VALUE -1 VARIABLE_SCOPE GLOBAL @@ -739,7 +730,7 @@ VARIABLE_COMMENT Number of rows per thread in EVENTS_STATEMENTS_HISTORY. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 1024 -@@ -2787,7 +2787,7 @@ +@@ -2801,7 +2801,7 @@ GLOBAL_VALUE_ORIGIN CONFIG DEFAULT_VALUE -1 VARIABLE_SCOPE GLOBAL @@ -748,7 +739,7 @@ VARIABLE_COMMENT Number of rows in EVENTS_WAITS_HISTORY_LONG. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 1048576 -@@ -2801,7 +2801,7 @@ +@@ -2815,7 +2815,7 @@ GLOBAL_VALUE_ORIGIN CONFIG DEFAULT_VALUE -1 VARIABLE_SCOPE GLOBAL @@ -757,7 +748,7 @@ VARIABLE_COMMENT Number of rows per thread in EVENTS_WAITS_HISTORY. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 1024 -@@ -2815,7 +2815,7 @@ +@@ -2829,7 +2829,7 @@ GLOBAL_VALUE_ORIGIN CONFIG DEFAULT_VALUE -1 VARIABLE_SCOPE GLOBAL @@ -766,7 +757,7 @@ VARIABLE_COMMENT Maximum number of instrumented hosts. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 1048576 -@@ -2829,7 +2829,7 @@ +@@ -2843,7 +2843,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 80 VARIABLE_SCOPE GLOBAL @@ -775,7 +766,7 @@ VARIABLE_COMMENT Maximum number of condition instruments. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 256 -@@ -2843,7 +2843,7 @@ +@@ -2857,7 +2857,7 @@ GLOBAL_VALUE_ORIGIN CONFIG DEFAULT_VALUE -1 VARIABLE_SCOPE GLOBAL @@ -784,7 +775,7 @@ VARIABLE_COMMENT Maximum number of instrumented condition objects. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 1048576 -@@ -2857,7 +2857,7 @@ +@@ -2871,7 +2871,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 1024 VARIABLE_SCOPE GLOBAL @@ -793,7 +784,7 @@ VARIABLE_COMMENT Maximum length considered for digest text, when stored in performance_schema tables. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 1048576 -@@ -2871,7 +2871,7 @@ +@@ -2885,7 +2885,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 50 VARIABLE_SCOPE GLOBAL @@ -802,7 +793,7 @@ VARIABLE_COMMENT Maximum number of file instruments. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 256 -@@ -2885,7 +2885,7 @@ +@@ -2899,7 +2899,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 32768 VARIABLE_SCOPE GLOBAL @@ -811,7 +802,7 @@ VARIABLE_COMMENT Maximum number of opened instrumented files. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 1048576 -@@ -2899,7 +2899,7 @@ +@@ -2913,7 +2913,7 @@ GLOBAL_VALUE_ORIGIN CONFIG DEFAULT_VALUE -1 VARIABLE_SCOPE GLOBAL @@ -820,7 +811,7 @@ VARIABLE_COMMENT Maximum number of instrumented files. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 1048576 -@@ -2913,7 +2913,7 @@ +@@ -2927,7 +2927,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 200 VARIABLE_SCOPE GLOBAL @@ -829,7 +820,7 @@ VARIABLE_COMMENT Maximum number of mutex instruments. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 256 -@@ -2927,7 +2927,7 @@ +@@ -2941,7 +2941,7 @@ GLOBAL_VALUE_ORIGIN CONFIG DEFAULT_VALUE -1 VARIABLE_SCOPE GLOBAL @@ -838,7 +829,7 @@ VARIABLE_COMMENT Maximum number of instrumented MUTEX objects. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 104857600 -@@ -2941,7 +2941,7 @@ +@@ -2955,7 +2955,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 40 VARIABLE_SCOPE GLOBAL @@ -847,7 +838,7 @@ VARIABLE_COMMENT Maximum number of rwlock instruments. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 256 -@@ -2955,7 +2955,7 @@ +@@ -2969,7 +2969,7 @@ GLOBAL_VALUE_ORIGIN CONFIG DEFAULT_VALUE -1 VARIABLE_SCOPE GLOBAL @@ -856,7 +847,7 @@ VARIABLE_COMMENT Maximum number of instrumented RWLOCK objects. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 104857600 -@@ -2969,7 +2969,7 @@ +@@ -2983,7 +2983,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 10 VARIABLE_SCOPE GLOBAL @@ -865,7 +856,7 @@ VARIABLE_COMMENT Maximum number of socket instruments. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 256 -@@ -2983,7 +2983,7 @@ +@@ -2997,7 +2997,7 @@ GLOBAL_VALUE_ORIGIN CONFIG DEFAULT_VALUE -1 VARIABLE_SCOPE GLOBAL @@ -874,7 +865,7 @@ VARIABLE_COMMENT Maximum number of opened instrumented sockets. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 1048576 -@@ -2997,7 +2997,7 @@ +@@ -3011,7 +3011,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 150 VARIABLE_SCOPE GLOBAL @@ -883,7 +874,7 @@ VARIABLE_COMMENT Maximum number of stage instruments. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 256 -@@ -3011,7 +3011,7 @@ +@@ -3025,7 +3025,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 178 VARIABLE_SCOPE GLOBAL @@ -892,7 +883,7 @@ VARIABLE_COMMENT Maximum number of statement instruments. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 256 -@@ -3025,7 +3025,7 @@ +@@ -3039,7 +3039,7 @@ GLOBAL_VALUE_ORIGIN CONFIG DEFAULT_VALUE -1 VARIABLE_SCOPE GLOBAL @@ -901,7 +892,7 @@ VARIABLE_COMMENT Maximum number of opened instrumented tables. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 1048576 -@@ -3039,7 +3039,7 @@ +@@ -3053,7 +3053,7 @@ GLOBAL_VALUE_ORIGIN CONFIG DEFAULT_VALUE -1 VARIABLE_SCOPE GLOBAL @@ -910,7 +901,7 @@ VARIABLE_COMMENT Maximum number of instrumented tables. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 1048576 -@@ -3053,7 +3053,7 @@ +@@ -3067,7 +3067,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 50 VARIABLE_SCOPE GLOBAL @@ -919,7 +910,7 @@ VARIABLE_COMMENT Maximum number of thread instruments. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 256 -@@ -3067,7 +3067,7 @@ +@@ -3081,7 +3081,7 @@ GLOBAL_VALUE_ORIGIN CONFIG DEFAULT_VALUE -1 VARIABLE_SCOPE GLOBAL @@ -928,7 +919,7 @@ VARIABLE_COMMENT Maximum number of instrumented threads. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 1048576 -@@ -3081,7 +3081,7 @@ +@@ -3095,7 +3095,7 @@ GLOBAL_VALUE_ORIGIN CONFIG DEFAULT_VALUE -1 VARIABLE_SCOPE GLOBAL @@ -937,7 +928,7 @@ VARIABLE_COMMENT Size of session attribute string buffer per thread. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 1048576 -@@ -3095,7 +3095,7 @@ +@@ -3109,7 +3109,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 100 VARIABLE_SCOPE GLOBAL @@ -946,7 +937,7 @@ VARIABLE_COMMENT Maximum number of rows in SETUP_ACTORS. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 1024 -@@ -3109,7 +3109,7 @@ +@@ -3123,7 +3123,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 100 VARIABLE_SCOPE GLOBAL @@ -955,7 +946,7 @@ VARIABLE_COMMENT Maximum number of rows in SETUP_OBJECTS. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 1048576 -@@ -3123,7 +3123,7 @@ +@@ -3137,7 +3137,7 @@ GLOBAL_VALUE_ORIGIN CONFIG DEFAULT_VALUE -1 VARIABLE_SCOPE GLOBAL @@ -964,7 +955,7 @@ VARIABLE_COMMENT Maximum number of instrumented users. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 1048576 -@@ -3193,7 +3193,7 @@ +@@ -3207,7 +3207,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 32768 VARIABLE_SCOPE SESSION @@ -973,7 +964,7 @@ VARIABLE_COMMENT The size of the buffer that is allocated when preloading indexes NUMERIC_MIN_VALUE 1024 NUMERIC_MAX_VALUE 1073741824 -@@ -3221,7 +3221,7 @@ +@@ -3235,7 +3235,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 15 VARIABLE_SCOPE SESSION @@ -982,7 +973,7 @@ VARIABLE_COMMENT Number of statements about which profiling information is maintained. If set to 0, no profiles are stored. See SHOW PROFILES. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 100 -@@ -3235,7 +3235,7 @@ +@@ -3249,7 +3249,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 5 VARIABLE_SCOPE SESSION @@ -991,7 +982,7 @@ VARIABLE_COMMENT Seconds between sending progress reports to the client for time-consuming statements. Set to 0 to disable progress reporting. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 4294967295 -@@ -3291,10 +3291,10 @@ +@@ -3305,10 +3305,10 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 0 VARIABLE_SCOPE SESSION ONLY @@ -1004,7 +995,7 @@ NUMERIC_BLOCK_SIZE 1 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -3305,7 +3305,7 @@ +@@ -3319,7 +3319,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 16384 VARIABLE_SCOPE SESSION @@ -1013,7 +1004,7 @@ VARIABLE_COMMENT Allocation block size for query parsing and execution NUMERIC_MIN_VALUE 1024 NUMERIC_MAX_VALUE 4294967295 -@@ -3319,7 +3319,7 @@ +@@ -3333,7 +3333,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 1048576 VARIABLE_SCOPE GLOBAL @@ -1022,7 +1013,7 @@ VARIABLE_COMMENT Don't cache results that are bigger than this NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 4294967295 -@@ -3333,7 +3333,7 @@ +@@ -3347,7 +3347,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 4096 VARIABLE_SCOPE GLOBAL @@ -1031,7 +1022,7 @@ VARIABLE_COMMENT The minimum size for blocks allocated by the query cache NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 4294967295 -@@ -3350,7 +3350,7 @@ +@@ -3364,7 +3364,7 @@ VARIABLE_TYPE BIGINT UNSIGNED VARIABLE_COMMENT The memory allocated to store results from old queries NUMERIC_MIN_VALUE 0 @@ -1040,7 +1031,7 @@ NUMERIC_BLOCK_SIZE 1024 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -3403,7 +3403,7 @@ +@@ -3417,7 +3417,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 24576 VARIABLE_SCOPE SESSION @@ -1049,7 +1040,7 @@ VARIABLE_COMMENT Persistent buffer for query parsing and execution NUMERIC_MIN_VALUE 1024 NUMERIC_MAX_VALUE 4294967295 -@@ -3417,7 +3417,7 @@ +@@ -3431,7 +3431,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 4096 VARIABLE_SCOPE SESSION @@ -1058,7 +1049,7 @@ VARIABLE_COMMENT Allocation block size for storing ranges during optimization NUMERIC_MIN_VALUE 4096 NUMERIC_MAX_VALUE 4294967295 -@@ -3431,7 +3431,7 @@ +@@ -3445,7 +3445,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 131072 VARIABLE_SCOPE SESSION @@ -1067,7 +1058,7 @@ VARIABLE_COMMENT Each thread that does a sequential scan allocates a buffer of this size for each table it scans. If you do many sequential scans, you may want to increase this value NUMERIC_MIN_VALUE 8192 NUMERIC_MAX_VALUE 2147483647 -@@ -3459,7 +3459,7 @@ +@@ -3473,7 +3473,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 262144 VARIABLE_SCOPE SESSION @@ -1076,7 +1067,7 @@ VARIABLE_COMMENT When reading rows in sorted order after a sort, the rows are read through this buffer to avoid a disk seeks NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 2147483647 -@@ -3739,10 +3739,10 @@ +@@ -3753,10 +3753,10 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 8388608 VARIABLE_SCOPE SESSION @@ -1089,7 +1080,7 @@ NUMERIC_BLOCK_SIZE 1 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -3781,7 +3781,7 @@ +@@ -3795,7 +3795,7 @@ GLOBAL_VALUE_ORIGIN CONFIG DEFAULT_VALUE 0 VARIABLE_SCOPE SESSION @@ -1098,7 +1089,7 @@ VARIABLE_COMMENT Uniquely identifies the server instance in the community of replication partners NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 4294967295 -@@ -3907,7 +3907,7 @@ +@@ -3921,7 +3921,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 0 VARIABLE_SCOPE GLOBAL @@ -1107,7 +1098,7 @@ VARIABLE_COMMENT Maximum number of parallel threads to use on slave for events in a single replication domain. When using multiple domains, this can be used to limit a single domain from grabbing all threads and thus stalling other domains. The default of 0 means to allow a domain to grab as many threads as it wants, up to the value of slave_parallel_threads. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 16383 -@@ -3949,7 +3949,7 @@ +@@ -3963,7 +3963,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 1073741824 VARIABLE_SCOPE GLOBAL @@ -1116,7 +1107,7 @@ VARIABLE_COMMENT The maximum packet length to sent successfully from the master to slave. NUMERIC_MIN_VALUE 1024 NUMERIC_MAX_VALUE 1073741824 -@@ -3977,7 +3977,7 @@ +@@ -3991,7 +3991,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 131072 VARIABLE_SCOPE GLOBAL @@ -1125,7 +1116,7 @@ VARIABLE_COMMENT Limit on how much memory SQL threads should use per parallel replication thread when reading ahead in the relay log looking for opportunities for parallel replication. Only used when --slave-parallel-threads > 0. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 2147483647 -@@ -4005,7 +4005,7 @@ +@@ -4019,7 +4019,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 0 VARIABLE_SCOPE GLOBAL @@ -1134,7 +1125,7 @@ VARIABLE_COMMENT If non-zero, number of threads to spawn to apply in parallel events on the slave that were group-committed on the master or were logged with GTID in different replication domains. Note that these threads are in addition to the IO and SQL threads, which are always created by a replication slave NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 16383 -@@ -4061,7 +4061,7 @@ +@@ -4075,7 +4075,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 10 VARIABLE_SCOPE GLOBAL @@ -1143,7 +1134,7 @@ VARIABLE_COMMENT Number of times the slave SQL thread will retry a transaction in case it failed with a deadlock or elapsed lock wait timeout, before giving up and stopping NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 4294967295 -@@ -4089,7 +4089,7 @@ +@@ -4103,7 +4103,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 2 VARIABLE_SCOPE GLOBAL @@ -1152,7 +1143,7 @@ VARIABLE_COMMENT If creating the thread takes longer than this value (in seconds), the Slow_launch_threads counter will be incremented NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 31536000 -@@ -4148,7 +4148,7 @@ +@@ -4162,7 +4162,7 @@ VARIABLE_TYPE BIGINT UNSIGNED VARIABLE_COMMENT Each thread that needs to do a sort allocates a buffer of this size NUMERIC_MIN_VALUE 1024 @@ -1161,7 +1152,7 @@ NUMERIC_BLOCK_SIZE 1 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -4439,7 +4439,7 @@ +@@ -4453,7 +4453,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 256 VARIABLE_SCOPE GLOBAL @@ -1170,7 +1161,7 @@ VARIABLE_COMMENT The soft upper limit for number of cached stored routines for one connection. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 524288 -@@ -4537,7 +4537,7 @@ +@@ -4551,10 +4551,10 @@ GLOBAL_VALUE_ORIGIN AUTO DEFAULT_VALUE 400 VARIABLE_SCOPE GLOBAL @@ -1178,17 +1169,21 @@ +VARIABLE_TYPE INT UNSIGNED VARIABLE_COMMENT The number of cached table definitions NUMERIC_MIN_VALUE 400 - NUMERIC_MAX_VALUE 524288 -@@ -4551,7 +4551,7 @@ - GLOBAL_VALUE_ORIGIN COMPILE-TIME +-NUMERIC_MAX_VALUE 524288 ++NUMERIC_MAX_VALUE 2097152 + NUMERIC_BLOCK_SIZE 1 + ENUM_VALUE_LIST NULL + READ_ONLY NO +@@ -4565,7 +4565,7 @@ + GLOBAL_VALUE_ORIGIN CONFIG DEFAULT_VALUE 2000 VARIABLE_SCOPE GLOBAL -VARIABLE_TYPE BIGINT UNSIGNED +VARIABLE_TYPE INT UNSIGNED VARIABLE_COMMENT The number of cached open tables - NUMERIC_MIN_VALUE 1 + NUMERIC_MIN_VALUE 10 NUMERIC_MAX_VALUE 1048576 -@@ -4565,7 +4565,7 @@ +@@ -4579,7 +4579,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 0 VARIABLE_SCOPE GLOBAL @@ -1197,7 +1192,7 @@ VARIABLE_COMMENT How many threads we should keep in a cache for reuse NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 16384 -@@ -4579,7 +4579,7 @@ +@@ -4593,7 +4593,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 10 VARIABLE_SCOPE GLOBAL @@ -1206,7 +1201,7 @@ VARIABLE_COMMENT Permits the application to give the threads system a hint for the desired number of threads that should be run at the same time.This variable has no effect, and is deprecated. It will be removed in a future release. NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 512 -@@ -4764,7 +4764,7 @@ +@@ -4778,7 +4778,7 @@ VARIABLE_TYPE BIGINT UNSIGNED VARIABLE_COMMENT If an internal in-memory temporary table exceeds this size, MariaDB will automatically convert it to an on-disk MyISAM or Aria table. NUMERIC_MIN_VALUE 1024 @@ -1215,7 +1210,7 @@ NUMERIC_BLOCK_SIZE 1 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -4775,7 +4775,7 @@ +@@ -4789,7 +4789,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 8192 VARIABLE_SCOPE SESSION @@ -1224,7 +1219,7 @@ VARIABLE_COMMENT Allocation block size for transactions to be stored in binary log NUMERIC_MIN_VALUE 1024 NUMERIC_MAX_VALUE 134217728 -@@ -4789,7 +4789,7 @@ +@@ -4803,7 +4803,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 4096 VARIABLE_SCOPE SESSION @@ -1233,7 +1228,7 @@ VARIABLE_COMMENT Persistent buffer for transactions to be stored in binary log NUMERIC_MIN_VALUE 1024 NUMERIC_MAX_VALUE 134217728 -@@ -4887,7 +4887,7 @@ +@@ -4901,7 +4901,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 28800 VARIABLE_SCOPE SESSION @@ -1242,7 +1237,7 @@ VARIABLE_COMMENT The number of seconds the server waits for activity on a connection before closing it NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 31536000 -@@ -4991,7 +4991,7 @@ +@@ -5005,7 +5005,7 @@ COMMAND_LINE_ARGUMENT OPTIONAL VARIABLE_NAME OPEN_FILES_LIMIT VARIABLE_SCOPE GLOBAL @@ -1251,7 +1246,7 @@ VARIABLE_COMMENT If this is not 0, then mysqld will use this value to reserve file descriptors to use with setrlimit(). If this value is 0 then mysqld will reserve max_connections*5 or max_connections + table_cache*2 (whichever is larger) number of file descriptors NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 4294967295 -@@ -5004,7 +5004,7 @@ +@@ -5018,7 +5018,7 @@ VARIABLE_TYPE BIGINT UNSIGNED VARIABLE_COMMENT Sets the internal state of the RAND() generator for replication purposes NUMERIC_MIN_VALUE 0 @@ -1260,7 +1255,7 @@ NUMERIC_BLOCK_SIZE 1 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -5014,7 +5014,7 @@ +@@ -5028,7 +5028,7 @@ VARIABLE_TYPE BIGINT UNSIGNED VARIABLE_COMMENT Sets the internal state of the RAND() generator for replication purposes NUMERIC_MIN_VALUE 0 @@ -1269,7 +1264,7 @@ NUMERIC_BLOCK_SIZE 1 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -5099,7 +5099,7 @@ +@@ -5113,7 +5113,7 @@ VARIABLE_NAME LOG_TC_SIZE GLOBAL_VALUE_ORIGIN AUTO VARIABLE_SCOPE GLOBAL From ad376a05fa3b817c05636bf9b36f40953c34bdfb Mon Sep 17 00:00:00 2001 From: Thirunarayanan Balathandayuthapani Date: Thu, 17 Jan 2019 13:09:14 +0530 Subject: [PATCH 17/18] MDEV-18279 MLOG_FILE_WRITE_CRYPT_DATA fails to set the crypt_data->type for tablespace. Problem: ======== MLOG_FILE_WRITE_CRYPT_DATA redo log fails to apply type for the crypt_data present in the space. While processing the double-write buffer pages, page fails to decrypt. It leads to warning message. Fix: ==== Set the type while parsing MLOG_FILE_WRITE_CRYPT_DATA redo log. If type and length is of invalid type then mark it as corrupted. --- storage/innobase/fil/fil0crypt.cc | 9 ++++++--- storage/xtradb/fil/fil0crypt.cc | 9 ++++++--- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/storage/innobase/fil/fil0crypt.cc b/storage/innobase/fil/fil0crypt.cc index ded17736177..fb84b5703bf 100644 --- a/storage/innobase/fil/fil0crypt.cc +++ b/storage/innobase/fil/fil0crypt.cc @@ -529,10 +529,12 @@ fil_parse_write_crypt_data( uint len = mach_read_from_1(ptr); ptr += 1; - ut_a(type == CRYPT_SCHEME_UNENCRYPTED || - type == CRYPT_SCHEME_1); // only supported + if ((type != CRYPT_SCHEME_1 && type != CRYPT_SCHEME_UNENCRYPTED) + || len != CRYPT_SCHEME_1_IV_LEN) { + *err = DB_CORRUPTION; + return NULL; + } - ut_a(len == CRYPT_SCHEME_1_IV_LEN); // only supported uint min_key_version = mach_read_from_4(ptr); ptr += 4; @@ -551,6 +553,7 @@ fil_parse_write_crypt_data( crypt_data->page0_offset = offset; crypt_data->min_key_version = min_key_version; crypt_data->encryption = encryption; + crypt_data->type = type; memcpy(crypt_data->iv, ptr, len); ptr += len; diff --git a/storage/xtradb/fil/fil0crypt.cc b/storage/xtradb/fil/fil0crypt.cc index ded17736177..fb84b5703bf 100644 --- a/storage/xtradb/fil/fil0crypt.cc +++ b/storage/xtradb/fil/fil0crypt.cc @@ -529,10 +529,12 @@ fil_parse_write_crypt_data( uint len = mach_read_from_1(ptr); ptr += 1; - ut_a(type == CRYPT_SCHEME_UNENCRYPTED || - type == CRYPT_SCHEME_1); // only supported + if ((type != CRYPT_SCHEME_1 && type != CRYPT_SCHEME_UNENCRYPTED) + || len != CRYPT_SCHEME_1_IV_LEN) { + *err = DB_CORRUPTION; + return NULL; + } - ut_a(len == CRYPT_SCHEME_1_IV_LEN); // only supported uint min_key_version = mach_read_from_4(ptr); ptr += 4; @@ -551,6 +553,7 @@ fil_parse_write_crypt_data( crypt_data->page0_offset = offset; crypt_data->min_key_version = min_key_version; crypt_data->encryption = encryption; + crypt_data->type = type; memcpy(crypt_data->iv, ptr, len); ptr += len; From c1aae370879490dc0a3cd63c5b1010fa21b1f62c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Thu, 17 Jan 2019 10:11:02 +0200 Subject: [PATCH 18/18] Re-record results for the changed max_value of table_definition_cache --- .../suite/sys_vars/r/sysvars_server_embedded,32bit.rdiff | 8 ++------ .../suite/sys_vars/r/sysvars_server_embedded.result | 2 +- .../sys_vars/r/sysvars_server_notembedded,32bit.rdiff | 8 ++------ .../suite/sys_vars/r/sysvars_server_notembedded.result | 2 +- 4 files changed, 6 insertions(+), 14 deletions(-) diff --git a/mysql-test/suite/sys_vars/r/sysvars_server_embedded,32bit.rdiff b/mysql-test/suite/sys_vars/r/sysvars_server_embedded,32bit.rdiff index d5d41e3a2a6..8e74f84fcd2 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_server_embedded,32bit.rdiff +++ b/mysql-test/suite/sys_vars/r/sysvars_server_embedded,32bit.rdiff @@ -1125,7 +1125,7 @@ VARIABLE_COMMENT The soft upper limit for number of cached stored routines for one connection. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 524288 -@@ -3851,10 +3851,10 @@ +@@ -3851,7 +3851,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 400 VARIABLE_SCOPE GLOBAL @@ -1133,11 +1133,7 @@ +VARIABLE_TYPE INT UNSIGNED VARIABLE_COMMENT The number of cached table definitions NUMERIC_MIN_VALUE 400 --NUMERIC_MAX_VALUE 524288 -+NUMERIC_MAX_VALUE 2097152 - NUMERIC_BLOCK_SIZE 1 - ENUM_VALUE_LIST NULL - READ_ONLY NO + NUMERIC_MAX_VALUE 2097152 @@ -3865,7 +3865,7 @@ GLOBAL_VALUE_ORIGIN CONFIG DEFAULT_VALUE 2000 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 2b3ecc36772..4da76bdaec1 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result +++ b/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result @@ -3854,7 +3854,7 @@ VARIABLE_SCOPE GLOBAL VARIABLE_TYPE BIGINT UNSIGNED VARIABLE_COMMENT The number of cached table definitions NUMERIC_MIN_VALUE 400 -NUMERIC_MAX_VALUE 524288 +NUMERIC_MAX_VALUE 2097152 NUMERIC_BLOCK_SIZE 1 ENUM_VALUE_LIST NULL READ_ONLY NO diff --git a/mysql-test/suite/sys_vars/r/sysvars_server_notembedded,32bit.rdiff b/mysql-test/suite/sys_vars/r/sysvars_server_notembedded,32bit.rdiff index 93febe46928..80e08c6f65c 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_server_notembedded,32bit.rdiff +++ b/mysql-test/suite/sys_vars/r/sysvars_server_notembedded,32bit.rdiff @@ -1161,7 +1161,7 @@ VARIABLE_COMMENT The soft upper limit for number of cached stored routines for one connection. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 524288 -@@ -4551,10 +4551,10 @@ +@@ -4551,7 +4551,7 @@ GLOBAL_VALUE_ORIGIN AUTO DEFAULT_VALUE 400 VARIABLE_SCOPE GLOBAL @@ -1169,11 +1169,7 @@ +VARIABLE_TYPE INT UNSIGNED VARIABLE_COMMENT The number of cached table definitions NUMERIC_MIN_VALUE 400 --NUMERIC_MAX_VALUE 524288 -+NUMERIC_MAX_VALUE 2097152 - NUMERIC_BLOCK_SIZE 1 - ENUM_VALUE_LIST NULL - READ_ONLY NO + NUMERIC_MAX_VALUE 2097152 @@ -4565,7 +4565,7 @@ GLOBAL_VALUE_ORIGIN CONFIG DEFAULT_VALUE 2000 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 8df07cdefbd..3e34bfce8f9 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result +++ b/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result @@ -4554,7 +4554,7 @@ VARIABLE_SCOPE GLOBAL VARIABLE_TYPE BIGINT UNSIGNED VARIABLE_COMMENT The number of cached table definitions NUMERIC_MIN_VALUE 400 -NUMERIC_MAX_VALUE 524288 +NUMERIC_MAX_VALUE 2097152 NUMERIC_BLOCK_SIZE 1 ENUM_VALUE_LIST NULL READ_ONLY NO